l3lab/ntp-mathlib huggingface dataset:
/-- `IsPrimitiveRoot.autToPow` is injective in the case that it's considered over a cyclotomic
field extension. -/
theorem autToPow_injective : Function.Injective <| hμ.autToPow K := by
  intro f g hfg
  apply_fun Units.val at hfg
  simp only [IsPrimitiveRoot.coe_autToPow_apply] at hfg
  -- Porting note: was `generalize_proofs hf' hg' at hfg`
  revert hfg
  generalize_proofs hf' hg'
  intro hfg
  have hf := hf'.choose_spec
  have hg := hg'.choose_spec
  -- Porting note: was `generalize_proofs hζ at hf hg`
  revert hf hg
  generalize_proofs hζ
  intro hf hg
  suffices f (hμ.toRootsOfUnity : Lˣ) = g (hμ.toRootsOfUnity : Lˣ) by
    apply AlgEquiv.coe_algHom_injective
    apply (hμ.powerBasis K).algHom_ext
    exact this
  rw [ZMod.eq_iff_modEq_nat] at hfg
  refine' (hf.trans _).trans hg.symm
  rw [← rootsOfUnity.coe_pow _ hf'.choose, ← rootsOfUnity.coe_pow _ hg'.choose]
  

Proof state:
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
f g : L ≃ₐ[K] L
hf' : ∃ m, f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hg' : ∃ m, g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hfg : Exists.choose hf' ≡ Exists.choose hg' [MOD ↑n]
hf : f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hf'
hg : g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hg'
⊢ ↑↑(toRootsOfUnity hμ ^ Exists.choose hf') = ↑↑(toRootsOfUnity hμ ^ Exists.choose hg')

Next tactic:
congr 2
/-- `IsPrimitiveRoot.autToPow` is injective in the case that it's considered over a cyclotomic
field extension. -/
theorem autToPow_injective : Function.Injective <| hμ.autToPow K := by
  intro f g hfg
  apply_fun Units.val at hfg
  simp only [IsPrimitiveRoot.coe_autToPow_apply] at hfg
  -- Porting note: was `generalize_proofs hf' hg' at hfg`
  revert hfg
  generalize_proofs hf' hg'
  intro hfg
  have hf := hf'.choose_spec
  have hg := hg'.choose_spec
  -- Porting note: was `generalize_proofs hζ at hf hg`
  revert hf hg
  generalize_proofs hζ
  intro hf hg
  suffices f (hμ.toRootsOfUnity : Lˣ) = g (hμ.toRootsOfUnity : Lˣ) by
    apply AlgEquiv.coe_algHom_injective
    apply (hμ.powerBasis K).algHom_ext
    exact this
  rw [ZMod.eq_iff_modEq_nat] at hfg
  refine' (hf.trans _).trans hg.symm
  rw [← rootsOfUnity.coe_pow _ hf'.choose, ← rootsOfUnity.coe_pow _ hg'.choose]
  congr 2
  

Proof state:
case e_self.e_self
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
f g : L ≃ₐ[K] L
hf' : ∃ m, f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hg' : ∃ m, g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hfg : Exists.choose hf' ≡ Exists.choose hg' [MOD ↑n]
hf : f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hf'
hg : g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hg'
⊢ toRootsOfUnity hμ ^ Exists.choose hf' = toRootsOfUnity hμ ^ Exists.choose hg'

Next tactic:
rw [pow_eq_pow_iff_modEq]
/-- `IsPrimitiveRoot.autToPow` is injective in the case that it's considered over a cyclotomic
field extension. -/
theorem autToPow_injective : Function.Injective <| hμ.autToPow K := by
  intro f g hfg
  apply_fun Units.val at hfg
  simp only [IsPrimitiveRoot.coe_autToPow_apply] at hfg
  -- Porting note: was `generalize_proofs hf' hg' at hfg`
  revert hfg
  generalize_proofs hf' hg'
  intro hfg
  have hf := hf'.choose_spec
  have hg := hg'.choose_spec
  -- Porting note: was `generalize_proofs hζ at hf hg`
  revert hf hg
  generalize_proofs hζ
  intro hf hg
  suffices f (hμ.toRootsOfUnity : Lˣ) = g (hμ.toRootsOfUnity : Lˣ) by
    apply AlgEquiv.coe_algHom_injective
    apply (hμ.powerBasis K).algHom_ext
    exact this
  rw [ZMod.eq_iff_modEq_nat] at hfg
  refine' (hf.trans _).trans hg.symm
  rw [← rootsOfUnity.coe_pow _ hf'.choose, ← rootsOfUnity.coe_pow _ hg'.choose]
  congr 2
  rw [pow_eq_pow_iff_modEq]
  

Proof state:
case e_self.e_self
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
f g : L ≃ₐ[K] L
hf' : ∃ m, f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hg' : ∃ m, g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hfg : Exists.choose hf' ≡ Exists.choose hg' [MOD ↑n]
hf : f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hf'
hg : g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hg'
⊢ Exists.choose hf' ≡ Exists.choose hg' [MOD orderOf (toRootsOfUnity hμ)]

Next tactic:
convert hfg
/-- `IsPrimitiveRoot.autToPow` is injective in the case that it's considered over a cyclotomic
field extension. -/
theorem autToPow_injective : Function.Injective <| hμ.autToPow K := by
  intro f g hfg
  apply_fun Units.val at hfg
  simp only [IsPrimitiveRoot.coe_autToPow_apply] at hfg
  -- Porting note: was `generalize_proofs hf' hg' at hfg`
  revert hfg
  generalize_proofs hf' hg'
  intro hfg
  have hf := hf'.choose_spec
  have hg := hg'.choose_spec
  -- Porting note: was `generalize_proofs hζ at hf hg`
  revert hf hg
  generalize_proofs hζ
  intro hf hg
  suffices f (hμ.toRootsOfUnity : Lˣ) = g (hμ.toRootsOfUnity : Lˣ) by
    apply AlgEquiv.coe_algHom_injective
    apply (hμ.powerBasis K).algHom_ext
    exact this
  rw [ZMod.eq_iff_modEq_nat] at hfg
  refine' (hf.trans _).trans hg.symm
  rw [← rootsOfUnity.coe_pow _ hf'.choose, ← rootsOfUnity.coe_pow _ hg'.choose]
  congr 2
  rw [pow_eq_pow_iff_modEq]
  convert hfg
  

Proof state:
case h.e'_1
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
f g : L ≃ₐ[K] L
hf' : ∃ m, f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hg' : ∃ m, g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hfg : Exists.choose hf' ≡ Exists.choose hg' [MOD ↑n]
hf : f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hf'
hg : g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hg'
⊢ orderOf (toRootsOfUnity hμ) = ↑n

Next tactic:
rw [hμ.eq_orderOf]
/-- `IsPrimitiveRoot.autToPow` is injective in the case that it's considered over a cyclotomic
field extension. -/
theorem autToPow_injective : Function.Injective <| hμ.autToPow K := by
  intro f g hfg
  apply_fun Units.val at hfg
  simp only [IsPrimitiveRoot.coe_autToPow_apply] at hfg
  -- Porting note: was `generalize_proofs hf' hg' at hfg`
  revert hfg
  generalize_proofs hf' hg'
  intro hfg
  have hf := hf'.choose_spec
  have hg := hg'.choose_spec
  -- Porting note: was `generalize_proofs hζ at hf hg`
  revert hf hg
  generalize_proofs hζ
  intro hf hg
  suffices f (hμ.toRootsOfUnity : Lˣ) = g (hμ.toRootsOfUnity : Lˣ) by
    apply AlgEquiv.coe_algHom_injective
    apply (hμ.powerBasis K).algHom_ext
    exact this
  rw [ZMod.eq_iff_modEq_nat] at hfg
  refine' (hf.trans _).trans hg.symm
  rw [← rootsOfUnity.coe_pow _ hf'.choose, ← rootsOfUnity.coe_pow _ hg'.choose]
  congr 2
  rw [pow_eq_pow_iff_modEq]
  convert hfg
  rw [hμ.eq_orderOf]
  -- Porting note: was `{occs := occurrences.pos [2]}`
  

Proof state:
case h.e'_1
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
f g : L ≃ₐ[K] L
hf' : ∃ m, f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hg' : ∃ m, g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hfg : Exists.choose hf' ≡ Exists.choose hg' [MOD ↑n]
hf : f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hf'
hg : g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hg'
⊢ orderOf (toRootsOfUnity hμ) = orderOf μ

Next tactic:
conv_rhs => rw [← hμ.val_toRootsOfUnity_coe]
/-- `IsPrimitiveRoot.autToPow` is injective in the case that it's considered over a cyclotomic
field extension. -/
theorem autToPow_injective : Function.Injective <| hμ.autToPow K := by
  intro f g hfg
  apply_fun Units.val at hfg
  simp only [IsPrimitiveRoot.coe_autToPow_apply] at hfg
  -- Porting note: was `generalize_proofs hf' hg' at hfg`
  revert hfg
  generalize_proofs hf' hg'
  intro hfg
  have hf := hf'.choose_spec
  have hg := hg'.choose_spec
  -- Porting note: was `generalize_proofs hζ at hf hg`
  revert hf hg
  generalize_proofs hζ
  intro hf hg
  suffices f (hμ.toRootsOfUnity : Lˣ) = g (hμ.toRootsOfUnity : Lˣ) by
    apply AlgEquiv.coe_algHom_injective
    apply (hμ.powerBasis K).algHom_ext
    exact this
  rw [ZMod.eq_iff_modEq_nat] at hfg
  refine' (hf.trans _).trans hg.symm
  rw [← rootsOfUnity.coe_pow _ hf'.choose, ← rootsOfUnity.coe_pow _ hg'.choose]
  congr 2
  rw [pow_eq_pow_iff_modEq]
  convert hfg
  rw [hμ.eq_orderOf]
  -- Porting note: was `{occs := occurrences.pos [2]}`
  conv_rhs => 

Proof state:
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
f g : L ≃ₐ[K] L
hf' : ∃ m, f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hg' : ∃ m, g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hfg : Exists.choose hf' ≡ Exists.choose hg' [MOD ↑n]
hf : f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hf'
hg : g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hg'
| orderOf μ

Next tactic:
rw [← hμ.val_toRootsOfUnity_coe]
/-- `IsPrimitiveRoot.autToPow` is injective in the case that it's considered over a cyclotomic
field extension. -/
theorem autToPow_injective : Function.Injective <| hμ.autToPow K := by
  intro f g hfg
  apply_fun Units.val at hfg
  simp only [IsPrimitiveRoot.coe_autToPow_apply] at hfg
  -- Porting note: was `generalize_proofs hf' hg' at hfg`
  revert hfg
  generalize_proofs hf' hg'
  intro hfg
  have hf := hf'.choose_spec
  have hg := hg'.choose_spec
  -- Porting note: was `generalize_proofs hζ at hf hg`
  revert hf hg
  generalize_proofs hζ
  intro hf hg
  suffices f (hμ.toRootsOfUnity : Lˣ) = g (hμ.toRootsOfUnity : Lˣ) by
    apply AlgEquiv.coe_algHom_injective
    apply (hμ.powerBasis K).algHom_ext
    exact this
  rw [ZMod.eq_iff_modEq_nat] at hfg
  refine' (hf.trans _).trans hg.symm
  rw [← rootsOfUnity.coe_pow _ hf'.choose, ← rootsOfUnity.coe_pow _ hg'.choose]
  congr 2
  rw [pow_eq_pow_iff_modEq]
  convert hfg
  rw [hμ.eq_orderOf]
  -- Porting note: was `{occs := occurrences.pos [2]}`
  conv_rhs => rw [← hμ.val_toRootsOfUnity_coe]
  

Proof state:
case h.e'_1
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
f g : L ≃ₐ[K] L
hf' : ∃ m, f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hg' : ∃ m, g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ m
hfg : Exists.choose hf' ≡ Exists.choose hg' [MOD ↑n]
hf : f ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hf'
hg : g ↑↑(toRootsOfUnity hμ) = ↑↑(toRootsOfUnity hμ) ^ Exists.choose hg'
⊢ orderOf (toRootsOfUnity hμ) = orderOf ↑↑(toRootsOfUnity hμ)

Next tactic:
rw [orderOf_units, Subgroup.orderOf_coe]
/-- The `MulEquiv` that takes an automorphism `f` to the element `k : (ZMod n)ˣ` such that
  `f μ = μ ^ k` for any root of unity `μ`. A strengthening of `IsPrimitiveRoot.autToPow`. -/
@[simps]
noncomputable def autEquivPow : (L ≃ₐ[K] L) ≃* (ZMod n)ˣ :=
  let hζ := zeta_spec n K L
  let hμ t := hζ.pow_of_coprime _ (ZMod.val_coe_unit_coprime t)
  { (zeta_spec n K L).autToPow K with
    invFun := fun t =>
      (hζ.powerBasis K).equivOfMinpoly ((hμ t).powerBasis K)
        (by
          

Proof state:
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ✝ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
h : Irreducible (cyclotomic (↑n) K)
hζ : IsPrimitiveRoot (zeta n K L) ↑n := zeta_spec n K L
hμ : ∀ (t : (ZMod ↑n)ˣ), IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n :=
  fun t => IsPrimitiveRoot.pow_of_coprime hζ (ZMod.val ↑t) (ZMod.val_coe_unit_coprime t)
src✝ : (L ≃ₐ[K] L) →* (ZMod ↑n)ˣ := IsPrimitiveRoot.autToPow K (_ : IsPrimitiveRoot (zeta n K L) ↑n)
t : (ZMod ↑n)ˣ
⊢ minpoly K (IsPrimitiveRoot.powerBasis K hζ).gen =
    minpoly K (IsPrimitiveRoot.powerBasis K (_ : IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n)).gen

Next tactic:
haveI := IsCyclotomicExtension.neZero' n K L
/-- The `MulEquiv` that takes an automorphism `f` to the element `k : (ZMod n)ˣ` such that
  `f μ = μ ^ k` for any root of unity `μ`. A strengthening of `IsPrimitiveRoot.autToPow`. -/
@[simps]
noncomputable def autEquivPow : (L ≃ₐ[K] L) ≃* (ZMod n)ˣ :=
  let hζ := zeta_spec n K L
  let hμ t := hζ.pow_of_coprime _ (ZMod.val_coe_unit_coprime t)
  { (zeta_spec n K L).autToPow K with
    invFun := fun t =>
      (hζ.powerBasis K).equivOfMinpoly ((hμ t).powerBasis K)
        (by
          haveI := IsCyclotomicExtension.neZero' n K L
          

Proof state:
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ✝ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
h : Irreducible (cyclotomic (↑n) K)
hζ : IsPrimitiveRoot (zeta n K L) ↑n := zeta_spec n K L
hμ : ∀ (t : (ZMod ↑n)ˣ), IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n :=
  fun t => IsPrimitiveRoot.pow_of_coprime hζ (ZMod.val ↑t) (ZMod.val_coe_unit_coprime t)
src✝ : (L ≃ₐ[K] L) →* (ZMod ↑n)ˣ := IsPrimitiveRoot.autToPow K (_ : IsPrimitiveRoot (zeta n K L) ↑n)
t : (ZMod ↑n)ˣ
this : NeZero ↑↑n
⊢ minpoly K (IsPrimitiveRoot.powerBasis K hζ).gen =
    minpoly K (IsPrimitiveRoot.powerBasis K (_ : IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n)).gen

Next tactic:
simp only [IsPrimitiveRoot.powerBasis_gen]
/-- The `MulEquiv` that takes an automorphism `f` to the element `k : (ZMod n)ˣ` such that
  `f μ = μ ^ k` for any root of unity `μ`. A strengthening of `IsPrimitiveRoot.autToPow`. -/
@[simps]
noncomputable def autEquivPow : (L ≃ₐ[K] L) ≃* (ZMod n)ˣ :=
  let hζ := zeta_spec n K L
  let hμ t := hζ.pow_of_coprime _ (ZMod.val_coe_unit_coprime t)
  { (zeta_spec n K L).autToPow K with
    invFun := fun t =>
      (hζ.powerBasis K).equivOfMinpoly ((hμ t).powerBasis K)
        (by
          haveI := IsCyclotomicExtension.neZero' n K L
          simp only [IsPrimitiveRoot.powerBasis_gen]
          

Proof state:
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ✝ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
h : Irreducible (cyclotomic (↑n) K)
hζ : IsPrimitiveRoot (zeta n K L) ↑n := zeta_spec n K L
hμ : ∀ (t : (ZMod ↑n)ˣ), IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n :=
  fun t => IsPrimitiveRoot.pow_of_coprime hζ (ZMod.val ↑t) (ZMod.val_coe_unit_coprime t)
src✝ : (L ≃ₐ[K] L) →* (ZMod ↑n)ˣ := IsPrimitiveRoot.autToPow K (_ : IsPrimitiveRoot (zeta n K L) ↑n)
t : (ZMod ↑n)ˣ
this : NeZero ↑↑n
⊢ minpoly K (zeta n K L) = minpoly K (zeta n K L ^ ZMod.val ↑t)

Next tactic:
have hr :=
            IsPrimitiveRoot.minpoly_eq_cyclotomic_of_irreducible
              ((zeta_spec n K L).pow_of_coprime _ (ZMod.val_coe_unit_coprime t)) h
/-- The `MulEquiv` that takes an automorphism `f` to the element `k : (ZMod n)ˣ` such that
  `f μ = μ ^ k` for any root of unity `μ`. A strengthening of `IsPrimitiveRoot.autToPow`. -/
@[simps]
noncomputable def autEquivPow : (L ≃ₐ[K] L) ≃* (ZMod n)ˣ :=
  let hζ := zeta_spec n K L
  let hμ t := hζ.pow_of_coprime _ (ZMod.val_coe_unit_coprime t)
  { (zeta_spec n K L).autToPow K with
    invFun := fun t =>
      (hζ.powerBasis K).equivOfMinpoly ((hμ t).powerBasis K)
        (by
          haveI := IsCyclotomicExtension.neZero' n K L
          simp only [IsPrimitiveRoot.powerBasis_gen]
          have hr :=
            IsPrimitiveRoot.minpoly_eq_cyclotomic_of_irreducible
              ((zeta_spec n K L).pow_of_coprime _ (ZMod.val_coe_unit_coprime t)) h
          

Proof state:
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ✝ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
h : Irreducible (cyclotomic (↑n) K)
hζ : IsPrimitiveRoot (zeta n K L) ↑n := zeta_spec n K L
hμ : ∀ (t : (ZMod ↑n)ˣ), IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n :=
  fun t => IsPrimitiveRoot.pow_of_coprime hζ (ZMod.val ↑t) (ZMod.val_coe_unit_coprime t)
src✝ : (L ≃ₐ[K] L) →* (ZMod ↑n)ˣ := IsPrimitiveRoot.autToPow K (_ : IsPrimitiveRoot (zeta n K L) ↑n)
t : (ZMod ↑n)ˣ
this : NeZero ↑↑n
hr : cyclotomic (↑n) K = minpoly K (zeta n K L ^ ZMod.val ↑t)
⊢ minpoly K (zeta n K L) = minpoly K (zeta n K L ^ ZMod.val ↑t)

Next tactic:
exact ((zeta_spec n K L).minpoly_eq_cyclotomic_of_irreducible h).symm.trans hr
/-- The `MulEquiv` that takes an automorphism `f` to the element `k : (ZMod n)ˣ` such that
  `f μ = μ ^ k` for any root of unity `μ`. A strengthening of `IsPrimitiveRoot.autToPow`. -/
@[simps]
noncomputable def autEquivPow : (L ≃ₐ[K] L) ≃* (ZMod n)ˣ :=
  let hζ := zeta_spec n K L
  let hμ t := hζ.pow_of_coprime _ (ZMod.val_coe_unit_coprime t)
  { (zeta_spec n K L).autToPow K with
    invFun := fun t =>
      (hζ.powerBasis K).equivOfMinpoly ((hμ t).powerBasis K)
        (by
          haveI := IsCyclotomicExtension.neZero' n K L
          simp only [IsPrimitiveRoot.powerBasis_gen]
          have hr :=
            IsPrimitiveRoot.minpoly_eq_cyclotomic_of_irreducible
              ((zeta_spec n K L).pow_of_coprime _ (ZMod.val_coe_unit_coprime t)) h
          exact ((zeta_spec n K L).minpoly_eq_cyclotomic_of_irreducible h).symm.trans hr)
    left_inv := fun f => by
      

Proof state:
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ✝ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
h : Irreducible (cyclotomic (↑n) K)
hζ : IsPrimitiveRoot (zeta n K L) ↑n := zeta_spec n K L
hμ : ∀ (t : (ZMod ↑n)ˣ), IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n :=
  fun t => IsPrimitiveRoot.pow_of_coprime hζ (ZMod.val ↑t) (ZMod.val_coe_unit_coprime t)
src✝ : (L ≃ₐ[K] L) →* (ZMod ↑n)ˣ := IsPrimitiveRoot.autToPow K (_ : IsPrimitiveRoot (zeta n K L) ↑n)
f : L ≃ₐ[K] L
⊢ (fun t =>
        PowerBasis.equivOfMinpoly (IsPrimitiveRoot.powerBasis K hζ)
          (IsPrimitiveRoot.powerBasis K (_ : IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n))
          (_ :
            minpoly K (IsPrimitiveRoot.powerBasis K hζ).gen =
              minpoly K (IsPrimitiveRoot.powerBasis K (_ : IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n)).gen))
      (OneHom.toFun (↑src✝) f) =
    f

Next tactic:
simp only [MonoidHom.toFun_eq_coe]
/-- The `MulEquiv` that takes an automorphism `f` to the element `k : (ZMod n)ˣ` such that
  `f μ = μ ^ k` for any root of unity `μ`. A strengthening of `IsPrimitiveRoot.autToPow`. -/
@[simps]
noncomputable def autEquivPow : (L ≃ₐ[K] L) ≃* (ZMod n)ˣ :=
  let hζ := zeta_spec n K L
  let hμ t := hζ.pow_of_coprime _ (ZMod.val_coe_unit_coprime t)
  { (zeta_spec n K L).autToPow K with
    invFun := fun t =>
      (hζ.powerBasis K).equivOfMinpoly ((hμ t).powerBasis K)
        (by
          haveI := IsCyclotomicExtension.neZero' n K L
          simp only [IsPrimitiveRoot.powerBasis_gen]
          have hr :=
            IsPrimitiveRoot.minpoly_eq_cyclotomic_of_irreducible
              ((zeta_spec n K L).pow_of_coprime _ (ZMod.val_coe_unit_coprime t)) h
          exact ((zeta_spec n K L).minpoly_eq_cyclotomic_of_irreducible h).symm.trans hr)
    left_inv := fun f => by
      simp only [MonoidHom.toFun_eq_coe]
      

Proof state:
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ✝ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
h : Irreducible (cyclotomic (↑n) K)
hζ : IsPrimitiveRoot (zeta n K L) ↑n := zeta_spec n K L
hμ : ∀ (t : (ZMod ↑n)ˣ), IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n :=
  fun t => IsPrimitiveRoot.pow_of_coprime hζ (ZMod.val ↑t) (ZMod.val_coe_unit_coprime t)
src✝ : (L ≃ₐ[K] L) →* (ZMod ↑n)ˣ := IsPrimitiveRoot.autToPow K (_ : IsPrimitiveRoot (zeta n K L) ↑n)
f : L ≃ₐ[K] L
⊢ PowerBasis.equivOfMinpoly (IsPrimitiveRoot.powerBasis K hζ)
      (IsPrimitiveRoot.powerBasis K
        (_ :
          IsPrimitiveRoot
            (zeta n K L ^ ZMod.val ↑((IsPrimitiveRoot.autToPow K (_ : IsPrimitiveRoot (zeta n K L) ↑n)) f)) ↑n))
      (_ :
        minpoly K (IsPrimitiveRoot.powerBasis K hζ).gen =
          minpoly K
            (IsPrimitiveRoot.powerBasis K
                (_ : IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑(OneHom.toFun (↑src✝) f)) ↑n)).gen) =
    f

Next tactic:
apply AlgEquiv.coe_algHom_injective
/-- The `MulEquiv` that takes an automorphism `f` to the element `k : (ZMod n)ˣ` such that
  `f μ = μ ^ k` for any root of unity `μ`. A strengthening of `IsPrimitiveRoot.autToPow`. -/
@[simps]
noncomputable def autEquivPow : (L ≃ₐ[K] L) ≃* (ZMod n)ˣ :=
  let hζ := zeta_spec n K L
  let hμ t := hζ.pow_of_coprime _ (ZMod.val_coe_unit_coprime t)
  { (zeta_spec n K L).autToPow K with
    invFun := fun t =>
      (hζ.powerBasis K).equivOfMinpoly ((hμ t).powerBasis K)
        (by
          haveI := IsCyclotomicExtension.neZero' n K L
          simp only [IsPrimitiveRoot.powerBasis_gen]
          have hr :=
            IsPrimitiveRoot.minpoly_eq_cyclotomic_of_irreducible
              ((zeta_spec n K L).pow_of_coprime _ (ZMod.val_coe_unit_coprime t)) h
          exact ((zeta_spec n K L).minpoly_eq_cyclotomic_of_irreducible h).symm.trans hr)
    left_inv := fun f => by
      simp only [MonoidHom.toFun_eq_coe]
      apply AlgEquiv.coe_algHom_injective
      

Proof state:
case a
n : ℕ+
K : Type u_1
inst✝⁴ : Field K
L : Type u_2
μ : L
inst✝³ : CommRing L
inst✝² : IsDomain L
hμ✝ : IsPrimitiveRoot μ ↑n
inst✝¹ : Algebra K L
inst✝ : IsCyclotomicExtension {n} K L
h : Irreducible (cyclotomic (↑n) K)
hζ : IsPrimitiveRoot (zeta n K L) ↑n := zeta_spec n K L
hμ : ∀ (t : (ZMod ↑n)ˣ), IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑t) ↑n :=
  fun t => IsPrimitiveRoot.pow_of_coprime hζ (ZMod.val ↑t) (ZMod.val_coe_unit_coprime t)
src✝ : (L ≃ₐ[K] L) →* (ZMod ↑n)ˣ := IsPrimitiveRoot.autToPow K (_ : IsPrimitiveRoot (zeta n K L) ↑n)
f : L ≃ₐ[K] L
⊢ ↑(PowerBasis.equivOfMinpoly (IsPrimitiveRoot.powerBasis K hζ)
        (IsPrimitiveRoot.powerBasis K
          (_ :
            IsPrimitiveRoot
              (zeta n K L ^ ZMod.val ↑((IsPrimitiveRoot.autToPow K (_ : IsPrimitiveRoot (zeta n K L) ↑n)) f)) ↑n))
        (_ :
          minpoly K (IsPrimitiveRoot.powerBasis K hζ).gen =
            minpoly K
              (IsPrimitiveRoot.powerBasis K
                  (_ : IsPrimitiveRoot (zeta n K L ^ ZMod.val ↑(OneHom.toFun (↑src✝) f)) ↑n)).gen)) =
    ↑f

Next tactic:
apply (hζ.powerBasis K).algHom_ext