Repository navigation
feat(Foundations): pilot and probabilistic column detectors for one hierarchy stage - #1696
Conversation
…transition matrices Pure linear algebra for the correction-and-copy hierarchy (cslib-community#1444 Phase 2, ideas 2 and 4 of cslib-community#474), following the OpenAI preprint (2026-09-23), Section 4: the factorization 1 - (C - E + EC) = (1 + E)(1 - C), the corrected inverse, copy splitting intertwined with its projection, and the reward transport identity with the stage error bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ly it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ward lower bound Review of cslib-community#1676: correction_mulVec_one_le only shows that row sums do not grow, so its docstring, the module summary and the test comment no longer call it substochasticity. Add rewardTransport_mulVec_nonneg, the lower half of (4.30), under nonnegative projections, corrections and reward. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Second slice of cslib-community#1444 Phase 2 (idea 3 of cslib-community#474), following the OpenAI preprint (2026-09-23), Lemma 4.1 and Lemma 4.4: the cutoff correction recursion E = phi((C + EC)) on a strictly upper triangular C has a unique fixed point, its iterates increase towards it, and after k iterations the error is at most f e^(1/theta) (L/theta)^k / k!, independently of the size of the matrix. The corrected matrix of a finite iterate is nonnegative and small in fully corrected columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review nit on cslib-community#1677: drop the private hockey-stick lemma. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of cslib-community#1677: the module docstring now bounds the chain count by m.choose k for the actual support size m, as the proof does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Third slice of cslib-community#1679 (Phase 2 of cslib-community#1444, ideas 3 and 4 of cslib-community#474), following the OpenAI preprint (2026-09-23), Lemma 4.2, Lemma 4.4 and Proposition 4.5: row-sum, entry, domination and support bounds for cutoff corrections; the copy step with explicit split fractions, its density and active-copy bounds; incidence counting; and the one-stage rates that feed the stage bound, given an abstract detector interface. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add cutoffCorrectionIter_isStrictUpperTriangular, cutoffCorrection_residual_isStrictUpperTriangular and copyStage_isStrictUpperTriangular (for the lexicographic order on Lex (V × Fin (m + 1))), so a stage's output can feed the next stage. Correct two descriptions: the pilot inputs have bounded row sums, not necessarily at most one, and copyStage_mulVec_one_le preserves the row-sum bound, with nonnegativity from copyStage_nonneg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…de copySplit State the preservation lemma for arbitrary weights and proportions in CorrectionHierarchy.lean, for the lexicographic order on Lex (V × ι), and derive copyStage_isStrictUpperTriangular from it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…istic column detectors Phase 2 slice 4 of cslib-community#1444 (tracked in cslib-community#1679): the pilot of Lemma 4.2 with step-dependent multipliers, the column detector of Lemma 4.3 over an abstract retention-channel interface, and one stage of the hierarchy whose multipliers, copy weights and overloaded set come from the detector, discharging the detector interface of copyStage_rates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…CorrectionSeq The row-sum, entry and input bounds of cutoffCorrectionIter in CopyStage are the fixed-multiplier case of the correction-sequence bounds; reuse them instead of re-proving. Statements are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
reviewer-crei-opus: agent review, not human approval. Advisory: this is the same session as the authoring workers. This is a full review of head Verdict: FINAL. No blocking findings. Discharge of #1683's slice-4 interface (checked against
Locators (checked against the pinned paper text).
Provenance. Everything used is in the paper text, §4.2 and Lemmas 4.2–4.3: the pilot, the running maximum, the row gate, the rank trial, the column number and the overloaded set.
Duplicates.
Tests (nonvacuous).
Nits (optional).
Limits. I did no local build. |
edemaine
left a comment
There was a problem hiding this comment.
reviewer-codex-edemaine — independent agent approval of 80b604b; not human approval. Reviewed the complete eight-file own layer over #1683 (35dd78f), reusing unchanged parent coverage.
The padded rank counts multiplicities correctly. The correction-sequence abstraction supplies the row, entry, support and forwardness bounds; the final antitone multiplier gives the actual-versus-pilot comparison. The detector proof conditions only the terminal seed: the pair bound controls gate failures, independence of the two seed spaces factors the retained-failure count, and the lower-tail/Markov bounds contribute 1/40 each, giving 19/20 without independence among rows. The converse detector bound and incidence count have the stated strict thresholds and constants. The final all-or-overloaded split correctly discharges copyStage_rates. The refactor preserves all 23 existing CopyStage statement texts and removes duplicate proofs.
Checked the mapping against pinned preprint 7ef5c0cc5ca4b0e072b7a050fca09ab24bc6fa3a, §4.2, Lemmas 4.2–4.3 and Proposition 4.5, pp. 12–17. The positive/empty detector examples, nonconstant pilot fixture and fully instantiated q=2 stage establish nonvacuity. The common constants for every H and construction-derived iterated hierarchy remain open as stated. No selected-abstract or machine/resource certificate impact.
Lean Action CI 40984359650 was running when inspected; title CI and diff whitespace checks passed. Independently checked 7,776 finite padded-rank cases including ties, negative values and padding. No local Lean elaboration/build was run.
Preserve the complete eight-path cslib-community#1696 feature/refactor over actual main 311e984. Resolve four inherited parent files with validated main and retain the original 80b604b CopyStage refactor. All seven nonaggregate own blobs match the reviewed source before the separate credited qualification repair. All unrelated main paths and the canonical import union are retained. The own-layer whitespace check against actual main passes. A first-parent check reports only the unchanged, inherited CuckooHashing EOF blank line; that unrelated main blob is preserved rather than cleaned up here. AI-assisted coordinator integration: codex-coord-20261029-1732. Preflight credit: codex-detectors-1696-refresh-20261030. Validation pending on the canonical WIP; no local Lean build.
…orrection for rc2 Under rc2 the root-namespace add_apply/sub_apply/mul_apply no longer apply to matrices; use the Matrix.* versions, as rc2-refresh/1676 and /1677 do for the lower modules of this stack. Proof-only; no statement changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 34406a0)
… feat/detectors-affine-1444 Resolves the add/add conflict in RetentionChannel.lean with main's (cslib-community#1688) version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
reviewer-crei-opus (agent review, not human approval; advisory: same session as the authoring workers). Delta review of head Verdict: FINAL (integration and proof-only delta). Payload (unchanged): Checked per file, old head against new head:
Conflict resolution: main's Limits: I did not run a local build. Hosted |
edemaine
left a comment
There was a problem hiding this comment.
reviewer-codex-edemaine: APPROVE at 915171329b2560084440f987fe8c274bbbfb7380 (independent agent delta review, not human approval). Reuse my complete own-layer mathematics/API/source review.
I checked the refreshed eight-file layer over main 311e9841f: the only own-source differences from approved 80b604b4 are Matrix apply-lemma qualifications in six proof sites across CopyStage/PilotCorrection. Statements, definition bodies, attributes, source credit, detector/rank proofs and concrete tests are preserved. The merged aggregate adds exactly four intended imports; no unrelated main rollback or curated-abstract impact. The original CopyStage refactor remains the reviewed one.
git diff --check passes. Exact-head Lean CI 41032939433 was running when inspected; title CI passes. No local Lean build was run. Required hosted validation remains before integration. Live head rechecked before posting.
|
Coordinator The following affine child also landed. Its latest main/cache handoff covers this exact parent and succeeds with a publicly retrievable cache mapping. This completes the one-stage detector milestone only: common constants for every H and the iterated hierarchy remain open in #1679/#1444. No selected-abstract impact. |
…erface (cslib-community#1698) * feat(Foundations): correction factorization and reward transport for transition matrices Pure linear algebra for the correction-and-copy hierarchy (cslib-community#1444 Phase 2, ideas 2 and 4 of cslib-community#474), following the OpenAI preprint (2026-09-23), Section 4: the factorization 1 - (C - E + EC) = (1 + E)(1 - C), the corrected inverse, copy splitting intertwined with its projection, and the reward transport identity with the stage error bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): expose IsStrictUpperTriangular so importers can apply it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): separate row-sum control from nonnegativity; add reward lower bound Review of cslib-community#1676: correction_mulVec_one_le only shows that row sums do not grow, so its docstring, the module summary and the test comment no longer call it substochasticity. Add rewardTransport_mulVec_nonneg, the lower half of (4.30), under nonnegative projections, corrections and reward. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): factorial truncation of cutoff corrections Second slice of cslib-community#1444 Phase 2 (idea 3 of cslib-community#474), following the OpenAI preprint (2026-09-23), Lemma 4.1 and Lemma 4.4: the cutoff correction recursion E = phi((C + EC)) on a strictly upper triangular C has a unique fixed point, its iterates increase towards it, and after k iterations the error is at most f e^(1/theta) (L/theta)^k / k!, independently of the size of the matrix. The corrected matrix of a finite iterate is nonnegative and small in fully corrected columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(Foundations): use Nat.sum_Icc_choose for the hockey-stick step Review nit on cslib-community#1677: drop the private hockey-stick lemma. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * doc(Foundations): count chains with the integer support size Review of cslib-community#1677: the module docstring now bounds the chain count by m.choose k for the actual support size m, as the proof does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): retention by pairwise independent hashing (cslib-community#1444) A point is retained when its hash lies in a target set B. Under a pairwise independent family each point is retained with probability #B/|Y|, two distinct points independently; the number of retained points of a set has mean #S p, variance #S p (1 - p), Chebyshev's inequality and the lower tail bound 4 / (#S p). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): one stage of the correction-and-copy hierarchy Third slice of cslib-community#1679 (Phase 2 of cslib-community#1444, ideas 3 and 4 of cslib-community#474), following the OpenAI preprint (2026-09-23), Lemma 4.2, Lemma 4.4 and Proposition 4.5: row-sum, entry, domination and support bounds for cutoff corrections; the copy step with explicit split fractions, its density and active-copy bounds; incidence counting; and the one-stage rates that feed the stage bound, given an abstract detector interface. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): affine retention channels over a prime field (cslib-community#1682) Identifiers y : ZMod P are retained when A y + b lies in the box {v | all coordinates < L} of ZMod P ^ H. Exact rates (L/P)^H and their squares for pairs, the lower tail 4/(#A pi), independence of separate seeds, and the assembled channel properties at rate f = a^H with L = ceil(P a): f <= pi <= 2^H f. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): copy stages preserve strict upper triangularity Add cutoffCorrectionIter_isStrictUpperTriangular, cutoffCorrection_residual_isStrictUpperTriangular and copyStage_isStrictUpperTriangular (for the lexicographic order on Lex (V × Fin (m + 1))), so a stage's output can feed the next stage. Correct two descriptions: the pilot inputs have bounded row sums, not necessarily at most one, and copyStage_mulVec_one_le preserves the row-sum bound, with nonnegativity from copyStage_nonneg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(Foundations): general copySplit_isStrictUpperTriangular beside copySplit State the preservation lemma for arbitrary weights and proportions in CorrectionHierarchy.lean, for the lexicographic order on Lex (V × ι), and derive copyStage_isStrictUpperTriangular from it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): pilot with step-dependent multipliers and probabilistic column detectors Phase 2 slice 4 of cslib-community#1444 (tracked in cslib-community#1679): the pilot of Lemma 4.2 with step-dependent multipliers, the column detector of Lemma 4.3 over an abstract retention-channel interface, and one stage of the hierarchy whose multipliers, copy weights and overloaded set come from the detector, discharging the detector interface of copyStage_rates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(Foundations): derive fixed-multiplier iterate bounds from IsCorrectionSeq The row-sum, entry and input bounds of cutoffCorrectionIter in CopyStage are the fixed-multiplier case of the correction-sequence bounds; reuse them instead of re-proving. Statements are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): affine retention channels satisfy the detector interface Instantiate RetentionChannels (cslib-community#1696) with the affine channels of cslib-community#1688 at rate a^H, with c_pi = 1, C_pi = C_pair = 2^H and C_var = 4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): qualify Matrix apply lemmas in CopyStage and PilotCorrection for rc2 Under rc2 the root-namespace add_apply/sub_apply/mul_apply no longer apply to matrices; use the Matrix.* versions, as rc2-refresh/1676 and /1677 do for the lower modules of this stack. Proof-only; no statement changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 34406a0) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Samuel Giuseppe Schlesinger <sgschlesinger@gmail.com>
…crete stage bound (cslib-community#1704) * feat(Foundations): correction factorization and reward transport for transition matrices Pure linear algebra for the correction-and-copy hierarchy (cslib-community#1444 Phase 2, ideas 2 and 4 of cslib-community#474), following the OpenAI preprint (2026-09-23), Section 4: the factorization 1 - (C - E + EC) = (1 + E)(1 - C), the corrected inverse, copy splitting intertwined with its projection, and the reward transport identity with the stage error bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): expose IsStrictUpperTriangular so importers can apply it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): separate row-sum control from nonnegativity; add reward lower bound Review of cslib-community#1676: correction_mulVec_one_le only shows that row sums do not grow, so its docstring, the module summary and the test comment no longer call it substochasticity. Add rewardTransport_mulVec_nonneg, the lower half of (4.30), under nonnegative projections, corrections and reward. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): factorial truncation of cutoff corrections Second slice of cslib-community#1444 Phase 2 (idea 3 of cslib-community#474), following the OpenAI preprint (2026-09-23), Lemma 4.1 and Lemma 4.4: the cutoff correction recursion E = phi((C + EC)) on a strictly upper triangular C has a unique fixed point, its iterates increase towards it, and after k iterations the error is at most f e^(1/theta) (L/theta)^k / k!, independently of the size of the matrix. The corrected matrix of a finite iterate is nonnegative and small in fully corrected columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(Foundations): use Nat.sum_Icc_choose for the hockey-stick step Review nit on cslib-community#1677: drop the private hockey-stick lemma. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * doc(Foundations): count chains with the integer support size Review of cslib-community#1677: the module docstring now bounds the chain count by m.choose k for the actual support size m, as the proof does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): retention by pairwise independent hashing (cslib-community#1444) A point is retained when its hash lies in a target set B. Under a pairwise independent family each point is retained with probability #B/|Y|, two distinct points independently; the number of retained points of a set has mean #S p, variance #S p (1 - p), Chebyshev's inequality and the lower tail bound 4 / (#S p). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): one stage of the correction-and-copy hierarchy Third slice of cslib-community#1679 (Phase 2 of cslib-community#1444, ideas 3 and 4 of cslib-community#474), following the OpenAI preprint (2026-09-23), Lemma 4.2, Lemma 4.4 and Proposition 4.5: row-sum, entry, domination and support bounds for cutoff corrections; the copy step with explicit split fractions, its density and active-copy bounds; incidence counting; and the one-stage rates that feed the stage bound, given an abstract detector interface. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): affine retention channels over a prime field (cslib-community#1682) Identifiers y : ZMod P are retained when A y + b lies in the box {v | all coordinates < L} of ZMod P ^ H. Exact rates (L/P)^H and their squares for pairs, the lower tail 4/(#A pi), independence of separate seeds, and the assembled channel properties at rate f = a^H with L = ceil(P a): f <= pi <= 2^H f. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): copy stages preserve strict upper triangularity Add cutoffCorrectionIter_isStrictUpperTriangular, cutoffCorrection_residual_isStrictUpperTriangular and copyStage_isStrictUpperTriangular (for the lexicographic order on Lex (V × Fin (m + 1))), so a stage's output can feed the next stage. Correct two descriptions: the pilot inputs have bounded row sums, not necessarily at most one, and copyStage_mulVec_one_le preserves the row-sum bound, with nonnegativity from copyStage_nonneg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(Foundations): general copySplit_isStrictUpperTriangular beside copySplit State the preservation lemma for arbitrary weights and proportions in CorrectionHierarchy.lean, for the lexicographic order on Lex (V × ι), and derive copyStage_isStrictUpperTriangular from it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): pilot with step-dependent multipliers and probabilistic column detectors Phase 2 slice 4 of cslib-community#1444 (tracked in cslib-community#1679): the pilot of Lemma 4.2 with step-dependent multipliers, the column detector of Lemma 4.3 over an abstract retention-channel interface, and one stage of the hierarchy whose multipliers, copy weights and overloaded set come from the detector, discharging the detector interface of copyStage_rates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(Foundations): derive fixed-multiplier iterate bounds from IsCorrectionSeq The row-sum, entry and input bounds of cutoffCorrectionIter in CopyStage are the fixed-multiplier case of the correction-sequence bounds; reuse them instead of re-proving. Statements are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): affine retention channels satisfy the detector interface Instantiate RetentionChannels (cslib-community#1696) with the affine channels of cslib-community#1688 at rate a^H, with c_pi = 1, C_pi = C_pair = 2^H and C_var = 4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): constants of the correction-and-copy hierarchy Bundle the constants and cutoffs of one hierarchy stage with all conditions used by the stage lemmas, prove that they exist for every density divisor q > 0, and restate one detector-driven stage with the bundled constants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): the iterated correction-and-copy hierarchy and its stage bound Iterate the detector-driven stages on V (l+1) ≃ Lex (V l × Fin D₀) at rates q⁻¹ ^ l and prove 0 ≤ p x - W_l(x̄_l) ≤ |V 0| (2^c)⁻¹^l from the construction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * doc(Foundations): document every HierarchyParams field Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): affine channels at every stage of the hierarchy Stage l hashes identifiers into a prime field P_l >= max(2^l, M l) at rate (2^H)^-l with uniform constants, discharging the channel hypotheses of sub_hierarchyReward_le; radix identifiers give a fully concrete instance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * doc(Foundations): clarify reduced hierarchy parameter scope Address cslib-community#1702 review5707105708: parameter existence is the reduced algebraic-stage package. Preserve the full threshold ladder and root/complement regularity gap for Q and every step cutoff. Correct m=ceilNat(q)*(k+1) and D0=m+1. No Lean declaration or proof body changes. Codex worker codex-hierarchy-fixes-1702-1704-20261030. Source-only preparation; supported-pin integration, full validation and outside delta review remain required before publication. * refactor(Probability): share hierarchy radix identification Move radixCopyEquiv, radixCopyEquiv_val and radixCopyEquiv_lt verbatim beside DetectedHierarchy. The concrete hierarchy invariant test now uses this API instead of a parallel equivalence and order proof. Keep finProdFinEquiv reuse and original authorship. Make the module-local prime choice, supporting facts and generic instance private, and retain the reduced algebraic-stage and later-estimation scope. Source-only preparation for cslib-community#1704 review5707162149; supported-pin builds are held pending cslib-community#1694. A stageModulus-specific prime instance may be needed to preserve downstream seed-finiteness inference and will be checked before final validation/publication. * fix(Foundations): qualify Matrix apply lemmas for the rc2 Mathlib API Under rc2 the root-namespace add_apply/neg_apply/sub_apply/mul_apply/one_apply no longer apply to matrices; use the Matrix.* versions in CorrectionHierarchy and its test, as cslib-community#1653 does elsewhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit ea663ce) * fix(Foundations): qualify Matrix apply lemmas in FactorialTruncation for rc2 Under rc2 the root-namespace add_apply/sub_apply/mul_apply no longer apply to matrices; use the Matrix.* versions in FactorialTruncation and its test, rewrapping lines that crossed 100 columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 19cf8a8) * fix(Foundations): qualify Matrix apply lemmas in CopyStage and PilotCorrection for rc2 Under rc2 the root-namespace add_apply/sub_apply/mul_apply no longer apply to matrices; use the Matrix.* versions, as rc2-refresh/1676 and /1677 do for the lower modules of this stack. Proof-only; no statement changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 34406a0) * fix(Probability): retain prime stage-modulus inference Keep the generic prime-choice implementation and supporting facts private. Make stageModulus a non-exposed definition with the same body: Lean rejects the private helper in the exposed abbreviation body. Export only Fact (stageModulus M l).Prime, using the private primality fact, so Mathlib derives NeZero and the finite-field/seed structures for actual hierarchy clients. Confirmed missing NeZero(stageModulus) and Fintype(stageSeed) in the real hierarchy module after privacy; the existing DetectedHierarchy and HierarchyChannels fixtures pass the strict focused build with this bridge (6152 jobs). No new prime-size, encoding, channel or resource guarantee. Full final validation and outside exact-head API delta review follow. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Samuel Giuseppe Schlesinger <sgschlesinger@gmail.com>
Parents cslib-community#1691, cslib-community#1696 and cslib-community#1698 have landed. The add/add conflicts in KthLargest.lean and ColumnDetector.lean take main's later versions; this PR's own layer does not touch them. Complexity.lean regenerated by mk_all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…ntion channels (cslib-community#1710) * chore(deps): track CSLib main and Lean rc2 Advance CSLib to 8a8ad748 and synchronize Mathlib, the documentation generator, Verso, and all three lockfiles with Lean v4.36.0-rc2. Keep the root and documentation projects on the same inherited dependency revisions. * refactor(probability): use generic infinite-sum lemmas Replace 187 deprecated ENNReal wrapper uses across 55 proof files with their generic counterparts. The exact mapping is: - ENNReal.tsum_le_tsum -> tsum_le_tsum (94) - ENNReal.tsum_add -> tsum_add (54) - ENNReal.tsum_eq_zero -> tsum_eq_zero_iff (14) - ENNReal.summable -> CompleteLattice.summable (6) - ENNReal.tsum_comm -> tsum_comm (6) - ENNReal.tsum_prod' -> tsum_prod' (5) - ENNReal.le_tsum -> le_tsum (5) - ENNReal.tsum_eq_add_tsum_ite -> tsum_eq_add_tsum_ite (2) - ENNReal.tsum_sigma -> tsum_sigma (1) The old wrappers invoke these same theorems specialized to ENNReal. All five le_tsum calls already pass the function by name. No statements or definitions change. * fix(build): adapt proofs to the rc2 Mathlib API Qualify newly protected matrix and finite-sum lemmas, publicly import the relocated Matrix.Array API, and replace renamed angle, parity, trailing-coefficient and polynomial-degree helpers. The generic polynomial lemmas retain the original field specializations and exponent hypotheses. No theorem statement or definition body changes. Validation: strict focused builds of all ten affected modules passed under Lean v4.36.0-rc2. Source comparison against d6ccb24 shows all Lean edits are inside theorem proofs except the required Bird import. * test(quantum): qualify the protected matrix lemma Preserve the existing non-unitary matrix counterexample under rc2 Mathlib by explicitly selecting Matrix.mul_apply, as in the library proof repairs. * fix(build): normalize goals before proof automation Use expected-type-directed refinement for the generic zero-sum lemma and expose the determinant variable-count function before fun_prop. Normalize graph and Cook-Levin wrappers in regression proofs while retaining direct/let-bound automation and all missing-hypothesis checks. Compose the existing rotation certificates for arithmetic-base examples, and remove one redundant concrete Fintype binder from a private test helper. Validation: strict focused builds of the two source and five test modules passed under Lean v4.36.0-rc2. No public theorem statement, definition body, model, encoding, probability, or resource bound changes. No heartbeat or fun_prop compatibility option was introduced. * feat(Foundations): correction factorization and reward transport for transition matrices Pure linear algebra for the correction-and-copy hierarchy (cslib-community#1444 Phase 2, ideas 2 and 4 of cslib-community#474), following the OpenAI preprint (2026-09-23), Section 4: the factorization 1 - (C - E + EC) = (1 + E)(1 - C), the corrected inverse, copy splitting intertwined with its projection, and the reward transport identity with the stage error bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): expose IsStrictUpperTriangular so importers can apply it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): separate row-sum control from nonnegativity; add reward lower bound Review of cslib-community#1676: correction_mulVec_one_le only shows that row sums do not grow, so its docstring, the module summary and the test comment no longer call it substochasticity. Add rewardTransport_mulVec_nonneg, the lower half of (4.30), under nonnegative projections, corrections and reward. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): factorial truncation of cutoff corrections Second slice of cslib-community#1444 Phase 2 (idea 3 of cslib-community#474), following the OpenAI preprint (2026-09-23), Lemma 4.1 and Lemma 4.4: the cutoff correction recursion E = phi((C + EC)) on a strictly upper triangular C has a unique fixed point, its iterates increase towards it, and after k iterations the error is at most f e^(1/theta) (L/theta)^k / k!, independently of the size of the matrix. The corrected matrix of a finite iterate is nonnegative and small in fully corrected columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(Foundations): use Nat.sum_Icc_choose for the hockey-stick step Review nit on cslib-community#1677: drop the private hockey-stick lemma. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * doc(Foundations): count chains with the integer support size Review of cslib-community#1677: the module docstring now bounds the chain count by m.choose k for the actual support size m, as the proof does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): retention by pairwise independent hashing (cslib-community#1444) A point is retained when its hash lies in a target set B. Under a pairwise independent family each point is retained with probability #B/|Y|, two distinct points independently; the number of retained points of a set has mean #S p, variance #S p (1 - p), Chebyshev's inequality and the lower tail bound 4 / (#S p). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): one stage of the correction-and-copy hierarchy Third slice of cslib-community#1679 (Phase 2 of cslib-community#1444, ideas 3 and 4 of cslib-community#474), following the OpenAI preprint (2026-09-23), Lemma 4.2, Lemma 4.4 and Proposition 4.5: row-sum, entry, domination and support bounds for cutoff corrections; the copy step with explicit split fractions, its density and active-copy bounds; incidence counting; and the one-stage rates that feed the stage bound, given an abstract detector interface. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): affine retention channels over a prime field (cslib-community#1682) Identifiers y : ZMod P are retained when A y + b lies in the box {v | all coordinates < L} of ZMod P ^ H. Exact rates (L/P)^H and their squares for pairs, the lower tail 4/(#A pi), independence of separate seeds, and the assembled channel properties at rate f = a^H with L = ceil(P a): f <= pi <= 2^H f. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): qualify Matrix apply lemmas for the rc2 Mathlib API Under rc2 the root-namespace add_apply/neg_apply/sub_apply/mul_apply/one_apply no longer apply to matrices; use the Matrix.* versions in CorrectionHierarchy and its test, as cslib-community#1653 does elsewhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): copy stages preserve strict upper triangularity Add cutoffCorrectionIter_isStrictUpperTriangular, cutoffCorrection_residual_isStrictUpperTriangular and copyStage_isStrictUpperTriangular (for the lexicographic order on Lex (V × Fin (m + 1))), so a stage's output can feed the next stage. Correct two descriptions: the pilot inputs have bounded row sums, not necessarily at most one, and copyStage_mulVec_one_le preserves the row-sum bound, with nonnegativity from copyStage_nonneg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): qualify Matrix apply lemmas in FactorialTruncation for rc2 Under rc2 the root-namespace add_apply/sub_apply/mul_apply no longer apply to matrices; use the Matrix.* versions in FactorialTruncation and its test, rewrapping lines that crossed 100 columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(Foundations): general copySplit_isStrictUpperTriangular beside copySplit State the preservation lemma for arbitrary weights and proportions in CorrectionHierarchy.lean, for the lexicographic order on Lex (V × ι), and derive copyStage_isStrictUpperTriangular from it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): frame-conditioned channels, validated variants and conditional averaging (cslib-community#1682) Frame-conditioned retention channels over ZMod P with their exact marginal rate, coordinates (F, w) on retention slices, the affine move (F, w) -> (gF, gw + c), validated walk variants with their unique wrap, and conditional variance decay on every slice from a spectral-gap hypothesis on the coordinates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Foundations): pilot with step-dependent multipliers and probabilistic column detectors Phase 2 slice 4 of cslib-community#1444 (tracked in cslib-community#1679): the pilot of Lemma 4.2 with step-dependent multipliers, the column detector of Lemma 4.3 over an abstract retention-channel interface, and one stage of the hierarchy whose multipliers, copy weights and overloaded set come from the detector, discharging the detector interface of copyStage_rates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(Foundations): derive fixed-multiplier iterate bounds from IsCorrectionSeq The row-sum, entry and input bounds of cutoffCorrectionIter in CopyStage are the fixed-multiplier case of the correction-sequence bounds; reuse them instead of re-proving. Statements are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): affine retention channels satisfy the detector interface Instantiate RetentionChannels (cslib-community#1696) with the affine channels of cslib-community#1688 at rate a^H, with c_pi = 1, C_pi = C_pair = 2^H and C_var = 4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): qualify Matrix apply lemmas in CopyStage and PilotCorrection for rc2 Under rc2 the root-namespace add_apply/sub_apply/mul_apply no longer apply to matrices; use the Matrix.* versions, as rc2-refresh/1676 and /1677 do for the lower modules of this stack. Proof-only; no statement changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(Probability): pair and tail estimates for frame-conditioned retention channels Lemma 3.1, items 2-3, of the OpenAI preprint for frame-conditioned channels: the frame density q_fr (with 1/2 <= q_fr for r < H, via Mathlib's card_linearIndependent), pairwise independence of the unrestricted polynomial channel, the transfer bound dens_frame <= dens / q_fr, the pair bound and the Chebyshev lower tail, and the detector-interface instance retentionChannels_frameRetains (constants 2^H / q_fr and 4 / q_fr, or 2^(H+1) and 8 for r < H). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(Foundations): qualify Matrix apply lemmas in CopyStage and PilotCorrection for rc2 Under rc2 the root-namespace add_apply/sub_apply/mul_apply no longer apply to matrices; use the Matrix.* versions, as rc2-refresh/1676 and /1677 do for the lower modules of this stack. Proof-only; no statement changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 34406a0) --------- Co-authored-by: Samuel Giuseppe Schlesinger <sgschlesinger@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Part of #1679 (Phase 2 of #1444).
Fourth slice: the probabilistic part of one stage of the correction-and-copy hierarchy (idea 3 of #474). It covers the pilot with step-dependent multipliers (Lemma 4.2, pilot form) and the column detector (Lemma 4.3). These are stated over an abstract retention-channel interface. The PR then discharges the detector interface of #1683's
Matrix.copyStage_rates. The ideas follow the OpenAI preprint (2026-09-23), §4.2, Lemmas 4.2–4.3 and Proposition 4.5, cited as[OpenAI2026LogSpace](revision7ef5c0cc). The preprint is not peer reviewed. Statements and names are ours. Only the preprint text was read; no OAI Lean code was opened or used.Stacked on #1683 (→ #1677 → #1676). Please review only this PR's own commits:
f1303d9: the content;80b604b: a proof-only refactor in feat(Foundations): one stage of the correction-and-copy hierarchy #1683'sCopyStage.lean.cutoffCorrectionIter_sum_le,cutoffCorrectionIter_le_muland two private helpers now reuse the new correction-sequence bounds instead of re-proving them. All statements are unchanged.The PR does not import #1688. The affine instantiation is the small follow-up #1698, stacked on this PR and #1688.
New files (lines):
Foundations/Data/Finset/KthLargest.lean(116),Foundations/LinearAlgebra/Matrix/PilotCorrection.lean(331),Foundations/Probability/ColumnDetector.lean(469),Foundations/Probability/DetectedStage.lean(295). Tests:ComplexityTests/KthLargest.lean(53),ComplexityTests/Detectors.lean(215).CopyStage.lean: +10 / −48.Main statements
Order statistic.
Finset.kthLargest k s his thek-th largest value ofhons, padded with zeros (the preprint'srank_k). It is characterized by threshold counts:lt_kthLargest_iff (hk : 0 < k) (ht : 0 ≤ t) : t < kthLargest k s h ↔ k ≤ #{x ∈ s | t < h x};le_kthLargest_iff(for0 < t, with≤).Pilot (Lemma 4.2).
Matrix.IsCorrectionSeq C FmeansF 0 = 0and0 ≤ F (i+1) ≤ C + F i * Centrywise. For such sequences:sum_input_le/sum_le: row sums at mosti + 1/i;input_le_mul/le_mul: entries at most(i+1) f/i f;input_mem/mem: support within a cover ofC;isStrictUpperTriangularandinput_isStrictUpperTriangular.Both kinds of corrections are such sequences: the fixed-multiplier
cutoffCorrectionIter(isCorrectionSeq_cutoffCorrectionIter) and the pilot (isCorrectionSeq_pilotCorrection). The pilotpilotCorrection c γ U C,pilotInput,pilotMaxworks as follows. Stepi+1setsG = C + Ê_i CandM_{i+1} = M_i ⊔ U G, thenÊ_{i+1} x y = c (G x y) * γ (M_{i+1} y). Two more results:cutoffCorrectionIter_le_pilotCorrection: with cutoffsc t * γ (M_k y), the actual iterates and their inputs are at most the pilot's, fori ≤ k. Herecis monotone andγantitone.exists_lt_pilotInput_of_lt_pilotMax.Channel interface.
Cslib.Probability.RetentionChannels X Y f π cπ Cπ Cpair Cvartakes channelsX : ι → V → PropandY : κ → V → Propon finite uniform seed spaces. Independence is built in through the product seed spaceι × κ. The fields are exactly (4.8)/(4.9):dens {s | X s v} = πanddens {t | Y t v} = π;cπ f ≤ π ≤ Cπ f;dens {Y w ∧ Y y} ≤ Cpair f · dens {Y y}forw ≠ y;dens {s | 2·#{x ∈ A | X s x} < #A π} ≤ Cvar / (#A π)for nonemptyA.These are the fields of #1688's
affineRetains_rates, and a frame-conditioned channel (#1691) also fits, with its frames as the seed type.Detector (Lemma 4.3). The definitions:
rowGate ρ K f G T x = ρ (rank_K {G x w / f : w ∈ T});detectorTrial ϕ ρ J K f G S T y = rank_J {ϕ (G x y / f) · rowGate x : x ∈ S};columnDetector X Y ϕ ρ J K f G y = 𝔼 s, 𝔼 t ∈ {t | Y t y}, detectorTrial … {x | X s x} {w | Y t w} y.The results:
le_columnDetector(4.3(1)). Assume the hypotheses0 < f, cπ,0 ≤ Cpair, thatϕ = 1fromδ₁, thatρ ≤ 1andρ = 1throughη > 0, and thatG ≥ 0has row sums≤ k. Assume also160 (1 + Cpair k / η) ≤ K,0 < J,4J ≤ cπ Rand40 Cvar ≤ cπ R. ThenR / f < #{x | δ₁ f ≤ G x y} → 19/20 ≤ columnDetector X Y ϕ ρ J K f G y.lt_card_of_lt_columnDetector(4.3(2)). Assumeϕ ∈ [0,1],ϕ = 0throughδ₀andρ ≤ 1. Then1/4 < columnDetector … G y → J / (4 Cπ f) < #{x | δ₀ f < G x y}.Detected stage. Let
M = pilotMax c γ (columnDetector X Y ϕ ρ J K f) C k. The copy weights aredetectorWeight κ M j x = if j = 0 then 1 else κ (M x)(4.22), and the overloaded set isoverloaded M = {x | 1/4 < M x}.card_overloaded_le : m * #(overloaded M) ≤ #A, given2 Cπ m k (k+1) ≤ δ₀ J(4.24). It uses incidence counting (feat(Foundations): one stage of the correction-and-copy hierarchy #1683) over the pilot inputs with row sums1, …, k.detectedStage_rates: the four conclusions ofcopyStage_ratesforE = cutoffCorrectionIter (fun y t => c t * γ (M y)) C k,D = C - E + E C,r = detectorWeight κ MandO = overloaded M:≤ f / q;copyWeight r;copyCover A O;#copyCover ≤ 2 #A.The hypotheses are the channel interface, feat(Foundations): factorial truncation of cutoff corrections #1677's cutoff conditions on
c,t - θ₂ f ≤ c t,γ ∈ [0,1]withγ = 1through1/2, andκ ∈ [0,1]vanishing through1/4and= 1above1/2. The detector conditions, (4.24) and feat(Foundations): one stage of the correction-and-copy hierarchy #1683's copy-constant conditions complete the list.card_le_of_pilot_pos,card_le_of_multiplier_pos(4.3(3)): ifγvanishes from4/5, a positive pilot (resp. final) multiplier bounds the column count#{x | δ₁ f ≤ G x y} ≤ R / fof the pilot (resp. actual) inputs.Source → Lean
RetentionChannels(independence via the product seed space)rank_jwith padding zeros (§4.2, p. 13)Finset.kthLargest,lt_kthLargest_iff,le_kthLargest_iffG_i,R_i,U_i,ĝ_i = γ(max_{r≤i} U_r),Ê_ipilotInput,rowGate,detectorTrial,columnDetector,pilotMax,pilotCorrectiong = ĝ_{k*}cutoffCorrectionIter (fun y t => c t * γ (M_k y))G_i 1, Ê_i 1 ≤ i 1, entries≤ i f,E_i ≤ Ê_i,G'_i ≤ G_i, supports, strict forwardnessIsCorrectionSeq.{sum_input_le, sum_le, input_le_mul, le_mul, input_mem, mem, isStrictUpperTriangular},cutoffCorrectionIter_le_pilotCorrectionle_columnDetectorlt_card_of_lt_columnDetectorcard_le_of_pilot_pos,card_le_of_multiplier_posr_j,O = {U_max > 1/4}, the incidence count and (4.24) in Prop. 4.5detectorWeight,overloaded,card_overloaded_leC⁺ ≤ f/q,C⁺P_r = P_r D, `Differences from the preprint.
ϕ = 1fromδ₁andρ = 1throughη, but not monotonicity or the upper thresholdsδ₀,η₊;κ = 1is assumed above1/2.M_0 = 0, which equalsmax_{1≤r≤i} U_rbecause detector numbers are nonnegative (columnDetector_nonneg).Scope. The pilot, the detector lemma and the one-stage assembly from the channel properties are complete. The following remains for Phase 2 (#1679):
k*,J,R*,K,D₀,q = 2^H) as a lemma for everyH. The test below exhibits one consistent choice forq = 2, but no general existence statement is proved.V_{l+1} = V_l × Fin D₀, with channels at ratef_l = q^{-l}at every stage, fed intosub_rewardTransport_mulVec_le_of_ratesto get the stage bound0 ≤ p − W_l ≤ |V₀| 2^{-cl}from the construction itself. This is the completion criterion of impl(#1444 Phase 2): correction-and-copy hierarchy #1679.The affine instantiation with #1688 is in #1698.
Tests. The tests discharge every hypothesis on concrete inputs:
kthLargestoverℚ: the 2nd largest of3, 1, 2, 0is2, and the padded 4th is0;M_1 2 = 1,Ê_1 (0,1) = 3/8andÊ_1 (1,2) = 0; the row-sum and comparison bounds apply;RetentionChannelsat any ratef ∈ (0,1], withc_π = 1,C_π = C_pair = 1/fandC_var = 0;le_columnDetectoron a 6-vertex column with five entries1/5(R = 4,K = 480) givesU ≥ 19/20;lt_card_of_lt_columnDetectorshows that an empty column hasU ≤ 1/4;detectedStage_rateson the 3-state walk atf = 1/2andq = 2withk = 15,m = 31,J = 297600,δ₀ = 1/10, withe^4·4^15/15! ≤ 1/8proved fromReal.exp_one_lt_d9. This shows the stage hypotheses are jointly satisfiable withq > 1.Validation at
80b604b, all passing locally:scripts/check.sh(all six gates);check_hygiene.py --check-simp;check_changed_files.py --base origin/main(because of the stack it also covers feat(Foundations): correction factorization and reward transport for transition matrices #1676/feat(Foundations): factorial truncation of cutoff corrections #1677/feat(Foundations): one stage of the correction-and-copy hierarchy #1683's modules);check_tidy_surface.py(baseline unchanged);parallel_defs.py(no candidates).ROADMAP is untouched. No catalogue or abstract impact.
Existing notions considered. Mathlib, CSLib and this library have no order statistic.
Finset.Quantilegives pivots, not ak-th largest value. There is also no detector or correction-sequence API. The proofs reuseFinset.card_filter_mul_le_sum(Markov),Finset.expect, and #1683'scard_mul_le_of_incidencesandcopyStage_rates.Review. Please arrange a non-author review of this PR's own layer: correctness, API, the channel interface and the source mapping above.
Integration refresh (2026-10-30). Head
80b604b4→915171329b2560084440f987fe8c274bbbfb7380: merge of main311e9841(which now contains #1683 and #1688), plus the rc2 repair91517132(Matrix.add_apply/sub_apply/mul_applyqualified inCopyStage.leanandPilotCorrection.lean, 6 lines). Payload check: this PR's own files (KthLargest,PilotCorrection,ColumnDetector,DetectedStage, both tests) are byte-identical to80b604b4apart from thosePilotCorrectionqualifications. TheCopyStagelayer is the same refactor as before, now shown against main's #1683 version.CorrectionHierarchy,FactorialTruncation, their tests and theOpenAI2026LogSpacebib entry now come from main. Gates onv4.36.0-rc2at91517132:scripts/check.sh(all 6),check_hygiene.py --check-simp,check_changed_files.py --base origin/main, andcheck_tidy_surface.py(baseline unchanged). All pass. A delta review of the merge and repair is needed.AI assistance: written by Claude Code (Claude Opus 5.5) as worker
worker-crei-dc679113-1444p2s4for coordinatorcoordinator-crei-dc679113, at crei's request.🤖 Generated with Claude Code