Repository navigation
Conversation
benaadams
force-pushed
the
feat/canonical-cil
branch
2 times, most recently
from
November 17, 2026 14:49
7d392ae to
6f13572
Compare
Bind each evidence record to the emitted method's link table. Check the managed, virtual and constrained targets of decoded methods against the specialized method table and import slots. Reject a changed handler index even when its identity and the reachability mask stay the same. Keep contract relocation for identical executable bodies and require each decoded call to bind its own metadata token.
Require a static method at ldftn so decoding preserves the callable signature. Check that the address of an instance method with no explicit parameters cannot produce a parameterless static pointer.
Render closed callable arguments with the type encoder used for raw specialization evidence. Preserve the class tag and scoped name and use layout slot zero for callable aggregate identities. Compare the literal identity of M<Account> with the address produced by the Lean decoder.
Check the numeric replacement of a managed address with the address link removed. Retain the replacement with its link as a separate check of the instruction's link kind.
Advance a cursor when an instruction reaches the next explicit link. Use its position to select the suffix for an unlinked call. Membership and insertion-position lookup now take one pass over the instructions and links when generating absence equations.
The self-admission corpus admits 3,801 extractor methods and all of them are defined from their decoder. The example counts stay at 1,145 of 1,198 scalar, 1,154 of 1,223 for x64-v3 and 1,153 of 1,208 for arm64-advsimd.
The tuple identity and the row result identity of Math.DivRem are written as interpolated strings. The evidence document says what a marshal site with no resolving overload becomes at a linked position: the decoder keeps the call and ManagedCallsValid refuses the method.
A body of 802 instructions with a linked call at every second one spends 168 heartbeats per instruction on its instruction checks, 104 of them in the model agreement check, against 60 for an arithmetic body. The budget stated on those checks is now 400 per instruction and applies to a method of more than 500 instructions, so a long body of calls stays inside it.
The operand checks and the marshal evidence state the option type of each indexed read they match on, and the marshal evidence names its changed site before building the changed instruction, so Lean reads the patterns and the structure literal.
Bind each open declaration, external target and closed range signature in one reserved call entry. Resolve the element and stride from checked array storage and layouts. Execute the same checked array operation for every stack, including null, invalid ranges and expired backing storage. The decoded instruction is a call at all three overloads. Array layout evidence comes from the model reader. Remove arrayExtensionCall and the AsSpan lowering and layout-use arms. Check the decoder on each overload and on raw operand and layout mutations.
The examples assembly decodes 1152 of 1198 scalar methods, 1161 of 1223 for x64-v3 and 1160 of 1208 for arm64-advsimd. The self-admission corpus decodes 3801 of 3801.
Read each modelled call as its operation at the original pc. The loop walk shares the checked stepper's link lookup and executes an unlinked call through its model fact. A linked call still uses its contract. CopyUntilZero advances through get_Item at pc 5 to Stamp at pc 19. The native-size getter regression checks that the first of two calls to the same operand pushes 8 and the second stops at its link.
Bind the endian constant to the profile and the exact runtime field. Decode RVA addresses and handles from their field and storage descriptors. Resolve RuntimeHelpers.CreateSpan through its typed generic declaration. Four more example methods decode on each profile. Scalar reaches 1149 of 1198, x64-v3 reaches 1158 of 1223, and arm64-advsimd reaches 1157 of 1208. All previously decoded examples retain their decoder definitions.
Match Instruction.call explicitly and name the altered call site before placing it in the raw instruction. All five aggregate MemoryMarshal evidence cases elaborate. Each case checks the original emission, the forged declaration and both candidate memory operations.
Keep Clear and Fill on writable spans, CopyTo and TryCopyTo on both
span owners, and both generic Array.Fill overloads as calls. Seven
reserved table entries bind eight open declarations and external targets.
The closed signature selects the overload. The checked layout supplies
aggregate widths. The interpreter uses the original stacked receiver
and the same memory operation for overlap, bounds, faults and counts.
At a byte copy site the instruction goal changes from .memory
(.spanCopy 1 false) to .call target {}. TryCopyTo uses .spanCopy 1 true
as its model. At a word fill or clear site .memory (.spanFill 4 false)
or .memory (.spanFill 4 true) becomes .call target {}. At an array
fill site .memory (.arrayFill .signed32 false) or its counted true
form becomes .call target {}. Use step_call_memory with the unlinked
pc and the generated method0_model2 fact at pc 2 to recover the same
stack, frame, memory and fault goal. Concrete fault and return proofs
use cil_kernel_rfl where rfl exceeds the elaborator recursion limit.
Reinterpreted span and view accessor proofs use the same kernel check
for their closed invocation results.
At an aggregate copy pc, a .size pc index .spanElement layout-use row
becomes a model fact with the checked width. A forged width is checked
against that fact. RuntimeModelsAgree checks the emitted call and the
raw declaration. The synthetic decoder tests check the call hole for
each altered overload. The generated examples check their model facts.
Each profile gains 22 decoded methods and loses zero. The decoded counts
are 1167 of 1198 on scalar, 1176 of 1223 on x64-v3 and 1175 of 1208
on arm64-advsimd.
The examples assembly decodes 1178 of 1198 scalar methods, 1187 of 1223 for x64-v3 and 1186 of 1208 for arm64-advsimd. The 20 scalar methods that keep a literal stop at a span constructor.
Decoded calls share their layout row's UTF-8 identity. Storage compares four bytes at a time and ASCII scope decoding checks the bytes before constructing characters. Projected results have decidable equality. Math.DivRem(1, 1) reduces by rfl at the default depth of 512. The literal call needed 579. The 221-byte generic tuple size and five model families have closed execution checks.
A positional layout read stops at the requested row or the end of the list. Compiled code uses native array indexing by a proved equation. At both 16 and 256 entries, first, middle and last model lookups need depth 75. A size query on the last layout needs 210 at both sizes.
The model fact check of a call site states the model through the raw operand at its position. The proof now requires the generated model fact for the expected model and lets the kernel compare the two sides, because the elaborator exceeds its recursion limit indexing a long literal code list near its end.
Tests.UnsafeReinterpretations is a lean_lib that no suite built, so its theorems were not checked in CI. Build it in the core suite beside Tests.UnsafeModels, Tests.UnsafeOffsets, Tests.UnsafeTransferModels and Tests.UnsafeBlocks.
A span ldobj returned any operand unchanged, so a Span-typed byref argument formed by Unsafe.As<long, Span<byte>> or Unsafe.NullRef reached the callee as a plain or null reference and the call returned normally. transferObject now forwards only a span or buffer span view. A null reference raises nullDereference and any other operand raises invalidState. step_ldobj_span now takes a bufferSpan view. step_ldobj_span_value, step_ldobj_span_null and step_ldobj_span_address state the other arms, and step_ldobj_span_result states the step on every stack. storageLowering? takes the stack and lowers a span load to nop only when the stack's head is a span view, so cilSteppedOp and the loop automation no longer lower a span load without a stack. Memory.Renamed.transferObjectResult keeps its statement and splits the new arm on the stack. The tests run the span load, every span member receiver and the object instructions on span, array and class types with null and plain references, and each faults.
Resolve struct field outlines from the original CIL sites and remove their copied representation. Reuse the checked field layout in the read contract and its relocation refutations. Bind direct local interfaces in virtual class catalogs to their physical metadata rows. Verify the four-word Vector128 comparison and its swapped-word counterexample.
… swaps Read argument loads from their original CIL instructions and remove the Arg outline record. Bind direct local interface MethodImpl rows to their owning class and exact declaration. Prove and refute compiled half-swap variants and measure reuse of the canonical region proofs.
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.
Tracks #568, #582, #596, #597 and #598. Methods decode from pinned bodies. Unsupported reachable instructions block extraction.
Implemented
Lean binds scalar generic calls to a unique pinned MethodDef, public sidecar export and audited contract closure.
TypeDef, ClassLayout, Field and FieldLayout bind scalar structs. Moving a field or changing packing refutes both readers (0 returned, 128 required).
Class slots bind inherited targets and local MethodImpl rows alongside unrelated IDisposable implementations. Missing slots and crossed owners or declarations fail. The mutant returns 11 instead of 12.
GenericParam and GenericParamConstraint bind method and owner constraints. Pair<int,long> selects !1 via InterfaceImpl and rejects !0 and !2. Both constrained calls return x + 2 for all Int32 inputs and preserve memory.
A facade ExportedType and AssemblyRef bind the implementation TypeDef. Its caller returns x + 1 for every Int32. Thirteen metadata mutations fail.
Portable 256/512-bit equality preserves memory. Repeating the left operand refutes both at the top bit. Reuse costs 6,015 kernel heartbeats vs 767,330/977,114 directly.
Deleted X86BaseDivRem64, Intrinsic, LocalAddress, Local, SetLocal, ClassField, StructField, FieldAccess and Arg. All 108 outlines match. Earlier comparisons cover 19 frame, 41 class and 120 struct cases.
x64 and ARM64 AES satisfy one round contract for every state and key. Repeating the low key half gives a verified one-bit counterexample on both profiles.
Closed
typeofretains bothldtoken/getter pairs and comparison or branch. Four changedSystem.Typesignatures fail. Five-stepSegmentRunaccepts any frame, stack and memory. Three compiled methods cover all Int32 inputs and match 15 CLR results.Othercosts 2,299,693 heartbeats shared, 2,411,159 directly and 1,158,900 folded.ldstrpushes its bound reference.MemoryOp.stringLiteralis deleted. An unbound literal is inconclusive for CLR contracts.CI runs 81 suites in 14 groups.
Both readers require an earlier nonzero enclosing TypeDef. Strict binding checks generic bases and field ranges. Structs and enums bind core scope, token and neutral culture. Pinned .NET 11 CoreLib fixes primitive storage and stack widths and its fieldless System.Object terminates layout. The kernel checks long assembly identities.
Templates share callee numbering and report the first differing pc. Compiled ldftn binds its index. A two-assembly struct call binds owner, token and arguments (2,713,469 kernel heartbeats both ways). Seven call and field extractions and outlines match. Renamed or reindexed stores fail at pc 1.
Lean checks tiny and fat method headers, instruction bytes, operands, branch targets, stack depth and local initialization.
decodeSingleCatchalso reads one small typed catch, checks its class token and disjoint instruction-aligned byte ranges. The public verifier rejects exception sections. The CoreLib resource lookup has a 56-byte body with a 25-byte instruction stream.Check method identities, signatures, locals, generic constraints, type operands, fields and call targets against carried metadata. Object parameters bind the core scope and name. Nongeneric forwarded calls bind open signatures in the caller and closed signatures in the defining module. Four scope mutations fail. Shared indexes avoid repeated scans. Omitted heap entries distinguish zero and maximum-width offsets.
Method.argumentAccessreads arguments from the declared signature and homes. Itsmethod{n}_argumentAccess{i}facts andreduceArgumentAccesssimproc cost about 8,400 kernel heartbeats per argument at 8, 32 and 128 arguments (10,800 with homes). The lookups suite rejects quadratic growth.Feature certificates store known words as sorted local-index and word pairs. Kernel heartbeats per instruction at 16, 64 and 256 locals are 21,719, 21,832 and 22,048, down from 23,163, 28,471 and 52,354.
FeatureFlowValid.expandandFeatureListValid.knownprove equivalence to the one-fact-per-local specification.Native method-table loads check the index against the proved entry count (
entryCountandcountedon both table types). At 16/64/256 entries they cost 24,722/24,714/24,753 kernel heartbeats, previously 29,483/41,785/90,934. Cost remains linear in static bindings and the loaded index.Class and static field instructions carry
FieldRef.FieldRef.ofOperand?reads its owner, index, type and metadata name. Templates emit their links.ldargusesMethod.argumentAccess.argumentAccess_of_evidenceproves unhomed narrowing. Outlines read parameter home slots directly.Starg,LdargaandSlotOperationsare deleted. 45 stepping rows stayed within 2%.Instruction.ofRaw?checks ECMA-335 opcodes and their operands. The kernel checks the raw forms inTests/ValueDecoding.lean. At 500/2,000/8,000 instructions, decoding costs 14,043/14,015/14,007 heartbeats per instruction.ldftnpushes a scoped method pointer.callichecks its signature, target andtail.prefix.ManagedOpis deleted. Generated proofs usestep_managed_call_eqandcil_kernel_rfland pass the 400-byte owner fixture.ManagedCallsValidchecks ascending call-site keys in one pass.ManagedCallsValid_iff_originalproves equivalence to the list check. Cost per site falls slightly at 64–1,024 sites. The old per-site scan grew 3.23 times at 64–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.The declared signature is checked by its own conjunct of
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.The object identity and null-test arms of
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?usesInstruction.ofRaw?and the checked frame, signature and home computations.Method.ofBody?reads code and initialization from pinned bytes aftercheckBody.decodedProgram?does this for every method.Method.ofBody?_of_decodesuses the generated body check. At 500/2,000/8,000 instructions decoding costs 24,775/24,494/24,425 kernel heartbeats per instruction.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.A call site states its method once, as a typed
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.Indirect accesses bind the raw width, signedness and alignment. All 39 forged emissions fail and all 25 extractor emissions pass. Unsupported
ldobjandstobjtypes admit only the span no-op. Decodedcpblkandinitblkexecute directly. The 308 block checks cover alignment, bounds, overlap and zero counts. Lean proves a fill past the allocation cannot succeed.Every raw opcode decodes to its admitted instruction or an explicit hole carrying the opcode. Stepping a hole faults.
Instruction.ofRaw?andInstruction.ofRawtake the preceding instruction for prefixes.Instruction.ofRawCodecarries it in one pass.Method.ofRaw?rejects undeclared arguments,Method.ofRaw?_codeidentifies the decoding at each pc, andScalarFlowValid.instruction_checkedproves the match.fixedBytesjoins chunks of at most 256 bytes throughfixedDigitsWithin, avoiding kernel hash collisions on equal low 64 bits. At 125, 500 and 1,000 string tokens the body check costs 88,900, 92,700 and 99,800 heartbeats/instruction (previously 89,600, 136,300 and 201,500). At 5, 10 and 20 KB the per-byte growth bound is 1.15. Body obligations up to 256 bytes grew 0.06–0.46%. Binding pages use 512-byte chunks. A 4 KB page costs 23.26M heartbeats with equal chunk tails and 23.25M with random tails (previously 506.1M and 23.0M). Importing the prelude-onlyCIL/Extraction/FixedDigits.leancosts 1.92M heartbeats and 1.2 s for a generated audit module, down from 5.25M and 2.9 s.Tests/BodyLiteral.leanchecks the import closure.PrefixEntryFreeforbids a branch or switch from skippingunaligned.,volatile.,tail.,constrained.,no.orreadonly.at any pc.checkBody_prefixEntryFree,instantiateMethod_prefixEntryFreeandMethodEvidenceValid.prefixEntryFreetransfer this decoder guarantee to every validated method.prefixEntryFreeWithscans a branch-destination bit mask at about 1,380 heartbeats per instruction. Cecil extraction also rejects entry after a prefix. All corpus and fixture methods pass.A homed argument is stored with
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.A raised exception is a typed
ExceptionType, in instructions, faults, contracts and example proofs; text is produced for display only.The receiver fold is deleted: a raw
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.Byte lists in generated evidence are numerals read by
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.BindingAudit.metadataRowschecks carried metadata and#USentries. A forged page fails.BindingAudit.staticDatachecks each static operand's Field, FieldRVA, signature, size, packing and mapped bytes. The compiled table returns 17. A matching prefix, reversed bytes and a missing RVA marker fail. Deep results under--proof-rootbind the compiled import closure. Failed publication creates no receipt or cache entry. The TypeDef reader checks name, kind, fields, base and nesting, including the sorted NestedClass rows.BindingAudit.publicKeyTokenschecks Assembly keys and AssemblyRef keys or tokens against direct references. Malformed references fail even if others are missing.objectFieldschecks System.Object has no instance fields.tupleFieldschecks the pair TypeDef, both GenericParams and Item1/Item2 FIELD VAR signatures. Separate images work. Missing destinations leave facts uncovered. Rehashed Object fields and swapped tuple signatures fail. .NET 11 replay took 68.3 s and 79.9 s.A support result is keyed by the extraction it was computed for, so a changed extraction no longer reuses the support of another one.
The proofs of
Guards::CountandGuards::Indexclose again andTests/Guards.csruns in the evidence suite.Tests/HoleCorpus.cspins that no admitted corpus method gets a parameter home from dead code or holds a dead prefix other thanunaligned..The extractor emits
cil_decoded_methodwithMethod.ofClosed?for every admitted method. The generated theorem identifies the complete method with the decoder result. The body certificate binds it to the selected assembly. Dead positions retain their raw opcode, and a reachable decoding refusal stops extraction.Raw
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.LayoutUsecontains only struct constructions, locals and parameter homes. Canonical field instructions use the checked field reference. The same vector field resolves at byte 32 on x64 and byte 16 on ARM64. A swapped architecture table, owner or field type is rejected.Struct
ldfldauses the offset from its checked field layout. The offset-onlyInstruction.fieldAddressis removed.step_ldflda_struct_eqstates the general step.step_ldflda_reference_eqandstep_ldflda_readOnlyReference_eqpreserve the receiver capability and use the checked pointer addition. Nested structs executeldfldandstfldat the checked field offset and width. Both preserve padding flags. A store through a readonly reference faults even for a malformed value. Decodedldfldandstfldnow also replacefieldAtandsetFieldAt.Class and struct fields use
ldfld,ldfldaandstfldoverFieldRef(opcodes 123–125).Method.fieldShapereads the checked layout.Instruction.instanceField?replacesclassField?. Six class field operations, their checks and translator arms are deleted. Stores require the field’s stack kind. Names come from metadata rows. Goals with.fieldAt 4 4 falseor.setAggregateFieldAt 8 4now name the field in.ldfldor.stfld. Across 35 extractions kernel heartbeats rise 0.78% and total heartbeats fall 0.05%.Static field access is
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.Call targets are read from each method's link table: the call arms of
steptake their target from the link of their pc and fault withunlinkedCallwithout one, andcil_instruction_equationsstates a link fact per call site.stepruns models throughintrinsicCall,featureCalland related functions.MethodEvidenceValid.modelsAgreebinds calls to typed entries using decoder and feature-flow evidence.memory_stepRenamedcovers all memory operations.RuntimeModel.StepRenamedtakes source well-formedness and an observable step. The 70BitModelsentries coverBitOperations, integer helpers andBinaryPrimitives.ReverseEndianness, excluding signedLog2and signed 8- and 16-bit rotations. Outlines step the four bit counts through their calls.A fault the model does not cover refutes nothing:
ExecutionFault.definiteis false for an unsupported instruction and for fuel exhaustion,Settledrequires a definite fault, and the refutation lemmas takeSettled. A refutation is a counterexample:MethodContract.Refuted,OutcomeContract.RefutedandOutcomeContract.RefutedCLRcarry an input and memory that meet the precondition with a settled outcome the contract does not allow, or exhaustion at every budget (Diverges). The theorem audit and the gate runner accept a refutation only as one of these, matched by name and declaring module; a theorem statingNotof a contract'sHolds, which a run that reaches a hole can prove, is refused (Tests/FailureReporting.cskeeps the forged proof that verified before).Opcode 0x73 decodes to
newobjof its constructor’sMethodRef. This removesnewAggregate,newObject, their translator records and step lemmas. The decoder and evidence sharemethod{n}Links.ManagedCallsValidbinds a live constructor to its raw site, target, class or aggregate link, bases and size. Tests reject a forged or missing link, wrong kind, base list, size, opcode or owner. Span and exception constructors keep their literal models.Opcode 0x28 decodes to
callof aMethodRefandCallPrefixesfortail.andconstrained.. The reference gives the argument count and the link at the pc gives the target.Instruction.ofCallSite?handlescallandnewobj.Method.ofRaw?,Method.ofBody?anddecodedProgram?take links after the environment.Method.withCodeclears them.ManagedCallsValidchecks the direct target and token. Extraction checks operands and prefixes for targets, imports and runtime models. Template code and link equations allow arbitrary callee indices. Only proof outlines build C# operation lists. Six compiled fixtures produced byte-identical extractions and outlines.Typed runtime calls cover integer Math helpers (Min, Max, Clamp, Abs, Sign; 31 corpus and 44 example sites), Vector128.CreateScalarUnsafe and 128/256-bit GetElement on ulong (23 example sites). A model checks the operands it observes. Linked calls keep the guard in
step_call_linked.reduceRuntimeModelresolves a closed method under a variable environment.step_call_intrinsicsteps the resolved call. Earlier intrinsic rows used 32% fewer frontend and 71% fewer kernel heartbeats; virtual calls cost about 61,000 heartbeats per table entry.An admitted throw sequence executes each
ldnull. Four compiled fixtures reject erasure. Lean checks the declared instance convention, parameter and return types, and generic arity of exception constructors. Eight altered operands fail the feature certificate. Four also fail on the compiled fixture. String loads and constructors still fold. Faults retain their type and raw throw position.The direct
Instruction.intrinsicand its execution rules are removed. C# outlines no longer carrySpanEmpty,ObserveView,ViewQuery,SpanSource,SpanCreate,SpanFromReferenceorSpanSingleReference. Array spans retain the element, mutability and range an outline uses.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).The stepper rewrites the link fact of a
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 that read or rewrite generated method text go through shared helpers in
Tests/GeneratedEvidence.cs, which forge a decoded method through its decoder call or through the raw definition the decoder reads. Every rejection test is kept: a forged decoder is refused byDeclaredValid,MethodShapeValidorManagedCallsValid, and a changed raw instruction byScalarFlowValid.Lean decodes
ldlen,newarrand numeric, reference and typedldelem/stelem. RemovedarrayLoad,arrayStore,arrayTransferand managed table operations. Outlines read array views and Unsafe offsets from original CIL sites. RemovedNewArray,ClassElement,TypedElementAccess,SpanLength,SpanSlice,SpanItem,ArraySpan,ArrayRangeandAddOffset. Lean verifies typedRefillRead. Typed access rejects by-ref-like elements and requires pinned classes orSystem.Stringfor objects. At 10 instructions numeric access uses 278,864 vs 278,242 frontend heartbeats/instruction. Typed access costs 6–8% less (256,343, 148,602 and 116,353 at 16, 58 and 254 instructions). Element proofs usestep_ldelem_any_of_element,step_stelem_any_of_writeand their transfer forms.Opcode 143 decodes to
.ldelema element readOnly. Adjacentreadonly.decodes to.nopand sets the flag. Other pairings and branches into it fail. The step uses the checked element shape andarrayAddress. The extractor reads the operand and prefix at the original site.ElementAddress,MemoryOp.arrayAddress, the loweredArrayAddress,Arrays.ValidateReadOnlyand the scalar readonly window are deleted. UsearrayAddress_of_elementandstep_ldelema_of_elementfor the formerstep_arrayAddress_of_element. Address steps cost 4–8% less. At 512 sites noScalarFlowValidrow costs more: plain addresses 277,254 versus 277,621, readonly addresses 364,641 versus 396,905, block copies 471,028 versus 472,062. Extracted byte offsets roughly doubled the generated bodies for those rows. The examples have 61 methods withldelema; the self-admission corpus has none.DecodedSummarybinds a checked method contract to a method defined from its decoder: the record names the pin, token and type arguments.DecodedAtrequires the method at that index, a successful decode to it and a valid reachability mask. An empty body at a missing index is refused (Require DecodedAt to name a method decoded from the record #614).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.An instance field access whose owner has no carried definition is refused in Lean (
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.A class instance field typed
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.The generated
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).The generated feature theorem states its link lookup as
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.The
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.A static site is bound to the field its token names: each static descriptor carries the typed field reference, and the static field check requires the site's descriptor to name the instruction's field for
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.closurefollows method links.MethodContract.Holds.restricttransfers the contract to its closure andDecodedSummary.relocatetransfers it to a matching program. Theclosuressuite reuses one proof in three programs and rejects different target bytes.Program.closure_eq_closureWithpermits any lookup agreeing with the list. Extractions certifyprogramLength,programIndex(a balanced tree fromprogram_index%) andprogramIndex_get?in one kernel comparison. Finding n methods and e callees in a program of P takes O(n log P + e). Chains of 8, 32 and 128 methods cost 87,394, 335,656 and 1,422,953 kernel heartbeats (list lookups cost 90,395, 437,519 and 3,533,840). Four reachable methods in programs of 128, 512 and 2,048 cost 55,819, 58,512 and 61,237 (lists cost 81,699, 179,818 and 571,795). The index adds 0.49% to elaboration for Add and 0.10% for 128 methods.DecodedSummary.reprofilebinds the same evidence and method identity to an agreeing profile. Independent x64-v3 extractions reuse compiled scalar proofs of addition, a low vector lane and an eight-byte byref write. Both extractions and proofs replay together. A different addition token or add byte invalidates reuse. Re-exporting the same DLL with a +1-or-+2 postcondition changes both closure and interface digests. The cached exact caller fails and the weaker caller verifies against the new digest.Reversing the single branch in compiled Choose preserves both two-instruction return regions. A consumer imports their compiled proofs, checks the changed branch, and proves its result for every Boolean, word pair and caller memory. The consumer cost 2.38M frontend and 285,524 kernel heartbeats. Direct stepping cost 2.79M and 126,232. Compiling the reusable producer cost 8.20M and 197,560.
The changed CountCalls initializer starts at one. A consumer reuses the compiled loop invariant, decreasing measure and Decrement proof to prove x + 1 modulo 2³² for every input. The four modules replayed together in 7.0 s.
The vector example:
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.Segment contracts (
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.The stepping tactics keep an index of the equation hypotheses in scope, so the cost of a step no longer grows with them (21 to 61 heartbeats per hypothesis per instruction between 16 and 256 hypotheses), and snapshot walks restate a fixed number of facts per store.
Path comparison in the verification scripts follows links and uses the case rule of the volume that holds each path, read from the operating system.
An x64 profile below the .NET 11 x86-64-v2 baseline is rejected, and the
x64-sse2profile is removed.StrictBinding:methodMetadataBoundandMetadataRowsBoundbound the carried rows of a method across pages.Closed argument storage is decided without
Classical.choice; that check costs 57% less on Add and 44% less on Countdown.Represent metadata names, UTF-16 user strings, assembly versions and identities with typed values. Preserve raw identity components and use a lawful assembly ordering. Some scoped identity comparisons remain textual.
The reference interpreter
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.Execute mixed native arithmetic and reference offsets through the bare opcodes:
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.Use opcode-specific arithmetic, conversion and local instructions. Local narrowing comes from declared metadata. Checked return dispatch rejects incompatible narrowing; execution and structural proofs use the shared dispatch. Remove unused vector-home components and dead block helpers.
Integrate deep checks into the internal standalone verification path. Retain pinned image snapshots, build StrictBinding in the selected certified library, jointly replay and audit the proof and binding contributions, and include binding evidence in successful reports.
verify --deep-checksexposes them, and replay failures are attributed to the declaration that the kernel rejected.StrictBindingchecks the carried table header, decoded header, Assembly row and its string and blob entries against the pinned image (assemblyMatches_of_assemblyBound). For slice rows,RowsMatch,rowsBoundandrowsMatch_of_rowsBoundmask MethodDef RVAs and reject missing or unused heap entries. One sort and merge-join assigns heap keys. Cost per added row grew 1.07× from 256 to 1,024 rows. The corpus covered 88 methods and 949 rows across eleven tables. Metadata roots accept a 256-byte version field.Check pinned SHA-256 digests and PE method-body locations with paged body claims and flat image-list auditing. Validate original library bytes and file sets before cache promotion, including same-length changes with restored timestamps.
Keep pinned metadata contexts alive through contract import/export, source-bundle verification, inventory probes and exception linting.
Read the metadata table header through the stream directory and the
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.Every Lean test library has a suite that builds it: 19 libraries that only an all-library build reached are now built by
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.BodyDecodes.callManagedTargetresolves a raw operand to a slice and MethodDef. For explicitly scoped owners,DecodedAt.direct_siteidentifies the callee pin, token and type arguments. App.Direct and Lib.Step share a token. The caller resolves to Lib, rejects App's pin and preserves caller memory through the summary.Proof-author changes
Decoded
ldobjandstobjpreserve aggregate bytes and initialization flags. Scalar loads and stores useldind,stind, typed object access or checked call transfers. All four synthetic transfer constructors and their lowering are gone.cil_element_shape% Extracted.method0 2gives the shape of the decoded array element at pc 2. Generic word-read outlines use the checked instruction at that position, including in methods with unreachable array instructions after the return.Instruction constructors follow ECMA-335 mnemonics:
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.Unsafe.SkipInit<T>executes as a checkedcall. The four-word reader and writer useldfldand preserve their overlap contracts. The standaloneInstruction.skipInitand its step equations are removed. Usestep_call_skipInit_referenceorcil_contract_steps.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.The first match of
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.Removed with no replacement:
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.A method records its declared signature, layout environment and call links.
TranslationValid,MethodEvidenceValidandMethodsCheckedtake the pin list. Handwritten certificates must supply the metadata evidence.broadcastBinaryMethod,broadcastShiftMethodand theinvoke_broadcast*facts take the declared signature and environment.The 23 step equations that hold by unfolding are closed with
id rfl, sosimpapplies them as propositional lemmas; statements are unchanged.The certificate is schema 7, with a binding section of twelve facts and the refutation bound to its method and assembly, and the
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.In
StrictBinding, body proofs compose throughcheckAll,ClaimsHoldandPagesHold;ClaimedBodiesBound,ClaimPagesBoundandclaimedBodiesBound_of_pagesare removed.Extraction refuses a runtime-async method, body bytes for a row with no IL body, a method generic parameter past the arity, a reference into a pinned assembly whose slice is missing, and an image whose table stream is
#-..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.A class field access is written
.ldfld field,.stfld fieldor.ldflda fieldwith a namedFieldRef;step_ldfld_eq,step_stfld_eq,step_ldflda_eqand their word, reference and array forms step those opcodes.argumentStepisequationStep.A static field access is written
.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_mono,invoke_monoandinvoke_uniquetakeStable.ExampleProof.outside_neither_returns_nor_throwsproves that the interpreter cannot return or throw at any fuel for a receiver outside the dispatch table. Its CLR behavior remains unknown. A fault used forcontract.RefutedorRefutedCLRmust be definite. Useof_return,of_faultorof_divergesfor a refutation.MethodContract.Refuted.of_faultreplacesnot_holds_of_fault. A rejected gate variant needs a production theorem that states the contract'sHolds.A proof that stepped an intrinsic call by unfolding
steprewrites withstep_intrinsic_eq.A method defined by
cil_decoded_methodgets its step equations fromcil_instruction_equations; the command takes the field references the method names.An object or aggregate construction is written
.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.A direct call is written
.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.An element load or store is written
.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.Runtime calls use
.callor.newobj. Usestep_call_model,step_call_intrinsicorstep_newobj_model.modelStep_memorysteps a bound memory helper.cil_loop_advanceandcil_contract_stepsstep them in the caller frame and report the failing model step.MethodEvidenceValidhas no profile conjunct and the generatedprofile_validterm is gone;MethodEvidenceValid.profile_validderives the fact from the shape check.ExactHardwareRegisteredisHardwareRegisteredand covers every hardware slot. A call or construction with neither a link nor a runtime model fails with "has neither a link nor a runtime model, so no step crosses it", and its failure record says"missing":"linkOrModel". A rejectedverify-batchrequest names the verified request it refutes (refutes) and passes only on a kernel-checkedMethodContract.Refutedof that request's statement; a build or extraction failure fails the row.Instruction.ofRaw?gives.nopfor a validunaligned.andcopyBlockorinitBlockforcpblkandinitblk, andblockAlignmentis new.A generated
Templates.leanholds, per input, pinned metadata, raw bodies and acil_decoded_method, and proves for each selected input that the template's code is that input's decoded code. The 30 exact-binding statements are unchanged, and 2,927 of 2,928 instruction equations are textually the same (one literal readsldc_i8 0). Checking a template costs 52,427 heartbeats per instruction at 502 instructions against 13,108 for the literal form, linear in inputs and flags. Proof outline stops and exception lint origins print the CIL instruction as Cecil spells it (IL_0001: stloc.0).ldlocaandldargaof a span slot pushValue.spanHome slot, and each use reads the slot's current view (spanView). A span constructor called on a home runs as the modelRuntimeModel.spanInPlaceand writes that slot.Instruction.initializeSpanLocal, its five step lemmas and the lowered call families are gone; a spaninitobjdecodes asinitobj.checkedValuerefuses a home, socheckedValue_of_valid,checkedValues_of_valid,run_load_arguments,step_call_loaded,MethodContract.Holds.forwardandforward_outtake a hypothesis that their values are not homes.modelStep_framereplacesmodelStep_next: the frame is unchanged, orspanInPlaceset one span slot to a new view of the same width and writability.Each validated record decodes to the whole executable method, including its argument homes. Runtime call agreement follows from decoding and the feature mask. The generated runtime theorem keeps its name.
A method or outcome summary can use the translation certificate and one method lookup. The compiled Bump example binds the account update and null-receiver exception to the same body. An agreeing profile can reuse the outcome proof when the same evidence decodes to the target.
A direct or relocated summary requires the destination record's
BodyDecodesproof. Changing only the assembly label breaks the binding. The translation constructor takes this fact from the existing certificate.DecodedSegmentSummarybinds a nonempty sequence at an exact PC to the decoded method. Its contract retains the entry stack, frame, footprint, returns, definite faults and divergence. A closed region can reuse the proof after a prefix changes when its instructions, method metadata and callees agree. The adder fixture swaps the two loads before the region. Changing the add or return convention fails the check. Adjacent summaries compose when the boundary states and permitted writes agree.A recurrent region that consumes positive fuel at each visit proves divergence for every budget. A checked entry prefix carries that proof to a method contract.
Kernel-checked counterexamples cover arithmetic, conversions, branches, loops, generics, exceptions, copies, snapshots, byref writes, dispatch and SIMD. Countdown and CountCalls variants exhaust every fuel budget. SSSE3 and AVX2 shuffles preserve overlapping 16- and 32-byte readable spans. Both AVX2 reads reject
Vector128.Create<byte>. Reversed SSSE3 operands, swapped AVX2 halves and ignored AVX2 mask bit 7 each have a compiled counterexample. AVX-512 SignWindow selects four limbs or their sign extension for all inputs and selectors on x64-v4. With limbs [0,1,2,2⁶³] and selectors [4,5,6,7], low-sign broadcast returns zeros. Swapping tables or choosing by bit 3 returns the input limbs. All three refute the required four all-one words. Unsupported execution stays inconclusive for CLR contracts. Stable interpreter results retain model-level uniqueness.Extraction and templates require successful decoding. A refused live instruction reports the method, IL offset, opcode and PC. The blockers report drops
literalMethods.MethodEvidenceValid.code_eqand.staticSites_eqapply to every method. Thedecodedflag andScalarFlowValid.of_decodedare gone.Method.ofClosed?returnsExcept MethodDecodeErrorand refuses a method with a reachable hole (liveHole pc opcode);Method.ofRaw?then givesnone. A spanldobjforwards only a span value andstorageLowering?takes the stack.Unsafe.Asneeds field or vector storage on both arguments.callModelledtakes an opcode and method pair.ExactIntrinsicsValidandmethodN_intrinsics_validatedare replaced byruntimeModels_exactHardware. Decoded signatures share layout identity bytes and scope constants, sorflcloses a run through a model at default limits.Extracted.leansetsmaxHeartbeatson instruction checks when 120 per instruction plus 432 per call site exceeds 200,000.Fixes for failed CI runs
Deep report tests use each binding request’s coverage predicate, including generic constraints and layouts.
MemoryMarshal rejects newobj at a call site. Array sum proofs accept PDB and fallback locals.
Argument homes follow locals. Lean refutes 14 offset and 12 transfer obligations from the failing declaration and its premises.
Integer-math wrappers supply the checked call model to the shared step tactic. The enum fixture uses the two-argument span constructor lookup. The math suite passes 21,804 CLR comparisons. Verification run 44909487654 also recorded a six-heartbeat difference across scalar stepping repeats. Kernel counts and proof bytes matched on all three repeats.
InstructionIndexes covers both blt encodings, closed scalar types, signed loads and stores. Aggregate ldfld uses checked snapshot equations. The 13 dispatch fixtures and forged local passed. Eight compiler columns cover 26 more imports standalone and pinned.
Template indexes include static layout. The library reader checks Windows paths, eviction and entry hashes.
Struct returns use
declaredNarrow_eq_storage. The stepper checks derivedstindfacts. Generic field operands resolve to their definitions.CLI packing isolates builds and checks the extractor hash. Seven forged-scope fixtures use assembly references. CI uses measured suite times, scaling checks count work and generated regexes use static partial properties.
Measurements
Direct explicit/packed reads: 1,279,438/1,264,256 kernel heartbeats vs 64,722 at 27953ed (CIL.Op). Applications: 7,700/7,695 in both. Reusing field shapes cuts gate proofs to 168,478/177,597 (−86.5%/−85.6%). Both relocations refute.
Countdown at 4/16 costs 643,032/1,783,100 directly versus 485,216/1,530,394 CIL.Op heartbeats. Both use 145 per contract application. The 25-byte bodies match.
At 254 instructions, typed Math.Max calls cost 138,235 frontend and 2,565 kernel heartbeats/instruction (previously 138,215 and 2,565).
Main
27953edband PR400710a2took 9,200 and 23,988 aggregate seconds across 79 matching suites. CLI rose from 199.2 to 1,580.2 s and workspace from 162.7 to 214.3 s. Default verification skips deep checks.Confined.frame_round_tripcarries an empty-footprint contract across a callee that preserves every pre-existing allocation. The compiled SignWindow and unsigned Less proofs each use 103 fewer proof objects. SignWindow frontend/kernel heartbeats fell from 8,849,109/998,273 to 8,811,283/997,462. Less fell from 6,637,333/1,112,951 to 6,606,512/1,112,132.On the same struct field, writable address formation took 180,627 frontend and 5,494 kernel heartbeats (182,698 and 5,862 before), and readonly took 173,538 and 5,416 (175,532 and 5,784 before). On Automation, StoreFacts, MethodContract and CodeAt, the four shared tactic tests, each frontend total fell and each kernel total held or fell.
Changed CountCalls and byref Mutate have identical CIL offsets, instructions and locals on main (.NET 10) and here (.NET 11). In order: old CIL.Op, direct canonical proof, compiled-summary consumer. CountCalls frontend/kernel heartbeats were 12.74M/873,910, 12.45M/760,588 and 7.06M/258,516. Module sizes were 714/764/287 kB, elaboration 2,042/2,276/961 ms and standalone replay 7.0/11.9/13.7 s. The producer cost 22.22M/919,933 heartbeats.
Mutate adds two and confines the write to its eight-byte footprint. In the same order, frontend/kernel heartbeats were 2.73M/93,374, 2.74M/78,043 and 177,252/30,919. Modules were 173/179/30 kB, elaboration 520/561/63 ms and standalone replay 9.0/12.1/12.2 s. The scalar producer cost 2.79M/81,223 heartbeats. Both comparisons use one timing per module.
Applying Lib.Step's summary in App.Direct costs 1,918,794 frontend and 69,536 kernel heartbeats. Direct evaluation of the same arbitrary-memory contract costs 2,221,314 and 364,123. Proving the summary costs 1,594,739 and 285,938.
Step equations used 40–64% fewer kernel heartbeats per instruction and 4–21% more proof bytes.
Across 36 matched stepping workloads, the return-dispatch change increased frontend heartbeats by at most 0.2967% and kernel heartbeats by at most 0.4098%.
Checking one generated
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_methodpreserves the Add, Choose and Countdown proofs, correctness theorem heartbeats and axioms. Before field decoding, deriving a method cost about 45,000 heartbeats per instruction, 4.1–4.3 times the emitted literal and facts. Extraction cost rose 6.0–6.6%, above the 5% threshold, because computing and kernel checking the literal each ran the decoder.Reusing the swapped-load add region cost 232,813 frontend and 25,193 kernel heartbeats. Restep cost 322,632 and 44,371 with the same destination binding. Proof terms had 617 and 518 objects.
Deriving runtime call agreement and binding the full method changes elaboration heartbeats by +0.40% for Add, -2.63% for Add17nint and -0.60% for TraceNarrow, measured against the decoder-only extractor. For the canonical four-word reader, frontend/kernel heartbeats rose from 7,039,350/238,860 to 7,937,633/606,297. For the writer they rose from 8,255,186/272,725 to 8,676,160/640,301. Automation, StoreFacts, MethodContract and CodeAt each moved by at most 345 frontend heartbeats. CallingFields rose 6.60%.
Summaries against stepping and against
main(27953edb, 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). In those examples, single-use summaries cost more frontend heartbeats. OnlyCallsandCountCallssave kernel work. At 16 calls to one callee, reuse costs 52.1M against 158.4M. 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.On one input,
Callsbyrflcosts 1,882,199/524,220 frontend/kernel heartbeats versus 1,412,152/374,759 onmain(+33%/+40%).All 3,427/12,667 self-admissions and 6,081 example/profile cases decode. All 18 class refusals match. Constructors give 2 outlines, 25 outline refusals and 1 extraction refusal. Prior outlines/refusals: 13/63, arguments 14/2, switch/return/throw 30/2, objects/arrays 8/12. Lean checks repeated targets in byte order. Dispatch: 501 definitions, 52 families, 2,026 cases. M4: 100 calls at 125/500 classes took 0.13/0.14 s (from 0.30/0.80 s).
Remaining work
Unsafestep bound calls. Vectors useldobj/stobj. Exception creation folds string loads andnewobj. Typedthrowand C# outline records remain (Use canonical decoded CIL as the sole executable instruction representation #568, Emit canonical CIL and metadata without constructing specialised executable instructions #582).Linux and Windows scalar16: 65,887 kernel heartbeats, frontend counts differ by six.
Not verified
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). At 256 sites, table shape costs about 1,650/site, walking the zipped lists 4,050, the first link read 2,560 and link fit 2,200.Extractor/binmakesTests/SelfAdmission.cs -- --updaterecord an empty baseline and report success (Keep Debug builds of the extractor out of Extractor/bin #624).ldflda, including on a closed generic class. The kernel checks MethodSpec argument counts against the declaration. The decoded-only gate manifest digest remains open.