Skip to content

Commit 61d4983

Browse files
committed
golf
1 parent f59d730 commit 61d4983

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

Mathlib/Data/Finset/Card.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ theorem image_iterate_stabilises_lt_card [DecidableEq α] {f : α → α} {s : F
919919
(hs : Set.MapsTo f s s) (hs₀ : s.Nonempty) :
920920
∃ n < #s, ∀ m, n ≤ m → s.image f^[m] = s.image f^[n] := by
921921
let g (i : ℕ) : Finset α := s.image f^[i]
922-
have : g 0 = s := by simp [g]
923922
have (i : ℕ) : 0 < #(g i) := (hs₀.image _).card_pos
924923
let G (i : ℕ) : ℕ := #(g i) - 1
925924
have hg : Antitone g := antitone_nat_of_succ_le <| fun i ↦ by
@@ -931,9 +930,8 @@ theorem image_iterate_stabilises_lt_card [DecidableEq α] {f : α → α} {s : F
931930
exact ⟨fun h ↦ eq_of_subset_of_card_le (hg hij) (by grind), by grind⟩
932931
have hG : Antitone G := fun i j h ↦ by simp only [G]; gcongr #?_ - 1; exact hg h
933932
have hG₁ (m : ℕ) : G m = G (m + 1) → G (m + 1) = G (m + 2) := by
934-
simp only [G_eq, g, Function.iterate_succ', ← image_image]
935-
grind
936-
obtain ⟨n, hn, hn'⟩ := Nat.stabilises_of_antitone hG hG₁
933+
grind [=_ image_image, iterate_succ']
934+
rcases Nat.stabilises_of_antitone hG hG₁ with ⟨n, hn, hn'⟩
937935
exact ⟨n, by grind⟩
938936

939937
/--

0 commit comments

Comments
 (0)