-- Mathlib/NumberTheory/Cyclotomic/Discriminant.lean
theorem discr_prime_pow [hcycl : IsCyclotomicExtension {p ^ k} K L] [hp : Fact (p : ℕ).Prime]
    (hζ : IsPrimitiveRoot ζ ↑(p ^ k)) (hirr : Irreducible (cyclotomic (↑(p ^ k) : ℕ) K)) :
    discr K (hζ.powerBasis K).basis =
      (-1) ^ ((p ^ k : ℕ).totient / 2) * p ^ ((p : ℕ) ^ (k - 1) * ((p - 1) * k - 1))

Proof state:
p : ℕ+
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hp : Fact (Nat.Prime ↑p)
k : ℕ
hcycl : IsCyclotomicExtension {p ^ (k + 1)} K L
hζ : IsPrimitiveRoot ζ ↑(p ^ (k + 1))
hirr : Irreducible (cyclotomic (↑(p ^ (k + 1))) K)
hk : ↑p ^ (k + 1) = ↑(2 ^ 1)
coe_two : 2 = ↑2
⊢ p = 2

Tactic:
replace hk :=
  eq_of_prime_pow_eq (prime_iff.1 hp.out) (prime_iff.1 Nat.prime_two) (succ_pos _) hk

Result:
p : ℕ+
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hp : Fact (Nat.Prime ↑p)
k : ℕ
hcycl : IsCyclotomicExtension {p ^ (k + 1)} K L
hζ : IsPrimitiveRoot ζ ↑(p ^ (k + 1))
hirr : Irreducible (cyclotomic (↑(p ^ (k + 1))) K)
coe_two : 2 = ↑2
hk : ↑p = 2
⊢ p = 2

Proof state:
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
coe_two : 2 = ↑2
hp : Fact (Nat.Prime ↑2)
hcycl✝ : IsCyclotomicExtension {2 ^ (0 + 1)} K L
hcycl : IsCyclotomicExtension {2} K L
hζ✝ : IsPrimitiveRoot ζ ↑(2 ^ (0 + 1))
hζ : IsPrimitiveRoot ζ ↑2
hirr : Irreducible (cyclotomic (↑(2 ^ (0 + 1))) K)
⊢ (minpoly K ζ).natDegree = 1

Tactic:
rw [hζ.eq_neg_one_of_two_right, show (-1 : L) = algebraMap K L (-1) by simp,
  minpoly.eq_X_sub_C_of_algebraMap_inj _ (FaithfulSMul.algebraMap_injective K L)]

Result:
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
coe_two : 2 = ↑2
hp : Fact (Nat.Prime ↑2)
hcycl✝ : IsCyclotomicExtension {2 ^ (0 + 1)} K L
hcycl : IsCyclotomicExtension {2} K L
hζ✝ : IsPrimitiveRoot ζ ↑(2 ^ (0 + 1))
hζ : IsPrimitiveRoot ζ ↑2
hirr : Irreducible (cyclotomic (↑(2 ^ (0 + 1))) K)
⊢ (X - C (-1)).natDegree = 1

Proof state:
case pos
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
coe_two : 2 = ↑2
hp : Fact (Nat.Prime ↑2)
hcycl : IsCyclotomicExtension {2 ^ (0 + 1)} K L
hζ : IsPrimitiveRoot ζ ↑(2 ^ (0 + 1))
hirr : Irreducible (cyclotomic (↑(2 ^ (0 + 1))) K)
⊢ discr K ⇑(IsPrimitiveRoot.powerBasis K hζ).basis =
    (-1) ^ (φ (↑2 ^ (0 + 1)) / 2) * ↑↑2 ^ (↑2 ^ (0 + 1 - 1) * ((↑2 - 1) * (0 + 1) - 1))

Tactic:
rw [pow_one] at hζ hcycl

Result:
case pos
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
coe_two : 2 = ↑2
hp : Fact (Nat.Prime ↑2)
hcycl✝ : IsCyclotomicExtension {2 ^ (0 + 1)} K L
hcycl : IsCyclotomicExtension {2} K L
hζ✝ : IsPrimitiveRoot ζ ↑(2 ^ (0 + 1))
hζ : IsPrimitiveRoot ζ ↑2
hirr : Irreducible (cyclotomic (↑(2 ^ (0 + 1))) K)
⊢ discr K ⇑(IsPrimitiveRoot.powerBasis K hζ✝).basis =
    (-1) ^ (φ (↑2 ^ (0 + 1)) / 2) * ↑↑2 ^ (↑2 ^ (0 + 1 - 1) * ((↑2 - 1) * (0 + 1) - 1))

Proof state:
p : ℕ+
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hp : Fact (Nat.Prime ↑p)
k : ℕ
hcycl : IsCyclotomicExtension {p ^ (k + 1)} K L
hζ : IsPrimitiveRoot ζ ↑(p ^ (k + 1))
hirr : Irreducible (cyclotomic (↑(p ^ (k + 1))) K)
coe_two : 2 = ↑2
hk : ↑p = 2
⊢ p = 2

Tactic:
rwa [coe_two, PNat.coe_inj] at hk

Result:
no goals

Proof state:
case zero
p : ℕ+
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hp : Fact (Nat.Prime ↑p)
hcycl : IsCyclotomicExtension {p ^ 0} K L
hζ : IsPrimitiveRoot ζ ↑(p ^ 0)
hirr : Irreducible (cyclotomic (↑(p ^ 0)) K)
⊢ discr K ⇑(IsPrimitiveRoot.powerBasis K hζ).basis = (-1) ^ (φ (↑p ^ 0) / 2) * ↑↑p ^ (↑p ^ (0 - 1) * ((↑p - 1) * 0 - 1))

Tactic:
simp only [coe_basis, _root_.pow_zero, powerBasis_gen _ hζ, totient_one, mul_zero, mul_one,
  show 1 / 2 = 0 by rfl, discr, traceMatrix]

Result:
case zero
p : ℕ+
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hp : Fact (Nat.Prime ↑p)
hcycl : IsCyclotomicExtension {p ^ 0} K L
hζ : IsPrimitiveRoot ζ ↑(p ^ 0)
hirr : Irreducible (cyclotomic (↑(p ^ 0)) K)
⊢ (Matrix.of fun i j => ((traceForm K L) (ζ ^ ↑i)) (ζ ^ ↑j)).det = 1 * ↑↑p ^ (↑p ^ (0 - 1) * (0 - 1))

Proof state:
case pos
p : ℕ+
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hp : Fact (Nat.Prime ↑p)
k : ℕ
hcycl : IsCyclotomicExtension {p ^ (k + 1)} K L
hζ : IsPrimitiveRoot ζ ↑(p ^ (k + 1))
hirr : Irreducible (cyclotomic (↑(p ^ (k + 1))) K)
hk : p ^ (k + 1) = 2
⊢ discr K ⇑(IsPrimitiveRoot.powerBasis K hζ).basis =
    (-1) ^ (φ (↑p ^ (k + 1)) / 2) * ↑↑p ^ (↑p ^ (k + 1 - 1) * ((↑p - 1) * (k + 1) - 1))

Tactic:
have coe_two : 2 = ((2 : ℕ+) : ℕ) := rfl

Result:
case pos
p : ℕ+
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hp : Fact (Nat.Prime ↑p)
k : ℕ
hcycl : IsCyclotomicExtension {p ^ (k + 1)} K L
hζ : IsPrimitiveRoot ζ ↑(p ^ (k + 1))
hirr : Irreducible (cyclotomic (↑(p ^ (k + 1))) K)
hk : p ^ (k + 1) = 2
coe_two : 2 = ↑2
⊢ discr K ⇑(IsPrimitiveRoot.powerBasis K hζ).basis =
    (-1) ^ (φ (↑p ^ (k + 1)) / 2) * ↑↑p ^ (↑p ^ (k + 1 - 1) * ((↑p - 1) * (k + 1) - 1))

Proof state:
case zero
p : ℕ+
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hp : Fact (Nat.Prime ↑p)
hcycl : IsCyclotomicExtension {p ^ 0} K L
hζ : IsPrimitiveRoot ζ ↑(p ^ 0)
hirr : Irreducible (cyclotomic (↑(p ^ 0)) K)
hζone : ζ = 1
⊢ (Matrix.of fun i j => ((traceForm K L) ((algebraMap K L) 1 ^ ↑i)) ((algebraMap K L) 1 ^ ↑j)).det =
    1 * ↑↑p ^ (↑p ^ (0 - 1) * (0 - 1))

Tactic:
simp only [traceMatrix, map_one, one_pow, Matrix.det_unique, traceForm_apply, mul_one]

Result:
case zero
p : ℕ+
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
hp : Fact (Nat.Prime ↑p)
hcycl : IsCyclotomicExtension {p ^ 0} K L
hζ : IsPrimitiveRoot ζ ↑(p ^ 0)
hirr : Irreducible (cyclotomic (↑(p ^ 0)) K)
hζone : ζ = 1
⊢ Matrix.of (fun i j => (trace K L) 1) default default = 1 * ↑↑p ^ (↑p ^ (0 - 1) * (0 - 1))

Proof state:
case pos
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
coe_two : 2 = ↑2
hp : Fact (Nat.Prime ↑2)
hcycl✝ : IsCyclotomicExtension {2 ^ (0 + 1)} K L
hcycl : IsCyclotomicExtension {2} K L
hζ✝ : IsPrimitiveRoot ζ ↑(2 ^ (0 + 1))
hζ : IsPrimitiveRoot ζ ↑2
hirr : Irreducible (cyclotomic (↑(2 ^ (0 + 1))) K)
this : (minpoly K ζ).natDegree = 1
⊢ discr K ⇑(IsPrimitiveRoot.powerBasis K hζ✝).basis =
    (-1) ^ (φ (↑2 ^ (0 + 1)) / 2) * ↑↑2 ^ (↑2 ^ (0 + 1 - 1) * ((↑2 - 1) * (0 + 1) - 1))

Tactic:
rcases Fin.equiv_iff_eq.2 this with ⟨e⟩

Result:
case pos.intro
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
coe_two : 2 = ↑2
hp : Fact (Nat.Prime ↑2)
hcycl✝ : IsCyclotomicExtension {2 ^ (0 + 1)} K L
hcycl : IsCyclotomicExtension {2} K L
hζ✝ : IsPrimitiveRoot ζ ↑(2 ^ (0 + 1))
hζ : IsPrimitiveRoot ζ ↑2
hirr : Irreducible (cyclotomic (↑(2 ^ (0 + 1))) K)
this : (minpoly K ζ).natDegree = 1
e : Fin (minpoly K ζ).natDegree ≃ Fin 1
⊢ discr K ⇑(IsPrimitiveRoot.powerBasis K hζ✝).basis =
    (-1) ^ (φ (↑2 ^ (0 + 1)) / 2) * ↑↑2 ^ (↑2 ^ (0 + 1 - 1) * ((↑2 - 1) * (0 + 1) - 1))

Proof state:
case pos.intro.convert_2
K : Type u
L : Type v
ζ : L
inst✝² : Field K
inst✝¹ : Field L
inst✝ : Algebra K L
coe_two : 2 = ↑2
hp : Fact (Nat.Prime ↑2)
hcycl✝ : IsCyclotomicExtension {2 ^ (0 + 1)} K L
hcycl : IsCyclotomicExtension {2} K L
hζ✝ : IsPrimitiveRoot ζ ↑(2 ^ (0 + 1))
hζ : IsPrimitiveRoot ζ ↑2
hirr : Irreducible (cyclotomic (↑(2 ^ (0 + 1))) K)
this : (minpoly K ζ).natDegree = 1
e : Fin (minpoly K ζ).natDegree ≃ Fin 1
⊢ φ ↑(2 ^ (0 + 1)) • 1 = 1

Tactic:
norm_num

Result:
no goals