fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
private sum_filter_pairs_eq_sum_powersetCard_sum (k : ℕ) (f : Finset σ × σ → MvPolynomial σ R) : ∑ t ∈ pairs σ k with #t.1 = k, f t = ∑ A ∈ powersetCard k univ, ∑ j ∈ A, f (A, j) := by apply sum_finset_product aesop
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
sum_filter_pairs_eq_sum_powersetCard_sum
null
private sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum (k : ℕ) (a : ℕ × ℕ) (ha : a ∈ {a ∈ antidiagonal k | a.fst < k}) (f : Finset σ × σ → MvPolynomial σ R) : ∑ t ∈ pairs σ k with #t.1 = a.1, f t = ∑ A ∈ powersetCard a.1 univ, ∑ j, f (A, j) := by apply sum_finset_product simp only [mem_filter, mem_powersetCard_univ, mem_univ, and_true, and_iff_right_iff_imp] rintro p hp have : #p.fst ≤ k := by apply le_of_lt; simp_all aesop
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
sum_filter_pairs_eq_sum_powersetCard_mem_filter_antidiagonal_sum
null
private filter_pairs_lt (k : ℕ) : (pairs σ k).filter (fun (s, _) ↦ #s < k) = (range k).disjiUnion (powersetCard · univ) ((pairwise_disjoint_powersetCard _).set_pairwise _) ×ˢ univ := by ext; aesop (add unsafe le_of_lt)
lemma
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
filter_pairs_lt
null
private sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum (k : ℕ) (f : Finset σ × σ → MvPolynomial σ R) : ∑ t ∈ pairs σ k with #t.1 < k, f t = ∑ a ∈ antidiagonal k with a.fst < k, ∑ A ∈ powersetCard a.fst univ, ∑ j, f (A, j) := by rw [filter_pairs_lt, sum_product, sum_disjiUnion] refine sum_nbij' (fun n ↦ (n, k - n)) Prod.fst ?_ ?_ ?_ ?_ ?_ <;> simp +contextual [@eq_comm _ _ k, le_of_lt]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum
null
private disjoint_filter_pairs_lt_filter_pairs_eq (k : ℕ) : Disjoint {t ∈ pairs σ k | #t.1 < k} {t ∈ pairs σ k | #t.1 = k} := by rw [disjoint_filter] exact fun _ _ h1 h2 ↦ lt_irrefl _ (h2.symm.subst h1)
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
disjoint_filter_pairs_lt_filter_pairs_eq
null
private disjUnion_filter_pairs_eq_pairs (k : ℕ) : disjUnion {t ∈ pairs σ k | #t.1 < k} {t ∈ pairs σ k | #t.1 = k} (disjoint_filter_pairs_lt_filter_pairs_eq σ k) = pairs σ k := by grind [MvPolynomial.NewtonIdentities.pairs]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
disjUnion_filter_pairs_eq_pairs
null
private esymm_summand_to_weight (k : ℕ) (A : Finset σ) (h : A ∈ powersetCard k univ) : ∑ j ∈ A, weight σ R k (A, j) = k * (-1) ^ k * (∏ i ∈ A, X i : MvPolynomial σ R) := by simp [weight, mem_powersetCard_univ.mp h, mul_assoc]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
esymm_summand_to_weight
null
private esymm_to_weight [DecidableEq σ] (k : ℕ) : k * esymm σ R k = (-1) ^ k * ∑ t ∈ pairs σ k with #t.1 = k, weight σ R k t := by rw [esymm, sum_filter_pairs_eq_sum_powersetCard_sum σ R k (fun t ↦ weight σ R k t), sum_congr rfl (esymm_summand_to_weight σ R k), mul_comm (k : MvPolynomial σ R) ((-1) ^ k), ← mul_sum, ← mul_assoc, ← mul_assoc, ← pow_add, Even.neg_one_pow ⟨k, rfl⟩, one_mul]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
esymm_to_weight
null
private esymm_mul_psum_summand_to_weight (k : ℕ) (a : ℕ × ℕ) (ha : a ∈ antidiagonal k) : ∑ A ∈ powersetCard a.fst univ, ∑ j, weight σ R k (A, j) = (-1) ^ a.fst * esymm σ R a.fst * psum σ R a.snd := by simp only [esymm, psum, weight, ← mul_assoc, mul_sum] rw [sum_comm] refine sum_congr rfl fun x _ ↦ ?_ rw [sum_mul] refine sum_congr rfl fun s hs ↦ ?_ rw [mem_powersetCard_univ.mp hs, ← mem_antidiagonal.mp ha, add_sub_self_left]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
esymm_mul_psum_summand_to_weight
null
private esymm_mul_psum_to_weight [DecidableEq σ] (k : ℕ) : ∑ a ∈ antidiagonal k with a.fst < k, (-1) ^ a.fst * esymm σ R a.fst * psum σ R a.snd = ∑ t ∈ pairs σ k with #t.1 < k, weight σ R k t := by rw [← sum_congr rfl (fun a ha ↦ esymm_mul_psum_summand_to_weight σ R k a (mem_filter.mp ha).left), sum_filter_pairs_eq_sum_filter_antidiagonal_powersetCard_sum σ R k]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
esymm_mul_psum_to_weight
null
mul_esymm_eq_sum (k : ℕ) : k * esymm σ R k = (-1) ^ (k + 1) * ∑ a ∈ antidiagonal k with a.1 < k, (-1) ^ a.1 * esymm σ R a.1 * psum σ R a.2 := by classical rw [NewtonIdentities.esymm_to_weight σ R k, NewtonIdentities.esymm_mul_psum_to_weight σ R k, eq_comm, ← sub_eq_zero, sub_eq_add_neg, neg_mul_eq_neg_mul, neg_eq_neg_one_mul ((-1 : MvPolynomial σ R) ^ k)] nth_rw 2 [← pow_one (-1 : MvPolynomial σ R)] rw [← pow_add, add_comm 1 k, ← left_distrib, ← sum_disjUnion (NewtonIdentities.disjoint_filter_pairs_lt_filter_pairs_eq σ k), NewtonIdentities.disjUnion_filter_pairs_eq_pairs σ k, NewtonIdentities.weight_sum σ R k, neg_one_pow_mul_eq_zero_iff.mpr rfl]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
mul_esymm_eq_sum
**Newton's identities** give a recurrence relation for the kth elementary symmetric polynomial in terms of lower degree elementary symmetric polynomials and power sums.
sum_antidiagonal_card_esymm_psum_eq_zero : ∑ a ∈ antidiagonal (Fintype.card σ), (-1) ^ a.fst * esymm σ R a.fst * psum σ R a.snd = 0 := by let k := Fintype.card σ suffices (-1 : MvPolynomial σ R) ^ (k + 1) * ∑ a ∈ antidiagonal k, (-1) ^ a.fst * esymm σ R a.fst * psum σ R a.snd = 0 by simpa using this simp [k, ← sum_filter_add_sum_filter_not (antidiagonal k) (fun a ↦ a.fst < k), ← mul_esymm_eq_sum, mul_add, ← mul_assoc, ← pow_add, mul_comm ↑k (esymm σ R k)]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
sum_antidiagonal_card_esymm_psum_eq_zero
null
psum_eq_mul_esymm_sub_sum (k : ℕ) (h : 0 < k) : psum σ R k = (-1) ^ (k + 1) * k * esymm σ R k - ∑ a ∈ antidiagonal k with a.1 ∈ Set.Ioo 0 k, (-1) ^ a.fst * esymm σ R a.1 * psum σ R a.2 := by simp only [Set.Ioo, Set.mem_setOf_eq, and_comm] have hesymm := mul_esymm_eq_sum σ R k rw [← (sum_filter_add_sum_filter_not {a ∈ antidiagonal k | a.fst < k} (fun a ↦ 0 < a.fst) (fun a ↦ (-1) ^ a.fst * esymm σ R a.fst * psum σ R a.snd))] at hesymm have sub_both_sides := congrArg (· - (-1 : MvPolynomial σ R) ^ (k + 1) * ∑ a ∈ {a ∈ antidiagonal k | a.fst < k} with 0 < a.fst, (-1) ^ a.fst * esymm σ R a.fst * psum σ R a.snd) hesymm simp only [left_distrib, add_sub_cancel_left] at sub_both_sides have sub_both_sides := congrArg ((-1 : MvPolynomial σ R) ^ (k + 1) * ·) sub_both_sides simp only [mul_sub_left_distrib, ← mul_assoc, ← pow_add, Even.neg_one_pow ⟨k + 1, rfl⟩, one_mul, filter_filter (fun a : ℕ × ℕ ↦ a.fst < k) (fun a ↦ ¬0 < a.fst)] at sub_both_sides have : {a ∈ antidiagonal k | a.fst < k ∧ ¬0 < a.fst} = {(0, k)} := by ext a rw [mem_filter, mem_antidiagonal, mem_singleton] refine ⟨?_, by rintro rfl; cutsat⟩ rintro ⟨ha, ⟨_, ha0⟩⟩ rw [← ha, Nat.eq_zero_of_not_pos ha0, zero_add, ← Nat.eq_zero_of_not_pos ha0] rw [this, sum_singleton] at sub_both_sides simp only [_root_.pow_zero, esymm_zero, mul_one, one_mul, filter_filter] at sub_both_sides exact sub_both_sides.symm
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Subalgebra.Basic", "Mathlib.Algebra.MvPolynomial.CommRing", "Mathlib.Algebra.MvPolynomial.Rename", "Mathlib.Data.Fintype.Basic", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/MvPolynomial/Symmetric/NewtonIdentities.lean
psum_eq_mul_esymm_sub_sum
A version of Newton's identities which may be more useful in the case that we know the values of the elementary symmetric polynomials and would like to calculate the values of the power sums.
cyclotomic' (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : R[X] := ∏ μ ∈ primitiveRoots n R, (X - C μ)
def
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic'
The modified `n`-th cyclotomic polynomial with coefficients in `R`, it is the usual cyclotomic polynomial if there is a primitive `n`-th root of unity in `R`.
@[simp] cyclotomic'_zero (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 0 R = 1 := by simp only [cyclotomic', Finset.prod_empty, primitiveRoots_zero]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic'_zero
The zeroth modified cyclotomic polynomial is `1`.
@[simp] cyclotomic'_one (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 1 R = X - 1 := by simp only [cyclotomic', Finset.prod_singleton, RingHom.map_one, IsPrimitiveRoot.primitiveRoots_one]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic'_one
The first modified cyclotomic polynomial is `X - 1`.
cyclotomic'.monic (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : (cyclotomic' n R).Monic := monic_prod_of_monic _ _ fun _ _ => monic_X_sub_C _
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic'.monic
The second modified cyclotomic polynomial is `X + 1` if the characteristic of `R` is not `2`. -/ -- Cannot be @[simp] because `p` cannot be inferred by `simp`. theorem cyclotomic'_two (R : Type*) [CommRing R] [IsDomain R] (p : ℕ) [CharP R p] (hp : p ≠ 2) : cyclotomic' 2 R = X + 1 := by rw [cyclotomic'] have prim_root_two : primitiveRoots 2 R = {(-1 : R)} := by simp only [Finset.eq_singleton_iff_unique_mem, mem_primitiveRoots two_pos] exact ⟨IsPrimitiveRoot.neg_one p hp, fun x => IsPrimitiveRoot.eq_neg_one_of_two_right⟩ simp only [prim_root_two, Finset.prod_singleton, RingHom.map_neg, RingHom.map_one, sub_neg_eq_add] /-- `cyclotomic' n R` is monic.
cyclotomic'_ne_zero (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' n R ≠ 0 := (cyclotomic'.monic n R).ne_zero
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic'_ne_zero
`cyclotomic' n R` is different from `0`.
natDegree_cyclotomic' {ζ : R} {n : ℕ} (h : IsPrimitiveRoot ζ n) : (cyclotomic' n R).natDegree = Nat.totient n := by rw [cyclotomic'] rw [natDegree_prod (primitiveRoots n R) fun z : R => X - C z] · simp only [IsPrimitiveRoot.card_primitiveRoots h, mul_one, natDegree_X_sub_C, Nat.cast_id, Finset.sum_const, nsmul_eq_mul] intro z _ exact X_sub_C_ne_zero z
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
natDegree_cyclotomic'
The natural degree of `cyclotomic' n R` is `totient n` if there is a primitive root of unity in `R`.
degree_cyclotomic' {ζ : R} {n : ℕ} (h : IsPrimitiveRoot ζ n) : (cyclotomic' n R).degree = Nat.totient n := by simp only [degree_eq_natDegree (cyclotomic'_ne_zero n R), natDegree_cyclotomic' h]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
degree_cyclotomic'
The degree of `cyclotomic' n R` is `totient n` if there is a primitive root of unity in `R`.
roots_of_cyclotomic (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : (cyclotomic' n R).roots = (primitiveRoots n R).val := by rw [cyclotomic']; exact roots_prod_X_sub_C (primitiveRoots n R)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
roots_of_cyclotomic
The roots of `cyclotomic' n R` are the primitive `n`-th roots of unity.
X_pow_sub_one_eq_prod {ζ : R} {n : ℕ} (hpos : 0 < n) (h : IsPrimitiveRoot ζ n) : X ^ n - 1 = ∏ ζ ∈ nthRootsFinset n (1 : R), (X - C ζ) := by classical rw [nthRootsFinset, ← Multiset.toFinset_eq (IsPrimitiveRoot.nthRoots_one_nodup h)] simp only [Finset.prod_mk] rw [nthRoots] have hmonic : (X ^ n - C (1 : R)).Monic := monic_X_pow_sub_C (1 : R) (ne_of_lt hpos).symm symm apply prod_multiset_X_sub_C_of_monic_of_roots_card_eq hmonic rw [@natDegree_X_pow_sub_C R _ _ n 1, ← nthRoots] exact IsPrimitiveRoot.card_nthRoots_one h
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
X_pow_sub_one_eq_prod
If there is a primitive `n`th root of unity in `K`, then `X ^ n - 1 = ∏ (X - μ)`, where `μ` varies over the `n`-th roots of unity.
cyclotomic'_splits (n : ℕ) : Splits (RingHom.id K) (cyclotomic' n K) := by apply splits_prod (RingHom.id K) intro z _ simp only [splits_X_sub_C (RingHom.id K)]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic'_splits
`cyclotomic' n K` splits.
X_pow_sub_one_splits {ζ : K} {n : ℕ} (h : IsPrimitiveRoot ζ n) : Splits (RingHom.id K) (X ^ n - C (1 : K)) := by rw [splits_iff_card_roots, ← nthRoots, IsPrimitiveRoot.card_nthRoots_one h, natDegree_X_pow_sub_C]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
X_pow_sub_one_splits
If there is a primitive `n`-th root of unity in `K`, then `X ^ n - 1` splits.
prod_cyclotomic'_eq_X_pow_sub_one {K : Type*} [CommRing K] [IsDomain K] {ζ : K} {n : ℕ} (hpos : 0 < n) (h : IsPrimitiveRoot ζ n) : ∏ i ∈ Nat.divisors n, cyclotomic' i K = X ^ n - 1 := by classical have hd : (n.divisors : Set ℕ).PairwiseDisjoint fun k => primitiveRoots k K := fun x _ y _ hne => IsPrimitiveRoot.disjoint hne simp only [X_pow_sub_one_eq_prod hpos h, cyclotomic', ← Finset.prod_biUnion hd, IsPrimitiveRoot.nthRoots_one_eq_biUnion_primitiveRoots]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
prod_cyclotomic'_eq_X_pow_sub_one
If there is a primitive `n`-th root of unity in `K`, then `∏ i ∈ Nat.divisors n, cyclotomic' i K = X ^ n - 1`.
cyclotomic'_eq_X_pow_sub_one_div {K : Type*} [CommRing K] [IsDomain K] {ζ : K} {n : ℕ} (hpos : 0 < n) (h : IsPrimitiveRoot ζ n) : cyclotomic' n K = (X ^ n - 1) /ₘ ∏ i ∈ Nat.properDivisors n, cyclotomic' i K := by rw [← prod_cyclotomic'_eq_X_pow_sub_one hpos h, ← Nat.cons_self_properDivisors hpos.ne', Finset.prod_cons] have prod_monic : (∏ i ∈ Nat.properDivisors n, cyclotomic' i K).Monic := by apply monic_prod_of_monic intro i _ exact cyclotomic'.monic i K rw [(div_modByMonic_unique (cyclotomic' n K) 0 prod_monic _).1] simp only [degree_zero, zero_add] refine ⟨by rw [mul_comm], ?_⟩ rw [bot_lt_iff_ne_bot] intro h exact Monic.ne_zero prod_monic (degree_eq_bot.1 h)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic'_eq_X_pow_sub_one_div
If there is a primitive `n`-th root of unity in `K`, then `cyclotomic' n K = (X ^ k - 1) /ₘ (∏ i ∈ Nat.properDivisors k, cyclotomic' i K)`.
int_coeff_of_cyclotomic' {K : Type*} [CommRing K] [IsDomain K] {ζ : K} {n : ℕ} (h : IsPrimitiveRoot ζ n) : ∃ P : ℤ[X], map (Int.castRingHom K) P = cyclotomic' n K ∧ P.degree = (cyclotomic' n K).degree ∧ P.Monic := by refine lifts_and_degree_eq_and_monic ?_ (cyclotomic'.monic n K) induction n using Nat.strong_induction_on generalizing ζ with | _ k ihk rcases k.eq_zero_or_pos with (rfl | hpos) · use 1 simp only [cyclotomic'_zero, coe_mapRingHom, Polynomial.map_one] let B : K[X] := ∏ i ∈ Nat.properDivisors k, cyclotomic' i K have Bmo : B.Monic := by apply monic_prod_of_monic intro i _ exact cyclotomic'.monic i K have Bint : B ∈ lifts (Int.castRingHom K) := by refine Subsemiring.prod_mem (lifts (Int.castRingHom K)) ?_ intro x hx have xsmall := (Nat.mem_properDivisors.1 hx).2 obtain ⟨d, hd⟩ := (Nat.mem_properDivisors.1 hx).1 rw [mul_comm] at hd exact ihk x xsmall (h.pow hpos hd) replace Bint := lifts_and_degree_eq_and_monic Bint Bmo obtain ⟨B₁, hB₁, _, hB₁mo⟩ := Bint let Q₁ : ℤ[X] := (X ^ k - 1) /ₘ B₁ have huniq : 0 + B * cyclotomic' k K = X ^ k - 1 ∧ (0 : K[X]).degree < B.degree := by constructor · rw [zero_add, mul_comm, ← prod_cyclotomic'_eq_X_pow_sub_one hpos h, ← Nat.cons_self_properDivisors hpos.ne', Finset.prod_cons] · simpa only [degree_zero, bot_lt_iff_ne_bot, Ne, degree_eq_bot] using Bmo.ne_zero replace huniq := div_modByMonic_unique (cyclotomic' k K) (0 : K[X]) Bmo huniq simp only [lifts, RingHom.mem_rangeS] use Q₁ rw [coe_mapRingHom, map_divByMonic (Int.castRingHom K) hB₁mo, hB₁, ← huniq.1] simp
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
int_coeff_of_cyclotomic'
If there is a primitive `n`-th root of unity in `K`, then `cyclotomic' n K` comes from a monic polynomial with integer coefficients.
unique_int_coeff_of_cycl {K : Type*} [CommRing K] [IsDomain K] [CharZero K] {ζ : K} {n : ℕ+} (h : IsPrimitiveRoot ζ n) : ∃! P : ℤ[X], map (Int.castRingHom K) P = cyclotomic' n K := by obtain ⟨P, hP⟩ := int_coeff_of_cyclotomic' h refine ⟨P, hP.1, fun Q hQ => ?_⟩ apply map_injective (Int.castRingHom K) Int.cast_injective rw [hP.1, hQ]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
unique_int_coeff_of_cycl
If `K` is of characteristic `0` and there is a primitive `n`-th root of unity in `K`, then `cyclotomic n K` comes from a unique polynomial with integer coefficients.
cyclotomic (n : ℕ) (R : Type*) [Ring R] : R[X] := if h : n = 0 then 1 else map (Int.castRingHom R) (int_coeff_of_cyclotomic' (Complex.isPrimitiveRoot_exp n h)).choose
def
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic
The `n`-th cyclotomic polynomial with coefficients in `R`.
int_cyclotomic_rw {n : ℕ} (h : n ≠ 0) : cyclotomic n ℤ = (int_coeff_of_cyclotomic' (Complex.isPrimitiveRoot_exp n h)).choose := by simp only [cyclotomic, h, dif_neg, not_false_iff] ext i simp only [coeff_map, Int.cast_id, eq_intCast]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
int_cyclotomic_rw
null
map_cyclotomic_int (n : ℕ) (R : Type*) [Ring R] : map (Int.castRingHom R) (cyclotomic n ℤ) = cyclotomic n R := by by_cases hzero : n = 0 · simp only [hzero, cyclotomic, dif_pos, Polynomial.map_one] simp [cyclotomic, hzero]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
map_cyclotomic_int
`cyclotomic n R` comes from `cyclotomic n ℤ`.
int_cyclotomic_spec (n : ℕ) : map (Int.castRingHom ℂ) (cyclotomic n ℤ) = cyclotomic' n ℂ ∧ (cyclotomic n ℤ).degree = (cyclotomic' n ℂ).degree ∧ (cyclotomic n ℤ).Monic := by by_cases hzero : n = 0 · simp only [hzero, cyclotomic, degree_one, monic_one, cyclotomic'_zero, dif_pos, Polynomial.map_one, and_self_iff] rw [int_cyclotomic_rw hzero] exact (int_coeff_of_cyclotomic' (Complex.isPrimitiveRoot_exp n hzero)).choose_spec
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
int_cyclotomic_spec
null
int_cyclotomic_unique {n : ℕ} {P : ℤ[X]} (h : map (Int.castRingHom ℂ) P = cyclotomic' n ℂ) : P = cyclotomic n ℤ := by apply map_injective (Int.castRingHom ℂ) Int.cast_injective rw [h, (int_cyclotomic_spec n).1]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
int_cyclotomic_unique
null
@[simp] map_cyclotomic (n : ℕ) {R S : Type*} [Ring R] [Ring S] (f : R →+* S) : map f (cyclotomic n R) = cyclotomic n S := by rw [← map_cyclotomic_int n R, ← map_cyclotomic_int n S, map_map] have : Subsingleton (ℤ →+* S) := inferInstance congr!
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
map_cyclotomic
The definition of `cyclotomic n R` commutes with any ring homomorphism.
cyclotomic.eval_apply {R S : Type*} (q : R) (n : ℕ) [Ring R] [Ring S] (f : R →+* S) : eval (f q) (cyclotomic n S) = f (eval q (cyclotomic n R)) := by rw [← map_cyclotomic n f, eval_map, eval₂_at_apply] @[simp] theorem cyclotomic.eval_apply_ofReal (q : ℝ) (n : ℕ) : eval (q : ℂ) (cyclotomic n ℂ) = (eval q (cyclotomic n ℝ)) := cyclotomic.eval_apply q n (algebraMap ℝ ℂ)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic.eval_apply
null
@[simp] cyclotomic_zero (R : Type*) [Ring R] : cyclotomic 0 R = 1 := by simp only [cyclotomic, dif_pos]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_zero
The zeroth cyclotomic polynomial is `1`.
@[simp] cyclotomic_one (R : Type*) [Ring R] : cyclotomic 1 R = X - 1 := by have hspec : map (Int.castRingHom ℂ) (X - 1) = cyclotomic' 1 ℂ := by simp only [cyclotomic'_one, map_X, Polynomial.map_one, Polynomial.map_sub] symm rw [← map_cyclotomic_int, ← int_cyclotomic_unique hspec] simp only [map_X, Polynomial.map_one, Polynomial.map_sub]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_one
The first cyclotomic polynomial is `X - 1`.
cyclotomic.monic (n : ℕ) (R : Type*) [Ring R] : (cyclotomic n R).Monic := by rw [← map_cyclotomic_int] exact (int_cyclotomic_spec n).2.2.map _
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic.monic
`cyclotomic n` is monic.
cyclotomic.isPrimitive (n : ℕ) (R : Type*) [CommRing R] : (cyclotomic n R).IsPrimitive := (cyclotomic.monic n R).isPrimitive
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic.isPrimitive
`cyclotomic n` is primitive.
cyclotomic_ne_zero (n : ℕ) (R : Type*) [Ring R] [Nontrivial R] : cyclotomic n R ≠ 0 := (cyclotomic.monic n R).ne_zero
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_ne_zero
`cyclotomic n R` is different from `0`.
degree_cyclotomic (n : ℕ) (R : Type*) [Ring R] [Nontrivial R] : (cyclotomic n R).degree = Nat.totient n := by rw [← map_cyclotomic_int] rw [degree_map_eq_of_leadingCoeff_ne_zero (Int.castRingHom R) _] · rcases n with - | k · simp only [cyclotomic, degree_one, dif_pos, Nat.totient_zero, CharP.cast_eq_zero] rw [← degree_cyclotomic' (Complex.isPrimitiveRoot_exp k.succ (Nat.succ_ne_zero k))] exact (int_cyclotomic_spec k.succ).2.1 simp only [(int_cyclotomic_spec n).right.right, eq_intCast, Monic.leadingCoeff, Int.cast_one, Ne, not_false_iff, one_ne_zero]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
degree_cyclotomic
The degree of `cyclotomic n` is `totient n`.
natDegree_cyclotomic (n : ℕ) (R : Type*) [Ring R] [Nontrivial R] : (cyclotomic n R).natDegree = Nat.totient n := by rw [natDegree, degree_cyclotomic]; norm_cast
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
natDegree_cyclotomic
The natural degree of `cyclotomic n` is `totient n`.
natDegree_cyclotomic_le {R : Type*} [Ring R] {n : ℕ} : natDegree (cyclotomic n R) ≤ n.totient := by nontriviality R rw [natDegree_cyclotomic]
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
natDegree_cyclotomic_le
The natural degree of `cyclotomic n` is at most `totient n`. If the base ring is nontrivial, then the degree is exactly `φ n`, otherwise it's zero.
degree_cyclotomic_pos (n : ℕ) (R : Type*) (hpos : 0 < n) [Ring R] [Nontrivial R] : 0 < (cyclotomic n R).degree := by rwa [degree_cyclotomic n R, Nat.cast_pos, Nat.totient_pos] open Finset
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
degree_cyclotomic_pos
The degree of `cyclotomic n R` is positive.
prod_cyclotomic_eq_X_pow_sub_one {n : ℕ} (hpos : 0 < n) (R : Type*) [CommRing R] : ∏ i ∈ Nat.divisors n, cyclotomic i R = X ^ n - 1 := by have integer : ∏ i ∈ Nat.divisors n, cyclotomic i ℤ = X ^ n - 1 := by apply map_injective (Int.castRingHom ℂ) Int.cast_injective simp only [Polynomial.map_prod, int_cyclotomic_spec, Polynomial.map_pow, map_X, Polynomial.map_one, Polynomial.map_sub] exact prod_cyclotomic'_eq_X_pow_sub_one hpos (Complex.isPrimitiveRoot_exp n hpos.ne') simpa only [Polynomial.map_prod, map_cyclotomic_int, Polynomial.map_sub, Polynomial.map_one, Polynomial.map_pow, Polynomial.map_X] using congr_arg (map (Int.castRingHom R)) integer
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
prod_cyclotomic_eq_X_pow_sub_one
`∏ i ∈ Nat.divisors n, cyclotomic i R = X ^ n - 1`.
cyclotomic.dvd_X_pow_sub_one (n : ℕ) (R : Type*) [Ring R] : cyclotomic n R ∣ X ^ n - 1 := by suffices cyclotomic n ℤ ∣ X ^ n - 1 by simpa only [map_cyclotomic_int, Polynomial.map_sub, Polynomial.map_one, Polynomial.map_pow, Polynomial.map_X] using Polynomial.map_dvd (Int.castRingHom R) this rcases n.eq_zero_or_pos with (rfl | hn) · simp rw [← prod_cyclotomic_eq_X_pow_sub_one hn] exact Finset.dvd_prod_of_mem _ (n.mem_divisors_self hn.ne')
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic.dvd_X_pow_sub_one
null
prod_cyclotomic_eq_geom_sum {n : ℕ} (h : 0 < n) (R) [CommRing R] : ∏ i ∈ n.divisors.erase 1, cyclotomic i R = ∑ i ∈ Finset.range n, X ^ i := by suffices (∏ i ∈ n.divisors.erase 1, cyclotomic i ℤ) = ∑ i ∈ Finset.range n, X ^ i by simpa only [Polynomial.map_prod, map_cyclotomic_int, Polynomial.map_sum, Polynomial.map_pow, Polynomial.map_X] using congr_arg (map (Int.castRingHom R)) this rw [← mul_left_inj' (cyclotomic_ne_zero 1 ℤ), prod_erase_mul _ _ (Nat.one_mem_divisors.2 h.ne'), cyclotomic_one, geom_sum_mul, prod_cyclotomic_eq_X_pow_sub_one h]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
prod_cyclotomic_eq_geom_sum
null
cyclotomic_prime (R : Type*) [Ring R] (p : ℕ) [hp : Fact p.Prime] : cyclotomic p R = ∑ i ∈ Finset.range p, X ^ i := by suffices cyclotomic p ℤ = ∑ i ∈ range p, X ^ i by simpa only [map_cyclotomic_int, Polynomial.map_sum, Polynomial.map_pow, Polynomial.map_X] using congr_arg (map (Int.castRingHom R)) this rw [← prod_cyclotomic_eq_geom_sum hp.out.pos, hp.out.divisors, erase_insert (mem_singleton.not.2 hp.out.ne_one.symm), prod_singleton]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_prime
If `p` is prime, then `cyclotomic p R = ∑ i ∈ range p, X ^ i`.
cyclotomic_prime_mul_X_sub_one (R : Type*) [Ring R] (p : ℕ) [hn : Fact (Nat.Prime p)] : cyclotomic p R * (X - 1) = X ^ p - 1 := by rw [cyclotomic_prime, geom_sum_mul] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_prime_mul_X_sub_one
null
cyclotomic_two (R : Type*) [Ring R] : cyclotomic 2 R = X + 1 := by simp [cyclotomic_prime] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_two
null
cyclotomic_three (R : Type*) [Ring R] : cyclotomic 3 R = X ^ 2 + X + 1 := by simp [cyclotomic_prime, sum_range_succ']
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_three
null
cyclotomic_dvd_geom_sum_of_dvd (R) [Ring R] {d n : ℕ} (hdn : d ∣ n) (hd : d ≠ 1) : cyclotomic d R ∣ ∑ i ∈ Finset.range n, X ^ i := by suffices cyclotomic d ℤ ∣ ∑ i ∈ Finset.range n, X ^ i by simpa only [map_cyclotomic_int, Polynomial.map_sum, Polynomial.map_pow, Polynomial.map_X] using map_dvd (Int.castRingHom R) this rcases n.eq_zero_or_pos with (rfl | hn) · simp rw [← prod_cyclotomic_eq_geom_sum hn] apply Finset.dvd_prod_of_mem simp [hd, hdn, hn.ne']
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_dvd_geom_sum_of_dvd
null
X_pow_sub_one_mul_prod_cyclotomic_eq_X_pow_sub_one_of_dvd (R) [CommRing R] {d n : ℕ} (hdvd : d ∣ n) (hn : n ≠ 0) : ((X ^ d - 1) * ∏ x ∈ n.divisors \ d.divisors, cyclotomic x R) = X ^ n - 1 := by have h0d : 0 < d := Nat.pos_of_dvd_of_pos hdvd (by positivity) rw [← prod_cyclotomic_eq_X_pow_sub_one h0d, ← prod_cyclotomic_eq_X_pow_sub_one (by positivity), mul_comm, Finset.prod_sdiff (by gcongr)]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
X_pow_sub_one_mul_prod_cyclotomic_eq_X_pow_sub_one_of_dvd
null
X_pow_sub_one_mul_cyclotomic_dvd_X_pow_sub_one_of_dvd (R) [CommRing R] {d n : ℕ} (h : d ∈ n.properDivisors) : (X ^ d - 1) * cyclotomic n R ∣ X ^ n - 1 := by rw [Nat.mem_properDivisors] at h use ∏ x ∈ n.properDivisors \ d.divisors, cyclotomic x R rw [← X_pow_sub_one_mul_prod_cyclotomic_eq_X_pow_sub_one_of_dvd R h.1 h.2.ne_bot, ← Nat.insert_self_properDivisors, Finset.insert_sdiff_of_notMem, Finset.prod_insert, mul_assoc] · exact Finset.notMem_sdiff_of_notMem_left Nat.self_notMem_properDivisors · exact fun hk => h.2.not_ge <| Nat.divisor_le hk · exact h.2.ne_bot
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
X_pow_sub_one_mul_cyclotomic_dvd_X_pow_sub_one_of_dvd
null
cyclotomic_eq_prod_X_pow_sub_one_pow_moebius {n : ℕ} (R : Type*) [CommRing R] [IsDomain R] : algebraMap _ (RatFunc R) (cyclotomic n R) = ∏ i ∈ n.divisorsAntidiagonal, algebraMap R[X] _ (X ^ i.snd - 1) ^ μ i.fst := by rcases n.eq_zero_or_pos with (rfl | hpos) · simp have h : ∀ n : ℕ, 0 < n → (∏ i ∈ Nat.divisors n, algebraMap _ (RatFunc R) (cyclotomic i R)) = algebraMap _ _ (X ^ n - 1 : R[X]) := by intro n hn rw [← prod_cyclotomic_eq_X_pow_sub_one hn R, map_prod] rw [(prod_eq_iff_prod_pow_moebius_eq_of_nonzero (fun n hn => _) fun n hn => _).1 h n hpos] <;> simp_rw [Ne, IsFractionRing.to_map_eq_zero_iff] · simp [cyclotomic_ne_zero] · intro n hn apply Monic.ne_zero apply monic_X_pow_sub_C _ (ne_of_gt hn)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_eq_prod_X_pow_sub_one_pow_moebius
`cyclotomic n R` can be expressed as a product in a fraction field of `R[X]` using Möbius inversion.
cyclotomic_eq_X_pow_sub_one_div {R : Type*} [CommRing R] {n : ℕ} (hpos : 0 < n) : cyclotomic n R = (X ^ n - 1) /ₘ ∏ i ∈ Nat.properDivisors n, cyclotomic i R := by nontriviality R rw [← prod_cyclotomic_eq_X_pow_sub_one hpos, ← Nat.cons_self_properDivisors hpos.ne', Finset.prod_cons] have prod_monic : (∏ i ∈ Nat.properDivisors n, cyclotomic i R).Monic := by apply monic_prod_of_monic intro i _ exact cyclotomic.monic i R rw [(div_modByMonic_unique (cyclotomic n R) 0 prod_monic _).1] simp only [degree_zero, zero_add] constructor · rw [mul_comm] rw [bot_lt_iff_ne_bot] intro h exact Monic.ne_zero prod_monic (degree_eq_bot.1 h)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_eq_X_pow_sub_one_div
We have `cyclotomic n R = (X ^ k - 1) /ₘ (∏ i ∈ Nat.properDivisors k, cyclotomic i K)`.
X_pow_sub_one_dvd_prod_cyclotomic (R : Type*) [CommRing R] {n m : ℕ} (hpos : 0 < n) (hm : m ∣ n) (hdiff : m ≠ n) : X ^ m - 1 ∣ ∏ i ∈ Nat.properDivisors n, cyclotomic i R := by replace hm := Nat.mem_properDivisors.2 ⟨hm, lt_of_le_of_ne (Nat.divisor_le (Nat.mem_divisors.2 ⟨hm, hpos.ne'⟩)) hdiff⟩ rw [← Finset.sdiff_union_of_subset (Nat.divisors_subset_properDivisors (ne_of_lt hpos).symm (Nat.mem_properDivisors.1 hm).1 (ne_of_lt (Nat.mem_properDivisors.1 hm).2)), Finset.prod_union Finset.sdiff_disjoint, prod_cyclotomic_eq_X_pow_sub_one (Nat.pos_of_mem_properDivisors hm)] exact ⟨∏ x ∈ n.properDivisors \ m.divisors, cyclotomic x R, by rw [mul_comm]⟩
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
X_pow_sub_one_dvd_prod_cyclotomic
If `m` is a proper divisor of `n`, then `X ^ m - 1` divides `∏ i ∈ Nat.properDivisors n, cyclotomic i R`.
cyclotomic_eq_prod_X_sub_primitiveRoots {K : Type*} [CommRing K] [IsDomain K] {ζ : K} {n : ℕ} (hz : IsPrimitiveRoot ζ n) : cyclotomic n K = ∏ μ ∈ primitiveRoots n K, (X - C μ) := by rw [← cyclotomic'] induction n using Nat.strong_induction_on generalizing ζ with | _ k hk obtain hzero | hpos := k.eq_zero_or_pos · simp only [hzero, cyclotomic'_zero, cyclotomic_zero] have h : ∀ i ∈ k.properDivisors, cyclotomic i K = cyclotomic' i K := by intro i hi obtain ⟨d, hd⟩ := (Nat.mem_properDivisors.1 hi).1 rw [mul_comm] at hd exact hk i (Nat.mem_properDivisors.1 hi).2 (IsPrimitiveRoot.pow hpos hz hd) rw [@cyclotomic_eq_X_pow_sub_one_div _ _ _ hpos, cyclotomic'_eq_X_pow_sub_one_div hpos hz, Finset.prod_congr (refl k.properDivisors) h]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_eq_prod_X_sub_primitiveRoots
If there is a primitive `n`-th root of unity in `K`, then `cyclotomic n K = ∏ μ ∈ primitiveRoots n K, (X - C μ)`. ∈ particular, `cyclotomic n K = cyclotomic' n K`
eq_cyclotomic_iff {R : Type*} [CommRing R] {n : ℕ} (hpos : 0 < n) (P : R[X]) : P = cyclotomic n R ↔ (P * ∏ i ∈ Nat.properDivisors n, Polynomial.cyclotomic i R) = X ^ n - 1 := by nontriviality R refine ⟨fun hcycl => ?_, fun hP => ?_⟩ · rw [hcycl, ← prod_cyclotomic_eq_X_pow_sub_one hpos R, ← Nat.cons_self_properDivisors hpos.ne', Finset.prod_cons] · have prod_monic : (∏ i ∈ Nat.properDivisors n, cyclotomic i R).Monic := by apply monic_prod_of_monic intro i _ exact cyclotomic.monic i R rw [@cyclotomic_eq_X_pow_sub_one_div R _ _ hpos, (div_modByMonic_unique P 0 prod_monic _).1] refine ⟨by rwa [zero_add, mul_comm], ?_⟩ rw [degree_zero, bot_lt_iff_ne_bot] intro h exact Monic.ne_zero prod_monic (degree_eq_bot.1 h)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
eq_cyclotomic_iff
null
cyclotomic_prime_pow_eq_geom_sum {R : Type*} [CommRing R] {p n : ℕ} (hp : p.Prime) : cyclotomic (p ^ (n + 1)) R = ∑ i ∈ Finset.range p, (X ^ p ^ n) ^ i := by have : ∀ m, (cyclotomic (p ^ (m + 1)) R = ∑ i ∈ Finset.range p, (X ^ p ^ m) ^ i) ↔ ((∑ i ∈ Finset.range p, (X ^ p ^ m) ^ i) * ∏ x ∈ Finset.range (m + 1), cyclotomic (p ^ x) R) = X ^ p ^ (m + 1) - 1 := by intro m have := eq_cyclotomic_iff (R := R) (P := ∑ i ∈ range p, (X ^ p ^ m) ^ i) (pow_pos hp.pos (m + 1)) rw [eq_comm] at this rw [this, Nat.prod_properDivisors_prime_pow hp] induction n with | zero => haveI := Fact.mk hp; simp [cyclotomic_prime] | succ n_n n_ih => rw [← (eq_cyclotomic_iff (pow_pos hp.pos (n_n + 1 + 1)) _).mpr ?_] rw [Nat.prod_properDivisors_prime_pow hp, Finset.prod_range_succ, n_ih] rw [this] at n_ih rw [mul_comm _ (∑ i ∈ _, _), n_ih, geom_sum_mul, sub_left_inj, ← pow_mul] simp only [pow_add, pow_one]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_prime_pow_eq_geom_sum
If `p ^ k` is a prime power, then `cyclotomic (p ^ (n + 1)) R = ∑ i ∈ range p, (X ^ (p ^ n)) ^ i`.
cyclotomic_prime_pow_mul_X_pow_sub_one (R : Type*) [CommRing R] (p k : ℕ) [hn : Fact (Nat.Prime p)] : cyclotomic (p ^ (k + 1)) R * (X ^ p ^ k - 1) = X ^ p ^ (k + 1) - 1 := by rw [cyclotomic_prime_pow_eq_geom_sum hn.out, geom_sum_mul, ← pow_mul, pow_succ, mul_comm]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_prime_pow_mul_X_pow_sub_one
null
cyclotomic_coeff_zero (R : Type*) [CommRing R] {n : ℕ} (hn : 1 < n) : (cyclotomic n R).coeff 0 = 1 := by induction n using Nat.strong_induction_on with | _ n hi have hprod : (∏ i ∈ Nat.properDivisors n, (Polynomial.cyclotomic i R).coeff 0) = -1 := by rw [← Finset.insert_erase (Nat.one_mem_properDivisors_iff_one_lt.2 (lt_of_lt_of_le one_lt_two hn)), Finset.prod_insert (Finset.notMem_erase 1 _), cyclotomic_one R] have hleq : ∀ j ∈ n.properDivisors.erase 1, 2 ≤ j := by intro j hj apply Nat.succ_le_of_lt exact (Ne.le_iff_lt (Finset.mem_erase.1 hj).1.symm).mp (Nat.succ_le_of_lt (Nat.pos_of_mem_properDivisors (Finset.mem_erase.1 hj).2)) have hcongr : ∀ j ∈ n.properDivisors.erase 1, (cyclotomic j R).coeff 0 = 1 := by intro j hj exact hi j (Nat.mem_properDivisors.1 (Finset.mem_erase.1 hj).2).2 (hleq j hj) have hrw : (∏ x ∈ n.properDivisors.erase 1, (cyclotomic x R).coeff 0) = 1 := by rw [Finset.prod_congr (refl (n.properDivisors.erase 1)) hcongr] simp only [Finset.prod_const_one] simp only [hrw, mul_one, zero_sub, coeff_one_zero, coeff_X_zero, coeff_sub] have heq : (X ^ n - 1 : R[X]).coeff 0 = -(cyclotomic n R).coeff 0 := by rw [← prod_cyclotomic_eq_X_pow_sub_one (zero_le_one.trans_lt hn), ← Nat.cons_self_properDivisors hn.ne_bot, Finset.prod_cons, mul_coeff_zero, coeff_zero_prod, hprod, mul_neg, mul_one] have hzero : (X ^ n - 1 : R[X]).coeff 0 = (-1 : R) := by rw [coeff_zero_eq_eval_zero _] simp only [zero_pow (by positivity : n ≠ 0), eval_X, eval_one, zero_sub, eval_pow, eval_sub] rw [hzero] at heq exact neg_inj.mp (Eq.symm heq)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
cyclotomic_coeff_zero
The constant term of `cyclotomic n R` is `1` if `2 ≤ n`.
coprime_of_root_cyclotomic {n : ℕ} (hpos : 0 < n) {p : ℕ} [hprime : Fact p.Prime] {a : ℕ} (hroot : IsRoot (cyclotomic n (ZMod p)) (Nat.castRingHom (ZMod p) a)) : a.Coprime p := by apply Nat.Coprime.symm rw [hprime.1.coprime_iff_not_dvd] intro h replace h := (ZMod.natCast_eq_zero_iff a p).2 h rw [IsRoot.def, eq_natCast, h, ← coeff_zero_eq_eval_zero] at hroot by_cases hone : n = 1 · simp only [hone, cyclotomic_one, zero_sub, coeff_one_zero, coeff_X_zero, neg_eq_zero, one_ne_zero, coeff_sub] at hroot rw [cyclotomic_coeff_zero (ZMod p) (Nat.succ_le_of_lt (lt_of_le_of_ne (Nat.succ_le_of_lt hpos) (Ne.symm hone)))] at hroot exact one_ne_zero hroot
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
coprime_of_root_cyclotomic
If `(a : ℕ)` is a root of `cyclotomic n (ZMod p)`, where `p` is a prime, then `a` and `p` are coprime.
orderOf_root_cyclotomic_dvd {n : ℕ} (hpos : 0 < n) {p : ℕ} [Fact p.Prime] {a : ℕ} (hroot : IsRoot (cyclotomic n (ZMod p)) (Nat.castRingHom (ZMod p) a)) : orderOf (ZMod.unitOfCoprime a (coprime_of_root_cyclotomic hpos hroot)) ∣ n := by apply orderOf_dvd_of_pow_eq_one suffices hpow : eval (Nat.castRingHom (ZMod p) a) (X ^ n - 1 : (ZMod p)[X]) = 0 by simp only [eval_X, eval_one, eval_pow, eval_sub, eq_natCast] at hpow apply Units.val_eq_one.1 simp only [sub_eq_zero.mp hpow, ZMod.coe_unitOfCoprime, Units.val_pow_eq_pow_val] rw [IsRoot.def] at hroot rw [← prod_cyclotomic_eq_X_pow_sub_one hpos (ZMod p), ← Nat.cons_self_properDivisors hpos.ne', Finset.prod_cons, eval_mul, hroot, zero_mul]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
orderOf_root_cyclotomic_dvd
If `(a : ℕ)` is a root of `cyclotomic n (ZMod p)`, then the multiplicative order of `a` modulo `p` divides `n`.
dvd_C_mul_X_sub_one_pow_add_one {p : ℕ} (hpri : p.Prime) (hp : p ≠ 2) (a r : R) (h₁ : r ∣ a ^ p) (h₂ : r ∣ p * a) : C r ∣ (C a * X - 1) ^ p + 1 := by have := hpri.dvd_add_pow_sub_pow_of_dvd (C a * X) (-1) (r := C r) ?_ ?_ · rwa [← sub_eq_add_neg, (hpri.odd_of_ne_two hp).neg_pow, one_pow, sub_neg_eq_add] at this · simp only [mul_pow, ← map_pow, dvd_mul_right, (_root_.map_dvd C h₁).trans] simp only [map_mul, map_natCast, ← mul_assoc, dvd_mul_right, (_root_.map_dvd C h₂).trans]
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
dvd_C_mul_X_sub_one_pow_add_one
null
private _root_.IsPrimitiveRoot.pow_sub_pow_eq_prod_sub_mul_field {K : Type*} [Field K] {ζ : K} (x y : K) (hpos : 0 < n) (h : IsPrimitiveRoot ζ n) : x ^ n - y ^ n = ∏ ζ ∈ nthRootsFinset n (1 : K), (x - ζ * y) := by by_cases hy : y = 0 · simp only [hy, zero_pow (Nat.ne_zero_of_lt hpos), sub_zero, mul_zero, prod_const] congr rw [h.card_nthRootsFinset] convert congr_arg (eval (x/y) · * y ^ card (nthRootsFinset n (1 : K))) <| X_pow_sub_one_eq_prod hpos h using 1 · simp [sub_mul, div_pow, hy, h.card_nthRootsFinset] · simp [eval_prod, prod_mul_pow_card, sub_mul, hy] variable [IsDomain R]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
_root_.IsPrimitiveRoot.pow_sub_pow_eq_prod_sub_mul_field
null
_root_.IsPrimitiveRoot.pow_sub_pow_eq_prod_sub_mul (hpos : 0 < n) (h : IsPrimitiveRoot ζ n) : x ^ n - y ^ n = ∏ ζ ∈ nthRootsFinset n (1 : R), (x - ζ * y) := by let K := FractionRing R apply FaithfulSMul.algebraMap_injective R K rw [map_sub, map_pow, map_pow, map_prod] simp_rw [map_sub, map_mul] have h' : IsPrimitiveRoot (algebraMap R K ζ) n := h.map_of_injective <| FaithfulSMul.algebraMap_injective R K rw [h'.pow_sub_pow_eq_prod_sub_mul_field _ _ hpos] refine (prod_nbij (algebraMap R K) (fun a ha ↦ map_mem_nthRootsFinset_one ha _) (fun a _ b _ H ↦ FaithfulSMul.algebraMap_injective R K H) (fun a ha ↦ ?_) (fun _ _ ↦ rfl)).symm have := Set.surj_on_of_inj_on_of_ncard_le (s := nthRootsFinset n (1 : R)) (t := nthRootsFinset n (1: K)) _ (fun _ hr ↦ map_mem_nthRootsFinset_one hr _) (fun a _ b _ H ↦ FaithfulSMul.algebraMap_injective R K H) (by simp [h.card_nthRootsFinset, h'.card_nthRootsFinset]) obtain ⟨x, hx, hx1⟩ := this _ ha exact ⟨x, hx, hx1.symm⟩
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
_root_.IsPrimitiveRoot.pow_sub_pow_eq_prod_sub_mul
If there is a primitive `n`th root of unity in `R`, then `X ^ n - Y ^ n = ∏ (X - μ Y)`, where `μ` varies over the `n`-th roots of unity.
_root_.IsPrimitiveRoot.pow_add_pow_eq_prod_add_mul (hodd : Odd n) (h : IsPrimitiveRoot ζ n) : x ^ n + y ^ n = ∏ ζ ∈ nthRootsFinset n (1 : R), (x + ζ * y) := by simpa [hodd.neg_pow] using h.pow_sub_pow_eq_prod_sub_mul x (-y) hodd.pos
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.FieldTheory.RatFunc.AsPolynomial", "Mathlib.NumberTheory.ArithmeticFunction", "Mathlib.RingTheory.RootsOfUnity.Complex" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean
_root_.IsPrimitiveRoot.pow_add_pow_eq_prod_add_mul
If there is a primitive `n`th root of unity in `R` and `n` is odd, then `X ^ n + Y ^ n = ∏ (X + μ Y)`, where `μ` varies over the `n`-th roots of unity.
@[simp] eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : ℕ} [hn : Fact p.Prime] : eval 1 (cyclotomic p R) = p := by simp only [cyclotomic_prime, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum, Finset.card_range, smul_one_eq_cast]
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
eval_one_cyclotomic_prime
null
eval₂_one_cyclotomic_prime {R S : Type*} [CommRing R] [Semiring S] (f : R →+* S) {p : ℕ} [Fact p.Prime] : eval₂ f 1 (cyclotomic p R) = p := by simp @[simp]
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
eval₂_one_cyclotomic_prime
null
eval_one_cyclotomic_prime_pow {R : Type*} [CommRing R] {p : ℕ} (k : ℕ) [hn : Fact p.Prime] : eval 1 (cyclotomic (p ^ (k + 1)) R) = p := by simp only [cyclotomic_prime_pow_eq_geom_sum hn.out, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum, Finset.card_range, smul_one_eq_cast]
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
eval_one_cyclotomic_prime_pow
null
eval₂_one_cyclotomic_prime_pow {R S : Type*} [CommRing R] [Semiring S] (f : R →+* S) {p : ℕ} (k : ℕ) [Fact p.Prime] : eval₂ f 1 (cyclotomic (p ^ (k + 1)) R) = p := by simp
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
eval₂_one_cyclotomic_prime_pow
null
private cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [CommRing R] [PartialOrder R] [IsStrictOrderedRing R] : 0 < eval (-1 : R) (cyclotomic n R) := by haveI := NeZero.of_gt hn rw [← map_cyclotomic_int, ← Int.cast_one, ← Int.cast_neg, eval_intCast_map, Int.coe_castRingHom, Int.cast_pos] suffices 0 < eval (↑(-1 : ℤ)) (cyclotomic n ℝ) by rw [← map_cyclotomic_int n ℝ, eval_intCast_map, Int.coe_castRingHom] at this simpa only [Int.cast_pos] using this simp only [Int.cast_one, Int.cast_neg] have h0 := cyclotomic_coeff_zero ℝ hn.le rw [coeff_zero_eq_eval_zero] at h0 by_contra! hx have := intermediate_value_univ (-1) 0 (cyclotomic n ℝ).continuous obtain ⟨y, hy : IsRoot _ y⟩ := this (show (0 : ℝ) ∈ Set.Icc _ _ by simpa [h0] using hx) rw [@isRoot_cyclotomic_iff] at hy rw [hy.eq_orderOf] at hn exact hn.not_ge LinearOrderedRing.orderOf_le_two
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
cyclotomic_neg_one_pos
null
cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [CommRing R] [LinearOrder R] [IsStrictOrderedRing R] (x : R) : 0 < eval x (cyclotomic n R) := by induction n using Nat.strong_induction_on with | _ n ih have hn' : 0 < n := pos_of_gt hn have hn'' : 1 < n := one_lt_two.trans hn have := prod_cyclotomic_eq_geom_sum hn' R apply_fun eval x at this rw [← cons_self_properDivisors hn'.ne', Finset.erase_cons_of_ne _ hn''.ne', Finset.prod_cons, eval_mul, eval_geom_sum] at this rcases lt_trichotomy 0 (∑ i ∈ Finset.range n, x ^ i) with (h | h | h) · apply pos_of_mul_pos_left · rwa [this] rw [eval_prod] refine Finset.prod_nonneg fun i hi => ?_ simp only [Finset.mem_erase, mem_properDivisors] at hi rw [geom_sum_pos_iff hn'.ne'] at h rcases h with hk | hx · refine (ih _ hi.2.2 (Nat.two_lt_of_ne ?_ hi.1 ?_)).le <;> rintro rfl · exact hn'.ne' (zero_dvd_iff.mp hi.2.1) · exact not_odd_iff_even.2 (even_iff_two_dvd.mpr hi.2.1) hk · rcases eq_or_ne i 2 with (rfl | hk) · simpa only [eval_X, eval_one, cyclotomic_two, eval_add] using hx.le refine (ih _ hi.2.2 (Nat.two_lt_of_ne ?_ hi.1 hk)).le rintro rfl exact hn'.ne' <| zero_dvd_iff.mp hi.2.1 · rw [eq_comm, geom_sum_eq_zero_iff_neg_one hn'.ne'] at h exact h.1.symm ▸ cyclotomic_neg_one_pos hn · apply pos_of_mul_neg_left · rwa [this] rw [geom_sum_neg_iff hn'.ne'] at h have h2 : 2 ∈ n.properDivisors.erase 1 := by rw [Finset.mem_erase, mem_properDivisors] exact ⟨by decide, even_iff_two_dvd.mp h.1, hn⟩ rw [eval_prod, ← Finset.prod_erase_mul _ _ h2] apply mul_nonpos_of_nonneg_of_nonpos · refine Finset.prod_nonneg fun i hi => le_of_lt ?_ simp only [Finset.mem_erase, mem_properDivisors] at hi refine ih _ hi.2.2.2 (Nat.two_lt_of_ne ?_ hi.2.1 hi.1) rintro rfl rw [zero_dvd_iff] at hi exact hn'.ne' hi.2.2.1 · simpa only [eval_X, eval_one, cyclotomic_two, eval_add] using h.right.le
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
cyclotomic_pos
null
cyclotomic_pos_and_nonneg (n : ℕ) {R} [CommRing R] [LinearOrder R] [IsStrictOrderedRing R] (x : R) : (1 < x → 0 < eval x (cyclotomic n R)) ∧ (1 ≤ x → 0 ≤ eval x (cyclotomic n R)) := by rcases n with (_ | _ | _ | n) · simp only [cyclotomic_zero, eval_one, zero_lt_one, implies_true, zero_le_one, and_self] · simp only [zero_add, cyclotomic_one, eval_sub, eval_X, eval_one, sub_pos, imp_self, sub_nonneg, and_self] · simp only [zero_add, reduceAdd, cyclotomic_two, eval_add, eval_X, eval_one] constructor <;> intro <;> linarith · constructor <;> intro <;> [skip; apply le_of_lt] <;> apply cyclotomic_pos (by cutsat)
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
cyclotomic_pos_and_nonneg
null
cyclotomic_pos' (n : ℕ) {R} [CommRing R] [LinearOrder R] [IsStrictOrderedRing R] {x : R} (hx : 1 < x) : 0 < eval x (cyclotomic n R) := (cyclotomic_pos_and_nonneg n x).1 hx
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
cyclotomic_pos'
Cyclotomic polynomials are always positive on inputs larger than one. Similar to `cyclotomic_pos` but with the condition on the input rather than index of the cyclotomic polynomial.
cyclotomic_nonneg (n : ℕ) {R} [CommRing R] [LinearOrder R] [IsStrictOrderedRing R] {x : R} (hx : 1 ≤ x) : 0 ≤ eval x (cyclotomic n R) := (cyclotomic_pos_and_nonneg n x).2 hx
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
cyclotomic_nonneg
Cyclotomic polynomials are always nonnegative on inputs one or more.
eval_one_cyclotomic_not_prime_pow {R : Type*} [Ring R] {n : ℕ} (h : ∀ {p : ℕ}, p.Prime → ∀ k : ℕ, p ^ k ≠ n) : eval 1 (cyclotomic n R) = 1 := by rcases n.eq_zero_or_pos with (rfl | hn') · simp have hn : 1 < n := one_lt_iff_ne_zero_and_ne_one.mpr ⟨hn'.ne', (h Nat.prime_two 0).symm⟩ rsuffices h | h : eval 1 (cyclotomic n ℤ) = 1 ∨ eval 1 (cyclotomic n ℤ) = -1 · have := eval_intCast_map (Int.castRingHom R) (cyclotomic n ℤ) 1 simpa only [map_cyclotomic, Int.cast_one, h, eq_intCast] using this · exfalso linarith [cyclotomic_nonneg n (le_refl (1 : ℤ))] rw [← Int.natAbs_eq_natAbs_iff, Int.natAbs_one, Nat.eq_one_iff_not_exists_prime_dvd] intro p hp hpe haveI := Fact.mk hp have := prod_cyclotomic_eq_geom_sum hn' ℤ apply_fun eval 1 at this rw [eval_geom_sum, one_geom_sum, eval_prod, eq_comm, ← Finset.prod_sdiff <| @range_pow_padicValNat_subset_divisors' p _ _, Finset.prod_image] at this · simp_rw [eval_one_cyclotomic_prime_pow, Finset.prod_const, Finset.card_range, mul_comm] at this rw [← Finset.prod_sdiff <| show {n} ⊆ _ from _] at this swap · simp only [singleton_subset_iff, mem_sdiff, mem_erase, Ne, mem_divisors, dvd_refl, true_and, mem_image, mem_range, not_exists, not_and] exact ⟨⟨hn.ne', hn'.ne'⟩, fun t _ => h hp _⟩ rw [← Int.natAbs_natCast p, Int.natAbs_dvd_natAbs] at hpe obtain ⟨t, ht⟩ := hpe rw [Finset.prod_singleton, ht, mul_left_comm, mul_comm, ← mul_assoc, mul_assoc] at this have : (p : ℤ) ^ padicValNat p n * p ∣ n := ⟨_, this⟩ simp only [← _root_.pow_succ, ← Int.natAbs_dvd_natAbs, Int.natAbs_natCast, Int.natAbs_pow] at this exact pow_succ_padicValNat_not_dvd hn'.ne' this · rintro x - y - hxy apply Nat.succ_injective exact Nat.pow_right_injective hp.two_le hxy
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
eval_one_cyclotomic_not_prime_pow
null
sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤ n) (hq' : 1 < q) : (q - 1) ^ totient n < (cyclotomic n ℝ).eval q := by have hn : 0 < n := pos_of_gt hn' have hq := zero_lt_one.trans hq' have hfor : ∀ ζ' ∈ primitiveRoots n ℂ, q - 1 ≤ ‖↑q - ζ'‖ := by intro ζ' hζ' rw [mem_primitiveRoots hn] at hζ' convert norm_sub_norm_le (↑q) ζ' · rw [Complex.norm_real, Real.norm_of_nonneg hq.le] · rw [hζ'.norm'_eq_one hn.ne'] let ζ := Complex.exp (2 * ↑Real.pi * Complex.I / ↑n) have hζ : IsPrimitiveRoot ζ n := Complex.isPrimitiveRoot_exp n hn.ne' have hex : ∃ ζ' ∈ primitiveRoots n ℂ, q - 1 < ‖↑q - ζ'‖ := by refine ⟨ζ, (mem_primitiveRoots hn).mpr hζ, ?_⟩ suffices ¬SameRay ℝ (q : ℂ) ζ by convert lt_norm_sub_of_not_sameRay this <;> simp only [hζ.norm'_eq_one hn.ne', Real.norm_of_nonneg hq.le, Complex.norm_real] rw [Complex.sameRay_iff] push_neg refine ⟨mod_cast hq.ne', hζ.ne_zero hn.ne', ?_⟩ rw [Complex.arg_ofReal_of_nonneg hq.le, Ne, eq_comm, hζ.arg_eq_zero_iff hn.ne'] clear_value ζ rintro rfl linarith [hζ.unique IsPrimitiveRoot.one] have : ¬eval (↑q) (cyclotomic n ℂ) = 0 := by simpa using (cyclotomic_pos' n hq').ne' suffices Units.mk0 (Real.toNNReal (q - 1)) (by simp [hq']) ^ totient n < Units.mk0 ‖(cyclotomic n ℂ).eval ↑q‖₊ (by simp_all) by simp [← Units.val_lt_val, Units.val_pow_eq_pow_val, Units.val_mk0, ← NNReal.coe_lt_coe, hq'.le, coe_nnnorm, NNReal.coe_pow, Real.coe_toNNReal', sub_nonneg] at this convert this rw [eq_comm] simp [cyclotomic_nonneg n hq'.le] simp only [cyclotomic_eq_prod_X_sub_primitiveRoots hζ, eval_prod, eval_C, eval_X, eval_sub, nnnorm_prod, Units.mk0_prod] convert Finset.prod_lt_prod' (M := NNRealˣ) _ _ swap; · exact fun _ => Units.mk0 (Real.toNNReal (q - 1)) (by simp [hq']) · simp only [Complex.card_primitiveRoots, prod_const, card_attach] · simp only [Finset.mem_attach, forall_true_left, Subtype.forall, ← Units.val_le_val, ← NNReal.coe_le_coe, norm_nonneg, Units.val_mk0, Real.coe_toNNReal', coe_nnnorm, max_le_iff, tsub_le_iff_right] intro x hx simpa only [and_true, tsub_le_iff_right] using hfor x hx · simp only [Finset.mem_attach, Subtype.exists, ← NNReal.coe_lt_coe, ← Units.val_lt_val, Units.val_mk0 _, coe_nnnorm] simpa [hq'.le, Real.coe_toNNReal', max_eq_left, sub_nonneg] using hex
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
sub_one_pow_totient_lt_cyclotomic_eval
null
sub_one_pow_totient_le_cyclotomic_eval {q : ℝ} (hq' : 1 < q) : ∀ n, (q - 1) ^ totient n ≤ (cyclotomic n ℝ).eval q | 0 => by simp only [totient_zero, _root_.pow_zero, cyclotomic_zero, eval_one, le_refl] | 1 => by simp only [totient_one, pow_one, cyclotomic_one, eval_sub, eval_X, eval_one, le_refl] | _ + 2 => (sub_one_pow_totient_lt_cyclotomic_eval le_add_self hq').le
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
sub_one_pow_totient_le_cyclotomic_eval
null
cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤ n) (hq' : 1 < q) : (cyclotomic n ℝ).eval q < (q + 1) ^ totient n := by have hn : 0 < n := pos_of_gt hn' have hq := zero_lt_one.trans hq' have hfor : ∀ ζ' ∈ primitiveRoots n ℂ, ‖↑q - ζ'‖ ≤ q + 1 := by intro ζ' hζ' rw [mem_primitiveRoots hn] at hζ' convert norm_sub_le (↑q) ζ' · rw [Complex.norm_real, Real.norm_of_nonneg (zero_le_one.trans_lt hq').le] · rw [hζ'.norm'_eq_one hn.ne'] let ζ := Complex.exp (2 * ↑Real.pi * Complex.I / ↑n) have hζ : IsPrimitiveRoot ζ n := Complex.isPrimitiveRoot_exp n hn.ne' have hex : ∃ ζ' ∈ primitiveRoots n ℂ, ‖↑q - ζ'‖ < q + 1 := by refine ⟨ζ, (mem_primitiveRoots hn).mpr hζ, ?_⟩ suffices ¬SameRay ℝ (q : ℂ) (-ζ) by convert norm_add_lt_of_not_sameRay this using 2 · rw [Complex.norm_real] symm exact abs_eq_self.mpr hq.le · simp [hζ.norm'_eq_one hn.ne'] rw [Complex.sameRay_iff] push_neg refine ⟨mod_cast hq.ne', neg_ne_zero.mpr <| hζ.ne_zero hn.ne', ?_⟩ rw [Complex.arg_ofReal_of_nonneg hq.le, Ne, eq_comm] intro h rw [Complex.arg_eq_zero_iff, Complex.neg_re, neg_nonneg, Complex.neg_im, neg_eq_zero] at h have hζ₀ : ζ ≠ 0 := by clear_value ζ rintro rfl exact hn.ne' (hζ.unique IsPrimitiveRoot.zero) have : ζ.re < 0 ∧ ζ.im = 0 := ⟨h.1.lt_of_ne ?_, h.2⟩ · rw [← Complex.arg_eq_pi_iff, hζ.arg_eq_pi_iff hn.ne'] at this rw [this] at hζ linarith [hζ.unique <| IsPrimitiveRoot.neg_one 0 two_ne_zero.symm] · contrapose! hζ₀ apply Complex.ext <;> simp [hζ₀, h.2] have : ¬eval (↑q) (cyclotomic n ℂ) = 0 := by simpa using (cyclotomic_pos' n hq').ne.symm suffices Units.mk0 ‖(cyclotomic n ℂ).eval ↑q‖₊ (by simp_all) < Units.mk0 (Real.toNNReal (q + 1)) (by simp; linarith) ^ totient n by simp only [← Units.val_lt_val, Units.val_pow_eq_pow_val, Units.val_mk0, ← NNReal.coe_lt_coe, coe_nnnorm, NNReal.coe_pow, Real.coe_toNNReal'] at this convert this using 2 · rw [eq_comm] simp [cyclotomic_nonneg n hq'.le] rw [eq_comm, max_eq_left_iff] linarith simp only [cyclotomic_eq_prod_X_sub_primitiveRoots hζ, eval_prod, eval_C, eval_X, eval_sub, nnnorm_prod, Units.mk0_prod] convert Finset.prod_lt_prod' (M := NNRealˣ) _ _ swap; · exact fun _ => Units.mk0 (Real.toNNReal (q + 1)) (by simp; linarith only [hq']) ...
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
cyclotomic_eval_lt_add_one_pow_totient
null
cyclotomic_eval_le_add_one_pow_totient {q : ℝ} (hq' : 1 < q) : ∀ n, (cyclotomic n ℝ).eval q ≤ (q + 1) ^ totient n | 0 => by simp | 1 => by simp [add_assoc, zero_le_one] | 2 => by simp | _ + 3 => (cyclotomic_eval_lt_add_one_pow_totient le_add_self hq').le
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
cyclotomic_eval_le_add_one_pow_totient
null
sub_one_pow_totient_lt_natAbs_cyclotomic_eval {n : ℕ} {q : ℕ} (hn' : 1 < n) (hq : q ≠ 1) : (q - 1) ^ totient n < ((cyclotomic n ℤ).eval ↑q).natAbs := by rcases hq.lt_or_gt.imp_left Nat.lt_one_iff.mp with (rfl | hq') · rw [zero_tsub, zero_pow (Nat.totient_pos.2 (pos_of_gt hn')).ne', pos_iff_ne_zero, Int.natAbs_ne_zero, Nat.cast_zero, ← coeff_zero_eq_eval_zero, cyclotomic_coeff_zero _ hn'] exact one_ne_zero rw [← @Nat.cast_lt ℝ, Nat.cast_pow, Nat.cast_sub hq'.le, Nat.cast_one, Int.cast_natAbs] refine (sub_one_pow_totient_lt_cyclotomic_eval hn' (Nat.one_lt_cast.2 hq')).trans_le ?_ convert (cyclotomic.eval_apply (q : ℤ) n (algebraMap ℤ ℝ)).trans_le (le_abs_self _) simp
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
sub_one_pow_totient_lt_natAbs_cyclotomic_eval
null
sub_one_lt_natAbs_cyclotomic_eval {n : ℕ} {q : ℕ} (hn' : 1 < n) (hq : q ≠ 1) : q - 1 < ((cyclotomic n ℤ).eval ↑q).natAbs := calc q - 1 ≤ (q - 1) ^ totient n := Nat.le_self_pow (Nat.totient_pos.2 <| pos_of_gt hn').ne' _ _ < ((cyclotomic n ℤ).eval ↑q).natAbs := sub_one_pow_totient_lt_natAbs_cyclotomic_eval hn' hq
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots", "Mathlib.Tactic.ByContra", "Mathlib.Topology.Algebra.Polynomial", "Mathlib.NumberTheory.Padics.PadicVal.Basic", "Mathlib.Analysis.Complex.Arg" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
sub_one_lt_natAbs_cyclotomic_eval
null
@[simp] cyclotomic_expand_eq_cyclotomic_mul {p n : ℕ} (hp : Nat.Prime p) (hdiv : ¬p ∣ n) (R : Type*) [CommRing R] : expand R p (cyclotomic n R) = cyclotomic (n * p) R * cyclotomic n R := by rcases Nat.eq_zero_or_pos n with (rfl | hnpos) · simp haveI := NeZero.of_pos hnpos suffices expand ℤ p (cyclotomic n ℤ) = cyclotomic (n * p) ℤ * cyclotomic n ℤ by rw [← map_cyclotomic_int, ← map_expand, this, Polynomial.map_mul, map_cyclotomic_int, map_cyclotomic] refine eq_of_monic_of_dvd_of_natDegree_le ((cyclotomic.monic _ ℤ).mul (cyclotomic.monic _ ℤ)) ((cyclotomic.monic n ℤ).expand hp.pos) ?_ ?_ · refine (IsPrimitive.Int.dvd_iff_map_cast_dvd_map_cast _ _ (IsPrimitive.mul (cyclotomic.isPrimitive (n * p) ℤ) (cyclotomic.isPrimitive n ℤ)) ((cyclotomic.monic n ℤ).expand hp.pos).isPrimitive).2 ?_ rw [Polynomial.map_mul, map_cyclotomic_int, map_cyclotomic_int, map_expand, map_cyclotomic_int] refine IsCoprime.mul_dvd (cyclotomic.isCoprime_rat fun h => ?_) ?_ ?_ · replace h : n * p = n * 1 := by simp [h] exact Nat.Prime.ne_one hp (mul_left_cancel₀ hnpos.ne' h) · have hpos : 0 < n * p := mul_pos hnpos hp.pos have hprim := Complex.isPrimitiveRoot_exp _ hpos.ne' rw [cyclotomic_eq_minpoly_rat hprim hpos] refine minpoly.dvd ℚ _ ?_ rw [aeval_def, ← eval_map, map_expand, map_cyclotomic, expand_eval, ← IsRoot.def, @isRoot_cyclotomic_iff] convert IsPrimitiveRoot.pow_of_dvd hprim hp.ne_zero (dvd_mul_left p n) rw [Nat.mul_div_cancel _ (Nat.Prime.pos hp)] · have hprim := Complex.isPrimitiveRoot_exp _ hnpos.ne.symm rw [cyclotomic_eq_minpoly_rat hprim hnpos] refine minpoly.dvd ℚ _ ?_ rw [aeval_def, ← eval_map, map_expand, expand_eval, ← IsRoot.def, ← cyclotomic_eq_minpoly_rat hprim hnpos, map_cyclotomic, @isRoot_cyclotomic_iff] exact IsPrimitiveRoot.pow_of_prime hprim hp hdiv · rw [natDegree_expand, natDegree_cyclotomic, natDegree_mul (cyclotomic_ne_zero _ ℤ) (cyclotomic_ne_zero _ ℤ), natDegree_cyclotomic, natDegree_cyclotomic, mul_comm n, Nat.totient_mul ((Nat.Prime.coprime_iff_not_dvd hp).2 hdiv), Nat.totient_prime hp, mul_comm (p - 1), ← Nat.mul_succ, Nat.sub_one, Nat.succ_pred_eq_of_pos hp.pos] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.ZMod", "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
cyclotomic_expand_eq_cyclotomic_mul
If `p` is a prime such that `¬ p ∣ n`, then `expand R p (cyclotomic n R) = (cyclotomic (n * p) R) * (cyclotomic n R)`.
cyclotomic_six (R : Type*) [Ring R] : cyclotomic 6 R = X ^ 2 - X + 1 := by suffices cyclotomic 6 ℤ = X ^ 2 - X + 1 by rw [← map_cyclotomic_int, this] simp apply mul_right_cancel₀ (cyclotomic_ne_zero 2 ℤ) rw [show 6 = 2 * 3 by rfl, ← cyclotomic_expand_eq_cyclotomic_mul Nat.prime_three (by norm_num1)] simp; ring
lemma
RingTheory
[ "Mathlib.Algebra.Algebra.ZMod", "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
cyclotomic_six
null
@[simp] cyclotomic_expand_eq_cyclotomic {p n : ℕ} (hp : Nat.Prime p) (hdiv : p ∣ n) (R : Type*) [CommRing R] : expand R p (cyclotomic n R) = cyclotomic (n * p) R := by rcases n.eq_zero_or_pos with (rfl | hzero) · simp haveI := NeZero.of_pos hzero suffices expand ℤ p (cyclotomic n ℤ) = cyclotomic (n * p) ℤ by rw [← map_cyclotomic_int, ← map_expand, this, map_cyclotomic_int] refine eq_of_monic_of_dvd_of_natDegree_le (cyclotomic.monic _ ℤ) ((cyclotomic.monic n ℤ).expand hp.pos) ?_ ?_ · have hpos := Nat.mul_pos hzero hp.pos have hprim := Complex.isPrimitiveRoot_exp _ hpos.ne.symm rw [cyclotomic_eq_minpoly hprim hpos] refine minpoly.isIntegrallyClosed_dvd (hprim.isIntegral hpos) ?_ rw [aeval_def, ← eval_map, map_expand, map_cyclotomic, expand_eval, ← IsRoot.def, @isRoot_cyclotomic_iff] convert IsPrimitiveRoot.pow_of_dvd hprim hp.ne_zero (dvd_mul_left p n) rw [Nat.mul_div_cancel _ hp.pos] · rw [natDegree_expand, natDegree_cyclotomic, natDegree_cyclotomic, mul_comm n, Nat.totient_mul_of_prime_of_dvd hp hdiv, mul_comm]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.ZMod", "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
cyclotomic_expand_eq_cyclotomic
If `p` is a prime such that `p ∣ n`, then `expand R p (cyclotomic n R) = cyclotomic (p * n) R`.
cyclotomic_irreducible_pow_of_irreducible_pow {p : ℕ} (hp : Nat.Prime p) {R} [CommRing R] [IsDomain R] {n m : ℕ} (hmn : m ≤ n) (h : Irreducible (cyclotomic (p ^ n) R)) : Irreducible (cyclotomic (p ^ m) R) := by rcases m.eq_zero_or_pos with (rfl | hm) · simpa using irreducible_X_sub_C (1 : R) obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le hmn induction k with | zero => simpa using h | succ k hk => have : m + k ≠ 0 := (add_pos_of_pos_of_nonneg hm k.zero_le).ne' rw [Nat.add_succ, pow_succ, ← cyclotomic_expand_eq_cyclotomic hp <| dvd_pow_self p this] at h exact hk (by cutsat) (of_irreducible_expand hp.ne_zero h)
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.ZMod", "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
cyclotomic_irreducible_pow_of_irreducible_pow
If the `p ^ n`th cyclotomic polynomial is irreducible, so is the `p ^ m`th, for `m ≤ n`.
cyclotomic_irreducible_of_irreducible_pow {p : ℕ} (hp : Nat.Prime p) {R} [CommRing R] [IsDomain R] {n : ℕ} (hn : n ≠ 0) (h : Irreducible (cyclotomic (p ^ n) R)) : Irreducible (cyclotomic p R) := pow_one p ▸ cyclotomic_irreducible_pow_of_irreducible_pow hp hn.bot_lt h
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.ZMod", "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
cyclotomic_irreducible_of_irreducible_pow
If `Irreducible (cyclotomic (p ^ n) R)` then `Irreducible (cyclotomic p R).`
cyclotomic_mul_prime_eq_pow_of_not_dvd (R : Type*) {p n : ℕ} [hp : Fact (Nat.Prime p)] [Ring R] [CharP R p] (hn : ¬p ∣ n) : cyclotomic (n * p) R = cyclotomic n R ^ (p - 1) := by letI : Algebra (ZMod p) R := ZMod.algebra _ _ suffices cyclotomic (n * p) (ZMod p) = cyclotomic n (ZMod p) ^ (p - 1) by rw [← map_cyclotomic _ (algebraMap (ZMod p) R), ← map_cyclotomic _ (algebraMap (ZMod p) R), this, Polynomial.map_pow] apply mul_right_injective₀ (cyclotomic_ne_zero n <| ZMod p); dsimp rw [← pow_succ', tsub_add_cancel_of_le hp.out.one_lt.le, mul_comm, ← ZMod.expand_card] conv_rhs => rw [← map_cyclotomic_int] rw [← map_expand, cyclotomic_expand_eq_cyclotomic_mul hp.out hn, Polynomial.map_mul, map_cyclotomic, map_cyclotomic]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.ZMod", "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
cyclotomic_mul_prime_eq_pow_of_not_dvd
If `R` is of characteristic `p` and `¬p ∣ n`, then `cyclotomic (n * p) R = (cyclotomic n R) ^ (p - 1)`.
cyclotomic_mul_prime_dvd_eq_pow (R : Type*) {p n : ℕ} [hp : Fact (Nat.Prime p)] [Ring R] [CharP R p] (hn : p ∣ n) : cyclotomic (n * p) R = cyclotomic n R ^ p := by letI : Algebra (ZMod p) R := ZMod.algebra _ _ suffices cyclotomic (n * p) (ZMod p) = cyclotomic n (ZMod p) ^ p by rw [← map_cyclotomic _ (algebraMap (ZMod p) R), ← map_cyclotomic _ (algebraMap (ZMod p) R), this, Polynomial.map_pow] rw [← ZMod.expand_card, ← map_cyclotomic_int n, ← map_expand, cyclotomic_expand_eq_cyclotomic hp.out hn, map_cyclotomic]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.ZMod", "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
cyclotomic_mul_prime_dvd_eq_pow
If `R` is of characteristic `p` and `p ∣ n`, then `cyclotomic (n * p) R = (cyclotomic n R) ^ p`.
cyclotomic_mul_prime_pow_eq (R : Type*) {p m : ℕ} [Fact (Nat.Prime p)] [Ring R] [CharP R p] (hm : ¬p ∣ m) : ∀ {k}, 0 < k → cyclotomic (p ^ k * m) R = cyclotomic m R ^ (p ^ k - p ^ (k - 1)) | 1, _ => by rw [pow_one, Nat.sub_self, pow_zero, mul_comm, cyclotomic_mul_prime_eq_pow_of_not_dvd R hm] | a + 2, _ => by have hdiv : p ∣ p ^ a.succ * m := ⟨p ^ a * m, by rw [← mul_assoc, pow_succ']⟩ rw [pow_succ', mul_assoc, mul_comm, cyclotomic_mul_prime_dvd_eq_pow R hdiv, cyclotomic_mul_prime_pow_eq _ _ a.succ_pos, ← pow_mul] · simp only [tsub_zero, Nat.succ_sub_succ_eq_sub] rw [Nat.mul_sub_right_distrib, mul_comm, pow_succ] · assumption
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.ZMod", "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
cyclotomic_mul_prime_pow_eq
If `R` is of characteristic `p` and `¬p ∣ m`, then `cyclotomic (p ^ k * m) R = (cyclotomic m R) ^ (p ^ k - p ^ (k - 1))`.
isRoot_cyclotomic_prime_pow_mul_iff_of_charP {m k p : ℕ} {R : Type*} [CommRing R] [IsDomain R] [hp : Fact (Nat.Prime p)] [hchar : CharP R p] {μ : R} [NeZero (m : R)] : (Polynomial.cyclotomic (p ^ k * m) R).IsRoot μ ↔ IsPrimitiveRoot μ m := by rcases k.eq_zero_or_pos with (rfl | hk) · rw [pow_zero, one_mul, isRoot_cyclotomic_iff] refine ⟨fun h => ?_, fun h => ?_⟩ · rw [IsRoot.def, cyclotomic_mul_prime_pow_eq R (NeZero.not_char_dvd R p m) hk, eval_pow] at h replace h := pow_eq_zero h rwa [← IsRoot.def, isRoot_cyclotomic_iff] at h · rw [← isRoot_cyclotomic_iff, IsRoot.def] at h rw [cyclotomic_mul_prime_pow_eq R (NeZero.not_char_dvd R p m) hk, IsRoot.def, eval_pow, h, zero_pow] exact Nat.sub_ne_zero_of_lt <| pow_right_strictMono₀ hp.out.one_lt <| Nat.pred_lt hk.ne'
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.ZMod", "Mathlib.RingTheory.Polynomial.Cyclotomic.Roots" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Expand.lean
isRoot_cyclotomic_prime_pow_mul_iff_of_charP
If `R` is of characteristic `p` and `¬p ∣ m`, then `ζ` is a root of `cyclotomic (p ^ k * m) R` if and only if it is a primitive `m`-th root of unity.
isRoot_of_unity_of_root_cyclotomic {ζ : R} {i : ℕ} (hi : i ∈ n.divisors) (h : (cyclotomic i R).IsRoot ζ) : ζ ^ n = 1 := by rcases n.eq_zero_or_pos with (rfl | hn) · exact pow_zero _ have := congr_arg (eval ζ) (prod_cyclotomic_eq_X_pow_sub_one hn R).symm rw [eval_sub, eval_pow, eval_X, eval_one] at this convert eq_add_of_sub_eq' this convert (add_zero (M := R) _).symm apply eval_eq_zero_of_dvd_of_eval_eq_zero _ h exact Finset.dvd_prod_of_mem _ hi
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
isRoot_of_unity_of_root_cyclotomic
null
_root_.isRoot_of_unity_iff (h : 0 < n) (R : Type*) [CommRing R] [IsDomain R] {ζ : R} : ζ ^ n = 1 ↔ ∃ i ∈ n.divisors, (cyclotomic i R).IsRoot ζ := by rw [← mem_nthRoots h, nthRoots, mem_roots <| X_pow_sub_C_ne_zero h _, C_1, ← prod_cyclotomic_eq_X_pow_sub_one h, isRoot_prod]
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
_root_.isRoot_of_unity_iff
null
_root_.IsPrimitiveRoot.isRoot_cyclotomic (hpos : 0 < n) {μ : R} (h : IsPrimitiveRoot μ n) : IsRoot (cyclotomic n R) μ := by rw [← mem_roots (cyclotomic_ne_zero n R), cyclotomic_eq_prod_X_sub_primitiveRoots h, roots_prod_X_sub_C, ← Finset.mem_def] rwa [← mem_primitiveRoots hpos] at h
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
_root_.IsPrimitiveRoot.isRoot_cyclotomic
Any `n`-th primitive root of unity is a root of `cyclotomic n R`.
private isRoot_cyclotomic_iff' {n : ℕ} {K : Type*} [Field K] {μ : K} [NeZero (n : K)] : IsRoot (cyclotomic n K) μ ↔ IsPrimitiveRoot μ n := by have hnpos : 0 < n := (NeZero.of_neZero_natCast K).out.bot_lt refine ⟨fun hμ => ?_, IsPrimitiveRoot.isRoot_cyclotomic hnpos⟩ have hμn : μ ^ n = 1 := by rw [isRoot_of_unity_iff hnpos _] exact ⟨n, n.mem_divisors_self hnpos.ne', hμ⟩ by_contra hnμ have ho : 0 < orderOf μ := (isOfFinOrder_iff_pow_eq_one.2 <| ⟨n, hnpos, hμn⟩).orderOf_pos have := pow_orderOf_eq_one μ rw [isRoot_of_unity_iff ho] at this obtain ⟨i, hio, hiμ⟩ := this replace hio := Nat.dvd_of_mem_divisors hio rw [IsPrimitiveRoot.not_iff] at hnμ rw [← orderOf_dvd_iff_pow_eq_one] at hμn have key : i < n := (Nat.le_of_dvd ho hio).trans_lt ((Nat.le_of_dvd hnpos hμn).lt_of_ne hnμ) have key' : i ∣ n := hio.trans hμn rw [← Polynomial.dvd_iff_isRoot] at hμ hiμ have hni : {i, n} ⊆ n.divisors := by simpa [Finset.insert_subset_iff, key'] using hnpos.ne' obtain ⟨k, hk⟩ := hiμ obtain ⟨j, hj⟩ := hμ have := prod_cyclotomic_eq_X_pow_sub_one hnpos K rw [← Finset.prod_sdiff hni, Finset.prod_pair key.ne, hk, hj] at this have hn := (X_pow_sub_one_separable_iff.mpr <| NeZero.natCast_ne n K).squarefree rw [← this, Squarefree] at hn specialize hn (X - C μ) ⟨(∏ x ∈ n.divisors \ {i, n}, cyclotomic x K) * k * j, by ring⟩ simp [Polynomial.isUnit_iff_degree_eq_zero] at hn
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
isRoot_cyclotomic_iff'
null
isRoot_cyclotomic_iff [NeZero (n : R)] {μ : R} : IsRoot (cyclotomic n R) μ ↔ IsPrimitiveRoot μ n := by have hf : Function.Injective _ := IsFractionRing.injective R (FractionRing R) haveI : NeZero (n : FractionRing R) := NeZero.nat_of_injective hf rw [← isRoot_map_iff hf, ← IsPrimitiveRoot.map_iff_of_injective hf, map_cyclotomic, ← isRoot_cyclotomic_iff']
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
isRoot_cyclotomic_iff
null
roots_cyclotomic_nodup [NeZero (n : R)] : (cyclotomic n R).roots.Nodup := by obtain h | ⟨ζ, hζ⟩ := (cyclotomic n R).roots.empty_or_exists_mem · exact h.symm ▸ Multiset.nodup_zero rw [mem_roots <| cyclotomic_ne_zero n R, isRoot_cyclotomic_iff] at hζ refine Multiset.nodup_of_le (roots.le_of_dvd (X_pow_sub_C_ne_zero (NeZero.pos_of_neZero_natCast R) 1) <| cyclotomic.dvd_X_pow_sub_one n R) hζ.nthRoots_one_nodup
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
roots_cyclotomic_nodup
null
cyclotomic.roots_to_finset_eq_primitiveRoots [NeZero (n : R)] : (⟨(cyclotomic n R).roots, roots_cyclotomic_nodup⟩ : Finset _) = primitiveRoots n R := by ext a simp [cyclotomic_ne_zero n R, ← isRoot_cyclotomic_iff, mem_primitiveRoots, NeZero.pos_of_neZero_natCast R]
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
cyclotomic.roots_to_finset_eq_primitiveRoots
null