Add ix claim/prove/verify pipeline; ix check becomes the Aiur kernel runner#428
Closed
arthurpaulino wants to merge 1 commit into
Closed
Add ix claim/prove/verify pipeline; ix check becomes the Aiur kernel runner#428arthurpaulino wants to merge 1 commit into
arthurpaulino wants to merge 1 commit into
Conversation
c37f2e5 to
7f85003
Compare
lake exe kernel + ix claim/prove/verify over the content-addressed store…runner
Renames the Rust-kernel typechecker `ix check` to `ix check-rs`
(verbatim move into `Ix/Cli/CheckRsCmd.lean`) and rebuilds the
default `ix check` around the IxVM Aiur kernel — the path
`lake exe kernel` used to take.
ix check Nat.add_comm # compiled-in Lean env
ix check --ixe arena.ixe foo bar # from .ixe, targeted names
ix check --ixe arena.ixe # iterate every named const
ix check --interp Foo.bar # Aiur interpreter (richer errors)
ix check --stats-out STATS Foo.bar # redirect per-circuit stats
Variadic positional names; flags `--interp` / `--keep-going` /
`--ixe` / `--stats-out`. Per-circuit stats print only on a single
target. `IX_QUIET=1` set unconditionally. `Kernel.lean` collapses
into a thin Cli shim around `Ix.Cli.CheckCmd.runCheckCmd`; the
`lake exe kernel` binary stays for fast Lean iteration.
`Ix/Cli/ProveCmd.lean` (replacing a commented-out scaffold):
ix prove <claim-hex> <ixe-path>
Reads the persisted claim, loads the env, resolves every
assumption / env / contains tree the claim references (each tree
must be in the store), builds the kernel witness via
`IxVM.ClaimHarness.buildClaimWitness`, runs Aiur's `prove`
against `verify_claim`, wraps the opaque proof bytes in a new
`Ixon.Proof { claim, proof }`, persists the wrapper, prints its
blake3 hex.
`Ix/Cli/VerifyCmd.lean`: `ix verify <proof-hex>` reads the
wrapper, recomputes `blake3(Claim.ser claim)` as the
`verify_claim` public input, rebuilds the Aiur backend, runs
`verify`. One arg — the wrapper carries the claim. Commitment +
FRI params are private constants in both files and must stay in
sync (TODO: move into the proof header).
`Ix/Claim.lean` defines `Ixon.Proof` under Tag4 flag
`FLAG_PROOF = 0xF` (claims use `0xE`), reusing the per-variant
`VARIANT_*_PROOF` size constants. `put` / `get` / `ser` / `de`
round-trip every claim variant.
`Ix/Cli/ClaimCmd.lean`: `ix claim {check, check-env, contains,
eval}` build an `Ix.Claim`, persist it at `blake3(ser claim)`,
print its address. `--asm <root>` threads an assumption-tree
merkle root. `reveal` is a TODO pending a JSON schema for
`Ix.RevealConstantInfo`.
`Ix/Cli/TreeCmd.lean`: `ix tree canonical <hex,hex,...>` and
`ix tree env <ixe>` build an `Ix.AssumptionTree` and persist it
under its merkle root (not under `blake3(bytes)`), so
`--asm <root>` references resolve with a plain `Store.read root`.
`Ix/Store.lean` gains `writeAt addr bytes` for content whose
canonical key isn't `blake3(bytes)`.
`Ix/Cli/AddrOfCmd.lean`: `ix addr-of <Lean.Name> [--ixe <path>]`
resolves a name to its 32-byte address — from a `.ixe` (via
`Ixon.Env.getAddr?`) or from the compiled-in Lean env (via
`IxVM.ClaimHarness.loadIxonEnv` → `lookupAddr`). Prints one hex
line so it composes with `ix claim …` and `ix prove …`.
`Ix/Cli/CompileCmd.lean` moves the input file to a positional
arg and adds a seed-filter trio:
- `--module <prefix,…>` — filter by SOURCE MODULE prefix (via
`Lean.Environment.getModuleIdxFor?` +
`allImportedModuleNames`). Catches macro-emitted decls
registered under unqualified names because the host module
still matches.
- `--exclude <names>` / `--exclude-file <path>` — strip names
from the seed set (excluded names still reappear via the
transitive closure if any other seed references them).
The compile path now threads `collectDeps` over filtered seeds
into `rsCompileEnvBytesFFI` rather than dumping the whole env.
`Ix/Cli/IngressCmd.lean` and `Ix/Cli/ValidateCmd.lean` get the
same positional-`<path>` treatment for shape consistency.
The subject-only kernel entrypoint (transitive deps trusted; not
a claim path) is renamed across `Ix/IxVM/Kernel/Claim.lean`,
`Ix/IxVM/ClaimHarness.lean` (`buildDbgCheckConst` →
`buildVerifyConst`), and `Tests/Ix/Kernel/Arena.lean`.
`Ix/IxVM.lean` gets a fresh docstring on `ixVM` explaining why
`verify_const` shares the blake3-verifying loaders with
`verify_claim`. `Ix/IxVM/Ingress.lean` reorders so
`load_verified_blob` sits next to `load_verified_constant` (no
behavior change).
`Tests/Ix/Kernel/ArenaExclude.lean` + `lean_exe arena-exclude`
in `lakefile.lean` emit the names that can't be driven through
the kernel — `.bad`-outcome decls, `knownIncompatible` entries,
`renamings`-tagged collision tests — one per line, ready for
`ix compile --exclude-file`.
Rename `lake exe kernel` to `lake exe check` to reflect the
`ix check` command.
Everything content-addressed lives under
`~/.ix/store/XX/YY/ZZ/<rest>`:
- Claims — key = `blake3(Ix.Claim.ser claim)`. First byte `0xE`.
- Proofs — key = `blake3(Ixon.Proof.ser wrapper)`. First byte
`0xF`. Wrapper carries the claim, so `ix verify` needs only
the proof hex.
- Trees — key = merkle root. Written via `Store.writeAt`.
`Main.lean` registers the new subcommands and uncomments
`proveCmd`.
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.
Renames the Rust-kernel typechecker
ix checktoix check-rs(verbatim move into
Ix/Cli/CheckRsCmd.lean) and rebuilds thedefault
ix checkaround the IxVM Aiur kernel — the pathlake exe kernelused to take.ix check(Aiur kernel runner)Variadic positional names; flags
--interp/--keep-going/--ixe/--stats-out. Per-circuit stats print only on a singletarget.
IX_QUIET=1set unconditionally.Kernel.leancollapsesinto a thin Cli shim around
Ix.Cli.CheckCmd.runCheckCmd; thelake exe kernelbinary stays for fast Lean iteration.ix prove+ix verify+Ixon.ProofwrapperIx/Cli/ProveCmd.lean(replacing a commented-out scaffold):Reads the persisted claim, loads the env, resolves every
assumption / env / contains tree the claim references (each tree
must be in the store), builds the kernel witness via
IxVM.ClaimHarness.buildClaimWitness, runs Aiur'sproveagainst
verify_claim, wraps the opaque proof bytes in a newIxon.Proof { claim, proof }, persists the wrapper, prints itsblake3 hex.
Ix/Cli/VerifyCmd.lean:ix verify <proof-hex>reads thewrapper, recomputes
blake3(Claim.ser claim)as theverify_claimpublic input, rebuilds the Aiur backend, runsverify. One arg — the wrapper carries the claim. Commitment +FRI params are private constants in both files and must stay in
sync (TODO: move into the proof header).
Ix/Claim.leandefinesIxon.Proofunder Tag4 flagFLAG_PROOF = 0xF(claims use0xE), reusing the per-variantVARIANT_*_PROOFsize constants.put/get/ser/deround-trip every claim variant.
ix claim+ix treebuildersIx/Cli/ClaimCmd.lean:ix claim {check, check-env, contains, eval}build anIx.Claim, persist it atblake3(ser claim),print its address.
--asm <root>threads an assumption-treemerkle root.
revealis a TODO pending a JSON schema forIx.RevealConstantInfo.Ix/Cli/TreeCmd.lean:ix tree canonical <hex,hex,...>andix tree env <ixe>build anIx.AssumptionTreeand persist itunder its merkle root (not under
blake3(bytes)), so--asm <root>references resolve with a plainStore.read root.Ix/Store.leangainswriteAt addr bytesfor content whosecanonical key isn't
blake3(bytes).ix addr-ofIx/Cli/AddrOfCmd.lean:ix addr-of <Lean.Name> [--ixe <path>]resolves a name to its 32-byte address — from a
.ixe(viaIxon.Env.getAddr?) or from the compiled-in Lean env (viaIxVM.ClaimHarness.loadIxonEnv→lookupAddr). Prints one hexline so it composes with
ix claim …andix prove ….ix compilefiltering + positional inputsIx/Cli/CompileCmd.leanmoves the input file to a positionalarg and adds a seed-filter trio:
--module <prefix,…>— filter by SOURCE MODULE prefix (viaLean.Environment.getModuleIdxFor?+allImportedModuleNames). Catches macro-emitted declsregistered under unqualified names because the host module
still matches.
--exclude <names>/--exclude-file <path>— strip namesfrom the seed set (excluded names still reappear via the
transitive closure if any other seed references them).
The compile path now threads
collectDepsover filtered seedsinto
rsCompileEnvBytesFFIrather than dumping the whole env.Ix/Cli/IngressCmd.leanandIx/Cli/ValidateCmd.leanget thesame positional-
<path>treatment for shape consistency.dbg_check_const→verify_constThe subject-only kernel entrypoint (transitive deps trusted; not
a claim path) is renamed across
Ix/IxVM/Kernel/Claim.lean,Ix/IxVM/ClaimHarness.lean(buildDbgCheckConst→buildVerifyConst), andTests/Ix/Kernel/Arena.lean.Ix/IxVM.leangets a fresh docstring onixVMexplaining whyverify_constshares the blake3-verifying loaders withverify_claim.Ix/IxVM/Ingress.leanreorders soload_verified_blobsits next toload_verified_constant(nobehavior change).
Arena exclude-list generator
Tests/Ix/Kernel/ArenaExclude.lean+lean_exe arena-excludein
lakefile.leanemit the names that can't be driven throughthe kernel —
.bad-outcome decls,knownIncompatibleentries,renamings-tagged collision tests — one per line, ready forix compile --exclude-file.Storage layout (recap)
Everything content-addressed lives under
~/.ix/store/XX/YY/ZZ/<rest>:blake3(Ix.Claim.ser claim). First byte0xE.blake3(Ixon.Proof.ser wrapper). First byte0xF. Wrapper carries the claim, soix verifyneeds onlythe proof hex.
Store.writeAt.Main.leanregisters the new subcommands and uncommentsproveCmd.