l3lab/ntp-mathlib huggingface dataset:
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      

Proof state:
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
⊢ orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)

Next tactic:
rw [← hgf, ← Fintype.card_pi]
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      

Proof state:
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
⊢ orderOf
      ((noncommPiCoprod (fun x => ϕ ↑x)
          (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
        g) ∣
    Fintype.card ((a : { j // j ≠ i }) → H ↑a)

Next tactic:
exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    

Proof state:
case intro.intro.intro.intro
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp✝ : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)
⊢ f ∈ ⊥

Next tactic:
change f = 1
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    change f = 1
    

Proof state:
case intro.intro.intro.intro
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp✝ : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)
⊢ f = 1

Next tactic:
rw [← pow_one f, ← orderOf_dvd_iff_pow_eq_one]
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    change f = 1
    rw [← pow_one f, ← orderOf_dvd_iff_pow_eq_one]
    -- porting note: ouch, had to replace an ugly `convert`
    

Proof state:
case intro.intro.intro.intro
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp✝ : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)
⊢ orderOf f ∣ 1

Next tactic:
obtain ⟨c, hc⟩ := Nat.dvd_gcd hxp hxi
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    change f = 1
    rw [← pow_one f, ← orderOf_dvd_iff_pow_eq_one]
    -- porting note: ouch, had to replace an ugly `convert`
    obtain ⟨c, hc⟩ := Nat.dvd_gcd hxp hxi
    

Proof state:
case intro.intro.intro.intro.intro
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp✝ : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)
c : ℕ
hc : Nat.gcd (∏ j : { j // j ≠ i }, Fintype.card (H ↑j)) (Fintype.card (H i)) = orderOf f * c
⊢ orderOf f ∣ 1

Next tactic:
use c
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    change f = 1
    rw [← pow_one f, ← orderOf_dvd_iff_pow_eq_one]
    -- porting note: ouch, had to replace an ugly `convert`
    obtain ⟨c, hc⟩ := Nat.dvd_gcd hxp hxi
    use c
    

Proof state:
case h
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp✝ : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)
c : ℕ
hc : Nat.gcd (∏ j : { j // j ≠ i }, Fintype.card (H ↑j)) (Fintype.card (H i)) = orderOf f * c
⊢ 1 = orderOf f * c

Next tactic:
rw [← hc]
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    change f = 1
    rw [← pow_one f, ← orderOf_dvd_iff_pow_eq_one]
    -- porting note: ouch, had to replace an ugly `convert`
    obtain ⟨c, hc⟩ := Nat.dvd_gcd hxp hxi
    use c
    rw [← hc]
    

Proof state:
case h
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp✝ : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)
c : ℕ
hc : Nat.gcd (∏ j : { j // j ≠ i }, Fintype.card (H ↑j)) (Fintype.card (H i)) = orderOf f * c
⊢ 1 = Nat.gcd (∏ j : { j // j ≠ i }, Fintype.card (H ↑j)) (Fintype.card (H i))

Next tactic:
symm
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    change f = 1
    rw [← pow_one f, ← orderOf_dvd_iff_pow_eq_one]
    -- porting note: ouch, had to replace an ugly `convert`
    obtain ⟨c, hc⟩ := Nat.dvd_gcd hxp hxi
    use c
    rw [← hc]
    symm
    

Proof state:
case h
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp✝ : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)
c : ℕ
hc : Nat.gcd (∏ j : { j // j ≠ i }, Fintype.card (H ↑j)) (Fintype.card (H i)) = orderOf f * c
⊢ Nat.gcd (∏ j : { j // j ≠ i }, Fintype.card (H ↑j)) (Fintype.card (H i)) = 1

Next tactic:
rw [← Nat.coprime_iff_gcd_eq_one, Nat.coprime_fintype_prod_left_iff, Subtype.forall]
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    change f = 1
    rw [← pow_one f, ← orderOf_dvd_iff_pow_eq_one]
    -- porting note: ouch, had to replace an ugly `convert`
    obtain ⟨c, hc⟩ := Nat.dvd_gcd hxp hxi
    use c
    rw [← hc]
    symm
    rw [← Nat.coprime_iff_gcd_eq_one, Nat.coprime_fintype_prod_left_iff, Subtype.forall]
    

Proof state:
case h
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp✝ : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)
c : ℕ
hc : Nat.gcd (∏ j : { j // j ≠ i }, Fintype.card (H ↑j)) (Fintype.card (H i)) = orderOf f * c
⊢ ∀ (a : ι) (b : a ≠ i), Nat.Coprime (Fintype.card (H ↑{ val := a, property := b })) (Fintype.card (H i))

Next tactic:
intro j
@[to_additive]
theorem independent_range_of_coprime_order [Finite ι] [∀ i, Fintype (H i)]
    (hcoprime : ∀ i j, i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))) :
    CompleteLattice.Independent fun i => (ϕ i).range := by
  cases nonempty_fintype ι
  classical
    rintro i
    rw [disjoint_iff_inf_le]
    rintro f ⟨hxi, hxp⟩
    dsimp at hxi hxp
    rw [iSup_subtype', ← noncommPiCoprod_range] at hxp
    rotate_left
    · intro _ _ hj
      apply hcomm
      exact hj ∘ Subtype.ext
    cases' hxp with g hgf
    cases' hxi with g' hg'f
    have hxi : orderOf f ∣ Fintype.card (H i) := by
      rw [← hg'f]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    have hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H j) := by
      rw [← hgf, ← Fintype.card_pi]
      exact (orderOf_map_dvd _ _).trans orderOf_dvd_card
    change f = 1
    rw [← pow_one f, ← orderOf_dvd_iff_pow_eq_one]
    -- porting note: ouch, had to replace an ugly `convert`
    obtain ⟨c, hc⟩ := Nat.dvd_gcd hxp hxi
    use c
    rw [← hc]
    symm
    rw [← Nat.coprime_iff_gcd_eq_one, Nat.coprime_fintype_prod_left_iff, Subtype.forall]
    intro j
    

Proof state:
case h
G : Type u_1
inst✝³ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Type u_3
inst✝² : (i : ι) → Group (H i)
ϕ : (i : ι) → H i →* G
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x : H i) (y : H j), Commute ((ϕ i) x) ((ϕ j) y)
f✝ g✝ : (i : ι) → H i
inst✝¹ : Finite ι
inst✝ : (i : ι) → Fintype (H i)
hcoprime : ∀ (i j : ι), i ≠ j → Nat.Coprime (Fintype.card (H i)) (Fintype.card (H j))
val✝ : Fintype ι
i : ι
f : G
hxp✝ : f ∈ ↑(⨆ x, range (ϕ ↑x))
g : (i_1 : { j // ¬j = i }) → H ↑i_1
hgf :
  (noncommPiCoprod (fun x => ϕ ↑x)
        (_ : ∀ (i_1 j : { j // ¬j = i }), i_1 ≠ j → ∀ (x : H ↑i_1) (y : H ↑j), Commute ((ϕ ↑i_1) x) ((ϕ ↑j) y)))
      g =
    f
g' : H i
hg'f : (ϕ i) g' = f
hxi : orderOf f ∣ Fintype.card (H i)
hxp : orderOf f ∣ ∏ j : { j // j ≠ i }, Fintype.card (H ↑j)
c : ℕ
hc : Nat.gcd (∏ j : { j // j ≠ i }, Fintype.card (H ↑j)) (Fintype.card (H i)) = orderOf f * c
j : ι
⊢ ∀ (b : j ≠ i), Nat.Coprime (Fintype.card (H ↑{ val := j, property := b })) (Fintype.card (H i))

Next tactic:
exact hcoprime _ _
@[to_additive]
theorem commute_subtype_of_commute (i j : ι) (hne : i ≠ j) :
    ∀ (x : H i) (y : H j), Commute ((H i).subtype x) ((H j).subtype y) := by
  

Proof state:
G : Type u_1
inst✝ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Subgroup G
f g : (i : ι) → ↥(H i)
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x y : G), x ∈ H i → y ∈ H j → Commute x y
i j : ι
hne : i ≠ j
⊢ ∀ (x : ↥(H i)) (y : ↥(H j)), Commute ((Subgroup.subtype (H i)) x) ((Subgroup.subtype (H j)) y)

Next tactic:
rintro ⟨x, hx⟩ ⟨y, hy⟩
@[to_additive]
theorem commute_subtype_of_commute (i j : ι) (hne : i ≠ j) :
    ∀ (x : H i) (y : H j), Commute ((H i).subtype x) ((H j).subtype y) := by
  rintro ⟨x, hx⟩ ⟨y, hy⟩
  

Proof state:
case mk.mk
G : Type u_1
inst✝ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Subgroup G
f g : (i : ι) → ↥(H i)
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x y : G), x ∈ H i → y ∈ H j → Commute x y
i j : ι
hne : i ≠ j
x : G
hx : x ∈ H i
y : G
hy : y ∈ H j
⊢ Commute ((Subgroup.subtype (H i)) { val := x, property := hx })
    ((Subgroup.subtype (H j)) { val := y, property := hy })

Next tactic:
exact hcomm i j hne x y hx hy
@[to_additive (attr := simp)]
theorem noncommPiCoprod_mulSingle (i : ι) (y : H i) :
    noncommPiCoprod hcomm (Pi.mulSingle i y) = y := by 

Proof state:
G : Type u_1
inst✝ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Subgroup G
f g : (i : ι) → ↥(H i)
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x y : G), x ∈ H i → y ∈ H j → Commute x y
i : ι
y : ↥(H i)
⊢ (noncommPiCoprod hcomm) (Pi.mulSingle i y) = ↑y

Next tactic:
apply MonoidHom.noncommPiCoprod_mulSingle
@[to_additive]
theorem noncommPiCoprod_range : (noncommPiCoprod hcomm).range = ⨆ i : ι, H i := by
  

Proof state:
G : Type u_1
inst✝ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Subgroup G
f g : (i : ι) → ↥(H i)
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x y : G), x ∈ H i → y ∈ H j → Commute x y
⊢ MonoidHom.range (noncommPiCoprod hcomm) = ⨆ i, H i

Next tactic:
simp [noncommPiCoprod, MonoidHom.noncommPiCoprod_range]
@[to_additive]
theorem injective_noncommPiCoprod_of_independent (hind : CompleteLattice.Independent H) :
    Function.Injective (noncommPiCoprod hcomm) := by
  

Proof state:
G : Type u_1
inst✝ : Group G
ι : Type u_2
hdec : DecidableEq ι
hfin : Fintype ι
H : ι → Subgroup G
f g : (i : ι) → ↥(H i)
hcomm : ∀ (i j : ι), i ≠ j → ∀ (x y : G), x ∈ H i → y ∈ H j → Commute x y
hind : CompleteLattice.Independent H
⊢ Function.Injective ⇑(noncommPiCoprod hcomm)

Next tactic:
apply MonoidHom.injective_noncommPiCoprod_of_independent