Theorem: Subgroup.index_comap_of_surjective
File: Mathlib/GroupTheory/Index.lean

tactic: letI := QuotientGroup.leftRel H
state_before: G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
⊢ index (comap f H) = index H

tactic: letI := QuotientGroup.leftRel (H.comap f)
state_before: G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this : Setoid G := QuotientGroup.leftRel H
⊢ index (comap f H) = index H

tactic: refine' Cardinal.toNat_congr (Equiv.ofBijective (Quotient.map' f fun x y => (key x y).mp) ⟨_, _⟩)
state_before: G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
key : ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (↑f x) (↑f y)
⊢ index (comap f H) = index H

tactic: simp only [QuotientGroup.leftRel_apply]
state_before: G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
⊢ ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (↑f x) (↑f y)

tactic: rw [f.map_mul, f.map_inv]
state_before: G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
x y : G'
⊢ ↑f (x⁻¹ * y) = (↑f x)⁻¹ * ↑f y

tactic: simp_rw [← Quotient.eq''] at key
state_before: case refine'_1
G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
key : ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (↑f x) (↑f y)
⊢ Function.Injective (Quotient.map' ↑f (_ : ∀ (x y : G'), Setoid.r x y → Setoid.r (↑f x) (↑f y)))

tactic: refine' Quotient.ind' fun x => _
state_before: case refine'_1
G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
key✝ : ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (↑f x) (↑f y)
key : ∀ (x y : G'), Quotient.mk'' x = Quotient.mk'' y ↔ Quotient.mk'' (↑f x) = Quotient.mk'' (↑f y)
⊢ Function.Injective (Quotient.map' ↑f (_ : ∀ (x y : G'), Setoid.r x y → Setoid.r (↑f x) (↑f y)))

tactic: refine' Quotient.ind' fun y => _
state_before: case refine'_1
G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
key✝ : ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (↑f x) (↑f y)
key : ∀ (x y : G'), Quotient.mk'' x = Quotient.mk'' y ↔ Quotient.mk'' (↑f x) = Quotient.mk'' (↑f y)
x : G'
⊢ ∀ ⦃a₂ : G' ⧸ comap f H⦄,
    Quotient.map' ↑f (_ : ∀ (x y : G'), Setoid.r x y → Setoid.r (↑f x) (↑f y)) (Quotient.mk'' x) =
        Quotient.map' ↑f (_ : ∀ (x y : G'), Setoid.r x y → Setoid.r (↑f x) (↑f y)) a₂ →
      Quotient.mk'' x = a₂

tactic: exact (key x y).mpr
state_before: case refine'_1
G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
key✝ : ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (↑f x) (↑f y)
key : ∀ (x y : G'), Quotient.mk'' x = Quotient.mk'' y ↔ Quotient.mk'' (↑f x) = Quotient.mk'' (↑f y)
x y : G'
⊢ Quotient.map' ↑f (_ : ∀ (x y : G'), Setoid.r x y → Setoid.r (↑f x) (↑f y)) (Quotient.mk'' x) =
      Quotient.map' ↑f (_ : ∀ (x y : G'), Setoid.r x y → Setoid.r (↑f x) (↑f y)) (Quotient.mk'' y) →
    Quotient.mk'' x = Quotient.mk'' y

tactic: refine' Quotient.ind' fun x => _
state_before: case refine'_2
G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
key : ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (↑f x) (↑f y)
⊢ Function.Surjective (Quotient.map' ↑f (_ : ∀ (x y : G'), Setoid.r x y → Setoid.r (↑f x) (↑f y)))

tactic: obtain ⟨y, hy⟩ := hf x
state_before: case refine'_2
G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
key : ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (↑f x) (↑f y)
x : G
⊢ ∃ a, Quotient.map' ↑f (_ : ∀ (x y : G'), Setoid.r x y → Setoid.r (↑f x) (↑f y)) a = Quotient.mk'' x

tactic: exact ⟨y, (Quotient.map'_mk'' f _ y).trans (congr_arg Quotient.mk'' hy)⟩
state_before: case refine'_2.intro
G : Type u_2
inst✝¹ : Group G
H K L : Subgroup G
G' : Type u_1
inst✝ : Group G'
f : G' →* G
hf : Function.Surjective ↑f
this✝ : Setoid G := QuotientGroup.leftRel H
this : Setoid G' := QuotientGroup.leftRel (comap f H)
key : ∀ (x y : G'), Setoid.r x y ↔ Setoid.r (↑f x) (↑f y)
x : G
y : G'
hy : ↑f y = x
⊢ ∃ a, Quotient.map' ↑f (_ : ∀ (x y : G'), Setoid.r x y → Setoid.r (↑f x) (↑f y)) a = Quotient.mk'' x