α : Type u
a : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d : ℕ
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
α : Type u
a : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
⊢ ∀ {d : ℕ},
    d ∣ Fintype.card α →
      0 < card (filter (fun a => orderOf a = d) univ) → card (filter (fun a => orderOf a = d) univ) = φ d
intro d hd hpos
case H
α : Type u
a : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
α : Type u
a : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d : ℕ
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
induction' d using Nat.strongRec' with d IH
case H.inl
α : Type u
a : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d : ℕ
hd✝ : d ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d) univ)
IH :
  ∀ (m : ℕ),
    m < 0 →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : 0 ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = 0) univ)
⊢ card (filter (fun a => orderOf a = 0) univ) = φ 0

case H.inr
α : Type u
a : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
case H
α : Type u
a : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
rcases Decidable.eq_or_ne d 0 with (rfl | hd0)
case H.inr.intro
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
case H.inr
α : Type u
a : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
rcases card_pos.1 hpos with ⟨a, ha'⟩
case H.inr.intro
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
case H.inr.intro
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
have ha : orderOf a = d := (mem_filter.1 ha').2
case H.inr.intro
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
h1 : ∑ m in properDivisors d, card (filter (fun a => orderOf a = m) univ) = ∑ m in properDivisors d, φ m
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
case H.inr.intro
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
have h1 :
  (∑ m in d.properDivisors, (univ.filter fun a : α => orderOf a = m).card) =
    ∑ m in d.properDivisors, φ m := by
  refine' Finset.sum_congr rfl fun m hm => _
  simp only [mem_filter, mem_range, mem_properDivisors] at hm
  refine' IH m hm.2 (hm.1.trans hd) (Finset.card_pos.2 ⟨a ^ (d / m), _⟩)
  simp only [mem_filter, mem_univ, orderOf_pow a, ha, true_and_iff,
    Nat.gcd_eq_right (div_dvd_of_dvd hm.1), Nat.div_div_self hm.1 hd0]
case H.inr.intro
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
h1 : ∑ m in properDivisors d, card (filter (fun a => orderOf a = m) univ) = ∑ m in properDivisors d, φ m
h2 : ∑ m in divisors d, card (filter (fun a => orderOf a = m) univ) = ∑ m in divisors d, φ m
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
case H.inr.intro
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
h1 : ∑ m in properDivisors d, card (filter (fun a => orderOf a = m) univ) = ∑ m in properDivisors d, φ m
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
have h2 :
  (∑ m in d.divisors, (univ.filter fun a : α => orderOf a = m).card) =
    ∑ m in d.divisors, φ m := by
  rw [← filter_dvd_eq_divisors hd0, sum_card_orderOf_eq_card_pow_eq_one hd0,
    filter_dvd_eq_divisors hd0, sum_totient, ← ha, card_pow_eq_one_eq_orderOf_aux hn a]
no goals
case H.inr.intro
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
h1 : ∑ m in properDivisors d, card (filter (fun a => orderOf a = m) univ) = ∑ m in properDivisors d, φ m
h2 : ∑ m in divisors d, card (filter (fun a => orderOf a = m) univ) = ∑ m in divisors d, φ m
⊢ card (filter (fun a => orderOf a = d) univ) = φ d
simpa [← cons_self_properDivisors hd0, ← h1] using h2
no goals
case H.inl
α : Type u
a : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d : ℕ
hd✝ : d ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d) univ)
IH :
  ∀ (m : ℕ),
    m < 0 →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : 0 ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = 0) univ)
⊢ card (filter (fun a => orderOf a = 0) univ) = φ 0
cases Fintype.card_ne_zero (eq_zero_of_zero_dvd hd)
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
m : ℕ
hm : m ∈ properDivisors d
⊢ card (filter (fun a => orderOf a = m) univ) = φ m
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
⊢ ∑ m in properDivisors d, card (filter (fun a => orderOf a = m) univ) = ∑ m in properDivisors d, φ m
refine' Finset.sum_congr rfl fun m hm => _
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
m : ℕ
hm : m ∣ d ∧ m < d
⊢ card (filter (fun a => orderOf a = m) univ) = φ m
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
m : ℕ
hm : m ∈ properDivisors d
⊢ card (filter (fun a => orderOf a = m) univ) = φ m
simp only [mem_filter, mem_range, mem_properDivisors] at hm
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
m : ℕ
hm : m ∣ d ∧ m < d
⊢ a ^ (d / m) ∈ filter (fun a => orderOf a = m) univ
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
m : ℕ
hm : m ∣ d ∧ m < d
⊢ card (filter (fun a => orderOf a = m) univ) = φ m
refine' IH m hm.2 (hm.1.trans hd) (Finset.card_pos.2 ⟨a ^ (d / m), _⟩)
no goals
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
m : ℕ
hm : m ∣ d ∧ m < d
⊢ a ^ (d / m) ∈ filter (fun a => orderOf a = m) univ
simp only [mem_filter, mem_univ, orderOf_pow a, ha, true_and_iff,
  Nat.gcd_eq_right (div_dvd_of_dvd hm.1), Nat.div_div_self hm.1 hd0]
no goals
α : Type u
a✝ : α
inst✝² : Group α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
hn : ∀ (n : ℕ), 0 < n → card (filter (fun a => a ^ n = 1) univ) ≤ n
d✝ : ℕ
hd✝ : d✝ ∣ Fintype.card α
hpos✝ : 0 < card (filter (fun a => orderOf a = d✝) univ)
d : ℕ
IH :
  ∀ (m : ℕ),
    m < d →
      m ∣ Fintype.card α →
        0 < card (filter (fun a => orderOf a = m) univ) → card (filter (fun a => orderOf a = m) univ) = φ m
hd : d ∣ Fintype.card α
hpos : 0 < card (filter (fun a => orderOf a = d) univ)
hd0 : d ≠ 0
a : α
ha' : a ∈ filter (fun a => orderOf a = d) univ
ha : orderOf a = d
h1 : ∑ m in properDivisors d, card (filter (fun a => orderOf a = m) univ) = ∑ m in properDivisors d, φ m
⊢ ∑ m in divisors d, card (filter (fun a => orderOf a = m) univ) = ∑ m in divisors d, φ m
rw [← filter_dvd_eq_divisors hd0, sum_card_orderOf_eq_card_pow_eq_one hd0,
  filter_dvd_eq_divisors hd0, sum_totient, ← ha, card_pow_eq_one_eq_orderOf_aux hn a]