ring_theory.polynomial.cyclotomic.eval
⟷
Mathlib.RingTheory.Polynomial.Cyclotomic.Eval
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -200,7 +200,7 @@ theorem eval_one_cyclotomic_not_prime_pow {R : Type _} [Ring R] {n : ℕ}
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 [← pow_succ', ← Int.natAbs_dvd_natAbs, Int.natAbs_ofNat, Int.natAbs_pow] at this
+ simp only [← pow_succ, ← Int.natAbs_dvd_natAbs, Int.natAbs_ofNat, Int.natAbs_pow] at this
exact pow_succ_padicValNat_not_dvd hn'.ne' this
· rintro x - y - hxy
apply Nat.succ_injective
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -70,16 +70,16 @@ private theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrdered
Int.cast_pos]
suffices 0 < eval (↑(-1 : ℤ)) (cyclotomic n ℝ)
by
- rw [← map_cyclotomic_int n ℝ, eval_int_cast_map, Int.coe_castRingHom] at this
+ rw [← map_cyclotomic_int n ℝ, eval_int_cast_map, Int.coe_castRingHom] at this
exact_mod_cast this
simp only [Int.cast_one, Int.cast_neg]
have h0 := cyclotomic_coeff_zero ℝ hn.le
- rw [coeff_zero_eq_eval_zero] at h0
+ rw [coeff_zero_eq_eval_zero] at h0
by_contra! hx
have := intermediate_value_univ (-1) 0 (cyclotomic n ℝ).Continuous
obtain ⟨y, hy : is_root _ y⟩ := this (show (0 : ℝ) ∈ Set.Icc _ _ by simpa [h0] using hx)
- rw [is_root_cyclotomic_iff] at hy
- rw [hy.eq_order_of] at hn
+ rw [is_root_cyclotomic_iff] at hy
+ rw [hy.eq_order_of] at hn
exact hn.not_le LinearOrderedRing.orderOf_le_two
#print Polynomial.cyclotomic_pos /-
@@ -89,18 +89,18 @@ theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x :
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
- dsimp at ih
+ dsimp at ih
have := prod_cyclotomic_eq_geom_sum hn' R
- apply_fun eval x at this
+ apply_fun eval x at this
rw [← cons_self_proper_divisors hn'.ne', Finset.erase_cons_of_ne _ hn''.ne', Finset.prod_cons,
- eval_mul, eval_geom_sum] at this
+ eval_mul, eval_geom_sum] at this
rcases lt_trichotomy 0 (∑ i in 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_proper_divisors] at hi
- rw [geom_sum_pos_iff hn'.ne'] at h
+ simp only [Finset.mem_erase, mem_proper_divisors] at hi
+ rw [geom_sum_pos_iff hn'.ne'] at h
cases' 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)
@@ -110,11 +110,11 @@ theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x :
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
+ · 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
+ rw [geom_sum_neg_iff hn'.ne'] at h
have h2 : 2 ∈ n.proper_divisors.erase 1 :=
by
rw [Finset.mem_erase, mem_proper_divisors]
@@ -122,10 +122,10 @@ theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x :
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_proper_divisors] at hi
+ simp only [Finset.mem_erase, mem_proper_divisors] 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
+ 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
#align polynomial.cyclotomic_pos Polynomial.cyclotomic_pos
@@ -186,21 +186,21 @@ theorem eval_one_cyclotomic_not_prime_pow {R : Type _} [Ring R] {n : ℕ}
apply Finset.dvd_prod_of_mem
simp [hn'.ne', hn.ne']
have := prod_cyclotomic_eq_geom_sum hn' ℤ
- apply_fun eval 1 at this
+ 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
+ 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
any_goals infer_instance
swap
· simp only [singleton_subset_iff, mem_sdiff, mem_erase, Ne.def, mem_divisors, dvd_refl,
true_and_iff, mem_image, mem_range, exists_prop, not_exists, not_and]
exact ⟨⟨hn.ne', hn'.ne'⟩, fun t _ => h hp _⟩
- rw [← Int.natAbs_ofNat p, Int.natAbs_dvd_natAbs] at hpe
+ rw [← Int.natAbs_ofNat 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
+ 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 [← pow_succ', ← Int.natAbs_dvd_natAbs, Int.natAbs_ofNat, Int.natAbs_pow] at this
+ simp only [← pow_succ', ← Int.natAbs_dvd_natAbs, Int.natAbs_ofNat, Int.natAbs_pow] at this
exact pow_succ_padicValNat_not_dvd hn'.ne' this
· rintro x - y - hxy
apply Nat.succ_injective
@@ -217,7 +217,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
have hfor : ∀ ζ' ∈ primitiveRoots n ℂ, q - 1 ≤ ‖↑q - ζ'‖ :=
by
intro ζ' hζ'
- rw [mem_primitiveRoots hn] at 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']
@@ -246,7 +246,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
by
simp only [← Units.val_lt_val, Units.val_pow_eq_pow_val, Units.val_mk0, ← NNReal.coe_lt_coe,
hq'.le, Real.toNNReal_lt_toNNReal_iff_of_nonneg, coe_nnnorm, Complex.norm_eq_abs,
- NNReal.coe_pow, Real.coe_toNNReal', max_eq_left, sub_nonneg] at this
+ NNReal.coe_pow, Real.coe_toNNReal', max_eq_left, sub_nonneg] at this
convert this
erw [cyclotomic.eval_apply q n (algebraMap ℝ ℂ), eq_comm]
simp only [cyclotomic_nonneg n hq'.le, Complex.coe_algebraMap, Complex.abs_ofReal, abs_eq_self]
@@ -284,7 +284,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
have hfor : ∀ ζ' ∈ primitiveRoots n ℂ, ‖↑q - ζ'‖ ≤ q + 1 :=
by
intro ζ' hζ'
- rw [mem_primitiveRoots hn] at 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']
@@ -301,14 +301,14 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
refine' ⟨by exact_mod_cast hq.ne', neg_ne_zero.mpr <| hζ.ne_zero hn.ne', _⟩
rw [Complex.arg_ofReal_of_nonneg hq.le, Ne.def, eq_comm]
intro h
- rw [Complex.arg_eq_zero_iff, Complex.neg_re, neg_nonneg, Complex.neg_im, neg_eq_zero] at 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ζ
+ 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ζ₀
ext <;> simp [hζ₀, h.2]
@@ -323,7 +323,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
by
simp only [← Units.val_lt_val, Units.val_pow_eq_pow_val, Units.val_mk0, ← NNReal.coe_lt_coe,
hq'.le, Real.toNNReal_lt_toNNReal_iff_of_nonneg, coe_nnnorm, Complex.norm_eq_abs,
- NNReal.coe_pow, Real.coe_toNNReal', max_eq_left, sub_nonneg] at this
+ NNReal.coe_pow, Real.coe_toNNReal', max_eq_left, sub_nonneg] at this
convert this
· erw [cyclotomic.eval_apply q n (algebraMap ℝ ℂ), eq_comm]
simp [cyclotomic_nonneg n hq'.le]
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -75,7 +75,7 @@ private theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrdered
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
+ by_contra! hx
have := intermediate_value_univ (-1) 0 (cyclotomic n ℝ).Continuous
obtain ⟨y, hy : is_root _ y⟩ := this (show (0 : ℝ) ∈ Set.Icc _ _ by simpa [h0] using hx)
rw [is_root_cyclotomic_iff] at hy
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,11 +3,11 @@ Copyright (c) 2021 Eric Rodriguez. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Rodriguez
-/
-import Mathbin.RingTheory.Polynomial.Cyclotomic.Roots
-import Mathbin.Tactic.ByContra
-import Mathbin.Topology.Algebra.Polynomial
-import Mathbin.NumberTheory.Padics.PadicVal
-import Mathbin.Analysis.Complex.Arg
+import RingTheory.Polynomial.Cyclotomic.Roots
+import Tactic.ByContra
+import Topology.Algebra.Polynomial
+import NumberTheory.Padics.PadicVal
+import Analysis.Complex.Arg
#align_import ring_theory.polynomial.cyclotomic.eval from "leanprover-community/mathlib"@"2a0ce625dbb0ffbc7d1316597de0b25c1ec75303"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2021 Eric Rodriguez. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Rodriguez
-
-! This file was ported from Lean 3 source module ring_theory.polynomial.cyclotomic.eval
-! leanprover-community/mathlib commit 2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.RingTheory.Polynomial.Cyclotomic.Roots
import Mathbin.Tactic.ByContra
@@ -14,6 +9,8 @@ import Mathbin.Topology.Algebra.Polynomial
import Mathbin.NumberTheory.Padics.PadicVal
import Mathbin.Analysis.Complex.Arg
+#align_import ring_theory.polynomial.cyclotomic.eval from "leanprover-community/mathlib"@"2a0ce625dbb0ffbc7d1316597de0b25c1ec75303"
+
/-!
# Evaluating cyclotomic polynomials
mathlib commit https://github.com/leanprover-community/mathlib/commit/2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
@@ -33,29 +33,37 @@ open Finset Nat
open scoped BigOperators
+#print Polynomial.eval_one_cyclotomic_prime /-
@[simp]
theorem 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_coe]
#align polynomial.eval_one_cyclotomic_prime Polynomial.eval_one_cyclotomic_prime
+-/
+#print Polynomial.eval₂_one_cyclotomic_prime /-
@[simp]
theorem 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
#align polynomial.eval₂_one_cyclotomic_prime Polynomial.eval₂_one_cyclotomic_prime
+-/
+#print Polynomial.eval_one_cyclotomic_prime_pow /-
@[simp]
theorem 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_coe]
#align polynomial.eval_one_cyclotomic_prime_pow Polynomial.eval_one_cyclotomic_prime_pow
+-/
+#print Polynomial.eval₂_one_cyclotomic_prime_pow /-
@[simp]
theorem 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
#align polynomial.eval₂_one_cyclotomic_prime_pow Polynomial.eval₂_one_cyclotomic_prime_pow
+-/
private theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] :
0 < eval (-1 : R) (cyclotomic n R) :=
@@ -77,6 +85,7 @@ private theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrdered
rw [hy.eq_order_of] at hn
exact hn.not_le LinearOrderedRing.orderOf_le_two
+#print Polynomial.cyclotomic_pos /-
theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x : R) :
0 < eval x (cyclotomic n R) :=
by
@@ -123,7 +132,9 @@ theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x :
exact hn'.ne' hi.2.2.1
· simpa only [eval_X, eval_one, cyclotomic_two, eval_add] using h.right.le
#align polynomial.cyclotomic_pos Polynomial.cyclotomic_pos
+-/
+#print Polynomial.cyclotomic_pos_and_nonneg /-
theorem cyclotomic_pos_and_nonneg (n : ℕ) {R} [LinearOrderedCommRing R] (x : R) :
(1 < x → 0 < eval x (cyclotomic n R)) ∧ (1 ≤ x → 0 ≤ eval x (cyclotomic n R)) :=
by
@@ -135,7 +146,9 @@ theorem cyclotomic_pos_and_nonneg (n : ℕ) {R} [LinearOrderedCommRing R] (x : R
· have : 2 < n + 3 := by decide
constructor <;> intro <;> [skip; apply le_of_lt] <;> apply cyclotomic_pos this
#align polynomial.cyclotomic_pos_and_nonneg Polynomial.cyclotomic_pos_and_nonneg
+-/
+#print Polynomial.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. -/
@@ -143,13 +156,17 @@ theorem cyclotomic_pos' (n : ℕ) {R} [LinearOrderedCommRing R] {x : R} (hx : 1
0 < eval x (cyclotomic n R) :=
(cyclotomic_pos_and_nonneg n x).1 hx
#align polynomial.cyclotomic_pos' Polynomial.cyclotomic_pos'
+-/
+#print Polynomial.cyclotomic_nonneg /-
/-- Cyclotomic polynomials are always nonnegative on inputs one or more. -/
theorem cyclotomic_nonneg (n : ℕ) {R} [LinearOrderedCommRing R] {x : R} (hx : 1 ≤ x) :
0 ≤ eval x (cyclotomic n R) :=
(cyclotomic_pos_and_nonneg n x).2 hx
#align polynomial.cyclotomic_nonneg Polynomial.cyclotomic_nonneg
+-/
+#print Polynomial.eval_one_cyclotomic_not_prime_pow /-
theorem 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
@@ -192,7 +209,9 @@ theorem eval_one_cyclotomic_not_prime_pow {R : Type _} [Ring R] {n : ℕ}
apply Nat.succ_injective
exact Nat.pow_right_injective hp.two_le hxy
#align polynomial.eval_one_cyclotomic_not_prime_pow Polynomial.eval_one_cyclotomic_not_prime_pow
+-/
+#print Polynomial.sub_one_pow_totient_lt_cyclotomic_eval /-
theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤ n) (hq' : 1 < q) :
(q - 1) ^ totient n < (cyclotomic n ℝ).eval q :=
by
@@ -248,14 +267,18 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
NNReal.coe_lt_coe, ← Units.val_lt_val, Units.val_mk0 _, coe_nnnorm]
simpa only [hq'.le, Real.coe_toNNReal', max_eq_left, sub_nonneg] using hex
#align polynomial.sub_one_pow_totient_lt_cyclotomic_eval Polynomial.sub_one_pow_totient_lt_cyclotomic_eval
+-/
+#print Polynomial.sub_one_pow_totient_le_cyclotomic_eval /-
theorem 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, pow_zero, cyclotomic_zero, eval_one]
| 1 => by simp only [totient_one, pow_one, cyclotomic_one, eval_sub, eval_X, eval_one]
| n + 2 => (sub_one_pow_totient_lt_cyclotomic_eval (by decide) hq').le
#align polynomial.sub_one_pow_totient_le_cyclotomic_eval Polynomial.sub_one_pow_totient_le_cyclotomic_eval
+-/
+#print Polynomial.cyclotomic_eval_lt_add_one_pow_totient /-
theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤ n) (hq' : 1 < q) :
(cyclotomic n ℝ).eval q < (q + 1) ^ totient n :=
by
@@ -325,7 +348,9 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
obtain ⟨ζ, hζ, hhζ : Complex.abs _ < _⟩ := hex
exact ⟨ζ, hζ, by simp [hhζ]⟩
#align polynomial.cyclotomic_eval_lt_add_one_pow_totient Polynomial.cyclotomic_eval_lt_add_one_pow_totient
+-/
+#print Polynomial.cyclotomic_eval_le_add_one_pow_totient /-
theorem cyclotomic_eval_le_add_one_pow_totient {q : ℝ} (hq' : 1 < q) :
∀ n, (cyclotomic n ℝ).eval q ≤ (q + 1) ^ totient n
| 0 => by simp
@@ -333,7 +358,9 @@ theorem cyclotomic_eval_le_add_one_pow_totient {q : ℝ} (hq' : 1 < q) :
| 2 => by simp
| n + 3 => (cyclotomic_eval_lt_add_one_pow_totient (by decide) hq').le
#align polynomial.cyclotomic_eval_le_add_one_pow_totient Polynomial.cyclotomic_eval_le_add_one_pow_totient
+-/
+#print Polynomial.sub_one_pow_totient_lt_natAbs_cyclotomic_eval /-
theorem 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
@@ -345,13 +372,16 @@ theorem sub_one_pow_totient_lt_natAbs_cyclotomic_eval {n : ℕ} {q : ℕ} (hn' :
refine' (sub_one_pow_totient_lt_cyclotomic_eval hn' (Nat.one_lt_cast.2 hq')).trans_le _
exact (cyclotomic.eval_apply (q : ℤ) n (algebraMap ℤ ℝ)).trans_le (le_abs_self _)
#align polynomial.sub_one_pow_totient_lt_nat_abs_cyclotomic_eval Polynomial.sub_one_pow_totient_lt_natAbs_cyclotomic_eval
+-/
+#print Polynomial.sub_one_lt_natAbs_cyclotomic_eval /-
theorem 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 <| pos_of_gt hn').ne' _
_ < ((cyclotomic n ℤ).eval ↑q).natAbs := sub_one_pow_totient_lt_natAbs_cyclotomic_eval hn' hq
#align polynomial.sub_one_lt_nat_abs_cyclotomic_eval Polynomial.sub_one_lt_natAbs_cyclotomic_eval
+-/
end Polynomial
mathlib commit https://github.com/leanprover-community/mathlib/commit/2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Rodriguez
! This file was ported from Lean 3 source module ring_theory.polynomial.cyclotomic.eval
-! leanprover-community/mathlib commit 5bfbcca0a7ffdd21cf1682e59106d6c942434a32
+! leanprover-community/mathlib commit 2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -16,6 +16,9 @@ import Mathbin.Analysis.Complex.Arg
/-!
# Evaluating cyclotomic polynomials
+
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
This file states some results about evaluating cyclotomic polynomials in various different ways.
## Main definitions
* `polynomial.eval(₂)_one_cyclotomic_prime(_pow)`: `eval 1 (cyclotomic p^k R) = p`.
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -213,7 +213,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
rw [Complex.sameRay_iff]
push_neg
refine' ⟨by exact_mod_cast hq.ne', hζ.ne_zero hn.ne', _⟩
- rw [Complex.arg_of_real_of_nonneg hq.le, Ne.def, eq_comm, hζ.arg_eq_zero_iff hn.ne']
+ rw [Complex.arg_ofReal_of_nonneg hq.le, Ne.def, eq_comm, hζ.arg_eq_zero_iff hn.ne']
clear_value ζ
rintro rfl
linarith [hζ.unique IsPrimitiveRoot.one]
@@ -276,7 +276,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
rw [Complex.sameRay_iff]
push_neg
refine' ⟨by exact_mod_cast hq.ne', neg_ne_zero.mpr <| hζ.ne_zero hn.ne', _⟩
- rw [Complex.arg_of_real_of_nonneg hq.le, Ne.def, eq_comm]
+ rw [Complex.arg_ofReal_of_nonneg hq.le, Ne.def, 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
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -348,7 +348,6 @@ theorem sub_one_lt_natAbs_cyclotomic_eval {n : ℕ} {q : ℕ} (hn' : 1 < n) (hq
calc
q - 1 ≤ (q - 1) ^ totient n := Nat.le_self_pow (Nat.totient_pos <| pos_of_gt hn').ne' _
_ < ((cyclotomic n ℤ).eval ↑q).natAbs := sub_one_pow_totient_lt_natAbs_cyclotomic_eval hn' hq
-
#align polynomial.sub_one_lt_nat_abs_cyclotomic_eval Polynomial.sub_one_lt_natAbs_cyclotomic_eval
end Polynomial
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -82,7 +82,7 @@ theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x :
have hn'' : 1 < n := one_lt_two.trans hn
dsimp at ih
have := prod_cyclotomic_eq_geom_sum hn' R
- apply_fun eval x at this
+ apply_fun eval x at this
rw [← cons_self_proper_divisors hn'.ne', Finset.erase_cons_of_ne _ hn''.ne', Finset.prod_cons,
eval_mul, eval_geom_sum] at this
rcases lt_trichotomy 0 (∑ i in Finset.range n, x ^ i) with (h | h | h)
@@ -169,7 +169,7 @@ theorem eval_one_cyclotomic_not_prime_pow {R : Type _} [Ring R] {n : ℕ}
apply Finset.dvd_prod_of_mem
simp [hn'.ne', hn.ne']
have := prod_cyclotomic_eq_geom_sum hn' ℤ
- apply_fun eval 1 at this
+ 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
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -62,16 +62,16 @@ private theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrdered
Int.cast_pos]
suffices 0 < eval (↑(-1 : ℤ)) (cyclotomic n ℝ)
by
- rw [← map_cyclotomic_int n ℝ, eval_int_cast_map, Int.coe_castRingHom] at this
+ rw [← map_cyclotomic_int n ℝ, eval_int_cast_map, Int.coe_castRingHom] at this
exact_mod_cast this
simp only [Int.cast_one, Int.cast_neg]
have h0 := cyclotomic_coeff_zero ℝ hn.le
- rw [coeff_zero_eq_eval_zero] at h0
+ rw [coeff_zero_eq_eval_zero] at h0
by_contra' hx
have := intermediate_value_univ (-1) 0 (cyclotomic n ℝ).Continuous
obtain ⟨y, hy : is_root _ y⟩ := this (show (0 : ℝ) ∈ Set.Icc _ _ by simpa [h0] using hx)
- rw [is_root_cyclotomic_iff] at hy
- rw [hy.eq_order_of] at hn
+ rw [is_root_cyclotomic_iff] at hy
+ rw [hy.eq_order_of] at hn
exact hn.not_le LinearOrderedRing.orderOf_le_two
theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x : R) :
@@ -80,18 +80,18 @@ theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x :
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
- dsimp at ih
+ dsimp at ih
have := prod_cyclotomic_eq_geom_sum hn' R
- apply_fun eval x at this
+ apply_fun eval x at this
rw [← cons_self_proper_divisors hn'.ne', Finset.erase_cons_of_ne _ hn''.ne', Finset.prod_cons,
- eval_mul, eval_geom_sum] at this
+ eval_mul, eval_geom_sum] at this
rcases lt_trichotomy 0 (∑ i in 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_proper_divisors] at hi
- rw [geom_sum_pos_iff hn'.ne'] at h
+ simp only [Finset.mem_erase, mem_proper_divisors] at hi
+ rw [geom_sum_pos_iff hn'.ne'] at h
cases' 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)
@@ -101,11 +101,11 @@ theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x :
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
+ · 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
+ rw [geom_sum_neg_iff hn'.ne'] at h
have h2 : 2 ∈ n.proper_divisors.erase 1 :=
by
rw [Finset.mem_erase, mem_proper_divisors]
@@ -113,10 +113,10 @@ theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x :
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_proper_divisors] at hi
+ simp only [Finset.mem_erase, mem_proper_divisors] 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
+ 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
#align polynomial.cyclotomic_pos Polynomial.cyclotomic_pos
@@ -130,7 +130,7 @@ theorem cyclotomic_pos_and_nonneg (n : ℕ) {R} [LinearOrderedCommRing R] (x : R
and_self_iff]
· constructor <;> intro <;> linarith
· have : 2 < n + 3 := by decide
- constructor <;> intro <;> [skip;apply le_of_lt] <;> apply cyclotomic_pos this
+ constructor <;> intro <;> [skip; apply le_of_lt] <;> apply cyclotomic_pos this
#align polynomial.cyclotomic_pos_and_nonneg Polynomial.cyclotomic_pos_and_nonneg
/-- Cyclotomic polynomials are always positive on inputs larger than one.
@@ -169,21 +169,21 @@ theorem eval_one_cyclotomic_not_prime_pow {R : Type _} [Ring R] {n : ℕ}
apply Finset.dvd_prod_of_mem
simp [hn'.ne', hn.ne']
have := prod_cyclotomic_eq_geom_sum hn' ℤ
- apply_fun eval 1 at this
+ 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
+ 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
any_goals infer_instance
swap
· simp only [singleton_subset_iff, mem_sdiff, mem_erase, Ne.def, mem_divisors, dvd_refl,
true_and_iff, mem_image, mem_range, exists_prop, not_exists, not_and]
exact ⟨⟨hn.ne', hn'.ne'⟩, fun t _ => h hp _⟩
- rw [← Int.natAbs_ofNat p, Int.natAbs_dvd_natAbs] at hpe
+ rw [← Int.natAbs_ofNat 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
+ 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 [← pow_succ', ← Int.natAbs_dvd_natAbs, Int.natAbs_ofNat, Int.natAbs_pow] at this
+ simp only [← pow_succ', ← Int.natAbs_dvd_natAbs, Int.natAbs_ofNat, Int.natAbs_pow] at this
exact pow_succ_padicValNat_not_dvd hn'.ne' this
· rintro x - y - hxy
apply Nat.succ_injective
@@ -198,7 +198,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
have hfor : ∀ ζ' ∈ primitiveRoots n ℂ, q - 1 ≤ ‖↑q - ζ'‖ :=
by
intro ζ' hζ'
- rw [mem_primitiveRoots hn] at 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']
@@ -227,7 +227,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
by
simp only [← Units.val_lt_val, Units.val_pow_eq_pow_val, Units.val_mk0, ← NNReal.coe_lt_coe,
hq'.le, Real.toNNReal_lt_toNNReal_iff_of_nonneg, coe_nnnorm, Complex.norm_eq_abs,
- NNReal.coe_pow, Real.coe_toNNReal', max_eq_left, sub_nonneg] at this
+ NNReal.coe_pow, Real.coe_toNNReal', max_eq_left, sub_nonneg] at this
convert this
erw [cyclotomic.eval_apply q n (algebraMap ℝ ℂ), eq_comm]
simp only [cyclotomic_nonneg n hq'.le, Complex.coe_algebraMap, Complex.abs_ofReal, abs_eq_self]
@@ -261,7 +261,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
have hfor : ∀ ζ' ∈ primitiveRoots n ℂ, ‖↑q - ζ'‖ ≤ q + 1 :=
by
intro ζ' hζ'
- rw [mem_primitiveRoots hn] at 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']
@@ -278,14 +278,14 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
refine' ⟨by exact_mod_cast hq.ne', neg_ne_zero.mpr <| hζ.ne_zero hn.ne', _⟩
rw [Complex.arg_of_real_of_nonneg hq.le, Ne.def, eq_comm]
intro h
- rw [Complex.arg_eq_zero_iff, Complex.neg_re, neg_nonneg, Complex.neg_im, neg_eq_zero] at 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ζ
+ 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ζ₀
ext <;> simp [hζ₀, h.2]
@@ -300,7 +300,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
by
simp only [← Units.val_lt_val, Units.val_pow_eq_pow_val, Units.val_mk0, ← NNReal.coe_lt_coe,
hq'.le, Real.toNNReal_lt_toNNReal_iff_of_nonneg, coe_nnnorm, Complex.norm_eq_abs,
- NNReal.coe_pow, Real.coe_toNNReal', max_eq_left, sub_nonneg] at this
+ NNReal.coe_pow, Real.coe_toNNReal', max_eq_left, sub_nonneg] at this
convert this
· erw [cyclotomic.eval_apply q n (algebraMap ℝ ℂ), eq_comm]
simp [cyclotomic_nonneg n hq'.le]
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -28,7 +28,7 @@ namespace Polynomial
open Finset Nat
-open BigOperators
+open scoped BigOperators
@[simp]
theorem eval_one_cyclotomic_prime {R : Type _} [CommRing R] {p : ℕ} [hn : Fact p.Prime] :
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -234,8 +234,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
simp only [cyclotomic_eq_prod_X_sub_primitive_roots hζ, eval_prod, eval_C, eval_X, eval_sub,
nnnorm_prod, Units.mk0_prod]
convert Finset.prod_lt_prod' _ _
- swap
- · exact fun _ => Units.mk0 (Real.toNNReal (q - 1)) (by simp [hq'])
+ swap; · exact fun _ => Units.mk0 (Real.toNNReal (q - 1)) (by simp [hq'])
· simp only [Complex.card_primitiveRoots, prod_const, card_attach]
· simp only [Subtype.coe_mk, Finset.mem_attach, forall_true_left, Subtype.forall, ←
Units.val_le_val, ← NNReal.coe_le_coe, complex.abs.nonneg, hq'.le, Units.val_mk0,
@@ -310,8 +309,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
simp only [cyclotomic_eq_prod_X_sub_primitive_roots hζ, eval_prod, eval_C, eval_X, eval_sub,
nnnorm_prod, Units.mk0_prod]
convert Finset.prod_lt_prod' _ _
- swap
- · exact fun _ => Units.mk0 (Real.toNNReal (q + 1)) (by simp <;> linarith only [hq'])
+ swap; · exact fun _ => Units.mk0 (Real.toNNReal (q + 1)) (by simp <;> linarith only [hq'])
· simp [Complex.card_primitiveRoots]
· simp only [Subtype.coe_mk, Finset.mem_attach, forall_true_left, Subtype.forall, ←
Units.val_le_val, ← NNReal.coe_le_coe, complex.abs.nonneg, hq'.le, Units.val_mk0,
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -73,7 +73,6 @@ private theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrdered
rw [is_root_cyclotomic_iff] at hy
rw [hy.eq_order_of] at hn
exact hn.not_le LinearOrderedRing.orderOf_le_two
-#align polynomial.cyclotomic_neg_one_pos polynomial.cyclotomic_neg_one_pos
theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x : R) :
0 < eval x (cyclotomic n R) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/ef95945cd48c932c9e034872bd25c3c220d9c946
@@ -4,11 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Rodriguez
! This file was ported from Lean 3 source module ring_theory.polynomial.cyclotomic.eval
-! leanprover-community/mathlib commit 3f655f5297b030a87d641ad4e825af8d9679eb0b
+! leanprover-community/mathlib commit 5bfbcca0a7ffdd21cf1682e59106d6c942434a32
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
-import Mathbin.RingTheory.Polynomial.Cyclotomic.Basic
+import Mathbin.RingTheory.Polynomial.Cyclotomic.Roots
import Mathbin.Tactic.ByContra
import Mathbin.Topology.Algebra.Polynomial
import Mathbin.NumberTheory.Padics.PadicVal
mathlib commit https://github.com/leanprover-community/mathlib/commit/8d33f09cd7089ecf074b4791907588245aec5d1b
@@ -131,7 +131,7 @@ theorem cyclotomic_pos_and_nonneg (n : ℕ) {R} [LinearOrderedCommRing R] (x : R
and_self_iff]
· constructor <;> intro <;> linarith
· have : 2 < n + 3 := by decide
- constructor <;> intro <;> [skip, apply le_of_lt] <;> apply cyclotomic_pos this
+ constructor <;> intro <;> [skip;apply le_of_lt] <;> apply cyclotomic_pos this
#align polynomial.cyclotomic_pos_and_nonneg Polynomial.cyclotomic_pos_and_nonneg
/-- Cyclotomic polynomials are always positive on inputs larger than one.
mathlib commit https://github.com/leanprover-community/mathlib/commit/d4437c68c8d350fc9d4e95e1e174409db35e30d7
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Rodriguez
! This file was ported from Lean 3 source module ring_theory.polynomial.cyclotomic.eval
-! leanprover-community/mathlib commit b13c1a07b23d09d72cd393a8e72fdd88dab90fa5
+! leanprover-community/mathlib commit 3f655f5297b030a87d641ad4e825af8d9679eb0b
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -274,7 +274,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
refine' ⟨ζ, (mem_primitiveRoots hn).mpr hζ, _⟩
suffices ¬SameRay ℝ (q : ℂ) (-ζ) by
convert norm_add_lt_of_not_sameRay this <;>
- simp [Real.norm_of_nonneg hq.le, hζ.norm'_eq_one hn.ne', -Complex.norm_eq_abs]
+ simp [abs_of_pos hq, hζ.norm'_eq_one hn.ne', -Complex.norm_eq_abs]
rw [Complex.sameRay_iff]
push_neg
refine' ⟨by exact_mod_cast hq.ne', neg_ne_zero.mpr <| hζ.ne_zero hn.ne', _⟩
mathlib commit https://github.com/leanprover-community/mathlib/commit/2af0836443b4cfb5feda0df0051acdb398304931
@@ -318,11 +318,11 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
Units.val_le_val, ← NNReal.coe_le_coe, complex.abs.nonneg, hq'.le, Units.val_mk0,
Real.coe_toNNReal, coe_nnnorm, Complex.norm_eq_abs, max_le_iff]
intro x hx
- have : Complex.AbsTheory.Complex.abs _ ≤ _ := hfor x hx
+ have : Complex.abs _ ≤ _ := hfor x hx
simp [this]
· simp only [Subtype.coe_mk, Finset.mem_attach, exists_true_left, Subtype.exists, ←
NNReal.coe_lt_coe, ← Units.val_lt_val, Units.val_mk0 _, coe_nnnorm]
- obtain ⟨ζ, hζ, hhζ : Complex.AbsTheory.Complex.abs _ < _⟩ := hex
+ obtain ⟨ζ, hζ, hhζ : Complex.abs _ < _⟩ := hex
exact ⟨ζ, hζ, by simp [hhζ]⟩
#align polynomial.cyclotomic_eval_lt_add_one_pow_totient Polynomial.cyclotomic_eval_lt_add_one_pow_totient
mathlib commit https://github.com/leanprover-community/mathlib/commit/ddec54a71a0dd025c05445d467f1a2b7d586a3ba
@@ -203,7 +203,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
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)
+ 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
@@ -221,7 +221,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
have : ¬eval (↑q) (cyclotomic n ℂ) = 0 :=
by
erw [cyclotomic.eval_apply q n (algebraMap ℝ ℂ)]
- simpa only [Complex.coe_algebraMap, Complex.of_real_eq_zero] using (cyclotomic_pos' n hq').ne'
+ simpa only [Complex.coe_algebraMap, Complex.ofReal_eq_zero] 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 [this])
@@ -231,7 +231,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
NNReal.coe_pow, Real.coe_toNNReal', max_eq_left, sub_nonneg] at this
convert this
erw [cyclotomic.eval_apply q n (algebraMap ℝ ℂ), eq_comm]
- simp only [cyclotomic_nonneg n hq'.le, Complex.coe_algebraMap, Complex.abs_of_real, abs_eq_self]
+ simp only [cyclotomic_nonneg n hq'.le, Complex.coe_algebraMap, Complex.abs_ofReal, abs_eq_self]
simp only [cyclotomic_eq_prod_X_sub_primitive_roots hζ, eval_prod, eval_C, eval_X, eval_sub,
nnnorm_prod, Units.mk0_prod]
convert Finset.prod_lt_prod' _ _
@@ -267,7 +267,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
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)
+ 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
@@ -294,7 +294,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
have : ¬eval (↑q) (cyclotomic n ℂ) = 0 :=
by
erw [cyclotomic.eval_apply q n (algebraMap ℝ ℂ)]
- simp only [Complex.coe_algebraMap, Complex.of_real_eq_zero]
+ simp only [Complex.coe_algebraMap, Complex.ofReal_eq_zero]
exact (cyclotomic_pos' n hq').Ne.symm
suffices
Units.mk0 ‖(cyclotomic n ℂ).eval q‖₊ (by simp [this]) <
@@ -318,11 +318,11 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
Units.val_le_val, ← NNReal.coe_le_coe, complex.abs.nonneg, hq'.le, Units.val_mk0,
Real.coe_toNNReal, coe_nnnorm, Complex.norm_eq_abs, max_le_iff]
intro x hx
- have : Complex.abs _ ≤ _ := hfor x hx
+ have : Complex.AbsTheory.Complex.abs _ ≤ _ := hfor x hx
simp [this]
· simp only [Subtype.coe_mk, Finset.mem_attach, exists_true_left, Subtype.exists, ←
NNReal.coe_lt_coe, ← Units.val_lt_val, Units.val_mk0 _, coe_nnnorm]
- obtain ⟨ζ, hζ, hhζ : Complex.abs _ < _⟩ := hex
+ obtain ⟨ζ, hζ, hhζ : Complex.AbsTheory.Complex.abs _ < _⟩ := hex
exact ⟨ζ, hζ, by simp [hhζ]⟩
#align polynomial.cyclotomic_eval_lt_add_one_pow_totient Polynomial.cyclotomic_eval_lt_add_one_pow_totient
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -155,18 +155,18 @@ theorem eval_one_cyclotomic_not_prime_pow {R : Type*} [Ring R] {n : ℕ}
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_iff, mem_image, mem_range, exists_prop, not_exists, not_and]
- exact ⟨⟨hn.ne', hn'.ne'⟩, fun t _ => h hp _⟩
- rw [← Int.natAbs_ofNat 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_ofNat, Int.natAbs_pow] at this
- exact pow_succ_padicValNat_not_dvd hn'.ne' 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_iff, mem_image, mem_range, exists_prop, not_exists, not_and]
+ exact ⟨⟨hn.ne', hn'.ne'⟩, fun t _ => h hp _⟩
+ rw [← Int.natAbs_ofNat 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_ofNat, 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
@@ -260,9 +260,9 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
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]
+ · 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
nat_cast
/int_cast
/rat_cast
to natCast
/intCast
/ratCast
(#11486)
Now that I am defining NNRat.cast
, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast
/intCast
/ratCast
over nat_cast
/int_cast
/rat_cast
, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.
@@ -54,10 +54,10 @@ theorem eval₂_one_cyclotomic_prime_pow {R S : Type*} [CommRing R] [Semiring S]
private theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing 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_int_cast_map, Int.coe_castRingHom,
+ 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_int_cast_map, Int.coe_castRingHom] at this
+ 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
@@ -144,7 +144,7 @@ theorem eval_one_cyclotomic_not_prime_pow {R : Type*} [Ring R] {n : ℕ}
· 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_int_cast_map (Int.castRingHom R) (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 : ℤ))]
@@ -158,7 +158,7 @@ theorem eval_one_cyclotomic_not_prime_pow {R : Type*} [Ring R] {n : ℕ}
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.def, mem_divisors, dvd_refl,
+ · simp only [singleton_subset_iff, mem_sdiff, mem_erase, Ne, mem_divisors, dvd_refl,
true_and_iff, mem_image, mem_range, exists_prop, not_exists, not_and]
exact ⟨⟨hn.ne', hn'.ne'⟩, fun t _ => h hp _⟩
rw [← Int.natAbs_ofNat p, Int.natAbs_dvd_natAbs] at hpe
@@ -192,7 +192,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
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.def, eq_comm, hζ.arg_eq_zero_iff 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]
@@ -252,7 +252,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
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.def, eq_comm]
+ 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
We change the following field in the definition of an additive commutative monoid:
nsmul_succ : ∀ (n : ℕ) (x : G),
- AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+ AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x
where the latter is more natural
We adjust the definitions of ^
in monoids, groups, etc.
Originally there was a warning comment about why this natural order was preferred
use
x * npowRec n x
and notnpowRec n x * x
in the definition to make sure that definitional unfolding ofnpowRec
is blocked, to avoid deep recursion issues.
but it seems to no longer apply.
Remarks on the PR :
pow_succ
and pow_succ'
have switched their meanings.Ideal.IsPrime.mul_mem_pow
which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul
.@@ -165,7 +165,7 @@ theorem eval_one_cyclotomic_not_prime_pow {R : Type*} [Ring R] {n : ℕ}
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_ofNat, Int.natAbs_pow] at this
+ simp only [← _root_.pow_succ, ← Int.natAbs_dvd_natAbs, Int.natAbs_ofNat, Int.natAbs_pow] at this
exact pow_succ_padicValNat_not_dvd hn'.ne' this
· rintro x - y - hxy
apply Nat.succ_injective
I removed some of the tactics that were not used and are hopefully uncontroversial arising from the linter at #11308.
As the commit messages should convey, the removed tactics are, essentially,
push_cast
norm_cast
congr
norm_num
dsimp
funext
intro
infer_instance
@@ -119,7 +119,7 @@ theorem cyclotomic_pos_and_nonneg (n : ℕ) {R} [LinearOrderedCommRing R] (x : R
simp [cyclotomic_zero, cyclotomic_one, cyclotomic_two, succ_eq_add_one, eval_X, eval_one,
eval_add, eval_sub, sub_nonneg, sub_pos, zero_lt_one, zero_le_one, imp_true_iff, imp_self,
and_self_iff]
- · constructor <;> intro <;> set_option tactic.skipAssignedInstances false in norm_num; linarith
+ · constructor <;> intro <;> linarith
· have : 2 < n + 3 := by linarith
constructor <;> intro <;> [skip; apply le_of_lt] <;> apply cyclotomic_pos this
#align polynomial.cyclotomic_pos_and_nonneg Polynomial.cyclotomic_pos_and_nonneg
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -119,7 +119,7 @@ theorem cyclotomic_pos_and_nonneg (n : ℕ) {R} [LinearOrderedCommRing R] (x : R
simp [cyclotomic_zero, cyclotomic_one, cyclotomic_two, succ_eq_add_one, eval_X, eval_one,
eval_add, eval_sub, sub_nonneg, sub_pos, zero_lt_one, zero_le_one, imp_true_iff, imp_self,
and_self_iff]
- · constructor <;> intro <;> norm_num <;> linarith
+ · constructor <;> intro <;> set_option tactic.skipAssignedInstances false in norm_num; linarith
· have : 2 < n + 3 := by linarith
constructor <;> intro <;> [skip; apply le_of_lt] <;> apply cyclotomic_pos this
#align polynomial.cyclotomic_pos_and_nonneg Polynomial.cyclotomic_pos_and_nonneg
simp can prove
porting notes (#10930)
Classify by adding issue number (#10618) to porting notes claiming anything semantically equivalent to
simp
can prove this"simp
can simplify this`"@[simp]
, now can be proved by simp
"@[simp]
, but simp
can prove it"simp
"simp
can already prove this"simp
already proves this"simp
can prove these"@@ -34,7 +34,7 @@ theorem eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : ℕ} [hn : Fact
Finset.card_range, smul_one_eq_coe]
#align polynomial.eval_one_cyclotomic_prime Polynomial.eval_one_cyclotomic_prime
--- @[simp] -- Porting note: simp already proves this
+-- @[simp] -- Porting note (#10618): simp already proves this
theorem 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
#align polynomial.eval₂_one_cyclotomic_prime Polynomial.eval₂_one_cyclotomic_prime
@@ -46,7 +46,7 @@ theorem eval_one_cyclotomic_prime_pow {R : Type*} [CommRing R] {p : ℕ} (k :
eval_finset_sum, Finset.card_range, smul_one_eq_coe]
#align polynomial.eval_one_cyclotomic_prime_pow Polynomial.eval_one_cyclotomic_prime_pow
--- @[simp] -- Porting note: simp already proves this
+-- @[simp] -- Porting note (#10618): simp already proves this
theorem 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
#align polynomial.eval₂_one_cyclotomic_prime_pow Polynomial.eval₂_one_cyclotomic_prime_pow
f ^ n
(#9617)
This involves moving lemmas from Algebra.GroupPower.Ring
to Algebra.GroupWithZero.Basic
and changing some 0 < n
assumptions to n ≠ 0
.
From LeanAPAP
@@ -307,8 +307,8 @@ theorem cyclotomic_eval_le_add_one_pow_totient {q : ℝ} (hq' : 1 < q) :
theorem 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_lt.imp_left Nat.lt_one_iff.mp with (rfl | hq')
- · rw [zero_tsub, zero_pow (Nat.totient_pos (pos_of_gt hn')), pos_iff_ne_zero, Int.natAbs_ne_zero,
- Nat.cast_zero, ← coeff_zero_eq_eval_zero, cyclotomic_coeff_zero _ hn']
+ · rw [zero_tsub, zero_pow (Nat.totient_pos (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 _
Complex.ext
only a local ext
lemma (#9010)
In accordance with this Zulip thread, this remove Complex.ext
from the global ext
attribute list and only enables it locally in certain files.
@@ -264,7 +264,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
rw [this] at hζ
linarith [hζ.unique <| IsPrimitiveRoot.neg_one 0 two_ne_zero.symm]
· contrapose! hζ₀
- ext <;> simp [hζ₀, h.2]
+ apply Complex.ext <;> simp [hζ₀, h.2]
have : ¬eval (↑q) (cyclotomic n ℂ) = 0 := by
erw [cyclotomic.eval_apply q n (algebraMap ℝ ℂ)]
simp only [Complex.coe_algebraMap, Complex.ofReal_eq_zero]
@@ -62,7 +62,7 @@ private theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrdered
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
+ 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
exact_mod_cast
tactic with mod_cast
elaborator where possible (#8404)
We still have the exact_mod_cast
tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast
are the ones that don't work using the term elaborator by itself.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -191,7 +191,7 @@ theorem sub_one_pow_totient_lt_cyclotomic_eval {n : ℕ} {q : ℝ} (hn' : 2 ≤
simp only [hζ.norm'_eq_one hn.ne', Real.norm_of_nonneg hq.le, Complex.norm_real]
rw [Complex.sameRay_iff]
push_neg
- refine' ⟨by exact_mod_cast hq.ne', hζ.ne_zero hn.ne', _⟩
+ refine' ⟨mod_cast hq.ne', hζ.ne_zero hn.ne', _⟩
rw [Complex.arg_ofReal_of_nonneg hq.le, Ne.def, eq_comm, hζ.arg_eq_zero_iff hn.ne']
clear_value ζ
rintro rfl
@@ -251,7 +251,7 @@ theorem cyclotomic_eval_lt_add_one_pow_totient {n : ℕ} {q : ℝ} (hn' : 3 ≤
· simp [abs_of_pos hq, hζ.norm'_eq_one hn.ne', -Complex.norm_eq_abs]
rw [Complex.sameRay_iff]
push_neg
- refine' ⟨by exact_mod_cast hq.ne', neg_ne_zero.mpr <| hζ.ne_zero hn.ne', _⟩
+ refine' ⟨mod_cast hq.ne', neg_ne_zero.mpr <| hζ.ne_zero hn.ne', _⟩
rw [Complex.arg_ofReal_of_nonneg hq.le, Ne.def, eq_comm]
intro h
rw [Complex.arg_eq_zero_iff, Complex.neg_re, neg_nonneg, Complex.neg_im, neg_eq_zero] at h
@@ -74,7 +74,6 @@ theorem cyclotomic_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] (x :
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
- dsimp at ih
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,
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -28,26 +28,26 @@ open Finset Nat
open scoped BigOperators
@[simp]
-theorem eval_one_cyclotomic_prime {R : Type _} [CommRing R] {p : ℕ} [hn : Fact p.Prime] :
+theorem 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_coe]
#align polynomial.eval_one_cyclotomic_prime Polynomial.eval_one_cyclotomic_prime
-- @[simp] -- Porting note: simp already proves this
-theorem eval₂_one_cyclotomic_prime {R S : Type _} [CommRing R] [Semiring S] (f : R →+* S) {p : ℕ}
+theorem 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
#align polynomial.eval₂_one_cyclotomic_prime Polynomial.eval₂_one_cyclotomic_prime
@[simp]
-theorem eval_one_cyclotomic_prime_pow {R : Type _} [CommRing R] {p : ℕ} (k : ℕ)
+theorem 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_coe]
#align polynomial.eval_one_cyclotomic_prime_pow Polynomial.eval_one_cyclotomic_prime_pow
-- @[simp] -- Porting note: simp already proves this
-theorem eval₂_one_cyclotomic_prime_pow {R S : Type _} [CommRing R] [Semiring S] (f : R →+* S)
+theorem 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
#align polynomial.eval₂_one_cyclotomic_prime_pow Polynomial.eval₂_one_cyclotomic_prime_pow
@@ -139,7 +139,7 @@ theorem cyclotomic_nonneg (n : ℕ) {R} [LinearOrderedCommRing R] {x : R} (hx :
(cyclotomic_pos_and_nonneg n x).2 hx
#align polynomial.cyclotomic_nonneg Polynomial.cyclotomic_nonneg
-theorem eval_one_cyclotomic_not_prime_pow {R : Type _} [Ring R] {n : ℕ}
+theorem 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
@@ -2,11 +2,6 @@
Copyright (c) 2021 Eric Rodriguez. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Rodriguez
-
-! This file was ported from Lean 3 source module ring_theory.polynomial.cyclotomic.eval
-! leanprover-community/mathlib commit 5bfbcca0a7ffdd21cf1682e59106d6c942434a32
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.Tactic.ByContra
@@ -14,6 +9,8 @@ import Mathlib.Topology.Algebra.Polynomial
import Mathlib.NumberTheory.Padics.PadicVal
import Mathlib.Analysis.Complex.Arg
+#align_import ring_theory.polynomial.cyclotomic.eval from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32"
+
/-!
# Evaluating cyclotomic polynomials
This file states some results about evaluating cyclotomic polynomials in various different ways.
The unported dependencies are
algebra.order.module
init.core
linear_algebra.free_module.finite.rank
algebra.order.monoid.cancel.defs
algebra.abs
algebra.group_power.lemmas
init.data.list.basic
linear_algebra.free_module.rank
algebra.order.monoid.cancel.basic
init.data.list.default
topology.subset_properties
init.logic
The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file