[Merged by Bors] - feat(Logic/Equiv/Fintype): generalize toCompl to finite source; add exists_extending_pair#34599
Closed
cameronfreer wants to merge 33 commits intoleanprover-community:masterfrom
Closed
Conversation
…ermutations Add lemmas for extending injective functions `Fin m → Fin n` to permutations of `Fin n`. - `Equiv.Perm.exists_extending_injective`: Any injective `k : Fin m → Fin n` extends to `σ : Perm (Fin n)` with `σ (Fin.castLE hmn i) = k i` - `Equiv.Perm.exists_extending_strictMono`: Special case for strictly monotone functions
Make docstrings more concise per mathlib style guidelines.
PR summary 865d150803Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
LLaurance
reviewed
Jan 30, 2026
Use `Fin.le_of_injective` to derive `m ≤ n` automatically from the injectivity hypothesis, simplifying the API.
tb65536
reviewed
Feb 3, 2026
tb65536
reviewed
Feb 3, 2026
…emma Remove `Equiv.Perm.exists_extending_strictMono` since it's a trivial special case of `exists_extending_injective` (just apply `.injective`).
`Mathlib.Logic.Equiv.Fintype` is already imported transitively via `Cycle.Type` → `Cycle.Factors` → `Cycle.Basic` → `Perm.Finite`.
tb65536
reviewed
Feb 3, 2026
Add a general theorem stating that any two injective functions from a finite type to a finite type can be related by a permutation. This is the elementary form of the multiple pretransitivity of permutation groups (see `Equiv.Perm.isMultiplyPretransitive`).
Simplify `exists_extending_injective` to a one-line corollary of the new general `Perm.exists_extending_pair` theorem.
The `Finite β` constraint suffices since the ranges are subsets of `β`.
tb65536
reviewed
Feb 3, 2026
…yPretransitive proof Use `Equiv.subtypeCongr` with `ofInjective` to build the permutation directly, eliminating the 57-line manual bijectivity proof via `Function.extend` and `Equiv.ofBijective`. The complement equivalence is still obtained via cardinal arithmetic.
…_extending_pair Add `Equiv.Perm.exists_extending_pair'` which generalizes `exists_extending_pair` from `[Finite β]` (target finite) to `[Finite α]` (source finite), using cardinal arithmetic for the complement equivalence. This allows the target type to be infinite. Use it to further simplify `isMultiplyPretransitive` to a 3-line proof.
The hypothesis is `[Finite β]` (target finite), not `[Finite α]`. Add cross-reference to the generalized `exists_extending_pair'`.
This was a one-line specialization of `exists_extending_pair` with no downstream uses. Callers can use `exists_extending_pair` directly. Also remove the now-unused `Mathlib.Data.Fin.Pigeonhole` import.
Rename `exists_extending_pair'` to `exists_extending_pair_of_finite_source` for discoverability, and add `exists_smul_eq_embedding` as the action-form wrapper. This reduces `isMultiplyPretransitive` to a two-line proof. Update cross-reference in `Fintype.lean` docstring accordingly.
…ite {x | p x}]
Generalize `toCompl` and related definitions (`extendSubtype`, etc.)
to only require finiteness of the subtype `{x | p x}` rather than
the ambient type `α`. This allows `exists_extending_pair` to be
strengthened from `[Finite β]` to `[Finite α]`.
Co-authored-by: tb65536 <tb65536@users.noreply.github.com>
Replace 4 `grind` calls (experimental tactic) with stable alternatives: - Set identities: `ext; simp; tauto` - Disjointness: term-mode proof via `disjoint_compl_right.mono_left`
…f_finite_source Remove `exists_extending_pair_of_finite_source` which is now redundant since `Equiv.Perm.exists_extending_pair` has been generalized from `[Finite β]` to `[Finite α]`. Update `exists_smul_eq_embedding` to use `exists_extending_pair` directly.
|
This pull request has conflicts, please merge |
Keep our short `isMultiplyPretransitive` proof via `exists_smul_eq_embedding`, discarding the upstream grind-golfed version of the old long proof.
tb65536
reviewed
Mar 7, 2026
Fix upstream regression in `extendSubtype_apply_of_not_mem` by using
`simp only` + `rfl` instead of `simp`. Remove redundant `{α β : Type*}`
from `Perm.exists_extending_pair` since they are already in scope.
Member
|
Can we please have a human written PR description that says in a couple of lines what the PR does? It is currently almost as long as the diff. Thanks! |
Extract the finset sdiff cardinality argument from `toCompl` into `Equiv.setDiffEquiv`, and fix lint warnings in `Perm.exists_map_finset_eq`.
26ac0e1 to
a424062
Compare
a424062 to
8691629
Compare
mathlib-bors bot
pushed a commit
that referenced
this pull request
Apr 2, 2026
…xists_extending_pair (#34599) Generalize `Equiv.toCompl` from `[Finite α]` to `[Finite {x | p x}]`, which allows the target type to be infinite. In the process we add `Perm.exists_extending_pair` (given injections `f, g : α → β` for finite `α`, there is some `σ : Perm β` s.t. `σ ∘ f = g`) and `Perm.exists_map_finset_eq`. This lets us simplify`Perm.isMultiplyPretransitive` from 70 lines to 2 lines, avoiding cardinal arithmetic. A [version of this](https://github.com/cameronfreer/exchangeability/blob/03a854a2/Exchangeability/Contractability.lean#L459) was used in formalizing de Finetti's theorem. Co-authored-by: tb65536 <tb65536@users.noreply.github.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Contributor
|
Pull request successfully merged into master. Build succeeded:
|
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.
Generalize
Equiv.toComplfrom[Finite α]to[Finite {x | p x}], which allows the target type to be infinite. In the process we addPerm.exists_extending_pair(given injectionsf, g : α → βfor finiteα, there is someσ : Perm βs.t.σ ∘ f = g) andPerm.exists_map_finset_eq.This lets us simplify
Perm.isMultiplyPretransitivefrom 70 lines to 2 lines, avoiding cardinal arithmetic.A version of this was used in formalizing de Finetti's theorem.
Co-authored-by: tb65536 tb65536@users.noreply.github.com