l3lab/ntp-mathlib huggingface dataset:
/-- A subgroup with cardinality `p ^ n` is a Sylow subgroup
 where `n` is the multiplicity of `p` in the group order. -/
def ofCard [Fintype G] {p : ℕ} [Fact p.Prime] (H : Subgroup G) [Fintype H]
    (card_eq : card H = p ^ (card G).factorization p) : Sylow p G
    where
  toSubgroup := H
  isPGroup' := IsPGroup.of_card card_eq
  is_maximal' := by
    obtain ⟨P, hHP⟩ := (IsPGroup.of_card card_eq).exists_le_sylow
    

Proof state:
case intro
G : Type u
α : Type v
β : Type w
inst✝³ : Group G
inst✝² : Fintype G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
H : Subgroup G
inst✝ : Fintype ↥H
card_eq : Fintype.card ↥H = p ^ (Nat.factorization (Fintype.card G)) p
P : Sylow p G
hHP : H ≤ ↑P
⊢ ∀ {Q : Subgroup G}, IsPGroup p ↥Q → H ≤ Q → Q = H

Next tactic:
exact SetLike.ext'
      (Set.eq_of_subset_of_card_le hHP (P.card_eq_multiplicity.trans card_eq.symm).le).symm ▸ P.3
/-- If `G` has a normal Sylow `p`-subgroup, then it is the only Sylow `p`-subgroup. -/
noncomputable def unique_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : Unique (Sylow p G) := by
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
⊢ Unique (Sylow p G)

Next tactic:
refine { uniq := fun Q ↦ ?_ }
/-- If `G` has a normal Sylow `p`-subgroup, then it is the only Sylow `p`-subgroup. -/
noncomputable def unique_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : Unique (Sylow p G) := by
  refine { uniq := fun Q ↦ ?_ }
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
Q : Sylow p G
⊢ Q = default

Next tactic:
obtain ⟨x, h1⟩ := exists_smul_eq G P Q
/-- If `G` has a normal Sylow `p`-subgroup, then it is the only Sylow `p`-subgroup. -/
noncomputable def unique_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : Unique (Sylow p G) := by
  refine { uniq := fun Q ↦ ?_ }
  obtain ⟨x, h1⟩ := exists_smul_eq G P Q
  

Proof state:
case intro
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
Q : Sylow p G
x : G
h1 : x • P = Q
⊢ Q = default

Next tactic:
obtain ⟨x, h2⟩ := exists_smul_eq G P default
/-- If `G` has a normal Sylow `p`-subgroup, then it is the only Sylow `p`-subgroup. -/
noncomputable def unique_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : Unique (Sylow p G) := by
  refine { uniq := fun Q ↦ ?_ }
  obtain ⟨x, h1⟩ := exists_smul_eq G P Q
  obtain ⟨x, h2⟩ := exists_smul_eq G P default
  

Proof state:
case intro.intro
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
Q : Sylow p G
x✝ : G
h1 : x✝ • P = Q
x : G
h2 : x • P = default
⊢ Q = default

Next tactic:
rw [Sylow.smul_eq_of_normal] at h1 h2
/-- If `G` has a normal Sylow `p`-subgroup, then it is the only Sylow `p`-subgroup. -/
noncomputable def unique_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : Unique (Sylow p G) := by
  refine { uniq := fun Q ↦ ?_ }
  obtain ⟨x, h1⟩ := exists_smul_eq G P Q
  obtain ⟨x, h2⟩ := exists_smul_eq G P default
  rw [Sylow.smul_eq_of_normal] at h1 h2
  

Proof state:
case intro.intro
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
Q : Sylow p G
x✝ : G
h1 : P = Q
x : G
h2 : P = default
⊢ Q = default

Next tactic:
rw [← h1, ← h2]
theorem characteristic_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : (P : Subgroup G).Characteristic := by
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
⊢ Characteristic ↑P

Next tactic:
haveI := Sylow.unique_of_normal P h
theorem characteristic_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : (P : Subgroup G).Characteristic := by
  haveI := Sylow.unique_of_normal P h
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
this : Unique (Sylow p G)
⊢ Characteristic ↑P

Next tactic:
rw [characteristic_iff_map_eq]
theorem characteristic_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : (P : Subgroup G).Characteristic := by
  haveI := Sylow.unique_of_normal P h
  rw [characteristic_iff_map_eq]
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
this : Unique (Sylow p G)
⊢ ∀ (ϕ : G ≃* G), Subgroup.map (MulEquiv.toMonoidHom ϕ) ↑P = ↑P

Next tactic:
intro Φ
theorem characteristic_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : (P : Subgroup G).Characteristic := by
  haveI := Sylow.unique_of_normal P h
  rw [characteristic_iff_map_eq]
  intro Φ
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
this : Unique (Sylow p G)
Φ : G ≃* G
⊢ Subgroup.map (MulEquiv.toMonoidHom Φ) ↑P = ↑P

Next tactic:
show (Φ • P).toSubgroup = P.toSubgroup
theorem characteristic_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : (P : Subgroup G).Characteristic := by
  haveI := Sylow.unique_of_normal P h
  rw [characteristic_iff_map_eq]
  intro Φ
  show (Φ • P).toSubgroup = P.toSubgroup
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
this : Unique (Sylow p G)
Φ : G ≃* G
⊢ ↑(Φ • P) = ↑P

Next tactic:
congr
theorem characteristic_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (h : (P : Subgroup G).Normal) : (P : Subgroup G).Characteristic := by
  haveI := Sylow.unique_of_normal P h
  rw [characteristic_iff_map_eq]
  intro Φ
  show (Φ • P).toSubgroup = P.toSubgroup
  congr
  

Proof state:
case e_self
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
h : Normal ↑P
this : Unique (Sylow p G)
Φ : G ≃* G
⊢ Φ • P = P

Next tactic:
simp [eq_iff_true_of_subsingleton]
theorem normal_of_normalizer_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G)
    (hn : (↑P : Subgroup G).normalizer.Normal) : (↑P : Subgroup G).Normal := by
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
hn : Normal (normalizer ↑P)
⊢ Normal ↑P

Next tactic:
rw [← normalizer_eq_top, ← normalizer_sup_eq_top' P le_normalizer, sup_idem]
@[simp]
theorem normalizer_normalizer {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G) :
    (↑P : Subgroup G).normalizer.normalizer = (↑P : Subgroup G).normalizer := by
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
⊢ normalizer (normalizer ↑P) = normalizer ↑P

Next tactic:
have := normal_of_normalizer_normal (P.subtype (le_normalizer.trans le_normalizer))
@[simp]
theorem normalizer_normalizer {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G) :
    (↑P : Subgroup G).normalizer.normalizer = (↑P : Subgroup G).normalizer := by
  have := normal_of_normalizer_normal (P.subtype (le_normalizer.trans le_normalizer))
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
this :
  Normal (normalizer ↑(Sylow.subtype P (_ : ↑P ≤ normalizer (normalizer ↑P)))) →
    Normal ↑(Sylow.subtype P (_ : ↑P ≤ normalizer (normalizer ↑P)))
⊢ normalizer (normalizer ↑P) = normalizer ↑P

Next tactic:
simp_rw [← normalizer_eq_top, Sylow.coe_subtype, ← subgroupOf_normalizer_eq le_normalizer, ←
    subgroupOf_normalizer_eq le_rfl, subgroupOf_self] at this
@[simp]
theorem normalizer_normalizer {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G) :
    (↑P : Subgroup G).normalizer.normalizer = (↑P : Subgroup G).normalizer := by
  have := normal_of_normalizer_normal (P.subtype (le_normalizer.trans le_normalizer))
  simp_rw [← normalizer_eq_top, Sylow.coe_subtype, ← subgroupOf_normalizer_eq le_normalizer, ←
    subgroupOf_normalizer_eq le_rfl, subgroupOf_self] at this
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
this : True → subgroupOf (normalizer ↑P) (normalizer (normalizer ↑P)) = ⊤
⊢ normalizer (normalizer ↑P) = normalizer ↑P

Next tactic:
rw [← subtype_range (P : Subgroup G).normalizer.normalizer, MonoidHom.range_eq_map,
    ← this trivial]
@[simp]
theorem normalizer_normalizer {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G) :
    (↑P : Subgroup G).normalizer.normalizer = (↑P : Subgroup G).normalizer := by
  have := normal_of_normalizer_normal (P.subtype (le_normalizer.trans le_normalizer))
  simp_rw [← normalizer_eq_top, Sylow.coe_subtype, ← subgroupOf_normalizer_eq le_normalizer, ←
    subgroupOf_normalizer_eq le_rfl, subgroupOf_self] at this
  rw [← subtype_range (P : Subgroup G).normalizer.normalizer, MonoidHom.range_eq_map,
    ← this trivial]
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝² : Group G
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
this : True → subgroupOf (normalizer ↑P) (normalizer (normalizer ↑P)) = ⊤
⊢ Subgroup.map (Subgroup.subtype (normalizer (normalizer ↑P)))
      (subgroupOf (normalizer ↑P) (normalizer (normalizer ↑P))) =
    normalizer ↑P

Next tactic:
exact map_comap_eq_self (le_normalizer.trans (ge_of_eq (subtype_range _)))
theorem normal_of_all_max_subgroups_normal [Finite G]
    (hnc : ∀ H : Subgroup G, IsCoatom H → H.Normal) {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)]
    (P : Sylow p G) : (↑P : Subgroup G).Normal :=
  normalizer_eq_top.mp
    (by
      

Proof state:
G : Type u
α : Type v
β : Type w
inst✝³ : Group G
inst✝² : Finite G
hnc : ∀ (H : Subgroup G), IsCoatom H → Normal H
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
⊢ normalizer ↑P = ⊤

Next tactic:
rcases eq_top_or_exists_le_coatom (↑P : Subgroup G).normalizer with (heq | ⟨K, hK, hNK⟩)
theorem normal_of_all_max_subgroups_normal [Finite G]
    (hnc : ∀ H : Subgroup G, IsCoatom H → H.Normal) {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)]
    (P : Sylow p G) : (↑P : Subgroup G).Normal :=
  normalizer_eq_top.mp
    (by
      rcases eq_top_or_exists_le_coatom (↑P : Subgroup G).normalizer with (heq | ⟨K, hK, hNK⟩)
      · 

Proof state:
case inl
G : Type u
α : Type v
β : Type w
inst✝³ : Group G
inst✝² : Finite G
hnc : ∀ (H : Subgroup G), IsCoatom H → Normal H
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
heq : normalizer ↑P = ⊤
⊢ normalizer ↑P = ⊤

Next tactic:
exact heq
theorem normal_of_all_max_subgroups_normal [Finite G]
    (hnc : ∀ H : Subgroup G, IsCoatom H → H.Normal) {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)]
    (P : Sylow p G) : (↑P : Subgroup G).Normal :=
  normalizer_eq_top.mp
    (by
      rcases eq_top_or_exists_le_coatom (↑P : Subgroup G).normalizer with (heq | ⟨K, hK, hNK⟩)
      · exact heq
      · 

Proof state:
case inr.intro.intro
G : Type u
α : Type v
β : Type w
inst✝³ : Group G
inst✝² : Finite G
hnc : ∀ (H : Subgroup G), IsCoatom H → Normal H
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
K : Subgroup G
hK : IsCoatom K
hNK : normalizer ↑P ≤ K
⊢ normalizer ↑P = ⊤

Next tactic:
haveI := hnc _ hK
theorem normal_of_all_max_subgroups_normal [Finite G]
    (hnc : ∀ H : Subgroup G, IsCoatom H → H.Normal) {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)]
    (P : Sylow p G) : (↑P : Subgroup G).Normal :=
  normalizer_eq_top.mp
    (by
      rcases eq_top_or_exists_le_coatom (↑P : Subgroup G).normalizer with (heq | ⟨K, hK, hNK⟩)
      · exact heq
      · haveI := hnc _ hK
        

Proof state:
case inr.intro.intro
G : Type u
α : Type v
β : Type w
inst✝³ : Group G
inst✝² : Finite G
hnc : ∀ (H : Subgroup G), IsCoatom H → Normal H
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
K : Subgroup G
hK : IsCoatom K
hNK : normalizer ↑P ≤ K
this : Normal K
⊢ normalizer ↑P = ⊤

Next tactic:
have hPK : ↑P ≤ K := le_trans le_normalizer hNK
theorem normal_of_all_max_subgroups_normal [Finite G]
    (hnc : ∀ H : Subgroup G, IsCoatom H → H.Normal) {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)]
    (P : Sylow p G) : (↑P : Subgroup G).Normal :=
  normalizer_eq_top.mp
    (by
      rcases eq_top_or_exists_le_coatom (↑P : Subgroup G).normalizer with (heq | ⟨K, hK, hNK⟩)
      · exact heq
      · haveI := hnc _ hK
        have hPK : ↑P ≤ K := le_trans le_normalizer hNK
        

Proof state:
case inr.intro.intro
G : Type u
α : Type v
β : Type w
inst✝³ : Group G
inst✝² : Finite G
hnc : ∀ (H : Subgroup G), IsCoatom H → Normal H
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
K : Subgroup G
hK : IsCoatom K
hNK : normalizer ↑P ≤ K
this : Normal K
hPK : ↑P ≤ K
⊢ normalizer ↑P = ⊤

Next tactic:
refine' (hK.1 _).elim
theorem normal_of_all_max_subgroups_normal [Finite G]
    (hnc : ∀ H : Subgroup G, IsCoatom H → H.Normal) {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)]
    (P : Sylow p G) : (↑P : Subgroup G).Normal :=
  normalizer_eq_top.mp
    (by
      rcases eq_top_or_exists_le_coatom (↑P : Subgroup G).normalizer with (heq | ⟨K, hK, hNK⟩)
      · exact heq
      · haveI := hnc _ hK
        have hPK : ↑P ≤ K := le_trans le_normalizer hNK
        refine' (hK.1 _).elim
        

Proof state:
case inr.intro.intro
G : Type u
α : Type v
β : Type w
inst✝³ : Group G
inst✝² : Finite G
hnc : ∀ (H : Subgroup G), IsCoatom H → Normal H
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
inst✝ : Finite (Sylow p G)
P : Sylow p G
K : Subgroup G
hK : IsCoatom K
hNK : normalizer ↑P ≤ K
this : Normal K
hPK : ↑P ≤ K
⊢ K = ⊤

Next tactic:
rw [← sup_of_le_right hNK, P.normalizer_sup_eq_top' hPK]
/-- If all its Sylow subgroups are normal, then a finite group is isomorphic to the direct product
of these Sylow subgroups.
-/
noncomputable def directProductOfNormal [Fintype G]
    (hn : ∀ {p : ℕ} [Fact p.Prime] (P : Sylow p G), (↑P : Subgroup G).Normal) :
    (∀ p : (card G).primeFactors, ∀ P : Sylow p G, (↑P : Subgroup G)) ≃* G := by
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝¹ : Group G
inst✝ : Fintype G
hn : ∀ {p : ℕ} [inst : Fact (Nat.Prime p)] (P : Sylow p G), Normal ↑P
⊢ ((p : { x // x ∈ (Fintype.card G).primeFactors }) → (P : Sylow (↑p) G) → ↥↑P) ≃* G

Next tactic:
set ps := (Fintype.card G).primeFactors
/-- If all its Sylow subgroups are normal, then a finite group is isomorphic to the direct product
of these Sylow subgroups.
-/
noncomputable def directProductOfNormal [Fintype G]
    (hn : ∀ {p : ℕ} [Fact p.Prime] (P : Sylow p G), (↑P : Subgroup G).Normal) :
    (∀ p : (card G).primeFactors, ∀ P : Sylow p G, (↑P : Subgroup G)) ≃* G := by
  set ps := (Fintype.card G).primeFactors
  -- “The” Sylow subgroup for p
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝¹ : Group G
inst✝ : Fintype G
hn : ∀ {p : ℕ} [inst : Fact (Nat.Prime p)] (P : Sylow p G), Normal ↑P
ps : Finset ℕ := (Fintype.card G).primeFactors
⊢ ((p : { x // x ∈ ps }) → (P : Sylow (↑p) G) → ↥↑P) ≃* G

Next tactic:
let P : ∀ p, Sylow p G := default
/-- If all its Sylow subgroups are normal, then a finite group is isomorphic to the direct product
of these Sylow subgroups.
-/
noncomputable def directProductOfNormal [Fintype G]
    (hn : ∀ {p : ℕ} [Fact p.Prime] (P : Sylow p G), (↑P : Subgroup G).Normal) :
    (∀ p : (card G).primeFactors, ∀ P : Sylow p G, (↑P : Subgroup G)) ≃* G := by
  set ps := (Fintype.card G).primeFactors
  -- “The” Sylow subgroup for p
  let P : ∀ p, Sylow p G := default
  

Proof state:
G : Type u
α : Type v
β : Type w
inst✝¹ : Group G
inst✝ : Fintype G
hn : ∀ {p : ℕ} [inst : Fact (Nat.Prime p)] (P : Sylow p G), Normal ↑P
ps : Finset ℕ := (Fintype.card G).primeFactors
P : (p : ℕ) → Sylow p G := default
⊢ ((p : { x // x ∈ ps }) → (P : Sylow (↑p) G) → ↥↑P) ≃* G

Next tactic:
have hcomm : Pairwise fun p₁ p₂ : ps => ∀ x y : G, x ∈ P p₁ → y ∈ P p₂ → Commute x y := by
    rintro ⟨p₁, hp₁⟩ ⟨p₂, hp₂⟩ hne
    haveI hp₁' := Fact.mk (Nat.prime_of_mem_primeFactors hp₁)
    haveI hp₂' := Fact.mk (Nat.prime_of_mem_primeFactors hp₂)
    have hne' : p₁ ≠ p₂ := by simpa using hne
    apply Subgroup.commute_of_normal_of_disjoint _ _ (hn (P p₁)) (hn (P p₂))
    apply IsPGroup.disjoint_of_ne p₁ p₂ hne' _ _ (P p₁).isPGroup' (P p₂).isPGroup'
/-- If all its Sylow subgroups are normal, then a finite group is isomorphic to the direct product
of these Sylow subgroups.
-/
noncomputable def directProductOfNormal [Fintype G]
    (hn : ∀ {p : ℕ} [Fact p.Prime] (P : Sylow p G), (↑P : Subgroup G).Normal) :
    (∀ p : (card G).primeFactors, ∀ P : Sylow p G, (↑P : Subgroup G)) ≃* G := by
  set ps := (Fintype.card G).primeFactors
  -- “The” Sylow subgroup for p
  let P : ∀ p, Sylow p G := default
  have hcomm : Pairwise fun p₁ p₂ : ps => ∀ x y : G, x ∈ P p₁ → y ∈ P p₂ → Commute x y := by
    

Proof state:
G : Type u
α : Type v
β : Type w
inst✝¹ : Group G
inst✝ : Fintype G
hn : ∀ {p : ℕ} [inst : Fact (Nat.Prime p)] (P : Sylow p G), Normal ↑P
ps : Finset ℕ := (Fintype.card G).primeFactors
P : (p : ℕ) → Sylow p G := default
⊢ _root_.Pairwise fun p₁ p₂ => ∀ (x y : G), x ∈ P ↑p₁ → y ∈ P ↑p₂ → Commute x y

Next tactic:
rintro ⟨p₁, hp₁⟩ ⟨p₂, hp₂⟩ hne
/-- If all its Sylow subgroups are normal, then a finite group is isomorphic to the direct product
of these Sylow subgroups.
-/
noncomputable def directProductOfNormal [Fintype G]
    (hn : ∀ {p : ℕ} [Fact p.Prime] (P : Sylow p G), (↑P : Subgroup G).Normal) :
    (∀ p : (card G).primeFactors, ∀ P : Sylow p G, (↑P : Subgroup G)) ≃* G := by
  set ps := (Fintype.card G).primeFactors
  -- “The” Sylow subgroup for p
  let P : ∀ p, Sylow p G := default
  have hcomm : Pairwise fun p₁ p₂ : ps => ∀ x y : G, x ∈ P p₁ → y ∈ P p₂ → Commute x y := by
    rintro ⟨p₁, hp₁⟩ ⟨p₂, hp₂⟩ hne
    

Proof state:
case mk.mk
G : Type u
α : Type v
β : Type w
inst✝¹ : Group G
inst✝ : Fintype G
hn : ∀ {p : ℕ} [inst : Fact (Nat.Prime p)] (P : Sylow p G), Normal ↑P
ps : Finset ℕ := (Fintype.card G).primeFactors
P : (p : ℕ) → Sylow p G := default
p₁ : ℕ
hp₁ : p₁ ∈ ps
p₂ : ℕ
hp₂ : p₂ ∈ ps
hne : { val := p₁, property := hp₁ } ≠ { val := p₂, property := hp₂ }
⊢ ∀ (x y : G), x ∈ P ↑{ val := p₁, property := hp₁ } → y ∈ P ↑{ val := p₂, property := hp₂ } → Commute x y

Next tactic:
haveI hp₁' := Fact.mk (Nat.prime_of_mem_primeFactors hp₁)
/-- If all its Sylow subgroups are normal, then a finite group is isomorphic to the direct product
of these Sylow subgroups.
-/
noncomputable def directProductOfNormal [Fintype G]
    (hn : ∀ {p : ℕ} [Fact p.Prime] (P : Sylow p G), (↑P : Subgroup G).Normal) :
    (∀ p : (card G).primeFactors, ∀ P : Sylow p G, (↑P : Subgroup G)) ≃* G := by
  set ps := (Fintype.card G).primeFactors
  -- “The” Sylow subgroup for p
  let P : ∀ p, Sylow p G := default
  have hcomm : Pairwise fun p₁ p₂ : ps => ∀ x y : G, x ∈ P p₁ → y ∈ P p₂ → Commute x y := by
    rintro ⟨p₁, hp₁⟩ ⟨p₂, hp₂⟩ hne
    haveI hp₁' := Fact.mk (Nat.prime_of_mem_primeFactors hp₁)
    

Proof state:
case mk.mk
G : Type u
α : Type v
β : Type w
inst✝¹ : Group G
inst✝ : Fintype G
hn : ∀ {p : ℕ} [inst : Fact (Nat.Prime p)] (P : Sylow p G), Normal ↑P
ps : Finset ℕ := (Fintype.card G).primeFactors
P : (p : ℕ) → Sylow p G := default
p₁ : ℕ
hp₁ : p₁ ∈ ps
p₂ : ℕ
hp₂ : p₂ ∈ ps
hne : { val := p₁, property := hp₁ } ≠ { val := p₂, property := hp₂ }
hp₁' : Fact (Nat.Prime p₁)
⊢ ∀ (x y : G), x ∈ P ↑{ val := p₁, property := hp₁ } → y ∈ P ↑{ val := p₂, property := hp₂ } → Commute x y

Next tactic:
haveI hp₂' := Fact.mk (Nat.prime_of_mem_primeFactors hp₂)
/-- If all its Sylow subgroups are normal, then a finite group is isomorphic to the direct product
of these Sylow subgroups.
-/
noncomputable def directProductOfNormal [Fintype G]
    (hn : ∀ {p : ℕ} [Fact p.Prime] (P : Sylow p G), (↑P : Subgroup G).Normal) :
    (∀ p : (card G).primeFactors, ∀ P : Sylow p G, (↑P : Subgroup G)) ≃* G := by
  set ps := (Fintype.card G).primeFactors
  -- “The” Sylow subgroup for p
  let P : ∀ p, Sylow p G := default
  have hcomm : Pairwise fun p₁ p₂ : ps => ∀ x y : G, x ∈ P p₁ → y ∈ P p₂ → Commute x y := by
    rintro ⟨p₁, hp₁⟩ ⟨p₂, hp₂⟩ hne
    haveI hp₁' := Fact.mk (Nat.prime_of_mem_primeFactors hp₁)
    haveI hp₂' := Fact.mk (Nat.prime_of_mem_primeFactors hp₂)
    

Proof state:
case mk.mk
G : Type u
α : Type v
β : Type w
inst✝¹ : Group G
inst✝ : Fintype G
hn : ∀ {p : ℕ} [inst : Fact (Nat.Prime p)] (P : Sylow p G), Normal ↑P
ps : Finset ℕ := (Fintype.card G).primeFactors
P : (p : ℕ) → Sylow p G := default
p₁ : ℕ
hp₁ : p₁ ∈ ps
p₂ : ℕ
hp₂ : p₂ ∈ ps
hne : { val := p₁, property := hp₁ } ≠ { val := p₂, property := hp₂ }
hp₁' : Fact (Nat.Prime p₁)
hp₂' : Fact (Nat.Prime p₂)
⊢ ∀ (x y : G), x ∈ P ↑{ val := p₁, property := hp₁ } → y ∈ P ↑{ val := p₂, property := hp₂ } → Commute x y

Next tactic:
have hne' : p₁ ≠ p₂ := by simpa using hne
/-- If all its Sylow subgroups are normal, then a finite group is isomorphic to the direct product
of these Sylow subgroups.
-/
noncomputable def directProductOfNormal [Fintype G]
    (hn : ∀ {p : ℕ} [Fact p.Prime] (P : Sylow p G), (↑P : Subgroup G).Normal) :
    (∀ p : (card G).primeFactors, ∀ P : Sylow p G, (↑P : Subgroup G)) ≃* G := by
  set ps := (Fintype.card G).primeFactors
  -- “The” Sylow subgroup for p
  let P : ∀ p, Sylow p G := default
  have hcomm : Pairwise fun p₁ p₂ : ps => ∀ x y : G, x ∈ P p₁ → y ∈ P p₂ → Commute x y := by
    rintro ⟨p₁, hp₁⟩ ⟨p₂, hp₂⟩ hne
    haveI hp₁' := Fact.mk (Nat.prime_of_mem_primeFactors hp₁)
    haveI hp₂' := Fact.mk (Nat.prime_of_mem_primeFactors hp₂)
    have hne' : p₁ ≠ p₂ := by 

Proof state:
G : Type u
α : Type v
β : Type w
inst✝¹ : Group G
inst✝ : Fintype G
hn : ∀ {p : ℕ} [inst : Fact (Nat.Prime p)] (P : Sylow p G), Normal ↑P
ps : Finset ℕ := (Fintype.card G).primeFactors
P : (p : ℕ) → Sylow p G := default
p₁ : ℕ
hp₁ : p₁ ∈ ps
p₂ : ℕ
hp₂ : p₂ ∈ ps
hne : { val := p₁, property := hp₁ } ≠ { val := p₂, property := hp₂ }
hp₁' : Fact (Nat.Prime p₁)
hp₂' : Fact (Nat.Prime p₂)
⊢ p₁ ≠ p₂

Next tactic:
simpa using hne
/-- If all its Sylow subgroups are normal, then a finite group is isomorphic to the direct product
of these Sylow subgroups.
-/
noncomputable def directProductOfNormal [Fintype G]
    (hn : ∀ {p : ℕ} [Fact p.Prime] (P : Sylow p G), (↑P : Subgroup G).Normal) :
    (∀ p : (card G).primeFactors, ∀ P : Sylow p G, (↑P : Subgroup G)) ≃* G := by
  set ps := (Fintype.card G).primeFactors
  -- “The” Sylow subgroup for p
  let P : ∀ p, Sylow p G := default
  have hcomm : Pairwise fun p₁ p₂ : ps => ∀ x y : G, x ∈ P p₁ → y ∈ P p₂ → Commute x y := by
    rintro ⟨p₁, hp₁⟩ ⟨p₂, hp₂⟩ hne
    haveI hp₁' := Fact.mk (Nat.prime_of_mem_primeFactors hp₁)
    haveI hp₂' := Fact.mk (Nat.prime_of_mem_primeFactors hp₂)
    have hne' : p₁ ≠ p₂ := by simpa using hne
    

Proof state:
case mk.mk
G : Type u
α : Type v
β : Type w
inst✝¹ : Group G
inst✝ : Fintype G
hn : ∀ {p : ℕ} [inst : Fact (Nat.Prime p)] (P : Sylow p G), Normal ↑P
ps : Finset ℕ := (Fintype.card G).primeFactors
P : (p : ℕ) → Sylow p G := default
p₁ : ℕ
hp₁ : p₁ ∈ ps
p₂ : ℕ
hp₂ : p₂ ∈ ps
hne : { val := p₁, property := hp₁ } ≠ { val := p₂, property := hp₂ }
hp₁' : Fact (Nat.Prime p₁)
hp₂' : Fact (Nat.Prime p₂)
hne' : p₁ ≠ p₂
⊢ ∀ (x y : G), x ∈ P ↑{ val := p₁, property := hp₁ } → y ∈ P ↑{ val := p₂, property := hp₂ } → Commute x y

Next tactic:
apply Subgroup.commute_of_normal_of_disjoint _ _ (hn (P p₁)) (hn (P p₂))