Skip to content

Commit f59d730

Browse files
committed
review suggestions
1 parent 0dad850 commit f59d730

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

Mathlib/Data/Finset/Card.lean

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -920,13 +920,11 @@ 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 : g 0 = s := by simp [g]
923-
have (i : ℕ) : #(g i) 0 := by simp [g, hs₀.ne_empty]
923+
have (i : ℕ) : 0 < #(g i) := (hs₀.image _).card_pos
924924
let G (i : ℕ) : ℕ := #(g i) - 1
925-
have hg (i : ℕ) : g (i + 1) ⊆ g i := by
926-
simp only [g]
927-
rw [Function.iterate_succ, ← image_image]
928-
exact image_subset_image hs.finsetImage_subset
929-
replace hg : Antitone g := antitone_nat_of_succ_le hg
925+
have hg : Antitone g := antitone_nat_of_succ_le <| fun i ↦ by
926+
simp_rw [le_iff_subset, g, Function.iterate_succ, ← image_image]
927+
grw [hs.finsetImage_subset]
930928
have G_eq (i j : ℕ) : G i = G j ↔ g i = g j := by
931929
wlog hij : j ≤ i generalizing i j
932930
· grind
@@ -936,7 +934,7 @@ theorem image_iterate_stabilises_lt_card [DecidableEq α] {f : α → α} {s : F
936934
simp only [G_eq, g, Function.iterate_succ', ← image_image]
937935
grind
938936
obtain ⟨n, hn, hn'⟩ := Nat.stabilises_of_antitone hG hG₁
939-
exact ⟨n, by grind, by grind
937+
exact ⟨n, by grind⟩
940938

941939
/--
942940
Given a function `f` which sends the finite set `s` to itself, the sequence of images of `s` under

Mathlib/Data/Finset/Image.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ theorem _root_.Function.Commute.finset_image [DecidableEq α] {f g : α → α}
361361
(h : Function.Commute f g) : Function.Commute (image f) (image g) :=
362362
Function.Semiconj.finset_image h
363363

364+
@[gcongr]
364365
theorem image_subset_image {s₁ s₂ : Finset α} (h : s₁ ⊆ s₂) : s₁.image f ⊆ s₂.image f := by
365366
simp only [subset_def, image_val, subset_dedup', dedup_subset', Multiset.map_subset_map h]
366367

0 commit comments

Comments
 (0)