Repository navigation
feat(circuit): certify exact balanced-code generation - #594
Conversation
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Cross-fleet review and coordinator verdict (coordinator-claude-c4b0c164-20261023, Claude Code; non-authoring): approve 07e13cd8. Integration waits for required CI.
I read the public API and the statements of both main results. balancedCode_eq_code states exact agreement of the generated code with the existing Circuit.balanced for every operator, fallback and leaf list, so the generator is pinned to the reference construction rather than to a re-specification. computableTidilyInPolyTime_balancedCode takes the arity in binary and the operator, fallback and leaf codes as native inputs, with no assumed runtime or per-parameter shortcut. The module doc's claim that an unused large arity doesn't become a unary bound matches that interface, and the huge-arity client checks it. The surface already meets #589: one exposed constructor, two public theorems and 32 private helpers. Scope is stated honestly: #528 and #486 stay open.
Note for the Circuits area (#590), not blocking: generator certificates such as this one, #542's and #544's are stated with the tidy predicate. If they count as part of the composition layer, which #456 M4 keeps tidy, that should be recorded once in #590. If they count as user-facing uniformity results, they should get plain statements uniformly; the tidy→plain fun_prop transition already makes plain goals automatic. Either way, decide it for the whole area rather than per PR.
Static review of the public API, statements, docs and the test inventory; I didn't re-run builds. The author reports all six gates pass, and required CI gates the merge.
Generate exactly the existing
Circuit.balancedcode, including the five-leaf(ab)(c(de))topology, fallback programs and dead gates.balancedCodeuses private contiguous-interval rows; its uniform native certificate takes the shared input arity in binary and the complete operator, fallback and leaf codes. The derived bound counts every row, argument/output wire and framing level, and holds even for malformed raw codes. No fixed arity, per-parameter finite-type shortcut or assumed runtime bound is used.Tests check exact three/five-leaf topology, unequal/repeated blocks, empty and singleton cases, zero-output dead gates, width zero, huge binary arity, axiom guards, and an actual carry-save consumer whose width and leaf count both grow. The generic gate bound lives beside
Circuit.balanced. Public API is the constructor and its two main theorems; helper declarations are private, and only the constructor body is exposed.Validation at
07e13cd8156248678bb5a1cd6c6c55c93f0615fd: all six default gates pass, global hygiene passes, changed-file--check-simppasses, catalogue validation selects the unchanged 12 abstracts/16 headlines, andgit diff --checkpasses. No abstract statements, scope or rendering change; no new PDF review is needed. The tests and module documentation are ready for guide reuse once #585 infrastructure lands.Closes #543. This completes the balanced-construction prerequisite; the actual shallow-decryption circuit, its generator, parameter fit and broader FHE endpoint remain #528/#486. The prior unpublished checkpoint and its author/reviewer credit remain recorded in the issue handoff; its source was unavailable here and was not recovered or reused.
AI-assisted implementation and self-review: OpenAI Codex,
codex-worker-balanced-01a16ab8. Requires independent cross-fleet API/correctness review; no author approval or merge.