l3lab/ntp-mathlib huggingface dataset:
/-- Do not use this lemma: It is made obsolete by `exists_right_complement'_of_coprime` -/
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
    {N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
    ∃ H : Subgroup G, IsComplement' N H := by
  

Proof state:
n : ℕ
G : Type u
inst✝² : Group G
inst✝¹ : Fintype G
hG : Fintype.card G = n
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Fintype.card ↥N) (index N)
⊢ ∃ H, IsComplement' N H

Next tactic:
revert G
/-- Do not use this lemma: It is made obsolete by `exists_right_complement'_of_coprime` -/
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
    {N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
    ∃ H : Subgroup G, IsComplement' N H := by
  revert G
  

Proof state:
n : ℕ
⊢ ∀ {G : Type u} [inst : Group G] [inst_1 : Fintype G],
    Fintype.card G = n →
      ∀ {N : Subgroup G} [inst_2 : Normal N], Nat.Coprime (Fintype.card ↥N) (index N) → ∃ H, IsComplement' N H

Next tactic:
apply Nat.strongInductionOn n
/-- Do not use this lemma: It is made obsolete by `exists_right_complement'_of_coprime` -/
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
    {N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
    ∃ H : Subgroup G, IsComplement' N H := by
  revert G
  apply Nat.strongInductionOn n
  

Proof state:
n : ℕ
⊢ ∀ (n : ℕ),
    (∀ m < n,
        ∀ {G : Type u} [inst : Group G] [inst_1 : Fintype G],
          Fintype.card G = m →
            ∀ {N : Subgroup G} [inst_2 : Normal N], Nat.Coprime (Fintype.card ↥N) (index N) → ∃ H, IsComplement' N H) →
      ∀ {G : Type u} [inst : Group G] [inst_1 : Fintype G],
        Fintype.card G = n →
          ∀ {N : Subgroup G} [inst_2 : Normal N], Nat.Coprime (Fintype.card ↥N) (index N) → ∃ H, IsComplement' N H

Next tactic:
rintro n ih G _ _ rfl N _ hN
/-- Do not use this lemma: It is made obsolete by `exists_right_complement'_of_coprime` -/
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
    {N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
    ∃ H : Subgroup G, IsComplement' N H := by
  revert G
  apply Nat.strongInductionOn n
  rintro n ih G _ _ rfl N _ hN
  

Proof state:
n : ℕ
G : Type u
inst✝² : Group G
inst✝¹ : Fintype G
ih :
  ∀ m < Fintype.card G,
    ∀ {G : Type u} [inst : Group G] [inst_1 : Fintype G],
      Fintype.card G = m →
        ∀ {N : Subgroup G} [inst_2 : Normal N], Nat.Coprime (Fintype.card ↥N) (index N) → ∃ H, IsComplement' N H
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Fintype.card ↥N) (index N)
⊢ ∃ H, IsComplement' N H

Next tactic:
refine' not_forall_not.mp fun h3 => _
/-- Do not use this lemma: It is made obsolete by `exists_right_complement'_of_coprime` -/
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
    {N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
    ∃ H : Subgroup G, IsComplement' N H := by
  revert G
  apply Nat.strongInductionOn n
  rintro n ih G _ _ rfl N _ hN
  refine' not_forall_not.mp fun h3 => _
  

Proof state:
n : ℕ
G : Type u
inst✝² : Group G
inst✝¹ : Fintype G
ih :
  ∀ m < Fintype.card G,
    ∀ {G : Type u} [inst : Group G] [inst_1 : Fintype G],
      Fintype.card G = m →
        ∀ {N : Subgroup G} [inst_2 : Normal N], Nat.Coprime (Fintype.card ↥N) (index N) → ∃ H, IsComplement' N H
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Fintype.card ↥N) (index N)
h3 : ∀ (x : Subgroup G), ¬IsComplement' N x
⊢ False

Next tactic:
haveI := SchurZassenhausInduction.step7 hN (fun G' _ _ hG' => by apply ih _ hG'; rfl) h3
/-- Do not use this lemma: It is made obsolete by `exists_right_complement'_of_coprime` -/
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
    {N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
    ∃ H : Subgroup G, IsComplement' N H := by
  revert G
  apply Nat.strongInductionOn n
  rintro n ih G _ _ rfl N _ hN
  refine' not_forall_not.mp fun h3 => _
  haveI := SchurZassenhausInduction.step7 hN (fun G' _ _ hG' => by 

Proof state:
n : ℕ
G : Type u
inst✝² : Group G
inst✝¹ : Fintype G
ih :
  ∀ m < Fintype.card G,
    ∀ {G : Type u} [inst : Group G] [inst_1 : Fintype G],
      Fintype.card G = m →
        ∀ {N : Subgroup G} [inst_2 : Normal N], Nat.Coprime (Fintype.card ↥N) (index N) → ∃ H, IsComplement' N H
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Fintype.card ↥N) (index N)
h3 : ∀ (x : Subgroup G), ¬IsComplement' N x
G' : Type u
x✝¹ : Group G'
x✝ : Fintype G'
hG' : Fintype.card G' < Fintype.card G
⊢ ∀ {N' : Subgroup G'} [inst : Normal N'], Nat.Coprime (Fintype.card ↥N') (index N') → ∃ H', IsComplement' N' H'

Next tactic:
apply ih _ hG'
/-- Do not use this lemma: It is made obsolete by `exists_right_complement'_of_coprime` -/
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
    {N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
    ∃ H : Subgroup G, IsComplement' N H := by
  revert G
  apply Nat.strongInductionOn n
  rintro n ih G _ _ rfl N _ hN
  refine' not_forall_not.mp fun h3 => _
  haveI := SchurZassenhausInduction.step7 hN (fun G' _ _ hG' => by apply ih _ hG'; 

Proof state:
n : ℕ
G : Type u
inst✝² : Group G
inst✝¹ : Fintype G
ih :
  ∀ m < Fintype.card G,
    ∀ {G : Type u} [inst : Group G] [inst_1 : Fintype G],
      Fintype.card G = m →
        ∀ {N : Subgroup G} [inst_2 : Normal N], Nat.Coprime (Fintype.card ↥N) (index N) → ∃ H, IsComplement' N H
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Fintype.card ↥N) (index N)
h3 : ∀ (x : Subgroup G), ¬IsComplement' N x
G' : Type u
x✝¹ : Group G'
x✝ : Fintype G'
hG' : Fintype.card G' < Fintype.card G
⊢ Fintype.card G' = Fintype.card G'

Next tactic:
rfl
/-- Do not use this lemma: It is made obsolete by `exists_right_complement'_of_coprime` -/
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
    {N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
    ∃ H : Subgroup G, IsComplement' N H := by
  revert G
  apply Nat.strongInductionOn n
  rintro n ih G _ _ rfl N _ hN
  refine' not_forall_not.mp fun h3 => _
  haveI := SchurZassenhausInduction.step7 hN (fun G' _ _ hG' => by apply ih _ hG'; rfl) h3
  

Proof state:
n : ℕ
G : Type u
inst✝² : Group G
inst✝¹ : Fintype G
ih :
  ∀ m < Fintype.card G,
    ∀ {G : Type u} [inst : Group G] [inst_1 : Fintype G],
      Fintype.card G = m →
        ∀ {N : Subgroup G} [inst_2 : Normal N], Nat.Coprime (Fintype.card ↥N) (index N) → ∃ H, IsComplement' N H
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Fintype.card ↥N) (index N)
h3 : ∀ (x : Subgroup G), ¬IsComplement' N x
this : IsCommutative N
⊢ False

Next tactic:
rw [← Nat.card_eq_fintype_card] at hN
/-- Do not use this lemma: It is made obsolete by `exists_right_complement'_of_coprime` -/
private theorem exists_right_complement'_of_coprime_aux' [Fintype G] (hG : Fintype.card G = n)
    {N : Subgroup G} [N.Normal] (hN : Nat.Coprime (Fintype.card N) N.index) :
    ∃ H : Subgroup G, IsComplement' N H := by
  revert G
  apply Nat.strongInductionOn n
  rintro n ih G _ _ rfl N _ hN
  refine' not_forall_not.mp fun h3 => _
  haveI := SchurZassenhausInduction.step7 hN (fun G' _ _ hG' => by apply ih _ hG'; rfl) h3
  rw [← Nat.card_eq_fintype_card] at hN
  

Proof state:
n : ℕ
G : Type u
inst✝² : Group G
inst✝¹ : Fintype G
ih :
  ∀ m < Fintype.card G,
    ∀ {G : Type u} [inst : Group G] [inst_1 : Fintype G],
      Fintype.card G = m →
        ∀ {N : Subgroup G} [inst_2 : Normal N], Nat.Coprime (Fintype.card ↥N) (index N) → ∃ H, IsComplement' N H
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
h3 : ∀ (x : Subgroup G), ¬IsComplement' N x
this : IsCommutative N
⊢ False

Next tactic:
exact not_exists_of_forall_not h3 (exists_right_complement'_of_coprime_aux hN)
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  

Proof state:
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
⊢ ∃ H, IsComplement' N H

Next tactic:
by_cases hN1 : Nat.card N = 0
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · 

Proof state:
case pos
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
hN1 : Nat.card ↥N = 0
⊢ ∃ H, IsComplement' N H

Next tactic:
rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    

Proof state:
case pos
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : N = ⊤
hN1 : Nat.card ↥N = 0
⊢ ∃ H, IsComplement' N H

Next tactic:
rw [hN]
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    

Proof state:
case pos
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : N = ⊤
hN1 : Nat.card ↥N = 0
⊢ ∃ H, IsComplement' ⊤ H

Next tactic:
exact ⟨⊥, isComplement'_top_bot⟩
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  

Proof state:
case neg
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
hN1 : ¬Nat.card ↥N = 0
⊢ ∃ H, IsComplement' N H

Next tactic:
by_cases hN2 : N.index = 0
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · 

Proof state:
case pos
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
hN1 : ¬Nat.card ↥N = 0
hN2 : index N = 0
⊢ ∃ H, IsComplement' N H

Next tactic:
rw [hN2, Nat.coprime_zero_right] at hN
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · rw [hN2, Nat.coprime_zero_right] at hN
    

Proof state:
case pos
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.card ↥N = 1
hN1 : ¬Nat.card ↥N = 0
hN2 : index N = 0
⊢ ∃ H, IsComplement' N H

Next tactic:
haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · rw [hN2, Nat.coprime_zero_right] at hN
    haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
    

Proof state:
case pos
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.card ↥N = 1
hN1 : ¬Nat.card ↥N = 0
hN2 : index N = 0
this : Subsingleton ↥N
⊢ ∃ H, IsComplement' N H

Next tactic:
rw [N.eq_bot_of_subsingleton]
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · rw [hN2, Nat.coprime_zero_right] at hN
    haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
    rw [N.eq_bot_of_subsingleton]
    

Proof state:
case pos
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.card ↥N = 1
hN1 : ¬Nat.card ↥N = 0
hN2 : index N = 0
this : Subsingleton ↥N
⊢ ∃ H, IsComplement' ⊥ H

Next tactic:
exact ⟨⊤, isComplement'_bot_top⟩
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · rw [hN2, Nat.coprime_zero_right] at hN
    haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
    rw [N.eq_bot_of_subsingleton]
    exact ⟨⊤, isComplement'_bot_top⟩
  

Proof state:
case neg
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
hN1 : ¬Nat.card ↥N = 0
hN2 : ¬index N = 0
⊢ ∃ H, IsComplement' N H

Next tactic:
have hN3 : Nat.card G ≠ 0 := by
    rw [← N.card_mul_index]
    exact mul_ne_zero hN1 hN2
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · rw [hN2, Nat.coprime_zero_right] at hN
    haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
    rw [N.eq_bot_of_subsingleton]
    exact ⟨⊤, isComplement'_bot_top⟩
  have hN3 : Nat.card G ≠ 0 := by
    

Proof state:
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
hN1 : ¬Nat.card ↥N = 0
hN2 : ¬index N = 0
⊢ Nat.card G ≠ 0

Next tactic:
rw [← N.card_mul_index]
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · rw [hN2, Nat.coprime_zero_right] at hN
    haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
    rw [N.eq_bot_of_subsingleton]
    exact ⟨⊤, isComplement'_bot_top⟩
  have hN3 : Nat.card G ≠ 0 := by
    rw [← N.card_mul_index]
    

Proof state:
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
hN1 : ¬Nat.card ↥N = 0
hN2 : ¬index N = 0
⊢ Nat.card ↥N * index N ≠ 0

Next tactic:
exact mul_ne_zero hN1 hN2
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · rw [hN2, Nat.coprime_zero_right] at hN
    haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
    rw [N.eq_bot_of_subsingleton]
    exact ⟨⊤, isComplement'_bot_top⟩
  have hN3 : Nat.card G ≠ 0 := by
    rw [← N.card_mul_index]
    exact mul_ne_zero hN1 hN2
  

Proof state:
case neg
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
hN1 : ¬Nat.card ↥N = 0
hN2 : ¬index N = 0
hN3 : Nat.card G ≠ 0
⊢ ∃ H, IsComplement' N H

Next tactic:
haveI := (Cardinal.lt_aleph0_iff_fintype.mp
    (lt_of_not_ge (mt Cardinal.toNat_apply_of_aleph0_le hN3))).some
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · rw [hN2, Nat.coprime_zero_right] at hN
    haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
    rw [N.eq_bot_of_subsingleton]
    exact ⟨⊤, isComplement'_bot_top⟩
  have hN3 : Nat.card G ≠ 0 := by
    rw [← N.card_mul_index]
    exact mul_ne_zero hN1 hN2
  haveI := (Cardinal.lt_aleph0_iff_fintype.mp
    (lt_of_not_ge (mt Cardinal.toNat_apply_of_aleph0_le hN3))).some
  

Proof state:
case neg
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
hN1 : ¬Nat.card ↥N = 0
hN2 : ¬index N = 0
hN3 : Nat.card G ≠ 0
this : Fintype G
⊢ ∃ H, IsComplement' N H

Next tactic:
apply exists_right_complement'_of_coprime_of_fintype
/-- **Schur-Zassenhaus** for normal subgroups:
  If `H : Subgroup G` is normal, and has order coprime to its index, then there exists a
  subgroup `K` which is a (right) complement of `H`. -/
theorem exists_right_complement'_of_coprime {N : Subgroup G} [N.Normal]
    (hN : Nat.Coprime (Nat.card N) N.index) : ∃ H : Subgroup G, IsComplement' N H := by
  by_cases hN1 : Nat.card N = 0
  · rw [hN1, Nat.coprime_zero_left, index_eq_one] at hN
    rw [hN]
    exact ⟨⊥, isComplement'_top_bot⟩
  by_cases hN2 : N.index = 0
  · rw [hN2, Nat.coprime_zero_right] at hN
    haveI := (Cardinal.toNat_eq_one_iff_unique.mp hN).1
    rw [N.eq_bot_of_subsingleton]
    exact ⟨⊤, isComplement'_bot_top⟩
  have hN3 : Nat.card G ≠ 0 := by
    rw [← N.card_mul_index]
    exact mul_ne_zero hN1 hN2
  haveI := (Cardinal.lt_aleph0_iff_fintype.mp
    (lt_of_not_ge (mt Cardinal.toNat_apply_of_aleph0_le hN3))).some
  apply exists_right_complement'_of_coprime_of_fintype
  

Proof state:
case neg.hN
n : ℕ
G : Type u
inst✝¹ : Group G
N : Subgroup G
inst✝ : Normal N
hN : Nat.Coprime (Nat.card ↥N) (index N)
hN1 : ¬Nat.card ↥N = 0
hN2 : ¬index N = 0
hN3 : Nat.card G ≠ 0
this : Fintype G
⊢ Nat.Coprime (Fintype.card ↥N) (index N)

Next tactic:
rwa [← Nat.card_eq_fintype_card]
/-- The morphism `m` in a factorisation `f = e ≫ m` through a monomorphism is uniquely
determined. -/
@[ext]
theorem ext {F F' : MonoFactorisation f} (hI : F.I = F'.I)
    (hm : F.m = eqToHom hI ≫ F'.m) : F = F' := by
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f : X ⟶ Y
F F' : MonoFactorisation f
hI : F.I = F'.I
hm : F.m = eqToHom hI ≫ F'.m
⊢ F = F'

Next tactic:
cases' F with _ Fm _ _ Ffac
/-- The morphism `m` in a factorisation `f = e ≫ m` through a monomorphism is uniquely
determined. -/
@[ext]
theorem ext {F F' : MonoFactorisation f} (hI : F.I = F'.I)
    (hm : F.m = eqToHom hI ≫ F'.m) : F = F' := by
  cases' F with _ Fm _ _ Ffac; 

Proof state:
case mk
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f : X ⟶ Y
F' : MonoFactorisation f
I✝ : C
Fm : I✝ ⟶ Y
m_mono✝ : Mono Fm
e✝ : X ⟶ I✝
Ffac : e✝ ≫ Fm = f
hI : (mk I✝ Fm e✝).I = F'.I
hm : (mk I✝ Fm e✝).m = eqToHom hI ≫ F'.m
⊢ mk I✝ Fm e✝ = F'

Next tactic:
cases' F' with _ Fm' _ _ Ffac'
/-- The morphism `m` in a factorisation `f = e ≫ m` through a monomorphism is uniquely
determined. -/
@[ext]
theorem ext {F F' : MonoFactorisation f} (hI : F.I = F'.I)
    (hm : F.m = eqToHom hI ≫ F'.m) : F = F' := by
  cases' F with _ Fm _ _ Ffac; cases' F' with _ Fm' _ _ Ffac'
  

Proof state:
case mk.mk
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f : X ⟶ Y
I✝¹ : C
Fm : I✝¹ ⟶ Y
m_mono✝¹ : Mono Fm
e✝¹ : X ⟶ I✝¹
Ffac : e✝¹ ≫ Fm = f
I✝ : C
Fm' : I✝ ⟶ Y
m_mono✝ : Mono Fm'
e✝ : X ⟶ I✝
Ffac' : e✝ ≫ Fm' = f
hI : (mk I✝¹ Fm e✝¹).I = (mk I✝ Fm' e✝).I
hm : (mk I✝¹ Fm e✝¹).m = eqToHom hI ≫ (mk I✝ Fm' e✝).m
⊢ mk I✝¹ Fm e✝¹ = mk I✝ Fm' e✝

Next tactic:
cases' hI
/-- The morphism `m` in a factorisation `f = e ≫ m` through a monomorphism is uniquely
determined. -/
@[ext]
theorem ext {F F' : MonoFactorisation f} (hI : F.I = F'.I)
    (hm : F.m = eqToHom hI ≫ F'.m) : F = F' := by
  cases' F with _ Fm _ _ Ffac; cases' F' with _ Fm' _ _ Ffac'
  cases' hI
  

Proof state:
case mk.mk.refl
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f : X ⟶ Y
I✝ : C
Fm : I✝ ⟶ Y
m_mono✝¹ : Mono Fm
e✝¹ : X ⟶ I✝
Ffac : e✝¹ ≫ Fm = f
Fm' : I✝ ⟶ Y
m_mono✝ : Mono Fm'
e✝ : X ⟶ I✝
Ffac' : e✝ ≫ Fm' = f
hm : (mk I✝ Fm e✝¹).m = eqToHom (_ : (mk I✝ Fm e✝¹).I = (mk I✝ Fm e✝¹).I) ≫ (mk I✝ Fm' e✝).m
⊢ mk I✝ Fm e✝¹ = mk I✝ Fm' e✝

Next tactic:
simp? at hm says simp only [eqToHom_refl, Category.id_comp] at hm
/-- The morphism `m` in a factorisation `f = e ≫ m` through a monomorphism is uniquely
determined. -/
@[ext]
theorem ext {F F' : MonoFactorisation f} (hI : F.I = F'.I)
    (hm : F.m = eqToHom hI ≫ F'.m) : F = F' := by
  cases' F with _ Fm _ _ Ffac; cases' F' with _ Fm' _ _ Ffac'
  cases' hI
  simp? at hm says 

Proof state:
case mk.mk.refl
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f : X ⟶ Y
I✝ : C
Fm : I✝ ⟶ Y
m_mono✝¹ : Mono Fm
e✝¹ : X ⟶ I✝
Ffac : e✝¹ ≫ Fm = f
Fm' : I✝ ⟶ Y
m_mono✝ : Mono Fm'
e✝ : X ⟶ I✝
Ffac' : e✝ ≫ Fm' = f
hm : (mk I✝ Fm e✝¹).m = eqToHom (_ : (mk I✝ Fm e✝¹).I = (mk I✝ Fm e✝¹).I) ≫ (mk I✝ Fm' e✝).m
⊢ mk I✝ Fm e✝¹ = mk I✝ Fm' e✝

Next tactic:
simp only [eqToHom_refl, Category.id_comp] at hm