refactor(Hachi/CWSS): cwss packages with escape - #659
Conversation
🤖 PR Summary
This refactor PR replaces the prior escape-threaded evaluation-chain approach with a protocol-agnostic escape abstraction embedded into the CWSS composition machinery itself. It does not close any sorries; callers who rely on the old Statistics
Lean Declarations ✏️ Removed: 25 declaration(s)
✏️ Added: 44 declaration(s)
✏️ Affected: 10 declaration(s) (line number changed)
✅ Removed: 1 `sorry`(s)
Coverage Notes
Partially Analyzed Files
📄 **Per-File Summaries**
Last updated: 2026-07-24 13:46 UTC. |
Build Timing Report
Incremental Rebuild Signal
This compares a clean project build against an incremental rebuild in the same CI job; it is a lightweight variability signal, not a full cross-run benchmark. Slowest Current Clean-Build FilesShowing 20 slowest current targets, with comparison against the selected baseline when available.
|
alexanderlhicks
left a comment
There was a problem hiding this comment.
🤖 AI-generated review (Claude Code). These comments were produced by an AI assistant reviewing this PR against the Hachi paper (NOZ26, ePrint 2026/156) and ArkLib conventions; claims were spot-checked in a built worktree but please verify before acting.
Additional notes (lines outside the diff hunks)
ArkLib/Commitments/Functional/Hachi/QuadEval/Soundness.lean:95— [documented deviation · no action required] For the record (already noted in the docstrings):quadEvalBetaSqis a squared-ℓ₂ over-approximation with dimensional factors, not the paper'sβ̄ = 2b^k(Lemma 8). This is the samequadEvalBetaSq/VerifiedOpeningvs(2b^k, 2ω, b)parameter bridge owed since #626 — worth tracking as the parameter-instantiation task so the escape norm bounds eventually reconcile to the paper's constants.
🤖 PR Summary
Generated — expertly summarize remaining output above Statistics
Lean Declarations ✏️ Removed: 25 declaration(s)
✏️ Added: 44 declaration(s)
✏️ Affected: 10 declaration(s) (line number changed)
✅ Removed: 1 `sorry`(s)
Coverage Notes
Partially Analyzed Files
📄 **Per-File Summaries**
Last updated: 2026-07-26 07:15 UTC. |
CWSS packages with escape threading
Adds a protocol-agnostic escape abstraction to the coordinate-wise special-soundness
(CWSS) composition machinery, and refactors the package layer into a clean 2×2 lattice
of package kinds joined by a single universal append
▷.Motivation: escapes belong to composition, not to relations
In a composed special-soundness chain, a downstream extractor may fail to produce a real
witness and instead return a cryptographic escape — e.g. a commitment binding-break that
is a Module-SIS solution via weak binding (Hachi's
w̃-commitment, [NOZ26] Remark 2 /Lemma 7). Composed extraction feeds each extractor's output into the previous seam relation,
so every relation upstream of the escape's origin needs somewhere to put it.
The naive fix — bake an escape disjunct into each subprotocol's own
relIn/relOut— pollutesevery upstream relation definition with cryptographic plumbing it shouldn't know about.
This PR keeps the subprotocol relations ordinary and threads the escape on a parallel seam
that is only widened into the relation inside the special-soundness certificate. Escape
handling shifts from relation definitions to appending / protocol composition. Because an
escape (an MSIS/collision solution) is checkable against the commitment key alone, it is
statement-independent: it passes through statement maps trivially, and the escape branch of
every seam extractor is the identity
Sum.inr.Core primitive:
Set.withEscapeWidens an ordinary relation to accept escapes on the right summand (
+lemmas:mem_withEscape_inl/inr,mem_withEscape_language_iff,withEscape_empty_iff). The wideninglives inside each package's certificate — the public
relIn/relOutstay escape-free.The four package kinds — the 2×2 lattice (escape? × guarded?)
Every kind carries
verifier,struct,relIn,relOut, and anisCWSScertificate; theescape kinds add
escIn/escOutplusescape_mono : escOut ⊆ escIn(escapes may grow up thechain but are never discarded).
CWSSPackagerelIn/relOut▷Package.leanGCWSSPackagerelIn/relOut▷ᵍGuarded.leanEscapeCWSSPackagerelIn.withEscape escIn/relOut.withEscape escOut▷ₑEscape.leanEscapeGCWSSPackagerelIn.withEscape escIn/relOut.withEscape escOut▷ₑᵍEscape.leanThe guarded axis (from the sumcheck track) models a left factor whose verifier may reject:
if check stmt tr then pure (out …) else failure. This is needed exactly where a runtime checkreads sent/input data that the downstream statement type drops (sumcheck round targets,
final-eval check, recursion handoff), which pure/relation-only verifiers cannot express.
Lifting: an escape-free / pure package enters a richer chain for free
Escape packages need only be defined for the subprotocols that genuinely produce escapes;
everything else is lifted automatically at composition time.
CWSSPackage.toGuarded/EscapeCWSSPackage.toGuardedcheck := truespecial caseCWSSPackage.withEscape/GCWSSPackage.withEscapeescIn = escOut(passes downstream escapes through unchanged)coordinateWiseSpecialSound.withEscapeEtreeSpecialSound.withEscapeat the tree levelComposition: one universal
▷over all 16 pairingsL₁ ▷ L₂composes any two package kinds at the join of their kinds, inserting thewithEscape/toGuardedlifts on the fly and choosing escape budgets so the escape seam holdsdefinitionally (only the ordinary relation seam
hRel, and between two escape-aware factors theescape seam
hEsc, remain — both discharged byrfl). Join semantics: escape-free ▷ escape-freestays escape-free, pure ▷ pure stays pure, and a single escape-aware or guarded factor lifts the
rest of the chain.
append,appendEscape,appendGuarded,appendEscapeGuarded,appendPure, …) and wired into a single dispatch tableunivAppendFn.▷is a single scoped elaborator that reads each factor's head constant and applies theunique compatible append — linear in chain length. Overloaded-notation
choicenodes wouldre-elaborate nested alternatives exponentially (a 5-link Hachi chain already exhausts the
heartbeat budget). The kind-marked
▷ₑ,▷ᵍ,▷ₑᵍremain as explicit single-target synonyms;repo code composes with the universal
▷throughout.