Repository navigation
Counted pulls in formal/: LT with a byte-sized μ and soundness by finishing order, on the Clean fork - #1034
Draft
jotabulacios wants to merge 2 commits into
Draft
Counted pulls in formal/: LT with a byte-sized μ and soundness by finishing order, on the Clean fork#1034jotabulacios wants to merge 2 commits into
jotabulacios wants to merge 2 commits into
Conversation
LT's multiplicity is counted in bytes rather than bits, and each table's
soundness now follows from a finishing order of its channels instead of a
global balance argument. StaticLookup replaces the static-channel abbrevs, and
the EqLookup ensemble is parameterised by a Balance.
The model builds against the Clean fork rather than upstream:
git = "https://github.com/yetanotherco/clean"
rev = "98e339e9ae2a02e8e0c4d6cfe81c2a5ce9467729"
That revision is upstream Clean main f3abad7c plus two commits: counted pulls
and staged channels, and a build on Lean v4.33.1. Upstream moved to v4.35.0 on
2026-10-22, and v4.35.0 cannot compile the Sail-generated RISC-V model that
formal-riscv/ depends on: its `inductive instruction` has 361 constructors and
the runtime caps constructor tags at 243 (LeanMaxCtorTag in lean.h). See
leanprover/lean4#8930, open and unmilestoned.
So this keeps 10856f8 in force rather than undoing it: lean-toolchain stays
at v4.33.1 and only the Clean entry of the manifest moves. Mathlib, CompPoly
and the rest are already the v4.33.1 set.
The export format changes with Clean main: a pull is no longer a negated
multiplicity but a "direction": "pull" field with a non-negative multiplicity.
prover/src/tests/lean_diff.rs reads that field, so the exported tables and the
Rust test that compares them move together.
The repository merges through a queue, so without a merge_group trigger the job runs on the PR but not on the commit that actually merges: a change that only breaks the model once combined with another queued PR would merge unchecked. The other queued workflows already have the trigger. The new step runs LambdaVM/Axioms.lean, a list of `#print axioms` lines that is not part of the library and so never reaches `lake build`. It fails on sorryAx, on any axiom outside propext, Classical.choice and Quot.sound, and on a count mismatch, so a declaration that is renamed or deleted fails the build instead of quietly dropping out of the check.
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.
Replaces #1031, which was rebased onto a base that changed the toolchain under it and stopped
compiling. Same end state, in two commits that build.
Base is
formal/clean-model(#1027), notmain. Merge order: #1027 → #1033 → this.What changes
be86021— the proofs. LT's multiplicity is counted in bytes rather than bits, and eachtable's soundness follows from a finishing order of its channels instead of a global balance.
StaticLookupreplaces the static-channel abbrevs,EqLookuptakes aBalanceparameter, andtwo ensembles are added:
LtStagedandCountedSameBus. The same commit moves the Clean pin tothe fork and regenerates the exported tables, whose format changed with Clean main.
1e45b46— the workflow. Amerge_grouptrigger, so the job also runs on the commit thatactually merges, and an axiom gate over the new
LambdaVM/Axioms.lean.Both commit messages carry the details. What follows is what they don't say.
Why the fork and not upstream
Two reasons, each sufficient on its own.
CountedChannel.lean(262 lines) andStagedChannels.lean(360) do not exist in
Verified-zkEVM/clean, andBalance.leangains 360 lines there. Thisbranch uses them in 16 places.
be86021explains: upstream is on Lean v4.35.0, andformal-riscv/needs v4.33.1.So fixing leanprover/lean4#8930 would not bring us back to upstream. The unblocker is the fork's
counted-pulls branch landing in
Verified-zkEVM/clean.The pin is a sha in both
revandinputRev, so moving the fork's branch cannot move thisbuild. The fork's own CI never ran on that branch — it triggers on
main, PRs and dispatch only— so I checked the revision by hand:
lake build --wfailover all of Clean (1936 jobs) andCleanTests(2341 jobs), both clean, with 18 SKIPs for snarkjs and wasm-validate not installed.What this proves, and what it does not
The consumers are real:
LT.circuit,MinToy.circuitandCountedMin.circuitdo counted pullson real channels, with
muMax = 255derived from LT's ownARE_BYTES[μ, 0]pull rather thanassumed.
The provider side is a stand-in. The BITWISE-shaped tables in these ensembles are
providerComponent/countedProviderComponentplaceholders, not the real BITWISE circuit withits
numRows = 2^20. Proving the ensembles against the real provider is the next step, not thisPR.
Not vacuous, though:
GeneralFormalCircuitrequirescompletenessas well assoundness, andthe fork's
CountedSquaresWitnessGenerationTest.leangenerates a real witness for a counted pullwith
native_decide.Checked before opening
Full build (2000 jobs), the axiom gate (10 expected, 10 found, no
sorryAx, only the threestandard axioms), and the export — all four JSON files regenerate byte-identical to the committed
ones.
Follow-ups
formal-riscv/needs a 2-line fix whichever of this and Prove RISC-V instructions match Clean model: shifts, comparisons and branch conditions. #1033 merges second:Alu.Guaranteesgains a fourth conjunct and
RiscvEquiv/AluBus.leandestructures it in four places.formal-riscv/does not exist on this branch's base, so nothing is broken here.formal-riscv/, so that breakage would merge green. Worth a separateissue, independent of this PR.