Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
rank
int64
0
2.4k
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp]
Mathlib/Data/Real/GoldenRatio.lean
64
66
theorem goldConj_mul_gold : ψ * Ο† = -1 := by
rw [mul_comm] exact gold_mul_goldConj
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp]
Mathlib/Data/Real/GoldenRatio.lean
70
72
theorem gold_add_goldConj : Ο† + ψ = 1 := by
rw [goldenRatio, goldenConj] ring
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj
Mathlib/Data/Real/GoldenRatio.lean
75
76
theorem one_sub_goldConj : 1 - Ο† = ψ := by
linarith [gold_add_goldConj]
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj
Mathlib/Data/Real/GoldenRatio.lean
79
80
theorem one_sub_gold : 1 - ψ = Ο† := by
linarith [gold_add_goldConj]
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp]
Mathlib/Data/Real/GoldenRatio.lean
84
84
theorem gold_sub_goldConj : Ο† - ψ = √5 := by
ring
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj
Mathlib/Data/Real/GoldenRatio.lean
87
88
theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by
rw [goldenRatio]; ring_nf; norm_num; ring
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200]
Mathlib/Data/Real/GoldenRatio.lean
91
94
theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by
rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200]
Mathlib/Data/Real/GoldenRatio.lean
98
101
theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by
rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < Ο† := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : Ο† β‰  0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero
Mathlib/Data/Real/GoldenRatio.lean
112
114
theorem one_lt_gold : 1 < Ο† := by
refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow`
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < Ο† := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : Ο† β‰  0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero theorem one_lt_gold : 1 < Ο† := by refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow` #align one_lt_gold one_lt_gold
Mathlib/Data/Real/GoldenRatio.lean
117
119
theorem gold_lt_two : Ο† < 2 := by
calc (1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num _ = 2 := by norm_num
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < Ο† := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : Ο† β‰  0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero theorem one_lt_gold : 1 < Ο† := by refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow` #align one_lt_gold one_lt_gold theorem gold_lt_two : Ο† < 2 := by calc (1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num _ = 2 := by norm_num
Mathlib/Data/Real/GoldenRatio.lean
121
122
theorem goldConj_neg : ψ < 0 := by
linarith [one_sub_goldConj, one_lt_gold]
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < Ο† := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : Ο† β‰  0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero theorem one_lt_gold : 1 < Ο† := by refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow` #align one_lt_gold one_lt_gold theorem gold_lt_two : Ο† < 2 := by calc (1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num _ = 2 := by norm_num theorem goldConj_neg : ψ < 0 := by linarith [one_sub_goldConj, one_lt_gold] #align gold_conj_neg goldConj_neg theorem goldConj_ne_zero : ψ β‰  0 := ne_of_lt goldConj_neg #align gold_conj_ne_zero goldConj_ne_zero
Mathlib/Data/Real/GoldenRatio.lean
129
131
theorem neg_one_lt_goldConj : -1 < ψ := by
rw [neg_lt, ← inv_gold] exact inv_lt_one one_lt_gold
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < Ο† := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : Ο† β‰  0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero theorem one_lt_gold : 1 < Ο† := by refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow` #align one_lt_gold one_lt_gold theorem gold_lt_two : Ο† < 2 := by calc (1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num _ = 2 := by norm_num theorem goldConj_neg : ψ < 0 := by linarith [one_sub_goldConj, one_lt_gold] #align gold_conj_neg goldConj_neg theorem goldConj_ne_zero : ψ β‰  0 := ne_of_lt goldConj_neg #align gold_conj_ne_zero goldConj_ne_zero theorem neg_one_lt_goldConj : -1 < ψ := by rw [neg_lt, ← inv_gold] exact inv_lt_one one_lt_gold #align neg_one_lt_gold_conj neg_one_lt_goldConj
Mathlib/Data/Real/GoldenRatio.lean
140
146
theorem gold_irrational : Irrational Ο† := by
have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_add 1 have := this.rat_mul (show (0.5 : β„š) β‰  0 by norm_num) convert this norm_num field_simp
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < Ο† := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : Ο† β‰  0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero theorem one_lt_gold : 1 < Ο† := by refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow` #align one_lt_gold one_lt_gold theorem gold_lt_two : Ο† < 2 := by calc (1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num _ = 2 := by norm_num theorem goldConj_neg : ψ < 0 := by linarith [one_sub_goldConj, one_lt_gold] #align gold_conj_neg goldConj_neg theorem goldConj_ne_zero : ψ β‰  0 := ne_of_lt goldConj_neg #align gold_conj_ne_zero goldConj_ne_zero theorem neg_one_lt_goldConj : -1 < ψ := by rw [neg_lt, ← inv_gold] exact inv_lt_one one_lt_gold #align neg_one_lt_gold_conj neg_one_lt_goldConj theorem gold_irrational : Irrational Ο† := by have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_add 1 have := this.rat_mul (show (0.5 : β„š) β‰  0 by norm_num) convert this norm_num field_simp #align gold_irrational gold_irrational
Mathlib/Data/Real/GoldenRatio.lean
150
156
theorem goldConj_irrational : Irrational ψ := by
have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_sub 1 have := this.rat_mul (show (0.5 : β„š) β‰  0 by norm_num) convert this norm_num field_simp
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < Ο† := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : Ο† β‰  0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero theorem one_lt_gold : 1 < Ο† := by refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow` #align one_lt_gold one_lt_gold theorem gold_lt_two : Ο† < 2 := by calc (1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num _ = 2 := by norm_num theorem goldConj_neg : ψ < 0 := by linarith [one_sub_goldConj, one_lt_gold] #align gold_conj_neg goldConj_neg theorem goldConj_ne_zero : ψ β‰  0 := ne_of_lt goldConj_neg #align gold_conj_ne_zero goldConj_ne_zero theorem neg_one_lt_goldConj : -1 < ψ := by rw [neg_lt, ← inv_gold] exact inv_lt_one one_lt_gold #align neg_one_lt_gold_conj neg_one_lt_goldConj theorem gold_irrational : Irrational Ο† := by have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_add 1 have := this.rat_mul (show (0.5 : β„š) β‰  0 by norm_num) convert this norm_num field_simp #align gold_irrational gold_irrational theorem goldConj_irrational : Irrational ψ := by have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_sub 1 have := this.rat_mul (show (0.5 : β„š) β‰  0 by norm_num) convert this norm_num field_simp #align gold_conj_irrational goldConj_irrational section Fibrec variable {Ξ± : Type*} [CommSemiring Ξ±] def fibRec : LinearRecurrence Ξ± where order := 2 coeffs := ![1, 1] #align fib_rec fibRec section Poly open Polynomial
Mathlib/Data/Real/GoldenRatio.lean
178
181
theorem fibRec_charPoly_eq {Ξ² : Type*} [CommRing Ξ²] : fibRec.charPoly = X ^ 2 - (X + (1 : Ξ²[X])) := by
rw [fibRec, LinearRecurrence.charPoly] simp [Finset.sum_fin_eq_sum_range, Finset.sum_range_succ', ← smul_X_eq_monomial]
1,817
import Mathlib.Data.Real.Irrational import Mathlib.Data.Nat.Fib.Basic import Mathlib.Data.Fin.VecNotation import Mathlib.Algebra.LinearRecurrence import Mathlib.Tactic.NormNum.NatFib import Mathlib.Tactic.NormNum.Prime #align_import data.real.golden_ratio from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2" noncomputable section open Polynomial abbrev goldenRatio : ℝ := (1 + √5) / 2 #align golden_ratio goldenRatio abbrev goldenConj : ℝ := (1 - √5) / 2 #align golden_conj goldenConj @[inherit_doc goldenRatio] scoped[goldenRatio] notation "Ο†" => goldenRatio @[inherit_doc goldenConj] scoped[goldenRatio] notation "ψ" => goldenConj open Real goldenRatio theorem inv_gold : φ⁻¹ = -ψ := by have : 1 + √5 β‰  0 := ne_of_gt (add_pos (by norm_num) <| Real.sqrt_pos.mpr (by norm_num)) field_simp [sub_mul, mul_add] norm_num #align inv_gold inv_gold theorem inv_goldConj : ψ⁻¹ = -Ο† := by rw [inv_eq_iff_eq_inv, ← neg_inv, ← neg_eq_iff_eq_neg] exact inv_gold.symm #align inv_gold_conj inv_goldConj @[simp] theorem gold_mul_goldConj : Ο† * ψ = -1 := by field_simp rw [← sq_sub_sq] norm_num #align gold_mul_gold_conj gold_mul_goldConj @[simp] theorem goldConj_mul_gold : ψ * Ο† = -1 := by rw [mul_comm] exact gold_mul_goldConj #align gold_conj_mul_gold goldConj_mul_gold @[simp] theorem gold_add_goldConj : Ο† + ψ = 1 := by rw [goldenRatio, goldenConj] ring #align gold_add_gold_conj gold_add_goldConj theorem one_sub_goldConj : 1 - Ο† = ψ := by linarith [gold_add_goldConj] #align one_sub_gold_conj one_sub_goldConj theorem one_sub_gold : 1 - ψ = Ο† := by linarith [gold_add_goldConj] #align one_sub_gold one_sub_gold @[simp] theorem gold_sub_goldConj : Ο† - ψ = √5 := by ring #align gold_sub_gold_conj gold_sub_goldConj theorem gold_pow_sub_gold_pow (n : β„•) : Ο† ^ (n + 2) - Ο† ^ (n + 1) = Ο† ^ n := by rw [goldenRatio]; ring_nf; norm_num; ring @[simp 1200] theorem gold_sq : Ο† ^ 2 = Ο† + 1 := by rw [goldenRatio, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_sq gold_sq @[simp 1200] theorem goldConj_sq : ψ ^ 2 = ψ + 1 := by rw [goldenConj, ← sub_eq_zero] ring_nf rw [Real.sq_sqrt] <;> norm_num #align gold_conj_sq goldConj_sq theorem gold_pos : 0 < Ο† := mul_pos (by apply add_pos <;> norm_num) <| inv_pos.2 zero_lt_two #align gold_pos gold_pos theorem gold_ne_zero : Ο† β‰  0 := ne_of_gt gold_pos #align gold_ne_zero gold_ne_zero theorem one_lt_gold : 1 < Ο† := by refine lt_of_mul_lt_mul_left ?_ (le_of_lt gold_pos) simp [← sq, gold_pos, zero_lt_one, - div_pow] -- Porting note: Added `- div_pow` #align one_lt_gold one_lt_gold theorem gold_lt_two : Ο† < 2 := by calc (1 + sqrt 5) / 2 < (1 + 3) / 2 := by gcongr; rw [sqrt_lt'] <;> norm_num _ = 2 := by norm_num theorem goldConj_neg : ψ < 0 := by linarith [one_sub_goldConj, one_lt_gold] #align gold_conj_neg goldConj_neg theorem goldConj_ne_zero : ψ β‰  0 := ne_of_lt goldConj_neg #align gold_conj_ne_zero goldConj_ne_zero theorem neg_one_lt_goldConj : -1 < ψ := by rw [neg_lt, ← inv_gold] exact inv_lt_one one_lt_gold #align neg_one_lt_gold_conj neg_one_lt_goldConj theorem gold_irrational : Irrational Ο† := by have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_add 1 have := this.rat_mul (show (0.5 : β„š) β‰  0 by norm_num) convert this norm_num field_simp #align gold_irrational gold_irrational theorem goldConj_irrational : Irrational ψ := by have := Nat.Prime.irrational_sqrt (show Nat.Prime 5 by norm_num) have := this.rat_sub 1 have := this.rat_mul (show (0.5 : β„š) β‰  0 by norm_num) convert this norm_num field_simp #align gold_conj_irrational goldConj_irrational section Fibrec variable {Ξ± : Type*} [CommSemiring Ξ±] def fibRec : LinearRecurrence Ξ± where order := 2 coeffs := ![1, 1] #align fib_rec fibRec
Mathlib/Data/Real/GoldenRatio.lean
187
192
theorem fib_isSol_fibRec : fibRec.IsSolution (fun x => x.fib : β„• β†’ Ξ±) := by
rw [fibRec] intro n simp only rw [Nat.fib_add_two, add_comm] simp [Finset.sum_fin_eq_sum_range, Finset.sum_range_succ']
1,817
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Basic import Mathlib.RingTheory.Ideal.Maps import Mathlib.RingTheory.MvPowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Finset (antidiagonal mem_antidiagonal) def PowerSeries (R : Type*) := MvPowerSeries Unit R #align power_series PowerSeries namespace PowerSeries open Finsupp (single) variable {R : Type*} section -- Porting note: not available in Lean 4 -- local reducible PowerSeries scoped notation:9000 R "⟦X⟧" => PowerSeries R instance [Inhabited R] : Inhabited R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Zero R] : Zero R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddMonoid R] : AddMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddGroup R] : AddGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Semiring R] : Semiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommSemiring R] : CommSemiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Ring R] : Ring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommRing R] : CommRing R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Nontrivial R] : Nontrivial R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A S} [Semiring R] [Semiring S] [AddCommMonoid A] [Module R A] [Module S A] [SMul R S] [IsScalarTower R S A] : IsScalarTower R S A⟦X⟧ := Pi.isScalarTower instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance end section Semiring variable (R) [Semiring R] def coeff (n : β„•) : R⟦X⟧ β†’β‚—[R] R := MvPowerSeries.coeff R (single () n) #align power_series.coeff PowerSeries.coeff def monomial (n : β„•) : R β†’β‚—[R] R⟦X⟧ := MvPowerSeries.monomial R (single () n) #align power_series.monomial PowerSeries.monomial variable {R}
Mathlib/RingTheory/PowerSeries/Basic.lean
150
151
theorem coeff_def {s : Unit β†’β‚€ β„•} {n : β„•} (h : s () = n) : coeff R n = MvPowerSeries.coeff R s := by
erw [coeff, ← h, ← Finsupp.unique_single s]
1,818
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Basic import Mathlib.RingTheory.Ideal.Maps import Mathlib.RingTheory.MvPowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Finset (antidiagonal mem_antidiagonal) def PowerSeries (R : Type*) := MvPowerSeries Unit R #align power_series PowerSeries namespace PowerSeries open Finsupp (single) variable {R : Type*} section -- Porting note: not available in Lean 4 -- local reducible PowerSeries scoped notation:9000 R "⟦X⟧" => PowerSeries R instance [Inhabited R] : Inhabited R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Zero R] : Zero R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddMonoid R] : AddMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddGroup R] : AddGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Semiring R] : Semiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommSemiring R] : CommSemiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Ring R] : Ring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommRing R] : CommRing R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Nontrivial R] : Nontrivial R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A S} [Semiring R] [Semiring S] [AddCommMonoid A] [Module R A] [Module S A] [SMul R S] [IsScalarTower R S A] : IsScalarTower R S A⟦X⟧ := Pi.isScalarTower instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance end section Semiring variable (R) [Semiring R] def coeff (n : β„•) : R⟦X⟧ β†’β‚—[R] R := MvPowerSeries.coeff R (single () n) #align power_series.coeff PowerSeries.coeff def monomial (n : β„•) : R β†’β‚—[R] R⟦X⟧ := MvPowerSeries.monomial R (single () n) #align power_series.monomial PowerSeries.monomial variable {R} theorem coeff_def {s : Unit β†’β‚€ β„•} {n : β„•} (h : s () = n) : coeff R n = MvPowerSeries.coeff R s := by erw [coeff, ← h, ← Finsupp.unique_single s] #align power_series.coeff_def PowerSeries.coeff_def @[ext] theorem ext {Ο† ψ : R⟦X⟧} (h : βˆ€ n, coeff R n Ο† = coeff R n ψ) : Ο† = ψ := MvPowerSeries.ext fun n => by rw [← coeff_def] Β· apply h rfl #align power_series.ext PowerSeries.ext theorem ext_iff {Ο† ψ : R⟦X⟧} : Ο† = ψ ↔ βˆ€ n, coeff R n Ο† = coeff R n ψ := ⟨fun h n => congr_arg (coeff R n) h, ext⟩ #align power_series.ext_iff PowerSeries.ext_iff instance [Subsingleton R] : Subsingleton R⟦X⟧ := by simp only [subsingleton_iff, ext_iff] exact fun _ _ _ ↦ (subsingleton_iff).mp (by infer_instance) _ _ def mk {R} (f : β„• β†’ R) : R⟦X⟧ := fun s => f (s ()) #align power_series.mk PowerSeries.mk @[simp] theorem coeff_mk (n : β„•) (f : β„• β†’ R) : coeff R n (mk f) = f n := congr_arg f Finsupp.single_eq_same #align power_series.coeff_mk PowerSeries.coeff_mk
Mathlib/RingTheory/PowerSeries/Basic.lean
181
184
theorem coeff_monomial (m n : β„•) (a : R) : coeff R m (monomial R n a) = if m = n then a else 0 := calc coeff R m (monomial R n a) = _ := MvPowerSeries.coeff_monomial _ _ _ _ = if m = n then a else 0 := by
simp only [Finsupp.unique_single_eq_iff]
1,818
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Basic import Mathlib.RingTheory.Ideal.Maps import Mathlib.RingTheory.MvPowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Finset (antidiagonal mem_antidiagonal) def PowerSeries (R : Type*) := MvPowerSeries Unit R #align power_series PowerSeries namespace PowerSeries open Finsupp (single) variable {R : Type*} section -- Porting note: not available in Lean 4 -- local reducible PowerSeries scoped notation:9000 R "⟦X⟧" => PowerSeries R instance [Inhabited R] : Inhabited R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Zero R] : Zero R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddMonoid R] : AddMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddGroup R] : AddGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Semiring R] : Semiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommSemiring R] : CommSemiring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Ring R] : Ring R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [CommRing R] : CommRing R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance [Nontrivial R] : Nontrivial R⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance instance {A S} [Semiring R] [Semiring S] [AddCommMonoid A] [Module R A] [Module S A] [SMul R S] [IsScalarTower R S A] : IsScalarTower R S A⟦X⟧ := Pi.isScalarTower instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by dsimp only [PowerSeries] infer_instance end section Semiring variable (R) [Semiring R] def coeff (n : β„•) : R⟦X⟧ β†’β‚—[R] R := MvPowerSeries.coeff R (single () n) #align power_series.coeff PowerSeries.coeff def monomial (n : β„•) : R β†’β‚—[R] R⟦X⟧ := MvPowerSeries.monomial R (single () n) #align power_series.monomial PowerSeries.monomial variable {R} theorem coeff_def {s : Unit β†’β‚€ β„•} {n : β„•} (h : s () = n) : coeff R n = MvPowerSeries.coeff R s := by erw [coeff, ← h, ← Finsupp.unique_single s] #align power_series.coeff_def PowerSeries.coeff_def @[ext] theorem ext {Ο† ψ : R⟦X⟧} (h : βˆ€ n, coeff R n Ο† = coeff R n ψ) : Ο† = ψ := MvPowerSeries.ext fun n => by rw [← coeff_def] Β· apply h rfl #align power_series.ext PowerSeries.ext theorem ext_iff {Ο† ψ : R⟦X⟧} : Ο† = ψ ↔ βˆ€ n, coeff R n Ο† = coeff R n ψ := ⟨fun h n => congr_arg (coeff R n) h, ext⟩ #align power_series.ext_iff PowerSeries.ext_iff instance [Subsingleton R] : Subsingleton R⟦X⟧ := by simp only [subsingleton_iff, ext_iff] exact fun _ _ _ ↦ (subsingleton_iff).mp (by infer_instance) _ _ def mk {R} (f : β„• β†’ R) : R⟦X⟧ := fun s => f (s ()) #align power_series.mk PowerSeries.mk @[simp] theorem coeff_mk (n : β„•) (f : β„• β†’ R) : coeff R n (mk f) = f n := congr_arg f Finsupp.single_eq_same #align power_series.coeff_mk PowerSeries.coeff_mk theorem coeff_monomial (m n : β„•) (a : R) : coeff R m (monomial R n a) = if m = n then a else 0 := calc coeff R m (monomial R n a) = _ := MvPowerSeries.coeff_monomial _ _ _ _ = if m = n then a else 0 := by simp only [Finsupp.unique_single_eq_iff] #align power_series.coeff_monomial PowerSeries.coeff_monomial theorem monomial_eq_mk (n : β„•) (a : R) : monomial R n a = mk fun m => if m = n then a else 0 := ext fun m => by rw [coeff_monomial, coeff_mk] #align power_series.monomial_eq_mk PowerSeries.monomial_eq_mk @[simp] theorem coeff_monomial_same (n : β„•) (a : R) : coeff R n (monomial R n a) = a := MvPowerSeries.coeff_monomial_same _ _ #align power_series.coeff_monomial_same PowerSeries.coeff_monomial_same @[simp] theorem coeff_comp_monomial (n : β„•) : (coeff R n).comp (monomial R n) = LinearMap.id := LinearMap.ext <| coeff_monomial_same n #align power_series.coeff_comp_monomial PowerSeries.coeff_comp_monomial variable (R) def constantCoeff : R⟦X⟧ β†’+* R := MvPowerSeries.constantCoeff Unit R #align power_series.constant_coeff PowerSeries.constantCoeff def C : R β†’+* R⟦X⟧ := MvPowerSeries.C Unit R set_option linter.uppercaseLean3 false in #align power_series.C PowerSeries.C variable {R} def X : R⟦X⟧ := MvPowerSeries.X () set_option linter.uppercaseLean3 false in #align power_series.X PowerSeries.X theorem commute_X (Ο† : R⟦X⟧) : Commute Ο† X := MvPowerSeries.commute_X _ _ set_option linter.uppercaseLean3 false in #align power_series.commute_X PowerSeries.commute_X @[simp]
Mathlib/RingTheory/PowerSeries/Basic.lean
229
231
theorem coeff_zero_eq_constantCoeff : ⇑(coeff R 0) = constantCoeff R := by
rw [coeff, Finsupp.single_zero] rfl
1,818
import Mathlib.Algebra.Polynomial.Coeff import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section Trunc variable [Semiring R] open Finset Nat def trunc (n : β„•) (Ο† : R⟦X⟧) : R[X] := βˆ‘ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m Ο†) #align power_series.trunc PowerSeries.trunc
Mathlib/RingTheory/PowerSeries/Trunc.lean
44
46
theorem coeff_trunc (m) (n) (Ο† : R⟦X⟧) : (trunc n Ο†).coeff m = if m < n then coeff R m Ο† else 0 := by
simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff]
1,819
import Mathlib.Algebra.Polynomial.Coeff import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section Trunc variable [Semiring R] open Finset Nat def trunc (n : β„•) (Ο† : R⟦X⟧) : R[X] := βˆ‘ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m Ο†) #align power_series.trunc PowerSeries.trunc theorem coeff_trunc (m) (n) (Ο† : R⟦X⟧) : (trunc n Ο†).coeff m = if m < n then coeff R m Ο† else 0 := by simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff] #align power_series.coeff_trunc PowerSeries.coeff_trunc @[simp] theorem trunc_zero (n) : trunc n (0 : R⟦X⟧) = 0 := Polynomial.ext fun m => by rw [coeff_trunc, LinearMap.map_zero, Polynomial.coeff_zero] split_ifs <;> rfl #align power_series.trunc_zero PowerSeries.trunc_zero @[simp] theorem trunc_one (n) : trunc (n + 1) (1 : R⟦X⟧) = 1 := Polynomial.ext fun m => by rw [coeff_trunc, coeff_one, Polynomial.coeff_one] split_ifs with h _ h' Β· rfl Β· rfl Β· subst h'; simp at h Β· rfl #align power_series.trunc_one PowerSeries.trunc_one @[simp] theorem trunc_C (n) (a : R) : trunc (n + 1) (C R a) = Polynomial.C a := Polynomial.ext fun m => by rw [coeff_trunc, coeff_C, Polynomial.coeff_C] split_ifs with H <;> first |rfl|try simp_all set_option linter.uppercaseLean3 false in #align power_series.trunc_C PowerSeries.trunc_C @[simp] theorem trunc_add (n) (Ο† ψ : R⟦X⟧) : trunc n (Ο† + ψ) = trunc n Ο† + trunc n ψ := Polynomial.ext fun m => by simp only [coeff_trunc, AddMonoidHom.map_add, Polynomial.coeff_add] split_ifs with H Β· rfl Β· rw [zero_add] #align power_series.trunc_add PowerSeries.trunc_add
Mathlib/RingTheory/PowerSeries/Trunc.lean
84
86
theorem trunc_succ (f : R⟦X⟧) (n : β„•) : trunc n.succ f = trunc n f + Polynomial.monomial n (coeff R n f) := by
rw [trunc, Ico_zero_eq_range, sum_range_succ, trunc, Ico_zero_eq_range]
1,819
import Mathlib.Algebra.Polynomial.Coeff import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section Trunc variable [Semiring R] open Finset Nat def trunc (n : β„•) (Ο† : R⟦X⟧) : R[X] := βˆ‘ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m Ο†) #align power_series.trunc PowerSeries.trunc theorem coeff_trunc (m) (n) (Ο† : R⟦X⟧) : (trunc n Ο†).coeff m = if m < n then coeff R m Ο† else 0 := by simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff] #align power_series.coeff_trunc PowerSeries.coeff_trunc @[simp] theorem trunc_zero (n) : trunc n (0 : R⟦X⟧) = 0 := Polynomial.ext fun m => by rw [coeff_trunc, LinearMap.map_zero, Polynomial.coeff_zero] split_ifs <;> rfl #align power_series.trunc_zero PowerSeries.trunc_zero @[simp] theorem trunc_one (n) : trunc (n + 1) (1 : R⟦X⟧) = 1 := Polynomial.ext fun m => by rw [coeff_trunc, coeff_one, Polynomial.coeff_one] split_ifs with h _ h' Β· rfl Β· rfl Β· subst h'; simp at h Β· rfl #align power_series.trunc_one PowerSeries.trunc_one @[simp] theorem trunc_C (n) (a : R) : trunc (n + 1) (C R a) = Polynomial.C a := Polynomial.ext fun m => by rw [coeff_trunc, coeff_C, Polynomial.coeff_C] split_ifs with H <;> first |rfl|try simp_all set_option linter.uppercaseLean3 false in #align power_series.trunc_C PowerSeries.trunc_C @[simp] theorem trunc_add (n) (Ο† ψ : R⟦X⟧) : trunc n (Ο† + ψ) = trunc n Ο† + trunc n ψ := Polynomial.ext fun m => by simp only [coeff_trunc, AddMonoidHom.map_add, Polynomial.coeff_add] split_ifs with H Β· rfl Β· rw [zero_add] #align power_series.trunc_add PowerSeries.trunc_add theorem trunc_succ (f : R⟦X⟧) (n : β„•) : trunc n.succ f = trunc n f + Polynomial.monomial n (coeff R n f) := by rw [trunc, Ico_zero_eq_range, sum_range_succ, trunc, Ico_zero_eq_range]
Mathlib/RingTheory/PowerSeries/Trunc.lean
88
95
theorem natDegree_trunc_lt (f : R⟦X⟧) (n) : (trunc (n + 1) f).natDegree < n + 1 := by
rw [Nat.lt_succ_iff, natDegree_le_iff_coeff_eq_zero] intros rw [coeff_trunc] split_ifs with h Β· rw [lt_succ, ← not_lt] at h contradiction Β· rfl
1,819
import Mathlib.Algebra.Polynomial.Coeff import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section Trunc variable [Semiring R] open Finset Nat def trunc (n : β„•) (Ο† : R⟦X⟧) : R[X] := βˆ‘ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m Ο†) #align power_series.trunc PowerSeries.trunc theorem coeff_trunc (m) (n) (Ο† : R⟦X⟧) : (trunc n Ο†).coeff m = if m < n then coeff R m Ο† else 0 := by simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff] #align power_series.coeff_trunc PowerSeries.coeff_trunc @[simp] theorem trunc_zero (n) : trunc n (0 : R⟦X⟧) = 0 := Polynomial.ext fun m => by rw [coeff_trunc, LinearMap.map_zero, Polynomial.coeff_zero] split_ifs <;> rfl #align power_series.trunc_zero PowerSeries.trunc_zero @[simp] theorem trunc_one (n) : trunc (n + 1) (1 : R⟦X⟧) = 1 := Polynomial.ext fun m => by rw [coeff_trunc, coeff_one, Polynomial.coeff_one] split_ifs with h _ h' Β· rfl Β· rfl Β· subst h'; simp at h Β· rfl #align power_series.trunc_one PowerSeries.trunc_one @[simp] theorem trunc_C (n) (a : R) : trunc (n + 1) (C R a) = Polynomial.C a := Polynomial.ext fun m => by rw [coeff_trunc, coeff_C, Polynomial.coeff_C] split_ifs with H <;> first |rfl|try simp_all set_option linter.uppercaseLean3 false in #align power_series.trunc_C PowerSeries.trunc_C @[simp] theorem trunc_add (n) (Ο† ψ : R⟦X⟧) : trunc n (Ο† + ψ) = trunc n Ο† + trunc n ψ := Polynomial.ext fun m => by simp only [coeff_trunc, AddMonoidHom.map_add, Polynomial.coeff_add] split_ifs with H Β· rfl Β· rw [zero_add] #align power_series.trunc_add PowerSeries.trunc_add theorem trunc_succ (f : R⟦X⟧) (n : β„•) : trunc n.succ f = trunc n f + Polynomial.monomial n (coeff R n f) := by rw [trunc, Ico_zero_eq_range, sum_range_succ, trunc, Ico_zero_eq_range] theorem natDegree_trunc_lt (f : R⟦X⟧) (n) : (trunc (n + 1) f).natDegree < n + 1 := by rw [Nat.lt_succ_iff, natDegree_le_iff_coeff_eq_zero] intros rw [coeff_trunc] split_ifs with h Β· rw [lt_succ, ← not_lt] at h contradiction Β· rfl @[simp] lemma trunc_zero' {f : R⟦X⟧} : trunc 0 f = 0 := rfl
Mathlib/RingTheory/PowerSeries/Trunc.lean
99
106
theorem degree_trunc_lt (f : R⟦X⟧) (n) : (trunc n f).degree < n := by
rw [degree_lt_iff_coeff_zero] intros rw [coeff_trunc] split_ifs with h Β· rw [← not_le] at h contradiction Β· rfl
1,819
import Mathlib.Algebra.Polynomial.Coeff import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section Trunc variable [Semiring R] open Finset Nat def trunc (n : β„•) (Ο† : R⟦X⟧) : R[X] := βˆ‘ m ∈ Ico 0 n, Polynomial.monomial m (coeff R m Ο†) #align power_series.trunc PowerSeries.trunc theorem coeff_trunc (m) (n) (Ο† : R⟦X⟧) : (trunc n Ο†).coeff m = if m < n then coeff R m Ο† else 0 := by simp [trunc, Polynomial.coeff_sum, Polynomial.coeff_monomial, Nat.lt_succ_iff] #align power_series.coeff_trunc PowerSeries.coeff_trunc @[simp] theorem trunc_zero (n) : trunc n (0 : R⟦X⟧) = 0 := Polynomial.ext fun m => by rw [coeff_trunc, LinearMap.map_zero, Polynomial.coeff_zero] split_ifs <;> rfl #align power_series.trunc_zero PowerSeries.trunc_zero @[simp] theorem trunc_one (n) : trunc (n + 1) (1 : R⟦X⟧) = 1 := Polynomial.ext fun m => by rw [coeff_trunc, coeff_one, Polynomial.coeff_one] split_ifs with h _ h' Β· rfl Β· rfl Β· subst h'; simp at h Β· rfl #align power_series.trunc_one PowerSeries.trunc_one @[simp] theorem trunc_C (n) (a : R) : trunc (n + 1) (C R a) = Polynomial.C a := Polynomial.ext fun m => by rw [coeff_trunc, coeff_C, Polynomial.coeff_C] split_ifs with H <;> first |rfl|try simp_all set_option linter.uppercaseLean3 false in #align power_series.trunc_C PowerSeries.trunc_C @[simp] theorem trunc_add (n) (Ο† ψ : R⟦X⟧) : trunc n (Ο† + ψ) = trunc n Ο† + trunc n ψ := Polynomial.ext fun m => by simp only [coeff_trunc, AddMonoidHom.map_add, Polynomial.coeff_add] split_ifs with H Β· rfl Β· rw [zero_add] #align power_series.trunc_add PowerSeries.trunc_add theorem trunc_succ (f : R⟦X⟧) (n : β„•) : trunc n.succ f = trunc n f + Polynomial.monomial n (coeff R n f) := by rw [trunc, Ico_zero_eq_range, sum_range_succ, trunc, Ico_zero_eq_range] theorem natDegree_trunc_lt (f : R⟦X⟧) (n) : (trunc (n + 1) f).natDegree < n + 1 := by rw [Nat.lt_succ_iff, natDegree_le_iff_coeff_eq_zero] intros rw [coeff_trunc] split_ifs with h Β· rw [lt_succ, ← not_lt] at h contradiction Β· rfl @[simp] lemma trunc_zero' {f : R⟦X⟧} : trunc 0 f = 0 := rfl theorem degree_trunc_lt (f : R⟦X⟧) (n) : (trunc n f).degree < n := by rw [degree_lt_iff_coeff_zero] intros rw [coeff_trunc] split_ifs with h Β· rw [← not_le] at h contradiction Β· rfl
Mathlib/RingTheory/PowerSeries/Trunc.lean
108
120
theorem evalβ‚‚_trunc_eq_sum_range {S : Type*} [Semiring S] (s : S) (G : R β†’+* S) (n) (f : R⟦X⟧) : (trunc n f).evalβ‚‚ G s = βˆ‘ i ∈ range n, G (coeff R i f) * s ^ i := by
cases n with | zero => rw [trunc_zero', range_zero, sum_empty, evalβ‚‚_zero] | succ n => have := natDegree_trunc_lt f n rw [evalβ‚‚_eq_sum_range' (hn := this)] apply sum_congr rfl intro _ h rw [mem_range] at h congr rw [coeff_trunc, if_pos h]
1,819
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Ring variable {R S : Type*} [Ring R] [Ring S] def invUnitsSub (u : RΛ£) : PowerSeries R := mk fun n => 1 /β‚š u ^ (n + 1) #align power_series.inv_units_sub PowerSeries.invUnitsSub @[simp] theorem coeff_invUnitsSub (u : RΛ£) (n : β„•) : coeff R n (invUnitsSub u) = 1 /β‚š u ^ (n + 1) := coeff_mk _ _ #align power_series.coeff_inv_units_sub PowerSeries.coeff_invUnitsSub @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
47
48
theorem constantCoeff_invUnitsSub (u : RΛ£) : constantCoeff R (invUnitsSub u) = 1 /β‚š u := by
rw [← coeff_zero_eq_constantCoeff_apply, coeff_invUnitsSub, zero_add, pow_one]
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Ring variable {R S : Type*} [Ring R] [Ring S] def invUnitsSub (u : RΛ£) : PowerSeries R := mk fun n => 1 /β‚š u ^ (n + 1) #align power_series.inv_units_sub PowerSeries.invUnitsSub @[simp] theorem coeff_invUnitsSub (u : RΛ£) (n : β„•) : coeff R n (invUnitsSub u) = 1 /β‚š u ^ (n + 1) := coeff_mk _ _ #align power_series.coeff_inv_units_sub PowerSeries.coeff_invUnitsSub @[simp] theorem constantCoeff_invUnitsSub (u : RΛ£) : constantCoeff R (invUnitsSub u) = 1 /β‚š u := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_invUnitsSub, zero_add, pow_one] #align power_series.constant_coeff_inv_units_sub PowerSeries.constantCoeff_invUnitsSub @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
52
55
theorem invUnitsSub_mul_X (u : RΛ£) : invUnitsSub u * X = invUnitsSub u * C R u - 1 := by
ext (_ | n) Β· simp Β· simp [n.succ_ne_zero, pow_succ']
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Ring variable {R S : Type*} [Ring R] [Ring S] def invUnitsSub (u : RΛ£) : PowerSeries R := mk fun n => 1 /β‚š u ^ (n + 1) #align power_series.inv_units_sub PowerSeries.invUnitsSub @[simp] theorem coeff_invUnitsSub (u : RΛ£) (n : β„•) : coeff R n (invUnitsSub u) = 1 /β‚š u ^ (n + 1) := coeff_mk _ _ #align power_series.coeff_inv_units_sub PowerSeries.coeff_invUnitsSub @[simp] theorem constantCoeff_invUnitsSub (u : RΛ£) : constantCoeff R (invUnitsSub u) = 1 /β‚š u := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_invUnitsSub, zero_add, pow_one] #align power_series.constant_coeff_inv_units_sub PowerSeries.constantCoeff_invUnitsSub @[simp] theorem invUnitsSub_mul_X (u : RΛ£) : invUnitsSub u * X = invUnitsSub u * C R u - 1 := by ext (_ | n) Β· simp Β· simp [n.succ_ne_zero, pow_succ'] set_option linter.uppercaseLean3 false in #align power_series.inv_units_sub_mul_X PowerSeries.invUnitsSub_mul_X @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
60
61
theorem invUnitsSub_mul_sub (u : RΛ£) : invUnitsSub u * (C R u - X) = 1 := by
simp [mul_sub, sub_sub_cancel]
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Ring variable {R S : Type*} [Ring R] [Ring S] def invUnitsSub (u : RΛ£) : PowerSeries R := mk fun n => 1 /β‚š u ^ (n + 1) #align power_series.inv_units_sub PowerSeries.invUnitsSub @[simp] theorem coeff_invUnitsSub (u : RΛ£) (n : β„•) : coeff R n (invUnitsSub u) = 1 /β‚š u ^ (n + 1) := coeff_mk _ _ #align power_series.coeff_inv_units_sub PowerSeries.coeff_invUnitsSub @[simp] theorem constantCoeff_invUnitsSub (u : RΛ£) : constantCoeff R (invUnitsSub u) = 1 /β‚š u := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_invUnitsSub, zero_add, pow_one] #align power_series.constant_coeff_inv_units_sub PowerSeries.constantCoeff_invUnitsSub @[simp] theorem invUnitsSub_mul_X (u : RΛ£) : invUnitsSub u * X = invUnitsSub u * C R u - 1 := by ext (_ | n) Β· simp Β· simp [n.succ_ne_zero, pow_succ'] set_option linter.uppercaseLean3 false in #align power_series.inv_units_sub_mul_X PowerSeries.invUnitsSub_mul_X @[simp] theorem invUnitsSub_mul_sub (u : RΛ£) : invUnitsSub u * (C R u - X) = 1 := by simp [mul_sub, sub_sub_cancel] #align power_series.inv_units_sub_mul_sub PowerSeries.invUnitsSub_mul_sub
Mathlib/RingTheory/PowerSeries/WellKnown.lean
64
68
theorem map_invUnitsSub (f : R β†’+* S) (u : RΛ£) : map f (invUnitsSub u) = invUnitsSub (Units.map (f : R β†’* S) u) := by
ext simp only [← map_pow, coeff_map, coeff_invUnitsSub, one_divp] rfl
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section invOneSubPow variable {S : Type*} [CommRing S] (d : β„•)
Mathlib/RingTheory/PowerSeries/WellKnown.lean
84
89
theorem mk_one_mul_one_sub_eq_one : (mk 1 : S⟦X⟧) * (1 - X) = 1 := by
rw [mul_comm, ext_iff] intro n cases n with | zero => simp | succ n => simp [sub_mul]
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section invOneSubPow variable {S : Type*} [CommRing S] (d : β„•) theorem mk_one_mul_one_sub_eq_one : (mk 1 : S⟦X⟧) * (1 - X) = 1 := by rw [mul_comm, ext_iff] intro n cases n with | zero => simp | succ n => simp [sub_mul]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
96
106
theorem mk_one_pow_eq_mk_choose_add : (mk 1 : S⟦X⟧) ^ (d + 1) = (mk fun n => Nat.choose (d + n) d : S⟦X⟧) := by
induction d with | zero => ext; simp | succ d hd => ext n rw [pow_add, hd, pow_one, mul_comm, coeff_mul] simp_rw [coeff_mk, Pi.one_apply, one_mul] norm_cast rw [Finset.sum_antidiagonal_choose_add, ← Nat.choose_succ_succ, Nat.succ_eq_add_one, add_right_comm]
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Field variable (A A' : Type*) [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] open Nat def exp : PowerSeries A := mk fun n => algebraMap β„š A (1 / n !) #align power_series.exp PowerSeries.exp def sin : PowerSeries A := mk fun n => if Even n then 0 else algebraMap β„š A ((-1) ^ (n / 2) / n !) #align power_series.sin PowerSeries.sin def cos : PowerSeries A := mk fun n => if Even n then algebraMap β„š A ((-1) ^ (n / 2) / n !) else 0 #align power_series.cos PowerSeries.cos variable {A A'} [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] (n : β„•) (f : A β†’+* A') @[simp] theorem coeff_exp : coeff A n (exp A) = algebraMap β„š A (1 / n !) := coeff_mk _ _ #align power_series.coeff_exp PowerSeries.coeff_exp @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
174
176
theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by
rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp] simp
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Field variable (A A' : Type*) [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] open Nat def exp : PowerSeries A := mk fun n => algebraMap β„š A (1 / n !) #align power_series.exp PowerSeries.exp def sin : PowerSeries A := mk fun n => if Even n then 0 else algebraMap β„š A ((-1) ^ (n / 2) / n !) #align power_series.sin PowerSeries.sin def cos : PowerSeries A := mk fun n => if Even n then algebraMap β„š A ((-1) ^ (n / 2) / n !) else 0 #align power_series.cos PowerSeries.cos variable {A A'} [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] (n : β„•) (f : A β†’+* A') @[simp] theorem coeff_exp : coeff A n (exp A) = algebraMap β„š A (1 / n !) := coeff_mk _ _ #align power_series.coeff_exp PowerSeries.coeff_exp @[simp] theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp] simp #align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp set_option linter.deprecated false in @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
181
182
theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by
rw [sin, coeff_mk, if_pos (even_bit0 n)]
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Field variable (A A' : Type*) [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] open Nat def exp : PowerSeries A := mk fun n => algebraMap β„š A (1 / n !) #align power_series.exp PowerSeries.exp def sin : PowerSeries A := mk fun n => if Even n then 0 else algebraMap β„š A ((-1) ^ (n / 2) / n !) #align power_series.sin PowerSeries.sin def cos : PowerSeries A := mk fun n => if Even n then algebraMap β„š A ((-1) ^ (n / 2) / n !) else 0 #align power_series.cos PowerSeries.cos variable {A A'} [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] (n : β„•) (f : A β†’+* A') @[simp] theorem coeff_exp : coeff A n (exp A) = algebraMap β„š A (1 / n !) := coeff_mk _ _ #align power_series.coeff_exp PowerSeries.coeff_exp @[simp] theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp] simp #align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp set_option linter.deprecated false in @[simp] theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by rw [sin, coeff_mk, if_pos (even_bit0 n)] #align power_series.coeff_sin_bit0 PowerSeries.coeff_sin_bit0 set_option linter.deprecated false in @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
187
189
theorem coeff_sin_bit1 : coeff A (bit1 n) (sin A) = (-1) ^ n * coeff A (bit1 n) (exp A) := by
rw [sin, coeff_mk, if_neg n.not_even_bit1, Nat.bit1_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp]
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Field variable (A A' : Type*) [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] open Nat def exp : PowerSeries A := mk fun n => algebraMap β„š A (1 / n !) #align power_series.exp PowerSeries.exp def sin : PowerSeries A := mk fun n => if Even n then 0 else algebraMap β„š A ((-1) ^ (n / 2) / n !) #align power_series.sin PowerSeries.sin def cos : PowerSeries A := mk fun n => if Even n then algebraMap β„š A ((-1) ^ (n / 2) / n !) else 0 #align power_series.cos PowerSeries.cos variable {A A'} [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] (n : β„•) (f : A β†’+* A') @[simp] theorem coeff_exp : coeff A n (exp A) = algebraMap β„š A (1 / n !) := coeff_mk _ _ #align power_series.coeff_exp PowerSeries.coeff_exp @[simp] theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp] simp #align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp set_option linter.deprecated false in @[simp] theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by rw [sin, coeff_mk, if_pos (even_bit0 n)] #align power_series.coeff_sin_bit0 PowerSeries.coeff_sin_bit0 set_option linter.deprecated false in @[simp] theorem coeff_sin_bit1 : coeff A (bit1 n) (sin A) = (-1) ^ n * coeff A (bit1 n) (exp A) := by rw [sin, coeff_mk, if_neg n.not_even_bit1, Nat.bit1_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_sin_bit1 PowerSeries.coeff_sin_bit1 set_option linter.deprecated false in @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
194
196
theorem coeff_cos_bit0 : coeff A (bit0 n) (cos A) = (-1) ^ n * coeff A (bit0 n) (exp A) := by
rw [cos, coeff_mk, if_pos (even_bit0 n), Nat.bit0_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp]
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Field variable (A A' : Type*) [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] open Nat def exp : PowerSeries A := mk fun n => algebraMap β„š A (1 / n !) #align power_series.exp PowerSeries.exp def sin : PowerSeries A := mk fun n => if Even n then 0 else algebraMap β„š A ((-1) ^ (n / 2) / n !) #align power_series.sin PowerSeries.sin def cos : PowerSeries A := mk fun n => if Even n then algebraMap β„š A ((-1) ^ (n / 2) / n !) else 0 #align power_series.cos PowerSeries.cos variable {A A'} [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] (n : β„•) (f : A β†’+* A') @[simp] theorem coeff_exp : coeff A n (exp A) = algebraMap β„š A (1 / n !) := coeff_mk _ _ #align power_series.coeff_exp PowerSeries.coeff_exp @[simp] theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp] simp #align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp set_option linter.deprecated false in @[simp] theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by rw [sin, coeff_mk, if_pos (even_bit0 n)] #align power_series.coeff_sin_bit0 PowerSeries.coeff_sin_bit0 set_option linter.deprecated false in @[simp] theorem coeff_sin_bit1 : coeff A (bit1 n) (sin A) = (-1) ^ n * coeff A (bit1 n) (exp A) := by rw [sin, coeff_mk, if_neg n.not_even_bit1, Nat.bit1_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_sin_bit1 PowerSeries.coeff_sin_bit1 set_option linter.deprecated false in @[simp] theorem coeff_cos_bit0 : coeff A (bit0 n) (cos A) = (-1) ^ n * coeff A (bit0 n) (exp A) := by rw [cos, coeff_mk, if_pos (even_bit0 n), Nat.bit0_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_cos_bit0 PowerSeries.coeff_cos_bit0 set_option linter.deprecated false in @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
201
202
theorem coeff_cos_bit1 : coeff A (bit1 n) (cos A) = 0 := by
rw [cos, coeff_mk, if_neg n.not_even_bit1]
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Field variable (A A' : Type*) [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] open Nat def exp : PowerSeries A := mk fun n => algebraMap β„š A (1 / n !) #align power_series.exp PowerSeries.exp def sin : PowerSeries A := mk fun n => if Even n then 0 else algebraMap β„š A ((-1) ^ (n / 2) / n !) #align power_series.sin PowerSeries.sin def cos : PowerSeries A := mk fun n => if Even n then algebraMap β„š A ((-1) ^ (n / 2) / n !) else 0 #align power_series.cos PowerSeries.cos variable {A A'} [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] (n : β„•) (f : A β†’+* A') @[simp] theorem coeff_exp : coeff A n (exp A) = algebraMap β„š A (1 / n !) := coeff_mk _ _ #align power_series.coeff_exp PowerSeries.coeff_exp @[simp] theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp] simp #align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp set_option linter.deprecated false in @[simp] theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by rw [sin, coeff_mk, if_pos (even_bit0 n)] #align power_series.coeff_sin_bit0 PowerSeries.coeff_sin_bit0 set_option linter.deprecated false in @[simp] theorem coeff_sin_bit1 : coeff A (bit1 n) (sin A) = (-1) ^ n * coeff A (bit1 n) (exp A) := by rw [sin, coeff_mk, if_neg n.not_even_bit1, Nat.bit1_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_sin_bit1 PowerSeries.coeff_sin_bit1 set_option linter.deprecated false in @[simp] theorem coeff_cos_bit0 : coeff A (bit0 n) (cos A) = (-1) ^ n * coeff A (bit0 n) (exp A) := by rw [cos, coeff_mk, if_pos (even_bit0 n), Nat.bit0_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_cos_bit0 PowerSeries.coeff_cos_bit0 set_option linter.deprecated false in @[simp] theorem coeff_cos_bit1 : coeff A (bit1 n) (cos A) = 0 := by rw [cos, coeff_mk, if_neg n.not_even_bit1] #align power_series.coeff_cos_bit1 PowerSeries.coeff_cos_bit1 @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
206
208
theorem map_exp : map (f : A β†’+* A') (exp A) = exp A' := by
ext simp
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Field variable (A A' : Type*) [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] open Nat def exp : PowerSeries A := mk fun n => algebraMap β„š A (1 / n !) #align power_series.exp PowerSeries.exp def sin : PowerSeries A := mk fun n => if Even n then 0 else algebraMap β„š A ((-1) ^ (n / 2) / n !) #align power_series.sin PowerSeries.sin def cos : PowerSeries A := mk fun n => if Even n then algebraMap β„š A ((-1) ^ (n / 2) / n !) else 0 #align power_series.cos PowerSeries.cos variable {A A'} [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] (n : β„•) (f : A β†’+* A') @[simp] theorem coeff_exp : coeff A n (exp A) = algebraMap β„š A (1 / n !) := coeff_mk _ _ #align power_series.coeff_exp PowerSeries.coeff_exp @[simp] theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp] simp #align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp set_option linter.deprecated false in @[simp] theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by rw [sin, coeff_mk, if_pos (even_bit0 n)] #align power_series.coeff_sin_bit0 PowerSeries.coeff_sin_bit0 set_option linter.deprecated false in @[simp] theorem coeff_sin_bit1 : coeff A (bit1 n) (sin A) = (-1) ^ n * coeff A (bit1 n) (exp A) := by rw [sin, coeff_mk, if_neg n.not_even_bit1, Nat.bit1_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_sin_bit1 PowerSeries.coeff_sin_bit1 set_option linter.deprecated false in @[simp] theorem coeff_cos_bit0 : coeff A (bit0 n) (cos A) = (-1) ^ n * coeff A (bit0 n) (exp A) := by rw [cos, coeff_mk, if_pos (even_bit0 n), Nat.bit0_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_cos_bit0 PowerSeries.coeff_cos_bit0 set_option linter.deprecated false in @[simp] theorem coeff_cos_bit1 : coeff A (bit1 n) (cos A) = 0 := by rw [cos, coeff_mk, if_neg n.not_even_bit1] #align power_series.coeff_cos_bit1 PowerSeries.coeff_cos_bit1 @[simp] theorem map_exp : map (f : A β†’+* A') (exp A) = exp A' := by ext simp #align power_series.map_exp PowerSeries.map_exp @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
212
214
theorem map_sin : map f (sin A) = sin A' := by
ext simp [sin, apply_ite f]
1,820
import Mathlib.Algebra.BigOperators.NatAntidiagonal import Mathlib.Algebra.Order.Ring.Abs import Mathlib.Data.Nat.Choose.Sum import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f" namespace PowerSeries section Field variable (A A' : Type*) [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] open Nat def exp : PowerSeries A := mk fun n => algebraMap β„š A (1 / n !) #align power_series.exp PowerSeries.exp def sin : PowerSeries A := mk fun n => if Even n then 0 else algebraMap β„š A ((-1) ^ (n / 2) / n !) #align power_series.sin PowerSeries.sin def cos : PowerSeries A := mk fun n => if Even n then algebraMap β„š A ((-1) ^ (n / 2) / n !) else 0 #align power_series.cos PowerSeries.cos variable {A A'} [Ring A] [Ring A'] [Algebra β„š A] [Algebra β„š A'] (n : β„•) (f : A β†’+* A') @[simp] theorem coeff_exp : coeff A n (exp A) = algebraMap β„š A (1 / n !) := coeff_mk _ _ #align power_series.coeff_exp PowerSeries.coeff_exp @[simp] theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp] simp #align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp set_option linter.deprecated false in @[simp] theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by rw [sin, coeff_mk, if_pos (even_bit0 n)] #align power_series.coeff_sin_bit0 PowerSeries.coeff_sin_bit0 set_option linter.deprecated false in @[simp] theorem coeff_sin_bit1 : coeff A (bit1 n) (sin A) = (-1) ^ n * coeff A (bit1 n) (exp A) := by rw [sin, coeff_mk, if_neg n.not_even_bit1, Nat.bit1_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_sin_bit1 PowerSeries.coeff_sin_bit1 set_option linter.deprecated false in @[simp] theorem coeff_cos_bit0 : coeff A (bit0 n) (cos A) = (-1) ^ n * coeff A (bit0 n) (exp A) := by rw [cos, coeff_mk, if_pos (even_bit0 n), Nat.bit0_div_two, ← mul_one_div, map_mul, map_pow, map_neg, map_one, coeff_exp] #align power_series.coeff_cos_bit0 PowerSeries.coeff_cos_bit0 set_option linter.deprecated false in @[simp] theorem coeff_cos_bit1 : coeff A (bit1 n) (cos A) = 0 := by rw [cos, coeff_mk, if_neg n.not_even_bit1] #align power_series.coeff_cos_bit1 PowerSeries.coeff_cos_bit1 @[simp] theorem map_exp : map (f : A β†’+* A') (exp A) = exp A' := by ext simp #align power_series.map_exp PowerSeries.map_exp @[simp] theorem map_sin : map f (sin A) = sin A' := by ext simp [sin, apply_ite f] #align power_series.map_sin PowerSeries.map_sin @[simp]
Mathlib/RingTheory/PowerSeries/WellKnown.lean
218
220
theorem map_cos : map f (cos A) = cos A' := by
ext simp [cos, apply_ite f]
1,820
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧}
Mathlib/RingTheory/PowerSeries/Order.lean
47
51
theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by
refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero]
1,821
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (Ο† : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : Ο† = 0 then ⊀ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊀ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero
Mathlib/RingTheory/PowerSeries/Order.lean
68
75
theorem order_finite_iff_ne_zero : (order Ο†).Dom ↔ Ο† β‰  0 := by
simp only [order] constructor Β· split_ifs with h <;> intro H Β· simp only [PartENat.top_eq_none, Part.not_none_dom] at H Β· exact h Β· intro h simp [h]
1,821
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (Ο† : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : Ο† = 0 then ⊀ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊀ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero theorem order_finite_iff_ne_zero : (order Ο†).Dom ↔ Ο† β‰  0 := by simp only [order] constructor Β· split_ifs with h <;> intro H Β· simp only [PartENat.top_eq_none, Part.not_none_dom] at H Β· exact h Β· intro h simp [h] #align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero
Mathlib/RingTheory/PowerSeries/Order.lean
80
84
theorem coeff_order (h : (order Ο†).Dom) : coeff R (Ο†.order.get h) Ο† β‰  0 := by
classical simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast'] generalize_proofs h exact Nat.find_spec h
1,821
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (Ο† : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : Ο† = 0 then ⊀ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊀ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero theorem order_finite_iff_ne_zero : (order Ο†).Dom ↔ Ο† β‰  0 := by simp only [order] constructor Β· split_ifs with h <;> intro H Β· simp only [PartENat.top_eq_none, Part.not_none_dom] at H Β· exact h Β· intro h simp [h] #align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero theorem coeff_order (h : (order Ο†).Dom) : coeff R (Ο†.order.get h) Ο† β‰  0 := by classical simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast'] generalize_proofs h exact Nat.find_spec h #align power_series.coeff_order PowerSeries.coeff_order
Mathlib/RingTheory/PowerSeries/Order.lean
89
94
theorem order_le (n : β„•) (h : coeff R n Ο† β‰  0) : order Ο† ≀ n := by
classical rw [order, dif_neg] · simp only [PartENat.coe_le_coe] exact Nat.find_le h · exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩
1,821
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (Ο† : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : Ο† = 0 then ⊀ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊀ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero theorem order_finite_iff_ne_zero : (order Ο†).Dom ↔ Ο† β‰  0 := by simp only [order] constructor Β· split_ifs with h <;> intro H Β· simp only [PartENat.top_eq_none, Part.not_none_dom] at H Β· exact h Β· intro h simp [h] #align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero theorem coeff_order (h : (order Ο†).Dom) : coeff R (Ο†.order.get h) Ο† β‰  0 := by classical simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast'] generalize_proofs h exact Nat.find_spec h #align power_series.coeff_order PowerSeries.coeff_order theorem order_le (n : β„•) (h : coeff R n Ο† β‰  0) : order Ο† ≀ n := by classical rw [order, dif_neg] Β· simp only [PartENat.coe_le_coe] exact Nat.find_le h Β· exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩ #align power_series.order_le PowerSeries.order_le
Mathlib/RingTheory/PowerSeries/Order.lean
99
101
theorem coeff_of_lt_order (n : β„•) (h : ↑n < order Ο†) : coeff R n Ο† = 0 := by
contrapose! h exact order_le _ h
1,821
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (Ο† : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : Ο† = 0 then ⊀ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊀ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero theorem order_finite_iff_ne_zero : (order Ο†).Dom ↔ Ο† β‰  0 := by simp only [order] constructor Β· split_ifs with h <;> intro H Β· simp only [PartENat.top_eq_none, Part.not_none_dom] at H Β· exact h Β· intro h simp [h] #align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero theorem coeff_order (h : (order Ο†).Dom) : coeff R (Ο†.order.get h) Ο† β‰  0 := by classical simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast'] generalize_proofs h exact Nat.find_spec h #align power_series.coeff_order PowerSeries.coeff_order theorem order_le (n : β„•) (h : coeff R n Ο† β‰  0) : order Ο† ≀ n := by classical rw [order, dif_neg] Β· simp only [PartENat.coe_le_coe] exact Nat.find_le h Β· exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩ #align power_series.order_le PowerSeries.order_le theorem coeff_of_lt_order (n : β„•) (h : ↑n < order Ο†) : coeff R n Ο† = 0 := by contrapose! h exact order_le _ h #align power_series.coeff_of_lt_order PowerSeries.coeff_of_lt_order @[simp] theorem order_eq_top {Ο† : R⟦X⟧} : Ο†.order = ⊀ ↔ Ο† = 0 := PartENat.not_dom_iff_eq_top.symm.trans order_finite_iff_ne_zero.not_left #align power_series.order_eq_top PowerSeries.order_eq_top
Mathlib/RingTheory/PowerSeries/Order.lean
112
116
theorem nat_le_order (Ο† : R⟦X⟧) (n : β„•) (h : βˆ€ i < n, coeff R i Ο† = 0) : ↑n ≀ order Ο† := by
by_contra H; rw [not_le] at H have : (order Ο†).Dom := PartENat.dom_of_le_natCast H.le rw [← PartENat.natCast_get this, PartENat.coe_lt_coe] at H exact coeff_order this (h _ H)
1,821
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (Ο† : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : Ο† = 0 then ⊀ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊀ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero theorem order_finite_iff_ne_zero : (order Ο†).Dom ↔ Ο† β‰  0 := by simp only [order] constructor Β· split_ifs with h <;> intro H Β· simp only [PartENat.top_eq_none, Part.not_none_dom] at H Β· exact h Β· intro h simp [h] #align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero theorem coeff_order (h : (order Ο†).Dom) : coeff R (Ο†.order.get h) Ο† β‰  0 := by classical simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast'] generalize_proofs h exact Nat.find_spec h #align power_series.coeff_order PowerSeries.coeff_order theorem order_le (n : β„•) (h : coeff R n Ο† β‰  0) : order Ο† ≀ n := by classical rw [order, dif_neg] Β· simp only [PartENat.coe_le_coe] exact Nat.find_le h Β· exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩ #align power_series.order_le PowerSeries.order_le theorem coeff_of_lt_order (n : β„•) (h : ↑n < order Ο†) : coeff R n Ο† = 0 := by contrapose! h exact order_le _ h #align power_series.coeff_of_lt_order PowerSeries.coeff_of_lt_order @[simp] theorem order_eq_top {Ο† : R⟦X⟧} : Ο†.order = ⊀ ↔ Ο† = 0 := PartENat.not_dom_iff_eq_top.symm.trans order_finite_iff_ne_zero.not_left #align power_series.order_eq_top PowerSeries.order_eq_top theorem nat_le_order (Ο† : R⟦X⟧) (n : β„•) (h : βˆ€ i < n, coeff R i Ο† = 0) : ↑n ≀ order Ο† := by by_contra H; rw [not_le] at H have : (order Ο†).Dom := PartENat.dom_of_le_natCast H.le rw [← PartENat.natCast_get this, PartENat.coe_lt_coe] at H exact coeff_order this (h _ H) #align power_series.nat_le_order PowerSeries.nat_le_order
Mathlib/RingTheory/PowerSeries/Order.lean
121
129
theorem le_order (Ο† : R⟦X⟧) (n : PartENat) (h : βˆ€ i : β„•, ↑i < n β†’ coeff R i Ο† = 0) : n ≀ order Ο† := by
induction n using PartENat.casesOn Β· show _ ≀ _ rw [top_le_iff, order_eq_top] ext i exact h _ (PartENat.natCast_lt_top i) Β· apply nat_le_order simpa only [PartENat.coe_lt_coe] using h
1,821
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (Ο† : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : Ο† = 0 then ⊀ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊀ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero theorem order_finite_iff_ne_zero : (order Ο†).Dom ↔ Ο† β‰  0 := by simp only [order] constructor Β· split_ifs with h <;> intro H Β· simp only [PartENat.top_eq_none, Part.not_none_dom] at H Β· exact h Β· intro h simp [h] #align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero theorem coeff_order (h : (order Ο†).Dom) : coeff R (Ο†.order.get h) Ο† β‰  0 := by classical simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast'] generalize_proofs h exact Nat.find_spec h #align power_series.coeff_order PowerSeries.coeff_order theorem order_le (n : β„•) (h : coeff R n Ο† β‰  0) : order Ο† ≀ n := by classical rw [order, dif_neg] Β· simp only [PartENat.coe_le_coe] exact Nat.find_le h Β· exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩ #align power_series.order_le PowerSeries.order_le theorem coeff_of_lt_order (n : β„•) (h : ↑n < order Ο†) : coeff R n Ο† = 0 := by contrapose! h exact order_le _ h #align power_series.coeff_of_lt_order PowerSeries.coeff_of_lt_order @[simp] theorem order_eq_top {Ο† : R⟦X⟧} : Ο†.order = ⊀ ↔ Ο† = 0 := PartENat.not_dom_iff_eq_top.symm.trans order_finite_iff_ne_zero.not_left #align power_series.order_eq_top PowerSeries.order_eq_top theorem nat_le_order (Ο† : R⟦X⟧) (n : β„•) (h : βˆ€ i < n, coeff R i Ο† = 0) : ↑n ≀ order Ο† := by by_contra H; rw [not_le] at H have : (order Ο†).Dom := PartENat.dom_of_le_natCast H.le rw [← PartENat.natCast_get this, PartENat.coe_lt_coe] at H exact coeff_order this (h _ H) #align power_series.nat_le_order PowerSeries.nat_le_order theorem le_order (Ο† : R⟦X⟧) (n : PartENat) (h : βˆ€ i : β„•, ↑i < n β†’ coeff R i Ο† = 0) : n ≀ order Ο† := by induction n using PartENat.casesOn Β· show _ ≀ _ rw [top_le_iff, order_eq_top] ext i exact h _ (PartENat.natCast_lt_top i) Β· apply nat_le_order simpa only [PartENat.coe_lt_coe] using h #align power_series.le_order PowerSeries.le_order
Mathlib/RingTheory/PowerSeries/Order.lean
134
139
theorem order_eq_nat {Ο† : R⟦X⟧} {n : β„•} : order Ο† = n ↔ coeff R n Ο† β‰  0 ∧ βˆ€ i, i < n β†’ coeff R i Ο† = 0 := by
classical rcases eq_or_ne φ 0 with (rfl | hφ) · simpa [(coeff R _).map_zero] using (PartENat.natCast_ne_top _).symm simp [order, dif_neg hφ, Nat.find_eq_iff]
1,821
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (Ο† : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : Ο† = 0 then ⊀ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊀ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero theorem order_finite_iff_ne_zero : (order Ο†).Dom ↔ Ο† β‰  0 := by simp only [order] constructor Β· split_ifs with h <;> intro H Β· simp only [PartENat.top_eq_none, Part.not_none_dom] at H Β· exact h Β· intro h simp [h] #align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero theorem coeff_order (h : (order Ο†).Dom) : coeff R (Ο†.order.get h) Ο† β‰  0 := by classical simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast'] generalize_proofs h exact Nat.find_spec h #align power_series.coeff_order PowerSeries.coeff_order theorem order_le (n : β„•) (h : coeff R n Ο† β‰  0) : order Ο† ≀ n := by classical rw [order, dif_neg] Β· simp only [PartENat.coe_le_coe] exact Nat.find_le h Β· exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩ #align power_series.order_le PowerSeries.order_le theorem coeff_of_lt_order (n : β„•) (h : ↑n < order Ο†) : coeff R n Ο† = 0 := by contrapose! h exact order_le _ h #align power_series.coeff_of_lt_order PowerSeries.coeff_of_lt_order @[simp] theorem order_eq_top {Ο† : R⟦X⟧} : Ο†.order = ⊀ ↔ Ο† = 0 := PartENat.not_dom_iff_eq_top.symm.trans order_finite_iff_ne_zero.not_left #align power_series.order_eq_top PowerSeries.order_eq_top theorem nat_le_order (Ο† : R⟦X⟧) (n : β„•) (h : βˆ€ i < n, coeff R i Ο† = 0) : ↑n ≀ order Ο† := by by_contra H; rw [not_le] at H have : (order Ο†).Dom := PartENat.dom_of_le_natCast H.le rw [← PartENat.natCast_get this, PartENat.coe_lt_coe] at H exact coeff_order this (h _ H) #align power_series.nat_le_order PowerSeries.nat_le_order theorem le_order (Ο† : R⟦X⟧) (n : PartENat) (h : βˆ€ i : β„•, ↑i < n β†’ coeff R i Ο† = 0) : n ≀ order Ο† := by induction n using PartENat.casesOn Β· show _ ≀ _ rw [top_le_iff, order_eq_top] ext i exact h _ (PartENat.natCast_lt_top i) Β· apply nat_le_order simpa only [PartENat.coe_lt_coe] using h #align power_series.le_order PowerSeries.le_order theorem order_eq_nat {Ο† : R⟦X⟧} {n : β„•} : order Ο† = n ↔ coeff R n Ο† β‰  0 ∧ βˆ€ i, i < n β†’ coeff R i Ο† = 0 := by classical rcases eq_or_ne Ο† 0 with (rfl | hΟ†) Β· simpa [(coeff R _).map_zero] using (PartENat.natCast_ne_top _).symm simp [order, dif_neg hΟ†, Nat.find_eq_iff] #align power_series.order_eq_nat PowerSeries.order_eq_nat
Mathlib/RingTheory/PowerSeries/Order.lean
144
157
theorem order_eq {Ο† : R⟦X⟧} {n : PartENat} : order Ο† = n ↔ (βˆ€ i : β„•, ↑i = n β†’ coeff R i Ο† β‰  0) ∧ βˆ€ i : β„•, ↑i < n β†’ coeff R i Ο† = 0 := by
induction n using PartENat.casesOn Β· rw [order_eq_top] constructor Β· rintro rfl constructor <;> intros Β· exfalso exact PartENat.natCast_ne_top β€Ή_β€Ί β€Ή_β€Ί Β· exact (coeff _ _).map_zero Β· rintro ⟨_h₁, hβ‚‚βŸ© ext i exact hβ‚‚ i (PartENat.natCast_lt_top i) Β· simpa [PartENat.natCast_inj] using order_eq_nat
1,821
import Mathlib.Algebra.CharP.Defs import Mathlib.RingTheory.Multiplicity import Mathlib.RingTheory.PowerSeries.Basic #align_import ring_theory.power_series.basic from "leanprover-community/mathlib"@"2d5739b61641ee4e7e53eca5688a08f66f2e6a60" noncomputable section open Polynomial open Finset (antidiagonal mem_antidiagonal) namespace PowerSeries open Finsupp (single) variable {R : Type*} section OrderBasic open multiplicity variable [Semiring R] {Ο† : R⟦X⟧} theorem exists_coeff_ne_zero_iff_ne_zero : (βˆƒ n : β„•, coeff R n Ο† β‰  0) ↔ Ο† β‰  0 := by refine not_iff_not.mp ?_ push_neg -- FIXME: the `FunLike.coe` doesn't seem to be picked up in the expression after #8386? simp [PowerSeries.ext_iff, (coeff R _).map_zero] #align power_series.exists_coeff_ne_zero_iff_ne_zero PowerSeries.exists_coeff_ne_zero_iff_ne_zero def order (Ο† : R⟦X⟧) : PartENat := letI := Classical.decEq R letI := Classical.decEq R⟦X⟧ if h : Ο† = 0 then ⊀ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h) #align power_series.order PowerSeries.order @[simp] theorem order_zero : order (0 : R⟦X⟧) = ⊀ := dif_pos rfl #align power_series.order_zero PowerSeries.order_zero theorem order_finite_iff_ne_zero : (order Ο†).Dom ↔ Ο† β‰  0 := by simp only [order] constructor Β· split_ifs with h <;> intro H Β· simp only [PartENat.top_eq_none, Part.not_none_dom] at H Β· exact h Β· intro h simp [h] #align power_series.order_finite_iff_ne_zero PowerSeries.order_finite_iff_ne_zero theorem coeff_order (h : (order Ο†).Dom) : coeff R (Ο†.order.get h) Ο† β‰  0 := by classical simp only [order, order_finite_iff_ne_zero.mp h, not_false_iff, dif_neg, PartENat.get_natCast'] generalize_proofs h exact Nat.find_spec h #align power_series.coeff_order PowerSeries.coeff_order theorem order_le (n : β„•) (h : coeff R n Ο† β‰  0) : order Ο† ≀ n := by classical rw [order, dif_neg] Β· simp only [PartENat.coe_le_coe] exact Nat.find_le h Β· exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩ #align power_series.order_le PowerSeries.order_le theorem coeff_of_lt_order (n : β„•) (h : ↑n < order Ο†) : coeff R n Ο† = 0 := by contrapose! h exact order_le _ h #align power_series.coeff_of_lt_order PowerSeries.coeff_of_lt_order @[simp] theorem order_eq_top {Ο† : R⟦X⟧} : Ο†.order = ⊀ ↔ Ο† = 0 := PartENat.not_dom_iff_eq_top.symm.trans order_finite_iff_ne_zero.not_left #align power_series.order_eq_top PowerSeries.order_eq_top theorem nat_le_order (Ο† : R⟦X⟧) (n : β„•) (h : βˆ€ i < n, coeff R i Ο† = 0) : ↑n ≀ order Ο† := by by_contra H; rw [not_le] at H have : (order Ο†).Dom := PartENat.dom_of_le_natCast H.le rw [← PartENat.natCast_get this, PartENat.coe_lt_coe] at H exact coeff_order this (h _ H) #align power_series.nat_le_order PowerSeries.nat_le_order theorem le_order (Ο† : R⟦X⟧) (n : PartENat) (h : βˆ€ i : β„•, ↑i < n β†’ coeff R i Ο† = 0) : n ≀ order Ο† := by induction n using PartENat.casesOn Β· show _ ≀ _ rw [top_le_iff, order_eq_top] ext i exact h _ (PartENat.natCast_lt_top i) Β· apply nat_le_order simpa only [PartENat.coe_lt_coe] using h #align power_series.le_order PowerSeries.le_order theorem order_eq_nat {Ο† : R⟦X⟧} {n : β„•} : order Ο† = n ↔ coeff R n Ο† β‰  0 ∧ βˆ€ i, i < n β†’ coeff R i Ο† = 0 := by classical rcases eq_or_ne Ο† 0 with (rfl | hΟ†) Β· simpa [(coeff R _).map_zero] using (PartENat.natCast_ne_top _).symm simp [order, dif_neg hΟ†, Nat.find_eq_iff] #align power_series.order_eq_nat PowerSeries.order_eq_nat theorem order_eq {Ο† : R⟦X⟧} {n : PartENat} : order Ο† = n ↔ (βˆ€ i : β„•, ↑i = n β†’ coeff R i Ο† β‰  0) ∧ βˆ€ i : β„•, ↑i < n β†’ coeff R i Ο† = 0 := by induction n using PartENat.casesOn Β· rw [order_eq_top] constructor Β· rintro rfl constructor <;> intros Β· exfalso exact PartENat.natCast_ne_top β€Ή_β€Ί β€Ή_β€Ί Β· exact (coeff _ _).map_zero Β· rintro ⟨_h₁, hβ‚‚βŸ© ext i exact hβ‚‚ i (PartENat.natCast_lt_top i) Β· simpa [PartENat.natCast_inj] using order_eq_nat #align power_series.order_eq PowerSeries.order_eq
Mathlib/RingTheory/PowerSeries/Order.lean
162
164
theorem le_order_add (Ο† ψ : R⟦X⟧) : min (order Ο†) (order ψ) ≀ order (Ο† + ψ) := by
refine le_order _ _ ?_ simp (config := { contextual := true }) [coeff_of_lt_order]
1,821
import Mathlib.RingTheory.HahnSeries.Multiplication import Mathlib.RingTheory.PowerSeries.Basic import Mathlib.Data.Finsupp.PWO #align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965" set_option linter.uppercaseLean3 false open Finset Function open scoped Classical open Pointwise Polynomial noncomputable section variable {Ξ“ : Type*} {R : Type*} namespace HahnSeries section Semiring variable [Semiring R] @[simps] def toPowerSeries : HahnSeries β„• R ≃+* PowerSeries R where toFun f := PowerSeries.mk f.coeff invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWF _).isPWO⟩ left_inv f := by ext simp right_inv f := by ext simp map_add' f g := by ext simp map_mul' f g := by ext n simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPWO_support] classical refine (sum_filter_ne_zero _).symm.trans <| (sum_congr ?_ fun _ _ ↦ rfl).trans <| sum_filter_ne_zero _ ext m simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter, mem_support] rintro h rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)] #align hahn_series.to_power_series HahnSeries.toPowerSeries theorem coeff_toPowerSeries {f : HahnSeries β„• R} {n : β„•} : PowerSeries.coeff R n (toPowerSeries f) = f.coeff n := PowerSeries.coeff_mk _ _ #align hahn_series.coeff_to_power_series HahnSeries.coeff_toPowerSeries theorem coeff_toPowerSeries_symm {f : PowerSeries R} {n : β„•} : (HahnSeries.toPowerSeries.symm f).coeff n = PowerSeries.coeff R n f := rfl #align hahn_series.coeff_to_power_series_symm HahnSeries.coeff_toPowerSeries_symm variable (Ξ“ R) [StrictOrderedSemiring Ξ“] def ofPowerSeries : PowerSeries R β†’+* HahnSeries Ξ“ R := (HahnSeries.embDomainRingHom (Nat.castAddMonoidHom Ξ“) Nat.strictMono_cast.injective fun _ _ => Nat.cast_le).comp (RingEquiv.toRingHom toPowerSeries.symm) #align hahn_series.of_power_series HahnSeries.ofPowerSeries variable {Ξ“} {R} theorem ofPowerSeries_injective : Function.Injective (ofPowerSeries Ξ“ R) := embDomain_injective.comp toPowerSeries.symm.injective #align hahn_series.of_power_series_injective HahnSeries.ofPowerSeries_injective theorem ofPowerSeries_apply (x : PowerSeries R) : ofPowerSeries Ξ“ R x = HahnSeries.embDomain ⟨⟨((↑) : β„• β†’ Ξ“), Nat.strictMono_cast.injective⟩, by simp only [Function.Embedding.coeFn_mk] exact Nat.cast_le⟩ (toPowerSeries.symm x) := rfl #align hahn_series.of_power_series_apply HahnSeries.ofPowerSeries_apply
Mathlib/RingTheory/HahnSeries/PowerSeries.lean
112
113
theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : β„•) : (ofPowerSeries Ξ“ R x).coeff n = PowerSeries.coeff R n x := by
simp [ofPowerSeries_apply]
1,822
import Mathlib.RingTheory.HahnSeries.Multiplication import Mathlib.RingTheory.PowerSeries.Basic import Mathlib.Data.Finsupp.PWO #align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965" set_option linter.uppercaseLean3 false open Finset Function open scoped Classical open Pointwise Polynomial noncomputable section variable {Ξ“ : Type*} {R : Type*} namespace HahnSeries section Semiring variable [Semiring R] @[simps] def toPowerSeries : HahnSeries β„• R ≃+* PowerSeries R where toFun f := PowerSeries.mk f.coeff invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWF _).isPWO⟩ left_inv f := by ext simp right_inv f := by ext simp map_add' f g := by ext simp map_mul' f g := by ext n simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPWO_support] classical refine (sum_filter_ne_zero _).symm.trans <| (sum_congr ?_ fun _ _ ↦ rfl).trans <| sum_filter_ne_zero _ ext m simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter, mem_support] rintro h rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)] #align hahn_series.to_power_series HahnSeries.toPowerSeries theorem coeff_toPowerSeries {f : HahnSeries β„• R} {n : β„•} : PowerSeries.coeff R n (toPowerSeries f) = f.coeff n := PowerSeries.coeff_mk _ _ #align hahn_series.coeff_to_power_series HahnSeries.coeff_toPowerSeries theorem coeff_toPowerSeries_symm {f : PowerSeries R} {n : β„•} : (HahnSeries.toPowerSeries.symm f).coeff n = PowerSeries.coeff R n f := rfl #align hahn_series.coeff_to_power_series_symm HahnSeries.coeff_toPowerSeries_symm variable (Ξ“ R) [StrictOrderedSemiring Ξ“] def ofPowerSeries : PowerSeries R β†’+* HahnSeries Ξ“ R := (HahnSeries.embDomainRingHom (Nat.castAddMonoidHom Ξ“) Nat.strictMono_cast.injective fun _ _ => Nat.cast_le).comp (RingEquiv.toRingHom toPowerSeries.symm) #align hahn_series.of_power_series HahnSeries.ofPowerSeries variable {Ξ“} {R} theorem ofPowerSeries_injective : Function.Injective (ofPowerSeries Ξ“ R) := embDomain_injective.comp toPowerSeries.symm.injective #align hahn_series.of_power_series_injective HahnSeries.ofPowerSeries_injective theorem ofPowerSeries_apply (x : PowerSeries R) : ofPowerSeries Ξ“ R x = HahnSeries.embDomain ⟨⟨((↑) : β„• β†’ Ξ“), Nat.strictMono_cast.injective⟩, by simp only [Function.Embedding.coeFn_mk] exact Nat.cast_le⟩ (toPowerSeries.symm x) := rfl #align hahn_series.of_power_series_apply HahnSeries.ofPowerSeries_apply theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : β„•) : (ofPowerSeries Ξ“ R x).coeff n = PowerSeries.coeff R n x := by simp [ofPowerSeries_apply] #align hahn_series.of_power_series_apply_coeff HahnSeries.ofPowerSeries_apply_coeff @[simp]
Mathlib/RingTheory/HahnSeries/PowerSeries.lean
117
128
theorem ofPowerSeries_C (r : R) : ofPowerSeries Ξ“ R (PowerSeries.C R r) = HahnSeries.C r := by
ext n simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq, single_coeff] split_ifs with hn Β· subst hn convert @embDomain_coeff β„• R _ _ Ξ“ _ _ _ 0 <;> simp Β· rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_C] intro simp (config := { contextual := true }) [Ne.symm hn]
1,822
import Mathlib.RingTheory.HahnSeries.Multiplication import Mathlib.RingTheory.PowerSeries.Basic import Mathlib.Data.Finsupp.PWO #align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965" set_option linter.uppercaseLean3 false open Finset Function open scoped Classical open Pointwise Polynomial noncomputable section variable {Ξ“ : Type*} {R : Type*} namespace HahnSeries section Semiring variable [Semiring R] @[simps] def toPowerSeries : HahnSeries β„• R ≃+* PowerSeries R where toFun f := PowerSeries.mk f.coeff invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWF _).isPWO⟩ left_inv f := by ext simp right_inv f := by ext simp map_add' f g := by ext simp map_mul' f g := by ext n simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPWO_support] classical refine (sum_filter_ne_zero _).symm.trans <| (sum_congr ?_ fun _ _ ↦ rfl).trans <| sum_filter_ne_zero _ ext m simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter, mem_support] rintro h rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)] #align hahn_series.to_power_series HahnSeries.toPowerSeries theorem coeff_toPowerSeries {f : HahnSeries β„• R} {n : β„•} : PowerSeries.coeff R n (toPowerSeries f) = f.coeff n := PowerSeries.coeff_mk _ _ #align hahn_series.coeff_to_power_series HahnSeries.coeff_toPowerSeries theorem coeff_toPowerSeries_symm {f : PowerSeries R} {n : β„•} : (HahnSeries.toPowerSeries.symm f).coeff n = PowerSeries.coeff R n f := rfl #align hahn_series.coeff_to_power_series_symm HahnSeries.coeff_toPowerSeries_symm variable (Ξ“ R) [StrictOrderedSemiring Ξ“] def ofPowerSeries : PowerSeries R β†’+* HahnSeries Ξ“ R := (HahnSeries.embDomainRingHom (Nat.castAddMonoidHom Ξ“) Nat.strictMono_cast.injective fun _ _ => Nat.cast_le).comp (RingEquiv.toRingHom toPowerSeries.symm) #align hahn_series.of_power_series HahnSeries.ofPowerSeries variable {Ξ“} {R} theorem ofPowerSeries_injective : Function.Injective (ofPowerSeries Ξ“ R) := embDomain_injective.comp toPowerSeries.symm.injective #align hahn_series.of_power_series_injective HahnSeries.ofPowerSeries_injective theorem ofPowerSeries_apply (x : PowerSeries R) : ofPowerSeries Ξ“ R x = HahnSeries.embDomain ⟨⟨((↑) : β„• β†’ Ξ“), Nat.strictMono_cast.injective⟩, by simp only [Function.Embedding.coeFn_mk] exact Nat.cast_le⟩ (toPowerSeries.symm x) := rfl #align hahn_series.of_power_series_apply HahnSeries.ofPowerSeries_apply theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : β„•) : (ofPowerSeries Ξ“ R x).coeff n = PowerSeries.coeff R n x := by simp [ofPowerSeries_apply] #align hahn_series.of_power_series_apply_coeff HahnSeries.ofPowerSeries_apply_coeff @[simp] theorem ofPowerSeries_C (r : R) : ofPowerSeries Ξ“ R (PowerSeries.C R r) = HahnSeries.C r := by ext n simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq, single_coeff] split_ifs with hn Β· subst hn convert @embDomain_coeff β„• R _ _ Ξ“ _ _ _ 0 <;> simp Β· rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_C] intro simp (config := { contextual := true }) [Ne.symm hn] #align hahn_series.of_power_series_C HahnSeries.ofPowerSeries_C @[simp]
Mathlib/RingTheory/HahnSeries/PowerSeries.lean
132
142
theorem ofPowerSeries_X : ofPowerSeries Ξ“ R PowerSeries.X = single 1 1 := by
ext n simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk] split_ifs with hn Β· rw [hn] convert @embDomain_coeff β„• R _ _ Ξ“ _ _ _ 1 <;> simp Β· rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_X] intro simp (config := { contextual := true }) [Ne.symm hn]
1,822
import Mathlib.RingTheory.HahnSeries.Multiplication import Mathlib.RingTheory.PowerSeries.Basic import Mathlib.Data.Finsupp.PWO #align_import ring_theory.hahn_series from "leanprover-community/mathlib"@"a484a7d0eade4e1268f4fb402859b6686037f965" set_option linter.uppercaseLean3 false open Finset Function open scoped Classical open Pointwise Polynomial noncomputable section variable {Ξ“ : Type*} {R : Type*} namespace HahnSeries section Semiring variable [Semiring R] @[simps] def toPowerSeries : HahnSeries β„• R ≃+* PowerSeries R where toFun f := PowerSeries.mk f.coeff invFun f := ⟨fun n => PowerSeries.coeff R n f, (Nat.lt_wfRel.wf.isWF _).isPWO⟩ left_inv f := by ext simp right_inv f := by ext simp map_add' f g := by ext simp map_mul' f g := by ext n simp only [PowerSeries.coeff_mul, PowerSeries.coeff_mk, mul_coeff, isPWO_support] classical refine (sum_filter_ne_zero _).symm.trans <| (sum_congr ?_ fun _ _ ↦ rfl).trans <| sum_filter_ne_zero _ ext m simp only [mem_antidiagonal, mem_addAntidiagonal, and_congr_left_iff, mem_filter, mem_support] rintro h rw [and_iff_right (left_ne_zero_of_mul h), and_iff_right (right_ne_zero_of_mul h)] #align hahn_series.to_power_series HahnSeries.toPowerSeries theorem coeff_toPowerSeries {f : HahnSeries β„• R} {n : β„•} : PowerSeries.coeff R n (toPowerSeries f) = f.coeff n := PowerSeries.coeff_mk _ _ #align hahn_series.coeff_to_power_series HahnSeries.coeff_toPowerSeries theorem coeff_toPowerSeries_symm {f : PowerSeries R} {n : β„•} : (HahnSeries.toPowerSeries.symm f).coeff n = PowerSeries.coeff R n f := rfl #align hahn_series.coeff_to_power_series_symm HahnSeries.coeff_toPowerSeries_symm variable (Ξ“ R) [StrictOrderedSemiring Ξ“] def ofPowerSeries : PowerSeries R β†’+* HahnSeries Ξ“ R := (HahnSeries.embDomainRingHom (Nat.castAddMonoidHom Ξ“) Nat.strictMono_cast.injective fun _ _ => Nat.cast_le).comp (RingEquiv.toRingHom toPowerSeries.symm) #align hahn_series.of_power_series HahnSeries.ofPowerSeries variable {Ξ“} {R} theorem ofPowerSeries_injective : Function.Injective (ofPowerSeries Ξ“ R) := embDomain_injective.comp toPowerSeries.symm.injective #align hahn_series.of_power_series_injective HahnSeries.ofPowerSeries_injective theorem ofPowerSeries_apply (x : PowerSeries R) : ofPowerSeries Ξ“ R x = HahnSeries.embDomain ⟨⟨((↑) : β„• β†’ Ξ“), Nat.strictMono_cast.injective⟩, by simp only [Function.Embedding.coeFn_mk] exact Nat.cast_le⟩ (toPowerSeries.symm x) := rfl #align hahn_series.of_power_series_apply HahnSeries.ofPowerSeries_apply theorem ofPowerSeries_apply_coeff (x : PowerSeries R) (n : β„•) : (ofPowerSeries Ξ“ R x).coeff n = PowerSeries.coeff R n x := by simp [ofPowerSeries_apply] #align hahn_series.of_power_series_apply_coeff HahnSeries.ofPowerSeries_apply_coeff @[simp] theorem ofPowerSeries_C (r : R) : ofPowerSeries Ξ“ R (PowerSeries.C R r) = HahnSeries.C r := by ext n simp only [ofPowerSeries_apply, C, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk, ne_eq, single_coeff] split_ifs with hn Β· subst hn convert @embDomain_coeff β„• R _ _ Ξ“ _ _ _ 0 <;> simp Β· rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_C] intro simp (config := { contextual := true }) [Ne.symm hn] #align hahn_series.of_power_series_C HahnSeries.ofPowerSeries_C @[simp] theorem ofPowerSeries_X : ofPowerSeries Ξ“ R PowerSeries.X = single 1 1 := by ext n simp only [single_coeff, ofPowerSeries_apply, RingHom.coe_mk] split_ifs with hn Β· rw [hn] convert @embDomain_coeff β„• R _ _ Ξ“ _ _ _ 1 <;> simp Β· rw [embDomain_notin_image_support] simp only [not_exists, Set.mem_image, toPowerSeries_symm_apply_coeff, mem_support, PowerSeries.coeff_X] intro simp (config := { contextual := true }) [Ne.symm hn] #align hahn_series.of_power_series_X HahnSeries.ofPowerSeries_X
Mathlib/RingTheory/HahnSeries/PowerSeries.lean
145
147
theorem ofPowerSeries_X_pow {R} [Semiring R] (n : β„•) : ofPowerSeries Ξ“ R (PowerSeries.X ^ n) = single (n : Ξ“) 1 := by
simp
1,822
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Reverse import Mathlib.Algebra.Polynomial.Inductions import Mathlib.RingTheory.Localization.Basic #align_import data.polynomial.laurent from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" open Polynomial Function AddMonoidAlgebra Finsupp noncomputable section variable {R : Type*} abbrev LaurentPolynomial (R : Type*) [Semiring R] := AddMonoidAlgebra R β„€ #align laurent_polynomial LaurentPolynomial @[nolint docBlame] scoped[LaurentPolynomial] notation:9000 R "[T;T⁻¹]" => LaurentPolynomial R open LaurentPolynomial -- Porting note: `ext` no longer applies `Finsupp.ext` automatically @[ext] theorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T⁻¹]} (h : βˆ€ a, p a = q a) : p = q := Finsupp.ext h def Polynomial.toLaurent [Semiring R] : R[X] β†’+* R[T;T⁻¹] := (mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R) #align polynomial.to_laurent Polynomial.toLaurent theorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) : toLaurent p = p.toFinsupp.mapDomain (↑) := rfl #align polynomial.to_laurent_apply Polynomial.toLaurent_apply def Polynomial.toLaurentAlg [CommSemiring R] : R[X] →ₐ[R] R[T;T⁻¹] := (mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom #align polynomial.to_laurent_alg Polynomial.toLaurentAlg @[simp] lemma Polynomial.coe_toLaurentAlg [CommSemiring R] : (toLaurentAlg : R[X] β†’ R[T;T⁻¹]) = toLaurent := rfl theorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f := rfl #align polynomial.to_laurent_alg_apply Polynomial.toLaurentAlg_apply namespace LaurentPolynomial section Semiring variable [Semiring R] theorem single_zero_one_eq_one : (Finsupp.single 0 1 : R[T;T⁻¹]) = (1 : R[T;T⁻¹]) := rfl #align laurent_polynomial.single_zero_one_eq_one LaurentPolynomial.single_zero_one_eq_one def C : R β†’+* R[T;T⁻¹] := singleZeroRingHom set_option linter.uppercaseLean3 false in #align laurent_polynomial.C LaurentPolynomial.C theorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) : algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) := rfl #align laurent_polynomial.algebra_map_apply LaurentPolynomial.algebraMap_apply theorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T⁻¹] r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.C_eq_algebra_map LaurentPolynomial.C_eq_algebraMap theorem single_eq_C (r : R) : Finsupp.single 0 r = C r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.single_eq_C LaurentPolynomial.single_eq_C @[simp] lemma C_apply (t : R) (n : β„€) : C t n = if n = 0 then t else 0 := by rw [← single_eq_C, Finsupp.single_apply]; aesop def T (n : β„€) : R[T;T⁻¹] := Finsupp.single n 1 set_option linter.uppercaseLean3 false in #align laurent_polynomial.T LaurentPolynomial.T @[simp] lemma T_apply (m n : β„€) : (T n : R[T;T⁻¹]) m = if n = m then 1 else 0 := Finsupp.single_apply @[simp] theorem T_zero : (T 0 : R[T;T⁻¹]) = 1 := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_zero LaurentPolynomial.T_zero
Mathlib/Algebra/Polynomial/Laurent.lean
185
187
theorem T_add (m n : β„€) : (T (m + n) : R[T;T⁻¹]) = T m * T n := by
-- Porting note: was `convert single_mul_single.symm` simp [T, single_mul_single]
1,823
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Reverse import Mathlib.Algebra.Polynomial.Inductions import Mathlib.RingTheory.Localization.Basic #align_import data.polynomial.laurent from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" open Polynomial Function AddMonoidAlgebra Finsupp noncomputable section variable {R : Type*} abbrev LaurentPolynomial (R : Type*) [Semiring R] := AddMonoidAlgebra R β„€ #align laurent_polynomial LaurentPolynomial @[nolint docBlame] scoped[LaurentPolynomial] notation:9000 R "[T;T⁻¹]" => LaurentPolynomial R open LaurentPolynomial -- Porting note: `ext` no longer applies `Finsupp.ext` automatically @[ext] theorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T⁻¹]} (h : βˆ€ a, p a = q a) : p = q := Finsupp.ext h def Polynomial.toLaurent [Semiring R] : R[X] β†’+* R[T;T⁻¹] := (mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R) #align polynomial.to_laurent Polynomial.toLaurent theorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) : toLaurent p = p.toFinsupp.mapDomain (↑) := rfl #align polynomial.to_laurent_apply Polynomial.toLaurent_apply def Polynomial.toLaurentAlg [CommSemiring R] : R[X] →ₐ[R] R[T;T⁻¹] := (mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom #align polynomial.to_laurent_alg Polynomial.toLaurentAlg @[simp] lemma Polynomial.coe_toLaurentAlg [CommSemiring R] : (toLaurentAlg : R[X] β†’ R[T;T⁻¹]) = toLaurent := rfl theorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f := rfl #align polynomial.to_laurent_alg_apply Polynomial.toLaurentAlg_apply namespace LaurentPolynomial section Semiring variable [Semiring R] theorem single_zero_one_eq_one : (Finsupp.single 0 1 : R[T;T⁻¹]) = (1 : R[T;T⁻¹]) := rfl #align laurent_polynomial.single_zero_one_eq_one LaurentPolynomial.single_zero_one_eq_one def C : R β†’+* R[T;T⁻¹] := singleZeroRingHom set_option linter.uppercaseLean3 false in #align laurent_polynomial.C LaurentPolynomial.C theorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) : algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) := rfl #align laurent_polynomial.algebra_map_apply LaurentPolynomial.algebraMap_apply theorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T⁻¹] r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.C_eq_algebra_map LaurentPolynomial.C_eq_algebraMap theorem single_eq_C (r : R) : Finsupp.single 0 r = C r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.single_eq_C LaurentPolynomial.single_eq_C @[simp] lemma C_apply (t : R) (n : β„€) : C t n = if n = 0 then t else 0 := by rw [← single_eq_C, Finsupp.single_apply]; aesop def T (n : β„€) : R[T;T⁻¹] := Finsupp.single n 1 set_option linter.uppercaseLean3 false in #align laurent_polynomial.T LaurentPolynomial.T @[simp] lemma T_apply (m n : β„€) : (T n : R[T;T⁻¹]) m = if n = m then 1 else 0 := Finsupp.single_apply @[simp] theorem T_zero : (T 0 : R[T;T⁻¹]) = 1 := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_zero LaurentPolynomial.T_zero theorem T_add (m n : β„€) : (T (m + n) : R[T;T⁻¹]) = T m * T n := by -- Porting note: was `convert single_mul_single.symm` simp [T, single_mul_single] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_add LaurentPolynomial.T_add
Mathlib/Algebra/Polynomial/Laurent.lean
191
191
theorem T_sub (m n : β„€) : (T (m - n) : R[T;T⁻¹]) = T m * T (-n) := by
rw [← T_add, sub_eq_add_neg]
1,823
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Reverse import Mathlib.Algebra.Polynomial.Inductions import Mathlib.RingTheory.Localization.Basic #align_import data.polynomial.laurent from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" open Polynomial Function AddMonoidAlgebra Finsupp noncomputable section variable {R : Type*} abbrev LaurentPolynomial (R : Type*) [Semiring R] := AddMonoidAlgebra R β„€ #align laurent_polynomial LaurentPolynomial @[nolint docBlame] scoped[LaurentPolynomial] notation:9000 R "[T;T⁻¹]" => LaurentPolynomial R open LaurentPolynomial -- Porting note: `ext` no longer applies `Finsupp.ext` automatically @[ext] theorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T⁻¹]} (h : βˆ€ a, p a = q a) : p = q := Finsupp.ext h def Polynomial.toLaurent [Semiring R] : R[X] β†’+* R[T;T⁻¹] := (mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R) #align polynomial.to_laurent Polynomial.toLaurent theorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) : toLaurent p = p.toFinsupp.mapDomain (↑) := rfl #align polynomial.to_laurent_apply Polynomial.toLaurent_apply def Polynomial.toLaurentAlg [CommSemiring R] : R[X] →ₐ[R] R[T;T⁻¹] := (mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom #align polynomial.to_laurent_alg Polynomial.toLaurentAlg @[simp] lemma Polynomial.coe_toLaurentAlg [CommSemiring R] : (toLaurentAlg : R[X] β†’ R[T;T⁻¹]) = toLaurent := rfl theorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f := rfl #align polynomial.to_laurent_alg_apply Polynomial.toLaurentAlg_apply namespace LaurentPolynomial section Semiring variable [Semiring R] theorem single_zero_one_eq_one : (Finsupp.single 0 1 : R[T;T⁻¹]) = (1 : R[T;T⁻¹]) := rfl #align laurent_polynomial.single_zero_one_eq_one LaurentPolynomial.single_zero_one_eq_one def C : R β†’+* R[T;T⁻¹] := singleZeroRingHom set_option linter.uppercaseLean3 false in #align laurent_polynomial.C LaurentPolynomial.C theorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) : algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) := rfl #align laurent_polynomial.algebra_map_apply LaurentPolynomial.algebraMap_apply theorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T⁻¹] r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.C_eq_algebra_map LaurentPolynomial.C_eq_algebraMap theorem single_eq_C (r : R) : Finsupp.single 0 r = C r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.single_eq_C LaurentPolynomial.single_eq_C @[simp] lemma C_apply (t : R) (n : β„€) : C t n = if n = 0 then t else 0 := by rw [← single_eq_C, Finsupp.single_apply]; aesop def T (n : β„€) : R[T;T⁻¹] := Finsupp.single n 1 set_option linter.uppercaseLean3 false in #align laurent_polynomial.T LaurentPolynomial.T @[simp] lemma T_apply (m n : β„€) : (T n : R[T;T⁻¹]) m = if n = m then 1 else 0 := Finsupp.single_apply @[simp] theorem T_zero : (T 0 : R[T;T⁻¹]) = 1 := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_zero LaurentPolynomial.T_zero theorem T_add (m n : β„€) : (T (m + n) : R[T;T⁻¹]) = T m * T n := by -- Porting note: was `convert single_mul_single.symm` simp [T, single_mul_single] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_add LaurentPolynomial.T_add theorem T_sub (m n : β„€) : (T (m - n) : R[T;T⁻¹]) = T m * T (-n) := by rw [← T_add, sub_eq_add_neg] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_sub LaurentPolynomial.T_sub @[simp]
Mathlib/Algebra/Polynomial/Laurent.lean
196
197
theorem T_pow (m : β„€) (n : β„•) : (T m ^ n : R[T;T⁻¹]) = T (n * m) := by
rw [T, T, single_pow n, one_pow, nsmul_eq_mul]
1,823
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Reverse import Mathlib.Algebra.Polynomial.Inductions import Mathlib.RingTheory.Localization.Basic #align_import data.polynomial.laurent from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" open Polynomial Function AddMonoidAlgebra Finsupp noncomputable section variable {R : Type*} abbrev LaurentPolynomial (R : Type*) [Semiring R] := AddMonoidAlgebra R β„€ #align laurent_polynomial LaurentPolynomial @[nolint docBlame] scoped[LaurentPolynomial] notation:9000 R "[T;T⁻¹]" => LaurentPolynomial R open LaurentPolynomial -- Porting note: `ext` no longer applies `Finsupp.ext` automatically @[ext] theorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T⁻¹]} (h : βˆ€ a, p a = q a) : p = q := Finsupp.ext h def Polynomial.toLaurent [Semiring R] : R[X] β†’+* R[T;T⁻¹] := (mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R) #align polynomial.to_laurent Polynomial.toLaurent theorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) : toLaurent p = p.toFinsupp.mapDomain (↑) := rfl #align polynomial.to_laurent_apply Polynomial.toLaurent_apply def Polynomial.toLaurentAlg [CommSemiring R] : R[X] →ₐ[R] R[T;T⁻¹] := (mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom #align polynomial.to_laurent_alg Polynomial.toLaurentAlg @[simp] lemma Polynomial.coe_toLaurentAlg [CommSemiring R] : (toLaurentAlg : R[X] β†’ R[T;T⁻¹]) = toLaurent := rfl theorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f := rfl #align polynomial.to_laurent_alg_apply Polynomial.toLaurentAlg_apply namespace LaurentPolynomial section Semiring variable [Semiring R] theorem single_zero_one_eq_one : (Finsupp.single 0 1 : R[T;T⁻¹]) = (1 : R[T;T⁻¹]) := rfl #align laurent_polynomial.single_zero_one_eq_one LaurentPolynomial.single_zero_one_eq_one def C : R β†’+* R[T;T⁻¹] := singleZeroRingHom set_option linter.uppercaseLean3 false in #align laurent_polynomial.C LaurentPolynomial.C theorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) : algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) := rfl #align laurent_polynomial.algebra_map_apply LaurentPolynomial.algebraMap_apply theorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T⁻¹] r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.C_eq_algebra_map LaurentPolynomial.C_eq_algebraMap theorem single_eq_C (r : R) : Finsupp.single 0 r = C r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.single_eq_C LaurentPolynomial.single_eq_C @[simp] lemma C_apply (t : R) (n : β„€) : C t n = if n = 0 then t else 0 := by rw [← single_eq_C, Finsupp.single_apply]; aesop def T (n : β„€) : R[T;T⁻¹] := Finsupp.single n 1 set_option linter.uppercaseLean3 false in #align laurent_polynomial.T LaurentPolynomial.T @[simp] lemma T_apply (m n : β„€) : (T n : R[T;T⁻¹]) m = if n = m then 1 else 0 := Finsupp.single_apply @[simp] theorem T_zero : (T 0 : R[T;T⁻¹]) = 1 := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_zero LaurentPolynomial.T_zero theorem T_add (m n : β„€) : (T (m + n) : R[T;T⁻¹]) = T m * T n := by -- Porting note: was `convert single_mul_single.symm` simp [T, single_mul_single] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_add LaurentPolynomial.T_add theorem T_sub (m n : β„€) : (T (m - n) : R[T;T⁻¹]) = T m * T (-n) := by rw [← T_add, sub_eq_add_neg] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_sub LaurentPolynomial.T_sub @[simp] theorem T_pow (m : β„€) (n : β„•) : (T m ^ n : R[T;T⁻¹]) = T (n * m) := by rw [T, T, single_pow n, one_pow, nsmul_eq_mul] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_pow LaurentPolynomial.T_pow @[simp]
Mathlib/Algebra/Polynomial/Laurent.lean
203
204
theorem mul_T_assoc (f : R[T;T⁻¹]) (m n : β„€) : f * T m * T n = f * T (m + n) := by
simp [← T_add, mul_assoc]
1,823
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Reverse import Mathlib.Algebra.Polynomial.Inductions import Mathlib.RingTheory.Localization.Basic #align_import data.polynomial.laurent from "leanprover-community/mathlib"@"831c494092374cfe9f50591ed0ac81a25efc5b86" open Polynomial Function AddMonoidAlgebra Finsupp noncomputable section variable {R : Type*} abbrev LaurentPolynomial (R : Type*) [Semiring R] := AddMonoidAlgebra R β„€ #align laurent_polynomial LaurentPolynomial @[nolint docBlame] scoped[LaurentPolynomial] notation:9000 R "[T;T⁻¹]" => LaurentPolynomial R open LaurentPolynomial -- Porting note: `ext` no longer applies `Finsupp.ext` automatically @[ext] theorem LaurentPolynomial.ext [Semiring R] {p q : R[T;T⁻¹]} (h : βˆ€ a, p a = q a) : p = q := Finsupp.ext h def Polynomial.toLaurent [Semiring R] : R[X] β†’+* R[T;T⁻¹] := (mapDomainRingHom R Int.ofNatHom).comp (toFinsuppIso R) #align polynomial.to_laurent Polynomial.toLaurent theorem Polynomial.toLaurent_apply [Semiring R] (p : R[X]) : toLaurent p = p.toFinsupp.mapDomain (↑) := rfl #align polynomial.to_laurent_apply Polynomial.toLaurent_apply def Polynomial.toLaurentAlg [CommSemiring R] : R[X] →ₐ[R] R[T;T⁻¹] := (mapDomainAlgHom R R Int.ofNatHom).comp (toFinsuppIsoAlg R).toAlgHom #align polynomial.to_laurent_alg Polynomial.toLaurentAlg @[simp] lemma Polynomial.coe_toLaurentAlg [CommSemiring R] : (toLaurentAlg : R[X] β†’ R[T;T⁻¹]) = toLaurent := rfl theorem Polynomial.toLaurentAlg_apply [CommSemiring R] (f : R[X]) : toLaurentAlg f = toLaurent f := rfl #align polynomial.to_laurent_alg_apply Polynomial.toLaurentAlg_apply namespace LaurentPolynomial section Semiring variable [Semiring R] theorem single_zero_one_eq_one : (Finsupp.single 0 1 : R[T;T⁻¹]) = (1 : R[T;T⁻¹]) := rfl #align laurent_polynomial.single_zero_one_eq_one LaurentPolynomial.single_zero_one_eq_one def C : R β†’+* R[T;T⁻¹] := singleZeroRingHom set_option linter.uppercaseLean3 false in #align laurent_polynomial.C LaurentPolynomial.C theorem algebraMap_apply {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A] (r : R) : algebraMap R (LaurentPolynomial A) r = C (algebraMap R A r) := rfl #align laurent_polynomial.algebra_map_apply LaurentPolynomial.algebraMap_apply theorem C_eq_algebraMap {R : Type*} [CommSemiring R] (r : R) : C r = algebraMap R R[T;T⁻¹] r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.C_eq_algebra_map LaurentPolynomial.C_eq_algebraMap theorem single_eq_C (r : R) : Finsupp.single 0 r = C r := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.single_eq_C LaurentPolynomial.single_eq_C @[simp] lemma C_apply (t : R) (n : β„€) : C t n = if n = 0 then t else 0 := by rw [← single_eq_C, Finsupp.single_apply]; aesop def T (n : β„€) : R[T;T⁻¹] := Finsupp.single n 1 set_option linter.uppercaseLean3 false in #align laurent_polynomial.T LaurentPolynomial.T @[simp] lemma T_apply (m n : β„€) : (T n : R[T;T⁻¹]) m = if n = m then 1 else 0 := Finsupp.single_apply @[simp] theorem T_zero : (T 0 : R[T;T⁻¹]) = 1 := rfl set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_zero LaurentPolynomial.T_zero theorem T_add (m n : β„€) : (T (m + n) : R[T;T⁻¹]) = T m * T n := by -- Porting note: was `convert single_mul_single.symm` simp [T, single_mul_single] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_add LaurentPolynomial.T_add theorem T_sub (m n : β„€) : (T (m - n) : R[T;T⁻¹]) = T m * T (-n) := by rw [← T_add, sub_eq_add_neg] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_sub LaurentPolynomial.T_sub @[simp] theorem T_pow (m : β„€) (n : β„•) : (T m ^ n : R[T;T⁻¹]) = T (n * m) := by rw [T, T, single_pow n, one_pow, nsmul_eq_mul] set_option linter.uppercaseLean3 false in #align laurent_polynomial.T_pow LaurentPolynomial.T_pow @[simp] theorem mul_T_assoc (f : R[T;T⁻¹]) (m n : β„€) : f * T m * T n = f * T (m + n) := by simp [← T_add, mul_assoc] set_option linter.uppercaseLean3 false in #align laurent_polynomial.mul_T_assoc LaurentPolynomial.mul_T_assoc @[simp]
Mathlib/Algebra/Polynomial/Laurent.lean
209
212
theorem single_eq_C_mul_T (r : R) (n : β„€) : (Finsupp.single n r : R[T;T⁻¹]) = (C r * T n : R[T;T⁻¹]) := by
-- Porting note: was `convert single_mul_single.symm` simp [C, T, single_mul_single]
1,823
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Ring.Action.Basic import Mathlib.GroupTheory.GroupAction.Hom import Mathlib.GroupTheory.GroupAction.Quotient #align_import algebra.polynomial.group_ring_action from "leanprover-community/mathlib"@"afad8e438d03f9d89da2914aa06cb4964ba87a18" variable (M : Type*) [Monoid M] open Polynomial namespace Polynomial variable (R : Type*) [Semiring R] variable {M} -- Porting note: changed `(Β· β€’ Β·) m` to `HSMul.hSMul m`
Mathlib/Algebra/Polynomial/GroupRingAction.lean
31
39
theorem smul_eq_map [MulSemiringAction M R] (m : M) : HSMul.hSMul m = map (MulSemiringAction.toRingHom M R m) := by
suffices DistribMulAction.toAddMonoidHom R[X] m = (mapRingHom (MulSemiringAction.toRingHom M R m)).toAddMonoidHom by ext1 r exact DFunLike.congr_fun this r ext n r : 2 change m β€’ monomial n r = map (MulSemiringAction.toRingHom M R m) (monomial n r) rw [Polynomial.map_monomial, Polynomial.smul_monomial, MulSemiringAction.toRingHom_apply]
1,824
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Ring.Action.Basic import Mathlib.GroupTheory.GroupAction.Hom import Mathlib.GroupTheory.GroupAction.Quotient #align_import algebra.polynomial.group_ring_action from "leanprover-community/mathlib"@"afad8e438d03f9d89da2914aa06cb4964ba87a18" variable (M : Type*) [Monoid M] open Polynomial namespace Polynomial variable (R : Type*) [Semiring R] variable {M} -- Porting note: changed `(Β· β€’ Β·) m` to `HSMul.hSMul m` theorem smul_eq_map [MulSemiringAction M R] (m : M) : HSMul.hSMul m = map (MulSemiringAction.toRingHom M R m) := by suffices DistribMulAction.toAddMonoidHom R[X] m = (mapRingHom (MulSemiringAction.toRingHom M R m)).toAddMonoidHom by ext1 r exact DFunLike.congr_fun this r ext n r : 2 change m β€’ monomial n r = map (MulSemiringAction.toRingHom M R m) (monomial n r) rw [Polynomial.map_monomial, Polynomial.smul_monomial, MulSemiringAction.toRingHom_apply] #align polynomial.smul_eq_map Polynomial.smul_eq_map variable (M) noncomputable instance [MulSemiringAction M R] : MulSemiringAction M R[X] := { Polynomial.distribMulAction with smul_one := fun m ↦ smul_eq_map R m β–Έ Polynomial.map_one (MulSemiringAction.toRingHom M R m) smul_mul := fun m _ _ ↦ smul_eq_map R m β–Έ Polynomial.map_mul (MulSemiringAction.toRingHom M R m) } variable {M R} variable [MulSemiringAction M R] @[simp] theorem smul_X (m : M) : (m β€’ X : R[X]) = X := (smul_eq_map R m).symm β–Έ map_X _ set_option linter.uppercaseLean3 false in #align polynomial.smul_X Polynomial.smul_X variable (S : Type*) [CommSemiring S] [MulSemiringAction M S] theorem smul_eval_smul (m : M) (f : S[X]) (x : S) : (m β€’ f).eval (m β€’ x) = m β€’ f.eval x := Polynomial.induction_on f (fun r ↦ by rw [smul_C, eval_C, eval_C]) (fun f g ihf ihg ↦ by rw [smul_add, eval_add, ihf, ihg, eval_add, smul_add]) fun n r _ ↦ by rw [smul_mul', smul_pow', smul_C, smul_X, eval_mul, eval_C, eval_pow, eval_X, eval_mul, eval_C, eval_pow, eval_X, smul_mul', smul_pow'] #align polynomial.smul_eval_smul Polynomial.smul_eval_smul variable (G : Type*) [Group G]
Mathlib/Algebra/Polynomial/GroupRingAction.lean
71
73
theorem eval_smul' [MulSemiringAction G S] (g : G) (f : S[X]) (x : S) : f.eval (g β€’ x) = g β€’ (g⁻¹ β€’ f).eval x := by
rw [← smul_eval_smul, smul_inv_smul]
1,824
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Ring.Action.Basic import Mathlib.GroupTheory.GroupAction.Hom import Mathlib.GroupTheory.GroupAction.Quotient #align_import algebra.polynomial.group_ring_action from "leanprover-community/mathlib"@"afad8e438d03f9d89da2914aa06cb4964ba87a18" variable (M : Type*) [Monoid M] open Polynomial namespace Polynomial variable (R : Type*) [Semiring R] variable {M} -- Porting note: changed `(Β· β€’ Β·) m` to `HSMul.hSMul m` theorem smul_eq_map [MulSemiringAction M R] (m : M) : HSMul.hSMul m = map (MulSemiringAction.toRingHom M R m) := by suffices DistribMulAction.toAddMonoidHom R[X] m = (mapRingHom (MulSemiringAction.toRingHom M R m)).toAddMonoidHom by ext1 r exact DFunLike.congr_fun this r ext n r : 2 change m β€’ monomial n r = map (MulSemiringAction.toRingHom M R m) (monomial n r) rw [Polynomial.map_monomial, Polynomial.smul_monomial, MulSemiringAction.toRingHom_apply] #align polynomial.smul_eq_map Polynomial.smul_eq_map variable (M) noncomputable instance [MulSemiringAction M R] : MulSemiringAction M R[X] := { Polynomial.distribMulAction with smul_one := fun m ↦ smul_eq_map R m β–Έ Polynomial.map_one (MulSemiringAction.toRingHom M R m) smul_mul := fun m _ _ ↦ smul_eq_map R m β–Έ Polynomial.map_mul (MulSemiringAction.toRingHom M R m) } variable {M R} variable [MulSemiringAction M R] @[simp] theorem smul_X (m : M) : (m β€’ X : R[X]) = X := (smul_eq_map R m).symm β–Έ map_X _ set_option linter.uppercaseLean3 false in #align polynomial.smul_X Polynomial.smul_X variable (S : Type*) [CommSemiring S] [MulSemiringAction M S] theorem smul_eval_smul (m : M) (f : S[X]) (x : S) : (m β€’ f).eval (m β€’ x) = m β€’ f.eval x := Polynomial.induction_on f (fun r ↦ by rw [smul_C, eval_C, eval_C]) (fun f g ihf ihg ↦ by rw [smul_add, eval_add, ihf, ihg, eval_add, smul_add]) fun n r _ ↦ by rw [smul_mul', smul_pow', smul_C, smul_X, eval_mul, eval_C, eval_pow, eval_X, eval_mul, eval_C, eval_pow, eval_X, smul_mul', smul_pow'] #align polynomial.smul_eval_smul Polynomial.smul_eval_smul variable (G : Type*) [Group G] theorem eval_smul' [MulSemiringAction G S] (g : G) (f : S[X]) (x : S) : f.eval (g β€’ x) = g β€’ (g⁻¹ β€’ f).eval x := by rw [← smul_eval_smul, smul_inv_smul] #align polynomial.eval_smul' Polynomial.eval_smul'
Mathlib/Algebra/Polynomial/GroupRingAction.lean
76
78
theorem smul_eval [MulSemiringAction G S] (g : G) (f : S[X]) (x : S) : (g β€’ f).eval x = g β€’ f.eval (g⁻¹ β€’ x) := by
rw [← smul_eval_smul, smul_inv_smul]
1,824
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β„•] [MulActionWithZero R S] (x : S) def smul_pow : β„• β†’ R β†’ S := fun n r => r β€’ x^n irreducible_def smeval : S := p.sum (smul_pow x)
Mathlib/Algebra/Polynomial/Smeval.lean
54
54
theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by
rw [smeval_def]
1,825
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β„•] [MulActionWithZero R S] (x : S) def smul_pow : β„• β†’ R β†’ S := fun n r => r β€’ x^n irreducible_def smeval : S := p.sum (smul_pow x) theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def] @[simp]
Mathlib/Algebra/Polynomial/Smeval.lean
57
58
theorem smeval_C : (C r).smeval x = r β€’ x ^ 0 := by
simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index]
1,825
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β„•] [MulActionWithZero R S] (x : S) def smul_pow : β„• β†’ R β†’ S := fun n r => r β€’ x^n irreducible_def smeval : S := p.sum (smul_pow x) theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def] @[simp] theorem smeval_C : (C r).smeval x = r β€’ x ^ 0 := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index] @[simp]
Mathlib/Algebra/Polynomial/Smeval.lean
61
63
theorem smeval_monomial (n : β„•) : (monomial n r).smeval x = r β€’ x ^ n := by
simp only [smeval_eq_sum, smul_pow, zero_smul, sum_monomial_index]
1,825
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β„•] [MulActionWithZero R S] (x : S) def smul_pow : β„• β†’ R β†’ S := fun n r => r β€’ x^n irreducible_def smeval : S := p.sum (smul_pow x) theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def] @[simp] theorem smeval_C : (C r).smeval x = r β€’ x ^ 0 := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index] @[simp] theorem smeval_monomial (n : β„•) : (monomial n r).smeval x = r β€’ x ^ n := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_monomial_index]
Mathlib/Algebra/Polynomial/Smeval.lean
65
67
theorem eval_eq_smeval : p.eval r = p.smeval r := by
rw [eval_eq_sum, smeval_eq_sum] rfl
1,825
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β„•] [MulActionWithZero R S] (x : S) def smul_pow : β„• β†’ R β†’ S := fun n r => r β€’ x^n irreducible_def smeval : S := p.sum (smul_pow x) theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def] @[simp] theorem smeval_C : (C r).smeval x = r β€’ x ^ 0 := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index] @[simp] theorem smeval_monomial (n : β„•) : (monomial n r).smeval x = r β€’ x ^ n := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_monomial_index] theorem eval_eq_smeval : p.eval r = p.smeval r := by rw [eval_eq_sum, smeval_eq_sum] rfl
Mathlib/Algebra/Polynomial/Smeval.lean
69
74
theorem evalβ‚‚_eq_smeval (R : Type*) [Semiring R] {S : Type*} [Semiring S] (f : R β†’+* S) (p : R[X]) (x: S) : letI : Module R S := RingHom.toModule f p.evalβ‚‚ f x = p.smeval x := by
letI : Module R S := RingHom.toModule f rw [smeval_eq_sum, evalβ‚‚_eq_sum] rfl
1,825
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β„•] [MulActionWithZero R S] (x : S) def smul_pow : β„• β†’ R β†’ S := fun n r => r β€’ x^n irreducible_def smeval : S := p.sum (smul_pow x) theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def] @[simp] theorem smeval_C : (C r).smeval x = r β€’ x ^ 0 := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index] @[simp] theorem smeval_monomial (n : β„•) : (monomial n r).smeval x = r β€’ x ^ n := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_monomial_index] theorem eval_eq_smeval : p.eval r = p.smeval r := by rw [eval_eq_sum, smeval_eq_sum] rfl theorem evalβ‚‚_eq_smeval (R : Type*) [Semiring R] {S : Type*} [Semiring S] (f : R β†’+* S) (p : R[X]) (x: S) : letI : Module R S := RingHom.toModule f p.evalβ‚‚ f x = p.smeval x := by letI : Module R S := RingHom.toModule f rw [smeval_eq_sum, evalβ‚‚_eq_sum] rfl variable (R) @[simp]
Mathlib/Algebra/Polynomial/Smeval.lean
79
80
theorem smeval_zero : (0 : R[X]).smeval x = 0 := by
simp only [smeval_eq_sum, smul_pow, sum_zero_index]
1,825
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β„•] [MulActionWithZero R S] (x : S) def smul_pow : β„• β†’ R β†’ S := fun n r => r β€’ x^n irreducible_def smeval : S := p.sum (smul_pow x) theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def] @[simp] theorem smeval_C : (C r).smeval x = r β€’ x ^ 0 := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index] @[simp] theorem smeval_monomial (n : β„•) : (monomial n r).smeval x = r β€’ x ^ n := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_monomial_index] theorem eval_eq_smeval : p.eval r = p.smeval r := by rw [eval_eq_sum, smeval_eq_sum] rfl theorem evalβ‚‚_eq_smeval (R : Type*) [Semiring R] {S : Type*} [Semiring S] (f : R β†’+* S) (p : R[X]) (x: S) : letI : Module R S := RingHom.toModule f p.evalβ‚‚ f x = p.smeval x := by letI : Module R S := RingHom.toModule f rw [smeval_eq_sum, evalβ‚‚_eq_sum] rfl variable (R) @[simp] theorem smeval_zero : (0 : R[X]).smeval x = 0 := by simp only [smeval_eq_sum, smul_pow, sum_zero_index] @[simp]
Mathlib/Algebra/Polynomial/Smeval.lean
83
85
theorem smeval_one : (1 : R[X]).smeval x = 1 β€’ x ^ 0 := by
rw [← C_1, smeval_C] simp only [Nat.cast_one, one_smul]
1,825
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β„•] [MulActionWithZero R S] (x : S) def smul_pow : β„• β†’ R β†’ S := fun n r => r β€’ x^n irreducible_def smeval : S := p.sum (smul_pow x) theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def] @[simp] theorem smeval_C : (C r).smeval x = r β€’ x ^ 0 := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index] @[simp] theorem smeval_monomial (n : β„•) : (monomial n r).smeval x = r β€’ x ^ n := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_monomial_index] theorem eval_eq_smeval : p.eval r = p.smeval r := by rw [eval_eq_sum, smeval_eq_sum] rfl theorem evalβ‚‚_eq_smeval (R : Type*) [Semiring R] {S : Type*} [Semiring S] (f : R β†’+* S) (p : R[X]) (x: S) : letI : Module R S := RingHom.toModule f p.evalβ‚‚ f x = p.smeval x := by letI : Module R S := RingHom.toModule f rw [smeval_eq_sum, evalβ‚‚_eq_sum] rfl variable (R) @[simp] theorem smeval_zero : (0 : R[X]).smeval x = 0 := by simp only [smeval_eq_sum, smul_pow, sum_zero_index] @[simp] theorem smeval_one : (1 : R[X]).smeval x = 1 β€’ x ^ 0 := by rw [← C_1, smeval_C] simp only [Nat.cast_one, one_smul] @[simp]
Mathlib/Algebra/Polynomial/Smeval.lean
88
90
theorem smeval_X : (X : R[X]).smeval x = x ^ 1 := by
simp only [smeval_eq_sum, smul_pow, zero_smul, sum_X_index, one_smul]
1,825
import Mathlib.Algebra.Group.NatPowAssoc import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Induction import Mathlib.Algebra.Polynomial.Eval namespace Polynomial section MulActionWithZero variable {R : Type*} [Semiring R] (r : R) (p : R[X]) {S : Type*} [AddCommMonoid S] [Pow S β„•] [MulActionWithZero R S] (x : S) def smul_pow : β„• β†’ R β†’ S := fun n r => r β€’ x^n irreducible_def smeval : S := p.sum (smul_pow x) theorem smeval_eq_sum : p.smeval x = p.sum (smul_pow x) := by rw [smeval_def] @[simp] theorem smeval_C : (C r).smeval x = r β€’ x ^ 0 := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_C_index] @[simp] theorem smeval_monomial (n : β„•) : (monomial n r).smeval x = r β€’ x ^ n := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_monomial_index] theorem eval_eq_smeval : p.eval r = p.smeval r := by rw [eval_eq_sum, smeval_eq_sum] rfl theorem evalβ‚‚_eq_smeval (R : Type*) [Semiring R] {S : Type*} [Semiring S] (f : R β†’+* S) (p : R[X]) (x: S) : letI : Module R S := RingHom.toModule f p.evalβ‚‚ f x = p.smeval x := by letI : Module R S := RingHom.toModule f rw [smeval_eq_sum, evalβ‚‚_eq_sum] rfl variable (R) @[simp] theorem smeval_zero : (0 : R[X]).smeval x = 0 := by simp only [smeval_eq_sum, smul_pow, sum_zero_index] @[simp] theorem smeval_one : (1 : R[X]).smeval x = 1 β€’ x ^ 0 := by rw [← C_1, smeval_C] simp only [Nat.cast_one, one_smul] @[simp] theorem smeval_X : (X : R[X]).smeval x = x ^ 1 := by simp only [smeval_eq_sum, smul_pow, zero_smul, sum_X_index, one_smul] @[simp]
Mathlib/Algebra/Polynomial/Smeval.lean
93
95
theorem smeval_X_pow {n : β„•} : (X ^ n : R[X]).smeval x = x ^ n := by
simp only [smeval_eq_sum, smul_pow, X_pow_eq_monomial, zero_smul, sum_monomial_index, one_smul]
1,825
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := βˆ‘ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
37
39
theorem coeff_scaleRoots (p : R[X]) (s : R) (i : β„•) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by
simp (config := { contextual := true }) [scaleRoots, coeff_monomial]
1,826
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := βˆ‘ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : β„•) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
42
44
theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by
rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one]
1,826
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := βˆ‘ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : β„•) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one] #align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree @[simp]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
48
50
theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by
ext simp
1,826
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := βˆ‘ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : β„•) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one] #align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree @[simp] theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by ext simp #align polynomial.zero_scale_roots Polynomial.zero_scaleRoots
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
53
59
theorem scaleRoots_ne_zero {p : R[X]} (hp : p β‰  0) (s : R) : scaleRoots p s β‰  0 := by
intro h have : p.coeff p.natDegree β‰  0 := mt leadingCoeff_eq_zero.mp hp have : (scaleRoots p s).coeff p.natDegree = 0 := congr_fun (congr_arg (coeff : R[X] β†’ β„• β†’ R) h) p.natDegree rw [coeff_scaleRoots_natDegree] at this contradiction
1,826
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := βˆ‘ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : β„•) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one] #align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree @[simp] theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by ext simp #align polynomial.zero_scale_roots Polynomial.zero_scaleRoots theorem scaleRoots_ne_zero {p : R[X]} (hp : p β‰  0) (s : R) : scaleRoots p s β‰  0 := by intro h have : p.coeff p.natDegree β‰  0 := mt leadingCoeff_eq_zero.mp hp have : (scaleRoots p s).coeff p.natDegree = 0 := congr_fun (congr_arg (coeff : R[X] β†’ β„• β†’ R) h) p.natDegree rw [coeff_scaleRoots_natDegree] at this contradiction #align polynomial.scale_roots_ne_zero Polynomial.scaleRoots_ne_zero
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
62
64
theorem support_scaleRoots_le (p : R[X]) (s : R) : (scaleRoots p s).support ≀ p.support := by
intro simpa using left_ne_zero_of_mul
1,826
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := βˆ‘ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : β„•) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one] #align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree @[simp] theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by ext simp #align polynomial.zero_scale_roots Polynomial.zero_scaleRoots theorem scaleRoots_ne_zero {p : R[X]} (hp : p β‰  0) (s : R) : scaleRoots p s β‰  0 := by intro h have : p.coeff p.natDegree β‰  0 := mt leadingCoeff_eq_zero.mp hp have : (scaleRoots p s).coeff p.natDegree = 0 := congr_fun (congr_arg (coeff : R[X] β†’ β„• β†’ R) h) p.natDegree rw [coeff_scaleRoots_natDegree] at this contradiction #align polynomial.scale_roots_ne_zero Polynomial.scaleRoots_ne_zero theorem support_scaleRoots_le (p : R[X]) (s : R) : (scaleRoots p s).support ≀ p.support := by intro simpa using left_ne_zero_of_mul #align polynomial.support_scale_roots_le Polynomial.support_scaleRoots_le theorem support_scaleRoots_eq (p : R[X]) {s : R} (hs : s ∈ nonZeroDivisors R) : (scaleRoots p s).support = p.support := le_antisymm (support_scaleRoots_le p s) (by intro i simp only [coeff_scaleRoots, Polynomial.mem_support_iff] intro p_ne_zero ps_zero have := pow_mem hs (p.natDegree - i) _ ps_zero contradiction) #align polynomial.support_scale_roots_eq Polynomial.support_scaleRoots_eq @[simp]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
78
86
theorem degree_scaleRoots (p : R[X]) {s : R} : degree (scaleRoots p s) = degree p := by
haveI := Classical.propDecidable by_cases hp : p = 0 Β· rw [hp, zero_scaleRoots] refine le_antisymm (Finset.sup_mono (support_scaleRoots_le p s)) (degree_le_degree ?_) rw [coeff_scaleRoots_natDegree] intro h have := leadingCoeff_eq_zero.mp h contradiction
1,826
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := βˆ‘ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : β„•) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one] #align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree @[simp] theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by ext simp #align polynomial.zero_scale_roots Polynomial.zero_scaleRoots theorem scaleRoots_ne_zero {p : R[X]} (hp : p β‰  0) (s : R) : scaleRoots p s β‰  0 := by intro h have : p.coeff p.natDegree β‰  0 := mt leadingCoeff_eq_zero.mp hp have : (scaleRoots p s).coeff p.natDegree = 0 := congr_fun (congr_arg (coeff : R[X] β†’ β„• β†’ R) h) p.natDegree rw [coeff_scaleRoots_natDegree] at this contradiction #align polynomial.scale_roots_ne_zero Polynomial.scaleRoots_ne_zero theorem support_scaleRoots_le (p : R[X]) (s : R) : (scaleRoots p s).support ≀ p.support := by intro simpa using left_ne_zero_of_mul #align polynomial.support_scale_roots_le Polynomial.support_scaleRoots_le theorem support_scaleRoots_eq (p : R[X]) {s : R} (hs : s ∈ nonZeroDivisors R) : (scaleRoots p s).support = p.support := le_antisymm (support_scaleRoots_le p s) (by intro i simp only [coeff_scaleRoots, Polynomial.mem_support_iff] intro p_ne_zero ps_zero have := pow_mem hs (p.natDegree - i) _ ps_zero contradiction) #align polynomial.support_scale_roots_eq Polynomial.support_scaleRoots_eq @[simp] theorem degree_scaleRoots (p : R[X]) {s : R} : degree (scaleRoots p s) = degree p := by haveI := Classical.propDecidable by_cases hp : p = 0 Β· rw [hp, zero_scaleRoots] refine le_antisymm (Finset.sup_mono (support_scaleRoots_le p s)) (degree_le_degree ?_) rw [coeff_scaleRoots_natDegree] intro h have := leadingCoeff_eq_zero.mp h contradiction #align polynomial.degree_scale_roots Polynomial.degree_scaleRoots @[simp]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
90
91
theorem natDegree_scaleRoots (p : R[X]) (s : R) : natDegree (scaleRoots p s) = natDegree p := by
simp only [natDegree, degree_scaleRoots]
1,826
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := βˆ‘ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : β„•) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one] #align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree @[simp] theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by ext simp #align polynomial.zero_scale_roots Polynomial.zero_scaleRoots theorem scaleRoots_ne_zero {p : R[X]} (hp : p β‰  0) (s : R) : scaleRoots p s β‰  0 := by intro h have : p.coeff p.natDegree β‰  0 := mt leadingCoeff_eq_zero.mp hp have : (scaleRoots p s).coeff p.natDegree = 0 := congr_fun (congr_arg (coeff : R[X] β†’ β„• β†’ R) h) p.natDegree rw [coeff_scaleRoots_natDegree] at this contradiction #align polynomial.scale_roots_ne_zero Polynomial.scaleRoots_ne_zero theorem support_scaleRoots_le (p : R[X]) (s : R) : (scaleRoots p s).support ≀ p.support := by intro simpa using left_ne_zero_of_mul #align polynomial.support_scale_roots_le Polynomial.support_scaleRoots_le theorem support_scaleRoots_eq (p : R[X]) {s : R} (hs : s ∈ nonZeroDivisors R) : (scaleRoots p s).support = p.support := le_antisymm (support_scaleRoots_le p s) (by intro i simp only [coeff_scaleRoots, Polynomial.mem_support_iff] intro p_ne_zero ps_zero have := pow_mem hs (p.natDegree - i) _ ps_zero contradiction) #align polynomial.support_scale_roots_eq Polynomial.support_scaleRoots_eq @[simp] theorem degree_scaleRoots (p : R[X]) {s : R} : degree (scaleRoots p s) = degree p := by haveI := Classical.propDecidable by_cases hp : p = 0 Β· rw [hp, zero_scaleRoots] refine le_antisymm (Finset.sup_mono (support_scaleRoots_le p s)) (degree_le_degree ?_) rw [coeff_scaleRoots_natDegree] intro h have := leadingCoeff_eq_zero.mp h contradiction #align polynomial.degree_scale_roots Polynomial.degree_scaleRoots @[simp] theorem natDegree_scaleRoots (p : R[X]) (s : R) : natDegree (scaleRoots p s) = natDegree p := by simp only [natDegree, degree_scaleRoots] #align polynomial.nat_degree_scale_roots Polynomial.natDegree_scaleRoots
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
94
95
theorem monic_scaleRoots_iff {p : R[X]} (s : R) : Monic (scaleRoots p s) ↔ Monic p := by
simp only [Monic, leadingCoeff, natDegree_scaleRoots, coeff_scaleRoots_natDegree]
1,826
import Mathlib.Algebra.GroupWithZero.NonZeroDivisors import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.RingTheory.Coprime.Basic import Mathlib.Tactic.AdaptationNote #align_import ring_theory.polynomial.scale_roots from "leanprover-community/mathlib"@"40ac1b258344e0c2b4568dc37bfad937ec35a727" variable {R S A K : Type*} namespace Polynomial open Polynomial section Semiring variable [Semiring R] [Semiring S] noncomputable def scaleRoots (p : R[X]) (s : R) : R[X] := βˆ‘ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) #align polynomial.scale_roots Polynomial.scaleRoots @[simp] theorem coeff_scaleRoots (p : R[X]) (s : R) (i : β„•) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp (config := { contextual := true }) [scaleRoots, coeff_monomial] #align polynomial.coeff_scale_roots Polynomial.coeff_scaleRoots theorem coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one] #align polynomial.coeff_scale_roots_nat_degree Polynomial.coeff_scaleRoots_natDegree @[simp] theorem zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by ext simp #align polynomial.zero_scale_roots Polynomial.zero_scaleRoots theorem scaleRoots_ne_zero {p : R[X]} (hp : p β‰  0) (s : R) : scaleRoots p s β‰  0 := by intro h have : p.coeff p.natDegree β‰  0 := mt leadingCoeff_eq_zero.mp hp have : (scaleRoots p s).coeff p.natDegree = 0 := congr_fun (congr_arg (coeff : R[X] β†’ β„• β†’ R) h) p.natDegree rw [coeff_scaleRoots_natDegree] at this contradiction #align polynomial.scale_roots_ne_zero Polynomial.scaleRoots_ne_zero theorem support_scaleRoots_le (p : R[X]) (s : R) : (scaleRoots p s).support ≀ p.support := by intro simpa using left_ne_zero_of_mul #align polynomial.support_scale_roots_le Polynomial.support_scaleRoots_le theorem support_scaleRoots_eq (p : R[X]) {s : R} (hs : s ∈ nonZeroDivisors R) : (scaleRoots p s).support = p.support := le_antisymm (support_scaleRoots_le p s) (by intro i simp only [coeff_scaleRoots, Polynomial.mem_support_iff] intro p_ne_zero ps_zero have := pow_mem hs (p.natDegree - i) _ ps_zero contradiction) #align polynomial.support_scale_roots_eq Polynomial.support_scaleRoots_eq @[simp] theorem degree_scaleRoots (p : R[X]) {s : R} : degree (scaleRoots p s) = degree p := by haveI := Classical.propDecidable by_cases hp : p = 0 Β· rw [hp, zero_scaleRoots] refine le_antisymm (Finset.sup_mono (support_scaleRoots_le p s)) (degree_le_degree ?_) rw [coeff_scaleRoots_natDegree] intro h have := leadingCoeff_eq_zero.mp h contradiction #align polynomial.degree_scale_roots Polynomial.degree_scaleRoots @[simp] theorem natDegree_scaleRoots (p : R[X]) (s : R) : natDegree (scaleRoots p s) = natDegree p := by simp only [natDegree, degree_scaleRoots] #align polynomial.nat_degree_scale_roots Polynomial.natDegree_scaleRoots theorem monic_scaleRoots_iff {p : R[X]} (s : R) : Monic (scaleRoots p s) ↔ Monic p := by simp only [Monic, leadingCoeff, natDegree_scaleRoots, coeff_scaleRoots_natDegree] #align polynomial.monic_scale_roots_iff Polynomial.monic_scaleRoots_iff
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
98
101
theorem map_scaleRoots (p : R[X]) (x : R) (f : R β†’+* S) (h : f p.leadingCoeff β‰  0) : (p.scaleRoots x).map f = (p.map f).scaleRoots (f x) := by
ext simp [Polynomial.natDegree_map_of_leadingCoeff_ne_zero _ h]
1,826
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section CommRing variable [CommRing R] {p q : R[X]} section variable [Semiring S] theorem natDegree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p β‰  0) {z : S} (hz : aeval z p = 0) (inj : βˆ€ x : R, algebraMap R S x = 0 β†’ x = 0) : 0 < p.natDegree := natDegree_pos_of_evalβ‚‚_root hp (algebraMap R S) hz inj #align polynomial.nat_degree_pos_of_aeval_root Polynomial.natDegree_pos_of_aeval_root theorem degree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p β‰  0) {z : S} (hz : aeval z p = 0) (inj : βˆ€ x : R, algebraMap R S x = 0 β†’ x = 0) : 0 < p.degree := natDegree_pos_iff_degree_pos.mp (natDegree_pos_of_aeval_root hp hz inj) #align polynomial.degree_pos_of_aeval_root Polynomial.degree_pos_of_aeval_root
Mathlib/Algebra/Polynomial/RingDivision.lean
50
55
theorem modByMonic_eq_of_dvd_sub (hq : q.Monic) {p₁ pβ‚‚ : R[X]} (h : q ∣ p₁ - pβ‚‚) : p₁ %β‚˜ q = pβ‚‚ %β‚˜ q := by
nontriviality R obtain ⟨f, sub_eq⟩ := h refine (div_modByMonic_unique (pβ‚‚ /β‚˜ q + f) _ hq ⟨?_, degree_modByMonic_lt _ hq⟩).2 rw [sub_eq_iff_eq_add.mp sub_eq, mul_add, ← add_assoc, modByMonic_add_div _ hq, add_comm]
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section CommRing variable [CommRing R] {p q : R[X]} section variable [Semiring S] theorem natDegree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p β‰  0) {z : S} (hz : aeval z p = 0) (inj : βˆ€ x : R, algebraMap R S x = 0 β†’ x = 0) : 0 < p.natDegree := natDegree_pos_of_evalβ‚‚_root hp (algebraMap R S) hz inj #align polynomial.nat_degree_pos_of_aeval_root Polynomial.natDegree_pos_of_aeval_root theorem degree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p β‰  0) {z : S} (hz : aeval z p = 0) (inj : βˆ€ x : R, algebraMap R S x = 0 β†’ x = 0) : 0 < p.degree := natDegree_pos_iff_degree_pos.mp (natDegree_pos_of_aeval_root hp hz inj) #align polynomial.degree_pos_of_aeval_root Polynomial.degree_pos_of_aeval_root theorem modByMonic_eq_of_dvd_sub (hq : q.Monic) {p₁ pβ‚‚ : R[X]} (h : q ∣ p₁ - pβ‚‚) : p₁ %β‚˜ q = pβ‚‚ %β‚˜ q := by nontriviality R obtain ⟨f, sub_eq⟩ := h refine (div_modByMonic_unique (pβ‚‚ /β‚˜ q + f) _ hq ⟨?_, degree_modByMonic_lt _ hq⟩).2 rw [sub_eq_iff_eq_add.mp sub_eq, mul_add, ← add_assoc, modByMonic_add_div _ hq, add_comm] #align polynomial.mod_by_monic_eq_of_dvd_sub Polynomial.modByMonic_eq_of_dvd_sub
Mathlib/Algebra/Polynomial/RingDivision.lean
58
69
theorem add_modByMonic (p₁ pβ‚‚ : R[X]) : (p₁ + pβ‚‚) %β‚˜ q = p₁ %β‚˜ q + pβ‚‚ %β‚˜ q := by
by_cases hq : q.Monic Β· cases' subsingleton_or_nontrivial R with hR hR Β· simp only [eq_iff_true_of_subsingleton] Β· exact (div_modByMonic_unique (p₁ /β‚˜ q + pβ‚‚ /β‚˜ q) _ hq ⟨by rw [mul_add, add_left_comm, add_assoc, modByMonic_add_div _ hq, ← add_assoc, add_comm (q * _), modByMonic_add_div _ hq], (degree_add_le _ _).trans_lt (max_lt (degree_modByMonic_lt _ hq) (degree_modByMonic_lt _ hq))⟩).2 Β· simp_rw [modByMonic_eq_of_not_monic _ hq]
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section CommRing variable [CommRing R] {p q : R[X]} section variable [Semiring S] theorem natDegree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p β‰  0) {z : S} (hz : aeval z p = 0) (inj : βˆ€ x : R, algebraMap R S x = 0 β†’ x = 0) : 0 < p.natDegree := natDegree_pos_of_evalβ‚‚_root hp (algebraMap R S) hz inj #align polynomial.nat_degree_pos_of_aeval_root Polynomial.natDegree_pos_of_aeval_root theorem degree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p β‰  0) {z : S} (hz : aeval z p = 0) (inj : βˆ€ x : R, algebraMap R S x = 0 β†’ x = 0) : 0 < p.degree := natDegree_pos_iff_degree_pos.mp (natDegree_pos_of_aeval_root hp hz inj) #align polynomial.degree_pos_of_aeval_root Polynomial.degree_pos_of_aeval_root theorem modByMonic_eq_of_dvd_sub (hq : q.Monic) {p₁ pβ‚‚ : R[X]} (h : q ∣ p₁ - pβ‚‚) : p₁ %β‚˜ q = pβ‚‚ %β‚˜ q := by nontriviality R obtain ⟨f, sub_eq⟩ := h refine (div_modByMonic_unique (pβ‚‚ /β‚˜ q + f) _ hq ⟨?_, degree_modByMonic_lt _ hq⟩).2 rw [sub_eq_iff_eq_add.mp sub_eq, mul_add, ← add_assoc, modByMonic_add_div _ hq, add_comm] #align polynomial.mod_by_monic_eq_of_dvd_sub Polynomial.modByMonic_eq_of_dvd_sub theorem add_modByMonic (p₁ pβ‚‚ : R[X]) : (p₁ + pβ‚‚) %β‚˜ q = p₁ %β‚˜ q + pβ‚‚ %β‚˜ q := by by_cases hq : q.Monic Β· cases' subsingleton_or_nontrivial R with hR hR Β· simp only [eq_iff_true_of_subsingleton] Β· exact (div_modByMonic_unique (p₁ /β‚˜ q + pβ‚‚ /β‚˜ q) _ hq ⟨by rw [mul_add, add_left_comm, add_assoc, modByMonic_add_div _ hq, ← add_assoc, add_comm (q * _), modByMonic_add_div _ hq], (degree_add_le _ _).trans_lt (max_lt (degree_modByMonic_lt _ hq) (degree_modByMonic_lt _ hq))⟩).2 Β· simp_rw [modByMonic_eq_of_not_monic _ hq] #align polynomial.add_mod_by_monic Polynomial.add_modByMonic
Mathlib/Algebra/Polynomial/RingDivision.lean
72
80
theorem smul_modByMonic (c : R) (p : R[X]) : c β€’ p %β‚˜ q = c β€’ (p %β‚˜ q) := by
by_cases hq : q.Monic Β· cases' subsingleton_or_nontrivial R with hR hR Β· simp only [eq_iff_true_of_subsingleton] Β· exact (div_modByMonic_unique (c β€’ (p /β‚˜ q)) (c β€’ (p %β‚˜ q)) hq ⟨by rw [mul_smul_comm, ← smul_add, modByMonic_add_div p hq], (degree_smul_le _ _).trans_lt (degree_modByMonic_lt _ hq)⟩).2 Β· simp_rw [modByMonic_eq_of_not_monic _ hq]
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section CommRing variable [CommRing R] {p q : R[X]} section variable [Semiring S] theorem natDegree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p β‰  0) {z : S} (hz : aeval z p = 0) (inj : βˆ€ x : R, algebraMap R S x = 0 β†’ x = 0) : 0 < p.natDegree := natDegree_pos_of_evalβ‚‚_root hp (algebraMap R S) hz inj #align polynomial.nat_degree_pos_of_aeval_root Polynomial.natDegree_pos_of_aeval_root theorem degree_pos_of_aeval_root [Algebra R S] {p : R[X]} (hp : p β‰  0) {z : S} (hz : aeval z p = 0) (inj : βˆ€ x : R, algebraMap R S x = 0 β†’ x = 0) : 0 < p.degree := natDegree_pos_iff_degree_pos.mp (natDegree_pos_of_aeval_root hp hz inj) #align polynomial.degree_pos_of_aeval_root Polynomial.degree_pos_of_aeval_root theorem modByMonic_eq_of_dvd_sub (hq : q.Monic) {p₁ pβ‚‚ : R[X]} (h : q ∣ p₁ - pβ‚‚) : p₁ %β‚˜ q = pβ‚‚ %β‚˜ q := by nontriviality R obtain ⟨f, sub_eq⟩ := h refine (div_modByMonic_unique (pβ‚‚ /β‚˜ q + f) _ hq ⟨?_, degree_modByMonic_lt _ hq⟩).2 rw [sub_eq_iff_eq_add.mp sub_eq, mul_add, ← add_assoc, modByMonic_add_div _ hq, add_comm] #align polynomial.mod_by_monic_eq_of_dvd_sub Polynomial.modByMonic_eq_of_dvd_sub theorem add_modByMonic (p₁ pβ‚‚ : R[X]) : (p₁ + pβ‚‚) %β‚˜ q = p₁ %β‚˜ q + pβ‚‚ %β‚˜ q := by by_cases hq : q.Monic Β· cases' subsingleton_or_nontrivial R with hR hR Β· simp only [eq_iff_true_of_subsingleton] Β· exact (div_modByMonic_unique (p₁ /β‚˜ q + pβ‚‚ /β‚˜ q) _ hq ⟨by rw [mul_add, add_left_comm, add_assoc, modByMonic_add_div _ hq, ← add_assoc, add_comm (q * _), modByMonic_add_div _ hq], (degree_add_le _ _).trans_lt (max_lt (degree_modByMonic_lt _ hq) (degree_modByMonic_lt _ hq))⟩).2 Β· simp_rw [modByMonic_eq_of_not_monic _ hq] #align polynomial.add_mod_by_monic Polynomial.add_modByMonic theorem smul_modByMonic (c : R) (p : R[X]) : c β€’ p %β‚˜ q = c β€’ (p %β‚˜ q) := by by_cases hq : q.Monic Β· cases' subsingleton_or_nontrivial R with hR hR Β· simp only [eq_iff_true_of_subsingleton] Β· exact (div_modByMonic_unique (c β€’ (p /β‚˜ q)) (c β€’ (p %β‚˜ q)) hq ⟨by rw [mul_smul_comm, ← smul_add, modByMonic_add_div p hq], (degree_smul_le _ _).trans_lt (degree_modByMonic_lt _ hq)⟩).2 Β· simp_rw [modByMonic_eq_of_not_monic _ hq] #align polynomial.smul_mod_by_monic Polynomial.smul_modByMonic @[simps] def modByMonicHom (q : R[X]) : R[X] β†’β‚—[R] R[X] where toFun p := p %β‚˜ q map_add' := add_modByMonic map_smul' := smul_modByMonic #align polynomial.mod_by_monic_hom Polynomial.modByMonicHom theorem neg_modByMonic (p mod : R[X]) : (-p) %β‚˜ mod = - (p %β‚˜ mod) := (modByMonicHom mod).map_neg p theorem sub_modByMonic (a b mod : R[X]) : (a - b) %β‚˜ mod = a %β‚˜ mod - b %β‚˜ mod := (modByMonicHom mod).map_sub a b end section variable [Ring S]
Mathlib/Algebra/Polynomial/RingDivision.lean
103
107
theorem aeval_modByMonic_eq_self_of_root [Algebra R S] {p q : R[X]} (hq : q.Monic) {x : S} (hx : aeval x q = 0) : aeval x (p %β‚˜ q) = aeval x p := by
--`evalβ‚‚_modByMonic_eq_self_of_root` doesn't work here as it needs commutativity rw [modByMonic_eq_sub_mul_div p hq, _root_.map_sub, _root_.map_mul, hx, zero_mul, sub_zero]
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h]
Mathlib/Algebra/Polynomial/RingDivision.lean
124
126
theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by
rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul]
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul
Mathlib/Algebra/Polynomial/RingDivision.lean
129
136
theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by
by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp]
Mathlib/Algebra/Polynomial/RingDivision.lean
140
145
theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by
classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow
Mathlib/Algebra/Polynomial/RingDivision.lean
148
153
theorem degree_le_mul_left (p : R[X]) (hq : q β‰  0) : degree p ≀ degree (p * q) := by
classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _)
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow theorem degree_le_mul_left (p : R[X]) (hq : q β‰  0) : degree p ≀ degree (p * q) := by classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _) #align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left
Mathlib/Algebra/Polynomial/RingDivision.lean
156
158
theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : p.natDegree ≀ q.natDegree := by
rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow theorem degree_le_mul_left (p : R[X]) (hq : q β‰  0) : degree p ≀ degree (p * q) := by classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _) #align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : p.natDegree ≀ q.natDegree := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _ #align polynomial.nat_degree_le_of_dvd Polynomial.natDegree_le_of_dvd
Mathlib/Algebra/Polynomial/RingDivision.lean
161
163
theorem degree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : degree p ≀ degree q := by
rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 exact degree_le_mul_left p h2.2
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow theorem degree_le_mul_left (p : R[X]) (hq : q β‰  0) : degree p ≀ degree (p * q) := by classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _) #align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : p.natDegree ≀ q.natDegree := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _ #align polynomial.nat_degree_le_of_dvd Polynomial.natDegree_le_of_dvd theorem degree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : degree p ≀ degree q := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 exact degree_le_mul_left p h2.2 #align polynomial.degree_le_of_dvd Polynomial.degree_le_of_dvd
Mathlib/Algebra/Polynomial/RingDivision.lean
166
169
theorem eq_zero_of_dvd_of_degree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : degree q < degree p) : q = 0 := by
by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (degree_le_of_dvd h₁ hc)
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow theorem degree_le_mul_left (p : R[X]) (hq : q β‰  0) : degree p ≀ degree (p * q) := by classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _) #align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : p.natDegree ≀ q.natDegree := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _ #align polynomial.nat_degree_le_of_dvd Polynomial.natDegree_le_of_dvd theorem degree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : degree p ≀ degree q := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 exact degree_le_mul_left p h2.2 #align polynomial.degree_le_of_dvd Polynomial.degree_le_of_dvd theorem eq_zero_of_dvd_of_degree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : degree q < degree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (degree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_degree_lt Polynomial.eq_zero_of_dvd_of_degree_lt
Mathlib/Algebra/Polynomial/RingDivision.lean
172
175
theorem eq_zero_of_dvd_of_natDegree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : natDegree q < natDegree p) : q = 0 := by
by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (natDegree_le_of_dvd h₁ hc)
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow theorem degree_le_mul_left (p : R[X]) (hq : q β‰  0) : degree p ≀ degree (p * q) := by classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _) #align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : p.natDegree ≀ q.natDegree := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _ #align polynomial.nat_degree_le_of_dvd Polynomial.natDegree_le_of_dvd theorem degree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : degree p ≀ degree q := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 exact degree_le_mul_left p h2.2 #align polynomial.degree_le_of_dvd Polynomial.degree_le_of_dvd theorem eq_zero_of_dvd_of_degree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : degree q < degree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (degree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_degree_lt Polynomial.eq_zero_of_dvd_of_degree_lt theorem eq_zero_of_dvd_of_natDegree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : natDegree q < natDegree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (natDegree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_nat_degree_lt Polynomial.eq_zero_of_dvd_of_natDegree_lt
Mathlib/Algebra/Polynomial/RingDivision.lean
178
180
theorem not_dvd_of_degree_lt {p q : R[X]} (h0 : q β‰  0) (hl : q.degree < p.degree) : Β¬p ∣ q := by
by_contra hcontra exact h0 (eq_zero_of_dvd_of_degree_lt hcontra hl)
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow theorem degree_le_mul_left (p : R[X]) (hq : q β‰  0) : degree p ≀ degree (p * q) := by classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _) #align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : p.natDegree ≀ q.natDegree := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _ #align polynomial.nat_degree_le_of_dvd Polynomial.natDegree_le_of_dvd theorem degree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : degree p ≀ degree q := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 exact degree_le_mul_left p h2.2 #align polynomial.degree_le_of_dvd Polynomial.degree_le_of_dvd theorem eq_zero_of_dvd_of_degree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : degree q < degree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (degree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_degree_lt Polynomial.eq_zero_of_dvd_of_degree_lt theorem eq_zero_of_dvd_of_natDegree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : natDegree q < natDegree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (natDegree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_nat_degree_lt Polynomial.eq_zero_of_dvd_of_natDegree_lt theorem not_dvd_of_degree_lt {p q : R[X]} (h0 : q β‰  0) (hl : q.degree < p.degree) : Β¬p ∣ q := by by_contra hcontra exact h0 (eq_zero_of_dvd_of_degree_lt hcontra hl) #align polynomial.not_dvd_of_degree_lt Polynomial.not_dvd_of_degree_lt
Mathlib/Algebra/Polynomial/RingDivision.lean
183
186
theorem not_dvd_of_natDegree_lt {p q : R[X]} (h0 : q β‰  0) (hl : q.natDegree < p.natDegree) : Β¬p ∣ q := by
by_contra hcontra exact h0 (eq_zero_of_dvd_of_natDegree_lt hcontra hl)
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow theorem degree_le_mul_left (p : R[X]) (hq : q β‰  0) : degree p ≀ degree (p * q) := by classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _) #align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : p.natDegree ≀ q.natDegree := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _ #align polynomial.nat_degree_le_of_dvd Polynomial.natDegree_le_of_dvd theorem degree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : degree p ≀ degree q := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 exact degree_le_mul_left p h2.2 #align polynomial.degree_le_of_dvd Polynomial.degree_le_of_dvd theorem eq_zero_of_dvd_of_degree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : degree q < degree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (degree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_degree_lt Polynomial.eq_zero_of_dvd_of_degree_lt theorem eq_zero_of_dvd_of_natDegree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : natDegree q < natDegree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (natDegree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_nat_degree_lt Polynomial.eq_zero_of_dvd_of_natDegree_lt theorem not_dvd_of_degree_lt {p q : R[X]} (h0 : q β‰  0) (hl : q.degree < p.degree) : Β¬p ∣ q := by by_contra hcontra exact h0 (eq_zero_of_dvd_of_degree_lt hcontra hl) #align polynomial.not_dvd_of_degree_lt Polynomial.not_dvd_of_degree_lt theorem not_dvd_of_natDegree_lt {p q : R[X]} (h0 : q β‰  0) (hl : q.natDegree < p.natDegree) : Β¬p ∣ q := by by_contra hcontra exact h0 (eq_zero_of_dvd_of_natDegree_lt hcontra hl) #align polynomial.not_dvd_of_nat_degree_lt Polynomial.not_dvd_of_natDegree_lt
Mathlib/Algebra/Polynomial/RingDivision.lean
190
195
theorem natDegree_sub_eq_of_prod_eq {p₁ pβ‚‚ q₁ qβ‚‚ : R[X]} (hp₁ : p₁ β‰  0) (hq₁ : q₁ β‰  0) (hpβ‚‚ : pβ‚‚ β‰  0) (hqβ‚‚ : qβ‚‚ β‰  0) (h_eq : p₁ * qβ‚‚ = pβ‚‚ * q₁) : (p₁.natDegree : β„€) - q₁.natDegree = (pβ‚‚.natDegree : β„€) - qβ‚‚.natDegree := by
rw [sub_eq_sub_iff_add_eq_add] norm_cast rw [← natDegree_mul hp₁ hqβ‚‚, ← natDegree_mul hpβ‚‚ hq₁, h_eq]
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [Semiring R] [NoZeroDivisors R] {p q : R[X]} instance : NoZeroDivisors R[X] where eq_zero_or_eq_zero_of_mul_eq_zero h := by rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero] refine eq_zero_or_eq_zero_of_mul_eq_zero ?_ rw [← leadingCoeff_zero, ← leadingCoeff_mul, h] theorem natDegree_mul (hp : p β‰  0) (hq : q β‰  0) : (p*q).natDegree = p.natDegree + q.natDegree := by rw [← Nat.cast_inj (R := WithBot β„•), ← degree_eq_natDegree (mul_ne_zero hp hq), Nat.cast_add, ← degree_eq_natDegree hp, ← degree_eq_natDegree hq, degree_mul] #align polynomial.nat_degree_mul Polynomial.natDegree_mul theorem trailingDegree_mul : (p * q).trailingDegree = p.trailingDegree + q.trailingDegree := by by_cases hp : p = 0 Β· rw [hp, zero_mul, trailingDegree_zero, top_add] by_cases hq : q = 0 Β· rw [hq, mul_zero, trailingDegree_zero, add_top] Β· rw [trailingDegree_eq_natTrailingDegree hp, trailingDegree_eq_natTrailingDegree hq, trailingDegree_eq_natTrailingDegree (mul_ne_zero hp hq), natTrailingDegree_mul hp hq] apply WithTop.coe_add #align polynomial.trailing_degree_mul Polynomial.trailingDegree_mul @[simp] theorem natDegree_pow (p : R[X]) (n : β„•) : natDegree (p ^ n) = n * natDegree p := by classical obtain rfl | hp := eq_or_ne p 0 Β· obtain rfl | hn := eq_or_ne n 0 <;> simp [*] exact natDegree_pow' $ by rw [← leadingCoeff_pow, Ne, leadingCoeff_eq_zero]; exact pow_ne_zero _ hp #align polynomial.nat_degree_pow Polynomial.natDegree_pow theorem degree_le_mul_left (p : R[X]) (hq : q β‰  0) : degree p ≀ degree (p * q) := by classical exact if hp : p = 0 then by simp only [hp, zero_mul, le_refl] else by rw [degree_mul, degree_eq_natDegree hp, degree_eq_natDegree hq]; exact WithBot.coe_le_coe.2 (Nat.le_add_right _ _) #align polynomial.degree_le_mul_left Polynomial.degree_le_mul_left theorem natDegree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : p.natDegree ≀ q.natDegree := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 rw [natDegree_mul h2.1 h2.2]; exact Nat.le_add_right _ _ #align polynomial.nat_degree_le_of_dvd Polynomial.natDegree_le_of_dvd theorem degree_le_of_dvd {p q : R[X]} (h1 : p ∣ q) (h2 : q β‰  0) : degree p ≀ degree q := by rcases h1 with ⟨q, rfl⟩; rw [mul_ne_zero_iff] at h2 exact degree_le_mul_left p h2.2 #align polynomial.degree_le_of_dvd Polynomial.degree_le_of_dvd theorem eq_zero_of_dvd_of_degree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : degree q < degree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (degree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_degree_lt Polynomial.eq_zero_of_dvd_of_degree_lt theorem eq_zero_of_dvd_of_natDegree_lt {p q : R[X]} (h₁ : p ∣ q) (hβ‚‚ : natDegree q < natDegree p) : q = 0 := by by_contra hc exact (lt_iff_not_ge _ _).mp hβ‚‚ (natDegree_le_of_dvd h₁ hc) #align polynomial.eq_zero_of_dvd_of_nat_degree_lt Polynomial.eq_zero_of_dvd_of_natDegree_lt theorem not_dvd_of_degree_lt {p q : R[X]} (h0 : q β‰  0) (hl : q.degree < p.degree) : Β¬p ∣ q := by by_contra hcontra exact h0 (eq_zero_of_dvd_of_degree_lt hcontra hl) #align polynomial.not_dvd_of_degree_lt Polynomial.not_dvd_of_degree_lt theorem not_dvd_of_natDegree_lt {p q : R[X]} (h0 : q β‰  0) (hl : q.natDegree < p.natDegree) : Β¬p ∣ q := by by_contra hcontra exact h0 (eq_zero_of_dvd_of_natDegree_lt hcontra hl) #align polynomial.not_dvd_of_nat_degree_lt Polynomial.not_dvd_of_natDegree_lt theorem natDegree_sub_eq_of_prod_eq {p₁ pβ‚‚ q₁ qβ‚‚ : R[X]} (hp₁ : p₁ β‰  0) (hq₁ : q₁ β‰  0) (hpβ‚‚ : pβ‚‚ β‰  0) (hqβ‚‚ : qβ‚‚ β‰  0) (h_eq : p₁ * qβ‚‚ = pβ‚‚ * q₁) : (p₁.natDegree : β„€) - q₁.natDegree = (pβ‚‚.natDegree : β„€) - qβ‚‚.natDegree := by rw [sub_eq_sub_iff_add_eq_add] norm_cast rw [← natDegree_mul hp₁ hqβ‚‚, ← natDegree_mul hpβ‚‚ hq₁, h_eq] #align polynomial.nat_degree_sub_eq_of_prod_eq Polynomial.natDegree_sub_eq_of_prod_eq
Mathlib/Algebra/Polynomial/RingDivision.lean
198
203
theorem natDegree_eq_zero_of_isUnit (h : IsUnit p) : natDegree p = 0 := by
nontriviality R obtain ⟨q, hq⟩ := h.exists_right_inv have := natDegree_mul (left_ne_zero_of_mul_eq_one hq) (right_ne_zero_of_mul_eq_one hq) rw [hq, natDegree_one, eq_comm, add_eq_zero_iff] at this exact this.1
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]}
Mathlib/Algebra/Polynomial/RingDivision.lean
245
256
theorem irreducible_of_monic (hp : p.Monic) (hp1 : p β‰  1) : Irreducible p ↔ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f = 1 ∨ g = 1 := by
refine ⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h => ⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg => (h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp (isUnit_of_mul_eq_one f _) (isUnit_of_mul_eq_one g _)⟩⟩ Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic] Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic] Β· rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one, mul_comm, ← hfg]
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]} theorem irreducible_of_monic (hp : p.Monic) (hp1 : p β‰  1) : Irreducible p ↔ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f = 1 ∨ g = 1 := by refine ⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h => ⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg => (h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp (isUnit_of_mul_eq_one f _) (isUnit_of_mul_eq_one g _)⟩⟩ Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic] Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic] Β· rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one, mul_comm, ← hfg] #align polynomial.irreducible_of_monic Polynomial.irreducible_of_monic
Mathlib/Algebra/Polynomial/RingDivision.lean
259
265
theorem Monic.irreducible_iff_natDegree (hp : p.Monic) : Irreducible p ↔ p β‰  1 ∧ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f.natDegree = 0 ∨ g.natDegree = 0 := by
by_cases hp1 : p = 1; Β· simp [hp1] rw [irreducible_of_monic hp hp1, and_iff_right hp1] refine forallβ‚„_congr fun a b ha hb => ?_ rw [ha.natDegree_eq_zero_iff_eq_one, hb.natDegree_eq_zero_iff_eq_one]
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]} theorem irreducible_of_monic (hp : p.Monic) (hp1 : p β‰  1) : Irreducible p ↔ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f = 1 ∨ g = 1 := by refine ⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h => ⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg => (h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp (isUnit_of_mul_eq_one f _) (isUnit_of_mul_eq_one g _)⟩⟩ Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic] Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic] Β· rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one, mul_comm, ← hfg] #align polynomial.irreducible_of_monic Polynomial.irreducible_of_monic theorem Monic.irreducible_iff_natDegree (hp : p.Monic) : Irreducible p ↔ p β‰  1 ∧ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f.natDegree = 0 ∨ g.natDegree = 0 := by by_cases hp1 : p = 1; Β· simp [hp1] rw [irreducible_of_monic hp hp1, and_iff_right hp1] refine forallβ‚„_congr fun a b ha hb => ?_ rw [ha.natDegree_eq_zero_iff_eq_one, hb.natDegree_eq_zero_iff_eq_one] #align polynomial.monic.irreducible_iff_nat_degree Polynomial.Monic.irreducible_iff_natDegree
Mathlib/Algebra/Polynomial/RingDivision.lean
268
279
theorem Monic.irreducible_iff_natDegree' (hp : p.Monic) : Irreducible p ↔ p β‰  1 ∧ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ g.natDegree βˆ‰ Ioc 0 (p.natDegree / 2) := by
simp_rw [hp.irreducible_iff_natDegree, mem_Ioc, Nat.le_div_iff_mul_le zero_lt_two, mul_two] apply and_congr_right' constructor <;> intro h f g hf hg he <;> subst he · rw [hf.natDegree_mul hg, add_le_add_iff_right] exact fun ha => (h f g hf hg rfl).elim (ha.1.trans_le ha.2).ne' ha.1.ne' · simp_rw [hf.natDegree_mul hg, pos_iff_ne_zero] at h contrapose! h obtain hl | hl := le_total f.natDegree g.natDegree · exact ⟨g, f, hg, hf, mul_comm g f, h.1, add_le_add_left hl _⟩ · exact ⟨f, g, hf, hg, rfl, h.2, add_le_add_right hl _⟩
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]} theorem irreducible_of_monic (hp : p.Monic) (hp1 : p β‰  1) : Irreducible p ↔ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f = 1 ∨ g = 1 := by refine ⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h => ⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg => (h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp (isUnit_of_mul_eq_one f _) (isUnit_of_mul_eq_one g _)⟩⟩ Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic] Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic] Β· rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one, mul_comm, ← hfg] #align polynomial.irreducible_of_monic Polynomial.irreducible_of_monic theorem Monic.irreducible_iff_natDegree (hp : p.Monic) : Irreducible p ↔ p β‰  1 ∧ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f.natDegree = 0 ∨ g.natDegree = 0 := by by_cases hp1 : p = 1; Β· simp [hp1] rw [irreducible_of_monic hp hp1, and_iff_right hp1] refine forallβ‚„_congr fun a b ha hb => ?_ rw [ha.natDegree_eq_zero_iff_eq_one, hb.natDegree_eq_zero_iff_eq_one] #align polynomial.monic.irreducible_iff_nat_degree Polynomial.Monic.irreducible_iff_natDegree theorem Monic.irreducible_iff_natDegree' (hp : p.Monic) : Irreducible p ↔ p β‰  1 ∧ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ g.natDegree βˆ‰ Ioc 0 (p.natDegree / 2) := by simp_rw [hp.irreducible_iff_natDegree, mem_Ioc, Nat.le_div_iff_mul_le zero_lt_two, mul_two] apply and_congr_right' constructor <;> intro h f g hf hg he <;> subst he Β· rw [hf.natDegree_mul hg, add_le_add_iff_right] exact fun ha => (h f g hf hg rfl).elim (ha.1.trans_le ha.2).ne' ha.1.ne' Β· simp_rw [hf.natDegree_mul hg, pos_iff_ne_zero] at h contrapose! h obtain hl | hl := le_total f.natDegree g.natDegree Β· exact ⟨g, f, hg, hf, mul_comm g f, h.1, add_le_add_left hl _⟩ Β· exact ⟨f, g, hf, hg, rfl, h.2, add_le_add_right hl _⟩ #align polynomial.monic.irreducible_iff_nat_degree' Polynomial.Monic.irreducible_iff_natDegree'
Mathlib/Algebra/Polynomial/RingDivision.lean
284
291
theorem Monic.irreducible_iff_lt_natDegree_lt {p : R[X]} (hp : p.Monic) (hp1 : p β‰  1) : Irreducible p ↔ βˆ€ q, Monic q β†’ natDegree q ∈ Finset.Ioc 0 (natDegree p / 2) β†’ Β¬ q ∣ p := by
rw [hp.irreducible_iff_natDegree', and_iff_right hp1] constructor · rintro h g hg hdg ⟨f, rfl⟩ exact h f g (hg.of_mul_monic_left hp) hg (mul_comm f g) hdg · rintro h f g - hg rfl hdg exact h g hg hdg (dvd_mul_left g f)
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]} theorem irreducible_of_monic (hp : p.Monic) (hp1 : p β‰  1) : Irreducible p ↔ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f = 1 ∨ g = 1 := by refine ⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h => ⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg => (h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp (isUnit_of_mul_eq_one f _) (isUnit_of_mul_eq_one g _)⟩⟩ Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic] Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic] Β· rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one, mul_comm, ← hfg] #align polynomial.irreducible_of_monic Polynomial.irreducible_of_monic theorem Monic.irreducible_iff_natDegree (hp : p.Monic) : Irreducible p ↔ p β‰  1 ∧ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f.natDegree = 0 ∨ g.natDegree = 0 := by by_cases hp1 : p = 1; Β· simp [hp1] rw [irreducible_of_monic hp hp1, and_iff_right hp1] refine forallβ‚„_congr fun a b ha hb => ?_ rw [ha.natDegree_eq_zero_iff_eq_one, hb.natDegree_eq_zero_iff_eq_one] #align polynomial.monic.irreducible_iff_nat_degree Polynomial.Monic.irreducible_iff_natDegree theorem Monic.irreducible_iff_natDegree' (hp : p.Monic) : Irreducible p ↔ p β‰  1 ∧ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ g.natDegree βˆ‰ Ioc 0 (p.natDegree / 2) := by simp_rw [hp.irreducible_iff_natDegree, mem_Ioc, Nat.le_div_iff_mul_le zero_lt_two, mul_two] apply and_congr_right' constructor <;> intro h f g hf hg he <;> subst he Β· rw [hf.natDegree_mul hg, add_le_add_iff_right] exact fun ha => (h f g hf hg rfl).elim (ha.1.trans_le ha.2).ne' ha.1.ne' Β· simp_rw [hf.natDegree_mul hg, pos_iff_ne_zero] at h contrapose! h obtain hl | hl := le_total f.natDegree g.natDegree Β· exact ⟨g, f, hg, hf, mul_comm g f, h.1, add_le_add_left hl _⟩ Β· exact ⟨f, g, hf, hg, rfl, h.2, add_le_add_right hl _⟩ #align polynomial.monic.irreducible_iff_nat_degree' Polynomial.Monic.irreducible_iff_natDegree' theorem Monic.irreducible_iff_lt_natDegree_lt {p : R[X]} (hp : p.Monic) (hp1 : p β‰  1) : Irreducible p ↔ βˆ€ q, Monic q β†’ natDegree q ∈ Finset.Ioc 0 (natDegree p / 2) β†’ Β¬ q ∣ p := by rw [hp.irreducible_iff_natDegree', and_iff_right hp1] constructor Β· rintro h g hg hdg ⟨f, rfl⟩ exact h f g (hg.of_mul_monic_left hp) hg (mul_comm f g) hdg Β· rintro h f g - hg rfl hdg exact h g hg hdg (dvd_mul_left g f)
Mathlib/Algebra/Polynomial/RingDivision.lean
293
316
theorem Monic.not_irreducible_iff_exists_add_mul_eq_coeff (hm : p.Monic) (hnd : p.natDegree = 2) : Β¬Irreducible p ↔ βˆƒ c₁ cβ‚‚, p.coeff 0 = c₁ * cβ‚‚ ∧ p.coeff 1 = c₁ + cβ‚‚ := by
cases subsingleton_or_nontrivial R Β· simp [natDegree_of_subsingleton] at hnd rw [hm.irreducible_iff_natDegree', and_iff_right, hnd] Β· push_neg constructor Β· rintro ⟨a, b, ha, hb, rfl, hdb⟩ simp only [zero_lt_two, Nat.div_self, ge_iff_le, Nat.Ioc_succ_singleton, zero_add, mem_singleton] at hdb have hda := hnd rw [ha.natDegree_mul hb, hdb] at hda use a.coeff 0, b.coeff 0, mul_coeff_zero a b simpa only [nextCoeff, hnd, add_right_cancel hda, hdb] using ha.nextCoeff_mul hb Β· rintro ⟨c₁, cβ‚‚, hmul, hadd⟩ refine ⟨X + C c₁, X + C cβ‚‚, monic_X_add_C _, monic_X_add_C _, ?_, ?_⟩ Β· rw [p.as_sum_range_C_mul_X_pow, hnd, Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_one, ← hnd, hm.coeff_natDegree, hnd, hmul, hadd, C_mul, C_add, C_1] ring Β· rw [mem_Ioc, natDegree_X_add_C _] simp Β· rintro rfl simp [natDegree_one] at hnd
1,827
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.BigOperators import Mathlib.Algebra.Polynomial.Degree.Lemmas import Mathlib.Algebra.Polynomial.Div #align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8" noncomputable section open Polynomial open Finset namespace Polynomial universe u v w z variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : β„•} section NoZeroDivisors variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]} theorem irreducible_of_monic (hp : p.Monic) (hp1 : p β‰  1) : Irreducible p ↔ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f = 1 ∨ g = 1 := by refine ⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h => ⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg => (h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp (isUnit_of_mul_eq_one f _) (isUnit_of_mul_eq_one g _)⟩⟩ Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic] Β· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic] Β· rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one, mul_comm, ← hfg] #align polynomial.irreducible_of_monic Polynomial.irreducible_of_monic theorem Monic.irreducible_iff_natDegree (hp : p.Monic) : Irreducible p ↔ p β‰  1 ∧ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ f.natDegree = 0 ∨ g.natDegree = 0 := by by_cases hp1 : p = 1; Β· simp [hp1] rw [irreducible_of_monic hp hp1, and_iff_right hp1] refine forallβ‚„_congr fun a b ha hb => ?_ rw [ha.natDegree_eq_zero_iff_eq_one, hb.natDegree_eq_zero_iff_eq_one] #align polynomial.monic.irreducible_iff_nat_degree Polynomial.Monic.irreducible_iff_natDegree theorem Monic.irreducible_iff_natDegree' (hp : p.Monic) : Irreducible p ↔ p β‰  1 ∧ βˆ€ f g : R[X], f.Monic β†’ g.Monic β†’ f * g = p β†’ g.natDegree βˆ‰ Ioc 0 (p.natDegree / 2) := by simp_rw [hp.irreducible_iff_natDegree, mem_Ioc, Nat.le_div_iff_mul_le zero_lt_two, mul_two] apply and_congr_right' constructor <;> intro h f g hf hg he <;> subst he Β· rw [hf.natDegree_mul hg, add_le_add_iff_right] exact fun ha => (h f g hf hg rfl).elim (ha.1.trans_le ha.2).ne' ha.1.ne' Β· simp_rw [hf.natDegree_mul hg, pos_iff_ne_zero] at h contrapose! h obtain hl | hl := le_total f.natDegree g.natDegree Β· exact ⟨g, f, hg, hf, mul_comm g f, h.1, add_le_add_left hl _⟩ Β· exact ⟨f, g, hf, hg, rfl, h.2, add_le_add_right hl _⟩ #align polynomial.monic.irreducible_iff_nat_degree' Polynomial.Monic.irreducible_iff_natDegree' theorem Monic.irreducible_iff_lt_natDegree_lt {p : R[X]} (hp : p.Monic) (hp1 : p β‰  1) : Irreducible p ↔ βˆ€ q, Monic q β†’ natDegree q ∈ Finset.Ioc 0 (natDegree p / 2) β†’ Β¬ q ∣ p := by rw [hp.irreducible_iff_natDegree', and_iff_right hp1] constructor Β· rintro h g hg hdg ⟨f, rfl⟩ exact h f g (hg.of_mul_monic_left hp) hg (mul_comm f g) hdg Β· rintro h f g - hg rfl hdg exact h g hg hdg (dvd_mul_left g f) theorem Monic.not_irreducible_iff_exists_add_mul_eq_coeff (hm : p.Monic) (hnd : p.natDegree = 2) : Β¬Irreducible p ↔ βˆƒ c₁ cβ‚‚, p.coeff 0 = c₁ * cβ‚‚ ∧ p.coeff 1 = c₁ + cβ‚‚ := by cases subsingleton_or_nontrivial R Β· simp [natDegree_of_subsingleton] at hnd rw [hm.irreducible_iff_natDegree', and_iff_right, hnd] Β· push_neg constructor Β· rintro ⟨a, b, ha, hb, rfl, hdb⟩ simp only [zero_lt_two, Nat.div_self, ge_iff_le, Nat.Ioc_succ_singleton, zero_add, mem_singleton] at hdb have hda := hnd rw [ha.natDegree_mul hb, hdb] at hda use a.coeff 0, b.coeff 0, mul_coeff_zero a b simpa only [nextCoeff, hnd, add_right_cancel hda, hdb] using ha.nextCoeff_mul hb Β· rintro ⟨c₁, cβ‚‚, hmul, hadd⟩ refine ⟨X + C c₁, X + C cβ‚‚, monic_X_add_C _, monic_X_add_C _, ?_, ?_⟩ Β· rw [p.as_sum_range_C_mul_X_pow, hnd, Finset.sum_range_succ, Finset.sum_range_succ, Finset.sum_range_one, ← hnd, hm.coeff_natDegree, hnd, hmul, hadd, C_mul, C_add, C_1] ring Β· rw [mem_Ioc, natDegree_X_add_C _] simp Β· rintro rfl simp [natDegree_one] at hnd #align polynomial.monic.not_irreducible_iff_exists_add_mul_eq_coeff Polynomial.Monic.not_irreducible_iff_exists_add_mul_eq_coeff
Mathlib/Algebra/Polynomial/RingDivision.lean
319
320
theorem root_mul : IsRoot (p * q) a ↔ IsRoot p a ∨ IsRoot q a := by
simp_rw [IsRoot, eval_mul, mul_eq_zero]
1,827