Repository navigation
Conversation
benaadams
force-pushed
the
feat/canonical-cil
branch
from
November 16, 2026 02:22
b0fac33 to
2d85785
Compare
ParameterEvidence, ConstrainedCalls, GenericOwners, NativeManagedDispatch, LookupScaling and DecodedOpcodes read the defined methods, the decoded form and the literal instructions through the helpers in GeneratedEvidence.cs instead of a pattern of their own.
…forgery The component invalidation check edits the add the helper's decoder reads through the helper that refuses a method kept as a literal.
… test helpers Brings the extractor's reading of a field operand's name from its definition's body in every raw method, the check that a specialized body's closed raw method names its field operand, the hole corpus recorded over the merged extractor and the name of the link key fact in the binding guide. No file conflicted; Tests/ConstrainedCalls.cs keeps both the method count through the shared helper and the incoming field operand check.
Brings in the tests that read or rewrite generated method text, moved onto shared helpers that understand a method defined from its decoder. Tests/GeneratedEvidence.cs gains the helpers: one forges the decoder call with a structure update of the decoded method, one edits the raw definition the decoder reads, one forges the declared return type, and three read whether and from what a method is decoded. Each fails on a method kept as a literal, so a reader never takes an absent body for an empty one. GenericEvidence, PointerOperations, StackAllocation, ReferenceInstructions, Objects and ConsumerComponents forge through the helpers; every rejection test is kept and names the check that refuses it. ParameterEvidence, ConstrainedCalls, GenericOwners, NativeManagedDispatch, LookupScaling and DecodedOpcodes read through them. Nothing conflicted.
The raw call opcode (0x28) is now `Instruction.call (method : MethodRef) (prefixes : CallPrefixes)`, with `tail.` and `constrained.` carried as prefixes. Its target is the link at its pc, so the lowered `call`/`tailCall` index-and-count forms and their step arm are gone; the argument count is `method.argumentCount`. - Instruction.ofRaw? decodes opcode 40 to the call its operand names; Method.ofRaw?, Method.ofBody? and decodedProgram? take the link table, so cil_decoded_method defines methods with calls. - linksOfCode implies no link for a call; Method.withCode keeps only implied links, so a body with calls states its links. ManagedCallsValid requires ascending keys bounded by the code and a .direct link at every call pc, read by one walk beside the code. - The call check ties the operand to the call site's method and the link to its token; constrained calls require the constrained prefix and no tail prefix. FeatureFlowValid and calleeConstant read the link of the pc. - Forwards, ForwardsOut and WP.load_call_store take the call's MethodRef and its arity. - MethodIdentity and StructuralLabels state call facts over the MethodRef; a dsimproc reduces MethodRef.argumentCount of a literal during stepping. - The extractor writes each call over its closed operand term and passes the link table to the decoder, and decodes methods with plain static calls.
…ranch Brings in the shared decoded-method helpers of Tests/GeneratedEvidence.cs and the forgeries and readers rewritten onto them. The merge had no conflicts; every file keeps both sides.
Raw newobj (0x73) decodes to `.newobj constructor`, where `constructor` is the
typed MethodRef its operand names. What it builds and which method it enters
come from the link of its pc in the method's table: `.aggregate callee size`
for a value type, `.object callee bases size` for a class. The lowered
`newAggregate` and `newObject` instructions and their translator arms are
gone.
Link form: each method's links are one named table, `method{n}Links`, of
`(pc, method{n}Link{pc})` entries. The literal states `links := method{n}Links`
and the decoder takes the same constant, `Method.ofRaw? profile environment
method{n}Links original typeArguments`, so a decoded method's links are the
extractor's and there is no second representation. `Instruction.readsLink`
marks the instructions whose step reads the table. ManagedCallsValid checks
each pc with the link the table gives it: a non-construction must have the
link its code implies, and a live newobj must pass validateConstructionWith,
which requires a raw managed newobj site naming exactly the instruction's
constructor, the linked method to be the one the site names, an `.object`
link for a class constructor with an object receiver and an `.aggregate` link
for a value type, the link's bases to be those the constructor's raw method
records, and the size to be one slot per instance field. A forged link index,
kind, base list or size is rejected.
The extractor's table of decoded opcodes gains newobj. A newobj whose
constructor the literal emits as a runtime model (span constructors,
exception constructors, System.Object) keeps its method's literal through the
RuntimeMethod refusal.
objectSiteType, StepEffect, StepContract and SiteConsistent take the pc, and
ObjectSitesConsistent quantifies over pcs of each body.
Brings in the helpers in Tests/GeneratedEvidence.cs that read and forge a
method defined from its decoder, and the tests moved onto them.
The helpers now match and write the decoder call with the method's link table,
`Method.ofRaw? profile environment method{n}Links original typeArguments`, and
a forged decoder takes and passes on the table.
The one conflict, in Tests/GenericEvidence.cs, kept the link forgeries that edit
the named `method{n}Links` table: the dropped link, the link at a wrong pc and
the link at a non-call each change the table that both a literal and a decoded
method read, and each is still refused by the method's ManagedCallsValid
decision.
Call sites name their method and take their target from the link at their pc, so the C# tests forge a call's target by its link definition (ForgeLink, DirectLinks in Tests/GeneratedEvidence.cs), forge a decoded method's links through the table its decoder is given, and check the rendered call and tail prefix. The managed-call cost fixtures, the embedding fixtures and the stepping calls workloads write the call over a MethodRef with an explicit link table.
step_newAggregate, step_newAggregate_action and run_newAggregate_of_contract named the deleted lowered instruction; they are now step_newobj_aggregate, step_newobj_aggregate_action and run_newobj_aggregate_of_contract. Long lines from the conversion are wrapped to the limits.
…ow rejections by method A call implies no link, so the binding and embedding docs and the skills supply a body's call links after withCode, and the parametric-body example writes its link table over the callee parameter. Rejection tests match a decided-false FeatureFlowValid by the method's own certificate arguments (FeatureObligation), since the printed obligation now carries the method's link reader between the constants and the closed signature.
…traction does The constructions body names its constructor by a full MethodRef literal, the form an extraction emits, instead of a structure update of MethodRef.arity.
…ts equation The newobj step equation matches on the link at its pc. With the link fact applied only in the second pass, simp carried and simplified both the value-type and the class arm before the match reduced. cil_checked_linked_step_by_equations adds the link fact to the first pass, so only the linked arm is simplified. Constructions stepping (frontend HB / kernel HB per instruction): instructions 16 64 256 base b921cb2 472527 / 7299 433397 / 4258 424162 / 3497 before (7c7293f) 529335 / 8570 495324 / 4739 487198 / 3781 named constant 527838 / 8555 494385 / 4729 486455 / 3772 count dsimproc 529376 / 8570 495369 / 4739 487244 / 3781 link in first pass 436205 / 6811 393267 / 4079 382842 / 3396 The named-constant row writes the constructor as a reducible definition the body names; the count row reduces parameters.length of a literal MethodRef by a dsimproc. Neither moves the row by more than 0.3%; only the link pass does.
step_call_eq now states a call's step as callStep of the link at its pc. Stepping rewrites the call's argument count and prefixes in place; under a match on the link, the kernel checked that rewrite by unfolding the matcher and evaluating the link table's read, which costs the pc's position in the table, so a body of n calls cost the square of n. A regular definition lets the kernel compare the arguments instead. The calls and tablecalls stepping rows measured 10827, 16474 and 47170 kernel heartbeats per instruction at 16, 64 and 256 before this change.
The first pass of a newobj step took every supplied fact along with the link fact, so caller facts such as allocation results rewrote before the step equation's guards were simplified. Only the generated link fact now joins the first pass; supplied facts apply in the second pass as for any other step. Constructions stepping (frontend HB / kernel HB per instruction): instructions 16 64 256 base b921cb2 472527 / 7299 433397 / 4258 424162 / 3497 all facts first pass 436767 / 6811 393875 / 4079 383449 / 3396 link fact only 438693 / 6825 395870 / 4082 385510 / 3396 The link fact accounts for the gain; supplied facts in the first pass add 0.5%.
Brings in newobj as one decoded instruction, .newobj over its constructor's
MethodRef, in place of the lowered newAggregate and newObject forms, whose
instructions, translator records and step lemmas are deleted.
Each method states one named link table that its literal, its evidence and
its decoder all take, so a decoded method's links are the extractor's.
ManagedCallsValid ties every live newobj to its raw site: the site names the
instruction's constructor, the linked method is the one the site names, a
class gets an object link and a value type an aggregate link, and the bases
and size match the constructor's raw method. Negative tests reject a forged
link index, kind, base list, size, a missing link, a call opcode and a
constructor owner the site does not name.
The stepper rewrites a newobj step's link fact in the pass that applies its
equation, so only the arm of the link's kind is simplified. Constructions
stepping measures 438693 / 395870 / 385510 frontend heartbeats per
instruction at 16 / 64 / 256, against 472527 / 433397 / 424162 before.
Consumer-visible: step_newobj_eq; the aggregate lemmas are named for newobj
and take an aggregate link premise; StepEffect, StepContract, SiteConsistent
and objectSiteType take a pc; step_callee concludes readsLink; extractions
write method{n}Links, methodEvidence.links and method{n}_links.
2,595 of 3,742 admitted corpus methods are defined from their decoder.
Constructors of span, exception and System.Object stay literal models.
Nothing conflicted.
The extractor's own code is the corpus, so replacing the NewAggregate and NewObject records with Newobj and MethodRef moves it: 3,742 of 13,284 methods are admitted and 2,595 are defined from their decoder. canonical-methods.txt drops the 14 getters and init setters of the two deleted records, which no longer exist, and gains 304 methods. The hole corpus skips 9,542 refused methods.
…r calls The corpus now has 13,402 methods, 3,759 of them admitted and 3,669 defined from their decoder. LeanEmitter.RecursionDepth, whose first refusal was a Math call, decodes in full, and the ModelCall record carries the operation it runs as, so its parameterless constructor leaves the list and its three new members join it. 90 methods keep a literal: 34 stop at callvirt, 23 at fields, 18 at ldstr and 15 at a translated call or construction.
…ummary DivisionIntrinsics.UnsafeLowNext returns UnsafeLow of its argument plus one. UnsafeLow runs Vector128.CreateScalarUnsafe and GetElement through their runtime models, calls without a link, so its record decodes in full and its contract binds as a DecodedSummary like any other body. The VectorSummary example proves the caller's result once by stepping UnsafeLow and once from that summary, and runs in the core suite. Tests/SummaryCalls.cs forges the original of UnsafeLow to read the other lane: the body check refuses the record and the summary rests on sorryAx. The compiler coverage baseline admits the new caller under every compiler column. The examples, contract and validation pages and the proof-writing skill describe the example.
ModelsAgree takes the feature profile since a modelled call must be available under the profile of its method, and the cost row of Tests/LookupScaling.cs still wrote the statement without it, so the generated file did not elaborate and the lookups job of run 44072748947 failed. The row states the scalar profile; it costs 205,276, 661,306 and 2,492,234 heartbeats at 8, 32 and 128 sites.
…entory The runtime model inventory asked the extractor only for the lowered form of each runtime method, and the translator now asks first whether the Lean model table models a call, which keeps its call. The integer Math helpers and the scalar vector calls moved to that path, so the inventory reported 90 definitions removed and the dispatch job of run 44072748947 failed, although the same methods are still modelled. The inventory now asks for the call model before the lowered form, as the translator does. Its recorded list keeps every earlier entry and gains the System.Object constructor, which has been a model entry since it stopped being lowered to a pop: 474 definitions in 44 families.
The external call check of Tests/GenericEvidence.cs replaced the emitted createScalarUnsafe64 intrinsic of DivisionIntrinsics::UnsafeEquals with another intrinsic and required ExactIntrinsicsValid to refuse it. CreateScalarUnsafe is now a modelled call, so the replacement found nothing and the evidence job of run 44072748947 failed with "Call mutation was not applied". The check forges the comparison intrinsic the body still emits, and ExactIntrinsicsValid refuses it; a forged modelled call is refused in Tests/RuntimeModels.lean.
Brings in ldelema decoding with its readonly. prefix, byte lists and binding image pages in the joined digit form, the modelled Math helpers and scalar vector calls, type definitions and nesting checked against image rows, the runtime inventory and model agreement fixes and the re-recorded corpus files. Every file merged without a conflict. Scalars.lean, GenericEvidence.cs, MetadataSlices.cs, BodyLiteral.lean, Tests/GenericEvidence.cs and the OPCODES, SOUNDNESS-EVIDENCE, SOUNDNESS-RUNTIME and VALIDATION documents keep both sides: the opaque class field heads, the generic arity rows and the new marker rejection alongside the incoming changes.
… into the vector summary The incoming side counts the calls the model table models in the runtime inventory, states the model agreement row with its profile and forges the intrinsic the external call fixture still emits. It changes only tests; no file conflicted.
…ndow The ldelema decoding commit made Instruction.ofRaw? refuse every instruction after readonly. other than ldelema, made ldelema decode its flag from the instruction before it, and added readOnlyDecodedMatches to the scalar check. With that, the readonly window decided nothing PrefixEntryFree and decoding do not, as ScalarFlowValid_iff_decodedReadOnly showed. This deletes the window (readOnlySiteWindow, readOnlySiteMatches, followsReadOnly and their lemmas), ScalarFlowValidWith, ScalarFlowValid_iff_decodedReadOnly with its helper lemmas, and MethodEvidenceValid.scalarFlowValid_decodedReadOnly. ScalarFlowValid is now the check with no readonly parameter. checkScalarSite takes the raw instruction before each site from `predecessors` (`none :: code.map some`), zipped into the list all3Flow walks, instead of `rawBefore rawAt pc`. ScalarFlowValid.instruction_checked keeps its statement at `rawBefore (raw.code[·]?) pc` and proves it through predecessors_getElem?. A branch into the address after readonly. now passes ScalarFlowValid and is refused by PrefixEntryFree, which body decoding establishes (Tests/ReadOnlyArrayReferences.lean branch_into_address_rejected). The single-site window tests are gone; the decoded-rule tests check ScalarFlowValid alone. LookupScaling no longer measures the window next to the prefix entry rule. These extractor checks refuse the same bodies before Lean sees them, and they stay: InstructionPrefixes.ValidateTaker (an instruction other than ldelema after readonly., or readonly. at the end of a body) and InstructionPrefixes.ValidateEntry (a branch into the instruction after a prefix). Neither became unreachable: the extractor runs both before it emits a body. Kernel heartbeats per site of the LookupScaling rows at 128 / 256 / 512, before the ldelema decoding commit, after it, and after this commit: | Row | Before | After decoding | This commit | | --- | --- | --- | --- | | plain addresses | 274065 / 274402 / 277621 | 292593 / 294890 / 300715 | 268857 / 268876 / 271776 | | readonly addresses | 377827 / 385402 / 396905 | 419350 / 429306 / 443981 | 344972 / 345706 / 350124 | | block copies | 462296 / 465056 / 472062 | 478759 / 483431 / 492992 | 469905 / 475862 / 489267 | | unaligned block copies | 553858 / 558367 / 568629 | 574675 / 581542 / 594935 | 563689 / 572802 / 592279 | | integer locals | 57115 / 57069 / 57472 | 61909 / 62187 / 62913 | 57701 / 57655 / 58057 | | addressed integer locals | 59743 / 59708 / 60122 | 64537 / 64825 / 65563 | 60329 / 60293 / 60707 | | native-int locals | 55581 / 57202 / 59254 | 60432 / 62375 / 64748 | 56251 / 57872 / 59924 | Every row is within 2% of the row before the decoding commit except block copies, +3.6% and +4.2% at 512 (+1.6% and +1.8% at 128). Measured at 512 copies on the parent with the decoding commit reversed and on this commit (millions of heartbeats, plain / unaligned): 241.70 / 291.14 against 250.50 / 303.25. Dropping readOnlyDecodedMatches from this commit's check saves 1.26 / 1.50, so the rest of the gap comes from walking the zipped predecessor list. The decode, method decode, decoded definition, decoded program, prefix entry and compile rows are unchanged by this commit.
benaadams
force-pushed
the
feat/canonical-cil
branch
from
November 17, 2026 14:49
7d392ae to
6f13572
Compare
…dow removal into the vector summary The incoming side streams the predecessor in the scalar certificate and drops the readonly window, with its tests, cost rows and documentation. No file conflicted.
Brings in the decoder that streams the previous instruction and drops the readonly window, with its lookup scaling rows, readonly array tests and documentation. Scalars.lean merged without a conflict and keeps both sides: the opaque class field admission next to the streamed predecessor.
Brings in the vector example for decoded summaries. DivisionIntrinsics.UnsafeLowNext returns UnsafeLow(x) + 1, and Examples/Proofs/VectorSummary.lean proves that once by stepping through UnsafeLow and its CreateScalarUnsafe and GetElement model calls, and once from a DecodedSummary of UnsafeLow, which needed no change to the summary shape. Tests/SummaryCalls.cs forges UnsafeLow to read the other lane; the body check refuses the record and the summary rests on sorryAx. The stepped proof costs 3,192,215 heartbeats, 118,705 in the kernel, and 3,488 proof objects; the summary route with its own proof, binding and decoding costs 3,506,999, 139,650 and 4,614, more on each measure for one use of a callee this small. The compiler coverage baseline gains the new caller. Nothing conflicted.
Each statement-only control of the lookups suite is now elaborated in the same file as the decision it is subtracted from. PartHeartbeats reads a heartbeat count after every part of one file, less the cost of a reading, with three readings after the first part so the evaluator is warm; the decided statement follows its stated form, so the shared header is elaborated once. This removes 39 Lean runs. The element shape rows share the 8-type, 8-site sample, which is now elaborated once. Every row keeps its bound and size; a side-by-side run of the old and new suite gives the same heartbeats to within 0.1 percent per row.
…one file Each body, tables, spelling and calli selection row of the lookups suite now reads its proof in one file: the extraction narrowed to the body obligation, with every measured proof preceded by the same theorem closed with sorry under another name, both read between heartbeat counts. The rows of one extraction share that file, so the tables row of the bulk and field extractions is read beside their body row. This removes 30 Lean runs. Every row keeps its bound and size; a side-by-side run of the old and new suite gives the same heartbeats to within 0.4 percent per row, the largest difference being 89 heartbeats on the 20-byte spelling row.
The scalar check walked a list of every site's predecessor so that each site could check that it was not an instruction other than ldelema after readonly. Walking that list cost block copies 3.6% and 4.2% per copy at 512 copies, and locals about 1%, over the check before the ldelema decoding commit. The rule now sits at the prefix site: readOnlyPrefixMatches requires the raw instruction after a readonly. to be ldelema (143), so a readonly. that ends the body is refused. That equals the follower form: a reachable readonly. falls through to the instruction after it, and PrefixEntryFree keeps every branch out of that instruction. readOnlyDecodedMatches keeps only the decoding of readonly. and ldelema, and checkScalarSite passes `rawBefore rawAt pc` to scalarEmissionMatches again, which reads the predecessor only at the sites whose decoding needs it. `predecessors` and predecessors_getElem? are gone; ScalarFlowValid.instruction_checked keeps its statement at `rawBefore (raw.code[·]?) pc`. Tests/ReadOnlyArrayReferences.lean keeps every refusal and its reason: - final_prefix_refused, wrong_followers_refused (readonly. readonly. ldelema, readonly. nop ldelema, readonly. ldelem) and prefixed_call_refused now also state that readOnlyPrefixMatches refuses the prefix site. - unaligned. ldelema, both wrong flags and another element type are refused by decoding, as before. - dead_prefix_follower_refused is new: a dead readonly. followed by a live ret that a branch reaches passes ScalarFlowValid and is refused by PrefixEntryFree. Kernel heartbeats per site of the LookupScaling rows at 128 / 256 / 512, before the ldelema decoding commit, after it, after the commit that streamed the predecessor, and after this commit: | Row | Before decoding | After decoding | Streamed | This commit | | --- | --- | --- | --- | --- | | plain addresses | 274065 / 274402 / 277621 | 292593 / 294890 / 300715 | 268857 / 268876 / 271776 | 273707 / 274038 / 277254 | | readonly addresses | 377827 / 385402 / 396905 | 419350 / 429306 / 443981 | 344972 / 345706 / 350124 | 357580 / 359265 / 364641 | | block copies | 462296 / 465056 / 472062 | 478759 / 483431 / 492992 | 469905 / 475862 / 489267 | 461259 / 464020 / 471028 | | unaligned block copies | 553858 / 558367 / 568629 | 574675 / 581542 / 594935 | 563689 / 572802 / 592279 | 552545 / 557055 / 567319 | | integer locals | 57115 / 57069 / 57472 | 61909 / 62187 / 62913 | 57701 / 57655 / 58057 | 56891 / 56845 / 57248 | | addressed integer locals | 59743 / 59708 / 60122 | 64537 / 64825 / 65563 | 60329 / 60293 / 60707 | 59519 / 59484 / 59898 | | native-int locals | 55581 / 57202 / 59254 | 60432 / 62375 / 64748 | 56251 / 57872 / 59924 | 55442 / 57063 / 59115 | Every row is at or below its value before the decoding commit. The decode, method decode, decoded definition, decoded program and prefix entry rows are unchanged, and compiling an extracted method costs 270724 and 264484 per instruction, against 271537 and 265296 for the streamed check.
Brings in two binding fixes. A class instance field typed System.Object or as a generic class is admitted in Lean as the extractor admits it: the held type of the operand is the type the signature decodes to, a class-like generic instance is an application over a head that states it is a class, and the binding check compares that head with the kind the metadata gives. The 45 corpus methods (88 admitted entries) that Lean refused with an operand mismatch are accepted, and forged heads are refused. The arity of a generic owner is tied to its GenericParam rows: an owner with no parameters carries the adjacent rows that bracket it, so a type definition with parameters named without its arguments is refused; this rests on the table being sorted by owner, as ECMA-335 requires. Each slice carries about a quarter more rows for the brackets (64,193 to 80,994 over the corpus). Over 60 corpus extractions total heartbeats rise by 3.0 percent, the tables check by 28 percent and the body check by 4 percent. Tests/SelfAdmission.cs gains an opt-in mode that checks every admitted entry in Lean, about 2.7 CPU-hours, which no suite runs. Open after this: a generic instantiation's head marker and its head are both stated by the extractor, so flipping both together is caught only by the call site's own checks. Nothing conflicted against the readonly rule at the prefix site.
The extractor gains MetadataSlices.Slice.GenericOwnerCode, which is admitted and defined from its decoder: the corpus has 13,410 methods, 3,760 admitted and 3,670 defined from their decoder. The 90 literal methods and their first refusals are unchanged.
modelStep_memory states that a runtime model of a memory operation steps exactly as the .memory instruction of that operation: both guard the operation's argumentCount operands for unspecified bits and run memoryInstruction. step_call_memory composes it with step_call_model, so a link-free call whose method's model is a memory operation rewrites to that instruction and its existing step equations apply. The runtime model tests reach a success and the unspecified-bits fault through it.
docs/VALIDATION-COVERAGE.md now says that the readonly. before a call is refused at its own site and that a live instruction after a dead readonly., which a branch reaches, is left to PrefixEntryFree, as dead_prefix_follower_refused shows.
A typed ldelem or stelem stepped through the instruction-level facts arrayLoad_of_element, arrayStore_of_write and arrayTransferInstruction, which the stepper applies under the step's bind, pair projections and shape match at every access. CIL/Safety/ArrayContents.lean now derives the step-level fact once from the element shape fact cil_resolution_facts declares: - step_ldelem_any_of_element and step_stelem_any_of_write for an integer, enum, bool or char element, from the element's address and its load or write; - step_ldelem_any_of_transfer and step_stelem_any_of_transfer for a struct or vector element, from its transfer. The lemmas carry no cil_step attribute, and no tactic library changes. The typedelements row of Tests/SteppingScaling.cs derives its four facts from body_elementShape0 and body_elementShape1. Proving the shape by rfl instead costs about 245,000 kernel heartbeats per proof (21,302 per instruction at 16). Per instruction at 16 / 58 / 254 instructions, frontend and kernel heartbeats: | Row | Frontend | Kernel | | --- | --- | --- | | typedelements, lowered to step-level facts | 273581 / 159922 / 126037 | 5811 / 2920 / 2068 | | typedelements before this commit | 275612 / 175995 / 145695 | 8019 / 3769 / 2519 | | typedelements after this commit | 256343 / 148602 / 116353 | 5859 / 2893 / 2019 | | typedsteps, supplied step facts | 262986 / 150552 / 117051 | 5697 / 2875 / 2044 | Against the lowered row, frontend is 6.3%, 7.1% and 7.7% lower and kernel 0.8% higher, 0.9% and 2.4% lower. The lowered row was measured before the history rewrite; the others on this commit's parent. The typedsteps, elements and addresses rows are unchanged.
…ded spelling A String may now be built from its UTF-8 bytes, so bytesOf of it reads those bytes instead of encoding the text in the kernel. - KernelEquation: utf8Characters_decode, the inverse of utf8Characters_encode, for any list of characters. - MetadataBytes: spelled?_bytesOf (spelled? (bytesOf s) = some s, for every String s, no condition), byteArray_of_spelled, byteString and byteString_eq. byteString bytes text h takes h : spelled? bytes = some text, decided once by cil_kernel_rfl where the string is defined. - MetadataBinding: MethodNames.spelledBy compares the owner and base bytes with bytesOf of the method's strings; spell_of_spelledBy turns it into Spell without spelling the names in the kernel. Tests: a byteString whose bytes are not its literal is refused by cil_kernel_rfl at its definition; a claim naming another stored string is refused by the check that refuses the wrong literal, with the same error, for checkTypeOperand, checkCallOperand, checkFieldOperand, methodIdentityValid, Frame.admits and Spell. The lookups suite pins bytesOf of a stored name against its literal (read cost, definition cost, literal cost in heartbeats): 20 bytes 27,474 44,043 103,840 80 bytes 92,662 119,864 604,639 320 bytes 353,187 422,903 2,614,145
A method whose signature has no GENERIC flag and that carries no run or link has no generic parameters, as ECMA-335 requires of its GenericParam rows, so the extractor no longer carries the neighbouring rows that showed it. A carried run is still read and checked against the signature's count, and a method that declares parameters keeps the neighbour rule. Over the same 60 corpus extractions against the tree without generic owner rows, total heartbeats fall from +3.02% to +1.72%, the tables check from +27.9% to +15.6% and the body check from +4.0% to +2.3%.
A typed ldelem or stelem in a generated outline now steps by
step_ldelem_any_of_element, step_stelem_any_of_write or the new
step_stelem_any_of_wide_write, citing the shape fact
cil_resolution_facts declares for its element type
(Extracted.method{n}_elementShape{k}). ProofOutline.ShapeFacts numbers
the element types in raw pc order as that command does, and an outline
refuses a typed access whose numbering it cannot reproduce.
The outline catalog gains ReadGeneric<UInt32> and ReadGeneric<UInt64>,
extracted with --type-argument; no earlier outline reached a typed
access. Tests/ResolutionFacts.lean steps a four- and an eight-byte
typed store from shape facts and checks that a four-byte shape cannot
step the eight-byte store.
Untyped array outlines change only in where the cil_checked_steps line
of an array read breaks (ArrayReadInt32, ArrayReadUInt64); the other
100 catalog outlines are byte-identical to what they were.
Cost of the correctness theorem of ReadGeneric<UInt32>, raw heartbeats
on this thread (Elab.async false):
arrayLoad_of_element 1,749,078
step_ldelem_any_of_element 1,753,154 (+0.23%)
ReadGeneric<UInt64>, step lemma 1,754,976
A specialized generic entry names its type arguments, so the generated
postcondition docstring of ReadGeneric<System.UInt32> ran past 100
columns and new-proof refused the method; the sentence now breaks before
its subject when it does not fit on one line.
The outline generator gains the shape accessors of a numeric array access and the closures of ProofOutline.ShapeFacts: the corpus has 13,417 methods, 3,764 admitted and 3,673 defined from their decoder. One more admitted method stops at ldstr, so 91 keep a literal.
memory_stepRenamed proves RuntimeModel.StepRenamed for the model of any MemoryOp, so a model table entry that resolves only memory operations adds its case to runtimeModel_stepRenamed by naming it. The model runs as memoryInstruction behind the unspecified-operand guard, and Memory.Renamed.memoryInstructionResult already relates that instruction's results on renamed memories. StepRenamed gains two premises, both required by memoryInstructionResult: - The source memory is well formed (source.WellFormed). The memory relation alone does not give the allocation and view invariants the memory instruction proofs read. - The source model step succeeds or throws (SuccessOrThrow of modelStep on the source). memoryInstructionResult relates results only for an observable source run; an invalid state or an unsupported operation has no renamed counterpart to state. Memory.Renamed.stepBoundary already holds both, as its formed and observable hypotheses, and passes them to the private stepCall. stepCall forwards them to runtimeModel_stepRenamed after rewriting the observable run by the call's link and model. The object constructor and intrinsic cases ignore the new premises. Nothing outside BoundaryStepRenaming.lean states StepRenamed or calls stepCall, so no consumer statement changes. Tests/RuntimeModels.lean instantiates the case for a whole-array view, a span copy and an out-operand division, and derives the case for any entry family that resolves only memory operations.
Program.closure read each visited method with program[index]?, so a
closure of n methods cost O(n * P) list steps in a program of P. The
search now takes a lookup: ClosureSearch.visit and run read through it,
closureWith is the only body of the search, and Program.closure is
closureWith (program[.]?) program.length root. Program.closure_eq_closureWith
rewrites a closure to closureWith over any lookup that agrees with the
list, so a proof decides it over an index stated once and pays
O(n * log P + e). No statement of closure_closed, closure_relocates or
closureEvidence_decodes changes.
program_index% (CIL/Extraction/FlowIndex.lean) writes FlowIndex.ofList
of a list as a literal tree whose leaves are the list's cell terms;
ModelTable reuses its list reader. Every extraction now states
programLength, programIndex and programIndex_get?, each checked once:
programIndex_eq is one cil_kernel_rfl against FlowIndex.ofList program,
which compares method{n} constants without unfolding them.
Tests/ProgramClosures decides its closure through the index.
Elaborating the whole Extracted.lean (raw heartbeats, Elab.async false):
| Extraction | Methods | Before | After |
| --- | --- | --- | --- |
| Arithmetic::Add | 1 | 12590029 | 12651370 (+0.49%) |
| VirtualCalls::DogLegs, largest example | 5 | 47892265 | 47983482 (+0.19%) |
| chain of 16 (generated Bodies) | 16 | 107812209 | 107980274 (+0.16%) |
| chain of 128 (generated Bodies) | 128 | 957295634 | 958228563 (+0.10%) |
The closure row of Tests/LookupScaling.cs decides each closure through
its stated index and reads n * log P + e units; it adds a long chain at
128/256/512, keeps the list form beside it, requires the four-method
tail to cost less through the index at every size, and measures stating
the index. Kernel heartbeats:
| Shape | Sizes | Through the index | Through the list |
| --- | --- | --- | --- |
| chain | 8/32/128 | 87394 / 335656 / 1422953 | 90395 / 437519 / 3533840 |
| long chain | 128/256/512 | 1422542 / 3013064 / 6568957 | - / - / 43269245 |
| fan | 32/128/512 | 140799 / 367218 / 1273057 | 144084 / 370459 / 1276182 |
| tail | 128/512/2048 | 55819 / 58512 / 61237 | 81699 / 179818 / 571795 |
Growth per unit between the last sizes and the first: chain 0.84, long
chain 1.02, fan 1.00, tail 1.01. Stating the index at 128/512/2048
costs 260137 / 857704 / 3248483 heartbeats (1.00 per method). The list
long chain at 512 was measured from a probe of the row's file.
A call of a BitOperations helper (IsPow2, PopCount, LeadingZeroCount, TrailingZeroCount, Log2, RoundUpToPowerOf2, RotateLeft, RotateRight), of the same helper an integer type declares, or of BinaryPrimitives.ReverseEndianness now keeps its call and runs the scalar intrinsic the runtime model table gives its method reference, in place of the lowered intrinsic, which no Lean check tied to its call. - CIL/Extraction/BitModels.lean adds one entry per owner and name: 8 under BitOperations, 61 on the ten integer types, and ReverseEndianness under the exact System.Memory scope. An entry's resolve gives a model only to a static, non-generic reference that takes one runtime integer type, then Int32 for a rotation, and returns the result its owner declares: Int32 for a BitOperations count, the type itself (a 64-bit word only at 64 bits) for a count the type declares, Boolean for IsPow2. Signed Log2 and signed 8- and 16-bit rotations have no entry. - modelEntries, runtimeModels_entries and runtimeModel_stepRenamed gain the entries; bitEntries_yields gives each model as an intrinsic. - BinaryTransfers reads spanMemoryScope; its private copy binaryScope of the same System.Memory literal is deleted. - Extractor/BitModels.cs holds the exact signatures and CallModel asks it first; the bit loops of BuildScalarOperations and ReverseEndianness() are removed from RuntimeModels.cs. Tests/BitModels.lean states each group's resolution, one kernel-checked test per result rule (BitOperations.PopCount gives an int word, UInt64.PopCount a long word, UInt32 and Byte counts an int word), the rejections (receiver, generic arity or method argument, wrong or mixed parameter, wrong result, signed Log2, signed narrow rotation, an undeclared helper, another owner, assembly or opcode), one mutation per group (LeadingZeroCount emitted at a PopCount site, UInt64.PopCount with an int word, ReverseEndianness(ulong) at 32 bits), each refused and each accepted by a table without the helpers, the same agreement under the scalar and AVX2 profiles, and steps against the lowered intrinsic: the counts and Log2 of zero, RoundUpToPowerOf2 of 0x80000001, and the byte reversal of a sign-extended short and sbyte. Tests/RuntimeModelInventory.txt is unchanged: 474 definitions. CallModel admits exactly the signatures Translate lowered, and signed Log2, signed 8- and 16-bit rotations and the Int128 and UInt128 BigMul forms were already absent from it. Call sites: the examples have 104 (BitOperations 32 in 30 methods, the integer types' own members 61 in 34, ReverseEndianness 11 in 11); the self-admission corpus has 2 (BitOperations.RotateRight(uint) and PopCount(ulong)). Example methods that decode in full under the scalar profile: 478 -> 552, none lost; methods kept as literals 713 -> 639. Corpus: 3,764 admitted and 3,673 decoded, unchanged. Rows, before and after: the lookups model lookup and agreement rows are unchanged (their tables are synthetic); in one file, deciding the runtime table's lookup of Math.Max costs 276,653 kernel heartbeats on the table without the helpers and 276,208 on the runtime table (8 -> 17 name groups, 49 -> 119 entries). Stepping, frontend / kernel heartbeats per instruction: calls 16/64/256 unchanged objectconstructors 16 185,725 / 4,517 -> 185,717 / 4,517 objectconstructors 256 103,425 / 2,075 -> 103,443 / 2,075 intrinsiccalls 14 248,249 / 6,492 -> 248,233 / 6,492 intrinsiccalls 62 161,284 / 3,281 -> 161,295 / 3,281
A call of PopCount, LeadingZeroCount, TrailingZeroCount or Log2 of BitOperations or of an integer type keeps its call since the bit helpers joined the runtime model table, so its operation is ModelCall(ScalarIntrinsic). Body.Pure and the scalar path walk matched only a bare ScalarIntrinsic, so an outline that reached such a count stopped there with a hole where it had stepped before. Body.Pure (ProofOutlineLoops.cs) and the result width of a pure word in the scalar path walk (ProofOutlineScalar.cs) now match the model call; cil_checked_steps already steps it with step_call_intrinsic. No extractor path emits a bare count intrinsic any more, so the bare pattern is replaced, not kept beside it. No outline matcher ever covered the other bit helpers (rotations, IsPow2, RoundUpToPowerOf2, ReverseEndianness), as a bare intrinsic or a model call; ReverseI16 and PowerU32 stay outlined with a hole, as before. Tests/ProofOutlines.cs adds Population64 (BitOperations.PopCount of a ulong) and PopulationU32 (UInt32.PopCount) and checks each outline steps its whole body. With the matchers reverted, the Population64 check fails. outlines-control passes: 41 outlines.
NarrowEvidence removes every generated theorem except the obligation under test, and matched a theorem name with \w+. An extraction now states programIndex_get?, whose name that pattern does not match, so a narrowed source kept it while removing programIndex_eq, which its proof cites, and the positive batch of the generic evidence check failed with an unknown identifier. The name pattern now accepts the ?, ! and ' a Lean identifier may carry.
A regex whose pattern is a constant is now a [GeneratedRegex] method. This converts the constant patterns among the inline regexes this branch added, and every constant pattern of the two evidence helpers Tests/GeneratedEvidence.cs and Tests/RejectedEvidence.cs: 31 call sites in ten files (GeneratedEvidence, RejectedEvidence, IncrementalEvidence, LookupScaling, ManagedDispatch, PreparedLeanFixtures, ReferenceAddOutlines, StrictBindingDecoding, SummaryCalls and scripts/TestSelectVerification). A pattern built at run time stays inline: one interpolated with a method number, a theorem name or a byte literal, one joined with Regex.Escape of a value, and the pattern parameters of ChangeByte, ChangeLiteralByte and TokenCost. The one-line theorem pattern of the kernel refutation check accepts the ?, ! and ' a Lean name may end in, as the narrowing pattern does. RejectedEvidence keeps its own import pattern because Tests/TranslationAudit.cs includes it without GeneratedEvidence. The inline regexes that predate this branch are unchanged in the other eight files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This draft works toward #568, #582, #596, #597 and #598. Decoded CIL as the sole executable representation remains the objective. On this head the extractor defines every method that decodes in full from its decoder (3,673 of 3,764 admitted methods of its own assembly); the lowered instruction language and the translator still exist for the rest.
The branch history was rewritten on 2026-11-16 to give every merge commit a subject and a description; no file content changed. Commit hashes in the entries below that predate that rewrite name commits of the old history, which CI runs still refer to by run number.
Implemented
Method.argumentAccesswith generated factsmethod{n}_argumentAccess{i}and thereduceArgumentAccesssimproc incil_step. The facts cost about 8,400 kernel-checked heartbeats per argument at 8, 32 and 128 parameters (10,800 with homes), and a lookups row fails a quadratic form.FeatureFlowValid.expandandFeatureListValid.knownprove the check accepts exactly the certificates the one-fact-per-local specification accepts.MethodTableandNativeMethodTablegain the fieldsentryCountandcounted, and a table load checks its index against the carried count. The step still costs time linear in the number of static bindings, and a load of entry i costs time linear in i.FieldRef(owner, index, type and metadata name), built byFieldRef.ofOperand?from a raw field operand; the class and static field instructions carry it. Templates write theirlinksexplicitly.ldarg.Instruction.argand its narrowing operand are deleted;ldargreads the declared signature and the parameter homes throughMethod.argumentAccess, andargumentAccess_of_evidenceproves that validated evidence reads an argument without a home at the narrowing of its storage. The 45 stepping rows are within 2% of their baseline.Instruction.ofRaw?decodes a raw opcode to the instruction ECMA-335 assigns it and refuses an operand its encoding cannot carry. 84 of the 109 instruction constructors decode from raw CIL; 25 do not yet.Tests/ValueDecoding.leandecides in the kernel a table of raw forms with the instruction each must give. Decoding costs 14,043, 14,015 and 14,007 heartbeats per instruction at 500, 2,000 and 8,000 instructions.indirectTarget, andstep_managed_call_eqstates the step with that selection as a rewrite target. The generated proofs ofcalliruns usecil_kernel_rfl, so the length of an owner identity no longer limits them; a run through a 400-byte owner is tested.ManagedCallsValidreads the link table by one walk beside the code and requires the link keys to ascend and to be call sites.ManagedCallsValid_iff_originalproves it accepts exactly what the list form accepts. Its cost per call site falls slightly from 64 to 1,024 sites, where a scan per site grew 3.23 times from 64 to 256.Tests/Objects.csverifies its 38 example proofs in one generated batch, as 22 other test files do; locally the file went from 676 s to between 107 and 163 s.MethodEvidenceValid,DeclaredValid, proved byrflin the generatedmethod{n}_declared_validated. On a 16-method fixture the shape theorems went from 4,211,835 to 774,006 heartbeats and the declared theorems add about 11,250 per method.Safety.stepsit in its first match, so neither match exceeds the 79 alternativessplithandles. The 91 generated step equations state the same facts.step_raise_faultingcosts 7.1% more and has a raised heartbeat budget.Method.ofRaw?gives the method a raw definition denotes, with each instruction decoded byInstruction.ofRaw?and the frame, signature and homes computed by the functions the evidence checks use;Method.ofBody?takes the code and the init flag from the pinned body bytes aftercheckBody, anddecodedProgram?does so for every method of an extraction.Method.ofBody?_of_decodesrewrites it with the generated body check. Decoding a method costs 24,775, 24,494 and 24,425 kernel heartbeats per instruction at 500, 2,000 and 8,000 instructions.Examples/Proofs/DecodedAdd.leanprovescorrectness_decoded: the program thatdecodedProgram?reads from the bytes ofArithmetic::Addreturns the sum of its arguments modulo 2^64. The proof names neither the emitted method nor the emitted program, and changing theaddbyte tosubin the extraction makes it fail. It costs 1.87M heartbeats and 479,000 kernel heartbeats, 1.38 and 1.24 times the proof over the emitted method.locallocis a CIL instruction:Instruction.stackAllocis deleted, the zeroing flag isDeclaredSignature.initLocals, whichDeclaredValidties to the localsinit bit of the body, andInstruction.ofRaw?decodes opcode 0xFE0F.MethodRef(owner, metadata name, signature, generic arity and method arguments); the declaring type, return type and parameter types are read from it.checkCallOperandrequires the name to spell the metadata row name, and the generic arity and method arguments to equal the row and the site. The name clause costs 41,199 and 151,448 heartbeats at 20 and 80 bytes, linear per byte.ldind,stind,ldobj,stobj,cpblkandinitblkemit to the width, sign and alignment of the raw instruction. 39 forged emissions that every check accepted are rejected, and the 25 emissions the extractor produces are accepted.ldobjandstobjof an operand type the extractor refuses accept nothing but the span no-op.Instruction.unadmitted (opcode)replacesInstruction.unsupported: it carries the raw opcode and faults when stepped.Instruction.ofRawgives the instructionofRaw?admits and a hole otherwise (ofRaw_eq_unadmitted_iff),Method.ofRaw?maps it over the code and refuses code that names an undeclared argument, andMethod.ofRaw?_codestates that each pc holds the decoding of the raw instruction there. The extractor writes the raw opcode at every hole.Instruction.ofRaw?andInstruction.ofRawtake the raw instruction before the one they decode (none at the first pc), where a prefix stands, andInstruction.ofRawCodedecodes code in one pass that carries it;ldelemais the first instruction to read it. The checks that compare an emitted instruction with its decoding take the same previous instruction, andScalarFlowValid.instruction_checkedstates the match after it.fixedBytesliteral whose code joins numerals of at most 256 bytes withNat.lorandNat.shiftLeft. The kernel keys its caches by a hash that reads only the low 64 bits of a numeral (Hashable Natandexpr_eq_fnin the Lean source), so the separate numerals the extractor wrote before, joined by++, collided when they ended in the same eight bytes and made a body check quadratic in its numerals.fixedDigitsWithinis the one splitter, over digits of any width. The body check of 125, 500 and 1,000 string tokens now costs 88,900, 92,700 and 99,800 heartbeats per instruction (89,600, 136,300 and 201,500 before), and rows over 5, 10 and 20 KB of equal-tail and random numerals bound the growth at 1.15 per byte; the former form fails them at 10 KB. Whole body obligations of bodies of at most 256 bytes rise by 0.06 to 0.46 percent. Binding pages take the same form (fixedDigitsWithin 512over one joined code): the digest proof of a 4 KB page whose chunks end in the same eight bytes costs 23.26M heartbeats against 23.25M for random ends, 506.1M against 23.0M before. The splitter lives inCIL/Extraction/FixedDigits.lean, which imports only the prelude, so a generated audit module costs 1.92M heartbeats and 1.2 s where importing it through the Lean library cost 5.25M and 2.9 s; a check inTests/BodyLiteral.leanfails when that import closure reaches a Lean module.PrefixEntryFreestates over raw code that no branch or switch arm, reachable or not, enters the instruction afterunaligned.,volatile.,tail.,constrained.,no.orreadonly.. Body decoding already refuses such a branch, socheckBody_prefixEntryFree,instantiateMethod_prefixEntryFreeandMethodEvidenceValid.prefixEntryFreegive the rule for every method with body evidence and the evidence check decides nothing new;prefixEntryFreeWithdecides it in one pass over a bit mask of the branch destinations (about 1,380 heartbeats per instruction). The extractor refuses the same bodies inInstructionPrefixes.ValidateEntrywith the blocker "Branch enters the instruction after a prefix". No corpus, example or fixture method holds such a branch.starg, addressed withldargaand read withldarg; the lowered local forms for homes are gone, and the four raw forms decode.step_relabel_faultingis proved by splitting on the first match ofstepand costs 52,100 heartbeats where it cost 212,700.Method.fieldShapeandMethod.valueShaperesolve a typed field reference or a value type against the layout environment, with one generated fact per distinct operand that the kernel checks from one layout entry: 268,814 to 271,626 heartbeats per field fact and 13,294 to 16,135 per value fact from 8 to 512 structs. No instruction reads them yet.ExceptionType, in instructions, faults, contracts and example proofs; text is produced for display only.stlocandldlocabefore a spanget_Lengthorget_Itemcall are emitted as themselves and checked against their raw instructions.StepMetadatarequires equal layout environments, and a method signature with an explicit receiver is refused in Lean by instantiation and by the metadata identity check; the declared signature check costs 9,883, 9,890 and 9,939 heartbeats per method at 1, 4 and 16 parameters.CIL.Extraction.fixedBytesinstead of list literals: checking a generated file costs 29% (Add), 25% (Countdown) and 17% (Struct) fewer heartbeats in total, and the kernel part rises 3 to 6% because each check decodes its bytes.MetadataName.ofBytes?reduces in the kernel in time linear in the name: 13,498, 35,148 and 119,302 heartbeats at 20, 80 and 320 bytes, where it cost 143,456, 1,746,460 and 26,147,681.SliceMatchesjoins the assembly block, the rows and the#USentries of one slice against a prepared image,sliceBounddecides it, and its success implies the proposition under a bounded view. Deep verification reconfirms the metadata-rows fact throughBindingAudit.metadataRows, with each distinct Assembly block checked once, beside the body-bytes fact; a forged row page must fail exactly that fact (Tests/DeepVerify.cs). An unchanged deep result is reused, also under--proof-root: its key binds the compiled import closure, each certified closure part is hashed and its header read once per process, and a failure between staging a consumer deep result and publishing it leaves no receipt and no new entry.StrictBindingalso checks a type definition of a pinned image in constant work (TypeDefAt: name, kind, field range, base and nesting, at rows the claim states as hints), with absence of a NestedClass row shown by adjacent rows and the sortedness that rests on stated as a whole-table fact (TablesSorted); no deep request uses these yet. A run that opens the certified library from the local cache, a release or the closure cache traces that stage, so a forced full verification with a warm cache shows its library stage.Guards::CountandGuards::Indexclose again andTests/Guards.csruns in the evidence suite.Tests/HoleCorpus.cspins that no admitted corpus method (3,764) gets a parameter home from dead code or holds a dead prefix other thanunaligned..cil_decoded_method method{n} := Method.ofRaw? ..., and the kernel computes the definition from the raw body. A method decodes in full when no pc holds a hole and every pc is reachable; every other method keeps its literal definition. 3,673 of the 3,764 admitted methods of the extractor's own assembly are defined this way (Tests/canonical-methods.txt), as are the examples Add, Choose, Countdown and Calls. The blockers report gives the first refusal of each of the 91 that are not:callvirt34, fields 23 (9 more since the deep binding scripts, whose records hold a 32-byte digest struct),ldstr19, a call or construction the extractor still translates 15 (an exception constructor followed bythrow13, other modelled runtime calls 2).ldindandstindare the instructionsldindandstindover a numeric kind;load64,store64andtableLoadare deleted.ldnull,castclassandisinstare instructions with decode arms;objectTestand the memory operationnullObjectare deleted.Method.ofRaw?decodes the instantiated code.ldfld,ldfldaandstfldover aFieldRef, stepped throughMethod.fieldShapeand decoded from opcodes 123 to 125. The six class field memory operations, their site and match checks and their translator arms are deleted. A class field store is admitted only of the field's stack kind. The extractor reads a field name from the bytes of its metadata row.ldsfld,ldsflda,stsfldand fieldldtokenover aFieldRef; the static memory operations are deleted, the static field tie compares the field name, and the stepper builds a static read from the body's site fact. These four instructions have no decode arm yet.newarrcarries its raw type token and steps through the element shape the layout environment gives it;newArrayandnewReferenceArrayare deleted, and aSystem.Objectelement array is refused by identity.steptake their target from the link of their pc and fault withunlinkedCallwithout one, andcil_instruction_equationsstates a link fact per call site.steprun through named functions (intrinsicCall,featureCalland the rest).RuntimeModelsAgree, a new part ofMethodEvidenceValid, ties each call to a modelled runtime method to its entry in a typed model table.memory_stepRenamedtransports the model of every memory operation under an allocation renaming, so an entry family that resolves only memory operations adds its case toruntimeModel_stepRenamedby naming it;RuntimeModel.StepRenamednow takes the well-formedness of the source memory and an observable source step. A call of aBitOperationshelper, of the same helper an integer type declares, or ofBinaryPrimitives.ReverseEndiannesskeeps its call and runs the scalar intrinsic that its entry inCIL/Extraction/BitModels.leangives its method reference (70 entries; signedLog2and signed 8- and 16-bit rotations have none); a proof outline steps the four bit counts through that call.ExecutionFault.definiteis false for an unsupported instruction and for fuel exhaustion,Settledrequires a definite fault, and the refutation lemmas takeSettled.newobjis one instruction over the typedMethodRefof its constructor, decoded from opcode 0x73;newAggregateandnewObject, their translator records and their step lemmas are deleted. Each method states one named link table,method{n}Links, which its literal, its evidence and its decoder all take, so the links of a decoded method are the ones the extractor wrote.ManagedCallsValidties every livenewobjto its raw site: the site names the instruction's constructor, the linked method is the one the site names, a class gets an object link and a value type an aggregate link, and the bases and the size match the constructor's raw method. Negative tests reject a forged link index, kind, base list and size, a missing link, a call opcode and a constructor owner the site does not name. Constructors of span and exception types keep their literal models.callis one instruction over the typedMethodRefof its target, withtail.andconstrained.carried asCallPrefixes, decoded from opcode 0x28; the loweredcallandtailCallforms with their index and count operands are deleted, the argument count is read from theMethodRefand the target from the link of the pc.Instruction.ofCallSite?decodescallandnewobjfrom a call site operand,Method.ofRaw?,Method.ofBody?anddecodedProgram?take the link table after the environment, andMethod.withCodedrops the links of both, so a rewritten body states its links again.ManagedCallsValidrequires a direct link at every call pc, tied to the site's method and token. The decoder admits a call that the extractor translates to a plain static call; every other kind of call is still translated.Mathhelpers (Min,Max,Clamp,Abs,Sign; 31 call sites in the corpus and 44 in the examples), andVector128.CreateScalarUnsafeandGetElementoverVector128andVector256ofulong(23 sites in the examples). A modelled call leaves the unspecified-operand guard to its model, which states the operands it observes; a linked managed call keeps its guard, andstep_call_linkedstates that its step is unchanged.reduceRuntimeModelevaluates the model of a closed method under a variable environment, and the stepper rewrites a modelled call whose intrinsic step the kernel cannot evaluate withstep_call_intrinsic. The intrinsic call stepping row costs 32% fewer frontend and 71% fewer kernel heartbeats; rows for instance and virtual calls record today's cost, about 61,000 heartbeats per virtual table entry.step_call_eqstates a call step ascallStepof the link at its pc, a regular definition, and every call-family step rewrites its link fact in the pass that applies its step equation. With a match on the link in the equation the kernel evaluated the table read once per site, and the calls stepping row cost 10,827, 16,474 and 47,170 kernel heartbeats per instruction at 16, 64 and 256 instructions. The row now costs 7,131, 5,397 and 4,963 kernel heartbeats (7,742, 5,800 and 5,315 before the conversion) and 801,548, 817,861 and 822,727 frontend heartbeats (821,255, 840,326 and 846,190).newobjstep in the pass that applies its step equation, so only the arm of the link's kind is simplified. The constructions stepping row costs 438,693, 395,870 and 385,510 frontend heartbeats per instruction at 16, 64 and 256 instructions (472,527, 433,397 and 424,162 before the conversion) and 6,825, 4,082 and 3,396 kernel heartbeats (7,299, 4,258 and 3,497). With the link fact one pass later the row cost 12 to 15% more than before the conversion.Tests/GeneratedEvidence.cs, which forge a decoded method through its decoder call or through the raw definition the decoder reads and fail on a method kept as a literal. Every rejection test is kept: a forged decoder is refused byDeclaredValid,MethodShapeValidorManagedCallsValid, and a changed raw instruction byScalarFlowValid.ldlen,ldelemandstelemby numeric kind, the reference load and store, the typedldelemandstelemover their element type, andnewarr. The loweredarrayLoad,arrayStoreandarrayTransfermemory operations and the managed table length and element operations are deleted with their translator records. A typed access resolves its element shape from the layout environment, which binds the width its step uses, and a by-ref-like element is refused there. An object type binds only to a pinned class or toSystem.String, so an array of an interface orSystem.Objectelement is refused in Lean and no longer only by the extractor. Stepping an element load or store by kind costs what the lowered forms cost (278,864 against 278,242 frontend heartbeats per instruction at 10 instructions). A typed access costs 6 to 8 percent fewer frontend heartbeats than the lowered forms (256,343, 148,602 and 116,353 per instruction at 16, 58 and 254 instructions), stepped from facts derived from the element shape factscil_resolution_factsgenerates (step_ldelem_any_of_element,step_stelem_any_of_writeand the transfer forms).ldelemais the instruction.ldelema element readOnly, decoded from opcode 143 with the flag set when the instruction before it isreadonly.;readonly.decodes to.nop, and any other instruction after it, orldelemaafter another prefix, does not decode. Its step reads the element shape the method's layouts give the operand type and forms the address with the unchangedarrayAddress.MemoryOp.arrayAddress, the loweredArrayAddressoperation,Arrays.ValidateReadOnlyand the readonly window of the scalar check are deleted: a site afterreadonly.must be anldelemaemitting its decoding, and a branch into it is refused byPrefixEntryFree.step_arrayAddress_of_elementgives way toarrayAddress_of_elementandstep_ldelema_of_element. The address stepping rows cost 4 to 8 percent less than the lowered form. Areadonly.site requires the instruction after it to beldelema, which with fall-through andPrefixEntryFreeis the rule that onlyldelemafollowsreadonly.. Per site at 512 sites everyScalarFlowValidrow is at or below its cost before the conversion (plain addresses 277,254 against 277,621, readonly addresses 364,641 against 396,905, block copies 471,028 against 472,062). The generated bodies of those rows carry the byte offsets extraction writes, which about doubled them. No corpus method holdsldelema; 61 methods of the examples do.DecodedSummarybinds a checked method contract to a method defined from its decoder: the contract, the proof that it holds, and the method's evidence record by pin, token and type arguments.decodedProgram?_eq_sometransfers it to the program read from the body bytes, and the site lemma gives a caller the token and type arguments of the callee it links. Examples prove one caller property both by stepping through the callee and through its summary: the generic identity at one and two sites,Arithmetic::Calls, and callers with 1, 4 and 16 calls of a method that writes through a reference. At 16 calls the summary proof costs 52.1M heartbeats with the summary's own proof, binding and decoding included, against 158.4M stepped, and 621,945 kernel heartbeats against 3,228,438.Tests/SummaryCalls.csfails when the cost per call through a summary grows by more than 1.6 times from 4 to 16 calls or when the summary proof at 16 calls costs as much as stepping. Negative tests refuse a contract whose footprint omits the written cell, a caller that leaves the callee's precondition unproved, a callee whose raw definition is forged, and a summary bound to another method's token.unboundInstanceField). Before, the operand check accepted any field name at index 0 for a type of an unpinned assembly or of a contract import, and no other check bound the index to the field the token names: a forged extraction in whichldfldof one field read another field's offset passed the whole evidence check, on the struct path and on the class path, and only the extractor refused it.Item1andItem2of the core-libraryValueTuplepair keep indices 0 and 1. All 5,065 instance field accesses in the admitted corpus have owners in the module itself.System.Objector as a generic class is admitted in Lean as the extractor admits it: a class-like generic instance is an application over a head that states it is a class, and binding compares the head with the kind the metadata gives. The 45 corpus methods (88 admitted entries) that Lean refused are accepted. The arity of a generic owner is tied to its GenericParam rows: an owner without parameters carries the adjacent rows that bracket it, so a type definition with parameters named without arguments is refused in Lean and no longer only by the extractor. That rests on the table being sorted by owner, as ECMA-335 requires, which no check reconfirms yet. A method whose signature has no GENERIC flag is read as having none without brackets, as before. Over 60 corpus extractions the brackets cost 1.7 percent of total heartbeats (the tables check 16 percent, the body check 2.3 percent).Tests/SelfAdmission.csgains an opt-in mode that checks every admitted entry in Lean (about 2.7 CPU-hours; no suite runs it); on290e747fLean accepts all 3,760 admitted corpus methods.method{n}_calls_validatedtheorem is decided in the kernel onManagedCallsValid, which reads links by one walk. The earlier tactic went through a list form that read each pc's link by a table scan, so its cost grew with instructions times links: 24.1M heartbeats at 125 string tokens and 159.4M at 500. It now costs 3.1M and 9.0M, and the lookups rows bound the whole file and the call check per token at 1.15 (strings 1.04, fields 1.09, calls 1.07).MethodEvidenceValiddoes. With the two stated differently, assembling the evidence theorem unified them by unfolding the decoded body, about 390,000 heartbeats per instruction; it now costs about 395,000 at 502, 1,002, 2,002 and 4,002 instructions.cil_decoded_methodwrites an all-zero struct local asList.replicate size 0, the term a literal definition has, so a caller's goal after frame entry is unchanged by decoding.System.Objectconstructor is the first entry of the runtime-model table. The base constructor call of a constructor stays one.callwith no link, where the extractor lowered it topop. A call whose method the table models states no link and a call it does not model states the link the call check required before;ManagedCallsValidtakes the modelled set and decides both in its one match on the instruction, so a pc that is not a call pays about 79 heartbeats for it.callEmitsNoPop, part ofUnsafeCallsValid, refusespopat a call or construction site, and the runtime catalog lowers nothing. Stepping a constructor's base call costs 18 to 25 percent fewer frontend heartbeats than thepopdid at 16, 64 and 256 instructions, and the calls stepping rows 5 to 9 percent fewer kernel heartbeats. Model facts are proved per table entry, so a further entry adds a case. This conversion defines 791 more corpus methods from their decoder.ldsfld,ldsflda,stsfldand fieldldtoken. Before, a forged extraction could put one field's descriptor at a site whose token names another, and a static load returned the other field's value. A static whose owner is not carried is refused, except the platform constant the feature check requires verbatim, and a static named through an instantiated owner is refused.StaticIdentitiesValid, a new conjunct ofTranslationValid, requires one static identity per field and one field per identity in the whole program, by sorting the pairs in both directions (oneToOne_spec); before, two fields could share an identity and alias in the model. It costs 22,544, 20,876 and 22,706 heartbeats per site at 8, 32 and 128 sites. The extractor reports an instance field operand whose owner is not carried as a blocker with its reason.Program.closurecomputes the methods a method reaches through its links and checks every entry it relies on;MethodContract.Holds.restrictcarries a contract proved in a program to the closure, andDecodedSummary.relocateinto any program the closure relocates into. Theclosuressuite proves a contract once, binds it over its closure and applies it in three programs, and Lean refutes a relocation into a target with other bytes. The search takes a lookup (closureWith), andProgram.closure_eq_closureWithrewrites a closure to one over any lookup that agrees with the list. Every extraction statesprogramLength,programIndex(a balanced tree written byprogram_index%) andprogramIndex_get?, checked once by one kernel comparison, so a proof decides a closure of n methods with e link callees in a program of P in n log P + e steps: a whole-program chain costs 87,394, 335,656 and 1,422,953 kernel heartbeats at 8, 32 and 128 methods (90,395, 437,519 and 3,533,840 through the list), and a four-method closure 55,819, 58,512 and 61,237 in programs of 128, 512 and 2,048 (81,699, 179,818 and 571,795 through the list). Stating the index adds 0.49% to the elaboration of theAddextraction and 0.10% to a 128-method one.DivisionIntrinsics.UnsafeLowNextreturnsUnsafeLow(x) + 1, andExamples/Proofs/VectorSummary.leanproves it once by stepping throughUnsafeLowand its two modelled vector calls and once from aDecodedSummaryofUnsafeLow. Stepped it costs 3,192,215 heartbeats (118,705 in the kernel, 3,488 proof objects); through the summary, with the summary's own proof, binding and decoding, 3,506,999 (139,650; 4,614), so one use of a callee this small does not repay the summary.mainhas no proof of a caller ofUnsafeLowto compare with. A forgedUnsafeLowthat reads the other lane is refused by the body check.CIL/Safety/SegmentContract.lean): a precondition, a memory footprint and a postcondition over checked exits, with sequential and branch composition and links to weakest-precondition proofs.x64-sse2profile is removed.StrictBinding:methodMetadataBoundandMetadataRowsBoundbound the carried rows of a method across pages.Classical.choice; that check costs 57% less on Add and 44% less on Countdown.CIL.stepitself gives a mixed int32 and native-int operand pair its ECMA-335 III.1.5 result for sixteen instructions (arithmetic, bit operations, comparisons and signed branches);Safety.stepreaches the widening only through it, andTests/MixedNativeOpcodes.leanproves the two interpreters agree for every operand, both orders and any stack beneath. Unsigned branches still refuse a mixed pair: on .NET 11 the runtime zero-extends or sign-extends the int32 operand of a mixed unsigned branch depending on whether the JIT has it as a constant, and one method changed its result after tier-up, so no single rule matches the runtime.addon a reference and an integer keeps the checked byte-offset semantics of the form it replaces, andTests/ReferenceTests.leanproves the two equal and rejects the old lowering.addon a native method table and an integer offset, in either order, executes the checked cursor addition;ManagedOp.tableOffsetand the C#TableOffsetrecord are deleted.verify --deep-checksexposes them, and replay failures are attributed to the declaration that the kernel rejected.StrictBindinggains the check that a carried Assembly block (table header bytes, decoded header, Assembly row, and the assembly's string and blob entries) equals the pinned image's bytes, withassemblyMatches_of_assemblyBoundproving the proposition from the check. Heap keys are compared through a numbering the check derives; a row key without its entry and an entry no row names are refused. The same check covers the carried table rows of a slice with the#Stringsand#Blobentries they name (RowsMatch,rowsBound,rowsMatch_of_rowsBound): a MethodDef row is compared with its body address column masked, and one sort and merge-join builds the numbering, at 1.07 times the cost per added row from 256 to 1,024 rows. The extractor's own slices for 88 methods and 949 rows across all eleven carried tables are accepted. The metadata root accepts a 256-byte version field.Validmask, and refuse an uncompressed#-table stream and malformed roots, each with its own error. Carried MethodDef rows keep the body address zeroed, so editing one method leaves the evidence of other methods byte-identical.core,evidenceorintrinsics, andTests/Strings.cs,Tests/Identities.csandTests/StrictBindingFixture.csrun in a suite.- Build with .NET 11. Share hash operations and reduce repeated work in stepping, embedding, metadata lookup, extraction and audit preparation.Proof-author changes
and,or,xor,not,shr_un,conv_i1toconv_u,ceq,cgt,cgt_un,clt,clt_un,br,brfalse,brtrue,bne_un,bge_un,bgt_un,ble_un,blt_un,ldc_i4,ldc_i8(argumentvalue),ldloc,stlocandldloca. Lemmas named after an instruction follow.divide,checkedArithmeticandcheckedConvertare replaced bydiv,div_un,rem,rem_un,add_ovftomul_ovf_un, andconv_ovfandconv_ovf_unoverConvTarget;conv_iis its own instruction.step_checked_result,step_conv_ovf_resultandstep_conv_ovf_un_resultreplace the earlier result lemmas, andguard_divtoguard_mul_ovf_unare incil_guard.ldlocandstloctake only an index; narrowing comes from the slot kind.step_local_annotationandstep_setLocal_annotationare removed.ldlocaon a span local pushes the view it holds.retreads its narrowing from the declared return type (Method.returnNarrow,declaredNarrowinCIL/Resolution.lean).addon a reference and an integer, in either order, executes the checked byte offset;step_add_reference_i32_eq,step_add_reference_i64_eqand the read-only and commuted forms state it.addon a native method table and a 32-bit or native offset, in either order, executes the checked cursor addition; it returnedinvalidStatebefore.step_add_table_i32_eq,step_add_table_i64_eqandstep_add_table_commuted_eqstate it, andManagedOp.tableOffsetis removed. Extraction accepts the table form only for opcodeaddwith no operand.CIL.stepbegins with the two table arms, so asplitonstepleaves 14 exclusion hypotheses in its last case; it left 12.step_add_commuted_eq,step_add_readOnly_commuted_eq,step_memory_add_commuted_eqandstep_memory_add_readOnly_commuted_eqare closed withid rfl.Memory.Renamed.stepReferencenow depends onClassical.choice.checkedNative_bindis public inFixedStepHelpers.FeatureStateisFeatureFactsover a list of index and word pairs, and the entry state haslocals := [];featureSuccessorstakes the stack;FeatureFlowValid_iff_listis replaced byFeatureListValid,FeatureFlowValid.expandandFeatureListValid.known;checkFeatureSiteis removed;factWeakensandfactsWeakenare inFeatureLocals.lean. A handwritten feature certificate lists only known facts.CIL.Extraction.linkKeysAscendandlinkKeysAscend_boundarekeysAscendandkeysAscend_boundover any element type.CIL.CodeSuffix.advanceandlookuptake an implicit element type; generated suffix and instruction facts keep their statements.cil_resolution_factsalso declares{m}_argumentAccess{i},{m}_parameterSuffix{16k}and, with homes,{m}_homeSuffix{16k},{m}_homesAscendand{m}_localCount, and it fails on homes that do not ascend or on a signature it cannot resolve.CIL.stepmatches on the instruction andCIL.widenMixedapplied to the stack.fallback_relabel,fallback_raise,fallback_appendLocalsandMemory.Renamed.stepFallbackstatevalueswhere they statedCIL.widenMixed op values. TheCIL.step.eq_Nlemmas of the arms that match the stack take the hypothesiswidenMixed op stack = pattern, sosimp only [CIL.step]needsCIL.widenMixedandCIL.nativePureBinaryin its simp set; the generatedstep_*_eqequations keep their statements.base_relabel_binaryandbase_relabel_comparisontake the instruction first;nativePureBinary_relabelandwidenMixed_relabelare removed.CIL.stepgives no meaning to local instructions and has noframeparameter;step_feature,step_return,step_intrinsic,step_profile_eq,BaseRelabel,Fallthrough,Branchingand the fallback lemmas lose that argument.vectorArg,vectorArgAddr,vectorLocal,vectorLocalAddr,setVectorLocal,lane,laneAddress,setLane,newVector256,asRef,tableAddress,skipInit,init256,bitcast256,mul64,byteToBool,Method.vectorLocals,Method.vectorArgs,Frame.argumentsandAddress.home.Framehas four fields.TranslationValid,MethodEvidenceValidandMethodsCheckedtake the pin list. Handwritten certificates must supply the metadata evidence.broadcastBinaryMethod,broadcastShiftMethodand theinvoke_broadcast*facts take the declared signature and environment.id rfl, sosimpapplies them as propositional lemmas; statements are unchanged.verify --format jsonreport is schema 2.verify --deep-checks digests.sha256runs the deep checks; there is no separate audit command. A defaultverifyprintsBinding: defaultand one line per trusted fact.StrictBinding, body proofs compose throughcheckAll,ClaimsHoldandPagesHold;ClaimedBodiesBound,ClaimPagesBoundandclaimedBodiesBound_of_pagesare removed.#-..arg iis written.ldarg i; its narrowing comes from the declared signature, not from an operand. A closedcallirun is proved bycil_kernel_rfl, and a singlecallistep bystep_managed_call_eqwith a kernel-checkedindirectTargetfact.validateManagedCallWithtakes the link read at the site. A mutated declared signature is rejected bymethod{n}_declared_validated, no longer bymethod{n}_shape_validated, andargumentAccess_of_evidencetakesDeclaredValid..stackAlloc zeroedis written.localloc, with the flag indeclared.initLocals;DeclaredSignaturehas the fieldinitLocalsandStepMetadatathe fielddeclared. ACallSiteliteral statesmethod := { owner, name, hasThis, genericArity, returnType, parameters };declaringType,hasThis,returnTypeandparameterTypesare accessors.step_relabel_faultinghas a raised heartbeat budget..unsupported descriptionis written.unadmitted opcode. An exception is a typed value (.throw .overflow,.thrown .argumentOutOfRange); proofs that named exception text name the member.StepMetadatahas the fieldenvironment;segmentStores,untouchedLocalsandSegmentLocalEffectstake the body; a homed argument appears as.starg,.ldargaand.ldarg. Generated byte definitions readCIL.Extraction.fixedBytes n 0x....load64and.store64are written.ldind .i8and.stind .i8; a narrow or native indirect access names its kind the same way..memory .nullObjectis written.ldnull, and.objectTestis written.castclass typeor.isinst type..ldfld field,.stfld fieldor.ldflda fieldwith a namedFieldRef;step_ldfld_eq,step_stfld_eq,step_ldflda_eqand their word, reference and array forms replace the class field forms ofstep_memory_eq.argumentStepisequationStep..ldsfld field,.ldsflda field,.stsfld fieldor.ldtoken;step_ldsfld_eq,step_ldsflda_eqandstep_ldtoken_eqstate their result as a match on the read, andstaticAtisMethod.staticAt.step_newarr_i32_eqandstep_newarr_i64_eqreplace thestep_newReferenceArrayequations; after steppingnewarra goal showsallocateElementsof the element shape.managedSteptakes the link of its pc, and an extraction statesmethod{n}_link{pc}facts.run_monoandinvoke_monotakeStable. A refutation from an unsupported fault no longer elaborates.steprewrites withstep_intrinsic_eq.cil_decoded_methodgets its step equations fromcil_instruction_equations; the command takes the field references the method names..newobj constructorwith aMethodRef;step_newobj_eqstates its step as a match on the link of its pc, and after the link fact rewrites the goal shows the earlier do-block withconstructor.parameters.lengthwhere the literal argument count was.step_newAggregate, its action form andrun_newAggregate_of_contractarestep_newobj_aggregate,step_newobj_aggregate_actionandrun_newobj_aggregate_of_contract, and the first and last take an aggregate link premise.objectSiteType,StepEffect,StepContractandSiteConsistenttake a pc;step_calleeconcludesreadsLink. An extraction writesmethod{n}Links,methodEvidence.linksandmethod{n}_links, and its decoder call takes the table..call method prefixeswith aMethodRef;.tailCallis.call method { tail := true }.step_call_eqstates the step ascallStepof the link at the pc.Forwards,ForwardsOutandWP.load_call_storetake the call'sMethodRefand its arity, andMethodIdentityandStructuralLabelsstate call facts over theMethodRef. A body built withMethod.withCodehas no link at a call ornewobjpc until its links are stated.validateLinkedCallWithchecks both instructions;callOf?,construction?,ManagedCallsValid.reads,ManagedCallsValid_of_implied,all3_impliedandManagedCallsValid.linkAt_eqare removed. A suppliedbody.linkAt pc = linkfact rewrites with the step equation..ldelem kind,.stelem kind,.ldelem_ref,.stelem_ref,.ldelem_any elementor.stelem_any element, and a length read.ldlen.step_arrayLoad_of_element,step_arrayStore_of_writeandstep_arrayStore_i64_of_writearearrayLoad_of_element,arrayStore_of_writeandarrayStore_i64_of_write.ldelem.ion a null table with a scalar that is not an index givesinvalidStatewhere it threw a null reference.Instruction.typeTest?isofType?, andMemory.Renamed.managedSteplost an unused argument.cil_contract_stepsskips a local invocation fact whose start memory is a different variable from the memory the call steps from; kernel heartbeats on the shared tactic libraries are unchanged. In a proof with several summarised calls, clear the earlier frame once the next call's frame exists.LocalSnapshots.read_word64reads a remembered 64-bit local.cil_checked_stepssteps a call without a link on in the same method. With the link fact and the model fact the stepper rewrites a modelled call bystep_call_model, and a directly linked.callbystep_call_direct;step_call_eqremains for a call whose link no fact decides.callSteptakes an argument for the unlinked case, and thecil_managed_callsmacro is removed.TranslationValidhas the conjunctStaticIdentitiesValidandtranslation_of_methodsa parameter for it;BodyEvidencehas the fieldstatics; a linked static collision is the typedStaticCollision;MetadataIndex.linkisIndexTables.link. The metadata errorsunboundInstanceField,unboundStaticFieldandinstantiatedStaticFieldare new.SegmentState.localFootprinttakes the body. Thex64-sse2profile no longer exists;x64-sse42is the lowest x64 profile.Fixes for failed CI runs
Defects in the library or tools that a run exposed:
rfland reached the recursion limit;declaredNarrowanswersnonefor any head other than a primitive or an enum, anddeclaredNarrow_eq_storageproves the value unchanged.stindfact that never applied and, for a one-byte write, accepted a derived fact the kernel rejects; each derived fact is now type-checked.clisuite rebuiltExtractor/binwith the pack's version stamped in, so later suites in the same job ran another extractor than the job was given (the check is onmain; the suites first shared a job on this branch). The pack builds into its own directories and the test fails when the shared extractor's hash changes.Tests and CI configuration:
evidenceexceeded its 30-minute limit after seven test libraries were registered in it; the duration table CI packs jobs from now holds measured times, and a job is given at least twice its measured time.?and so keptprogramIndex_get?while removing the theorem it cites. The three before it were on49bd7ab3: a cost row wroteModelsAgreewithout its profile argument, the runtime model inventory asked only for lowered forms and lost the 90 definitions that became model entries, and a forgery check replaced an intrinsic that is now a modelled call. The hole corpus baseline no longer pins the number of refused corpus methods, which went stale twice. The constant regexes this branch added in tests are[GeneratedRegex]methods (31 call sites in ten files); patterns built at run time stay inline.692c0604; a full run takes 60 to 66 minutes. Thelookupssuite reads each control and each open form in the file of its decided statement, 69 fewer Lean runs, with every row within 0.4 percent.Measurements
Extracted.leancosts 2 to 2.3 times what it costs on main (Add: 4.8M to 11.3M heartbeats). Of the 6.5M added for Add, 4.6M elaborate the literal metadata, name and table bytes and 2.0M run the checks; the checks of the lowered program, 2.4M to 16.4M per file, are still carried beside the decoded evidence.cil_decoded_methodverifies the proofs of Add, Choose and Countdown unchanged, with the same heartbeats, kernel heartbeats and axioms for the correctness theorems. Defining the method costs about 45,000 heartbeats per instruction, 4.1 to 4.3 times the emitted literal with its facts, and adds 6.0 to 6.6% to an extraction module (measured before the field instructions decoded); that is a regression against the 5% threshold, caused by running the decoder once to compute the literal and once in the kernel.main; sub-method regions and an invalidating reuse store are missing. Use canonical decoded CIL as the sole executable instruction representation #568, Emit canonical CIL and metadata without constructing specialised executable instructions #582 and Migrate checked execution and consumer proofs from CIL.Op to canonical CIL #598 wait on the same conversion: 84 of 109 instruction constructors decode, 552 of 1,191 distinct example methods decode in full, and the lowered language, the translator and the raw-against-emitted checks are all still present.main(27953edb, built once; its rows match CI run 43422873269). Heartbeats, with kernel heartbeats in brackets; a summary row includes the summary's own proof, its decoding and its binding.CountCalls:main10,373,560 (655,554), stepped here 9,807,269 (453,183), through a summary ofDecrement9,949,785 (240,803).Identity64:main1,543,005 (64,260), stepped 1,556,811 (57,833), summary 2,051,844 (87,160).Repeated:main2,398,448 (68,830), stepped 2,424,688 (63,273), summary 2,478,344 (103,540).Nested:main2,414,643 (80,782), stepped 2,440,469 (73,854).Callsfor every input, whichmaindoes not prove: stepped 8,361,015 (347,408), summary 9,292,411 (237,414). A single use of a summary costs more frontend heartbeats than stepping in every example and less kernel work only forCallsandCountCalls; reuse is where it pays, 52.1M against 158.4M at 16 calls of one callee. Proof objects and module sizes:CountCalls20,489 objects onmain, 18,145 stepped and 11,072 through the summary, in a module of 664,616 bytes onmainand 897,144 here;Identity642,193, 2,399 and 3,612 objects.Callsbyrflat one input, costs 1,882,199 heartbeats and 524,220 kernel heartbeats on this head against 1,412,152 and 374,759 onmain: 33% and 40% more for evaluating a decoded method with two calls.Instruction.ofRaw?decodes 84 of 109 instruction constructors, and every other opcode decodes to a hole. The translator files (InstructionTranslation.cs,Operation.cs,TypeTests.cs,Throws.cs,FrameMetadata.cs,ParameterStorage.cs) total 1,532 lines, against 1,327 before the conversions of this PR;Operation.csalso holds the typed operand records, and the count has not been split between those and the lowered forms. 3,673 of 3,764 admitted corpus methods are defined from their decoder. The acceptance coverage above was not rebuilt on this head.Remaining work
callvirt, 23 at fields, 19 atldstr, 13 at an exception constructor followed bythrowand 2 at other modelled runtime calls. That corpus is the extractor's own assembly, which is mostly simple code. In the examples assembly 552 distinct methods decode in full under the scalar profile and 639 keep a literal (478 and 713 before the bit and byte-order models). The breakdown that follows was measured before those models and still counts their 74 methods: 490 stop at a runtime call the extractor still translates (Unsafe224,SpanandReadOnlySpan91,MemoryMarshal34,BitOperations30,Math.DivRemand similar 19,BinaryPrimitives18), 74 at value-type fields, 64 atinitobj,ldobj,stobjorsizeof, 50 atconstrained.,callvirtorldftn, and 28 atldstrorldtoken.main. Reuse of a summary across extractions with its invalidation, and binding beyond the method record (the site lemma cannot conclude the pin while the call check compares owners as text) remain. The migration of the proof corpus (Migrate checked execution and consumer proofs from CIL.Op to canonical CIL #598) waits on canonical execution.Instructionconstructors do not decode: instance, virtual and indirect calls, static fields, value-type fields, block and size instructions and runtime tokens.byteString, a string stored as its bytes behind a decided spelling, read at 27,474, 92,662 and 353,187 heartbeats at 20, 80 and 320 bytes against 103,840, 604,639 and 2,614,145 for the literal); the extractor does not emit such constants yet. On hand-edited extractions they take 13 to 22 percent off larger extractions. Lean 4.36.0 does not change this cost or the numeral collision cost (both measured on 4.35.0 and 4.36.0).The carried metadata is checked internally; its complete correspondence to pinned image bytes remains unfinished. This draft does not yet satisfy every acceptance criterion of the linked issues.
Not verified
dc7a6893, which adds theldelemaconversion, passed in full. The run on49bd7ab3, which adds the binding page form and the modelled Math and vector calls, failed three suites on tests that the next push fixed, and run 44081993153 on that push passed in full. Run 44107343116 on6f135727, which deletes the readonly window, passed in full. Run 44122985007 on2b1ba8e9, which adds the vector summary example, passed in full. Run 44137376339 on290e747f, which adds the class field and generic arity fixes and the readonly rule at the prefix site, passed in full. Run 44164502709 on692c0604passed in full. The run on this head, which makes generated outlines step typed array accesses from shape facts, is in progress.mainand has not come down: the same 79 suites took 17,343 s in run 44151461181 on00560842against 9,200 s onmain(27953edb), 89% more (17,400 s on75778dc8). The largest increases arelookups(94 to 2,444 s),assemblies(289 to 2,057 s),unsafe(651 to 1,382 s),stepping(105 to 817 s),evidence(799 to 1,438 s) anddispatch(726 to 1,155 s). On75778dc8, matched by stage, tests added on this branch accounted for 5,368 s and tests on both sides that cost more for 4,521 s. Measured on two batches, the declarations that exist on both sides cost the same or less, and the added cost is the new per-method evidence, led by the body check; the string constants above address its largest part. A full run takes 60 to 66 minutes.cil_managed_callson extracted evidence after the link walk change; the heartbeat comparison on the shared tactic tests after the hole,localloc,stargandldargaarms joined the first match ofstep;Tests.StoreFactsand the loop suites after the typed exception change; the linked first pass for instance, virtual and managed calls (the stepping rows exercisecallonly).callconversion; of about 13,300 per site at 256 sites, the table-shape conjuncts take about 1,650, the walk over the zipped lists 4,050, the first link read 2,560 and the link fit 2,200.Tests/SelfAdmission.cs -- --updaterecords an empty baseline and reports success when the extractor inExtractor/binis a Debug build, in which every method is "not checked". It is not fixed on this head.ldfldathat the extractor refuses, and its step faults as unsupported; a contract can still be disproved by unfoldinginvokeby hand over a run that reaches a hole, and the audit would accept that proof.