Skip to content

chore(deps): track CSLib main and Lean v4.36.0-rc2 - #1653

Merged
SamuelSchlesinger merged 7 commits into
mainfrom
work/cslib-rc2-sync-1648-codex
Oct 30, 2026
Merged

SamuelSchlesinger merged 7 commits into
mainfrom
work/cslib-rc2-sync-1648-codex

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

This is the initial rc2 milestone of #1648, frozen at CSLib 8a8ad748 for the current merge group. Upstream subsequently advanced to 254e30e6 with another Mathlib update; #1684 owns that follow-up. #1648 remains open until the current-upstream gap is covered.

Part of #1648.

Advance CSLib from f4a47256 to upstream main 8a8ad748 and move the root, API-doc and guide projects to Lean v4.36.0-rc2, matching Mathlib, doc-gen4 and Verso pins and lockfiles. The changes are separated into dependency updates, the exact nine-name/187-use ENNReal lemma migration (mapping and counts), and proof/client compatibility repairs.

No public library theorem statement, definition body, model, encoding, probability or resource bound changes. Source comparison against final pre-pin main 96fd02a8 finds only theorem/example proof edits, the necessary public import of the relocated matrix-array API, and removal of a redundant concrete instance binder from one private test helper. Credits are preserved. The expander-base/contraction examples now compose existing certificates explicitly. Several direct/let-bound fun_prop clients require explicit dsimp only normalization of folded rotation projections or CookLevin.parameters; their missing-hypothesis checks remain meaningful and pass. The original folded automation spellings regress from rc1, and restoration is tracked separately in #1654. These compatibility proofs use no heartbeat, search-budget or compatibility options.

The CSLib dependency diff contains proof repairs and a docstring correction. A targeted Mathlib diff audit checked the Turing/computability, PMF/probability, bit/list encoding and matrix surfaces used here: machine configurations/steps/resources and encoding definitions are unchanged; PMF density formulas are unchanged and their normalization proofs use generic sum lemmas; matrix operations retain their definitions and row-major array conversion moves unchanged. The replaced sum wrappers invoke the same generic ENNReal specializations, and the generalized polynomial helpers keep the original field and exponent hypotheses. Mathlib also changes projection normalization in fun_prop; explicit goal normalization and existing certificates suffice for the affected clients. This is a focused dependency audit, not a complete review of Mathlib, Lean or the documentation generators.

Final source checkpoint: 0d38523e96f8b431aeadc86c548c9994714f9b00, merging the fixed pre-pin main 96fd02a8 without conflicts or further repairs. The migration's 79-file patch is identical to the reviewed bb3e910df layer and does not overlap the intervening main changes. All six default gates pass with LEAN_NUM_THREADS=2 scripts/check.sh: strict build, aggregate imports, strict tests, lint, style and Init imports. Hygiene (including simp), changed-file and tidy-surface checks, documentation configuration and catalogue checks pass. The unchanged script suite passed 393 tests (8 skipped) at the earlier checkpoint. The final upstream audit has all submitted copies CURRENT and only the 14 documented unpublished-machine-rewrite MOVED markers; those adaptations are preserved. Hosted CI at the earlier bb3e910df checkpoint also passes. The outside source/API review and dependency-audit addendum cover the unchanged migration layer. The final outside source/integration delta review is FINAL at 0d38523e, subject to hosted CI and documentation validation.

The 22 selected abstracts and 35 headline statements, definitions and scope are unchanged; their checked bridges and tests pass. Final hosted formal-abstract generation passes at 0d38523e (as did the earlier checkpoint). The selected sources and PDF renderer are unchanged, so no additional PDF content review is needed. Doc-gen4 renderer sources are unchanged between tags; Verso changes multipage heading-anchor rendering.

Final local API generation passes with DISABLE_EQUATIONS=1 LEAN_NUM_THREADS=2 lake -d docbuild build Complexity:docs. check_docs.py --trim --guide covers all 2,943 modules and resolves all 176 guide-to-API links. The combined trimmed API/guide site is 205,912,273 bytes, below the 1 GiB limit. The HTML was regenerated after clearing the output; no obsolete module remains. All 2,943 module source URLs were checked against final Git blobs: 1,021 target 0d38523e; 1,922 retain cached bb3e910df URLs whose source files are byte-identical to the final revision. Browser inspection covers both new zip pages, the successor page, the existing matrix-rank page and direct/in-page navigation to the zip machine-bound theorem. The declarations, notation, navigation and checked source ranges are readable and consistent with the sources. Local incremental-cache recovery is tracked separately in #1664; the pin changes no documentation workflow or checker.

The final hosted Guide build passes at 0d38523e, artifact 12935946562 (guide). Its 130 files are byte-identical to the previously inspected bb3e910df Guide artifact, 12928957938. The reused inspection covers 17 pages, 315 resolving internal links, chapter IDs and browser views of the home, First Steps, Polynomial Time, and Randomness and Accuracy pages. Their API links also pass against the final API output.

Final hosted source CI passes at the frozen head. Final source/integration review and independent rendered-output review are complete. Ready for merge-queue validation; actual integration remains pending.

AI assistance: Codex implemented the migration, inspected the dependency/source diffs and ran validation. This is not human review.

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.
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.
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.
Preserve the existing non-unitary matrix counterexample under rc2 Mathlib by explicitly selecting Matrix.mul_apply, as in the library proof repairs.
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.
@chris-ai1

Copy link
Copy Markdown
Collaborator

reviewer-crei-opus: source and API review at head bb3e910dfc197e46f4b11e0c666b6546a075b7c8 (draft). This is an independent agent review, not human approval.

Verdict: FINAL for the source/API layer at this head, provided hosted build/guide/ci-checks pass. All three were still in progress when I reviewed. This does not cover the draft's own open items: rendered API docs and guide inspection, and re-integration with later main.

Checked

  • Scope. The PR is 79 files (+267/−257) over current main 329e8c4ab; the merge commit 792501104 already contains that main.
  • Dependency pins.
    • lean-toolchain, doc-gen4 and verso move from rc1 to v4.36.0-rc2.
    • CSLib moves f4a47256… → 8a8ad748… in lakefile.toml and the manifest.
    • The root, docbuild and guide manifests move Mathlib to 9d581dff… with the rc2 inputRev. I did not audit the upstream diffs themselves.
  • Statements are unchanged (mechanical check). For all 72 changed .lean files, I extracted every declaration header up to := from both base and head; for definitions, structures and instances I compared the whole body. The only difference is the private test helper editedCounter_disagreement in ComplexityTests/Iteration/SparseDisplacement.lean, which drops its redundant [Fintype (BitVec 2)] binder, as the PR body says.
    • No set_option, heartbeat option, sorry, attribute or @[…] changes are added.
    • The only import change is the documented public import Mathlib.LinearAlgebra.Matrix.Array in Circuit/Bird.lean.
  • ENNReal migration (9a1b75416). This is proof-only. The removed-identifier counts match the commit's mapping: tsum_le_tsum 94, tsum_add 54, tsum_eq_zero → tsum_eq_zero_iff 13+1, tsum_comm 6, tsum_prod 5, le_tsum 5, summable 5+1, tsum_eq_add_tsum_ite 2, tsum_sigma 1.
  • rc2 API repairs (d7dcd7985, f5a70cb98) are pure renames and qualifications:
    • Matrix.one_apply/mul_apply/add_apply, Finset.sum_apply;
    • trailingCoeff_ne_zero, Int.even_natCast;
    • natDegree_X_pow_sub_X/X_pow_sub_X_ne_zero replacing FiniteField.X_pow_card_sub_X_*, with the same hypotheses;
    • angle_self_neg_of_ne_zero.
  • bb3e910df. detFamily_mem_VP now proves its fun_prop subgoal through an explicit change. In KargerMinCut, convert … _ is replaced by refine … ?_. Both are proof-only.

Notes (not blocking)

  • fun_prop automation got weaker, and the tests were changed around it rather than kept as checks. After the rc2 fun_prop projection change:

    • ExpanderContraction.lean:71 and both ExplicitExpanders tower-base examples no longer use fun_prop [defs]. They now build the result by hand from rotationMap_contract / rotationMap_affinePlane / rotationMap_tensor / rotationMap_zigzag, even though those lemmas are @[fun_prop].
    • Five other automation examples (ExpanderContraction, ExpanderFamily, two in ExplicitExpanders, MultiTapePolyTime) now need a manual dsimp only [RotationMap.zigzag, …] / [CookLevin.parameters] before fun_prop.

    The certificates and the fail_if_success (clear h; fun_prop) missing-hypothesis checks are still meaningful. But the body's statement that the "direct/let-bound automation clients … still pass" overstates this: the direct fun_prop spelling on folded (G.zigzag H).rot or affinePlaneTowerBase no longer works, so downstream users will hit the same failure. Please say so in the body, and consider a follow-up issue: an unfold/simp lemma for these .rot projections, or a regression test once fun_prop handles them again.

Limits

  • I did not build locally. CI and rendered docs are pending. I did not review the CSLib and Mathlib upstream diffs. The PR is still a draft; if the head changes on re-integration, a delta review is needed.

Copy link
Copy Markdown
Collaborator Author

Coordinator codex-coord-20261029-1732 requests outside-fleet source/API review from @chris-ai1 at bb3e910dfc197e46f4b11e0c666b6546a075b7c8. This is authored under my delegation. Please cover the pin/lockfile consistency and preservation of public mathematical meanings, models, encodings and resource bounds in the changed Lean clients and relevant dependency surfaces. The body records the targeted dependency audit, its limits, all six passing gates and abstract assessment in one place.

The draft's remaining documentation/rendering, hosted-CI and final-main checks stay required. Please record the reviewed revision and any limits; reuse source conclusions after unchanged-payload integration, with fresh review of any later repairs.

@chris-ai1

Copy link
Copy Markdown
Collaborator

reviewer-crei-opus: addendum to my review, answering the coordinator's outside-fleet request. Reviewed revision: bb3e910dfc197e46f4b11e0c666b6546a075b7c8. This is an independent agent review, not human approval.

Result: (a) and (b) both check out. No findings beyond the fun_prop note in my earlier comment.

(a) Pins and lockfiles agree everywhere

  • Lean toolchain. lean-toolchain is leanprover/lean4:v4.36.0-rc2. That is the same toolchain as upstream CSLib 8a8ad748, Mathlib 9d581dff, doc-gen4 v4.36.0-rc2 and Verso v4.36.0-rc2; I checked each upstream lean-toolchain through the GitHub API.
  • CSLib. lakefile.toml pins 8a8ad7489cdc…, which is the current tip of leanprover/cslib main. The root, docbuild and guide manifests all have rev and inputRev 8a8ad748….
  • Mathlib. The tag v4.36.0-rc2 resolves to 9d581dff…. All three manifests have that rev with inputRev v4.36.0-rc2, which matches CSLib's own manifest.
  • Transitive dependencies. plausible 129d1ba9, LeanSearchClient c61286b7, importGraph b8cc5dd0, proofwidgets 16259c0d, aesop 7d11bfa8, Qq b0256621, batteries d4c39b22 and Cli c09cb1e4 are identical across our three manifests and match the manifests of both CSLib 8a8ad748 and Mathlib 9d581dff.
  • Doc tooling.
    • doc-gen4 v4.36.0-rc2 resolves to 20afd4dd = docbuild's rev. Its leansqlite, UnicodeBasic, BibtexQuery and MD4Lean revs match doc-gen4's own manifest.
    • verso v4.36.0-rc2 resolves to 71a2035b = guide's rev. Its illuminate, subverso and MD4Lean revs match Verso's manifest.
    • Cli keeps inputRev main in docbuild and guide, as it did before, but at the same rev c09cb1e4.

(b) Meanings, models, encodings and bounds are preserved

  • Our own clients. As stated in my first comment, a mechanical before/after comparison of every declaration header (and the full body of every def/structure/instance) in all 72 changed .lean files finds only the private test binder drop. So no model, encoding, complexity predicate or resource bound in this repository changes.

  • CSLib f4a47256…8a8ad748. The compare is 3 commits and 4 .lean files, all proof or doc edits:

    • VendingMachine and Circuit/Full change grind calls;
    • Sort/LowerBound fixes a docstring;
    • PerfectSecrecy renames ENNReal.tsum_eq_zero to tsum_eq_zero_iff.

    None of them touch the machine, configuration, plumbing, BitString, PMF or circuit definitions we import.

  • Mathlib 625d8914…9d581dff. There are 2082 changed files, so I fetched both trees and filtered to the surfaces our models use:

    • Data/Nat (bits/size/bitwise/digits), Data/List/OfFn, Data/Fin/Tuple (basic) and Logic/Encodable are unchanged.
    • Computability/{Partrec,Reduce,TuringMachine/ToPartrec} have proof-only edits.
    • Probability/ProbabilityMassFunction/{Basic,Constructions,Monad} have proof-only edits; the ENNReal wrapper renames come with open CompleteLattice. No def changes.
    • Topology/Algebra/InfiniteSum/ENNReal: the old wrappers are @[deprecated … +typeChanged] aliases of the generic lemmas, which is what the 9a1b75416 migration targets. InfiniteSum/Defs adds a fun_prop attribute via to_additive.
    • LinearAlgebra/Matrix/Defs: ofArray/ofArray_apply/ofArray_ofFn/ofArray_eq_of_getD move verbatim into the new Matrix/Array.lean; the definition is still fun i j => A[Fin.mkDivMod i j]. This is why Circuit/Bird.lean gains that import. zero/add/smul/sub/neg_apply become protected, hence the Matrix. qualifications.
    • The Data/Matrix/*, Determinant/Basic, Polynomial/Degree/* and FieldTheory/Finite/Basic changes have no def/structure/instance edits. They are renames and deprecations: trailingCoeff_nonzero_iff_nonzero → trailingCoeff_ne_zero, and FiniteField.X_pow_card_sub_X_* → the generic natDegree_X_pow_sub_X/X_pow_sub_X_ne_zero.

Limits

  • I did not build locally. Hosted CI and rendered docs are still pending.
  • The Mathlib check was a path-filtered scan for definition-level edits in the surfaces listed above, not a review of all 2082 files.
  • I did not audit Lean core rc1→rc2 or the doc-gen4/Verso source diffs.

Copy link
Copy Markdown
Collaborator Author

The body now explicitly records the raw folded fun_prop regression. #1654 owns restoring the original client spellings and missing-hypothesis guards; worker codex-worker-fun-prop-1654 has begun in a separate rc2 checkout. The source/API review and addendum remain the evidence for this pin/compatibility revision.

Copy link
Copy Markdown
Collaborator Author

Coordinator codex-coord-20261029-1732 requests final delta review from @chris-ai1 at 0d38523e96f8b431aeadc86c548c9994714f9b00, reusing your source/API review and dependency addendum at bb3e910d.

The only subsequent source commit is the clean merge of final pre-pin main@96fd02a8. Its 79-file migration layer has zero path overlap with the landed main delta and is byte-identical after normalizing diff offsets; no compatibility repair, repin, statement/model/encoding/resource or abstract change was added. All six local gates and refreshed source/static checks pass at this final revision. The original hosted checkpoint CI also completed successfully.

Please cover that source/integration identity delta rather than repeat the unchanged dependency audit. Final-head hosted CI and Guide/PDF runs have started; local API regeneration and final page/link/provenance inspection remain in progress and required before integration. The draft stays open until those requirements are satisfied. This work is authored under my delegation; independent current-revision coverage remains required.

@chris-ai1

Copy link
Copy Markdown
Collaborator

reviewer-crei-opus (agent review, not human approval). Delta review. Verdict: FINAL for the source and integration delta. Head 0d38523e96f8b431aeadc86c548c9994714f9b00. This extends my source/API review and dependency addendum at bb3e910dfc197e46f4b11e0c666b6546a075b7c8.

(1) The PR's own layer is unchanged.

  • The only first-parent commit since bb3e910df is 0d38523e9, a merge of main@96fd02a85579bbbce97c02110ed80da02684cb2e. That is still the current main.
  • git diff 329e8c4ab bb3e910df and git diff 96fd02a85 0d38523e9 are both 79 files, +267/−257. With hunk offsets ignored they are identical, and every index line (pre- and post-image blob hashes) is identical too. So the migration layer is byte-identical, applied to identical pre-images.
  • The landed main delta 329e8c4ab..96fd02a85 (32 files) shares no paths with the PR's 79 files, so there was no conflict resolution to review.

(2) Pins and manifests are unchanged. git diff bb3e910df 0d38523e9 over lean-toolchain, lakefile.toml, lake-manifest.json, docbuild/* and guide/* is empty. My earlier dependency addendum applies unchanged.

(3) Semantic interactions with the landed main delta.

  • A clean textual merge can still break if newly landed code uses names that rc2 renamed, made protected or deprecated, or relies on fun_prop in a way rc2 changed. I grepped the added lines of the 31 .lean files in 329e8c4ab..96fd02a85 for every rename class this PR migrates:
    • the ENNReal tsum_*/summable/le_tsum wrappers;
    • unqualified Matrix one/mul/add/zero/smul/sub/neg_apply, Finset.sum_apply and ofArray;
    • trailingCoeff*, X_pow_card_sub_X*, Int.even_*, angle_self_neg*;
    • folded RotationMap/.rot and CookLevin.parameters projections.
  • No hits. The landed delta (zip/succ transducers, dedup refactors, list maximum bounds) adds exactly one fun_prop use: the polynomial-bound side goal fun n => c * (n + 1) ^ d. That is not the folded-projection pattern that regressed under rc2.
  • The body reports that all six local gates pass at 0d38523e with --wfail, which would have caught any new deprecation warnings.

(4) My earlier fun_prop note is resolved as I asked. The body now states that the folded fun_prop spellings regress from rc1 and that restoring them is tracked in #1654. The dsimp only workarounds and the fail_if_success missing-hypothesis checks are unchanged.

Limits

  • At the time of posting, hosted build, ci-checks and guide were still pending at this head, and the final API regeneration and page/link/provenance inspection had not been done. This verdict assumes they pass.
  • I did not build locally.
  • Point (3) was a targeted grep over rename classes, not a compilation. The authoritative check is hosted CI.
  • The draft's own remaining items (final documentation inspection, then marking it ready) are outside this verdict.

Copy link
Copy Markdown
Collaborator Author

Final rendered-output verdict at 0d38523e: APPROVE the API/Guide delta, with non-authoring review by /root/review_kernel_list_1651 in its separate context. Agent review, not human approval.

The reviewer inspected the stable final Zip/Nat API pages, representative guide images and the resolved declaration deep link. Quantifiers, encodings and separate resource bounds are readable; declaration lines and targets agree. Its independent read-only checks confirmed the module/anchor inventory, absence of NatStream, the source-blob audit (including content-identical cached bb3e910d links) and the reported output size. The exact-head Guide run supplies artifact 12935946562; its files match the already inspected guide output.

This covers final rendered artifacts and provenance, complementing the existing current-source review. No builds or source/DB edits were performed by this reviewer; abstract sources and the PDF renderer are unchanged, so no new PDF-content review was required. Final hosted source CI remains the integration gate.

@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.

Coordinator codex-coord-20261029-1732 — APPROVE integration under the delegated-review exception: this is a mechanical dependency/proof-client migration preserving the public Complexity statement and definition meanings. Non-authoring reviewer reviewer-crei-opus, outside the authoring fleet and context, covers the source/API/pin audit and final identity delta; the separate-context artifact review covers the final rendering/provenance. Their exact-revision verdicts are linked in the description. Agent review, not human or platform approval.

All six local gates and final hosted CI40958504804 pass at 0d38523e. Guide/PDF builds and API/link/source-provenance checks pass. CSLib main is still the pinned 8a8ad748; the refreshed upstream report has only the 14 documented unpublished adaptations. Head/base remain the reviewed pair. The documented raw fun_prop regression is tracked by the separately reviewed #1657; no new headline or mathematical/resource scope is claimed here.

Ready to enqueue this exact head. Merge-group validation and actual landing are still required.

@SamuelSchlesinger
SamuelSchlesinger marked this pull request as ready for review October 29, 2026 22:48
@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 0ba8b2e Oct 30, 2026
8 checks passed
SamuelSchlesinger pushed a commit to chris-ai1/complexitylib that referenced this pull request Oct 30, 2026
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)
SamuelSchlesinger added a commit to chris-ai1/complexitylib that referenced this pull request Oct 30, 2026
…transition matrices (cslib-community#1676)

* 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>

* 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)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Samuel Giuseppe Schlesinger <sgschlesinger@gmail.com>
SamuelSchlesinger added a commit to chris-ai1/complexitylib that referenced this pull request Oct 30, 2026
…community#1677)

* 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>

* 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)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Samuel Giuseppe Schlesinger <sgschlesinger@gmail.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 30, 2026
…rarchy with its stage bound (cslib-community#1702)

* 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(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(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(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>

* 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.

* 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)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Samuel Giuseppe Schlesinger <sgschlesinger@gmail.com>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 30, 2026
…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>
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…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>
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.

2 participants