Repository navigation
Conversation
Extend the executable MIR model, M_ref, PureLift, and the kernel-checked
correspondence proof to cover Unicode scalar char values, three-way
BinOp.cmp comparisons (via core::cmp::Ordering), checked-overflow
arithmetic (BinOp.{add,sub,mul}WithOverflow), and CastKind.intToInt
casts (paths below are relative to anneal/):
- trusted/lean/Trusted/{MirAst.lean,MirAst/{Types,Rvalues}.lean,
MirModel.lean}: add MirTy.char and MirTy.ordering (for
core::cmp::Ordering, #[repr(i8)] with Less = -1, Equal = 0,
Greater = 1), OrderingVal and Val.{char,ordering}, BinOp.cmp,
BinOp.isOverflowing, CastKind (.intToInt | .unsupported), and
Rvalue.cast (the three *WithOverflow BinOp variants already existed).
- trusted/lean/Trusted/{MirSemantics.lean,MirSemantics/{Ops,Enum,Layout,
Bytes,State,Step,Boundary,CanaryFixtures}.lean}: add char layout
(<4, 2>), ABI valid scalar-value checks (<= 0x10ffff excluding
surrogates), ordering discriminant reads (i8 dst) and rejection of raw
primitive reads on Ordering, overflow arithmetic (*WithOverflow in
Ops.lean), natural-alignment overflow-pair layout (intLayout align; 16
for i128) and codec for .tuple [.int w s, .bool] with uninit padding
bytes ignored on decodeVal, evalCharSwitchBranches, CastKind.intToInt
casts across integers, bool, and char (u8-only integer-to-char),
castTypesValid enforcement in initState and BodyStaticAdmitted, and
five Pass 1 canaries (20 -> 25).
- trusted/correspondence/Trusted/{Correspondence.lean,Correspondence/
{Codec,State,Config,Simulation}.lean}: wire M_ref through
Miri.Interpreter.ExecutionMachine.step using ScalarOps,
IntegerOps.binaryChar, ScalarInt.{toChar,ofChar}, Cast.cast, and
IntegerCast.cast (activating refCastLeaves.typeInfo, refScalarLeaves,
refValidityHooks, refProjectFieldLayout field 1, and Ordering enum
hooks), with BackendRepr.ScalarPair layouts, refHasPadding (true for
Memory reprs and padded ScalarPairs), refCastTypesValid, FrameSimInv
updated for castTypesValid, and three Pass 2 claims D14-D16
(34 -> 37).
- theory/Anneal/{MirWp.lean,MirWp/{Canaries,Execution,Reflection}.lean,
PureLift/MirBridge.lean} and correspondence/Anneal/
{MirCorrespondenceProof.lean,MirCorrespondence/*.lean}: discharge all
five new Pass 1 canary theorems, extend PureLift computable mirrors,
and prove lockstep correspondence (zero sorry, zero Trusted-namespace
leaks in non-Trusted modules).
- trusted/audit/{TrustedBoundary.lean,src/lib.rs,
tests/boundary_audit.rs} and
docs/{trust-model,mir-correspondence-design}.md: lock the 25 Pass 1
and 37 Pass 2 claims and all 39 required live ExecutionMachine Miri
primitives with positive and negative tests, fix the stale 38,718 ->
38,728 vendor declaration count in a TrustedBoundary.lean doc comment,
and update design docs.
No trust-boundary checks or auditor allowlists are relaxed.
Agent-authored-by: AI agent acting on joshlf's behalf
|
Authored by an AI agent acting on joshlf's behalf. Review Receipt (Gate 1)
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## joshlf-anneal-mir-completeness-03-memory-model #4005 +/- ##
===============================================================================
Coverage 92.99% 92.99%
===============================================================================
Files 16 16
Lines 2469 2469
===============================================================================
Hits 2296 2296
Misses 173 173 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Authored by an AI agent acting on joshlf's behalf.
Human review surface
anneal/trusted/lean/):anneal/trusted/lean/Trusted/MirAst.lean,MirAst/Types.lean,MirAst/Rvalues.lean: AddedMirTy.char,MirTy.ordering(forcore::cmp::Ordering,#[repr(i8)]Less = -1,Equal = 0,Greater = 1with verbatimlibrary/core/src/cmp.rsrust-lang/rust@8144389cquote),BinOp.cmp,BinOp.isOverflowing(the threeBinOp.*WithOverflowvariants already existed inRvalues.lean; addedAddWithOverflowquote fromsyntax.rs@8144389c),CastKind(intToInt | unsupported), andRvalue.cast; extendedMirTy.beqand AST module docs.anneal/trusted/lean/Trusted/MirModel.lean: Added self-containedOrderingVal(less | equal | greater, avoidingInit.Data.Ord.Basic),Val.char (c : Char), andVal.ordering (ord : OrderingVal).anneal/trusted/lean/Trusted/MirSemantics/Layout.lean: AddedoverflowPairLayoutfor.tuple [.int w s, .bool](natural scalar-pair size2 * (intLayout w).sizeand natural alignment(intLayout w).alignLog2— i.e.,w.byteSize, including16fori128, withw.byteSize - 1padding bytes matchingLayoutData::scalar_pairinsimple.rs@8144389cfora=T, b=bool), and admitted.char(⟨4, 2⟩),.ordering(⟨1, 0⟩), and overflow pairs inlayoutOfTy. (By existing convention,M_reflayouts useAlign.ONE, a difference unobservable in profile v1.)anneal/trusted/lean/Trusted/MirSemantics/Enum.lean: AddedisUnicodeScalar(with verbatimrust-lang/reference@a286e1ecquote),orderingTagBits/orderingOfTagBits(255/0/1),isOverflowPairTy, andisIntLikeTy; updatedVal.ty?,checkVal,isSupportedScalarOrUnitTy(admitting.char,.ordering, and.tuple [.int w s, .bool]), andisPrimitiveReadableTy(admitting.charand.tuple [.int w s, .bool], while rejecting.orderingand enums whoseM_reftag scalar is.Union).anneal/trusted/lean/Trusted/MirSemantics/Bytes.lean: ExtendedevalConstLit,encodeVal, anddecodeValfor.char,.ordering, and overflow pairs.tuple [.int w s, .bool](encoding integer + bool +w.byteSize - 1.uninitpadding bytes with verbatimrustcplace.rs@8144389cquote; decoding integer and bool slices and ignoring padding bytes).anneal/trusted/lean/Trusted/MirSemantics/Ops.lean: AddedcmpOrderingOfInt,intLikeBits, andevalIntToIntCast(with verbatimcast.rs@8144389cquotes); extendedevalArithOp(BinOp.{add,sub,mul}WithOverflowreturning.tuple [.scalar wrapped, .bool (hostOverflow || lossy)]),evalBinOp(Cmpon same-typed ints ->OrderingVal;Eq..GeandCmponchar-> comparing Unicode scalar values;.unsupportedonbool.cmp), andevalUnOpdocs (rejecting unary ops onchar).anneal/trusted/lean/Trusted/MirSemantics/{State,Step,Boundary,CanaryFixtures}.leanandTrusted/MirSemantics.lean: Added staticcastTypesValid(enforcingdstTy == castTyon unprojected.assign dst (.cast .intToInt _ castTy), enforced in bothinitStateand publicBodyStaticAdmittedinBoundary.lean:217matchingrustcwell-formed MIR invariant) and.orderingcase indiscriminantTypesValid; addedevalOrderingDiscriminantOfVal,.cast .intToIntinevalRvalue(source-type check -> uninit check -> target check ->u8 -> charcheck), andevalCharSwitchBranches(plus empty-branches-onlyswitchIntjump tootherwisefor overflow pairs, matchingrustc's interpreter instep.rs:555-577even thoughrustcMIR validation rejects that form) inevalTerminator; added 5 locked Pass 1 canaries (20 -> 25,Canary*AnnealClaim).anneal/trusted/correspondence/):anneal/trusted/correspondence/Trusted/Correspondence/{Codec,Config,Simulation,State}.leanandTrusted/Correspondence.lean: ExtendedRefRvalue/codec with.cast(andcollectTy/interning for.char/.ordering); activated previously fail-closedM_refleaves (refCastLeaves.typeInfoadmittingint/bool/char,refScalarLeavesorderingLayout/overflowLayoutand.chartypeKind,refValidityHooks.typeKind.char/.ordering/overflow pairs,refProjectFieldLayoutfield1for overflow pairs and field0for.ordering,refProjectVariantLayoutandrefDiscriminantLeavesfor.ordering,toMiriRvaluemapping.cast .intToIntto.Cast .IntToIntand.cast .unsupportedto.CopyForDeref); updatedcheckRefVal,evalRefConstLit,valToMiriImmediate,BackendRepr.ScalarPairlayout for.tuple [.int w s, .bool], andrefReadReturnVal; replaced PR 03's constant-falserefHasPaddingwith theplace.rs:971-992rule (falseforScalar,|a| + |b| != sizeforScalarPair— sofalsefori8/u8pairs andtruefor wider overflow pairs — andtrueforMemoryreprs such as.unit,.never, and ZST enums, routing any indirect copy of those throughmemoryCopy, which tightens Day-1 behavior consistently withM_anneal); addedrefCastTypesValidandcastTypesValid body = truetoFrameSimInv; added 3 locked Pass 2 claimsD14–D16(34 -> 37).anneal/trusted/audit/{TrustedBoundary.lean,src/lib.rs,tests/boundary_audit.rs}):20 -> 25), 3 new Pass 2 claims (D14–D16,34 -> 37), and 5 new required liveExecutionMachineMiri primitives inverifyRefEvaluatorIndependence(34 -> 39:IntegerOps.binaryChar,Cast.cast,IntegerCast.cast,ScalarInt.{toChar,ofChar}, all also purity-checked viaclosureCorr); fixed stale38,718 -> 38,728vendor declaration count in doc comment; added matching positive and negative tests inboundary_audit.rs. No auditor allowlists or boundary checks relaxed.anneal/docs/{trust-model,mir-correspondence-design}.md):20 -> 25,34 -> 37,34 -> 39), and updatedmir-correspondence-design.md(§1, §3.1, §4.1, §4.4, §4.5, §5.2, §5.4) forchar,Ordering,*WithOverflow,CastKind.intToInt, andcastTypesValid. (Cumulative stack also relies on PR 03'sSimulationInvpinnings.mem = entryMemoryandforceAllocation/allocateStackremaining canary-reached only.)none.Summary
Stacks on #3977 (
joshlf-anneal-mir-completeness-03-memory-model) to addcharvalues/operations,BinOp.cmp(core::cmp::Ordering), checked-overflow arithmetic (BinOp.{add,sub,mul}WithOverflowproducing(T, bool)overflow pairs with natural alignment and padding), andCastKind.intToIntinteger/bool/charcasts acrossTrusted.MirAst,Trusted.MirSemantics,Trusted.Correspondence,Anneal.PureLift,Anneal.MirWp, andAnneal.MirCorrespondenceProof.All 25 Pass 1
MirWpclaims, all 37 Pass 2 claims, and all 39 required liveExecutionMachineprimitives build, replay, and passanneal-audit --require-correspondenceandcargo test -p anneal-auditwith zerosorry.