Skip to content

Commit bccca01

Browse files
committed
golf more
1 parent 61d4983 commit bccca01

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

Mathlib/Data/Finset/Card.lean

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -920,18 +920,15 @@ theorem image_iterate_stabilises_lt_card [DecidableEq α] {f : α → α} {s : F
920920
∃ n < #s, ∀ m, n ≤ m → s.image f^[m] = s.image f^[n] := by
921921
let g (i : ℕ) : Finset α := s.image f^[i]
922922
have (i : ℕ) : 0 < #(g i) := (hs₀.image _).card_pos
923-
let G (i : ℕ) : ℕ := #(g i) - 1
924923
have hg : Antitone g := antitone_nat_of_succ_le <| fun i ↦ by
925924
simp_rw [le_iff_subset, g, Function.iterate_succ, ← image_image]
926925
grw [hs.finsetImage_subset]
927-
have G_eq (i j : ℕ) : G i = G j ↔ g i = g j := by
926+
have eq_iff (i j : ℕ) : #(g i) - 1 = #(g j) - 1 ↔ g i = g j := by
928927
wlog hij : j ≤ i generalizing i j
929928
· grind
930929
exact ⟨fun h ↦ eq_of_subset_of_card_le (hg hij) (by grind), by grind⟩
931-
have hG : Antitone G := fun i j h ↦ by simp only [G]; gcongr #?_ - 1; exact hg h
932-
have hG₁ (m : ℕ) : G m = G (m + 1) → G (m + 1) = G (m + 2) := by
933-
grind [=_ image_image, iterate_succ']
934-
rcases Nat.stabilises_of_antitone hG hG₁ with ⟨n, hn, hn'⟩
930+
have hG : Antitone (fun i ↦ #(g i) - 1) := fun i j h ↦ by dsimp; gcongr #?_ - 1; exact hg h
931+
rcases Nat.stabilises_of_antitone hG (by grind [=_ image_image, iterate_succ']) with ⟨n, hn, hn'⟩
935932
exact ⟨n, by grind⟩
936933

937934
/--

0 commit comments

Comments
 (0)