chore: Fin.castLE consistency + README version drift fix#21
Merged
Conversation
Two open-coded initial-segment inclusions are replaced with the mathlib spelling `Fin.castLE`. Both substitutions are in let-bindings inside proof bodies (statements unchanged): - Exchangeability/Contractability.lean:470 — `contractable_of_exchangeable` call site: `let ι := fun i => ⟨i.val, Nat.lt_of_lt_of_le i.isLt hmn⟩` -> `let ι := Fin.castLE hmn`. Existing `simpa [ι]` and `simp [..., ι]` unfold the new RHS the same way; no other proof changes needed. - Exchangeability/Util/FinsetHelpers.lean:32 — `filter_val_lt_card`: same substitution; the inline `hf_inj` proof collapses to `Fin.castLE_injective h`, and the `Finset.image` branch's `simp only [f]` steps simplify directly via `Fin.ext rfl` / `rintro ⟨j, rfl⟩`. (`Contractability.lean:408` was deliberately left alone — that `let` is inside a lemma statement, not the proof body, and the agreed scope is proof-body-only churn.) README.md:51 was still claiming `lean-toolchain` was pinned to 4.27.0-rc1; the v4.30.0-rc2 bump (#17) missed updating it. Rather than re-pin and re-drift, point at the file itself: "(see `lean-toolchain` for the pinned version)".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Small batched cleanup PR with two unrelated-but-trivial items:
Fin.castLEconsistency — two open-codedfun i => ⟨i.val, Nat.lt_of_lt_of_le i.isLt h⟩inclusions are replaced with the mathlib spellingFin.castLE h. The codebase already usesFin.castLEin many places (Core.lean, the recently refactoredContractability.exists_perm_extending_strictMonofrom refactor: thin exists_perm_extending_strictMono via mathlib API (−46 lines) #18, and the newCore.exists_approxPermfrom refactor: route Core.approxPerm through Equiv.Perm.exists_extending_pair (−31 lines) #20); these two sites had been missed.README.md:51still claimedlean-toolchainwas pinned to4.27.0-rc1; the v4.30.0-rc2 bump (bump Lean to v4.30.0-rc2 + mathlib v4.30.0-rc2 #17) missed updating it. Rather than re-pin (and re-drift on the next bump), point at the file itself.Net diff: 3 files, +7 / −13 (−6 lines).
What changed
Lean (proof-body-only, statements unchanged)
Exchangeability/Contractability.lean:470contractable_of_exchangeablecall sitelet ι := fun i => ⟨i.val, Nat.lt_of_lt_of_le i.isLt hmn⟩→let ι := Fin.castLE hmn. Existingsimpa [ι]andsimp [..., ι]calls work unchanged (still unfold the let).Exchangeability/Util/FinsetHelpers.lean:32filter_val_lt_cardletsubstitution. Inlinehf_injcollapses from a 3-line proof toFin.castLE_injective h. TheFinset.imageext-step'ssimp only [f]is replaced by directFin.ext rfl/rintro ⟨j, rfl⟩.Contractability.lean:408was deliberately left alone — thatletis inside a lemma statement (not the proof body), and per agreed scope this PR is proof-body-only churn. A statement-level cleanup pass can address it later if desired.Docs
README.md:51(this project uses lean-toolchain pinned to 4.27.0-rc1)(see lean-toolchain for the pinned version)This makes the README impervious to future bump drift.
Verification
lake buildExchangeability+ForMathlib)Notes for review
Fin.castLEcleanup atContractability.lean:408is out of scope; it's inside a lemma statement.Kernel.IndepFun.compand other PR chore: autoGolf proof bodies across 61 files (−841 lines) #16 safe-subset replacements.