Repository navigation
Add zero-TCB Anneal.Stdlib.Slice and Convert proof modules - #742
Conversation
|
🤖 Review Receipt for Human review surfaceNone (0 files in Verification receipts (
|
Add two zero-TCB theory modules under `theory/Anneal/Stdlib/` extending
the verified `Anneal.Stdlib` library with `core::slice`,
`core::convert`, `core::cmp::Ordering`, and `core::mem` specifications,
algebraic laws, and Profile v2 operational MIR models, without modifying
`trusted/`, `correspondence/`, `ci/`, `.github/`, or
`theory/bundle-manifest.json`:
- `theory/Anneal/Stdlib/Slice.lean`: pure specifications and algebraic
laws for nine slice operations (`is_empty`, `get`, `first`, `last`,
`split_first`, `split_last`, total checked `split_at`, `starts_with`,
and `ends_with`); zero-`CoreCallOp` Profile v2 MIR models and
`PureStdlibResultV2` theorems for four operations (`sliceIsEmptyBody`
plus copied-`u8` `sliceGetCopiedU8Body`, `sliceFirstCopiedU8Body`,
and `sliceLastCopiedU8Body`); and `CoreContracts` characterizations
and direct spec bridges connecting `CoreCallOp.sliceIsEmpty` to
`specSliceIsEmpty` and panicking `CoreCallOp.sliceSplitAt` to total
`specSliceSplitAt` (panicking where `specSliceSplitAt` returns
`none`).
- `theory/Anneal/Stdlib/Convert.lean`: pure specifications, algebraic
laws, and zero-`CoreCallOp` Profile v2 MIR models with
`PureStdlibResultV2` theorems for `core::cmp::Ordering::{reverse,
then, is_eq, is_ne, is_lt, is_gt}`, `core::convert::identity`,
lossless unsigned `From` and checked `TryFrom` integer conversions,
and value-level `core::mem::{swap, take}`, plus pure spec and
decomposition law for `core::mem::replace` (`specMemReplace`,
`specMemSwap_via_replace`).
- `theory/Anneal/Stdlib.lean`: re-export `Anneal.Stdlib.Slice` and
`Anneal.Stdlib.Convert`.
- `theory/Anneal/Stdlib/Canaries.lean`: positive operational canaries
for the new `Slice` and `Convert` helpers plus constructive
determinism-backed negative soundness canaries via
`pureStdlibResultV2_ret_unique`.
- `tests/cargo-anneal/tests/suite/stdlib_core_canary.rs`: add
`zerocopy_style_slice_and_ordering_verify_e2e`, a synthetic
`zerocopy`-style `#![no_std]` end-to-end Profile v2 test (not a
verbatim `google/zerocopy` item) verifying `core::slice::is_empty`
(via trusted `CoreCallOp.sliceIsEmpty`) and `Ordering::{Equal,
Greater}` with a fail-closed negative control, independent of the
unbundled zero-`CoreCallOp` models in `Anneal.Stdlib.{Slice,Convert}`.
Scope and gaps: the operational models in `Slice.lean` and
`Convert.lean` target `anneal::stdlib_model::*` identities with
by-value signatures (`Option<u8>` for copied element lookups,
`(uN, uN)` for pure value-level `swap`/`take`), and `get`/`first`/
`last` `exec_some` theorems take loaded byte and allocation hypotheses
directly; MIR models for `split_*`/`starts_with`/`ends_with`/`replace`
and automated bridging from captured sysroot `core` MIR (`Option<&T>`,
`(&[T], &[T])`, `&mut T` ABIs, and generic trait dispatch) remain
follow-up work.
All 78 public theorems across `Slice`, `Convert`, and `Canaries` pass
Lean 4.35.0 strict compilation (`-DwarningAsError=true
-DElab.async=false -Ddebug.skipKernelTC=false`), `leanchecker --fresh`,
and `#print axioms` (`<= [propext]`).
`anneal-audit --release --require-correspondence` and
`cargo test -p cargo-anneal-tests --test suite stdlib_core_canary::`
(3/3) pass.
Agent-authored-by: AI agent acting on joshlf's behalf
8a1acb0 to
d2f672c
Compare
|
🤖 Review Receipt for Human review surfaceNone (0 files in Verification receipts (
|
joshlf
left a comment
There was a problem hiding this comment.
Authored by an AI agent acting on joshlf's behalf.
Gate 2 Independent Cross-Family Review — CLEAN (tier1_code, Round 1)
- Identity:
multi:4ad81da4274cfa6a285a2e252c49d772bfba9c10:d2f672cbbb054cf6302c98dbe7d08466cd67a309(base=4ad81da4274c,head=d2f672cbbb05,tree=c535d51559a0) - Separation:
author_family=agentvs.reviewer_family=multi - Coverage: 5 inspected, 0 inapplicable, 0 blocked (of 5 changed file(s))
| Seat | Family | Role | Status | Verdict | Findings | Latency |
|---|---|---|---|---|---|---|
seat1 |
claude-frontier-thinking |
code_and_spec_critic |
completed |
clean |
0 | 458s |
seat2 |
gemini-frontier-thinking |
code_and_hygiene_critic |
completed |
clean |
0 | 366s |
No unresolved P0-P2 findings raised across completed seats.
Non-blocking advisories (P3, not Gate 2 findings)
These notes do not block merge and do not require another Gate 2 round.
G2-R1-A01[P3] (tests/cargo-anneal/tests/suite/stdlib_core_canary.rs:21): The module doc item 3 says the canary exercises 'real sysroot core::slice::<impl [T]>::is_empty', but the selected unit routes is_empty through the trusted CoreCallOp.sliceIsEmpty contract, not a captured sysroot MIR body.G2-R1-A02[P3] (theory/Anneal/Stdlib/Slice.lean:459): ci/stdlib_intrinsics.toml still describes sliceIsEmpty as 'candidate for Tier-1 0-TCB MIR lowering', although this PR adds a partial Tier-1 model (sliceIsEmptyBody). The base convention updates such notes to 'Partially modeled ... in Anneal.Stdlib.X'.
|
Authored by an AI agent acting on joshlf's behalf. Posted |
Add two zero-TCB theory modules under
theory/Anneal/Stdlib/extending the verifiedAnneal.Stdliblibrary withcore::slice,core::convert,core::cmp::Ordering, andcore::memspecifications, algebraic laws, and Profile v2 operational MIR models, without modifyingtrusted/,correspondence/,ci/,.github/, ortheory/bundle-manifest.json:theory/Anneal/Stdlib/Slice.lean: pure specifications and algebraic laws for nine slice operations (is_empty,get,first,last,split_first,split_last, total checkedsplit_at,starts_with, andends_with); zero-CoreCallOpProfile v2 MIR models andPureStdlibResultV2theorems for four operations (sliceIsEmptyBodyplus copied-u8sliceGetCopiedU8Body,sliceFirstCopiedU8Body, andsliceLastCopiedU8Body); andCoreContractscharacterizations and direct spec bridges connectingCoreCallOp.sliceIsEmptytospecSliceIsEmptyand panickingCoreCallOp.sliceSplitAtto totalspecSliceSplitAt(panicking wherespecSliceSplitAtreturnsnone).theory/Anneal/Stdlib/Convert.lean: pure specifications, algebraic laws, and zero-CoreCallOpProfile v2 MIR models withPureStdlibResultV2theorems forcore::cmp::Ordering::{reverse, then, is_eq, is_ne, is_lt, is_gt},core::convert::identity, lossless unsignedFromand checkedTryFrominteger conversions, and value-levelcore::mem::{swap, take}, plus pure spec and decomposition law forcore::mem::replace(specMemReplace,specMemSwap_via_replace).theory/Anneal/Stdlib.lean: re-exportAnneal.Stdlib.SliceandAnneal.Stdlib.Convert.theory/Anneal/Stdlib/Canaries.lean: positive operational canaries for the newSliceandConverthelpers plus constructive determinism-backed negative soundness canaries viapureStdlibResultV2_ret_unique.tests/cargo-anneal/tests/suite/stdlib_core_canary.rs: addzerocopy_style_slice_and_ordering_verify_e2e, a syntheticzerocopy-style#![no_std]end-to-end Profile v2 test (not a verbatimgoogle/zerocopyitem) verifyingcore::slice::is_empty(via trustedCoreCallOp.sliceIsEmpty) andOrdering::{Equal, Greater}with a fail-closed negative control, independent of the unbundled zero-CoreCallOpmodels inAnneal.Stdlib.{Slice,Convert}.Scope and gaps: the operational models in
Slice.leanandConvert.leantargetanneal::stdlib_model::*identities with by-value signatures (Option<u8>for copied element lookups,(uN, uN)for pure value-levelswap/take), andget/first/lastexec_sometheorems take loaded byte and allocation hypotheses directly; MIR models forsplit_*/starts_with/ends_with/replaceand automated bridging from captured sysrootcoreMIR (Option<&T>,(&[T], &[T]),&mut TABIs, and generic trait dispatch) remain follow-up work.All 78 public theorems across
Slice,Convert, andCanariespass Lean 4.35.0 strict compilation (-DwarningAsError=true -DElab.async=false -Ddebug.skipKernelTC=false),leanchecker --fresh, and#print axioms(<= [propext]).anneal-audit --release --require-correspondenceandcargo test -p cargo-anneal-tests --test suite stdlib_core_canary::(3/3) pass.Authored by an AI agent acting on joshlf's behalf.