Theorem: Subgroup.rank_closure_finset_le_card
File: Mathlib/GroupTheory/Finiteness.lean

tactic: classical
let t : Finset (closure (s : Set G)) := s.preimage Subtype.val Subtype.coe_injective.injOn
have ht : closure (t : Set (closure (s : Set G))) = ⊤ := by
  rw [Finset.coe_preimage]
  exact closure_preimage_eq_top (s : Set G)
apply (Group.rank_le (closure (s : Set G)) ht).trans
suffices H : Set.InjOn Subtype.val (t : Set (closure (s : Set G))) by
  rw [← Finset.card_image_of_injOn H, Finset.image_preimage]
  apply Finset.card_filter_le
apply Subtype.coe_injective.injOn
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
⊢ Group.rank ↥(closure ↑s) ≤ s.card
state_after: no goals

tactic: let t : Finset (closure (s : Set G)) := s.preimage Subtype.val Subtype.coe_injective.injOn
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
⊢ Group.rank ↥(closure ↑s) ≤ s.card
state_after: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
⊢ Group.rank ↥(closure ↑s) ≤ s.card

tactic: have ht : closure (t : Set (closure (s : Set G))) = ⊤ := by
  rw [Finset.coe_preimage]
  exact closure_preimage_eq_top (s : Set G)
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
⊢ Group.rank ↥(closure ↑s) ≤ s.card
state_after: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
ht : closure ↑t = ⊤
⊢ Group.rank ↥(closure ↑s) ≤ s.card

tactic: apply (Group.rank_le (closure (s : Set G)) ht).trans
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
ht : closure ↑t = ⊤
⊢ Group.rank ↥(closure ↑s) ≤ s.card
state_after: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
ht : closure ↑t = ⊤
⊢ t.card ≤ s.card

tactic: suffices H : Set.InjOn Subtype.val (t : Set (closure (s : Set G))) by
  rw [← Finset.card_image_of_injOn H, Finset.image_preimage]
  apply Finset.card_filter_le
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
ht : closure ↑t = ⊤
⊢ t.card ≤ s.card
state_after: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
ht : closure ↑t = ⊤
⊢ Set.InjOn Subtype.val ↑t

tactic: apply Subtype.coe_injective.injOn
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
ht : closure ↑t = ⊤
⊢ Set.InjOn Subtype.val ↑t
state_after: no goals

tactic: rw [Finset.coe_preimage]
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
⊢ closure ↑t = ⊤
state_after: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
⊢ closure (Subtype.val ⁻¹' ↑s) = ⊤

tactic: exact closure_preimage_eq_top (s : Set G)
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
⊢ closure (Subtype.val ⁻¹' ↑s) = ⊤
state_after: no goals

tactic: rw [← Finset.card_image_of_injOn H, Finset.image_preimage]
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H✝ : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H✝
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
ht : closure ↑t = ⊤
H : Set.InjOn Subtype.val ↑t
⊢ t.card ≤ s.card
state_after: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H✝ : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H✝
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
ht : closure ↑t = ⊤
H : Set.InjOn Subtype.val ↑t
⊢ (Finset.filter (fun x => x ∈ Set.range Subtype.val) s).card ≤ s.card

tactic: apply Finset.card_filter_le
state_before: M : Type u_1
N : Type u_2
inst✝³ : Monoid M
inst✝² : AddMonoid N
G : Type u_3
H✝ : Type u_4
inst✝¹ : Group G
inst✝ : AddGroup H✝
s : Finset G
t : Finset ↥(closure ↑s) := s.preimage Subtype.val ⋯
ht : closure ↑t = ⊤
H : Set.InjOn Subtype.val ↑t
⊢ (Finset.filter (fun x => x ∈ Set.range Subtype.val) s).card ≤ s.card
state_after: no goals