Repository navigation
refactor(Circuit): share wire-order locality of labelling rounds in Circuit/Local - #4998
SamuelSchlesinger wants to merge 1 commit into
Conversation
…ircuit/Local Moves `IsLocal` and its fixed-point lemmas (`iterate_succ`, `isFixed_iterate`, `iterate_eq_of_isFixed`, `eq_of_isFixed`) from HalfGates to the new leaf module `Computability/Circuit/Local.lean` (namespace `Cslib.Circuits`, names unchanged). FreeXOR drops its private copy (`IsLocal`, `iterate_congr`, `iterate_eq_of_isLocal`, `step_iterate`) and uses the shared lemmas. Garbling/Basic gains `isLocal_evalStep` from `IsOrdered` and derives `evaluate_eq_of_evalStep` from it instead of repeating the wire induction. Part of #4817 (F10).
|
Agent review (Jetski reviewer dhrev-1, session 0d63ccac-4689-448c-8372-96935846ef6e), head a381c64: APPROVE (queue once CI is green) This is a clean extraction, and it doesn't change any statement.
Non-blocking (don't push for these):
Before queueing I'll confirm that Limits: I reviewed the source diff and grepped the head. I didn't build locally; I'm relying on the author's targeted builds of all importers and tests and the hosted CI run. This is an agent review, not a human review. |
|
Agent review (Jetski reviewer dhrev-1, session 0d63ccac-4689-448c-8372-96935846ef6e), head a381c64: rendered-manual check per the coordinator rule, verdict unchanged (APPROVE). Rendered: inspected p. 486 of cslib-frontier-operators-manual.pdf from run 43371654001: OK. The HalfGates paragraph ("…because the round is local ( Agent Operator's Manual: no edit needed. The PR changes no agent workflow, tooling or validation step. |
Change
Part of #4817 (facts lane F10). Jetski session facts-encoding (helper of facts 0e8cfb07), branch
readability/facts-circuit-local, one commit onmain. This is infrastructure and deduplication; no new mathematics.Three garbling modules each proved the same thing: a round is local when each wire's new label depends only on lower-numbered wires, and
n + slocal rounds reach the round's unique fixed labelling. HalfGates had a publicIsLocalwith fixed-point lemmas. FreeXOR had a private copy (IsLocal,iterate_congr,iterate_eq_of_isLocal,step_iterate). Garbling/Basic repeated the wire induction inline inevaluate_eq_of_evalStep.CslibFrontier/Computability/Circuit/Local.lean(namespaceCslib.Circuits,-- upstream: candidate). It holdsIsLocaland the HalfGates lemmasIsLocal.iterate_succ,.isFixed_iterate,.iterate_eq_of_isFixedand.eq_of_isFixed, with names and statements unchanged; the value type is generalized fromTypetoType*. It imports onlyCircuit.WireNumber, so adding it causes little rebuild fan-out.isFixed_iterateanditerate_eq_of_isFixed.isLocal_evalStep(an ordered topology makes an evaluation round local).evaluate_eq_of_evalStepis now three lines: locality plusiterate_eq_of_isFixed. It used to be a 22-line induction with its ownharg/hgateargument-congruence plumbing.The representative caller is
Garbling.evaluate_eq_of_evalStep, which, with its clientsGarbled.run_garbleWithand Garbling/Privacy, no longer repeats the induction. FreeXOR'sisLocal_evalStep/isLocal_propagateStepand HalfGates'isLocal_evalStepstay separate because the three schemes have differentevalStepdefinitions. Each is a short congruence proof and the only scheme-specific part.Net: 6 files, +119/−109. The new module is 89 lines including its docs; the existing files lose 109 lines and gain 30.
Manual impact
IsLocal.iterate_eq_of_isFixedto Circuit/Local.lean and says the point-and-permute and Free-XOR evaluators use it too.Validation
a381c6495,lake build --wfail --iofailpasses for Circuit.Local, Garbling.{Basic, FreeXOR, HalfGates, HalfGates.Privacy, Privacy}, MPC.Yao and the testsCslibFrontierTests.Crypto.{FreeXOR, GarblingScheme, HalfGates, Garbling, GarblingSwitch, Yao}. Together these cover every importer of the changed modules.lake lintpasses on the five changed or new library modules. Source hygiene (--check-simp), the source-only changed-file lints, both ratchets,lake exe mk_all --checkand the manual checker (errors []) all pass.guide/has no references.AI assistance
Written by an AI agent (Jetski, swarm worker
facts-encoding) under the direction of Samuel Schlesinger: it moved the lemmas, migrated the clients, wrote the manual sentence and ran the checks. No human has reviewed this PR yet.