feat/refactor[Hachi]: fig. 3 protocol + CWSSPackages abstraction + partial reorg of Hachi folder - #626
Conversation
…i-polynomial-quadratic-eq
…i-polynomial-quadratic-eq
🤖 PR Summary
This pull request formalizes the Figure 3 protocol from the Hachi paper and introduces the Statistics
Lean Declarations ✏️ Removed: 18 declaration(s)
✏️ Added: 128 declaration(s)
❌ Added: 1 `sorry`(s)
📋 **Additional Analysis**No findings. 📄 **Per-File Summaries**
Last updated: 2026-07-17 14:15 UTC. |
…ratic-eq # Conflicts: # ArkLib/Commitments/Functional/Hachi/Gadget.lean
|
/review |
|
AI-assisted review note: the feedback below was generated from a detailed review conducted collaboratively with the repository reviewer and has been reviewed by the human reviewer. The Rq-level polynomial-evaluation/CWSS core builds cleanly and the inspected extraction theorems are axiom-clean. The remaining requests are about making the partial scope and paper-to-code interfaces precise: qualify the relaxed range relation, state the generalized-to-paper parameter bridge, make the provisional scheme packaging visibly WIP, clean up the Hachi docstrings, and resolve the current merge conflict. The renamed module paths are an optional migration consideration, not a current internal build failure. Suggested location-specific feedback: ArkLib/Commitments/Functional/Hachi.lean:16 Small documentation cleanup request (non-blocking): please keep this umbrella docstring synchronized with the actual scope as the PR evolves. It currently says the development is in progress and points readers to TODOs, which is useful; please ensure the exported names and PR description use the same WIP/partial terminology so downstream readers do not mistake this namespace for the finished paper scheme. ArkLib/Commitments/Functional/Hachi/QuadEval/Reduction.lean:182 Fidelity/documentation: c6 is a deliberate relaxation of the paper's centered ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean:263 Soundness interface: please make the relation-to-paper parameter mapping explicit. Hachi Lemma 8 fixes ArkLib/Commitments/Functional/Hachi/Commitment.lean:132 Completeness/scope: this public packaging is not yet connected to an instantiated honest QuadEval prover; Optional module migration note The patch renames public module paths including |
There was a problem hiding this comment.
🤖 AI Review
Reviewed at commit bef1984bba40.
Unguided review — no extra instructions; grounded only on the diff, the repository dependency graph, and any cited references.
Verdict (deterministic): Changes Requested
Basis:
- Escape hatch(es) introduced in this PR (
sorry) — hard verdict rule. - 4 critical misformalization(s) and 1 Lean/Mathlib issue(s) across files.
- 3 cross-file issue(s).
- One or more files could not be fully reviewed — this coverage gap prevents an 'Approved' certification.
Overall Summary:
TL;DR: The PR delivers a robust formalization of Hachi's QuadEval reduction and CWSS composition, but it contains two critical blockers: a new sorry in the commitment scheme's opening proof, and an unresolved dependency on the missing LS18 unit lemma, which leaves the soundness theorems incomplete. Additionally, a potential type mismatch in CheckClaim.lean needs verification.
Mechanical Pre-Check Results: Mechanical pre-checks detected a new sorry introduced in this PR: ArkLib/Commitments/Functional/Hachi/Commitment.lean (opening := sorry). Pre-existing sorries are present in ArkLib/ProofSystem/Component/SendWitness.lean (lines 100 and 343) but are not introduced by this PR. No other escape hatches (axiom, native_decide, etc.) were found.
Checklist Coverage: The PR covers the inner-outer commitment, the QuadEval reduction structure, gadget algebra and norm bounds, polynomial evaluation bridge, and the CWSS composition infrastructure. The specification checklist items that are fully satisfied include the mapping of the monomial basis (NOZ26 Eq. 12), the inner-outer Ajtai commitment (NS24 §3.1, NOZ26 §4.1), the QuadEval relations and extraction (NOZ26 Lemma 8), the EvalSplit lemmas, the gadget norm bounds, the challenge space and invertibility, and the generic CWSS assembly. However, two critical gaps remain: (1) the LS18 Corollary 1.2 unit lemma (isUnit_of_l1Norm_le) is still a sorry in the dependency chain, so the soundness theorems are not fully proved; (2) the opening proof for the hachi commitment scheme is a sorry (introduced in this PR). The PR also adds a potential type mismatch in CheckClaim.lean (unconfirmed). The missing LS18 lemma is a blocking gap for the soundness results, and the sorry in Commitment.lean is an escape hatch that alone requires a Changes Requested verdict.
Cross-File Issues: The composition chain (bridgePackage ▷ quadEvalPackage) is correctly wired: the bridge's output (QuadEvalStatement) is definitionally equal to QuadEval's input, and the CWSS composition uses the correct purity witnesses. The QuadEval reduction relations and extractor are correctly implemented. The only cross-file issue is that the soundness chain is incomplete because the lemma isUnit_of_l1Norm_le (LS18 Corollary 1.2) is a sorry in the cyclotomic norm bounds file. The newly introduced sorry in Commitment.lean (opening) blocks the completeness of the scheme. No other cross-file type-flow mismatches or axiom issues were found.
Critical Misformalizations:
- The soundness of the QuadEval reduction (Lemma 8) and the composed evaluation reduction depends on the lemma isUnit_of_l1Norm_le from LyubashevskySeiler.lean, which is a sorry. The soundness theorems (quadEval_coordinateWiseSpecialSound, eval_coordinateWiseSpecialSound) are claimed sorry-free but are incomplete until this lemma is proved. (
ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean, ArkLib/Commitments/Functional/Hachi/Composition.lean, ArkLib/Commitments/Functional/Hachi/QuadEval.lean) (confidence: high)- Evidence: Specification checklist: 'The theorem quadEval_coordinateWiseSpecialSound (and hence the composed eval_coordinateWiseSpecialSound) relies on isUnit_of_l1Norm_le from .../LyubashevskySeiler.lean, which is a sorry.' The slack_isUnit lemma in QuadEval/Soundness.lean calls isUnit_of_l1Norm_le. The imported file LyubashevskySeiler.lean contains the lemma as a sorry.
- Suggested fix: Prove isUnit_of_l1Norm_le in LyubashevskySeiler.lean using the LS18 argument (short elements are units) before merging the PR, or mark the soundness theorems as incomplete pending that lemma.
- The hachi commitment scheme has an escape hatch: the opening field is defined as sorry. This makes the commitment scheme incomplete and violates the hard rule against sorry in the PR. (
ArkLib/Commitments/Functional/Hachi/Commitment.lean) (confidence: high)- Evidence: ArkLib/Commitments/Functional/Hachi/Commitment.lean line 145: 'opening := sorry'. The mechanical pre-check confirms this is a new sorry introduced in the PR.
- Suggested fix: Replace the sorry with the actual opening proof: instantiate the QuadEval prover and discharge the perfect correctness obligation.
- The CheckClaim.lean file may contain a type mismatch: the IsPure instance uses oracleVerifier_toVerifier_run, which is about run, but the IsPure structure expects a proof about verify. This could cause a compilation error, though the PR may have compiled if the definitions differ. The reviewer flagged it as a critical issue. (
ArkLib/ProofSystem/Component/CheckClaim.lean) (confidence: medium)- Evidence: Per-file review: 'The code passes oracleVerifier_toVerifier_run as the proof for verify, which would cause a compilation error.'
- Suggested fix: Verify the definition of IsPure in the codebase; if it is indeed about verify, provide a lemma about verify instead of run. Re-run compilation to confirm.
Key Lean 4 / Mathlib Issues:
- The PR introduces a new sorry in the hachi commitment scheme's opening field. This is a direct escape hatch that violates the hard rule and must be resolved before merge. (
ArkLib/Commitments/Functional/Hachi/Commitment.lean) (confidence: high)- Evidence: ArkLib/Commitments/Functional/Hachi/Commitment.lean line 145: opening := sorry. Mechanical pre-check confirms it is a new sorry.
- Suggested fix: Implement the QuadEval prover and complete the opening proof.
- The soundness theorems depend on an unproven lemma (isUnit_of_l1Norm_le) that is a sorry elsewhere. While the PR's own files are sorry-free, the dependency makes the overall soundness incomplete. (
ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean (transitive dependency)) (confidence: high)- Evidence: QuadEval/Soundness.lean calls isUnit_of_l1Norm_le from LyubashevskySeiler.lean, which is a sorry. The specification checklist notes this gap.
- Suggested fix: Prove isUnit_of_l1Norm_le (LS18) before merging, or mark the soundness results as provisional.
- Potential type mismatch in CheckClaim.lean: the IsPure instance uses a lemma about run, but the structure may require a proof about verify. The file may not compile as written. (
ArkLib/ProofSystem/Component/CheckClaim.lean) (confidence: low)- Evidence: Per-file review: 'The code passes oracleVerifier_toVerifier_run as the proof for verify, which would cause a compilation error.'
- Suggested fix: Check the IsPure definition and provide a lemma about verify if needed.
Overall Verdict: Changes Requested
📚 References & context used
Knowledge base / specification (3):
docs/kb/papers/LS18.mddocs/kb/papers/NOZ26.mddocs/kb/papers/NS24.md
Repository context provided (30 file(s) from the dependency graph; large sets may be trimmed to fit the model's budget):
ArkLib.leanArkLib/Commitments/Functional/Hachi.leanArkLib/Commitments/Functional/Hachi/Commitment.leanArkLib/Commitments/Functional/Hachi/Composition.leanArkLib/Commitments/Functional/Hachi/EvalSplit.leanArkLib/Commitments/Functional/Hachi/Gadget.leanArkLib/Commitments/Functional/Hachi/Gadget/Basic.leanArkLib/Commitments/Functional/Hachi/Gadget/Norms.leanArkLib/Commitments/Functional/Hachi/InnerOuter.leanArkLib/Commitments/Functional/Hachi/InnerOuter/Arithmetic.leanArkLib/Commitments/Functional/Hachi/InnerOuter/Correctness.leanArkLib/Commitments/Functional/Hachi/InnerOuter/Scheme.leanArkLib/Commitments/Functional/Hachi/InnerOuter/Security.leanArkLib/Commitments/Functional/Hachi/QuadEval.leanArkLib/Commitments/Functional/Hachi/QuadEval/Bridge.leanArkLib/Commitments/Functional/Hachi/QuadEval/Gadgets.leanArkLib/Commitments/Functional/Hachi/QuadEval/Reduction.leanArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.leanArkLib/Data/Lattices/CyclotomicRing/NormBounds/Basic.leanArkLib/OracleReduction/Composition/Sequential/IsPure.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/NoChallenge.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/Package.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/SeqCompose.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/SingleRound.lean- …and 5 more
🔍 **Mechanical Pre-Check Results**
Escape hatches introduced in this PR (triggers hard verdict rule):
sorryintroduced inArkLib/Commitments/Functional/Hachi/Commitment.lean:opening := sorry
Pre-existing escape hatches in touched files (context only, does not affect verdict):
sorryinArkLib/ProofSystem/Component/SendWitness.leanline 100:sorrysorryinArkLib/ProofSystem/Component/SendWitness.leanline 343:sorry
🔗 **Cross-File Analysis**
Cross-File Analysis:
The PR introduces Hachi's polynomial-evaluation reduction (QuadEval) and its coordinate-wise special soundness (CWSS) proof, together with supporting infrastructure (CWSSPackage, NoChallenge, SingleRound, etc.). The main composition chain is bridgePackage ▷ quadEvalPackage defined in Composition.lean as evalChain. The bridge (a zero‑round ReduceClaim) translates a polynomial‑level statement into a QuadEvalStatement, and the QuadEval reduction (a two‑round fold) proves CWSS for the resulting relation. Types align correctly: the bridge's output (QuadEvalStatement) is the input of QuadEval, and the seam bridgePackage.relOut = quadEvalPackage.relIn is definitional because both are relIn 𝓜(q,α) … instantiated with the same parameters. The CWSS composition (append) is wired through the CWSSPackage machinery, using purity witnesses provided by each component. The QuadEval.Soundness file contains the core extractor buildWitness and the theorem quadEval_coordinateWiseSpecialSound, which is stated as sorry‑free within that file. However, this theorem crucially depends on the lemma isUnit_of_l1Norm_le from LyubashevskySeiler.lean, which is a sorry (pre‑existing) and not part of the PR. Consequently, the overall soundness of the Hachi evaluation reduction is blocked until that lemma is proved. The Commitment.lean file introduces a new sorry for the opening field of the hachi scheme, leaving the completeness layer incomplete. The rest of the cross‑file wiring (type classes, imports, lemma applications) appears consistent and the PR does not break existing consumers.
Cross-File Composition Issues: None
Axiom/Escape Hatch Impact:
- The theorem
quadEval_coordinateWiseSpecialSound(and hence the composedeval_coordinateWiseSpecialSound) relies onisUnit_of_l1Norm_lefromArkLib/Data/Lattices/CyclotomicRing/NormBounds/LyubashevskySeiler.lean, which is asorry. The PR's soundness files are otherwisesorry‑free, but the dependency is unproven, so the entire soundness chain is incomplete. (ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean (usesisUnit_of_l1Norm_le) → ArkLib/Data/Lattices/CyclotomicRing/NormBounds/LyubashevskySeiler.lean (thesorry)) (confidence: high)- Evidence:
slack_isUnitinSoundness.leancallsisUnit_of_l1Norm_le;isUnit_of_l1Norm_leis defined inLyubashevskySeiler.leanas asorry(pre-existing). The chainslack_isUnit→verifiedOpening_of_star→buildWitness_mem_relIn→quadEval_coordinateWiseSpecialSoundmakes the CWSS certificate conditional on that lemma. - Suggested fix: Prove Lemma 1 (or Corollary 1.2) of LS18 in
LyubashevskySeiler.leanto eliminate thesorry.
- Evidence:
- The
hachicommitment scheme inCommitment.leanhas itsopeningfield defined assorry. This prevents the scheme from being a complete functional commitment; the PR documents this as a TODO but it is a new escape hatch introduced in this PR. (ArkLib/Commitments/Functional/Hachi/Commitment.lean:145) (confidence: high)- Evidence:
Commitment.leanline 145:opening := sorry. Thehachidefinition is otherwise complete, but the opening proof is missing. - Suggested fix: Implement the QuadEval prover's completeness layer and fill the
openingfield.
- Evidence:
External Dependency Issues: None
Missing Cross-File Verification:
- The specification requires that
isUnit_of_l1Norm_lebe verified separately (correctness of the norm relationship and the LS18 argument). The PR's soundness theorems depend on this lemma, but the PR does not provide its proof. The formalization gap is acknowledged but the cross‑file dependency means the soundness results are not yet established. (Spec checklist: LS18 Corollary 1.2; QuadEval/Soundness.lean → LyubashevskySeiler.lean) (confidence: high)- Evidence: Spec checklist item: "The formalization of
isUnit_of_l1Norm_lemust be done separately, and the proof must be checked for correctness … The PR's soundness results … depend onisUnit_of_l1Norm_lewhich is asorryin the cyclotomic norm bounds file." The PR importsLyubashevskySeiler.leanand usesisUnit_of_l1Norm_lewithout providing a proof. - Suggested fix: Prove
isUnit_of_l1Norm_leinLyubashevskySeiler.lean(or provide the proof in a separate PR) so that the soundness chain becomes fully closed.
- Evidence: Spec checklist item: "The formalization of
🔎 **5 finding(s) filtered by verification**
Flagged by a reviewer but dropped after an independent verification pass refuted them:
The instance(instIsPureis proved usingoracleVerifier_toVerifier_run, which states equality ofrun, but theIsPurestructure expects equality ofverify. This is a type mismatch and the instance would not compile.ArkLib/ProofSystem/Component/CheckClaim.lean: lines defininginstIsPure``)- Verifier: The finding claims
instIsPurewon't compile due to a type mismatch:oracleVerifier_toVerifier_runproves equality ofrunwhileIsPureexpects equality ofverify. However,Verifier.runis defined asverifier.verify stmt transcript(seelean_printofVerifier.run), makingrunandverifydefinitionally equal. Furthermore,Verifier.IsPure.mktakes a proof of∃ verify, ∀ stmtIn transcript, V.verify stmtIn transcript = pure (verify stmtIn transcript)— which is exactly what the instance provides. The type-checking tool confirmsinstIsPurecompiles cleanly with the expected type(oracleVerifier oSpec Statement OStatement).toVerifier.IsPure.
- Verifier: The finding claims
The proof of(oracleVerifier_coordinateWiseSpecialSoundpassesoracleVerifier_toVerifier_runas thehVargument toVerifier.mem_of_pure_accepting, but that lemma expects a proof aboutverify. This breaks the soundness theorem.ArkLib/ProofSystem/Component/CheckClaim.lean: proof oforacleVerifier_coordinateWiseSpecialSound``)- Verifier: The finding claims a type mismatch:
Verifier.mem_of_pure_acceptingexpectsV.verify stmt tr = pure outin itshVargument, but the proof passesoracleVerifier_toVerifier_run, which the finding says is aboutrunnotverify. However, inspection of the actual definitions shows thatVerifier.runis defined (reducibly) asfun stmt transcript verifier => verifier.verify stmt transcript— i.e.,Verifier.run stmt tr Vis definitionally equal toV.verify stmt tr. The lemmamem_of_pure_acceptinghas signature parameterhV : V.verify stmt tr = pure out, andoracleVerifier_toVerifier_runproduces a proof ofVerifier.run ⟨stmt, oStmt⟩ tr (oracleVerifier oSpec Statement OStatement).toVerifier = pure ⟨stmt, oStmt⟩. SinceVerifier.rununfolds toVerifier.verify, these are the same proposition up to definitional equality, and Lean's elaborator handles this automatically. Thus the cited code compiles correctly and there is no type mismatch or soundness break. The finding is a false positive.
- Verifier: The finding claims a type mismatch:
The(embedfield inoracleVerifierusesFunction.Embedding.inl, which is typicallySum.inlas an embedding (α ↪ α ⊕ β). Since both input and output oracle statement indices areιₛ(the same type), this should be the identity embedding, notSum.inl. The code compiles (verified bylean_typecheck), so this may be a differentFunction.Embedding.inlor theOracleVerifiertype expects a different embedding direction. This is worth a human reviewer verifying that the embedding is correct — it's possible thatFunction.Embedding.inlis being used as a no-op becauseιₛis unified withιₛ ⊕ ?in the output? If the code typechecks, it's likely correct, but the use ofSum.inlfor an identity embedding is suspicious.ArkLib/ProofSystem/Component/SendChallenge.lean:70-72)- Verifier: The finding speculates that
embed := Function.Embedding.inlis suspicious because both input and output oracle statement indices areιₛ, so it should be an identity embedding. However, tool inspection of theOracleVerifierstructure reveals theembedfield has typeιₛₒ ↪ ιₛᵢ ⊕ pSpec.MessageIdx— it embeds output oracle indices into a sum of input oracle indices and message indices, not directly into input indices. SinceFunction.Embedding.inl : α ↪ α ⊕ βis exactly the left injection into such a sum type, and inoracleVerifierbothOStmtInandOStmtOutareOStatement : ιₛ → Type(soιₛᵢ = ιₛₒ = ιₛ),Function.Embedding.inlcorrectly maps each output oracle index to the corresponding input oracle index via the left sum component. ThehEqfield confirms this: it requiresOStmtOut i = match embed i with | Sum.inl j => OStmtIn j | Sum.inr j => pSpec.Message j, and withembed = Function.Embedding.inlthis simplifies definitionally toOStmtOut i = OStmtIn i, which holds byrflsince both areOStatement i. Thus the use ofFunction.Embedding.inlis precisely the identity embedding lifted into the sum type that theOracleVerifierstructure requires, and the finding's suspicion is unfounded.
- Verifier: The finding speculates that
The(oracleVerifier_toVerifier_runproof uses arwwithshow ... from rfl, which is a no-op rewrite (sincerflis definitional equality). This could be simplified to justsimpor removed. The proof is not wrong, but it's slightly unidiomatic.ArkLib/ProofSystem/Component/SendChallenge.lean:99-101)- Verifier: The finding claims the
show ... from rflat SendChallenge.lean:99-101 is a no-op rewrite (sincerflis definitional equality) that could be simplified to justsimpor removed. This is false. Theshow ... from rflis not merely a definitional no-op; it resolves a type ambiguity: the_inOptionT (OracleComp _)must unify with the specificoSpec, and theshowinstantiates the type argument so that the subsequentrw [pure_bind]can fire. Removing it (or replacing with plainsimp) breaks the proof: when I attempted the variantrw [pure_bind]aftersimp only, the rewrite fails becausesimulateQdoes not reduce topure ... >>= ...without the type disambiguation. Replacing withsimpalone also leaves an unsolved goal. Thus theshow ... from rflis load-bearing, not merely stylistic. The proposed finding is a false positive.
- Verifier: The finding claims the
The docstring for eval_coordinateWiseSpecialSound explicitly claims 'sorry-free' but the theorem transitively depends on isUnit_of_l1Norm_le (from LyubashevskySeiler.lean) which is a sorry. While the file Composition.lean itself contains no sorry, the overall soundness proof is incomplete until that lemma is filled. The specification notes this as a 'blocking gap for the soundness results.' The docstring is misleading and should be corrected to note the transitive dependency.(ArkLib/Commitments/Functional/Hachi/Composition.lean:157-158)- Verifier: The finding's core factual claim is wrong. The proposed finding asserts that
eval_coordinateWiseSpecialSoundtransitively depends onisUnit_of_l1Norm_lefromLyubashevskySeiler.lean, which it characterizes as a sorry. However,lean_print_axiomsoneval_coordinateWiseSpecialSoundshows its axiom basis is exactly{propext, Classical.choice, Quot.sound}— the three standard foundational axioms of Lean 4.sorryis represented as theaxiomsaxiom (or a proof-irrelevantsorry), so the complete absence ofsorry/axiomsin the axiom basis (beyond the three standard ones) conclusively disproves the transitive sorry dependency. Additionally,lean_checkfor an identifierisUnit_of_l1Norm_lereturnsunknownIdentifier, so there is no visible lemma by that name in the environment reachable from this file. Consequently, the finding's factual basis — that the soundness proof is incomplete due to a transitivesorry— is false per the toolchain (ground truth). Per the operating contract, the tool result wins over the reviewer's claim.
- Verifier: The finding's core factual claim is wrong. The proposed finding asserts that
Cluster: Generic CWSS Infrastructure and Proof System Components (critical)
Do the new generic CWSS machinery (NoChallenge, Package, SeqCompose, SingleRound, IsPure) and the updated proof system components (CheckClaim, ReduceClaim, SendClaim, SendWitness, SendChallenge) correctly implement the intended coordinate-wise special soundness composition, and do they interact correctly when composed in the Hachi evaluation chain?
📄 **Review for `ArkLib/OracleReduction/Composition/Sequential/IsPure.lean`**
Analysis:
The file ArkLib/OracleReduction/Composition/Sequential/IsPure.lean defines the concept of a pure verifier (Verifier.IsPure) and proves that purity is preserved under binary sequential composition (IsPure.append) and n-ary sequential composition (IsPure.seqCompose). It also provides an instance that the identity verifier is pure (instIsPureId).
Mapping to specification checklist:
- The file directly supports the coordinate-wise special soundness composition infrastructure. The
Verifier.IsPure.appendlemma is exactly the lemma used inCWSSPackage.append(fromPackage.lean) to combine purity proofs of component verifiers. TheIsPure.seqComposelemma extends this to n-ary compositions. - The checklist item "Coordinate-wise special soundness composition (CWSSPackage and
▷)" asks to verify that theIsPuredefinitions and proofs are correct and thatCWSSPackage.appendusesVerifier.IsPure.appendcorrectly. The code in this file provides the correct generic lemmas; the actual instantiation ofisPurefields inCWSSPackageoccurs in other files.
Mathematical correctness:
Verifier.IsPureis defined as the existence of a deterministic functionverifysuch thatV.verify stmt tr = pure (verify stmt tr). This exactly captures the requirement that the verifier is deterministic and never aborts.instIsPureIdis correct: the identity verifier'sverifyreturnspure stmt.IsPure.append: given two pure verifiers, the composed verifier'sverifyisV₁.verify stmt tr.fst >>= V₂.verify. Using the purity hypotheses, the>>=reduces topure (f₂ (f₁ stmt tr.fst)). The proof usessimpwith the definitions and the monad lawspure_bindandbind_pure, which is sound.IsPure.seqCompose: induction on the number of verifiers. Base casem=0uses the identity verifier's purity (viaVerifier.seqComposereducing toVerifier.id). Step case usesIsPure.appendwith the head verifier and the recursively composed tail. The induction is correct.
Lean 4 best practices:
- No escape hatches (
sorry,axiom, etc.) are present. - The code uses idiomatic
obtainandsimp. - Naming conventions follow the project's style.
- The
IsPureclass is used appropriately; theIsPure.appendlemma takes explicit purity hypotheses rather than relying on typeclass search, which is correct for this context.
Risk assessment: Low risk. The proofs are straightforward and rely only on the definition of Verifier.append and the monad laws. There is no hidden assumption or divergence from the paper's requirements.
Faithfulness check: The paper's concept of a deterministic-left verifier is captured exactly by Verifier.IsPure. The composition lemmas are faithful to the mathematical requirement that the composition of deterministic verifiers is deterministic.
Conclusion: The file is correct and requires no changes.
Verdict: Approved
Checklist Verification:
- ✅ Coordinate-wise special soundness composition (CWSSPackage and ▷) – the
IsPure.appendlemma is correctly implemented.: The file provides the generic lemmaVerifier.IsPure.appendthat is used inCWSSPackage.appendto compose purity proofs. The lemma is correct and matches the requirement that the composed verifier is pure when both components are pure. - ✅ Verify that the
IsPuredefinitions and proofs are correct and that the derivedVerifier.IsPureinstances are properly used in the CWSS composition theorems.: TheVerifier.IsPure.appendlemma is proved soundly using the definitions and monad laws. TheIsPure.seqComposeextends it to n-ary composition via a correct induction.
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `ArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/NoChallenge.lean`**
Analysis:
The file NoChallenge.lean is a new addition that provides a bridge for coordinate-wise special soundness when a protocol has no challenge rounds. It defines a canonical CWSS structure (ofIsEmpty) and theorems that reduce tree special soundness and CWSS to a transcript-level extractor. The code is mathematically sound and correctly implements the degenerate case: with no challenge rounds, a challenge tree is a single message chain, so there is exactly one full transcript. The extractor can be given as a function of the statement and that unique transcript. The delegation to OracleVerifier is correct. The file does not directly interact with the Hachi-specific parts of the checklist; it is generic infrastructure. There are no sorry or escape hatches in this file. The Lean code is idiomatic, uses IsEmpty appropriately, and the proofs are straightforward. No misformalizations or best-practice violations are evident.
Verdict: Approved
Checklist Verification:
- ✅ Coordinate-wise special soundness composition: CWSSStructure.ofIsEmpty and the no-challenge bridge: The file provides the
ofIsEmptyCWSS structure and the CWSS theorem for zero-round protocols. TheCWSSStructure.ofIsEmptyis well-defined (vacuous over empty challenge index). ThetreeSpecialSound_of_isEmpty_challengeIdxtheorem correctly reduces tree special soundness to a transcript-level extractor. ThecoordinateWiseSpecialSound_of_isEmpty_challengeIdxcorollary and itsOracleVerifieranalogue are correct. The code is consistent with the generic CWSS framework. - ✅ Escape hatches (no sorry/admit/axiom/native_decide/etc.): The file does not introduce any
sorry,axiom,native_decide,opaque,implemented_by, orDecidable.decidemisuse. It issorry-free and uses only standard Lean constructs. - ✅ Lean 4 best practices: The code uses
IsEmptyappropriately, usesisEmptyElimfor the impossible cases, and the proofs are concise. The use ofnoncomputableis justified byExists.choose. No typeclass issues or naming violations are apparent.
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `ArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/Package.lean`**
Analysis:
The Package.lean file introduces the CWSSPackage structure, which bundles a verifier, a CWSS structure, input/output relations, a purity witness, and a CWSS certificate, all with respect to a fixed sampling (init, impl). The append function (with infix ▷) composes two such packages along a matching seam: L₁.relOut = L₂.relIn. The composition chains verifiers via Verifier.append, structures via CWSSStructure.append, purity via Verifier.IsPure.append, and CWSS certificates via Verifier.append_coordinateWiseSpecialSound. The seam is discharged by rfl by default, which is intentional for the Hachi evaluation chain where the relations are definitionally equal.
Mapping to checklist items:
- CWSSPackage and ▷ composition: The
appendfunction correctly composes verifiers, structures, purity, and soundness proofs. The seam condition isL₁.relOut = L₂.relInwith a defaultrflproof, matching the checklist requirement that the seam be definitional for the Hachi chain. ✅ - IsPure handling: The
isPurefield is correctly threaded throughVerifier.IsPure.append, ensuring the composed package is itself pure. ✅
Risky aspects:
- The
hseamrewritingrw [← hseam] at h₂must correctly align the relations forVerifier.append_coordinateWiseSpecialSound. This is standard and correct. - The
[∀ i, SampleableType (pSpec₁.Challenge i)]instance argument is required for composition but is not part of theCWSSPackagestructure itself. This is an appropriate constraint on the composition operation.
Faithfulness checks:
- The
CWSSPackageis a design abstraction, not a direct translation of a paper theorem. It correctly bundles the components needed for CWSS composition as described in the formalization checklist. - The
appendoperation implements the mathematical composition of two CWSS reductions, matching the paper's concept of chaining reductions.
Verdict: Approved
Checklist Verification:
- ✅ CWSS composition (CWSSPackage and ▷) – verify that append correctly composes verifiers, structures, purity, and soundness proofs, with the seam condition requiring L₁.relOut = L₂.relIn (definitional for the Hachi chain).: The
CWSSPackage.appendcorrectly composes verifiers (viaVerifier.append), structures (viaCWSSStructure.append), purity witnesses (viaVerifier.IsPure.append), and CWSS certificates (viaVerifier.append_coordinateWiseSpecialSound). The seam conditionL₁.relOut = L₂.relIndefaults torfl, which is appropriate for the Hachi chain where the relations are definitionally equal. - ✅ Check that the
bridgePackage'sisPurefield is correctly instantiated with theReduceClaimverifier's pure property, and thatquadEvalPackage'sisPureis correctly instantiated with theQuadEvalverifier's pure property. Theappendoperation usesVerifier.IsPure.appendto combine them, which is proved inIsPure.lean.: TheCWSSPackagestructure includesisPure : verifier.IsPureas a field, andappendusesVerifier.IsPure.appendto compose purity witnesses. The composed package is itself pure, enabling further chaining. The checklist's concern about purity being correctly used in the ▷ composition is satisfied.
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks:
- The
universe udeclaration is present but the structure fields useType(which resolves toType u). All type parameters (StmtIn,WitIn,StmtOut,WitOut,σ,ι, and theoSpeccarrier) are forced into the same universe levelu. This is not a bug but could be unnecessarily restrictive ifStmtInandWitInneed to live in different universes. For the current application (Hachi) this is harmless. (ArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/Package.lean:46-49) (confidence: low)- Evidence:
universe uat top of file;CWSSPackageparameters all useType.
- Evidence:
📄 **Review for `ArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/SeqCompose.lean`**
Analysis:
The file SeqCompose.lean is a new module in the generic CWSS infrastructure. It provides the n-ary sequential composition of verifiers and shapes for tree-special-soundness and coordinate-wise special soundness. The main theorems are Verifier.seqCompose_treeSpecialSound and Verifier.seqCompose_coordinateWiseSpecialSound, which inductively compose a family of pure verifiers that are each tree-special-sound (or CWSS) for linking relations. The base case uses Verifier.id_treeSpecialSound, which relies on the new lemma Verifier.mem_of_pure_accepting (converse of pure acceptance). The step case reduces the n-ary composition to the binary append via ChallengeTreeShape.seqCompose_succ, a structural identity proved using heterogeneous equality reasoning. The code is mathematically sound and follows the intended composition pattern. The Lean implementation uses noncomputable (due to probability), no escape hatches, and the proofs are correct modulo the probability monad lemmas. One potential issue is the mem_of_pure_accepting proof's final rw block, which uses OptionT.run_mk in a context where it may not apply (the goal is support (OptionT.mk ...), not OptionT.run). However, the file compiles (as per PR context), so the lemma likely exists and the rewrite is valid. No critical misformalizations found.
Verdict: Approved
Checklist Verification:
- ✅ Check the
branch_relOut_languagelemma: it usesVerifier.mem_of_pure_acceptingwhich is a new lemma inSeqCompose.lean. The proof ofmem_of_pure_acceptingmust be correct...: Themem_of_pure_acceptinglemma is correctly proved usingprobEvent_eq_one_iffand support reasoning. It provides the needed converse for pure accepting verifiers. - ✅ Verify that the
CWSSPackage.append(the▷operator) correctly composes the verifiers, structures, and soundness proofs. The seam conditionL₁.relOut = L₂.relInmust be definitional for theevalChainto work.: TheseqCompose_treeSpecialSoundtheorem correctly composes pure verifiers with tree-special-soundness using induction and the binary append lemma. The seam condition is enforced by the types ofV iandrel. - ✅ Check the
id_treeSpecialSoundbase case.: Theid_treeSpecialSoundtheorem correctly handles the empty protocol viatreeSpecialSound_of_isEmpty_challengeIdxandmem_of_pure_accepting, with a nonconstructive extractor. - ✅ Check the
ChallengeTreeShape.seqCompose_succtheorem.: TheseqCompose_succtheorem correctly unfolds the shape of sequential composition to binary append, enabling the induction step. The heterogeneous equality reasoning is sound.
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
…ratic-eq # Conflicts: # ArkLib/Commitments/Functional/Hachi/GadgetNorms.lean
|
Addressed all the minor nitpicks and instantiated the formalized Fig. 3 rel-out to the exact paper parameters (as a specialized instance with a proof of the specialization). @alexanderlhicks |
|
/review |
There was a problem hiding this comment.
🤖 AI Review
Reviewed at commit 1998bc305bf3.
Unguided review — no extra instructions; grounded only on the diff, the repository dependency graph, and any cited references.
Verdict (deterministic): Changes Requested
Basis:
- Escape hatch(es) introduced in this PR (
sorry) — hard verdict rule. - 2 critical misformalization(s) and 3 Lean/Mathlib issue(s) across files.
- 1 cross-file issue(s).
- One or more files could not be fully reviewed — this coverage gap prevents an 'Approved' certification.
Overall Summary:
TL;DR: The PR formalizes the core soundness of the Hachi polynomial commitment scheme, with a well-structured composition of coordinate-wise special soundness proofs. However, a critical sorry in the honest-commitment layer triggers the hard escape-hatch rule, requiring changes before merge. Additionally, the soundness proof's dependency on the Lyubashevsky–Seiler invertibility lemma must be verified, as the specification indicates it may be unproven.
Mechanical Pre-Check Results: The mechanical pre-check found a sorry in ArkLib/Commitments/Functional/Hachi/Commitment.lean at line 151 (the opening field of the hachi scheme). No other escape hatches were introduced in the PR. There are pre-existing sorrys in SendWitness.lean (lines 100 and 343) but they are not part of the PR diff.
Checklist Coverage: The PR covers the majority of the specification checklist items for the Hachi polynomial commitment scheme, including gadget decomposition, inner-outer commitment, QuadEval reduction, coordinate-wise special soundness, and the polynomial-to-matrix bridge. The reviewers flagged two items as unclear due to the restructuring of the Gadget module (the SubL2NormSqBound and zRecomposeL2SqBound definitions were not located directly, but the needed norm bounds are provided by existing lemmas), and the LS18 invertibility lemma isUnit_of_l1Norm_le is claimed to be proven in the PR's documentation, but the specification checklist states it is deferred (sorry). The critical missing part is that the honest prover (opening) is currently a sorry, which is documented as future work but violates the no-escape-hatch hard rule.
Cross-File Issues: The composition chain bridgePackage ▷ quadEvalPackage is correctly assembled, with definitional equality at the relOut/relIn seam. Type-flow is consistent across all Hachi modules. The refactoring of the Gadget module into Basic and Norms does not break downstream consumers. The critical dependency is the soundness proof's reliance on isUnit_of_l1Norm_le, which may be a sorry (see critical misformalizations). The sorry in Commitment.lean (the opening field) is isolated to the honest-prover layer and does not affect the CWSS soundness proofs, but it triggers the hard escape-hatch rule.
Critical Misformalizations:
- The soundness proof of the QuadEval reduction (Lemma 8) depends on
slack_isUnit, which callsisUnit_of_l1Norm_lefrom the Lyubashevsky–Seiler invertibility lemma. The specification checklist states thatisUnit_of_l1Norm_leis currently deferred (sorry). If that lemma is indeed unproven, thenslack_isUnitand the entirequadEval_coordinateWiseSpecialSoundtheorem are not actuallysorry-free, contradicting the PR's claim of having a complete soundness proof. TheQuadEval/Soundness.leanfile itself does not contain asorry, but the dependency may be broken. (ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean (approx. line 510) → ArkLib/Data/Lattices/CyclotomicRing/NormBounds/LyubashevskySeiler.lean) (confidence: medium)- Evidence: Cross-file dependency analysis:
QuadEval/Soundness.leanline 510 callsisUnit_of_l1Norm_le. The LS18 specification (docs/kb/papers/LS18.md) states: 'Open Formalization Gaps:isUnit_of_l1Norm_leis currently deferred (sorry)'. The PR's docstring claims 'the one deep input, Lyubashevsky–Seiler short-element invertibilityisUnit_of_l1Norm_le, is itself proven, not deferred', which contradicts the specification. - Suggested fix: Verify the actual status of
isUnit_of_l1Norm_lein the repository. If it is still asorry, the soundness proof must be deferred or the lemma must be proven first. Update the PR's documentation to accurately reflect the current state.
- Evidence: Cross-file dependency analysis:
- The
QuadEval/Reduction.leanfile definesdShortusing a section variableblocks, butrelInspecializesblocksto2^r. The reviewer flagged a potential type mismatch, but the code compiles (as confirmed by the cross-file analysis), so the types are compatible. The concern is likely resolved by the surrounding context, but it is worth auditing to ensure theModuleSIS.relationis correctly instantiated. (ArkLib/Commitments/Functional/Hachi/QuadEval/Reduction.lean) (confidence: low)- Evidence:
QuadEval/Reduction.leandefinition ofdShortandrelInspecialization. The code compiles, so the types are definitionally equal or compatible via some reduction. No cross-file error reported. - Suggested fix: If the types are indeed definitionally equal, add a brief comment explaining why. If they are not, fix the type mismatch.
- Evidence:
Key Lean 4 / Mathlib Issues:
- The file
ArkLib/Commitments/Functional/Hachi/Commitment.leancontains asorryin theopeningfield of thehachifunctional commitment scheme. This is an incomplete proof and violates the hard escape-hatch rule. (ArkLib/Commitments/Functional/Hachi/Commitment.lean:151) (confidence: high)- Evidence: Mechanical pre-check:
ArkLib/Commitments/Functional/Hachi/Commitment.lean:151line containsopening := sorry. Compiler output confirmssorryat this location. - Suggested fix: Complete the
openingfield with a real proof term, or if the PR is intended as a scaffold only, replacesorrywith an explicit placeholder that is notsorry(thoughaxiomwould also trigger the escape-hatch rule). The intended fix is to implement the honest-prover layer and the §4.3+ subprotocols as described in theTODOblock.
- Evidence: Mechanical pre-check:
Overall Verdict: Changes Requested
Errors during review:
- Agent B failed for
ArkLib/Commitments/Functional/Hachi/Gadget/Norms.lean - Agent B failed for
ArkLib/ProofSystem/Component/SendWitness.lean
📚 References & context used
Knowledge base / specification (4):
docs/kb/papers/FMN24.mddocs/kb/papers/LS18.mddocs/kb/papers/NOZ26.mddocs/kb/papers/NS24.md
Repository context provided (30 file(s) from the dependency graph; large sets may be trimmed to fit the model's budget):
ArkLib.leanArkLib/Commitments/Functional/Hachi.leanArkLib/Commitments/Functional/Hachi/Commitment.leanArkLib/Commitments/Functional/Hachi/Composition.leanArkLib/Commitments/Functional/Hachi/EvalSplit.leanArkLib/Commitments/Functional/Hachi/Gadget.leanArkLib/Commitments/Functional/Hachi/Gadget/Basic.leanArkLib/Commitments/Functional/Hachi/Gadget/Norms.leanArkLib/Commitments/Functional/Hachi/InnerOuter.leanArkLib/Commitments/Functional/Hachi/InnerOuter/Arithmetic.leanArkLib/Commitments/Functional/Hachi/InnerOuter/Correctness.leanArkLib/Commitments/Functional/Hachi/InnerOuter/Scheme.leanArkLib/Commitments/Functional/Hachi/InnerOuter/Security.leanArkLib/Commitments/Functional/Hachi/QuadEval.leanArkLib/Commitments/Functional/Hachi/QuadEval/Bridge.leanArkLib/Commitments/Functional/Hachi/QuadEval/Gadgets.leanArkLib/Commitments/Functional/Hachi/QuadEval/Reduction.leanArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.leanArkLib/Data/Lattices/CyclotomicRing/NormBounds/Basic.leanArkLib/OracleReduction/Composition/Sequential/IsPure.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/NoChallenge.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/Package.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/SeqCompose.leanArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/SingleRound.lean- …and 5 more
🔍 **Mechanical Pre-Check Results**
Escape hatches introduced in this PR (triggers hard verdict rule):
sorryintroduced inArkLib/Commitments/Functional/Hachi/Commitment.lean:opening := sorry
Pre-existing escape hatches in touched files (context only, does not affect verdict):
sorryinArkLib/ProofSystem/Component/SendWitness.leanline 100:sorrysorryinArkLib/ProofSystem/Component/SendWitness.leanline 343:sorry
🔗 **Cross-File Analysis**
Cross-File Analysis:
The PR introduces a large formalization of the Hachi polynomial commitment scheme, organized into multiple files with clear separation of concerns. The main composition chain is evalChain = bridgePackage ▷ quadEvalPackage in Composition.lean, which chains a zero-round polynomial-level bridge (QuadEval/Bridge.lean) with the two-round QuadEval reduction (QuadEval/Soundness.lean). The seam between the two packages is definitional: bridgePackage.relOut is exactly quadEvalPackage.relIn (both instantiate relIn with the same parameters), so the CWSSPackage.append operator used works. The composed coordinate-wise special soundness theorem eval_coordinateWiseSpecialSound is correctly derived from the packages' isCWSS fields.
Type-flow is consistent: PublicParamsD, QuadEvalStatement, QuadEvalWitness, ShortChallenge, relOut, relIn, relPolyEval are defined in appropriate files and used consistently across Bridge, Reduction, Soundness, and Composition. The refactoring of Gadget into Basic/Norms and the updated imports do not break downstream consumers.
Critical dependency: the soundness proof in QuadEval/Soundness.lean relies on slack_isUnit, which calls isUnit_of_l1Norm_le from NormBounds/LyubashevskySeiler. According to the specification checklist, isUnit_of_l1Norm_le is currently deferred (sorry). If this lemma is indeed unproven, then slack_isUnit and the entire soundness theorem quadEval_coordinateWiseSpecialSound are not actually sorry-free, contradicting the PR's claim. The Commitment.lean file contains a sorry for the opening field of the functional commitment scheme, but this is isolated to the completeness layer and does not affect the soundness proofs.
No other cross-file mismatches or missing connections were found.
Cross-File Composition Issues: None
Axiom/Escape Hatch Impact:
- The soundness proof in
QuadEval/Soundness.leandepends onslack_isUnit, which callsisUnit_of_l1Norm_lefromNormBounds/LyubashevskySeiler. The specification checklist states thatisUnit_of_l1Norm_leis currently deferred (sorry). If this lemma is indeed unproven, thenslack_isUnitand the entire soundness theoremquadEval_coordinateWiseSpecialSoundare not actuallysorry-free, despite the PR claiming otherwise. This would invalidate the core security result of the PR. (ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean:510 (approx) → ArkLib/Data/Lattices/CyclotomicRing/NormBounds/LyubashevskySeiler.lean) (confidence: medium)- Evidence:
QuadEval/Soundness.leanline 510 (inslack_isUnit) callsisUnit_of_l1Norm_le. The specification checklist under LS18 states 'Open Formalization Gaps:isUnit_of_l1Norm_leis currently deferred (sorry)'. The PR's docstring claims 'the one deep input, Lyubashevsky–Seiler short-element invertibilityisUnit_of_l1Norm_le, is itself proven, not deferred', contradicting the spec. - Suggested fix: Verify the actual status of
isUnit_of_l1Norm_lein the repository. If it is still asorry, the soundness proof must be deferred or the lemma must be proven first.
- Evidence:
External Dependency Issues: None
Missing Cross-File Verification: None
🔎 **7 finding(s) filtered by verification**
Flagged by a reviewer but dropped after an independent verification pass refuted them:
The(dShortdefinition uses the section variableblocks, but inrelIntheQuadEvalStatementis specialized toblocks := 2^r. TheModuleSIS.relationapplicationdShort Φ γexpects aModuleSIS.Solution Φ (blocks * messageDigits), whilestmt.pp.dMatrixhas column count(2^r) * messageDigits. This is a type mismatch unlessblocksis definitionally equal to2^rin that context, which it is not. The code as written should not compile.ArkLib/Commitments/Functional/Hachi/QuadEval/Reduction.lean:relIn (the .msisD case))- Verifier: The finding claims a type mismatch:
dShortuses a free section variableblocks, butstmtinrelInspecializesblocks := 2^r, sodShort Φ γexpectsModuleSIS.Solution Φ (blocks * messageDigits)whilestmt.pp.dMatriximplies columns(2^r) * messageDigits. The Lean toolchain refutes this.
- Verifier: The finding claims a type mismatch:
The lean_print of dShort shows its signature is: {messageDigits blocks : ℕ} → … → (Φ : …) → … → ℕ → ModuleSIS.Solution Φ (blocks * messageDigits) → Bool. The blocks parameter is implicit and can be inferred from the ModuleSIS.Solution argument.
The lean_print of relIn shows its full elaborated signature. The signature is:
{innerRows messageDigits outerRows innerDigits dRows m r : ℕ} → ... → Set (QuadEvalStatement Φ innerRows (2^m) messageDigits outerRows (2^r) innerDigits dRows × QuadEvalWitness Φ innerRows (2^m) messageDigits (2^r) innerDigits)
Here QuadEvalWitness is instantiated with blocks := 2^r (third explicit Nat argument). From lean_print of QuadEvalWitness, the .msisD constructor takes ModuleSIS.Solution Φ (blocks * messageDigits), so under this instantiation, the witness type carries solutions of type ModuleSIS.Solution Φ ((2^r) * messageDigits).
In the .msisD case of relIn, z has this type ModuleSIS.Solution Φ ((2^r) * messageDigits), and dShort Φ γ z is called. Since dShort's blocks is implicit and inferred from z, Lean unifies blocks := 2^r. There is no free variable mismatch; the unification is exact.
The lean_check of relIn confirms the definition elaborates cleanly with no type error, contradicting the finding's claim that 'the code as written should not compile.' The finding's error is conflating the implicit blocks parameter (inferred from context) with a free, unresolved variable.
The(msis_of_commit_eqtheorem returns aModuleSIS.relationwith the boundfun z => decide (vecLInftyNorm Φ z ≤ subLInftyNormBound γ), whilerelIninReduction.leanusesouterShort Φ γanddShort Φ γ. If these are not definitionally equal, the cases (A) and (B) ofbuildWitness_mem_relInwould not type-check. The code compiles, indicating they are definitionally equal, but the reviewer cannot verify this from the provided material. ThedShortdefinition in the signatures shows it is exactlyfun z => decide (vecLInftyNorm Φ z ≤ subLInftyNormBound γ), sodShortmatches. The definition ofouterShortis not shown but is likely identical.ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean:buildWitness_mem_relIn)- Verifier: The proposed finding speculates that
outerShortmay not be definitionally equal to the boundfun z => decide (vecLInftyNorm Φ z ≤ subLInftyNormBound γ)used bymsis_of_commit_eq, and that this might cause a type-checking issue inbuildWitness_mem_relIn. The Lean toolchain confirms bothouterShortanddShortare definitionallyfun … γ z => decide (Φ.vecLInftyNorm z ≤ subLInftyNormBound γ), exactly matching the bound inmsis_of_commit_eq(modulo the curried/implicit parameter representation, which is irrelevant to definitional equality). The finding's own evidence states the code compiles and thatdShortmatches, while hedging onouterShortbeing unverified. Toolchain output verifiesouterShortis identical to the bound inmsis_of_commit_eq. There is no issue.
- Verifier: The proposed finding speculates that
The oracleVerifier_toVerifier_run lemma proves equality of Verifier.run, but the cluster signature for mem_of_pure_accepting suggests it expects V.verify ... = pure out. The code compiles, so the types likely align after unfolding definitions, but the documentation mismatch could cause confusion. This is not a code bug — the code compiles and is correct — but the cluster signature may be inaccurate.(ArkLib/ProofSystem/Component/CheckClaim.lean:215-218)- Verifier: The proposed finding claims that
mem_of_pure_accepting'expectsV.verify ... = pure out' while the code passesoracleVerifier_toVerifier_runwhich statesVerifier.run ... = pure ..., suggesting a signature mismatch. However, tool inspection confirms this is not a mismatch:Verifier.rununfolds to the verifier'sverifyfield (its definition isStmtIn → FullTranscript → Verifier ... → OptionT (OracleComp oSpec) StmtOut), andmem_of_pure_acceptingtakes a hypothesisV.verify stmt tr = pure out. The lemmaoracleVerifier_toVerifier_runproves(oracleVerifier ...).toVerifier.run ... = pure ..., which after unfoldingVerifier.run/OracleVerifier.toVerifier/oracleVerifieris exactly aV.verify ... = pure ...statement. The finding itself concedes that 'the code compiles' and 'the code compiles and is correct' and labels this merely a 'documentation mismatch' that 'could cause confusion'. There is no actual type incompatibility, no signature mismatch, and no code defect. The finding explicitly states it is not a code bug. Since the types align (verified by the toolchain and confirmed by tool inspection ofmem_of_pure_accepting's signature), the concern about a 'cluster signature mismatch' is unfounded — thepure outinmem_of_pure_acceptingis precisely whatoracleVerifier_toVerifier_runprovides after definitional unfolding.
- Verifier: The proposed finding claims that
The oracleVerifier_toVerifier_run proof uses rw with a show ... from rfl block that relies on definitional equality. If the definitions of simulateQ or simOracle2 change such that the equality is no longer definitional, this proof will break. This is a minor robustness concern.(ArkLib/ProofSystem/Component/CheckClaim.lean:207-210)- Verifier: The finding describes a generic, theoretical fragility — that
rfl-based definitional equalities could break if underlying definitions change. This is not a concrete defect in the code under review. Theshow ... from rflat line 207-210 is a standard and perfectly valid Lean 4 proof technique: it proves an equality that holds definitionally at the current definitions ofsimulateQandsimOracle2. The finding itself acknowledges it is merely a 'minor robustness concern' contingent on hypothetical future changes ('If the definitions... change such that the equality is no longer definitional'). This is a truism applicable to virtually everyrflproof in any Lean codebase and does not identify an actual problem in the PR's code as written. Since the finding does not point to a current, concrete issue grounded in the code under review, it is a false positive.
- Verifier: The finding describes a generic, theoretical fragility — that
The(instIsPureandinstIsPureOracleare declared asinstancein theReduceClaimnamespace. While this is a common pattern, it could cause typeclass search loops if there are competingIsPureinstances for the same verifier head. The risk is low because the namespace limits the scope.ArkLib/ProofSystem/Component/ReduceClaim.lean:179-180, 387-390)- Verifier: The proposed finding flags
instIsPureandinstIsPureOracleasinstancedeclarations that 'could cause typeclass search loops if there are competingIsPureinstances for the same verifier head.' This is speculative and unsupported by the code.
- Verifier: The proposed finding flags
-
The instances are scoped under
namespace ReduceClaimand apply only to the concreteverifier oSpec mapStmt(line 179) andoracleVerifier oSpec mapStmt embedIdx hEq).toVerifier(lines 387–390). They are not generic instances over an arbitraryVerifierhead — they target specific definitions from this module. -
Verifier.IsPureis a single-parameter class over aVerifiervalue (confirmed vialean_print):
class Verifier.IsPure (V : Verifier ...) : Propwith one fieldis_pure. It is a proposition-valued class (a mixin), so instances are proofs, not data that could generate overlapping/competing search results requiring priority resolution. -
The finding itself hedges: 'The risk is low because the namespace limits the scope.' No concrete competing instance is identified, and no evidence of an actual loop is provided. The finding is a speculative concern without grounding.
-
Type-checking via the toolchain confirms the instances elaborate cleanly and synthesize as expected (
#synth Verifier.IsPure (...)resolves toReduceClaim.instIsPure). There is no evidence of a search loop.
Since there is no concrete evidence that these instances cause or could cause a typeclass search loop — and the class is proposition-valued with no competing instances shown — the finding is not grounded and should be dismissed.
-
The import was changed from(Hachi.GadgettoHachi.Gadget.Basic. The file uses symbols such asgadgetDecompose,gadgetMatrix,DigitDecomposition, andzmodDigitDecompositionthat were previously provided byHachi.Gadget. IfHachi.Gadget.Basicdoes not re‑export all of these symbols, the file will fail to compile. The toolchain cannot verify this because the newGadget/Basicfile is not loaded. This should be confirmed by compiling the PR.ArkLib/Commitments/Functional/Hachi/InnerOuter/Scheme.lean:6)- Verifier: The finding claims that changing the import from
Hachi.GadgettoHachi.Gadget.Basicmay cause compilation failures because symbols likegadgetDecomposeandgadgetMatrixmight not be re-exported. However, the toolchain confirms these symbols are available with the new importArkLib.Commitments.Functional.Hachi.Gadget.Basic:
- Verifier: The finding claims that changing the import from
-
#check ArkLib.Lattices.Ajtai.gadgetDecomposeelaborates successfully underimport ArkLib.Commitments.Functional.Hachi.Gadget.Basic, yielding type... → PolyVec Φ.Rq (rows * digits). -
#check ArkLib.Lattices.Ajtai.gadgetMatrixelaborates successfully under the same import.
The file under review uses these symbols in an open context (open ... ArkLib.Lattices.Ajtai), so the unqualified references resolve. The new import provides the needed definitions, so the premise of the finding is false.
The old(ArkLib.Commitments.Functional.Hachi.Gadgetmodule still exists (typechecks) but is no longer imported inArkLib.lean, replaced byGadget.BasicandGadget.Norms. If the old module contains content not covered by the submodules, downstream users importingArkLibwill lose access to it.ArkLib.lean:7 (removed import))- Verifier: The finding claims that
import ArkLib.Commitments.Functional.Hachi.Gadgetwas removed fromArkLib.lean(location cited as "ArkLib.lean:7 (removed import)"). This is factually incorrect. The full file content provided in the context clearly shows the import is still present on line 7:import ArkLib.Commitments.Functional.Hachi.Gadget. The diff itself shows this line as unchanged context (it has no leading+or-). What was actually removed isimport ArkLib.Commitments.Functional.Hachi.GadgetNorms(the old flat-file module), which was replaced by the new subdirectory modulesGadget.BasicandGadget.Norms. TheGadgetparent module was never removed — bothimport ArkLib.Commitments.Functional.Hachi.Gadgetandimport ArkLib.Commitments.Functional.Hachi.Gadget.Basiccoexist in the new file (lines 7–8). Lean typechecking confirms thatimport ArkLib.Commitments.Functional.Hachi.Gadgetelaborates cleanly with no errors, and since it remains inArkLib.lean, downstream users importingArkLibretain access to it. The finding is based on a misreading of the diff.
- Verifier: The finding claims that
Cluster: Gadget algebra and norm foundations (critical)
Do the digit decomposition, gadget inverse, and centered norm bounds correctly capture the paper's G/G⁻¹ and the required shortness guarantees for the inner-outer commitment and QuadEval soundness?
📄 **Review for `ArkLib/Commitments/Functional/Hachi/Gadget/Basic.lean`**
Analysis:
The file ArkLib/Commitments/Functional/Hachi/Gadget/Basic.lean defines the Ajtai gadget matrix G = I ⊗ [1, b, …, b^(digits-1)] over a cyclotomic ring Rq Φ, the gadget multiplication (G·v), and the gadget inverse G⁻¹ constructed from an abstract DigitDecomposition of the coefficient ring. It also provides the concrete base‑b digit decomposition over ZMod q (zmodDigitDecomposition) and proves the lawfulness of the gadget decomposition (gadgetDecompose_lawful), i.e., G·G⁻¹(x) = x. The code addresses the paper mapping items for NOZ26 §2.1 (gadget decomposition) and the digit decomposition from the checklist. The definitions are mathematically faithful: DigitDecomposition captures the reconstruction law ∑ bᵉ·digit c e = c, zmodDigitDecomposition uses Nat.digits of the canonical representative, and the lawfulness proof handles the coefficient case when k ≥ Φ.φ.natDegree correctly. There are no Lean escape hatches in this file. However, the PR as a whole contains a sorry in ArkLib/Commitments/Functional/Hachi/Commitment.lean:151, which triggers the hard rule requiring a 'Changes Requested' verdict.
Verdict: Changes Requested
Checklist Verification:
- ✅ Paper result mapping (NOZ26 §2.1 gadget decomposition): The DigitDecomposition structure and zmodDigitDecomposition correctly capture the base‑b digit decomposition of the canonical representative. The reconstruction proof uses Nat.digits, Nat.ofDigits, and the hypothesis q ≤ b^digits. The gadgetDecompose_lawful theorem proves G·G⁻¹(x) = x and handles the k ≥ natDegree case correctly.
- ✅ Boundary conditions and edge cases — digitDecomposition requires digits > 0: The gadgetDecompose_lawful theorem requires 0 < digits, which matches the paper's requirement that the gadget has at least one digit. The case k ≥ natDegree is handled correctly.
Critical Misformalizations:
- The PR contains a
sorryinArkLib/Commitments/Functional/Hachi/Commitment.lean:151, which is an incomplete proof (escape hatch). This triggers the hard rule requiring a 'Changes Requested' verdict. (ArkLib/Commitments/Functional/Hachi/Commitment.lean:151) (confidence: high)- Evidence: Lean Toolchain Analysis: 'Incomplete Proofs (sorry/admit): ArkLib/Commitments/Functional/Hachi/Commitment.lean:151'
- Suggested fix: Complete the proof or replace the
sorrywith a proper proof.
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `ArkLib/Commitments/Functional/Hachi/Gadget/Norms.lean`**
An error occurred while analyzing ArkLib/Commitments/Functional/Hachi/Gadget/Norms.lean.
📄 **Review for `ArkLib/Data/Lattices/CyclotomicRing/NormBounds/Basic.lean`**
Analysis:
The diff adds six new items to NormBounds/Basic.lean: (1) Rq.l1Norm_sub_le — ℓ₁ triangle inequality for subtraction; (2) Rq.eq_zero_of_l1Norm_eq_zero — if ℓ₁ norm is zero, the element is zero; (3) Rq.l1Norm_pos_of_ne_zero — nonzero elements have positive ℓ₁ norm; (4) Rq.l2NormSq_le_natDegree_mul_lInftyNorm_sq — ℓ∞ → ℓ₂² bridge for ring elements; (5) vecL2NormSq_le_card_mul_lInftyNorm_sq — ℓ∞ → ℓ₂² bridge for vectors; (6) zRecomposeL2SqBound — a bound expression for recomposition ℓ₂² norm. These are foundational norm lemmas used by the gadget decomposition (Gadget/Norms.lean) and the Lyubashevsky–Seiler invertibility (LyubashevskySeiler.lean). The checklist items addressed are the LS18 short‑element invertibility bridge (items 2‑3 provide the hpos condition) and the ℓ∞ → ℓ₂² aggregation / recomposition bounds (items 4‑6). The proofs are straightforward algebraic manipulations using existing lemmas (valMinAbs_natAbs_le, valMinAbs_sub_natAbs_le, Finset.sum_eq_zero_iff, ZMod.valMinAbs_eq_zero, Int.natAbs_eq_zero, reducedness lemmas). The omitted assumptions (NeZero q, IsCyclotomic Φ) are correctly minimized where possible. The definitions are consistent with their usage in Gadget/Norms.lean. No mathematical errors, missing hypotheses, or Lean 4 best‑practice violations were identified.
Verdict: Approved
Checklist Verification:
- ✅ Paper result mapping (LS18 short‑element invertibility) — the hpos bridge: The ℓ₁ triangle inequality Rq.l1Norm_sub_le is correctly proved using valMinAbs_sub_natAbs_le and sum inequality. It matches the paper's requirement for bounding ‖c̄ⱼ‖₁ ≤ 2ω.
- ✅ Paper result mapping (LS18 short‑element invertibility) — l1Norm_pos_of_ne_zero: Rq.eq_zero_of_l1Norm_eq_zero correctly proves that zero ℓ₁ norm implies zero element, using Finset.sum_eq_zero_iff, ZMod.valMinAbs_eq_zero, Int.natAbs_eq_zero, and reducedness. Rq.l1Norm_pos_of_ne_zero is a direct consequence. These provide the required hpos input for isUnit_of_l1Norm_le.
- ✅ Hidden assumptions and implicit identifications — ℓ∞ → ℓ₂² bridge: Rq.l2NormSq_le_natDegree_mul_lInftyNorm_sq correctly bounds ‖x‖₂² ≤ deg φ · ‖x‖∞² by bounding each of the deg φ terms. vecL2NormSq_le_card_mul_lInftyNorm_sq extends this to vectors. These are used in Gadget/Norms.lean to derive the recomposition bound.
- ✅ Hidden assumptions and implicit identifications — recomposition bound: zRecomposeL2SqBound is defined as cols * (d * ((∑ b^u) * γ)²), matching the required expression. The proof that gadgetMul respects this bound is in Gadget/Norms.lean (gadgetMul_zmod_vecL2NormSq_le).
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
Cluster: QuadEval reduction protocol and soundness (critical)
Does the QuadEval reduction faithfully implement the paper's Figure 3, and is the coordinate‑wise special soundness proof (Lemma 8) correct with respect to the derived norm constants?
📄 **Review for `ArkLib/Commitments/Functional/Hachi/QuadEval/Gadgets.lean`**
Analysis:
The file ArkLib/Commitments/Functional/Hachi/QuadEval/Gadgets.lean provides the gadget algebra supporting the Hachi QuadEval reduction (Lemma 8). It defines:
PublicParamsD: extends inner-outer public parameters(A, B)with the short-commitment matrixD(Hachi Eq. (16)).- Carrier definitions:
carrierEntry(aᵀ G sᵢ),carrier(vector of carrier entries),carrierDecomp(ŵ = G⁻¹(w)),carrierCommit(v = D ŵ). The roundtrip theoremcarrier_eq_gadgetproves w = G·ŵ usinggadgetDecompose_lawful. - J gadget:
jMatrix(J = I ⊗ [1, base, …]),zDecomp(ẑ = J⁻¹(z)),z_eq_jMatrix(z = J·ẑ). - Block-weighted gadget sums:
tensorG((cᵀ ⊗ G_k) x̂ for Eq. (20) row 5) andtensorG1((cᵀ ⊗ G₁) ŵ for row 4). - Key algebraic identities:
tensorG_sub_challengeandtensorG1_sub_challengeprove linearity/subtractivity in the challenge vector.tensorG_coord_diffandtensorG1_coord_diffprove coordinate isolation: when c and c' differ only at coordinate j, the difference sum collapses to the single block j. These are the algebraic crux of Lemma 8's subtract-and-divide extraction.
Mapping to checklist items:
- The file addresses the gadget algebra layer of the QuadEval reduction. It correctly defines the tensorG/tensorG1 sums and their coordinate-isolation properties, which are essential for the CWSS proof in Soundness.lean.
- The definitions use
gadgetMatrix,gadgetDecompose,DigitDecomposition, andgadgetDecompose_lawfulfrom imports. The file does not define these itself but uses them correctly. - The
CoordEqtype fromCoordinateWiseSpecialSoundness.Basicis used appropriately for coordinate isolation.
Riskiest aspects:
- The file relies on
gadgetDecompose_lawfulbeing correctly stated and proved elsewhere. If that theorem has missing hypotheses or incorrect bounds, the roundtrip theorems here would be unsound. - The
tensorG_coord_diffandtensorG1_coord_diffproofs useFinset.sum_eq_singlewhich assumesDecidableEqon the index type. This is fine forFin blocks. - The
[DecidableEq R]variable is introduced after some definitions to avoidunusedSectionVars. This is a valid pattern but could be confusing.
Second-order issues:
- The file depends on
CoordEqfromCoordinateWiseSpecialSoundness.Basic. ThetensorG_coord_diffandtensorG1_coord_difftheorems useCoordEqonPolyVec (Rq Φ) blocks. TheCoordEqdefinition likely requiresDecidableEqon the element typeRq Φ. The file has[BEq R] [LawfulBEq R]at the top level, which should provideDecidableEq R. However,Rq Φis a quotient polynomial ring, and itsDecidableEqinstance depends onDecidableEq RandDecidableEqfor the polynomial representation. This is likely available but should be verified. - The
tensorGandtensorG1definitions are in sections that don't explicitly require[DecidableEq R], but the proofs useCoordEqwhich does. TheDecidableEqinstance forRq Φshould be available from the top-level context.
No escape hatches found: The file contains no sorry, axiom, native_decide, implemented_by, opaque, or sorryAx. All proofs are complete.
Overall: The file is mathematically sound and implements the paper's gadget algebra correctly. The proofs are straightforward algebraic manipulations. No critical misformalizations are evident from the diff alone.
Verdict: Approved
Checklist Verification:
- ✅ The
tensorGandtensorG1must be subtractive in the challenge vector and the coordinate isolation must collapse to the single blockj: The file definestensorGandtensorG1exactly as the block-weighted gadget sums from the paper. The subtractivity and coordinate-isolation theorems (tensorG_sub_challenge,tensorG1_sub_challenge,tensorG_coord_diff,tensorG1_coord_diff) faithfully implement the algebraic identities required for Lemma 8's subtract-and-divide extraction. ⚠️ The definitions ofDigitDecomposition,gadgetDecompose, andzmodDigitDecompositionmust capture the base-bdigit decomposition: The definitions ofcarrier,carrierDecomp,carrierCommit,jMatrix,zDecompand their roundtrip theorems correctly use the importedgadgetMatrix,gadgetDecompose, andgadgetDecompose_lawful. The file assumes these are correctly defined elsewhere; it does not define them itself.⚠️ ThegadgetDecompose_lawfultheorem must proveG·G⁻¹(x) = x: The roundtrip theoremscarrier_eq_gadgetandz_eq_jMatrixusegadgetDecompose_lawfulwith the hypotheseshd : 0 < digitsandh1 : 1 ≤ Φ.φ.natDegree. These match the paper's requirements. The file assumesgadgetDecompose_lawfulis correctly proved elsewhere.- ✅ The
InnerOuter.Schememust define the commitment exactly as a two‑layer composition: ThePublicParamsDstructure correctly extendsInnerOuter.PublicParamswith thedMatrixfield of typeSimple.PublicParams Φ dRows (blocks * messageDigits), matching Hachi Eq. (16). - ✅ The definitions of
IsSpecialSoundFamily,CoordEq,CWSSStructure,StarAt,central,sibmust match the paper: TheCoordEqtype fromCoordinateWiseSpecialSoundness.Basicis used correctly in the coordinate-isolation theorems. The file does not redefine these concepts. - ✅ Escape hatches (sorry, axiom, etc.): The file is a new introduction of gadget algebra; no
sorry,axiom, or other escape hatches are used. The proofs are complete and use standard tactics. - ✅ Typeclass assumptions are minimal and correct: The file uses
Field R,BEq R,LawfulBEq Ras typeclass assumptions. These are minimal for the cyclotomic ring operations. The[DecidableEq R]is introduced only where needed (after pure definitions). - ✅ Implicit vs. explicit arguments: The
carrierDecomptakesbaseas an implicit argument (pinned byddCarrier), whilecarrierandcarrierEntrytake it explicitly. This is a reasonable design choice and not an error. - ✅ Simp lemmas: No
@[simp]attributes are used. The file defines no simp lemmas, which is appropriate for these definitions. - ✅ Prop vs. Type: The theorems are placed in
Prop, definitions inType. No misuse found. - ✅ Universe levels: The file uses
Type(Type 0) which is sufficient for the domain. No universe polymorphism is needed. - ✅ Computability: The definitions are computable; no
noncomputableis used. - ✅ Naming conventions: Names follow the project's conventions:
camelCasefor definitions,snake_casefor theorems,UpperCamelCasefor types. The names are descriptive.
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `ArkLib/Commitments/Functional/Hachi/QuadEval/Reduction.lean`**
Analysis:
The PR introduces a new file Reduction.lean that formalizes the data layer of Hachi's QuadEval reduction (Figure 3, §4.2 of NOZ26). It defines:
QuadEvalStatement,QuadEvalResponse,QuadEvalWitness(the three case extracted witness),ShortChallengesubtype with lemmas (l1Norm_le,l1Norm_val_sub_le,val_ne_of_ne),derivedMsgMatrix,evalConsistency(Eq. 15),dShort,relOut(Eq. 20 linear system + symmetric ℓ∞ ball range checks),InSb,vecInSb,paperRelOut(the paper's exact S_b box),paperRelOut_subset_relOut(containment proof),relIn(extraction disjunction),verifier(pure pass‑through, as required by the CWSS generic layer),proverskeleton.
The code is a faithful rendition of the paper's Figure 3 data, with the deliberate generalization of range checks from the S_b box to the enclosing ℓ∞ ball, and a formal proof that the paper's verifier is contained in this generalization.
I identified one critical issue: the dShort definition uses the section variable blocks, but in relIn the QuadEvalStatement is specialized to blocks := 2^r. The ModuleSIS.relation application dShort Φ γ expects a ModuleSIS.Solution Φ (blocks * messageDigits), while stmt.pp.dMatrix has column count (2^r) * messageDigits. This is a type mismatch unless blocks is definitionally equal to 2^r in that context, which it is not. This would cause a compilation error. However, since the PR is presented as a diff and the file is new, it's possible this compiles in the full project context if there's a typeclass or if ModuleSIS.relation is more flexible, but as written it appears to be a type error. I'll flag this as a critical finding.
Additionally, I noticed a few minor issues:
- The
lInftyNorm_le_of_InSbproof usesomegawith a mix ofℤandℕbounds; whileomegacan handle this, the proof depends on the definition ofRq.lInftyNormand the conversion fromvalMinAbs(inℤ) to the norm (inℕ). This is a potential fragility but not a current error. - The
InSbdefinition usesa.1.coeff kwhich relies on the internal representation ofRq Φ. This is a bit fragile but acceptable ifRqis defined as a structure with a polynomial field. - The
proverdefinition usespSpecwithras a parameter, but the protocol is strictly two-round. Therparameter inpSpecmight be something else (like the challenge vector size). This is a naming confusion but not an error.
I also note that the Rq.l1Norm identifier was not found by the tool, but this is likely due to namespace issues; the code opens CyclotomicModulus so it should be available.
The main finding is the type mismatch in dShort / relIn. I'll flag this as a critical misformalization.
Verdict: Changes Requested
Checklist Verification:
- ✅ The QuadEval.Reduction module must define the protocol exactly as in Figure 3: The definitions of QuadEvalStatement, QuadEvalResponse, and QuadEvalWitness are present and match the paper's notation. The verifier is a pure pass-through, relOut contains the five equations plus range checks, and the paperRelOut containment is proved. The ShortChallenge subtype is correctly defined.
- ✅ The paperRelOut must capture the paper's exact S_b box range checks: paperRelOut is defined with vecInSb (InSb box), and paperRelOut_subset_relOut is proved for γ ≥ b/2. The InSb definition matches the paper's S_b box.
- ✅ The relIn definition must be the disjunction from Lemma 8: relIn correctly encodes the disjunction: VerifiedOpening + evalConsistency, or MSIS(B), or MSIS(D). dShort is defined as the analogue of outerShort.
- ✅ The verifier is a pure pass-through: verifier is defined as a pure pass-through: verify returns (stmt, round-0 message, round-1 challenge). This satisfies the hpure condition.
- ❌ The dShort definition in relIn must be compatible with the specialized blocks=2^r: dShort is defined with the section variable 'blocks', but in relIn the QuadEvalStatement is specialized to blocks := 2^r. The types ModuleSIS.Solution Φ (blocks * messageDigits) and ModuleSIS.Solution Φ ((2^r) * messageDigits) are not definitionally equal, causing a potential type error. This is a critical issue.
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks:
- The
proverdefinition usespSpecparameterized byr, but the protocol is strictly two-round. Therparameter inpSpecmight be the challenge vector size (log₂ of blocks), not the number of rounds. This is a naming confusion in thepSpecAPI but not an error in this file. (ArkLib/Commitments/Functional/Hachi/QuadEval/Reduction.lean:verifier and prover definitions) (confidence: low)- Evidence:
pSpec (CarrierCom Φ dRows) (ShortChallenge Φ ω) rwhereris the section variable fromm r : Nat. The docstring sayspSpec ⟨!v[.P_to_V, .V_to_P], !v[CarrierCom, Fin 2ʳ → C]⟩.
- Evidence:
- The
InSbdefinition accessesa.1.coeff kwhich relies on the internal representation ofRq Φas a structure with a polynomial field. This is fragile but acceptable ifRqis defined as a single-field structure. (ArkLib/Commitments/Functional/Hachi/QuadEval/Reduction.lean:InSb) (confidence: low)- Evidence:
InSbdefinition:(a.1.coeff k).valMinAbs.
- Evidence:
📄 **Review for `ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean`**
Analysis:
The file ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean is a new file that formalizes the coordinate-wise special soundness (CWSS) of the QuadEval reduction, corresponding to Hachi Lemma 8 (NOZ26 §4.2, Figure 3). This is the soundness proof for the two-round folding protocol.
Mathematical content:
The file defines:
quadEvalZL2SqBoundandquadEvalBetaSq: the derived norm constants B_z and βSq = 4·B_z for the J-gadget recomposition bound.extractedOpening: the subtract-and-divide weak opening assembled from a star of accepting branches.buildWitness: the three-case extractor (Lemma 8's case analysis): (A) divergent inner decomposition → MSIS(B), (B) divergent carrier decomposition → MSIS(D), (C) otherwise → subtract-and-divide weak opening.quadEvalPackage: a CWSSPackage bundling the verifier with its CWSS certificate for composition.
And proves:
evalConsistency_of_star: Eq. (15) consistency for the extracted opening.msis_of_commit_eq: two-transcript MSIS extraction step for cases (A)/(B) — two γ-short openings of the same commitment differ by a 2γ-short kernel vector.inner_eq_of_chain: the unit-cancellation core of subtract-and-divide.ShortChallenge.coordEq_val: lifts coordinate equality from the ShortChallenge subtype to the underlying ring elements.slack_isUnit: the challenge slack is a unit, using Lyubashevsky–Seiler invertibility.verifiedOpening_of_star: the extracted opening is a VerifiedOpening at βSq/γ/2ω.evalConsistency_of_relOut_star: the extracted opening satisfies Eq. (15) eval-consistency.buildWitness_mem_relIn: the witness assembler is correct — the main math lemma reducing Lemma 8.quadEval_coordinateWiseSpecialSound: Hachi Lemma 8 assembled via the generic CWSS framework.quadEval_coordinateWiseSpecialSound_paperParams: paper-parameter instantiation (γ := b).
Mapping to checklist items:
The code addresses all the critical checklist items for NOZ26 §4.2 QuadEval reduction and Lemma 8, FMN24 coordinate-wise special soundness, and LS18 short-element invertibility. The definitions and theorems closely follow the paper's structure.
Riskiest aspects:
-
The
msis_of_commit_eqtheorem returns aModuleSIS.relationwith a specific norm bound functionfun z => decide (vecLInftyNorm Φ z ≤ subLInftyNormBound γ). TherelInrelation expectsouterShort Φ γanddShort Φ γfor the MSIS cases. If these are not definitionally equal to the lambda used inmsis_of_commit_eq, the cases (A) and (B) ofbuildWitness_mem_relInwould not type-check. However, the toolchain confirms the code compiles, so this is likely fine. -
The
quadEvalBetaSqconstant is defined assubL2NormSqBound (quadEvalZL2SqBound ...) = 4·B_z. ThegadgetMul_zmod_sub_l2NormSq_lelemma must return a bound of≤ quadEvalBetaSq(or something that implies it). The code compiles, so the types match. However, ifgadgetMul_zmod_sub_l2NormSq_lealready gives a bound on the difference (rather than on each vector individually), thenquadEvalBetaSqmight be 4× larger than necessary, but this is a conservative bound, not an error. -
The
evalConsistency_of_starlemma usessplitFormfromCompPoly. The proof depends onsplitFormunfolding todot b (M *ᵥ a)or similar. This is consistent with the definition ofevalConsistencyinReduction.lean. -
The
verifiedOpening_of_staruseshc2eandhc6tefrom the central branch'srelOutto proveouter_eqandouter_shortof theVerifiedOpening. This is correct because the extracted opening'sinnerDecompis the central branch'sinnerDecverbatim, so the central branch's bounds apply directly (no 2γ slack).
Faithfulness checks:
-
Hachi Lemma 8 (paper): The QuadEval reduction is CWSS for (2^r, 2) structure. The extractor either outputs a weak opening or an MSIS solution for B or D.
-
Lean
quadEval_coordinateWiseSpecialSound: States exactly this, withrelOut= Eq. (20) + range checks,relIn= weak opening ∨ MSIS(B) ∨ MSIS(D). The hypotheses include q ≡ 5 mod 8, (2ω)² < q, and 0 < zDigits. The paper's hypotheses are the same. The conclusion matches the paper's. ✓ -
LS18 Corollary 1.2 (paper): nonzero short elements are units.
-
Lean
slack_isUnit: UsesisUnit_of_l1Norm_lewith the correct hypotheses. The slack is nonzero (sibling differs at coordinate i), has ℓ₁ norm ≤ 2ω, and (2ω)² < q ensures ℓ₂² < q. ✓ -
FMN24 Definitions 2.9/2.10 (paper): SS(S, ℓ, k) and star-center extraction.
-
Lean: Uses
foldStructure,StarAt,sib,central,CoordEqfrom theCoordinateWisemodule. The generic theoremcoordinateWiseSpecialSound_of_mkWitnessfromSingleRound.leanhandles the tree/extractor/guard obligations. ✓
No escape hatches found: The file is sorry-free (the docstring claims this, and the toolchain doesn't show any sorry in this file). No axiom, native_decide, implemented_by, opaque, or sorryAx are present.
Lean best practices:
- The
noncomputableattribute onextractedOpeningandbuildWitnessis appropriate (usesRing.inversewhich is noncomputable). - The
open Classicalis used forhB.chooseandhD.chooseinbuildWitness, which is fine for a cryptographic extractor. - The naming conventions follow the project's style.
- The typeclass assumptions are minimal and correct.
- The
variablesections are well-organized.
Potential issues found:
- The
evalConsistency_of_starproof usessplitFormwhich is not directly visible in the provided context. However, sinceCompPolyis opened and the code compiles, this is resolved. - The
msis_of_commit_eqreturns aModuleSIS.relationwith a specific lambda, whilerelInexpectsouterShort/dShort. The definitional equality between these is not verified in the provided material, but the code compiles, indicating they are indeed definitionally equal.
No critical misformalizations found. The formalization appears faithful to the paper.
Verdict: Approved
Checklist Verification:
- ✅ Paper result mapping (NOZ26 §4.2 QuadEval reduction and Lemma 8) — relOut encodes Eq. (20): The
relOutrelation is defined inQuadEval/Reduction.leanand used correctly inSoundness.lean. TherelOutcontains all five equations (c1-c5) plus three ℓ∞ range checks (c6a-c6c), matching Eq. (20). - ✅ Paper result mapping (NOZ26 §4.2 QuadEval reduction and Lemma 8) — paperRelOut_subset_relOut: The
paperRelOut_subset_relOuttheorem is proved inReduction.leanand referenced in the docstrings. The containment holds for γ ≥ b/2. The paper's S_b box is modeled asInSband the containment useslInftyNorm_le_of_InSb. - ✅ Paper result mapping (NOZ26 §4.2 QuadEval reduction and Lemma 8) — quadEval_coordinateWiseSpecialSound: The
quadEval_coordinateWiseSpecialSoundtheorem states CWSS for thefoldStructurewith(ℓ, k) = (2^r, 2),relIn= weak opening ∨ MSIS(B) ∨ MSIS(D), andrelOut= Eq. (20) + range checks. The hypotheses include q ≡ 5 mod 8, (2ω)² < q, and 0 < zDigits. - ✅ Paper result mapping (NOZ26 §4.2 QuadEval reduction and Lemma 8) — buildWitness three-case extractor: The
buildWitnessfunction implements the three cases: (A) divergent innerDecomp → MSIS(B), (B) divergent carrierDec → MSIS(D), (C) otherwise → subtract-and-divide opening. The proofbuildWitness_mem_relInhandles each case correctly using commitment equalities and norm bounds. - ✅ Paper result mapping (NOZ26 §4.2 QuadEval reduction and Lemma 8) — verifiedOpening_of_star: The
verifiedOpening_of_starlemma proves the extracted opening is aVerifiedOpeningat βSq/γ/2ω. Thescaled_shortproof usesgadgetMul_zmod_sub_l2NormSq_lewith the correct parameters. Theouter_shortis the central branch's γ (not 2γ), andinner_equses the coordinate-isolated c5 chain. Theslack_isUnitlemma uses LS18 invertibility. - ✅ Paper result mapping (NOZ26 §4.2 QuadEval reduction and Lemma 8) — evalConsistency_of_relOut_star: The
evalConsistency_of_relOut_starlemma proves Eq. (15) consistency using c3, c4, and the coordinate-isolated unit-divided chain. The proof correctly appliestensorG1_coord_diffandtensorG1_sub_challenge. - ✅ Paper result mapping (LS18 short-element invertibility) — slack_isUnit: The
slack_isUnitlemma usesisUnit_of_l1Norm_lefrom LS18 with the correct hypotheses: q ≡ 5 mod 8, slack is nonzero, ℓ₁ norm ≤ 2ω, and (2ω)² < q. The ring is the power-of-two cyclotomic𝓜(q, α). - ✅ Paper result mapping (NOZ26 §4.2 QuadEval reduction and Lemma 8) — buildWitness_mem_relIn: The
buildWitness_mem_relInlemma correctly assembles the three cases. Case (A) usesmsis_of_commit_eqwithstmt.pp.outerMatrix(B), case (B) uses it withstmt.pp.dMatrix(D), and case (C) produces theVerifiedOpeningandevalConsistency. TherelInrelation is defined as the disjunction of these three cases. - ✅ Paper result mapping (FMN24 coordinate-wise special soundness) — CWSS structure: The
quadEval_coordinateWiseSpecialSoundtheorem is assembled usingcoordinateWiseSpecialSound_of_mkWitnessfromSingleRound.lean, which handles the generic CWSS tree/extractor/guard obligations. The purity prooffun _ _ => rflcorrectly reflects that the verifier is a pure pass-through. - ✅ Paper result mapping (NOZ26 §4.2 QuadEval reduction and Lemma 8) — quadEvalPackage: The
quadEvalPackagebundles the verifier,foldStructure,relIn,relOut, purity proof, and CWSS certificate into aCWSSPackage. TherelOutof the package is defined asrelOut ...and therelInasrelIn ..., ready for composition with the polynomial-level bridge.
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks:
- The
quadEvalBetaSqconstant is documented assubL2NormSqBound B_z = 4·B_z. ThequadEvalZL2SqBoundiszRecomposeL2SqBound γ b τ d (2^m * δ). IfgadgetMul_zmod_sub_l2NormSq_lealready gives a bound on the differenceJ z₁ - J z₂, thenquadEvalBetaSqmight be 4× larger than the actual bound, making it a looser bound than necessary. This is a conservative bound choice, not an error, but the docstring could be clarified to explain why the factor of 4 is present (triangle inequality for the difference of two vectors, or becausesubL2NormSqBoundis defined as 4·B_z). (ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean:quadEvalBetaSq) (confidence: low)- Evidence: The docstring for
quadEvalBetaSqsays 'the ℓ₂² bound on the extracted c̄ⱼ •ᵥ sⱼ = z_sib − z_central'. ThegadgetMul_zmod_sub_l2NormSq_lelemma is used directly inverifiedOpening_of_star, suggesting it already accounts for the difference. The factor of 4 may be redundant if the lemma already bounds the difference.
- Evidence: The docstring for
Cluster: Polynomial‑to‑matrix bridge (high)
Does the bridge correctly convert a multilinear polynomial evaluation claim into a QuadEvalStatement, and is the pull‑back of the Lemma 8 extraction to the polynomial level sound?
📄 **Review for `ArkLib/Commitments/Functional/Hachi/EvalSplit.lean`**
Analysis:
The diff adds toPolynomial (the inverse reshape of toMatrix), three round‑trip/access lemmas, and the bridge lemma splitForm_monomialBasis_eq_eval. These definitions realize the polynomial‑to‑matrix bridge required by NOZ26 §4.2: a matrix M is read back into a CMlPolynomial via toPolynomial, and the split bilinear form splitForm M (mb xl) (mb xh) is proved equal to eval (toPolynomial M) (xl ++ xh). The Bridge.lean code (reviewed in context) uses this lemma to translate the QuadEval‑level consistency condition into a polynomial evaluation claim, exactly as required by the specification checklist.
Every checklist item for this file is satisfied:
toPolynomialand its round‑trip lemmas are correctly defined and proved.splitForm_monomialBasis_eq_evalis proved and correctly factors the evaluation.- The Bridge.lean usage (
mem_relPolyEval_of_relIn) correctly rewrites the matrix condition using the bridge lemma. - The
bridgePackageis pure and itsrelOutis definitionally equal to the downstreamrelIn.
No mathematical errors, missing hypotheses, or Lean 4 anti‑patterns were found. The only existing sorry in the repository is in a different file and is not implicated by this diff.
Verdict: Approved
Checklist Verification:
- ✅ Paper result mapping (NOZ26 §4.2 polynomial‑to‑QuadEval bridge) — matrix reshape
toMatrixand its inversetoPolynomial:toMatrixwas already defined;toPolynomialis added as its inverse with round‑trip lemmastoMatrix_toPolynomialandtoPolynomial_toMatrix. - ✅ Paper result mapping (NOZ26 §4.2 polynomial‑to‑QuadEval bridge) —
splitForm_monomialBasis_eq_eval:splitForm_monomialBasis_eq_evalis proved:splitForm M (mb xl).get (mb xh).get = eval (toPolynomial M) (xl ++ xh). The proof usesevalSplit_eq_evalandtoMatrix_toPolynomial, matching the paper's bridge. - ✅ Paper result mapping (NOZ26 §4.2 polynomial‑to‑QuadEval bridge) —
PolyEvalStatementandtoQuadEvalStatement:PolyEvalStatementandtoQuadEvalStatementexist in Bridge.lean and usemb(xl)andmb(xh)as required. - ✅ Paper result mapping (NOZ26 §4.2 polynomial‑to‑QuadEval bridge) —
relPolyEvalandmem_relPolyEval_of_relIn:relPolyEvalis defined as the pull‑back ofQuadEval'srelIn;mem_relPolyEval_of_relInis proved using the bridge lemma. - ✅ Paper result mapping (NOZ26 §4.2 polynomial‑to‑QuadEval bridge) —
bridge_coordinateWiseSpecialSound:bridge_coordinateWiseSpecialSoundandbridgePackageare defined in Bridge.lean; the package is pure andrelOutis definitionallyQuadEval'srelIn. - ✅ Paper result mapping (FMN24 coordinate‑wise special soundness) — definitions: The
foldStructureand related CWSS definitions are in the single‑round module, not in this diff, but the bridge correctly uses them. - ✅ Hidden assumptions and implicit identifications — index convention consistency: The
splitEquivindexing is little‑endian and consistent with the monomial basis;toMatrixandtoPolynomialare inverses. - ✅ Hidden assumptions and implicit identifications — pure verifier: The
bridgePackageis purely a zero‑roundReduceClaim;isPureis proved byrfl. - ✅ Hidden assumptions and implicit identifications — definitional equality of
relOutandrelIn:relOutofbridgePackageisrelIn Φ base βSq γ κ, which is definitionally equal to theQuadEvalpackage'srelIn.
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `ArkLib/Commitments/Functional/Hachi/QuadEval/Bridge.lean`**
Analysis:
The file Bridge.lean defines a zero-round polynomial-to-matrix bridge for Hachi's QuadEval reduction. It introduces PolyEvalStatement (the polynomial-level statement with public parameters, commitment, split evaluation point (xl, xh), and claimed value y), toQuadEvalStatement (which maps it to a QuadEvalStatement by taking the evaluation bases to be the monomial tensor bases of the point halves), and bridgeVerifier (a ReduceClaim verifier). The polynomial-level input relation relPolyEval is the pull-back of QuadEval's relIn: either a weak VerifiedOpening whose extracted polynomial evaluates to y, or MSIS solutions for B or D. The main theorem mem_relPolyEval_of_relIn proves that relIn at toQuadEvalStatement implies relPolyEval, using splitForm_monomialBasis_eq_eval from EvalSplit. The CWSS theorem bridge_coordinateWiseSpecialSound is a direct application of the generic ReduceClaim.verifier_coordinateWiseSpecialSound. Finally, bridgePackage bundles everything into a CWSSPackage ready for composition with quadEvalPackage.
Mapping to checklist items:
- The bridge correctly reinterprets a polynomial-level evaluation claim as a
QuadEvalStatementusing the monomial tensor bases, matching NOZ26 §4.2's implicit bridge. extractedPolyistoPolynomial (derivedMsgMatrix ...)andtoMatrix_extractedPolygives the round-trip identity, linking the polynomial and matrix views.relPolyEvalcorrectly captures the polynomial-level extraction:VerifiedOpeningwithevalconsistency, or MSIS for B/D.mem_relPolyEval_of_relIncorrectly rewrites the matrix-levelevalConsistencyinto the polynomial evaluation usingsplitForm_monomialBasis_eq_eval.bridge_coordinateWiseSpecialSoundcorrectly usesReduceClaim.verifier_coordinateWiseSpecialSound.bridgePackageis pure and itsrelOutis definitionallyrelIn, satisfying the seam requirement for▷-composition.
Riskiest aspects:
- The argument order in
evalConsistencyvssplitFormandsplitForm_monomialBasis_eq_evalis load-bearing and not directly visible in this file, but the proof typechecks and the docstring acknowledges the order. The type system guarantees consistency. - The
PolyEvalStatementstructure fixes2^mand2^rin thePublicParamsDtype, matchingQuadEvalStatement'smessageRowsandblocks. No off-by-one or exponent confusion. - Edge cases
r=0orm=0are not excluded; they produce valid (though trivial) instances. The proofs do not rely on positivity.
Lean 4 best practices:
- Typeclass assumptions are minimal and appropriate (
Field,BEq,LawfulBEq,NeZero,Fact (Nat.Prime q)). @[simp]lemmatoMatrix_extractedPolyis a good simplification rule.omit [NeZero q]is used correctly to avoid unnecessary instance constraints.- Naming conventions follow Mathlib style.
- No escape hatches (
sorry,axiom, etc.) are present; the file is sorry-free. - Universe polymorphism is not used but the file is consistent with the project's style.
Verdict: The code is mathematically correct, well-documented, and free of Lean issues. It satisfies all relevant checklist items.
Verdict: Approved
Checklist Verification:
- ✅ NOZ26 §4.2 (implicit): Polynomial‑level bridge: zero‑round reduction that reinterprets a
CMlPolynomialevaluation claim as aQuadEvalStatementvia the monomial tensor bases.: ThePolyEvalStatementandtoQuadEvalStatementcorrectly define the polynomial-level statement and its reinterpretation as aQuadEvalStatementwith the monomial tensor bases. TheEvalSplitmodule provides the matrix reshape and the bridge lemmasplitForm_monomialBasis_eq_eval. - ✅
relPolyEvaldefinition must be the pull‑back ofQuadEval'srelInto the polynomial level: aVerifiedOpeningwhose extracted polynomial evaluates toy, or MSIS(B), or MSIS(D). Themem_relPolyEval_of_relInlemma must prove thatrelInattoQuadEvalStatementimpliesrelPolyEval.:extractedPolyis defined astoPolynomial (derivedMsgMatrix ...)andtoMatrix_extractedPolyproves the round‑trip identity. TherelPolyEvalrelation is the pull‑back ofQuadEval'srelInto the polynomial level:VerifiedOpeningwithevalconsistency, or MSIS for B/D. - ✅ The
mem_relPolyEval_of_relInlemma must prove thatrelInattoQuadEvalStatementimpliesrelPolyEval.:mem_relPolyEval_of_relIncorrectly rewrites the matrix‑levelevalConsistencyto the polynomial evaluation usingsplitForm_monomialBasis_eq_eval. The argument order is consistent with the docstring and the proof typechecks. - ✅ The
bridge_coordinateWiseSpecialSoundtheorem must prove that the zero‑roundReduceClaimhead is CWSS for anyD, reducingrelPolyEvaltoQuadEval'srelIn. The witness type must be unchanged (QuadEvalWitness).:bridge_coordinateWiseSpecialSoundusesReduceClaim.verifier_coordinateWiseSpecialSoundwith the correct pull‑back. The witness type is unchanged (QuadEvalWitness). - ✅ The
evalChaincomposition usesCWSSPackage.append(▷). The left package'srelOutmust be definitionally equal to the right'srelIn. The PR'sbridgePackagesetsrelOut := relIn Φ base βSq γ κandquadEvalPackagesetsrelIn := relIn …with the same parameters. This must berfl.:bridgePackagesetsrelOut := relIn Φ base βSq γ κwhich is definitionallyQuadEval'srelIn. TheisPurefield is proven withrfl. The composition seam isrfl. - ✅ The
PolyEvalStatementandtoQuadEvalStatementmust faithfully represent the paper's evaluation claim: the evaluation point is split intoxl(firstrvariables) andxh(lastmvariables), and the bases are the monomial tensor basesmb(xl)andmb(xh).: ThePolyEvalStatementstructure andtoQuadEvalStatementcorrectly split the evaluation point intoxl(firstrvariables) andxh(lastmvariables), and use the monomial tensor basesmb(xl)andmb(xh)as thebvecandavecrespectively. TheEvalSplitmodule'ssplitForm_monomialBasis_eq_evaluses the same split. - ✅ The
QuadEvalverifier is a pure pass‑through, so itsverifymust be a deterministic function of the transcript. Thehpurecondition required bycoordinateWiseSpecialSound_of_mkWitnessmust be∀ s tr, V.verify s tr = pure (s, tr.messages 0, tr.challenges 1). The PR'sverifierdefinition must satisfy this exactly.: ThebridgeVerifieris aReduceClaim.verifierwhich is pure (deterministic). TheisPurefield inbridgePackageprovides the prooffun _ _ => rfl. Thehpurecondition is satisfied. - ✅ Escape hatches: no
sorryoradmitin this file.: The file contains nosorry,axiom,native_decide,implemented_by,opaque, orsorryAx. All proofs are complete.
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
Cluster: Generic CWSS composition infrastructure (high)
Are the new generic CWSS composition primitives (no‑challenge bridge, CWSSPackage, n‑ary seqCompose, SingleRound assembly) mathematically correct and do they provide the necessary purity and composition theorems for the Hachi proofs?
📄 **Review for `ArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/NoChallenge.lean`**Analysis: What the code does mathematically:
Mapping to specification checklist: Riskiest aspects:
Faithfulness checks:
Potential issues identified: Verdict: Approved Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/Package.lean`**Analysis: Mapping to the checklist:
No mathematical errors, missing hypotheses, or escape hatches are present. The only minor style issue is an unused Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/SeqCompose.lean`**Analysis:
The code typechecks successfully. The mathematical content is sound, the induction is correctly structured, and the purity requirements are properly propagated. The file does not introduce any escape hatches ( Checklist mapping: This file addresses the FMN24 CWSS composition infrastructure. It does not directly address the Hachi-specific checklist items (gadget decomposition, inner-outer commitment, QuadEval) — those are in other files. The file correctly provides the generic n-ary composition theorems needed for the Hachi proofs. Faithfulness checks:
No mathematical errors, missing hypotheses, or broken assumptions found. Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness/SingleRound.lean`**Analysis: Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/OracleReduction/Composition/Sequential/IsPure.lean`**Analysis:
These are foundational lemmas that support the Mapping to checklist items:
Risk assessment: Another subtlety: the No escape hatches found. The proofs are complete (no Faithfulness checks: There is no direct paper result mapped to this file; it's infrastructure. The Potential issues:
Conclusion: The file is mathematically correct, follows Lean best practices, and has no critical issues. There are minor style nitpicks (duplicate proof in base case). Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/ProofSystem/Component/CheckClaim.lean`**Analysis: Mathematical mapping:
Riskiest aspects:
Faithfulness checks:
No mathematical errors found. The code is clean and follows the design described in the spec. Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/ProofSystem/Component/ReduceClaim.lean`**Analysis:
Correctness assessment: The mathematical content is sound. The Potential concerns:
No mathematical errors, missing hypotheses, or escape hatches were found. The changes are purely additive and do not break existing code. Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/ProofSystem/Component/SendChallenge.lean`**Analysis:
Mathematically, Mapping to checklist items:
Riskiest aspects: the Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks: None 📄 **Review for `ArkLib/ProofSystem/Component/SendClaim.lean`**Analysis:
Mapping to spec checklist: The checklist items for Riskiest aspects: (1) The Faithfulness checks: No specific paper theorem is directly referenced by Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/ProofSystem/Component/SendWitness.lean`**An error occurred while analyzing 📄 **Review for `ArkLib/Commitments/Functional/Hachi/Composition.lean`**Analysis: Mapping to checklist:
Risk assessment: The composition is purely structural — it chains two already-proven packages. The risk of misformalization is low. The main potential issues are: (1) the Second-order issues: The Lean practices: The code uses appropriate typeclass assumptions, correct implicit/explicit argument conventions, and standard naming. No escape hatches are present in the file under review. Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
Cluster: Inner‑outer commitment scheme (minor updates) (medium)Do the import changes and documentation additions preserve the correctness of the inner‑outer commitment and weak‑binding proofs? 📄 **Review for `ArkLib/Commitments/Functional/Hachi/InnerOuter/Scheme.lean`**Analysis: Verdict: Needs Minor Revisions Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks: None 📄 **Review for `ArkLib/Commitments/Functional/Hachi/InnerOuter/Correctness.lean`**Analysis:
Mathematically, the file proves perfect correctness of the inner-outer Ajtai commitment for the Hachi base-
Compliance with spec checklist:
Correctness of the import change: Second-order issues:
Faithfulness Check:
Verdict: The diff is a clean import path update and documentation enhancement. No mathematical errors, no broken assumptions, no escape hatches introduced. The file compiles and all theorems remain correct. Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks: None 📄 **Review for `ArkLib/Commitments/Functional/Hachi/InnerOuter/Security.lean`**Analysis: Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks: None 📄 **Review for `ArkLib/Commitments/Functional/Hachi/InnerOuter/Arithmetic.lean`**Analysis: Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks: None Cluster: Top‑level Hachi integration and functional commitment scaffold (medium)Is the top‑level Hachi functional commitment correctly wired, and does the 📄 **Review for `ArkLib/Commitments/Functional/Hachi.lean`**Analysis: What the code does mathematically: Nothing directly. It serves as an organizational entry point and re-export hub for the Hachi development. Users who Mapping to spec checklist items: No checklist items are directly addressed by this file. All checklist items concern mathematical content (definitions, theorems, proof strategies) that live in the submodules this file imports. The file does not introduce any new formalization, so it cannot violate any mathematical correctness requirement. Riskiest aspects: The only potential issue is whether the import list is complete for a module that claims to be an umbrella re-export. The docstring describes six submodules ( Second-order issues: The docstring explicitly acknowledges that Faithfulness checks: Not applicable — there are no Lean theorems or definitions referencing paper results in this file. Tool evidence: Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
|
📄 **Review for `ArkLib/Commitments/Functional/Hachi/Commitment.lean`**Analysis:
The file matches the paper's description of the honest committer operations (NOZ26 §2.1/§4.1) and the protocol shape ( Riskiest aspect: The Checklist mapping: The code addresses the top-level scaffolding of the Hachi functional commitment (NOZ26 §4.1), using the canonical base- Verdict: Changes Requested Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues:
Nitpicks: None 📄 **Review for `ArkLib.lean`**Analysis: Verdict: Changes Requested Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues:
Nitpicks: None Cluster: Unclustered files (low)Review these files independently. 📄 **Review for `ArkLib/Commitments/Functional/Hachi/Gadget.lean`**Analysis: Checklist mapping:
Riskiest aspects:
Faithfulness check: The diff is purely organizational. No Lean theorem statement changed. The paper-to-Lean mapping is unaffected — the same definitions and theorems exist at the same fully qualified names. Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/Commitments/Functional/Hachi/GadgetNorms.lean`**Analysis:
These bounds are explicitly required by the Formalization Checklist:
The checklist further states that the Risk assessment: The deletion is the highest‑risk change possible — it removes a foundational dependency for the entire Hachi commitment‑layer security argument. Unless the PR simultaneously adds equivalent bounds in a different module (which the diff does not show), this is a blocker. Even if the bounds are moved, the deletion alone would break the build until the downstream imports are updated, which the diff also does not show. Faithfulness checks: The theorems in the deleted file are mathematically faithful to the paper’s requirements (correct hypotheses, correct bounds). The file itself has no Verdict: Changes Requested Checklist Verification:
Critical Misformalizations:
Lean 4 / Mathlib Issues:
Nitpicks: None 📄 **Review for `ArkLib/Commitments/Functional/Hachi/InnerOuter.lean`**Analysis: Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks: None 📄 **Review for `ArkLib/Commitments/Functional/Hachi/QuadEval.lean`**Analysis: Verdict: Needs Minor Revisions Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks:
📄 **Review for `ArkLib/OracleReduction/Security/CoordinateWiseSpecialSoundness.lean`**Analysis: What the change does mathematically:
Checklist mapping:
Risk assessment:
Faithfulness check:
Lean 4 best practices:
Verdict: Approved Checklist Verification:
Critical Misformalizations: None Lean 4 / Mathlib Issues: None Nitpicks: None |
TLDR
This PR adds the (sub)protocol of fig. 3 from the Hachi paper and along the way, introduces a new abstraction called
CWSSPackagethat allows for easy composition of CWSS protocols (even has nice notation). It also slightly restructures the Hachi folder to be more readable (typically with subfolders for subprotocols and more documentation of where what is to be found).Figure 3 Protocol
This PR adds the
Hachi/QuadEval/development for the Figure 3 polynomial-evaluation reduction.The reduction rewrites a multilinear evaluation claim
f(x) = yas the quadratic formbᵀ M a, then folds the2^rcarrier blocks under the verifier’s challenge vector. In Lean, the protocol is split into:QuadEval/Gadgets.lean: gadget algebra forPublicParamsD, the carrierw, its decompositionŵ, the short commitmentv = D ŵ, theJdecomposition, and thetensorG/tensorG1identities used by the extractor.QuadEval/Reduction.lean: the Figure 3 protocol data, includingQuadEvalStatement,QuadEvalResponse,QuadEvalWitness,ShortChallenge,relIn,relOut,verifier, and the honestproverskeleton.QuadEval/Soundness.lean: Hachi Lemma 8 asquadEval_coordinateWiseSpecialSound, together withbuildWitnessand the composablequadEvalPackage.QuadEval/Bridge.lean: the zero-round polynomial-level bridge fromPolyEvalStatementtoQuadEvalStatement, withrelPolyEval,bridge_coordinateWiseSpecialSound, andbridgePackage.The implementation is organized as a two-package CWSS chain. The first package is a zero-round
adapter into the Figure 3 statement shape; the second package is the actual two-round Figure 3
protocol. At the relation level, the chain looks like this:
Relations are the nodes; each
CWSSPackageis an edge reducing one relation to the next, and thewhole chain is
evalChain = bridgePackage ▷ quadEvalPackage.Zooming into the
quadEvalPackage, the implemented Figure 3 interaction is:In other words:
bridgePackagecovers the statement reduction into Figure 3: it turns aPolyEvalStatementinto a
QuadEvalStatementusingtoQuadEvalStatement, withbvec := mb(xl)andavec := mb(xh). It has no messages or challenges, so its structure isCWSSStructure.ofIsEmpty.quadEvalPackagecovers the Figure 3 protocol itself: the prover sends the short carriercommitment
v = D ŵ, the verifier sends the challenge vectorc : Fin (2^r) → ShortChallenge, and the output relationrelOutchecks the Eq. (20)constraints and range checks against
QuadEvalResponse = (ŵ, t̂, ẑ).bridgePackage.relOutis the same relation asquadEvalPackage.relIn, so the two compose asbridgePackage ▷ quadEvalPackage.CWSSPackage Composition
This PR introduces
CWSSPackage, a small bundle for reusable CWSS composition. A package collectsexactly the data needed to reuse one protocol as a link in a larger CWSS proof:
verifier: the verifier/reduction implemented by this component;struct: theCWSSStructuredescribing the component's challenge shape;relIn: the input relation the component reduces from;relOut: the output relation the component reduces to;isPure: the proof that the verifier is deterministic as a function of the statement andtranscript, which is the hypothesis needed to compose it on the left;
isCWSS: the actual coordinate-wise-special-soundness certificate for this component.Packages compose with:
whenever each adjacent seam matches, i.e.
Pᵢ.relOut = Pᵢ₊₁.relIn. The result is again aCWSSPackage, whoseisCWSSfield is the composed CWSS certificate for the whole chain.For the Figure 3 core in this PR, the concrete chain is:
where
bridgePackageis the zero-round polynomial-level bridge intoQuadEval, andquadEvalPackageis the two-round Figure 3 reduction with its Lemma 8 CWSS proof.Generic Infrastructure
This PR also adds reusable CWSS infrastructure for:
CWSSStructure.ofIsEmpty;CoordinateWise.SingleRound;Hachi Integration
This PR adds the Hachi folder landing page and a
Commitment.Schemeshell with the multilinear evaluation oracle, honestkeygen, and honestcommit.The full opening proof remains documented as future work pending the remaining §4.3+/§4.5 subprotocols and the completeness layer. The Figure 3 CWSS core itself is exposed through
evalChainandeval_coordinateWiseSpecialSound.cc @ErVinuelas