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. |
alexanderlhicks
left a comment
There was a problem hiding this comment.
Part of a cross-PR review of #654, #656 and #659 read together (plus the open ring-switching PR #615), in isolated builds, against NOZ26 (ePrint 2026/156, SHA-256 c7c98591…afd5e6a15). Where a finding interacts with a sibling PR I say so explicitly.
#659 — reviewed at 74feb760
The refactor is clean and the fixed-key Module-SIS repair is genuinely sound. Escapes are now
checked against pp.outerMatrix / pp.dMatrix, the actual key from the statement's public
parameters, so a break can no longer be smuggled in by supplying a convenient matrix alongside the
solution. I also went looking for the obvious hole and it isn't there: ModuleSIS.relation is
decide (z ≠ 0) && isShort z && decide (A *ᵥ z = 0), so Definition 1's 0 < ‖z‖∞ really is
enforced.
Several paper checks came out right on independent re-derivation:
paperRelOut_subset_relOuthas the containment in the sound direction — the formalized
relation is the weaker (larger) one, so soundness against it is at least as strong;- the
ℓ₁invertibility criterion implies paper Lemma 3'sℓ₂hypothesis, since‖·‖₂ ≤ ‖·‖₁. A
sound generalisation, not a weakening; SS(C, 2^r, 2)really does haveℓ(k−1)+1 = 2^r + 1elements, as Lemma 8 states. (Pleasant
contrast with Lemma 10, whose transcript count is wrong — see #656.)
The 14 Gadget Basic → Core declarations are body-identical moves, the five umbrella renames are
declaration-free, import integrity holds, and there is no new sorry (changed-file bodies
36 → 35). quadEval_coordinateWiseSpecialSound, paperRelOut_subset_relOut, CWSSPackage.append
and EscapeCWSSPackage.append are all axiom-clean.
Three things I'd like changed:
- Six deleted design documents with 21 live references left behind, across 10 files. Several are
load-bearing section pointers —ZeroCheck/Constraints.lean:45,75,188cite
HACHI_LEMMA10_GAP.md§3.K / §3.K.2 as the derivation of the Kronecker-seed design the code
implements.check-docs-integrity.pydoesn't see docstring paths, so CI stays green. #654
performs the identical deletion with zero dangling references — adopt its cleanup on rebase, and
migrate the surviving gap analyses intodocs/kb/audits/first. docs/skills/make-pr-ready.mdtells agents to delete untracked user files after only a
warning. Out of scope, and hazardous in a tree that routinely carries dozens of untracked planning
documents. (#656 edits the same file with a genuinely useful canonical-base fix — worth keeping
theirs and dropping this addition.)QuadEvalEscapeMaphas no upper bound onlocalEsc— and the obvious fix doesn't work,
because.selfsetslocalEsc := quadEvalSISSet, which is nonempty for every compressing key,
and nonemptiness alone already collapses the certificate to a constant extractor. Compiled witness
in that comment. Pre-existing framework behaviour, so not a blocker on its own, but the
guarded-append and package-lattice claims should be scoped accordingly.
Two smaller items: the generated overview still advertises a superseded shape — "single line of nine
reductions" (:357), "9-link opening chain" (:365), "≈24 open sorries" (:367), and generation "from
the current working tree on the hachi-skeleton branch" (:527) — against an actual 12 rows and 33
executable sorry bodies in the Hachi tree. Those lines fall outside this PR's diff hunks so I
couldn't anchor a comment; either regenerate or drop the numeric claims. And your HMZ25 bib entry is
the correct one of the two competing additions — see that comment, it's a heads-up rather than a
defect.
On #615 (open, head 68e9a752): it overlaps this PR on ArkLib.lean,
blueprint/src/references.bib and docs/wiki/repo-map.md. Worth noting it is not exposed to
item 3: #615 states security as an RBR knowledge-soundness probability bound and never uses
withEscape, so there's no constant-extractor escape hatch there. The fix I suggest above moves
these certificates toward the shape #615 already has.
Ordering: #654 → #659 → #656. Rebasing onto #654 gets you its proof of
ScalarRound.coordinateWiseSpecialSound_of_mkWitness_scalar (currently sorry here), its
HACHI_*.md reference cleanup, and a settled bib — three of the items above largely resolve
themselves that way.
Posted as a comment rather than a formal "request changes" so it doesn't block the queue.
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.