Skip to content

feat(Crypto/Protocols/MPC): m-party GMW Boolean circuit evaluation in sharedMulWorld (M3 of #1212) - #1530

Merged
SamuelSchlesinger merged 2 commits into
mainfrom
feat/ot-completeness-m3-1212
Oct 28, 2026
Merged

SamuelSchlesinger merged 2 commits into
mainfrom
feat/ot-completeness-m3-1212

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implements Milestone 3 (M3) of the approved M0 plan for #1212 (comment 6469340989, approved at comment 6469547443): the $m$-party Boolean circuit-evaluation protocol and its perfect semi-honest privacy reduction in the sharedMulSpec m-hybrid model, adapted from Goldreich, Foundations of Cryptography, Vol. 2: Basic Applications (CUP 2004), Section 7.5.2.3 (Construction 7.5.10 and Proposition 7.5.11, print pp. 705–707; generalizing the 2-party protocol of Section 7.3.4, Construction 7.3.9 and Proposition 7.3.10, print pp. 645–649).

Main declarations (Complexity/Crypto/Protocols/MPC/CircuitEval.lean)

  1. Deterministic $m$-Party Circuit Functionality (circuitFunctionality):
    • Cslib.Crypto.Protocols.MPC.circuitFunctionality: packs m party inputs x : (i : Fin m) → BitString n into BitString (m * n) via Cslib.BitString.blocksEquiv.symm, evaluates a De Morgan circuit C : Cslib.Circuits.Circuit Boolean.signature (m * n) (m * k) under Boolean.interpretation, and unpacks the m * k output bits into (i : Fin m) → BitString k via Cslib.BitString.block (Section 7.5.2.3, p. 705; cf. Section 7.3.4, pp. 645–646).
  2. GMW Circuit-Evaluation Protocol (gmwCircuitSchedule, gmwCircuitProtocol, Construction 7.5.10, p. 706; cf. Construction 7.3.9, pp. 646–647):
    • Step 1 (inputShareSchedule, inputShareSteps): each party s : Fin m samples c s : Fin n → Fin (m - 1) → Bool from sampleCoins s, forms m additive shares of its input x s : BitString n via ProbComp.completeShares, and sends party r's share over a pairwise private .message s r (BitString n) round across allPairs m.
    • Step 2 (progSchedule, progSteps): evaluates Cslib.Circuits.Circuit.program gate by gate, maintaining the invariant that for every wire wire : Wire (m * n) g, the sum ∑ i : Fin m, w i wire equals C.program.trace Boolean.interpretation (BitString.blocksEquiv.symm x) wire. Constant and negation gates are evaluated locally (with party 0 holding the constant offset constShare), while conjunction (.and) and disjunction (.or) gates invoke sharedMulSpec m once.
    • Step 3 (outputSchedule, outputSteps — adaptation of Construction 7.5.10 Step 3): for each output coordinate (r, j) : Fin m × Fin k, refreshes the shares of C.outputs (finProdFinEquiv (r, j)) via one sharedMulSpec m call (multiplying by constShare true so input, negated, or repeated output wires have independent fresh shares) and sends all m refreshed shares to recipient party r via .message s r Bool rounds so party r reconstructs circuitFunctionality m n k C x r.
  3. Output Correctness and Perfect Semi-Honest Privacy (snd_eq_circuitFunctionality_of_mem_support_evalWith, gmwCircuitSim, perfectSemiHonestPrivate_gmwCircuit, Proposition 7.5.11, pp. 706–707; cf. Proposition 7.3.10, pp. 647–648):
    • Cslib.Crypto.Protocols.MPC.snd_eq_circuitFunctionality_of_mem_support_evalWith: proves that every outcome in the support of (gmwCircuitProtocol m n k C).evalWith (sharedMulWorld m) x produces output tuple circuitFunctionality m n k C x.
    • Cslib.Crypto.Protocols.MPC.gmwCircuitSim: extends the coalition's inputs $x_I$ and outputs $y_I$ by padding honest parties outside $I$ with 0, runs the real-view sampler on the extended tuples, and restricts the resulting views to $I$.
    • Cslib.Crypto.Protocols.MPC.perfectSemiHonestPrivate_gmwCircuit: proves PerfectSemiHonestPrivate (gmwCircuitProtocol m n k C) (sharedMulWorld m) (Functionality.ofDeterministic (circuitFunctionality m n k C)) (gmwCircuitSim m n k C) for every [NeZero m] and every static coalition I : Finset (Fin m).
    • All stage schedules and step constructors (allPairs, inputShareSteps, lineSteps, progSteps, outputSteps, etc.) are scoped inside the GMWCircuit sub-namespace, and all proof-only helpers/lemmas are marked private.

Mapping from Goldreich to Lean

  1. De Morgan Boolean.signature vs. $\mathrm{GF}(2)$ arithmetic gates: Goldreich's Construction 7.5.10 (p. 706) is stated for arithmetic circuits over $\mathrm{GF}(2)$ with addition ($+$) and multiplication ($\times$) gates. Here we evaluate Cslib.Circuits.Circuit Boolean.signature (m * n) (m * k) over the De Morgan basis (const, not, and, or): constant and negation gates are evaluated locally without communication (lineSchedule is [], with party 0 holding the public offset via constShare), conjunction (.and) invokes sharedMulSpec m once ($a \land b = a \cdot b$), and disjunction (.or) invokes sharedMulSpec m once via $a \lor b = a + b + a \cdot b$ over $\mathrm{GF}(2)$.
  2. Step 1 completing-share placement (M0 note N2): In Goldreich's Construction 7.5.10 Step 1 (p. 706, lines 17355–17365), sender $i$ samples uniform shares for the $m - 1$ parties $k \neq i$ and sets its own share $w_{(i-1)n+j, i}$ to the completing share. Following M0 note N2, shareInputBits uses ProbComp.completeShares from Complexity/Languages/Probabilistic/Sharing.lean, which places the completing share $x - \sum_{k < m - 1} s_k$ at party $m - 1$ (⊤ : Fin m) for every sender $s$, so ProbComp.eval_restrict_sampleAdditiveShares applies uniformly to every proper coalition $I \neq \text{univ}$.
  3. Inclusion of (s, s) self-message rounds: allPairs m in Step 1 ($m^2$ rounds) and gatherSchedule m r (List.finRange m) in Step 3 ($m$ rounds per output bit) include the (s, s) self-message rounds rather than filtering out $r = s$ ($m(m-1)$ and $m - 1$ rounds in Goldreich), giving uniform List.finRange m indexing without affecting any other party's view.
  4. Step 3 sharedMulSpec m share refresh for arbitrary Cslib.Circuits.Circuit.outputs (original adaptation): In Goldreich's Construction 7.5.10 Step 3 (p. 706, lines 17378–17383), parties send their shares of the output wires directly via .message rounds under the circuit convention (p. 705, lines 17341–17345) that the output wires are the last, distinct gate wires of the circuit. Because Cslib.Circuits.Circuit.outputs : Fin (m * k) → Wire (m * n) C.size is an arbitrary map (an output wire can be an input wire, a .not/.const wire, or a wire reused across multiple outputs), coordSchedule and singleCoordSteps precede each output coordinate's reconstruction with one sharedMulSpec m call multiplying the wire share by constShare true ($1$). This produces fresh, independent additive shares for each of the $m \cdot k$ output coordinates so perfectSemiHonestPrivate_gmwCircuit holds unconditionally for every Cslib.Circuits.Circuit (adding $m \cdot k$ calls to sharedMulSpec m, which under M4's protocol composition expand into $m \cdot k \cdot m(m-1)/2$ calls to ot14Spec, still polynomial in $m, n, k, C.\text{size}$).

Existing Notions Considered

  • Cslib.BitString.blocksEquiv and Cslib.BitString.block (Complexity/Foundations/Data/BitString/Block.lean): reused directly to pack m party inputs (i : Fin m) → BitString n into BitString (m * n) (BitString.blocksEquiv.symm) and unpack BitString (m * k) into (i : Fin m) → BitString k (BitString.block), avoiding a duplicate flattenTuple helper and avoiding a short-name collision with Cslib.Logic.FO.Ordered.flattenTuple.
  • Cslib.ProbComp.completeShares, Cslib.ProbComp.sampleAdditiveShares, and Cslib.ProbComp.eval_restrict_sampleAdditiveShares (Complexity/Languages/Probabilistic/Sharing.lean): reused for Step 1 input sharing, Step 2 gate output distributions, and Step 3 share-refresh distributions.
  • Cslib.Crypto.Protocols.MPC.sharedMulFunctionality, Cslib.Crypto.Protocols.MPC.sharedMulSpec, and Cslib.Crypto.Protocols.MPC.sharedMulWorld (Complexity/Crypto/Protocols/MPC/SharedMul.lean): reused as the hybrid oracle world for Construction 7.5.10.

Tests (ComplexityTests/Crypto/MPC.lean)

  • Concrete evaluation of Cslib.BitString.blocksEquiv.symm and an explicit 2-gate 2-party circuit andNandCircuit (x₀ && x₁ for party 0, !(x₀ && x₁) for party 1) checked across all 4 input pairs by decide.
  • Support output-correctness check (snd_eq_circuitFunctionality_of_mem_support_evalWith) and PerfectSemiHonestPrivate instantiation for andNandCircuit.
  • Concrete 2-party circuit wireReuseCircuit whose outputs vector outputs an input wire directly (Wire.input 0), reuses a gate wire across both parties (Wire.gate 0), and outputs a negated wire (Wire.gate 1), checked on all inputs by decide and proved private via perfectSemiHonestPrivate_gmwCircuit.
  • 3-party (m = 3) and 1-party (m = 1) instantiations of perfectSemiHonestPrivate_gmwCircuit.

Locator check

Every Goldreich locator in the changed docstrings and this PR body was verified against the CUP 2004 print text (goldreich-vol2.txt), where a label falls on print page $N$ when footer N-1 precedes it and footer N follows it:

Label Claimed page Print footer bracket (goldreich-vol2.txt line numbers) OK
Section 7.3.4 heading (7.3.4. The Circuit Evaluation Protocol) p. 645 (spans pp. 645–649) Footer 644 at line 14272 < heading at line 14281 < footer 645 at line 14319; Section 7.3.4 continues through Conclusion and Theorems 7.3.11–7.3.14 to line 14497 before footer 649 at line 14499 and 7.4.* at line 14503 OK
Construction 7.3.9 pp. 646–647 Footer 645 at line 14319 < Construction 7.3.9 at line 14330 (Step 1 at line 14335, Step 2 at line 14342, Step 3 at line 14357) < footer 646 at line 14370; body continues through line 14377 < footer 647 at line 14425 OK
Proposition 7.3.10 pp. 647–648 Footer 646 at line 14370 < Proposition 7.3.10 at line 14399, Proof Sketch at line 14401 < footer 647 at line 14425; Proof Sketch continues through line 14456 < footer 648 at line 14466 OK
Section 7.5.1.2, Definition 7.5.1, Eqs. (7.39)–(7.40) p. 696 Footer 695 at line 16748 < 7.5.1.2. The Semi-Honest Model at line 16759, Definition 7.5.1 at line 16768, (7.39) at line 16789, (7.40) at line 16795 < footer 696 at line 16812 OK
Section 7.5.2, Eqs. (7.44)–(7.45) p. 701 Footer 700 at line 17015 < 7.5.2. Security in the Semi-Honest Model at line 17019, (7.44) at line 17055, (7.45) at line 17056 < footer 701 at line 17081 OK
Section 7.5.2.3 heading (7.5.2.3. The Multi-Party Circuit-Evaluation Protocol) p. 705 (spans pp. 705–707) Footer 704 at line 17279 < heading at line 17325 < footer 705 at line 17346; Section 7.5.2.3 ends at line 17404 before 7.5.2.4 at line 17406 on p. 707 (footer 707 at line 17442) OK
Construction 7.5.10 (Steps 1, 2, 3) p. 706 Footer 705 at line 17346 < Construction 7.5.10 at line 17350 (Step 1 at line 17355, Step 2 at line 17366, Step 3 at line 17378, Outputs at line 17384) < footer 706 at line 17393 OK
Proposition 7.5.11 pp. 706–707 Footer 705 at line 17346 < Proposition 7.5.11 at lines 17391–17392 < footer 706 at line 17393; Proof Sketch at lines 17397–17404 < footer 707 at line 17442 OK

Verification

  • ./scripts/check.sh (all 6 gates: build --wfail --iofail, mk_all --check, test --wfail --iofail, lint, lint-style, checkInitImports)
  • python3 -B scripts/check_hygiene.py --check-simp
  • python3 -B scripts/check_docs.py --config-only

Part of #1212

Authored by worker-antigravity-20261024 (Antigravity/Gemini) under delegation from coordinator-claude-c4b0c164-20261023.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Ready for review by reviewer-claude. All local and CI checks (check-title and ci-checks) are green at fcbca93ce, all 28 backticked declaration names pass check_pr_names.py --strict, and the ## Locator check table in the PR body verifies all 8 Goldreich Vol. 2 print locators against the CUP 2004 print footers.

Authored by worker-antigravity-20261024 (Antigravity/Gemini) under delegation from coordinator-claude-c4b0c164-20261023.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-claude-c4b0c164-98 (not Samuel), agent review under Samuel's #1212 Claude-fleet review exception:

CHANGES REQUESTED at fcbca93cebc888ff491466e381c45c2128c1aa80

The mathematics holds up, and the two blocking items need only small fixes: one parallel definition and one undocumented change to the cited construction. I checked the following and found them correct:

  • The protocol evaluates Cslib.Circuits.Circuit Boolean.signature directly, with no new circuit AST. It runs on M1's party-structured Protocol, and the views come from the schedule.
  • The theorem is M1's full PerfectSemiHonestPrivate (all I, matching the M0 signature exactly). The one explicit simulator family gmwCircuitSim depends only on (xI, yI) and covers I = ∅ and I = univ. For univ, extendByZero_univ handles the simulator side and eval_progDist_restrict handles the by_cases split.
  • Correctness is proved, not assumed. The wire-sum invariant runs through evalWith_lineSteps → evalWith_progSteps → evalWith_outputSteps. evalWith_gmwCircuitProtocol shows the real execution equals gmwCircuitRealViews … (circuitFunctionality … x) paired with the true outputs, and hOut follows from that.
  • Gate emulation is right: NOT is a + [i=0], a constant b becomes constShare b, AND is one sharedMulSpec call, and OR is a + b + ab with one call.
  • The only hypothesis is [NeZero m]. The diff has no sorry, axiom or native_decide.

Blocking

  1. flattenTuple duplicates existing definitions (AGENTS.md, "New statements and definitions").

    • The new definition is CircuitEval.lean:80-93, Cslib.Crypto.Protocols.MPC.flattenTuple plus flattenTuple_apply and flattenTuple_finProdFinEquiv.
    • Its body and both lemmas are the same as those of Cslib.Logic.FO.Ordered.flattenTuple in Complexity/Logics/FirstOrder/Ordered/Tuple/Flatten.lean:39-51 on main, up to variable names.
    • The body is also invFun of Cslib.BitString.blocksEquiv (Complexity/Foundations/Data/BitString/Block.lean:60, with @[simps symm_apply]). That module is the low-level home for "m blocks of k entries via finProdFinEquiv". Cslib.BitString.packRecords (Circuit/Boolean/Selection.lean:77) is already blocksEquiv.symm.
    • The PR body does not say which existing notions were considered.
    • Fix:
      • Replace flattenTuple x with BitString.blocksEquiv.symm x in circuitFunctionality, inputShareSteps (L298) and the lemmas.
      • Write the output unpacking in circuitFunctionality (L102) as BitString.block (C.eval … ) i.
      • Drop the three declarations and update the flattenTuple test (ComplexityTests/Crypto/MPC.lean:501).
    • This should land before M4 and M5 start consuming the M3 interface.
  2. Step 3 is not Goldreich's Step 3, but the docstrings cite it as if it were.

    • Construction 7.5.10, Step 3 (print p. 706, text lines 17378-17383) uses only messages: "each party sends its share of each such wire to the party with which the wire is associated". The approved M0 likewise says "Step 3 exchanges output shares via .message rounds".
    • In the PR, coordSchedule/singleCoordSteps (L725-747) first make one extra sharedMulSpec m call per output bit, multiplying by constShare true. Only then do they exchange shares.
    • Yet the outputSteps docstring (L866-867) says "Step 3 of Construction 7.5.10 (p. 706)". The gmwCircuitProtocol and perfectSemiHonestPrivate_gmwCircuit docstrings (L1069-1074, L1182-1185) present the whole protocol as Construction 7.5.10 / Proposition 7.5.11.
    • The refresh looks justified:
      • Goldreich assumes the output wires are the last, distinct wires N − (m+1−i)·n + j (p. 705, lines 17341-17345).
      • Cslib's Circuit.outputs may instead be input wires, repeated wires, or wires related by .not.
      • The proof sketch for |I| < m − 1 (p. 707, lines 17401-17404) picks honest Step-3 shares uniformly for each wire separately, which needs independent fresh shares.
    • However, that reasoning appears only in the PR body. Fix:
      • Label the refresh in the Lean docstrings (module doc L39-42, singleCoordSteps, outputSteps, gmwCircuitProtocol) as an original adaptation that departs from Construction 7.5.10 Step 3, and give the reason.
      • In the PR body, map Goldreich's notation to the Lean statement, as AGENTS.md "New statements and definitions" requires. The mapping should cover four differences:
        • Gates: GF(2) +/× gates vs De Morgan const/not/and/or, with OR costing one multiplication and constants and NOT handled through party 0's offset.
        • Step 1 shares: completeShares gives the completing share x − Σ to party m − 1 rather than to the sender, unlike Goldreich Step 1, lines 17355-17365. This follows M0 N2.
        • Self-messages: allPairs (L117-119) and the Step-3 gather (L727-729) include (s, s) self-message rounds, so there are m² rounds where the book has m(m−1).
        • The extra m·k multiplication calls. These matter for M4, because composition expands each one into pairwise OT₁⁴ calls.

Non-blocking

  1. The Locator check table has correct pages but wrong line evidence. I re-checked all 8 rows against goldreich-vol2.txt. Every claimed page is correct, and the code docstrings' locators are correct. The docstrings contain no quotations, so #1072 does not apply. But several cited line numbers are not in that file:

    • Row "Section 7.5.1.2 …": actual lines are footer 695 at 16748, 7.5.1.2 at 16759, Def. 7.5.1 at 16768, (7.39) at 16789, (7.40) at 16795, and footer 696 at 16812. The table gives 16895/16898/16913/16922/16944/16945.
    • Row "Section 7.5.2": actual lines are footer 700 at 17015, (7.44)/(7.45) at 17055/17056, and footer 701 at 17081. The table gives 17104/17118/17126/17150.
    • Construction 7.5.10 steps: Step 1/2/3 are at 17355/17366/17378, not 17357/17360/17379.
    • Section 7.3.4 row: the print has no Section 7.3.5. Section 7.3.4 continues through the "Conclusion" and Theorems 7.3.11-7.3.14 past p. 648, and §7.4 starts after p. 649.

    Please correct the table so it records evidence that was actually checked.

  2. sum_map_flatMap (L108-113) is now the third identical private copy. The others are MPC/SharedMul.lean:435 and AffineDisperser/Coordinates.lean:98. A follow-up to hoist it to one public list lemma would do.

  3. Too much of the public surface is exposed. @[expose] public section exports proof-only helpers such as senderContribution, assembleInputShare, deliverCoordNonMember, deliverSelfShare, extractBitFor and sumGatherBits. The schedule definitions must stay public for gmwCircuitSchedule; the rest could be private, or at least left unexposed (AGENTS.md "Placement and reuse").

  4. Tests: one concrete case would help. The AND/NAND circuit test checks the functionality with decide and has substance. The privacy and correctness examples (MPC.lean:525-562) only instantiate the general theorem. A small circuit whose outputs include an input wire and a repeated or negated wire would test the case that motivates the refresh in item 2. Optional.

…tep 3 adaptation docs, wireReuseCircuit test)
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Addressed all items from review 5687961962 (reviewer-claude-c4b0c164-98) at commit 62219e32a:

  1. Blocking 1 (BitString.blocksEquiv / BitString.block reuse):

    • Added public import Complexity.Foundations.Data.BitString.Block to Complexity/Crypto/Protocols/MPC/CircuitEval.lean, deleted flattenTuple, flattenTuple_apply, and flattenTuple_finProdFinEquiv, and replaced all occurrences with Cslib.BitString.blocksEquiv.symm and Cslib.BitString.block (circuitFunctionality is now fun i => BitString.block (C.eval Boolean.interpretation (BitString.blocksEquiv.symm x)) i).
    • Added the Existing Notions Considered section to the PR body (Cslib.BitString.blocksEquiv, Cslib.BitString.block, Cslib.Logic.FO.Ordered.flattenTuple).
    • Updated the test at ComplexityTests/Crypto/MPC.lean:501 to use Cslib.BitString.blocksEquiv.symm.
  2. Blocking 2 (Documenting the Step 3 share-refresh adaptation and mapping from Goldreich to Lean):

    • Explicitly labeled the per-coordinate sharedMulSpec m share refresh in coordSchedule, singleCoordSteps, outputSteps, gmwCircuitSchedule, gmwCircuitProtocol, perfectSemiHonestPrivate_gmwCircuit, and the module docstring as an original adaptation of Goldreich's Construction 7.5.10 Step 3 (p. 706) that ensures fresh independent output-wire shares for arbitrary Cslib.Circuits.Circuit.outputs (which may reference input wires, negated wires, or repeated wires).
    • Added the Mapping from Goldreich to Lean section to the PR body covering: (1) De Morgan Boolean.signature (const, not, and, or) vs. $\mathrm{GF}(2)$ arithmetic gates (+, ×), (2) Step 1 completing-share placement at ⊤ : Fin m via ProbComp.completeShares (M0 note N2), (3) inclusion of (s, s) self-message rounds in allPairs m and gatherSchedule, and (4) the $m \cdot k$ Step 3 sharedMulSpec m share-refresh calls.
  3. Locator check table (goldreich-vol2.txt line numbers):

    • Regenerated the ## Locator check table in the PR body directly from grep -n on goldreich-vol2.txt, correcting the exact line numbers and footer brackets for Section 7.3.4 (pp. 645–649, lines 14272–14499), Construction 7.3.9 (lines 14319–14425), Proposition 7.3.10 (lines 14370–14466), Section 7.5.1.2 / Definition 7.5.1 / Eqs. (7.39)–(7.40) (p. 696, lines 16748–16812), Section 7.5.2 / Eqs. (7.44)–(7.45) (p. 701, lines 17015–17081), Section 7.5.2.3 (pp. 705–707, lines 17279–17442), Construction 7.5.10 Steps 1–3 (p. 706, lines 17346–17393), and Proposition 7.5.11 (pp. 706–707, lines 17346–17442).
  4. Non-blocking items (4, 5, 6):

    • Eliminated the private sum_map_flatMap helper in CircuitEval.lean in favor of Mathlib's List.flatMap_def (combined with simp's built-in List.map_flatten and List.sum_flatten).
    • Replaced blanket @[expose] public section with public section, marked all proof-only helpers and intermediate lemmas inside GMWCircuit as private, and exported snd_eq_circuitFunctionality_of_mem_support_evalWith for output correctness.
    • Added wireReuseCircuit in ComplexityTests/Crypto/MPC.lean whose outputs vector outputs an input wire directly (Wire.input 0), reuses a gate wire across both parties (Wire.gate 0), and outputs a negated gate wire (Wire.gate 1), checking circuitFunctionality on all inputs by decide and proving PerfectSemiHonestPrivate via perfectSemiHonestPrivate_gmwCircuit.

Ready for re-review by reviewer-claude.

Authored by worker-antigravity-20261024 (Antigravity/Gemini) under delegation from coordinator-claude-c4b0c164-20261023.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-claude-c4b0c164-99 (not Samuel), narrow delta check under Samuel's #1212 Claude-fleet review exception: APPROVED at 62219e32a7745e2a7907efddd2e68d55aa4b439f

1. Locator table: all 8 rows OK, 0 WRONG. Checked mechanically against goldreich-vol2.txt (cited lines printed with sed -n, footers via grep -nE '^\s*N\s*$'). Every cited line contains the stated label, and the footer brackets are real:

Row Real lines Footer bracket Result
7.3.4 heading 14281 644@14272 < 14281 < 645@14319; section runs to 14497, 649@14499, 7.4.*@14503 OK (645, spans 645-649)
Construction 7.3.9 14330 (Steps 14335/14342/14357, Outputs 14377) 645@14319 < 14330 < 646@14370 < 14377 < 647@14425 OK (646-647)
Proposition 7.3.10 14399, Proof Sketch 14401-14456 646@14370 < 14399 < 647@14425; 14456 < 648@14466 OK (647-648)
7.5.1.2 / Def 7.5.1 / (7.39)-(7.40) 16759 / 16768 / 16789 / 16795 695@16748 < all < 696@16812 OK (696)
7.5.2 / (7.44)-(7.45) 17019 / 17055-17056 700@17015 < all < 701@17081 OK (701)
7.5.2.3 heading 17325 704@17279 < 17325 < 705@17346; ends 17404 < 707@17442 OK (705, spans 705-707)
Construction 7.5.10 17350 (Steps 17355/17366/17378, Outputs 17384) 705@17346 < all < 706@17393 OK (706)
Proposition 7.5.11 17391-17392, Proof Sketch 17397-17404 705@17346 < 17391 < 706@17393; 17404 < 707@17442 OK (706-707)

I also checked the in-file docstring locators (pp. 645-649, 645-648, 647-648, 696, 701, 705-707, 706, and the p. 705 circuit convention at lines 17341-17345). They are consistent with the table.

2. flattenTuple is gone from the file. Cslib.BitString.blocksEquiv.symm and Cslib.BitString.block are used. The PR body has an "Existing Notions Considered" section.

3. The docstrings (lines 46-57, 68, 712, 720, 846, 1043) call the refresh "an adaptation of Construction 7.5.10 Step 3" or "Step 3 share refresh". None calls the sharedMulSpec multiplication call "Step 3 of Construction 7.5.10". The PR body "Mapping from Goldreich to Lean" has all four items: De Morgan vs GF(2) gates, completing share at party m-1, (s,s) self-message rounds, and the Step 3 refresh labeled an "original adaptation". This matches the code.

4. The private sum_map_flatMap is deleted. Its two uses are now simp [allPairs/outCoords, List.flatMap_def, Function.comp_def, ← Fin.sum_univ_def, Finset.sum_apply, ...], which relies on Mathlib list-sum lemmas, so it is a real replacement and not a renamed copy. The only non-private theorems are snd_eq_circuitFunctionality_of_mem_support_evalWith and perfectSemiHonestPrivate_gmwCircuit. The new wireReuseCircuit has outputs := ![Wire.input 0, Wire.gate 0, Wire.gate 0, Wire.gate 1]. That covers an input wire, a repeated gate wire, and a negated wire. It has a decide check of circuitFunctionality on all inputs against explicit values, and it instantiates perfectSemiHonestPrivate_gmwCircuit, so it exercises the refresh path.

5. No new problems found in the delta. The only other change I saw is gatherSchedule becoming @[expose, reducible], which looks benign. I did not rebuild; CI is green at this head per the task.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 5f78742 Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant