feat: even more general ring switch#615
Conversation
🤖 PR SummaryThis PR generalizes the ring-switching layer to decoupled packing and opening algebras, as documented in Flock (BRW26) and the internal note RSG. The core change is the introduction of the Generic ring-switching subdirectory ( Statistics
Lean Declarations ✏️ Added: 110 declaration(s)
📋 **Additional Analysis**The diff introduces a large new generic ring-switching layer, fixes a bug in BinaryBasefold, and updates documentation. Overall it follows the ArkLib style guide closely, but a few minor violations were found. 📄 **Per-File Summaries**
The addition details the seven-step spine every ring switch shares, the four safety pillars (coordinate maps derived from a bundled Newly described files and theorems include:
The documentation also notes that
Last updated: 2026-07-11 23:48 UTC. |
|
big next step will be the reduction & soundness. |
…rface
- Generic/Relations.lean: framework-fixed relation chain — openingClaimRel
anchor (+ non-vacuity witness), sliceRel, sumcheckClaimRel, and the proven
chain coherence sumcheckClaim_of_slices (via bridge_eqTilde); PackedCommitment
(commitsTo + functionality law + Nonempty guard; the legacy True-hook is
unstatable: commitsTo_not_top / commitsTo_ne_top); DenseMLPCS mirroring
MLIOPCS with relIn fixed to evalRel (= MLPEvalRelation AND commitsTo), so the
PCS's own completeness/RBR fields consume the binding predicate
- Data/Module/Basis.lean (new): reusable Basis.sum_smul_{bijective,injective};
Recombine.lean refactored onto it + openingDecomposition_injective (the
opening half of Flock Remark 5)
- Binius/FRIBinius/Prelude.lean: biniusCommitsTo (commitsTo orientation of the
legacy initialCompatibility, rfl-pinned); documents the pre-existing upstream
diagonal-coercion bug in firstOracleWitnessConsistencyProp (encoding reads
t's diagonal evaluations, so commitsTo functionality is unprovable until the
upstream spelling is fixed — recorded S7 gate)
- KB ring-switching page + repo-map updated; ArkLib.lean regenerated
All new declarations sorry-free and axiom-clean; RingSwitching sorry count
unchanged at 14; binaryTowerProfile untouched. Hardened via a 4-pass
independent adversarial close-review (structural Nonempty guard, precision
fixes, upstream bug confirmed by compiled probe and logged).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
firstOracleWitnessConsistencyProp, getMidCodewords, and the honest-witness lens in FRIBinius/CoreInteractionPhase built P0 from `fun w => t.val.eval w`, where the silent coercion Fin (2^l) -> (Fin l -> L) is the pointwise Nat-cast CONSTANT function — the "novel coefficients" were t's evaluations at diagonal points, not its hypercube table, making the encoding non-injective (X 0 and X 1 collapsed definitionally; compiled counterexample) and the predicate unusable as binding semantics (functionality provably false). Fix: new named encoder BinaryBasefold.witnessNovelCoeffs — t's cube table in the LSB-first Nat.getBit order, the exact inverse of the decoder's Nat.binaryFinMapToNat mapping (roundtrip: getBit_of_binaryFinMapToNat) — used at all three sites; a repo-wide sweep found no further instances. Compiled regression probe: witnessNovelCoeffs now separates X 0 / X 1. The biniusCommitsTo functionality proof (S7) is provable-as-sketched again. Pre-existing bug (predates this PR); all consumers are sorry-gated statements, so nothing proven was invalidated. Found by the S5 close-review adversarial passes. Docstrings and the KB page updated accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review finding: the R7 regression probe was verified in-session but never committed, so nothing in-tree would catch the diagonal-encoding bug regressing. Adds a generic-field example separating witnessNovelCoeffs (X 0) from (X 1) at omega = 1 - unprovable under the pre-fix diagonal spelling. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two plumbing lemmas for RBR-game factoring (generic ring-switch S6):
- probEvent_uniformSample_eq_pr_uniformOfFintype: Pr[E | $t C] equals
the PMF-level Pr_{c <-$p C}[E c]
- probEvent_bind_uniformSample_le: a per-prefix PMF bound transfers to
the bind (prefix; uniform challenge; pair) - the challenge-round shape
Both sorry-free and axiom-clean ([propext, Classical.choice, Quot.sound]).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Verifier.probEvent_challengeRound_le: bounds the RBR-game shape
(prefix; uniformly sampled challenge i; post-map) by any epsilon that
bounds the PMF-level bad-event probability for every fixed prefix
outcome - the bridge from simulateQ (impl.addLift challengeQueryImpl)
games to Pr_{c <- $p _} per-round analyses (BatchingStrategy.separates).
The prefix is an arbitrary OracleComp (no prover unfolding); the
post-map covers the games' (transcript, challenge, queryLog) triple.
Sorry-free, axiom-clean. Closes the bootstrapped 'medium' plumbing item;
the feared erw-chain reduced to one erw [simulateQ_query].
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… check (S6/F2) The design-review F2 algebra, all sorry-free and axiom-clean: - Packing.lean: generic unpack (coefficient-wise packBasis.repr) with the round-trip PROVEN both directions (packedMLE_unpack / unpack_packedMLE; packedMLE_surjective constructive) - CommRing-only, honoring the file's no-assumed-round-trip disclaimer - Relations.lean: claimConsistent (DP24 Check 1 in family form, the [BRW26] Remark-5 read-back equation) + both directions: openingClaimRel_of_claimConsistent (soundness read-back, [IsDomain E] - the logged S6 deviation) and claimConsistent_of_slices (completeness) - Data/MvPolynomial/Multilinear.lean: aeval_multilinear_eq_sum_eqTilde (eq-expansion of a multilinear at an algebra point; reusable) INV-2: exercised on tower, decoupled-toy (CommRing-only parts) and decoupled-field (domain-gated parts) carriers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…uction Generic/Reduction.lean: the ProtocolSpec 2 phase (prover sends slices, verifier sends batching challenge) written WITHOUT the composition operators, so every definition is sorry-free and axiom-clean (verified: standard 3 axioms on all 8 public decls) despite upstream OracleVerifier.append.verify being sorried. - Verifier performs the soundness-critical claim-consistency check (design review F1: without it the phase RBR statement is false), and fails via OptionT failure, not a dummy statement - phaseRelIn = openingClaimRel AND commitsTo (packedMLE wit) - the oracle-extended anchor promised at S5; phaseRelOut carries commitsTo through to the sumcheck claim - Per-round error VECTOR (bat.error at the single challenge round) - WitMid/extractor via unpack; RBR knowledge soundness recorded as a Prop-valued def (roadmap section 8, F3) pending the stretch proof - W := car.iE pinned; INV-2 examples on tower + decoupled-field carriers Also folds ChallengeRound.lean + Reduction.lean into the ArkLib.lean umbrella (283 imports). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…o first) ringSwitchPhase_rbrKnowledgeSound: the ring-switch phase is round-by-round knowledge sound with error bat.error at the batching-challenge round - the FIRST non-vacuous RBR probability bound completed in ArkLib (the three prior real ones are all sorried). - phaseKnowledgeStateFunction [IsDomain car.E]: round 1 tracks the Remark-5 check + binding + slice relation; round 2 re-tracks the check (the verifier fails without it), binding, and the batched claim; toFun_full cases on the verifier's definitional if and kills the failure branch by empty support - phase_badEvent_le: commitsTo_functional collapses the existential to the committed t'0; the surviving event is exactly BatchingStrategy.separates on the sent slices vs the honest slices of t'0 (via sumcheckClaim_of_slices); no-commitment branch has probability zero - Verifier.probEvent_rbrGame_le (Security/ChallengeRound.lean): the factoring lemma restated at the literal game shape - unifying the game's destructuring bind against the plain-bind lemma diverges in whnf (structure-eta through the prover term), so the same proof script is replayed with the matcher fired by one constructor-level obtain All axiom-clean ([propext, Classical.choice, Quot.sound]); zero sorry tokens; no maxHeartbeats override needed; whole library green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Independent adversarial close-review verdict: theorem holds up, 'repo first' claim accurate, no blockers. Adds its two suggested witnesses: phaseRelIn nonemptiness (true claims + trivial commitment - the RBR obligation is not discharged by an empty input relation) and an end-to-end application of ringSwitchPhase_rbrKnowledgeSound at decoupledFieldCarrier with the PROVEN gamma-powers strategy (real separation error 3/4). Honest caveats recorded in roadmap section 8: phase completeness deferred (next session), and the repo-wide RBR->knowledge-soundness implication remains sorried upstream. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Further generalization of the ring-switching abstraction based on discussion around https://github.com/leanEthereum/leanVM-b/blob/main/misc/ring-switching-generalized.pdf and Flock.
WIP, but should not be a huge PR once the generic layer (mostly in the current draft) is in place, binius and hachi (if the ring switching stage is reached before this is merged) will be ported accordingly.