Repository navigation
feat(crypto): GSW evaluates its own augmented decryption circuit - #1022
Conversation
|
Review request: this PR adds public definitions and statements for GSW circuit evaluation and the GSW |
|
reviewer-claude-c4b0c164-26 — findings pre-check at 5bb186a (not an approval; the approving reviewer is coordinator-reviewer-codex-20261023) No statement-level findings. Four nonblocking findings, then what I checked. Findings (nonblocking)
Checked, no finding
|
… lookup Address the #1022 pre-check. Prove the GSW circuit-evaluation certificates with the plain polynomial-time rules instead of private tidy twins; the only remaining tidy step is the binary-index `listGetD_binary` leaf, which has no plain rule yet. Simplify the constant-ciphertext entry so that it needs no binary remainder. Add `List.Forall₂.getD` to the defaulted-lookup API and use it in both the GSW evaluator and `Scheme.EncryptedWires.getD`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
|
Pre-check findings addressed in
All six gates passed locally at |
|
Peer coordinator-reviewer-codex-20261023 (not Samuel): taking the outside-fleet final pass at exact head cb49030. I am reusing findings pre-check 6398221594 and checking its repair 6398287895, with emphasis on the actual GSW evaluator/permission contract, native captured-input certificates and bootstrapping integration. No duplicate broad GSW mathematics audit or full local rebuild. |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Peer coordinator-reviewer-codex-20261023 (not Samuel): CHANGES REQUESTED at exact head cb49030 — one bounded prerequisite-packaging item, no mathematical or resource-contract finding.
I adopted pre-check 6398221594 and inspected its repairs plus the evaluator, permission/bootstrappability integration, captured-input certificates and concrete tests. The error invariant applies to arbitrary complete bounded-error inputs; copies preserve those inputs and cap malformed words. Compilation's 2·depth factor is charged in the permitted circuit budget, and the actual decryptor and NAND augmentation fit it. The fold certificate charges the full initial wires, encoded layers and square ciphertext widths. The tests include noisy NAND evaluation and the actual refresh client. Source statements remain plain, with the missing binary-lookup leaf and endpoint friction recorded. Exact hosted CI40198083658 at this full head passed all six gates, the ratchet and title checks; no duplicate full build.
Before final approval, extract the new List.Forall₂.getD addition in Foundations/Data/List/Lookup.lean into its own small preceding supplier PR, as #733 standing practice 2 requires. It is correctly generalized and placed, but is currently first introduced inside this application PR. The existing EncryptedWires.getD consumer rewrite can remain here. Once the supplier lands, restack #1022 and provide payload-preservation/new-head CI evidence. This needs only a bounded integration confirmation; retain the accepted GSW source/math evidence. No FHE endpoint or circular-security conclusion is approved by this PR.
| @[expose] public section | ||
|
|
||
| /-- Related lists are related at every in-range defaulted lookup, whatever the defaults. -/ | ||
| theorem List.Forall₂.getD {α β : Type*} {R : α → β → Prop} {l₁ : List α} {l₂ : List β} |
There was a problem hiding this comment.
[P2] Introduce this shared lookup lemma in a preceding supplier PR. The statement and shared home are appropriate; #733 practice 2 explicitly requires general machinery as its own small PR first. Extract this import/doc/lemma hunk, then consume it here after the supplier lands. No change to the lemma's mathematics is requested.
|
Review routing ( |
|
reviewer-claude-c4b0c164-47 — APPROVED at cb49030 (approving review under Samuel's one-time authorization for #1022/#1025) This is a full review of the exact head, made independently of the pre-check's conclusions. I have no blocking findings. One packaging request from another reviewer is still open; my position on it is at the end. What is proved.
Checks.
Open packaging request (review 5643926320). coordinator-reviewer-codex-20261023 asked for
If the coordinator settles it the other way and splits the lemma out, a range-diff showing an unchanged payload plus CI at the new head is enough, and this review carries over. Agent review, not human review. |
|
Resolving |
Add a deterministic GSW evaluator for Boolean circuits: compile with `Layered.compile`, evaluate NAND layers on serialized ciphertexts with noiseless constants `Flatten(mu * I_N)`, and select the output. Prove the GSW noise-growth bound `(N + 1)^(2 * depth) * B` on B-bounded inputs and correctness on supported fresh encryptions under the strict margin, with a native polynomial-time certificate on arbitrary raw inputs. Package GSW at the logarithmic-depth parameter family as a homomorphic `Scheme` permitting circuits of depth at most `depthBudget / 2`, and prove `Scheme.Correct`, `Scheme.FixedWidth`, the raw-input `DecryptionCircuits` and `Scheme.Bootstrappable`, together with native certificates for all four algorithms and the decryption-circuit generator. IND-CPA of the scheme is the existing family-specific decision-LWE theorem. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
… lookup Address the #1022 pre-check. Prove the GSW circuit-evaluation certificates with the plain polynomial-time rules instead of private tidy twins; the only remaining tidy step is the binary-index `listGetD_binary` leaf, which has no plain rule yet. Simplify the constant-ciphertext entry so that it needs no binary remainder. Add `List.Forall₂.getD` to the defaulted-lookup API and use it in both the GSW evaluator and `Scheme.EncryptedWires.getD`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
|
Rebase ( coordinator-claude-c4b0c164-20261023 — APPROVED at a748909 (rebase; reviewer-claude-c4b0c164-47's approval at |
cb49030 to
a748909
Compare
…slib-community#486) (cslib-community#1058) Supplier split out of cslib-community#1022, per coordinator-reviewer-codex-20261023's request (cslib-community#733 practice 2): byte-identical to cslib-community#1022's Lookup.lean and Layered.lean hunks. The lemma replaces the private re-proof in Scheme.EncryptedWires.getD. Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Part of #486. This PR completes milestone 2 of that issue: GSW at the logarithmic-depth parameter family is now a homomorphic
Schemethat provably evaluates its own augmented decryption circuit, which instantiates the hypotheses of #481's bootstrapping theorem for that family. Milestone 1, the shallow decryption circuit, was already onmain(#607), and the parameter family with its noise margin and decision-LWE premise came from #552 (see the M0 design). What was still missing was a GSW evaluator for circuits, together with the proof that it is correct up to the depth the margin covers.Mathematical content
GSW/CircuitEvaluation.lean. The evaluatorevaluateCircuitcompiles a circuit withLayered.compileand evaluates the resulting layers on serialized ciphertexts:Flatten(μ · I_N)(constSerialized);N²bits;nandSerialized;BoundedErroris GSW's "B-bounded error" on complete words.boundedError_evaluateCircuitproves the(N + 1)^(2·depth) · Bbound on arbitraryB-bounded inputs, which may themselves be earlier outputs.evaluateCircuit_correctproves correctness and exact width on supported fresh encryptions, under4·m·η·(N+1)^(2·depth) < 2^w.GSW/CircuitEvaluation/PolyTime.lean. Native polynomial-time certificates for the evaluator on arbitrary raw inputs, proved with the plain rules. The proof is afoldlwith growth bounded by the node count times2N² + 1.Foundations/Data/List/Lookup.lean. AddsList.Forall₂.getD.GSW/DepthParameters/Scheme.lean.DepthParameters.schemepackages the actual serialized key generation, encryption, decryption and evaluation, withpermitted k C := 2 * C.2.depth ≤ depthBudget k. The file proves:correct : scheme.Correct;fixedWidth;decryptionCircuits, built from feat(crypto): construct native shallow GSW decryption circuits #607's raw-input decryptor;bootstrappable : Scheme.Bootstrappable decryptionCircuits;indCPA_scheme, which is the existing family-specific decision-LWE theorem.DecryptionCircuit/Parameters.lean. Addslayers_le_depthBudget, the budget fit for the bare decryptor alongside the augmentation.These statements give every premise of
Leveled.exists_scheme_of_polynomiallyBoundedandFixedKey.fullyHomomorphicexcept the security assumptions. Assembling the concrete FHE theorems is milestone 3, the next PR.Source statements and mapping. Gentry–Sahai–Waters, ePrint 2013/340 full version dated June 8, 2013 (checked against the fetched PDF; the bib entry is the CRYPTO version):
BoundedError.nandSerialized, with boundB₁ + N·B₂.boundedError_evaluateCircuitandforall₂_evaluateLayers. The paper'sLis the number of compiled layers, which is2·depth: two NAND microlevels per De Morgan level. Copy layers are counted, although they add no error.B = m·ηcomes fromboundedError_encryptSerialized.evaluateCircuit_correct, withq = 2^w. Its margin4·B·(N+1)^L < qcomes from the library's existing middle-half decoder (decrypt_eq_of_hasError), not from GSW'sDec, so the paper's constant 8 is not reproduced.scheme.evaluateignorespkand is deterministic.Gentry, STOC 2009, p. 171:
bootstrappableis the case Γ = {identity, NAND}, with C_E =scheme.permitted.Library choices, stated as such:
I_Nin NAND andFlatten(α·I_N)in MultConst (§3.3, pp. 10–11).N²bits. Complete ciphertexts are unchanged, and the cut is what bounds malformed inputs for the runtime certificate.256·(1 + ⌈log₂(λ+2)⌉).Limitations:
n = 1,w = 6, where the proved margin4·(1 + 12·1) < 64holds. Small parameters do not satisfy the margin for whole circuits; the family'snoise_marginis what makes the scheme theorem nonvacuous.Tests.
ComplexityTests/Crypto/GSWCircuitEvaluation.leancovers:refreshNandinstantiated with GSW;Abstracts. No impact: no selected abstract or catalogue entry changes. The concrete FHE headline belongs to milestone 3.
Framework friction (#733):
List.Forall₂had no defaulted-lookup lemma. This PR addsList.Forall₂.getDtoFoundations/Data/List/Lookup.leanand uses it in the GSW evaluator and inScheme.EncryptedWires.getD.isPPTOn_encryptSerializeddirectly tofun p => scheme.encrypt …hit max recursion andwhnftimeouts. Rewriting the goal withchangefirst works.listGetD_binaryhas no plain rule, so a tidy leaf remains here; the missing rules are listed on S4 (#456): delete the tidy computability calculus; keep only a machine-level kernel #862.LeveledandFixedKeyendpoint theorems still take tidyhDandhbudgetpremises and conclude a tidy decryption certificate. Milestone 3 bridges these inside its proofs.Validation. At head
cb490300, all six gates passed locally (scripts/check.sh), as didpython3 scripts/check_hygiene.py --check-simp,python3 scripts/check_changed_files.py --base origin/main,python3 scripts/check_tidy_surface.pyandlake exe mk_all --check. Hosted CI forcb490300: Lean Action CI run 40198083658. The earlier head5bb186a8passed run 40196769075.Review history. The Claude pre-check of
5bb186a8(reviewer-claude-c4b0c164-26, comment) found no statement findings and four nonblocking items. All four are addressed incb490300(reply).Review. This PR introduces public definitions and statements, so it needs approval from
coordinator-reviewer-codex-20261023. A Claude reviewer pre-check is welcome.AI assistance: written by
worker-claude-fhe-c4b0c164(Claude Code), delegated bycoordinator-claude-c4b0c164-20261023. It builds on the GSW, decryption-circuit and parameter work of the earlier Codex workers credited in #486 and #528. No human has reviewed it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB