Derangements on types #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
In this file we define derangements α, the set of derangements on a type α.
We also define some equivalences involving various subtypes of perm α and derangements α:
derangements_option_equiv_sigma_at_most_one_fixed_point: An equivalence betweenderangements (option α)and the sigma-typeΣ a : α, {f : perm α // fixed_points f ⊆ a}.derangements_recursion_equiv: An equivalence betweenderangements (option α)and the sigma-typeΣ a : α, (derangements (({a}ᶜ : set α) : Type _) ⊕ derangements α)which is later used to inductively count the number of derangements.
In order to prove the above, we also prove some results about the effect of equiv.remove_none
on derangements: remove_none.fiber_none and remove_none.fiber_some.
A permutation is a derangement if it has no fixed points.
Equations
- derangements α = {f : equiv.perm α | ∀ (x : α), ⇑f x ≠ x}
Instances for derangements
Instances for ↥derangements
If α is equivalent to β, then derangements α is equivalent to derangements β.
Equations
Derangements on a subtype are equivalent to permutations on the original type where points are fixed iff they are not in the subtype.
Equations
- derangements.subtype_equiv p = (((equiv.perm.subtype_equiv_subtype_perm p).subtype_equiv _).trans (equiv.subtype_subtype_equiv_subtype_exists (λ (f : equiv.perm α), ∀ (a : α), ¬p a → a ∈ function.fixed_points ⇑f) (λ (f : {f // ∀ (a : α), ¬p a → a ∈ function.fixed_points ⇑f}), ∀ (a : α), a ∈ function.fixed_points ⇑f → ¬p a))).trans (equiv.subtype_equiv_right _)
The set of permutations that fix either a or nothing is equivalent to the sum of:
- derangements on
α - derangements on
αminusa.
Equations
- derangements.at_most_one_fixed_point_equiv_sum_derangements a = (((equiv.sum_compl (λ (f : {f // function.fixed_points ⇑f ⊆ {a}}), a ∈ function.fixed_points ⇑f)).symm.trans ((_.mpr (equiv.subtype_subtype_equiv_subtype_inter (λ (f : equiv.perm α), function.fixed_points ⇑f ⊆ {a}) (λ (f : equiv.perm α), a ∈ function.fixed_points ⇑f))).sum_congr (_.mpr (equiv.subtype_subtype_equiv_subtype_inter (λ (f : equiv.perm α), function.fixed_points ⇑f ⊆ {a}) (λ (f : equiv.perm α), a ∉ function.fixed_points ⇑f))))).trans ((equiv.subtype_equiv_right _).sum_congr (equiv.subtype_equiv_right _))).trans (((derangements.subtype_equiv (λ (x : α), x ∈ {a}ᶜ)).trans (equiv.subtype_equiv_right _)).symm.sum_congr (equiv.subtype_equiv_right derangements.at_most_one_fixed_point_equiv_sum_derangements._proof_6))
The set of permutations f such that the preimage of (a, f) under
equiv.perm.decompose_option is a derangement.
Equations
- derangements.equiv.remove_none.fiber a = {f : equiv.perm α | (a, f) ∈ ⇑equiv.perm.decompose_option '' derangements (option α)}
For any a : α, the fiber over some a is the set of permutations
where a is the only possible fixed point.
The set of derangements on option α is equivalent to the union over a : α
of "permutations with a the only possible fixed point".
Equations
- derangements.derangements_option_equiv_sigma_at_most_one_fixed_point = (((equiv.perm.decompose_option.image (derangements (option α))).trans (equiv.set_prod_equiv_sigma (⇑equiv.perm.decompose_option '' derangements (option α)))).trans (equiv.sigma_option_equiv_of_some (λ (a : option α), ↥(derangements.equiv.remove_none.fiber a)) derangements.derangements_option_equiv_sigma_at_most_one_fixed_point._proof_1)).trans (derangements.derangements_option_equiv_sigma_at_most_one_fixed_point._proof_2.mpr (equiv.refl (Σ (a : α), ↥{f : equiv.perm α | function.fixed_points ⇑f ⊆ {a}})))
The set of derangements on option α is equivalent to the union over all a : α of
"derangements on α ⊕ derangements on {a}ᶜ".