combinatorics.derangements.basic
⟷
Mathlib.Combinatorics.Derangements.Basic
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -101,7 +101,7 @@ def atMostOneFixedPointEquivSum_derangements [DecidableEq α] (a : α) :
_ ≃ Sum { f : Perm α // fixedPoints f = {a} } { f : Perm α // fixedPoints f = ∅ } :=
by
refine' Equiv.sumCongr (subtype_equiv_right fun f => _) (subtype_equiv_right fun f => _)
- · rw [Set.eq_singleton_iff_unique_mem, and_comm']
+ · rw [Set.eq_singleton_iff_unique_mem, and_comm]
rfl
· rw [Set.eq_empty_iff_forall_not_mem]
refine' ⟨fun h x hx => h.2 (h.1 hx ▸ hx), fun h => ⟨fun x hx => (h _ hx).elim, h _⟩⟩
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -69,7 +69,7 @@ protected def subtypeEquiv (p : α → Prop) [DecidablePred p] :
refine' (perm.subtype_equiv_subtype_perm p).subtypeEquiv fun f => ⟨fun hf a hfa ha => _, _⟩
· refine' hf ⟨a, ha⟩ (Subtype.ext _)
rwa [mem_fixed_points, is_fixed_pt, perm.subtype_equiv_subtype_perm, @coeFn_coe_base',
- Equiv.coe_fn_mk, Subtype.coe_mk, Equiv.Perm.ofSubtype_apply_of_mem] at hfa
+ Equiv.coe_fn_mk, Subtype.coe_mk, Equiv.Perm.ofSubtype_apply_of_mem] at hfa
rintro hf ⟨a, ha⟩ hfa
refine' hf _ _ ha
change perm.subtype_equiv_subtype_perm p f a = a
@@ -140,7 +140,7 @@ theorem RemoveNone.fiber_none : RemoveNone.fiber (@none α) = ∅ :=
by
rw [Set.eq_empty_iff_forall_not_mem]
intro f hyp
- rw [remove_none.mem_fiber] at hyp
+ rw [remove_none.mem_fiber] at hyp
rcases hyp with ⟨F, F_derangement, F_none, _⟩
exact F_derangement none F_none
#align derangements.equiv.remove_none.fiber_none derangements.Equiv.RemoveNone.fiber_none
@@ -156,11 +156,11 @@ theorem RemoveNone.fiber_some (a : α) :
constructor
· rw [remove_none.mem_fiber]
rintro ⟨F, F_derangement, F_none, rfl⟩ x x_fixed
- rw [mem_fixed_points_iff] at x_fixed
- apply_fun some at x_fixed
+ rw [mem_fixed_points_iff] at x_fixed
+ apply_fun some at x_fixed
cases' Fx : F (some x) with y
- · rwa [remove_none_none F Fx, F_none, Option.some_inj, eq_comm] at x_fixed
- · exfalso; rw [remove_none_some F ⟨y, Fx⟩] at x_fixed ; exact F_derangement _ x_fixed
+ · rwa [remove_none_none F Fx, F_none, Option.some_inj, eq_comm] at x_fixed
+ · exfalso; rw [remove_none_some F ⟨y, Fx⟩] at x_fixed; exact F_derangement _ x_fixed
· intro h_opfp
use equiv.perm.decompose_option.symm (some a, f)
constructor
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,10 +3,10 @@ Copyright (c) 2021 Henry Swanson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Henry Swanson
-/
-import Mathbin.Dynamics.FixedPoints.Basic
-import Mathbin.GroupTheory.Perm.Option
-import Mathbin.Logic.Equiv.Defs
-import Mathbin.Logic.Equiv.Option
+import Dynamics.FixedPoints.Basic
+import GroupTheory.Perm.Option
+import Logic.Equiv.Defs
+import Logic.Equiv.Option
#align_import combinatorics.derangements.basic from "leanprover-community/mathlib"@"97eab48559068f3d6313da387714ef25768fb730"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,17 +2,14 @@
Copyright (c) 2021 Henry Swanson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Henry Swanson
-
-! This file was ported from Lean 3 source module combinatorics.derangements.basic
-! leanprover-community/mathlib commit 97eab48559068f3d6313da387714ef25768fb730
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Dynamics.FixedPoints.Basic
import Mathbin.GroupTheory.Perm.Option
import Mathbin.Logic.Equiv.Defs
import Mathbin.Logic.Equiv.Option
+#align_import combinatorics.derangements.basic from "leanprover-community/mathlib"@"97eab48559068f3d6313da387714ef25768fb730"
+
/-!
# Derangements on types
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -208,6 +208,7 @@ def derangementsOptionEquivSigmaAtMostOneFixedPoint :
#align derangements.derangements_option_equiv_sigma_at_most_one_fixed_point derangements.derangementsOptionEquivSigmaAtMostOneFixedPoint
-/
+#print derangements.derangementsRecursionEquiv /-
/-- The set of derangements on `option α` is equivalent to the union over all `a : α` of
"derangements on `α` ⊕ derangements on `{a}ᶜ`". -/
def derangementsRecursionEquiv :
@@ -216,6 +217,7 @@ def derangementsRecursionEquiv :
derangementsOptionEquivSigmaAtMostOneFixedPoint.trans
(sigmaCongrRight atMostOneFixedPointEquivSum_derangements)
#align derangements.derangements_recursion_equiv derangements.derangementsRecursionEquiv
+-/
end Option
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -82,7 +82,6 @@ protected def subtypeEquiv (p : α → Prop) [DecidablePred p] :
_ ≃ { f : Perm α // ∀ a, ¬p a ↔ a ∈ fixedPoints f } :=
subtypeEquivRight fun f => by
simp_rw [exists_prop, ← forall_and, ← iff_iff_implies_and_implies]
-
#align derangements.subtype_equiv derangements.subtypeEquiv
-/
@@ -116,7 +115,6 @@ def atMostOneFixedPointEquivSum_derangements [DecidableEq α] (a : α) :
(subtype_equiv_right fun f => mem_derangements_iff_fixed_points_eq_empty.symm)
rw [eq_comm, Set.ext_iff]
simp_rw [Set.mem_compl_iff, Classical.not_not]
-
#align derangements.at_most_one_fixed_point_equiv_sum_derangements derangements.atMostOneFixedPointEquivSum_derangements
-/
@@ -207,7 +205,6 @@ def derangementsOptionEquivSigmaAtMostOneFixedPoint :
_ ≃ Σ a : α, ↥(equiv.remove_none.fiber (some a)) :=
(sigma_option_equiv_of_some _ fiber_none_is_false)
_ ≃ Σ a : α, {f : perm α | fixed_points f ⊆ {a}} := by simp_rw [equiv.remove_none.fiber_some]
-
#align derangements.derangements_option_equiv_sigma_at_most_one_fixed_point derangements.derangementsOptionEquivSigmaAtMostOneFixedPoint
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -38,7 +38,7 @@ open Equiv Function
#print derangements /-
/-- A permutation is a derangement if it has no fixed points. -/
def derangements (α : Type _) : Set (Perm α) :=
- { f : Perm α | ∀ x : α, f x ≠ x }
+ {f : Perm α | ∀ x : α, f x ≠ x}
#align derangements derangements
-/
@@ -128,7 +128,7 @@ variable [DecidableEq α]
/-- The set of permutations `f` such that the preimage of `(a, f)` under
`equiv.perm.decompose_option` is a derangement. -/
def RemoveNone.fiber (a : Option α) : Set (Perm α) :=
- { f : Perm α | (a, f) ∈ Equiv.Perm.decomposeOption '' derangements (Option α) }
+ {f : Perm α | (a, f) ∈ Equiv.Perm.decomposeOption '' derangements (Option α)}
#align derangements.equiv.remove_none.fiber derangements.Equiv.RemoveNone.fiber
-/
@@ -155,14 +155,14 @@ theorem RemoveNone.fiber_none : RemoveNone.fiber (@none α) = ∅ :=
/-- For any `a : α`, the fiber over `some a` is the set of permutations
where `a` is the only possible fixed point. -/
theorem RemoveNone.fiber_some (a : α) :
- RemoveNone.fiber (some a) = { f : Perm α | fixedPoints f ⊆ {a} } :=
+ RemoveNone.fiber (some a) = {f : Perm α | fixedPoints f ⊆ {a}} :=
by
ext f
constructor
· rw [remove_none.mem_fiber]
rintro ⟨F, F_derangement, F_none, rfl⟩ x x_fixed
rw [mem_fixed_points_iff] at x_fixed
- apply_fun some at x_fixed
+ apply_fun some at x_fixed
cases' Fx : F (some x) with y
· rwa [remove_none_none F Fx, F_none, Option.some_inj, eq_comm] at x_fixed
· exfalso; rw [remove_none_some F ⟨y, Fx⟩] at x_fixed ; exact F_derangement _ x_fixed
@@ -196,7 +196,7 @@ variable [DecidableEq α]
/-- The set of derangements on `option α` is equivalent to the union over `a : α`
of "permutations with `a` the only possible fixed point". -/
def derangementsOptionEquivSigmaAtMostOneFixedPoint :
- derangements (Option α) ≃ Σ a : α, { f : Perm α | fixedPoints f ⊆ {a} } :=
+ derangements (Option α) ≃ Σ a : α, {f : Perm α | fixedPoints f ⊆ {a}} :=
by
have fiber_none_is_false : equiv.remove_none.fiber (@none α) → False := by
rw [equiv.remove_none.fiber_none]; exact IsEmpty.false
@@ -206,7 +206,7 @@ def derangementsOptionEquivSigmaAtMostOneFixedPoint :
_ ≃ Σ a : Option α, ↥(equiv.remove_none.fiber a) := (set_prod_equiv_sigma _)
_ ≃ Σ a : α, ↥(equiv.remove_none.fiber (some a)) :=
(sigma_option_equiv_of_some _ fiber_none_is_false)
- _ ≃ Σ a : α, { f : perm α | fixed_points f ⊆ {a} } := by simp_rw [equiv.remove_none.fiber_some]
+ _ ≃ Σ a : α, {f : perm α | fixed_points f ⊆ {a}} := by simp_rw [equiv.remove_none.fiber_some]
#align derangements.derangements_option_equiv_sigma_at_most_one_fixed_point derangements.derangementsOptionEquivSigmaAtMostOneFixedPoint
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -72,7 +72,7 @@ protected def subtypeEquiv (p : α → Prop) [DecidablePred p] :
refine' (perm.subtype_equiv_subtype_perm p).subtypeEquiv fun f => ⟨fun hf a hfa ha => _, _⟩
· refine' hf ⟨a, ha⟩ (Subtype.ext _)
rwa [mem_fixed_points, is_fixed_pt, perm.subtype_equiv_subtype_perm, @coeFn_coe_base',
- Equiv.coe_fn_mk, Subtype.coe_mk, Equiv.Perm.ofSubtype_apply_of_mem] at hfa
+ Equiv.coe_fn_mk, Subtype.coe_mk, Equiv.Perm.ofSubtype_apply_of_mem] at hfa
rintro hf ⟨a, ha⟩ hfa
refine' hf _ _ ha
change perm.subtype_equiv_subtype_perm p f a = a
@@ -145,7 +145,7 @@ theorem RemoveNone.fiber_none : RemoveNone.fiber (@none α) = ∅ :=
by
rw [Set.eq_empty_iff_forall_not_mem]
intro f hyp
- rw [remove_none.mem_fiber] at hyp
+ rw [remove_none.mem_fiber] at hyp
rcases hyp with ⟨F, F_derangement, F_none, _⟩
exact F_derangement none F_none
#align derangements.equiv.remove_none.fiber_none derangements.Equiv.RemoveNone.fiber_none
@@ -161,11 +161,11 @@ theorem RemoveNone.fiber_some (a : α) :
constructor
· rw [remove_none.mem_fiber]
rintro ⟨F, F_derangement, F_none, rfl⟩ x x_fixed
- rw [mem_fixed_points_iff] at x_fixed
- apply_fun some at x_fixed
+ rw [mem_fixed_points_iff] at x_fixed
+ apply_fun some at x_fixed
cases' Fx : F (some x) with y
- · rwa [remove_none_none F Fx, F_none, Option.some_inj, eq_comm] at x_fixed
- · exfalso; rw [remove_none_some F ⟨y, Fx⟩] at x_fixed; exact F_derangement _ x_fixed
+ · rwa [remove_none_none F Fx, F_none, Option.some_inj, eq_comm] at x_fixed
+ · exfalso; rw [remove_none_some F ⟨y, Fx⟩] at x_fixed ; exact F_derangement _ x_fixed
· intro h_opfp
use equiv.perm.decompose_option.symm (some a, f)
constructor
@@ -196,17 +196,17 @@ variable [DecidableEq α]
/-- The set of derangements on `option α` is equivalent to the union over `a : α`
of "permutations with `a` the only possible fixed point". -/
def derangementsOptionEquivSigmaAtMostOneFixedPoint :
- derangements (Option α) ≃ Σa : α, { f : Perm α | fixedPoints f ⊆ {a} } :=
+ derangements (Option α) ≃ Σ a : α, { f : Perm α | fixedPoints f ⊆ {a} } :=
by
have fiber_none_is_false : equiv.remove_none.fiber (@none α) → False := by
rw [equiv.remove_none.fiber_none]; exact IsEmpty.false
calc
derangements (Option α) ≃ Equiv.Perm.decomposeOption '' derangements (Option α) :=
Equiv.image _ _
- _ ≃ Σa : Option α, ↥(equiv.remove_none.fiber a) := (set_prod_equiv_sigma _)
- _ ≃ Σa : α, ↥(equiv.remove_none.fiber (some a)) :=
+ _ ≃ Σ a : Option α, ↥(equiv.remove_none.fiber a) := (set_prod_equiv_sigma _)
+ _ ≃ Σ a : α, ↥(equiv.remove_none.fiber (some a)) :=
(sigma_option_equiv_of_some _ fiber_none_is_false)
- _ ≃ Σa : α, { f : perm α | fixed_points f ⊆ {a} } := by simp_rw [equiv.remove_none.fiber_some]
+ _ ≃ Σ a : α, { f : perm α | fixed_points f ⊆ {a} } := by simp_rw [equiv.remove_none.fiber_some]
#align derangements.derangements_option_equiv_sigma_at_most_one_fixed_point derangements.derangementsOptionEquivSigmaAtMostOneFixedPoint
-/
@@ -215,7 +215,7 @@ def derangementsOptionEquivSigmaAtMostOneFixedPoint :
"derangements on `α` ⊕ derangements on `{a}ᶜ`". -/
def derangementsRecursionEquiv :
derangements (Option α) ≃
- Σa : α, Sum (derangements (({a}ᶜ : Set α) : Type _)) (derangements α) :=
+ Σ a : α, Sum (derangements (({a}ᶜ : Set α) : Type _)) (derangements α) :=
derangementsOptionEquivSigmaAtMostOneFixedPoint.trans
(sigmaCongrRight atMostOneFixedPointEquivSum_derangements)
#align derangements.derangements_recursion_equiv derangements.derangementsRecursionEquiv
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -211,12 +211,6 @@ def derangementsOptionEquivSigmaAtMostOneFixedPoint :
#align derangements.derangements_option_equiv_sigma_at_most_one_fixed_point derangements.derangementsOptionEquivSigmaAtMostOneFixedPoint
-/
-/- warning: derangements.derangements_recursion_equiv -> derangements.derangementsRecursionEquiv is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α], Equiv.{succ u1, succ u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} (Equiv.Perm.{succ u1} (Option.{u1} α))) Type.{u1} (Set.hasCoeToSort.{u1} (Equiv.Perm.{succ u1} (Option.{u1} α))) (derangements.{u1} (Option.{u1} α))) (Sigma.{u1, u1} α (fun (a : α) => Sum.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} (Equiv.Perm.{succ u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.hasSingleton.{u1} α) a))))) Type.{u1} (Set.hasCoeToSort.{u1} (Equiv.Perm.{succ u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.hasSingleton.{u1} α) a))))) (derangements.{u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.hasSingleton.{u1} α) a))))) (coeSort.{succ u1, succ (succ u1)} (Set.{u1} (Equiv.Perm.{succ u1} α)) Type.{u1} (Set.hasCoeToSort.{u1} (Equiv.Perm.{succ u1} α)) (derangements.{u1} α))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α], Equiv.{succ u1, succ u1} (Set.Elem.{u1} (Equiv.Perm.{succ u1} (Option.{u1} α)) (derangements.{u1} (Option.{u1} α))) (Sigma.{u1, u1} α (fun (a : α) => Sum.{u1, u1} (Set.Elem.{u1} (Equiv.Perm.{succ u1} (Set.Elem.{u1} α (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.instBooleanAlgebraSet.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.instSingletonSet.{u1} α) a)))) (derangements.{u1} (Set.Elem.{u1} α (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.instBooleanAlgebraSet.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.instSingletonSet.{u1} α) a))))) (Set.Elem.{u1} (Equiv.Perm.{succ u1} α) (derangements.{u1} α))))
-Case conversion may be inaccurate. Consider using '#align derangements.derangements_recursion_equiv derangements.derangementsRecursionEquivₓ'. -/
/-- The set of derangements on `option α` is equivalent to the union over all `a : α` of
"derangements on `α` ⊕ derangements on `{a}ᶜ`". -/
def derangementsRecursionEquiv :
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -101,10 +101,7 @@ def atMostOneFixedPointEquivSum_derangements [DecidableEq α] (a : α) :
Sum { f : Perm α // fixedPoints f ⊆ {a} ∧ a ∈ fixedPoints f }
{ f : Perm α // fixedPoints f ⊆ {a} ∧ a ∉ fixedPoints f } :=
by
- refine' Equiv.sumCongr _ _ <;>
- · convert subtype_subtype_equiv_subtype_inter _ _
- ext f
- rfl
+ refine' Equiv.sumCongr _ _ <;> · convert subtype_subtype_equiv_subtype_inter _ _; ext f; rfl
_ ≃ Sum { f : Perm α // fixedPoints f = {a} } { f : Perm α // fixedPoints f = ∅ } :=
by
refine' Equiv.sumCongr (subtype_equiv_right fun f => _) (subtype_equiv_right fun f => _)
@@ -168,9 +165,7 @@ theorem RemoveNone.fiber_some (a : α) :
apply_fun some at x_fixed
cases' Fx : F (some x) with y
· rwa [remove_none_none F Fx, F_none, Option.some_inj, eq_comm] at x_fixed
- · exfalso
- rw [remove_none_some F ⟨y, Fx⟩] at x_fixed
- exact F_derangement _ x_fixed
+ · exfalso; rw [remove_none_some F ⟨y, Fx⟩] at x_fixed; exact F_derangement _ x_fixed
· intro h_opfp
use equiv.perm.decompose_option.symm (some a, f)
constructor
@@ -181,8 +176,7 @@ theorem RemoveNone.fiber_some (a : α) :
· simp
simp only [Equiv.optionCongr_apply, Option.map_some']
by_cases x_vs_a : x = a
- · rw [x_vs_a, swap_apply_right]
- apply Option.some_ne_none
+ · rw [x_vs_a, swap_apply_right]; apply Option.some_ne_none
have ne_1 : some x ≠ none := Option.some_ne_none _
have ne_2 : some x ≠ some a := (Option.some_injective α).ne_iff.mpr x_vs_a
rw [swap_apply_of_ne_of_ne ne_1 ne_2, (Option.some_injective α).ne_iff]
@@ -204,10 +198,8 @@ variable [DecidableEq α]
def derangementsOptionEquivSigmaAtMostOneFixedPoint :
derangements (Option α) ≃ Σa : α, { f : Perm α | fixedPoints f ⊆ {a} } :=
by
- have fiber_none_is_false : equiv.remove_none.fiber (@none α) → False :=
- by
- rw [equiv.remove_none.fiber_none]
- exact IsEmpty.false
+ have fiber_none_is_false : equiv.remove_none.fiber (@none α) → False := by
+ rw [equiv.remove_none.fiber_none]; exact IsEmpty.false
calc
derangements (Option α) ≃ Equiv.Perm.decomposeOption '' derangements (Option α) :=
Equiv.image _ _
mathlib commit https://github.com/leanprover-community/mathlib/commit/d11893b411025250c8e61ff2f12ccbd7ee35ab15
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Henry Swanson
! This file was ported from Lean 3 source module combinatorics.derangements.basic
-! leanprover-community/mathlib commit 9407b03373c8cd201df99d6bc5514fc2db44054f
+! leanprover-community/mathlib commit 97eab48559068f3d6313da387714ef25768fb730
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -16,6 +16,9 @@ import Mathbin.Logic.Equiv.Option
/-!
# 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 α`:
mathlib commit https://github.com/leanprover-community/mathlib/commit/57e09a1296bfb4330ddf6624f1028ba186117d82
@@ -32,25 +32,32 @@ on derangements: `remove_none.fiber_none` and `remove_none.fiber_some`.
open Equiv Function
+#print derangements /-
/-- A permutation is a derangement if it has no fixed points. -/
def derangements (α : Type _) : Set (Perm α) :=
{ f : Perm α | ∀ x : α, f x ≠ x }
#align derangements derangements
+-/
variable {α β : Type _}
+#print mem_derangements_iff_fixedPoints_eq_empty /-
theorem mem_derangements_iff_fixedPoints_eq_empty {f : Perm α} :
f ∈ derangements α ↔ fixedPoints f = ∅ :=
Set.eq_empty_iff_forall_not_mem.symm
#align mem_derangements_iff_fixed_points_eq_empty mem_derangements_iff_fixedPoints_eq_empty
+-/
+#print Equiv.derangementsCongr /-
/-- If `α` is equivalent to `β`, then `derangements α` is equivalent to `derangements β`. -/
def Equiv.derangementsCongr (e : α ≃ β) : derangements α ≃ derangements β :=
e.permCongr.subtypeEquiv fun f => e.forall_congr' <| by simp
#align equiv.derangements_congr Equiv.derangementsCongr
+-/
namespace derangements
+#print derangements.subtypeEquiv /-
/-- Derangements on a subtype are equivalent to permutations on the original type where points are
fixed iff they are not in the subtype. -/
protected def subtypeEquiv (p : α → Prop) [DecidablePred p] :
@@ -74,11 +81,13 @@ protected def subtypeEquiv (p : α → Prop) [DecidablePred p] :
simp_rw [exists_prop, ← forall_and, ← iff_iff_implies_and_implies]
#align derangements.subtype_equiv derangements.subtypeEquiv
+-/
+#print derangements.atMostOneFixedPointEquivSum_derangements /-
/-- The set of permutations that fix either `a` or nothing is equivalent to the sum of:
- derangements on `α`
- derangements on `α` minus `a`. -/
-def atMostOneFixedPointEquivSumDerangements [DecidableEq α] (a : α) :
+def atMostOneFixedPointEquivSum_derangements [DecidableEq α] (a : α) :
{ f : Perm α // fixedPoints f ⊆ {a} } ≃ Sum (derangements ({a}ᶜ : Set α)) (derangements α) :=
calc
{ f : Perm α // fixedPoints f ⊆ {a} } ≃
@@ -108,24 +117,30 @@ def atMostOneFixedPointEquivSumDerangements [DecidableEq α] (a : α) :
rw [eq_comm, Set.ext_iff]
simp_rw [Set.mem_compl_iff, Classical.not_not]
-#align derangements.at_most_one_fixed_point_equiv_sum_derangements derangements.atMostOneFixedPointEquivSumDerangements
+#align derangements.at_most_one_fixed_point_equiv_sum_derangements derangements.atMostOneFixedPointEquivSum_derangements
+-/
namespace Equiv
variable [DecidableEq α]
+#print derangements.Equiv.RemoveNone.fiber /-
/-- The set of permutations `f` such that the preimage of `(a, f)` under
`equiv.perm.decompose_option` is a derangement. -/
def RemoveNone.fiber (a : Option α) : Set (Perm α) :=
{ f : Perm α | (a, f) ∈ Equiv.Perm.decomposeOption '' derangements (Option α) }
#align derangements.equiv.remove_none.fiber derangements.Equiv.RemoveNone.fiber
+-/
+#print derangements.Equiv.RemoveNone.mem_fiber /-
theorem RemoveNone.mem_fiber (a : Option α) (f : Perm α) :
f ∈ RemoveNone.fiber a ↔
∃ F : Perm (Option α), F ∈ derangements (Option α) ∧ F none = a ∧ removeNone F = f :=
by simp [remove_none.fiber, derangements]
#align derangements.equiv.remove_none.mem_fiber derangements.Equiv.RemoveNone.mem_fiber
+-/
+#print derangements.Equiv.RemoveNone.fiber_none /-
theorem RemoveNone.fiber_none : RemoveNone.fiber (@none α) = ∅ :=
by
rw [Set.eq_empty_iff_forall_not_mem]
@@ -134,7 +149,9 @@ theorem RemoveNone.fiber_none : RemoveNone.fiber (@none α) = ∅ :=
rcases hyp with ⟨F, F_derangement, F_none, _⟩
exact F_derangement none F_none
#align derangements.equiv.remove_none.fiber_none derangements.Equiv.RemoveNone.fiber_none
+-/
+#print derangements.Equiv.RemoveNone.fiber_some /-
/-- For any `a : α`, the fiber over `some a` is the set of permutations
where `a` is the only possible fixed point. -/
theorem RemoveNone.fiber_some (a : α) :
@@ -170,6 +187,7 @@ theorem RemoveNone.fiber_some (a : α) :
exact x_vs_a (h_opfp contra)
· rw [apply_symm_apply]
#align derangements.equiv.remove_none.fiber_some derangements.Equiv.RemoveNone.fiber_some
+-/
end Equiv
@@ -177,6 +195,7 @@ section Option
variable [DecidableEq α]
+#print derangements.derangementsOptionEquivSigmaAtMostOneFixedPoint /-
/-- The set of derangements on `option α` is equivalent to the union over `a : α`
of "permutations with `a` the only possible fixed point". -/
def derangementsOptionEquivSigmaAtMostOneFixedPoint :
@@ -195,14 +214,21 @@ def derangementsOptionEquivSigmaAtMostOneFixedPoint :
_ ≃ Σa : α, { f : perm α | fixed_points f ⊆ {a} } := by simp_rw [equiv.remove_none.fiber_some]
#align derangements.derangements_option_equiv_sigma_at_most_one_fixed_point derangements.derangementsOptionEquivSigmaAtMostOneFixedPoint
+-/
+/- warning: derangements.derangements_recursion_equiv -> derangements.derangementsRecursionEquiv is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α], Equiv.{succ u1, succ u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} (Equiv.Perm.{succ u1} (Option.{u1} α))) Type.{u1} (Set.hasCoeToSort.{u1} (Equiv.Perm.{succ u1} (Option.{u1} α))) (derangements.{u1} (Option.{u1} α))) (Sigma.{u1, u1} α (fun (a : α) => Sum.{u1, u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} (Equiv.Perm.{succ u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.hasSingleton.{u1} α) a))))) Type.{u1} (Set.hasCoeToSort.{u1} (Equiv.Perm.{succ u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.hasSingleton.{u1} α) a))))) (derangements.{u1} (coeSort.{succ u1, succ (succ u1)} (Set.{u1} α) Type.{u1} (Set.hasCoeToSort.{u1} α) (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.booleanAlgebra.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.hasSingleton.{u1} α) a))))) (coeSort.{succ u1, succ (succ u1)} (Set.{u1} (Equiv.Perm.{succ u1} α)) Type.{u1} (Set.hasCoeToSort.{u1} (Equiv.Perm.{succ u1} α)) (derangements.{u1} α))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : DecidableEq.{succ u1} α], Equiv.{succ u1, succ u1} (Set.Elem.{u1} (Equiv.Perm.{succ u1} (Option.{u1} α)) (derangements.{u1} (Option.{u1} α))) (Sigma.{u1, u1} α (fun (a : α) => Sum.{u1, u1} (Set.Elem.{u1} (Equiv.Perm.{succ u1} (Set.Elem.{u1} α (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.instBooleanAlgebraSet.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.instSingletonSet.{u1} α) a)))) (derangements.{u1} (Set.Elem.{u1} α (HasCompl.compl.{u1} (Set.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Set.{u1} α) (Set.instBooleanAlgebraSet.{u1} α)) (Singleton.singleton.{u1, u1} α (Set.{u1} α) (Set.instSingletonSet.{u1} α) a))))) (Set.Elem.{u1} (Equiv.Perm.{succ u1} α) (derangements.{u1} α))))
+Case conversion may be inaccurate. Consider using '#align derangements.derangements_recursion_equiv derangements.derangementsRecursionEquivₓ'. -/
/-- The set of derangements on `option α` is equivalent to the union over all `a : α` of
"derangements on `α` ⊕ derangements on `{a}ᶜ`". -/
def derangementsRecursionEquiv :
derangements (Option α) ≃
Σa : α, Sum (derangements (({a}ᶜ : Set α) : Type _)) (derangements α) :=
derangementsOptionEquivSigmaAtMostOneFixedPoint.trans
- (sigmaCongrRight atMostOneFixedPointEquivSumDerangements)
+ (sigmaCongrRight atMostOneFixedPointEquivSum_derangements)
#align derangements.derangements_recursion_equiv derangements.derangementsRecursionEquiv
end Option
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -68,7 +68,7 @@ protected def subtypeEquiv (p : α → Prop) [DecidablePred p] :
change perm.subtype_equiv_subtype_perm p f a = a
rw [perm.subtype_equiv_subtype_perm_apply_of_mem f ha, hfa, Subtype.coe_mk]
_ ≃ { f : Perm α // ∃ h : ∀ a, ¬p a → a ∈ fixedPoints f, ∀ a, a ∈ fixedPoints f → ¬p a } :=
- subtypeSubtypeEquivSubtypeExists _ _
+ (subtypeSubtypeEquivSubtypeExists _ _)
_ ≃ { f : Perm α // ∀ a, ¬p a ↔ a ∈ fixedPoints f } :=
subtypeEquivRight fun f => by
simp_rw [exists_prop, ← forall_and, ← iff_iff_implies_and_implies]
@@ -189,9 +189,9 @@ def derangementsOptionEquivSigmaAtMostOneFixedPoint :
calc
derangements (Option α) ≃ Equiv.Perm.decomposeOption '' derangements (Option α) :=
Equiv.image _ _
- _ ≃ Σa : Option α, ↥(equiv.remove_none.fiber a) := set_prod_equiv_sigma _
+ _ ≃ Σa : Option α, ↥(equiv.remove_none.fiber a) := (set_prod_equiv_sigma _)
_ ≃ Σa : α, ↥(equiv.remove_none.fiber (some a)) :=
- sigma_option_equiv_of_some _ fiber_none_is_false
+ (sigma_option_equiv_of_some _ fiber_none_is_false)
_ ≃ Σa : α, { f : perm α | fixed_points f ⊆ {a} } := by simp_rw [equiv.remove_none.fiber_some]
#align derangements.derangements_option_equiv_sigma_at_most_one_fixed_point derangements.derangementsOptionEquivSigmaAtMostOneFixedPoint
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -86,7 +86,7 @@ def atMostOneFixedPointEquivSum_derangements [DecidableEq α] (a : α) :
(Equiv.sumCompl _).symm
_ ≃ Sum { f : Perm α // fixedPoints f ⊆ {a} ∧ a ∈ fixedPoints f }
{ f : Perm α // fixedPoints f ⊆ {a} ∧ a ∉ fixedPoints f } := by
- -- porting note: `subtypeSubtypeEquivSubtypeInter` no longer works with placeholder `_`s.
+ -- Porting note: `subtypeSubtypeEquivSubtypeInter` no longer works with placeholder `_`s.
refine' Equiv.sumCongr _ _
· exact subtypeSubtypeEquivSubtypeInter
(fun x : Perm α => fixedPoints x ⊆ {a})
@@ -101,7 +101,7 @@ def atMostOneFixedPointEquivSum_derangements [DecidableEq α] (a : α) :
· rw [Set.eq_empty_iff_forall_not_mem]
exact ⟨fun h x hx => h.2 (h.1 hx ▸ hx), fun h => ⟨fun x hx => (h _ hx).elim, h _⟩⟩
_ ≃ Sum (derangements ({a}ᶜ : Set α)) (derangements α) := by
- -- porting note: was `subtypeEquiv _` but now needs the placeholder to be provided explicitly
+ -- Porting note: was `subtypeEquiv _` but now needs the placeholder to be provided explicitly
refine'
Equiv.sumCongr ((derangements.subtypeEquiv (· ∈ ({a}ᶜ : Set α))).trans <|
subtypeEquivRight fun x => _).symm
refine
s (#10762)
I replaced a few "terminal" refine/refine'
s with exact
.
The strategy was very simple-minded: essentially any refine
whose following line had smaller indentation got replaced by exact
and then I cleaned up the mess.
This PR certainly leaves some further terminal refine
s, but maybe the current change is beneficial.
@@ -99,7 +99,7 @@ def atMostOneFixedPointEquivSum_derangements [DecidableEq α] (a : α) :
· rw [Set.eq_singleton_iff_unique_mem, and_comm]
rfl
· rw [Set.eq_empty_iff_forall_not_mem]
- refine' ⟨fun h x hx => h.2 (h.1 hx ▸ hx), fun h => ⟨fun x hx => (h _ hx).elim, h _⟩⟩
+ exact ⟨fun h x hx => h.2 (h.1 hx ▸ hx), fun h => ⟨fun x hx => (h _ hx).elim, h _⟩⟩
_ ≃ Sum (derangements ({a}ᶜ : Set α)) (derangements α) := by
-- porting note: was `subtypeEquiv _` but now needs the placeholder to be provided explicitly
refine'
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -19,7 +19,7 @@ We also define some equivalences involving various subtypes of `Perm α` and `de
* `derangementsOptionEquivSigmaAtMostOneFixedPoint`: An equivalence between
`derangements (Option α)` and the sigma-type `Σ a : α, {f : Perm α // fixed_points f ⊆ a}`.
* `derangementsRecursionEquiv`: An equivalence between `derangements (Option α)` and the
- sigma-type `Σ a : α, (derangements (({a}ᶜ : Set α) : Type _) ⊕ derangements α)` which is later
+ 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.removeNone`
@@ -30,11 +30,11 @@ on derangements: `RemoveNone.fiber_none` and `RemoveNone.fiber_some`.
open Equiv Function
/-- A permutation is a derangement if it has no fixed points. -/
-def derangements (α : Type _) : Set (Perm α) :=
+def derangements (α : Type*) : Set (Perm α) :=
{ f : Perm α | ∀ x : α, f x ≠ x }
#align derangements derangements
-variable {α β : Type _}
+variable {α β : Type*}
theorem mem_derangements_iff_fixedPoints_eq_empty {f : Perm α} :
f ∈ derangements α ↔ fixedPoints f = ∅ :=
@@ -2,17 +2,14 @@
Copyright (c) 2021 Henry Swanson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Henry Swanson
-
-! This file was ported from Lean 3 source module combinatorics.derangements.basic
-! leanprover-community/mathlib commit 9407b03373c8cd201df99d6bc5514fc2db44054f
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Dynamics.FixedPoints.Basic
import Mathlib.GroupTheory.Perm.Option
import Mathlib.Logic.Equiv.Defs
import Mathlib.Logic.Equiv.Option
+#align_import combinatorics.derangements.basic from "leanprover-community/mathlib"@"9407b03373c8cd201df99d6bc5514fc2db44054f"
+
/-!
# Derangements on types
This PR is the result of running
find . -type f -name "*.lean" -exec sed -i -E 's/^( +)\. /\1· /' {} \;
find . -type f -name "*.lean" -exec sed -i -E 'N;s/^( +·)\n +(.*)$/\1 \2/;P;D' {} \;
which firstly replaces .
focusing dots with ·
and secondly removes isolated instances of such dots, unifying them with the following line. A new rule is placed in the style linter to verify this.
@@ -91,10 +91,10 @@ def atMostOneFixedPointEquivSum_derangements [DecidableEq α] (a : α) :
{ f : Perm α // fixedPoints f ⊆ {a} ∧ a ∉ fixedPoints f } := by
-- porting note: `subtypeSubtypeEquivSubtypeInter` no longer works with placeholder `_`s.
refine' Equiv.sumCongr _ _
- . exact subtypeSubtypeEquivSubtypeInter
+ · exact subtypeSubtypeEquivSubtypeInter
(fun x : Perm α => fixedPoints x ⊆ {a})
(a ∈ fixedPoints ·)
- . exact subtypeSubtypeEquivSubtypeInter
+ · exact subtypeSubtypeEquivSubtypeInter
(fun x : Perm α => fixedPoints x ⊆ {a})
(¬a ∈ fixedPoints ·)
_ ≃ Sum { f : Perm α // fixedPoints f = {a} } { f : Perm α // fixedPoints f = ∅ } := by
at
and goals (#5387)
Changes are of the form
some_tactic at h⊢
-> some_tactic at h ⊢
some_tactic at h
-> some_tactic at h
@@ -146,7 +146,7 @@ theorem RemoveNone.fiber_some (a : α) :
· rw [RemoveNone.mem_fiber]
rintro ⟨F, F_derangement, F_none, rfl⟩ x x_fixed
rw [mem_fixedPoints_iff] at x_fixed
- apply_fun some at x_fixed
+ apply_fun some at x_fixed
cases' Fx : F (some x) with y
· rwa [removeNone_none F Fx, F_none, Option.some_inj, eq_comm] at x_fixed
· exfalso
by
s! (#3825)
This PR puts, with one exception, every single remaining by
that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh
. The exception is when the by
begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.
Essentially this is s/\n *by$/ by/g
, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated by
s".
@@ -57,19 +57,18 @@ fixed iff they are not in the subtype. -/
protected def subtypeEquiv (p : α → Prop) [DecidablePred p] :
derangements (Subtype p) ≃ { f : Perm α // ∀ a, ¬p a ↔ a ∈ fixedPoints f } :=
calc
- derangements (Subtype p) ≃
- { f : { f : Perm α // ∀ a, ¬p a → a ∈ fixedPoints f } // ∀ a, a ∈ fixedPoints f → ¬p a } :=
- by
- refine' (Perm.subtypeEquivSubtypePerm p).subtypeEquiv fun f => ⟨fun hf a hfa ha => _, _⟩
- · refine' hf ⟨a, ha⟩ (Subtype.ext _)
- simp_rw [mem_fixedPoints, IsFixedPt, Perm.subtypeEquivSubtypePerm,
- Equiv.coe_fn_mk, Perm.ofSubtype_apply_of_mem _ ha] at hfa
- assumption
- rintro hf ⟨a, ha⟩ hfa
- refine' hf _ _ ha
- simp only [Perm.subtypeEquivSubtypePerm_apply_coe, mem_fixedPoints]
- dsimp [IsFixedPt]
- simp_rw [Perm.ofSubtype_apply_of_mem _ ha, hfa]
+ derangements (Subtype p) ≃ { f : { f : Perm α // ∀ a, ¬p a → a ∈ fixedPoints f } //
+ ∀ a, a ∈ fixedPoints f → ¬p a } := by
+ refine' (Perm.subtypeEquivSubtypePerm p).subtypeEquiv fun f => ⟨fun hf a hfa ha => _, _⟩
+ · refine' hf ⟨a, ha⟩ (Subtype.ext _)
+ simp_rw [mem_fixedPoints, IsFixedPt, Perm.subtypeEquivSubtypePerm,
+ Equiv.coe_fn_mk, Perm.ofSubtype_apply_of_mem _ ha] at hfa
+ assumption
+ rintro hf ⟨a, ha⟩ hfa
+ refine' hf _ _ ha
+ simp only [Perm.subtypeEquivSubtypePerm_apply_coe, mem_fixedPoints]
+ dsimp [IsFixedPt]
+ simp_rw [Perm.ofSubtype_apply_of_mem _ ha, hfa]
_ ≃ { f : Perm α // ∃ _h : ∀ a, ¬p a → a ∈ fixedPoints f, ∀ a, a ∈ fixedPoints f → ¬p a } :=
subtypeSubtypeEquivSubtypeExists _ _
_ ≃ { f : Perm α // ∀ a, ¬p a ↔ a ∈ fixedPoints f } :=
@@ -183,8 +182,7 @@ variable [DecidableEq α]
of "permutations with `a` the only possible fixed point". -/
def derangementsOptionEquivSigmaAtMostOneFixedPoint :
derangements (Option α) ≃ Σa : α, { f : Perm α | fixedPoints f ⊆ {a} } := by
- have fiber_none_is_false : Equiv.RemoveNone.fiber (@none α) → False :=
- by
+ have fiber_none_is_false : Equiv.RemoveNone.fiber (@none α) → False := by
rw [Equiv.RemoveNone.fiber_none]
exact IsEmpty.false
calc
closes #3680, see https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Stepping.20through.20simp_rw/near/326712986
@@ -63,7 +63,7 @@ protected def subtypeEquiv (p : α → Prop) [DecidablePred p] :
refine' (Perm.subtypeEquivSubtypePerm p).subtypeEquiv fun f => ⟨fun hf a hfa ha => _, _⟩
· refine' hf ⟨a, ha⟩ (Subtype.ext _)
simp_rw [mem_fixedPoints, IsFixedPt, Perm.subtypeEquivSubtypePerm,
- Equiv.coe_fn_mk, Subtype.coe_mk, Perm.ofSubtype_apply_of_mem _ ha] at hfa
+ Equiv.coe_fn_mk, Perm.ofSubtype_apply_of_mem _ ha] at hfa
assumption
rintro hf ⟨a, ha⟩ hfa
refine' hf _ _ ha
The unported dependencies are