Skip to content

Ap/ixcc - #703

Closed
arthurpaulino wants to merge 4 commits into
jcb/ixccfrom
ap/ixcc
Closed

arthurpaulino wants to merge 4 commits into
jcb/ixccfrom
ap/ixcc

Conversation

@arthurpaulino

Copy link
Copy Markdown
Member

No description provided.

… bounded-parallel)

Port PR #699 (LSpec v3 migration) onto jcb/ixcc (3fee672) and pin LSpec to its
merged main commit (b12338b60c87cc2d2dfeeeaa16d859100ec038c8).

### Summary of Changes

1. **LSpec v3 dependency & generator migration**
   - Pin LSpec in lakefile.lean / lake-manifest.json to main (b12338b6).
   - Configure `moreLeanArgs := #["-Dcompiler.extract_closed=false"]` on `lean_lib Tests`
     in lakefile.lean so pure test expressions inside `def ... : LSpec.Spec` declarations
     are not hoisted into module initializers.
   - Migrate Tests/Gen/{Basic,Claim,Ix,Ixon,IxonSyntax}.lean from SlimCheck / SampleableExt
     to LSpec.Prop (pure SplitMix64 Gen, Sampleable, Shrinkable, FormatValue), preserving
     jcb/ixcc's CompilePolicy / CompileClaim generators.
   - Update Tests/ProofHelpers.lean (checkOk, checkErr, checkErrAny returning LSpec.Spec).

2. **Lazy Bool-based suites & jcb/ixcc-specific suite migrations**
   - Migrate all test modules across Tests/ from TestSeq / individualIO / checkIO / lspecIO
     to LSpec.Spec (it / itBool / prop / propWith / AssertM / lspecMain), preserving all
     jcb/ixcc updates (IxCK renames, CompileClaim wire vectors, ClaimPolicy Mode 2 /
     theorem statements, MultiStarkVerifier admissibility & decoder-parity suites,
     ResourceModes finding/recursive-type suites, SourceContract v5 mode API).
   - Migrate jcb/ixcc-only suites to LSpec v3:
     - Tests/Ix/CircuitMeta.lean
     - Tests/Ix/Compile/Equations.lean
     - Tests/Ix/Compile/WordEquations.lean

3. **Bounded-thread parallel runner, thread-safety & CI**
   - Add -j N / --threads N support to Tests/Registry.lean using LSpec.runTree's shared
     bounded WorkerPool.
   - Add Ix.withImportLock in Ix/Common.lean (used by Ix/Meta.lean and
     Ix/RoleBinding/Compile.lean) to serialize Lean's process-global
     enableInitializersExecution + importModules / searchPathRef across worker threads.
   - Update .github/workflows/ci.yml to run primary IxTests with `-j 16`.

### Verification
- `lake build --wfail IxTests ixon-primitives ixon-tests IxVMTests IxManualTests ffi-tests source-contract-tests formal-package-tests kernel-source-ingress`: passed (zero warnings).
- `IxTests --list`: 7.5s startup (zero import-time test execution).
- `IxTests -j 16`: 61/61 primary suites passed (149.7s wall).
- `ffi-tests`, `source-contract-tests` (69/69), `ixon-primitives`, `ixon-tests`,
  `kernel-source-ingress`, `Scripts/CheckCiFilters.lean`: all passed.
- `formal-package-tests multistark-verifier`: 172/172 passed.
- `IxVMTests`: `ixvm-tagn` (783/783) and `ixvm-exploits` (8/8 + 137/137) passed;
  `ixvm-eval` LSpec v3 oracles (23/23) and all 106 claim verdicts passed (pre-existing
  jcb/ixcc FFT pin drift untouched).
…nd @[...] mode syntax

Port the pure Lean Ix frontend (parser, scope, Tarjan SCC scheduler,
first-order elaborator, canonicalizer, auxgen, tactics) onto jcb/ixcc,
compile it directly to Protocol v6 Aiur circuits via IxCCAiur under
the 8-word Goldilocks public claim-digest ABI (IxVM::verify_claim /
DynamicLink CodecTag.ixonAddrSingle), and unify mode/contract surface
syntax repo-wide onto `@[...]` mode attribute annotations—without
modifying Ix.Syntax (Ix/Environment.lean), Ix.Expr, Ix.ConstantInfo,
or the Ixon v5 binary wire format.

Summary of changes:
- Unified `@[...]` mode annotation syntax everywhere (retiring old
  sigils `0`, `1`, `&`, `!`, `~`, `let borrow`, and bare `@mode`):
  - Exact 1-to-1 Ixon v5 mode vocabulary (`unique`, `borrowed`, `once`,
    `erased`, `borrow`, `shared`) supporting both comma-separated
    (`@[unique, borrowed]`) and adjacent (`@[unique] @[borrowed]`)
    blocks, plus arbitrary whitespace (spaces, tabs, linebreaks)
    immediately after `(`, `{`, `⦃`/`{{`, `[`, `:`, `→`/`->`, `,`,
    `let`, and inside `@[ ... , ... ]`. Rejects mid-group annotations
    like `(a @[unique] b : Nat)`, space inside `@[`, illegal mode
    combinations (`@[once, unique]`, `@[erased, ...]`, `@[borrow, ...]`,
    duplicates), and retired sigils/`@mode` forms.
  - Lean scoped `SourceContract` (`Ix/Compile/SourceContract/{Syntax,Elab}.lean`):
    uses `atomic ("@[" >> sepBy1 ... "," >> "]")` with
    `nonReservedSymbol` (reusing Lean's built-in `"@["`, `","`, `"]"`
    tokens—0 new `TokenTable` entries), and decouples
    `structAnnotatedSimpleField` from `Command.declModifiers` so
    `@[shared]`/`@[erased]` simple fields are not swallowed as Lean
    declaration attributes.
  - Pure Ix frontend (`Ix/Frontend/Parser/{FastTables,Term,Command}.lean`,
    `Syntax.lean`, `Elab/{Term,CorePure}.lean`, `Format.lean`,
    `Circuit/BenchGen.lean`): maximal-munch `"@["` token, pure
    first-order `@[...]` mode prefix parser & Ixon v5 validator,
    anonymous annotated instance binders `[@[borrowed] C α]`,
    `let @[borrow]` (freeing `let borrow v := ...` as an ordinary local
    function), structure field `@[shared]`/`@[erased]` disambiguated
    from top-level `@[no_rc] def ...`, and canonical `@[...]`
    round-trip formatting.
  - Updated all tests, ownership fixtures (`IxCC/fixtures/ownership/src/*/Annotated.lean`
    and `IxCC/IxCCTests/Own/Strip.lean`), `Tests/Cli.lean`,
    `Tests/Ix/SourceContract/*`, `Tests/Ix/ResourceModes.lean`,
    `ModeRepairTests/`, `docs/source-contracts.md`,
    `docs/resource-checking.md`, and comments repo-wide.
- Unified Ixon.ElabClaim (Ix/Ixon/ElabClaim.lean, 0xE8 0x0B | 04 03):
  Collapse ElabClaim, ElabEnvClaim, and module elaboration claims into
  a single content-addressed wire format (kind, flags, sourceAddr,
  outputAddr, optional importsAddr / syntaxAddr / exportsAddr; 70 B
  minimal, 102 B with syntaxAddr, 134 B with syntaxAddr + exportsAddr),
  strictly disjoint from Ix.Claim.de. Updated Scripts/GenPaperFixtures.
- Compositional frontend circuits (Ix/Frontend/Circuit/{Wire,Entry,Schedule,BenchGen}.lean):
  - Entrypoints verifyParse (sourceAddr -> syntaxAddr via ch 4) and
    verifyElabStx (syntaxAddr -> alphaEnv/exportsAddr via ch 5), chained
    cryptographically by claim.syntaxAddr, plus zero-copy Bytes::Stream
    wire encoding and sidecar @[circuit_*] scheduling (zero Ixon address
    mutation).
  - First-order CorePure elaborator (Ix/Frontend/Elab/CorePure.lean) and
    split prelude/defeq helpers to eliminate ANF closures and narrow wide
    cold chips.
- IxCCAiur & prover tooling (IxCCAiur/, crates/aiur/examples/ixcc_prove.rs):
  - Opt-in profile-guided dense cold-chip grouping (--auto-group-dense,
    --auto-group-cold-rows N) that keeps hot chips narrow while densely
    packing cold/uninvoked chips within Protocol v6 stark-key u16 NodeId
    limits (<65,535), zero TCB (certified by Grouping.preparePlan).
  - Non-numeric prim widening in PolyShapeInfer, cycle guard in
    PolyFunSpecialize, w32/w64 cases in BigNatLower with zero-sorry
    proofs in BigNatWholeProof, --dict-spec, and ixcc_prove --exec-only,
    function_rows profiling, and channel 5 syntax-stream tamper checks.

Verified end-to-end STARK proving (Protocol v6: log_blowup=2,
num_queries=128, maxDegree=3; --pin checked, 8/8 forged claim words and
2/2 tampered streams rejected on every run):
- pair-parse (334 B `@[unique]` FrontendPair.ix, verifyParse, dense):
  - standalone: 15.5 ms exec, 10.2 ms witness, 661 ms prove, 143 ms verify,
    109 active circuits, 18,285 prog rows, 34.78 MB proof
  - --batch v6: 844 ms prove, 301 ms verify, 34.88 MB proof, 14.01 MB VK
- pair-elab-stx (334 B `@[unique]` FrontendPair.ix, 126 consts, verifyElabStx):
  - standalone: 53.6 ms exec, 78,569 prog rows, verified with --pin & --controls
  - --batch v6: 52.6 ms exec, verified with --pin & --controls (8/8 forged
    claims and 2/2 tampered streams rejected)
- Prior dense benchmark (319 B FrontendPair.ix, same Xeon 6975P-C):
  - Compiled Lean Ix.Frontend (full general Ix language, verifyParse +
    verifyElabStx dense, num_queries=128): 74.5 ms exec, 1.97 s prove /
    356 ms verify, 313.5M FFT, 29.32 MB + 56.67 MB proofs, 3.7 GiB RSS
  - Handwritten Direct Aiur (matched_aiur, bounded subset, num_queries=100):
    270.5 ms exec (3.6x slower), 758 ms prove / 128 ms verify, 127.1M FFT,
    41.32 MB proof (~52.9 MB normalized to 128 queries)
  - Interpreted Lean via IxVM (jcb/ix-frontend baseline): OOM on elab
    (>448 GiB VM limit); 115.45 s exec (~7,800x slower) on parse-only

Verification:
- lake build Ix.Compile.SourceContract.Elab Tests.Ix.SourceContract.{SyntaxFixture,SyntaxCheck,Imported,ImportCheck} (15/15; 0 new TokenTable entries)
- lake exe source-contract-tests (100% pass)
- lake build Ix.Frontend Ix.Frontend.Circuit.{Schedule,BenchGen} Tests.Cli Tests.Ix.ResourceModes ix (6,300/6,300)
- Ix.Frontend mode syntax & format round-trip suite (host == CorePure bit-exact alphaEnv hash; 23/23 negative parse controls rejected)
- cd IxCC && lake exe tests-own --only strip (22/22 assertions passed across all ownership twins)
- lake env lean --run Ix/Frontend/Circuit/BenchGen.lean (8/8 fixtures bit-exact)
- ixcc-aiur + ixcc_prove standalone & --batch v6 verified on pair-parse & pair-elab-stx
- git diff origin/jcb/ixcc -- Ix/Environment.lean is empty
…QROM)

Align Ix on shipped Protocol v6 (Goldilocks^3 + 32-byte BLAKE3-256 +
Stage-1 pinning enabled, stage_1_pinning = 1) with CertiFRI
ap/v6-qrom-0.5 (14f7a315bf5bc46fb124b6f0e9bb53b1f23ea63b), establishing
machine-checked >=127.71-bit classical ROM (ideal sponge; keyed
byte-level at eps_rbr <= (3/4)/2^133) and unconditional >=64-bit QROM
post-quantum soundness (Johnson regime, compressed-oracle + Zhandry
Lemma 5 standard-QRO) across IxVM, Recursion, Aggregation, and
transparent Endpoint 1 (compact400KBBalanced).

Summary of changes:
- CertiFRI pin alignment: update Cargo.toml, Cargo.lock, lakefile.lean,
  and lake-manifest.json to CertiFRI 14f7a315bf5b; adapt
  Ix/Cert/MultiStark/PrunedSoundness.lean.
- Stage-1 pinning (stage_1_pinning = 1) across all Rust crates &
  in-circuit Aiur verifier:
  - stark-key & Ix/Aiur/Parameters.lean: 8th u16 stage_1_pinning
    (required = 1 in production), range preamble commits to
    (&proof.preamble, &proof.pinned), verified by lean_mirror_matches.
  - aiur, proof-compression, stark-shrinker (transparent EP1 systems;
    hiding OuterSystem::Zk left out-of-scope and documented honestly),
    stark-verifier, stark-verifier-native, ffi, MultiStark/ Aiur
    modules, refinement pins, and regenerated Tests/Fixtures/MultiStark/.
- Pure-Lean pinned verifier cutover:
  - Add Mathlib-free, zero-FFI Ix/Cert/MultiStark/PinnedVerifier.lean
    directly calling CertiFri.Stark.Profile.verifyBytesPinned with Ix's
    validate_preamble policy (MEMSEG=16 closure pairs, K-lane 2^39
    weighted rows, zero-PoW witness admissibility, tensor challenge cap).
  - Wire Ix/Cli/PureStarkVerifierKernel.lean (`ix verify`) and
    Scripts/VerifyMultiStark.lean to PinnedVerifier; update
    Ix/Cert/MultiStark/StarkKey.lean and Tests/Ix/MultiStarkVerifier.lean.
- Release 0.5 formal audit, closure manifest, CLI PQ report & docs:
  - Add Ix/Cert/Release05/SecurityAudit.lean and
    Ix/Cert/Release05/ClosureManifest.lean (5,142 constants, SHA-256
    5152a1554cf081b5edda33f045767e7d21e6cd13a04c3fe2da25eec57b4a8dc7),
    strictly [propext, Classical.choice, Quot.sound], verified via
    #guard_msgs, #guard_module_axioms, leanchecker, and 264-module /
    19,133-constant Scripts/KernelReplay.lean.
  - Add --pq support to Ix/Aiur/FriSecurity.lean and Scripts/FriSecurity.lean.
  - Update docs/stark-parameters.md and docs/endpoint-security-review.md.

CPU benchmark (Protocol v6 + Stage-1 pinning, --features parallel):
- ix prove Nat.add_comm: 10.64 s wall-clock (end-to-end incl. witness gen)
- Stored Ixon.Proof size: 24,734,653 bytes (23.59 MiB)
- Pure-Lean ix verify (CertiFri.Stark.Profile.verifyBytesPinned): 7.26 s

Verification:
- cargo test --locked: stark-key (27/27), aiur --features parallel (195/195
  incl. lean_mirror_matches), proof-compression (fri 12/12, pipeline 64/64),
  stark-shrinker (plonkish 12/12 + e2e .ixa 2/2), stark-verifier (14/14).
- Lean: Ix.Cert.Release05.{SecurityAudit,ClosureManifest}, leanchecker
  Ix.Cert.Release05, Scripts/KernelReplay.lean (264 modules, 19,133 consts),
  verify-multistark --self-test (6/6), IxTests pure-verify-cli,
  formal-package-tests multistark-verifier, Scripts/CheckFormal.lean (full
  CPU integration gate incl. controller/checking/cuda --cpu-only).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant