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.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS
Mathlib/Algebra/Polynomial/Lifts.lean
73
75
theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by
rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl
1,978
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts
Mathlib/Algebra/Polynomial/Lifts.lean
87
91
theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by
obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]
1,978
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts
Mathlib/Algebra/Polynomial/Lifts.lean
112
116
theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by
simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul]
1,978
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts
Mathlib/Algebra/Polynomial/Lifts.lean
120
124
theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by
obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]
1,978
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts
Mathlib/Algebra/Polynomial/Lifts.lean
128
136
theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by
rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff]
1,978
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff] #align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts section LiftDeg
Mathlib/Algebra/Polynomial/Lifts.lean
141
162
theorem monomial_mem_lifts_and_degree_eq {s : S} {n : ℕ} (hl : monomial n s ∈ lifts f) : ∃ q : R[X], map f q = monomial n s ∧ q.degree = (monomial n s).degree := by
by_cases hzero : s = 0 · use 0 simp only [hzero, degree_zero, eq_self_iff_true, and_self_iff, monomial_zero_right, Polynomial.map_zero] rw [lifts_iff_set_range] at hl obtain ⟨q, hq⟩ := hl replace hq := (ext_iff.1 hq) n have hcoeff : f (q.coeff n) = s := by simp? [coeff_monomial] at hq says simp only [coeff_map, coeff_monomial, ↓reduceIte] at hq exact hq use monomial n (q.coeff n) constructor · simp only [hcoeff, map_monomial] have hqzero : q.coeff n ≠ 0 := by intro habs simp only [habs, RingHom.map_zero] at hcoeff exact hzero hcoeff.symm rw [← C_mul_X_pow_eq_monomial] rw [← C_mul_X_pow_eq_monomial] simp only [hzero, hqzero, Ne, not_false_iff, degree_C_mul_X_pow]
1,978
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff] #align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts section Ring variable {R : Type u} [Ring R] {S : Type v} [Ring S] (f : R →+* S) def liftsRing (f : R →+* S) : Subring S[X] := RingHom.range (mapRingHom f) #align polynomial.lifts_ring Polynomial.liftsRing
Mathlib/Algebra/Polynomial/Lifts.lean
257
258
theorem lifts_iff_liftsRing (p : S[X]) : p ∈ lifts f ↔ p ∈ liftsRing f := by
simp only [lifts, liftsRing, RingHom.mem_range, RingHom.mem_rangeS]
1,978
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff] #align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts section Algebra variable {R : Type u} [CommSemiring R] {S : Type v} [Semiring S] [Algebra R S] def mapAlg (R : Type u) [CommSemiring R] (S : Type v) [Semiring S] [Algebra R S] : R[X] →ₐ[R] S[X] := @aeval _ S[X] _ _ _ (X : S[X]) #align polynomial.map_alg Polynomial.mapAlg
Mathlib/Algebra/Polynomial/Lifts.lean
274
276
theorem mapAlg_eq_map (p : R[X]) : mapAlg R S p = map (algebraMap R S) p := by
simp only [mapAlg, aeval_def, eval₂_eq_sum, map, algebraMap_apply, RingHom.coe_comp] ext; congr
1,978
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff] #align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts section Algebra variable {R : Type u} [CommSemiring R] {S : Type v} [Semiring S] [Algebra R S] def mapAlg (R : Type u) [CommSemiring R] (S : Type v) [Semiring S] [Algebra R S] : R[X] →ₐ[R] S[X] := @aeval _ S[X] _ _ _ (X : S[X]) #align polynomial.map_alg Polynomial.mapAlg theorem mapAlg_eq_map (p : R[X]) : mapAlg R S p = map (algebraMap R S) p := by simp only [mapAlg, aeval_def, eval₂_eq_sum, map, algebraMap_apply, RingHom.coe_comp] ext; congr #align polynomial.map_alg_eq_map Polynomial.mapAlg_eq_map
Mathlib/Algebra/Polynomial/Lifts.lean
280
282
theorem mem_lifts_iff_mem_alg (R : Type u) [CommSemiring R] {S : Type v} [Semiring S] [Algebra R S] (p : S[X]) : p ∈ lifts (algebraMap R S) ↔ p ∈ AlgHom.range (@mapAlg R _ S _ _) := by
simp only [coe_mapRingHom, lifts, mapAlg_eq_map, AlgHom.mem_range, RingHom.mem_rangeS]
1,978
import Mathlib.Algebra.Polynomial.AlgebraMap import Mathlib.Algebra.Polynomial.Monic #align_import data.polynomial.lifts from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0" open Polynomial noncomputable section namespace Polynomial universe u v w section Semiring variable {R : Type u} [Semiring R] {S : Type v} [Semiring S] {f : R →+* S} def lifts (f : R →+* S) : Subsemiring S[X] := RingHom.rangeS (mapRingHom f) #align polynomial.lifts Polynomial.lifts theorem mem_lifts (p : S[X]) : p ∈ lifts f ↔ ∃ q : R[X], map f q = p := by simp only [coe_mapRingHom, lifts, RingHom.mem_rangeS] #align polynomial.mem_lifts Polynomial.mem_lifts theorem lifts_iff_set_range (p : S[X]) : p ∈ lifts f ↔ p ∈ Set.range (map f) := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_set_range Polynomial.lifts_iff_set_range theorem lifts_iff_ringHom_rangeS (p : S[X]) : p ∈ lifts f ↔ p ∈ (mapRingHom f).rangeS := by simp only [coe_mapRingHom, lifts, Set.mem_range, RingHom.mem_rangeS] #align polynomial.lifts_iff_ring_hom_srange Polynomial.lifts_iff_ringHom_rangeS theorem lifts_iff_coeff_lifts (p : S[X]) : p ∈ lifts f ↔ ∀ n : ℕ, p.coeff n ∈ Set.range f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS f] rfl #align polynomial.lifts_iff_coeff_lifts Polynomial.lifts_iff_coeff_lifts theorem C_mem_lifts (f : R →+* S) (r : R) : C (f r) ∈ lifts f := ⟨C r, by simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.C_mem_lifts Polynomial.C_mem_lifts theorem C'_mem_lifts {f : R →+* S} {s : S} (h : s ∈ Set.range f) : C s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use C r simp only [coe_mapRingHom, map_C, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] set_option linter.uppercaseLean3 false in #align polynomial.C'_mem_lifts Polynomial.C'_mem_lifts theorem X_mem_lifts (f : R →+* S) : (X : S[X]) ∈ lifts f := ⟨X, by simp only [coe_mapRingHom, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_mem_lifts Polynomial.X_mem_lifts theorem X_pow_mem_lifts (f : R →+* S) (n : ℕ) : (X ^ n : S[X]) ∈ lifts f := ⟨X ^ n, by simp only [coe_mapRingHom, map_pow, Set.mem_univ, Subsemiring.coe_top, eq_self_iff_true, map_X, and_self_iff]⟩ set_option linter.uppercaseLean3 false in #align polynomial.X_pow_mem_lifts Polynomial.X_pow_mem_lifts theorem base_mul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts f) : C (f r) * p ∈ lifts f := by simp only [lifts, RingHom.mem_rangeS] at hp ⊢ obtain ⟨p₁, rfl⟩ := hp use C r * p₁ simp only [coe_mapRingHom, map_C, map_mul] #align polynomial.base_mul_mem_lifts Polynomial.base_mul_mem_lifts theorem monomial_mem_lifts {s : S} (n : ℕ) (h : s ∈ Set.range f) : monomial n s ∈ lifts f := by obtain ⟨r, rfl⟩ := Set.mem_range.1 h use monomial n r simp only [coe_mapRingHom, Set.mem_univ, map_monomial, Subsemiring.coe_top, eq_self_iff_true, and_self_iff] #align polynomial.monomial_mem_lifts Polynomial.monomial_mem_lifts theorem erase_mem_lifts {p : S[X]} (n : ℕ) (h : p ∈ lifts f) : p.erase n ∈ lifts f := by rw [lifts_iff_ringHom_rangeS, mem_map_rangeS] at h ⊢ intro k by_cases hk : k = n · use 0 simp only [hk, RingHom.map_zero, erase_same] obtain ⟨i, hi⟩ := h k use i simp only [hi, hk, erase_ne, Ne, not_false_iff] #align polynomial.erase_mem_lifts Polynomial.erase_mem_lifts section Algebra variable {R : Type u} [CommSemiring R] {S : Type v} [Semiring S] [Algebra R S] def mapAlg (R : Type u) [CommSemiring R] (S : Type v) [Semiring S] [Algebra R S] : R[X] →ₐ[R] S[X] := @aeval _ S[X] _ _ _ (X : S[X]) #align polynomial.map_alg Polynomial.mapAlg theorem mapAlg_eq_map (p : R[X]) : mapAlg R S p = map (algebraMap R S) p := by simp only [mapAlg, aeval_def, eval₂_eq_sum, map, algebraMap_apply, RingHom.coe_comp] ext; congr #align polynomial.map_alg_eq_map Polynomial.mapAlg_eq_map theorem mem_lifts_iff_mem_alg (R : Type u) [CommSemiring R] {S : Type v} [Semiring S] [Algebra R S] (p : S[X]) : p ∈ lifts (algebraMap R S) ↔ p ∈ AlgHom.range (@mapAlg R _ S _ _) := by simp only [coe_mapRingHom, lifts, mapAlg_eq_map, AlgHom.mem_range, RingHom.mem_rangeS] #align polynomial.mem_lifts_iff_mem_alg Polynomial.mem_lifts_iff_mem_alg
Mathlib/Algebra/Polynomial/Lifts.lean
286
289
theorem smul_mem_lifts {p : S[X]} (r : R) (hp : p ∈ lifts (algebraMap R S)) : r • p ∈ lifts (algebraMap R S) := by
rw [mem_lifts_iff_mem_alg] at hp ⊢ exact Subalgebra.smul_mem (mapAlg R S).range hp r
1,978
import Mathlib.Algebra.Polynomial.FieldDivision import Mathlib.Algebra.Polynomial.Lifts import Mathlib.Data.List.Prime #align_import data.polynomial.splits from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e" noncomputable section open Polynomial universe u v w variable {R : Type*} {F : Type u} {K : Type v} {L : Type w} namespace Polynomial open Polynomial section Splits section CommRing variable [CommRing K] [Field L] [Field F] variable (i : K →+* L) def Splits (f : K[X]) : Prop := f.map i = 0 ∨ ∀ {g : L[X]}, Irreducible g → g ∣ f.map i → degree g = 1 #align polynomial.splits Polynomial.Splits @[simp] theorem splits_zero : Splits i (0 : K[X]) := Or.inl (Polynomial.map_zero i) #align polynomial.splits_zero Polynomial.splits_zero theorem splits_of_map_eq_C {f : K[X]} {a : L} (h : f.map i = C a) : Splits i f := letI := Classical.decEq L if ha : a = 0 then Or.inl (h.trans (ha.symm ▸ C_0)) else Or.inr fun hg ⟨p, hp⟩ => absurd hg.1 <| Classical.not_not.2 <| isUnit_iff_degree_eq_zero.2 <| by have := congr_arg degree hp rw [h, degree_C ha, degree_mul, @eq_comm (WithBot ℕ) 0, Nat.WithBot.add_eq_zero_iff] at this exact this.1 set_option linter.uppercaseLean3 false in #align polynomial.splits_of_map_eq_C Polynomial.splits_of_map_eq_C @[simp] theorem splits_C (a : K) : Splits i (C a) := splits_of_map_eq_C i (map_C i) set_option linter.uppercaseLean3 false in #align polynomial.splits_C Polynomial.splits_C theorem splits_of_map_degree_eq_one {f : K[X]} (hf : degree (f.map i) = 1) : Splits i f := Or.inr fun hg ⟨p, hp⟩ => by have := congr_arg degree hp simp [Nat.WithBot.add_eq_one_iff, hf, @eq_comm (WithBot ℕ) 1, mt isUnit_iff_degree_eq_zero.2 hg.1] at this tauto #align polynomial.splits_of_map_degree_eq_one Polynomial.splits_of_map_degree_eq_one theorem splits_of_degree_le_one {f : K[X]} (hf : degree f ≤ 1) : Splits i f := if hif : degree (f.map i) ≤ 0 then splits_of_map_eq_C i (degree_le_zero_iff.mp hif) else by push_neg at hif rw [← Order.succ_le_iff, ← WithBot.coe_zero, WithBot.succ_coe, Nat.succ_eq_succ] at hif exact splits_of_map_degree_eq_one i (le_antisymm ((degree_map_le i _).trans hf) hif) #align polynomial.splits_of_degree_le_one Polynomial.splits_of_degree_le_one theorem splits_of_degree_eq_one {f : K[X]} (hf : degree f = 1) : Splits i f := splits_of_degree_le_one i hf.le #align polynomial.splits_of_degree_eq_one Polynomial.splits_of_degree_eq_one theorem splits_of_natDegree_le_one {f : K[X]} (hf : natDegree f ≤ 1) : Splits i f := splits_of_degree_le_one i (degree_le_of_natDegree_le hf) #align polynomial.splits_of_nat_degree_le_one Polynomial.splits_of_natDegree_le_one theorem splits_of_natDegree_eq_one {f : K[X]} (hf : natDegree f = 1) : Splits i f := splits_of_natDegree_le_one i (le_of_eq hf) #align polynomial.splits_of_nat_degree_eq_one Polynomial.splits_of_natDegree_eq_one theorem splits_mul {f g : K[X]} (hf : Splits i f) (hg : Splits i g) : Splits i (f * g) := letI := Classical.decEq L if h : (f * g).map i = 0 then Or.inl h else Or.inr @fun p hp hpf => ((irreducible_iff_prime.1 hp).2.2 _ _ (show p ∣ map i f * map i g by convert hpf; rw [Polynomial.map_mul])).elim (hf.resolve_left (fun hf => by simp [hf] at h) hp) (hg.resolve_left (fun hg => by simp [hg] at h) hp) #align polynomial.splits_mul Polynomial.splits_mul theorem splits_of_splits_mul' {f g : K[X]} (hfg : (f * g).map i ≠ 0) (h : Splits i (f * g)) : Splits i f ∧ Splits i g := ⟨Or.inr @fun g hgi hg => Or.resolve_left h hfg hgi (by rw [Polynomial.map_mul]; exact hg.trans (dvd_mul_right _ _)), Or.inr @fun g hgi hg => Or.resolve_left h hfg hgi (by rw [Polynomial.map_mul]; exact hg.trans (dvd_mul_left _ _))⟩ #align polynomial.splits_of_splits_mul' Polynomial.splits_of_splits_mul'
Mathlib/Algebra/Polynomial/Splits.lean
124
125
theorem splits_map_iff (j : L →+* F) {f : K[X]} : Splits j (f.map i) ↔ Splits (j.comp i) f := by
simp [Splits, Polynomial.map_map]
1,979
import Mathlib.Algebra.Polynomial.Splits import Mathlib.RingTheory.Adjoin.Basic import Mathlib.RingTheory.AdjoinRoot #align_import ring_theory.adjoin.field from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" noncomputable section open Polynomial section Embeddings variable (F : Type*) [Field F] open AdjoinRoot in def AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly {R : Type*} [CommRing R] [Algebra F R] (x : R) : Algebra.adjoin F ({x} : Set R) ≃ₐ[F] AdjoinRoot (minpoly F x) := AlgEquiv.symm <| AlgEquiv.ofBijective (Minpoly.toAdjoin F x) <| by refine ⟨(injective_iff_map_eq_zero _).2 fun P₁ hP₁ ↦ ?_, Minpoly.toAdjoin.surjective F x⟩ obtain ⟨P, rfl⟩ := mk_surjective P₁ refine AdjoinRoot.mk_eq_zero.mpr (minpoly.dvd F x ?_) rwa [Minpoly.toAdjoin_apply', liftHom_mk, ← Subalgebra.coe_eq_zero, aeval_subalgebra_coe] at hP₁ #align alg_equiv.adjoin_singleton_equiv_adjoin_root_minpoly AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly noncomputable def Algebra.adjoin.liftSingleton {S T : Type*} [CommRing S] [CommRing T] [Algebra F S] [Algebra F T] (x : S) (y : T) (h : aeval y (minpoly F x) = 0) : Algebra.adjoin F {x} →ₐ[F] T := (AdjoinRoot.liftHom _ y h).comp (AlgEquiv.adjoinSingletonEquivAdjoinRootMinpoly F x).toAlgHom open Finset
Mathlib/RingTheory/Adjoin/Field.lean
56
81
theorem Polynomial.lift_of_splits {F K L : Type*} [Field F] [Field K] [Field L] [Algebra F K] [Algebra F L] (s : Finset K) : (∀ x ∈ s, IsIntegral F x ∧ Splits (algebraMap F L) (minpoly F x)) → Nonempty (Algebra.adjoin F (s : Set K) →ₐ[F] L) := by
classical refine Finset.induction_on s (fun _ ↦ ?_) fun a s _ ih H ↦ ?_ · rw [coe_empty, Algebra.adjoin_empty] exact ⟨(Algebra.ofId F L).comp (Algebra.botEquiv F K)⟩ rw [forall_mem_insert] at H rcases H with ⟨⟨H1, H2⟩, H3⟩ cases' ih H3 with f choose H3 _ using H3 rw [coe_insert, Set.insert_eq, Set.union_comm, Algebra.adjoin_union_eq_adjoin_adjoin] set Ks := Algebra.adjoin F (s : Set K) haveI : FiniteDimensional F Ks := ((Submodule.fg_iff_finiteDimensional _).1 (fg_adjoin_of_finite s.finite_toSet H3)).of_subalgebra_toSubmodule letI := fieldOfFiniteDimensional F Ks letI := (f : Ks →+* L).toAlgebra have H5 : IsIntegral Ks a := H1.tower_top have H6 : (minpoly Ks a).Splits (algebraMap Ks L) := by refine splits_of_splits_of_dvd _ ((minpoly.monic H1).map (algebraMap F Ks)).ne_zero ((splits_map_iff _ _).2 ?_) (minpoly.dvd _ _ ?_) · rw [← IsScalarTower.algebraMap_eq] exact H2 · rw [Polynomial.aeval_map_algebraMap, minpoly.aeval] obtain ⟨y, hy⟩ := Polynomial.exists_root_of_splits _ H6 (minpoly.degree_pos H5).ne' exact ⟨Subalgebra.ofRestrictScalars F _ <| Algebra.adjoin.liftSingleton Ks a y hy⟩
1,980
import Mathlib.Algebra.Polynomial.Splits import Mathlib.RingTheory.Adjoin.Basic import Mathlib.RingTheory.AdjoinRoot #align_import ring_theory.adjoin.field from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23" noncomputable section open Polynomial variable {R K L M : Type*} [CommRing R] [Field K] [Field L] [CommRing M] [Algebra R K] [Algebra R L] [Algebra R M] {x : L} (int : IsIntegral R x) (h : Splits (algebraMap R K) (minpoly R x)) theorem IsIntegral.mem_range_algHom_of_minpoly_splits (f : K →ₐ[R] L) : x ∈ f.range := show x ∈ Set.range f from Set.image_subset_range _ _ <| by rw [image_rootSet h f, mem_rootSet'] exact ⟨((minpoly.monic int).map _).ne_zero, minpoly.aeval R x⟩ theorem IsIntegral.mem_range_algebraMap_of_minpoly_splits [Algebra K L] [IsScalarTower R K L] : x ∈ (algebraMap K L).range := int.mem_range_algHom_of_minpoly_splits h (IsScalarTower.toAlgHom R K L) variable [Algebra K M] [IsScalarTower R K M] {x : M} (int : IsIntegral R x) theorem IsIntegral.minpoly_splits_tower_top' {f : K →+* L} (h : Splits (f.comp <| algebraMap R K) (minpoly R x)) : Splits f (minpoly K x) := splits_of_splits_of_dvd _ ((minpoly.monic int).map _).ne_zero ((splits_map_iff _ _).mpr h) (minpoly.dvd_map_of_isScalarTower R _ x)
Mathlib/RingTheory/Adjoin/Field.lean
106
110
theorem IsIntegral.minpoly_splits_tower_top [Algebra K L] [IsScalarTower R K L] (h : Splits (algebraMap R L) (minpoly R x)) : Splits (algebraMap K L) (minpoly K x) := by
rw [IsScalarTower.algebraMap_eq R K L] at h exact int.minpoly_splits_tower_top' h
1,980
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def'
Mathlib/FieldTheory/Separable.lean
52
54
theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by
rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h
1,981
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality]
Mathlib/FieldTheory/Separable.lean
66
67
theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by
simp [Separable, IsCoprime, eq_iff_true_of_subsingleton]
1,981
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton
Mathlib/FieldTheory/Separable.lean
70
72
theorem separable_X_add_C (a : R) : (X + C a).Separable := by
rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right
1,981
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton theorem separable_X_add_C (a : R) : (X + C a).Separable := by rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X_add_C Polynomial.separable_X_add_C
Mathlib/FieldTheory/Separable.lean
76
78
theorem separable_X : (X : R[X]).Separable := by
rw [separable_def, derivative_X] exact isCoprime_one_right
1,981
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton theorem separable_X_add_C (a : R) : (X + C a).Separable := by rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X_add_C Polynomial.separable_X_add_C theorem separable_X : (X : R[X]).Separable := by rw [separable_def, derivative_X] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X Polynomial.separable_X
Mathlib/FieldTheory/Separable.lean
82
83
theorem separable_C (r : R) : (C r).Separable ↔ IsUnit r := by
rw [separable_def, derivative_C, isCoprime_zero_right, isUnit_C]
1,981
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton theorem separable_X_add_C (a : R) : (X + C a).Separable := by rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X_add_C Polynomial.separable_X_add_C theorem separable_X : (X : R[X]).Separable := by rw [separable_def, derivative_X] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X Polynomial.separable_X theorem separable_C (r : R) : (C r).Separable ↔ IsUnit r := by rw [separable_def, derivative_C, isCoprime_zero_right, isUnit_C] set_option linter.uppercaseLean3 false in #align polynomial.separable_C Polynomial.separable_C
Mathlib/FieldTheory/Separable.lean
87
89
theorem Separable.of_mul_left {f g : R[X]} (h : (f * g).Separable) : f.Separable := by
have := h.of_mul_left_left; rw [derivative_mul] at this exact IsCoprime.of_mul_right_left (IsCoprime.of_add_mul_left_right this)
1,981
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton theorem separable_X_add_C (a : R) : (X + C a).Separable := by rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X_add_C Polynomial.separable_X_add_C theorem separable_X : (X : R[X]).Separable := by rw [separable_def, derivative_X] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X Polynomial.separable_X theorem separable_C (r : R) : (C r).Separable ↔ IsUnit r := by rw [separable_def, derivative_C, isCoprime_zero_right, isUnit_C] set_option linter.uppercaseLean3 false in #align polynomial.separable_C Polynomial.separable_C theorem Separable.of_mul_left {f g : R[X]} (h : (f * g).Separable) : f.Separable := by have := h.of_mul_left_left; rw [derivative_mul] at this exact IsCoprime.of_mul_right_left (IsCoprime.of_add_mul_left_right this) #align polynomial.separable.of_mul_left Polynomial.Separable.of_mul_left
Mathlib/FieldTheory/Separable.lean
92
94
theorem Separable.of_mul_right {f g : R[X]} (h : (f * g).Separable) : g.Separable := by
rw [mul_comm] at h exact h.of_mul_left
1,981
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton theorem separable_X_add_C (a : R) : (X + C a).Separable := by rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X_add_C Polynomial.separable_X_add_C theorem separable_X : (X : R[X]).Separable := by rw [separable_def, derivative_X] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X Polynomial.separable_X theorem separable_C (r : R) : (C r).Separable ↔ IsUnit r := by rw [separable_def, derivative_C, isCoprime_zero_right, isUnit_C] set_option linter.uppercaseLean3 false in #align polynomial.separable_C Polynomial.separable_C theorem Separable.of_mul_left {f g : R[X]} (h : (f * g).Separable) : f.Separable := by have := h.of_mul_left_left; rw [derivative_mul] at this exact IsCoprime.of_mul_right_left (IsCoprime.of_add_mul_left_right this) #align polynomial.separable.of_mul_left Polynomial.Separable.of_mul_left theorem Separable.of_mul_right {f g : R[X]} (h : (f * g).Separable) : g.Separable := by rw [mul_comm] at h exact h.of_mul_left #align polynomial.separable.of_mul_right Polynomial.Separable.of_mul_right
Mathlib/FieldTheory/Separable.lean
97
99
theorem Separable.of_dvd {f g : R[X]} (hf : f.Separable) (hfg : g ∣ f) : g.Separable := by
rcases hfg with ⟨f', rfl⟩ exact Separable.of_mul_left hf
1,981
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton theorem separable_X_add_C (a : R) : (X + C a).Separable := by rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X_add_C Polynomial.separable_X_add_C theorem separable_X : (X : R[X]).Separable := by rw [separable_def, derivative_X] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X Polynomial.separable_X theorem separable_C (r : R) : (C r).Separable ↔ IsUnit r := by rw [separable_def, derivative_C, isCoprime_zero_right, isUnit_C] set_option linter.uppercaseLean3 false in #align polynomial.separable_C Polynomial.separable_C theorem Separable.of_mul_left {f g : R[X]} (h : (f * g).Separable) : f.Separable := by have := h.of_mul_left_left; rw [derivative_mul] at this exact IsCoprime.of_mul_right_left (IsCoprime.of_add_mul_left_right this) #align polynomial.separable.of_mul_left Polynomial.Separable.of_mul_left theorem Separable.of_mul_right {f g : R[X]} (h : (f * g).Separable) : g.Separable := by rw [mul_comm] at h exact h.of_mul_left #align polynomial.separable.of_mul_right Polynomial.Separable.of_mul_right theorem Separable.of_dvd {f g : R[X]} (hf : f.Separable) (hfg : g ∣ f) : g.Separable := by rcases hfg with ⟨f', rfl⟩ exact Separable.of_mul_left hf #align polynomial.separable.of_dvd Polynomial.Separable.of_dvd theorem separable_gcd_left {F : Type*} [Field F] {f : F[X]} (hf : f.Separable) (g : F[X]) : (EuclideanDomain.gcd f g).Separable := Separable.of_dvd hf (EuclideanDomain.gcd_dvd_left f g) #align polynomial.separable_gcd_left Polynomial.separable_gcd_left theorem separable_gcd_right {F : Type*} [Field F] {g : F[X]} (f : F[X]) (hg : g.Separable) : (EuclideanDomain.gcd f g).Separable := Separable.of_dvd hg (EuclideanDomain.gcd_dvd_right f g) #align polynomial.separable_gcd_right Polynomial.separable_gcd_right
Mathlib/FieldTheory/Separable.lean
112
114
theorem Separable.isCoprime {f g : R[X]} (h : (f * g).Separable) : IsCoprime f g := by
have := h.of_mul_left_left; rw [derivative_mul] at this exact IsCoprime.of_mul_right_right (IsCoprime.of_add_mul_left_right this)
1,981
import Mathlib.Algebra.Polynomial.Expand import Mathlib.Algebra.Polynomial.Splits import Mathlib.Algebra.Squarefree.Basic import Mathlib.FieldTheory.Minpoly.Field import Mathlib.RingTheory.PowerBasis #align_import field_theory.separable from "leanprover-community/mathlib"@"92ca63f0fb391a9ca5f22d2409a6080e786d99f7" universe u v w open scoped Classical open Polynomial Finset namespace Polynomial section CommSemiring variable {R : Type u} [CommSemiring R] {S : Type v} [CommSemiring S] def Separable (f : R[X]) : Prop := IsCoprime f (derivative f) #align polynomial.separable Polynomial.Separable theorem separable_def (f : R[X]) : f.Separable ↔ IsCoprime f (derivative f) := Iff.rfl #align polynomial.separable_def Polynomial.separable_def theorem separable_def' (f : R[X]) : f.Separable ↔ ∃ a b : R[X], a * f + b * (derivative f) = 1 := Iff.rfl #align polynomial.separable_def' Polynomial.separable_def' theorem not_separable_zero [Nontrivial R] : ¬Separable (0 : R[X]) := by rintro ⟨x, y, h⟩ simp only [derivative_zero, mul_zero, add_zero, zero_ne_one] at h #align polynomial.not_separable_zero Polynomial.not_separable_zero theorem Separable.ne_zero [Nontrivial R] {f : R[X]} (h : f.Separable) : f ≠ 0 := (not_separable_zero <| · ▸ h) @[simp] theorem separable_one : (1 : R[X]).Separable := isCoprime_one_left #align polynomial.separable_one Polynomial.separable_one @[nontriviality] theorem separable_of_subsingleton [Subsingleton R] (f : R[X]) : f.Separable := by simp [Separable, IsCoprime, eq_iff_true_of_subsingleton] #align polynomial.separable_of_subsingleton Polynomial.separable_of_subsingleton theorem separable_X_add_C (a : R) : (X + C a).Separable := by rw [separable_def, derivative_add, derivative_X, derivative_C, add_zero] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X_add_C Polynomial.separable_X_add_C theorem separable_X : (X : R[X]).Separable := by rw [separable_def, derivative_X] exact isCoprime_one_right set_option linter.uppercaseLean3 false in #align polynomial.separable_X Polynomial.separable_X theorem separable_C (r : R) : (C r).Separable ↔ IsUnit r := by rw [separable_def, derivative_C, isCoprime_zero_right, isUnit_C] set_option linter.uppercaseLean3 false in #align polynomial.separable_C Polynomial.separable_C theorem Separable.of_mul_left {f g : R[X]} (h : (f * g).Separable) : f.Separable := by have := h.of_mul_left_left; rw [derivative_mul] at this exact IsCoprime.of_mul_right_left (IsCoprime.of_add_mul_left_right this) #align polynomial.separable.of_mul_left Polynomial.Separable.of_mul_left theorem Separable.of_mul_right {f g : R[X]} (h : (f * g).Separable) : g.Separable := by rw [mul_comm] at h exact h.of_mul_left #align polynomial.separable.of_mul_right Polynomial.Separable.of_mul_right theorem Separable.of_dvd {f g : R[X]} (hf : f.Separable) (hfg : g ∣ f) : g.Separable := by rcases hfg with ⟨f', rfl⟩ exact Separable.of_mul_left hf #align polynomial.separable.of_dvd Polynomial.Separable.of_dvd theorem separable_gcd_left {F : Type*} [Field F] {f : F[X]} (hf : f.Separable) (g : F[X]) : (EuclideanDomain.gcd f g).Separable := Separable.of_dvd hf (EuclideanDomain.gcd_dvd_left f g) #align polynomial.separable_gcd_left Polynomial.separable_gcd_left theorem separable_gcd_right {F : Type*} [Field F] {g : F[X]} (f : F[X]) (hg : g.Separable) : (EuclideanDomain.gcd f g).Separable := Separable.of_dvd hg (EuclideanDomain.gcd_dvd_right f g) #align polynomial.separable_gcd_right Polynomial.separable_gcd_right theorem Separable.isCoprime {f g : R[X]} (h : (f * g).Separable) : IsCoprime f g := by have := h.of_mul_left_left; rw [derivative_mul] at this exact IsCoprime.of_mul_right_right (IsCoprime.of_add_mul_left_right this) #align polynomial.separable.is_coprime Polynomial.Separable.isCoprime theorem Separable.of_pow' {f : R[X]} : ∀ {n : ℕ} (_h : (f ^ n).Separable), IsUnit f ∨ f.Separable ∧ n = 1 ∨ n = 0 | 0 => fun _h => Or.inr <| Or.inr rfl | 1 => fun h => Or.inr <| Or.inl ⟨pow_one f ▸ h, rfl⟩ | n + 2 => fun h => by rw [pow_succ, pow_succ] at h exact Or.inl (isCoprime_self.1 h.isCoprime.of_mul_left_right) #align polynomial.separable.of_pow' Polynomial.Separable.of_pow' theorem Separable.of_pow {f : R[X]} (hf : ¬IsUnit f) {n : ℕ} (hn : n ≠ 0) (hfs : (f ^ n).Separable) : f.Separable ∧ n = 1 := (hfs.of_pow'.resolve_left hf).resolve_right hn #align polynomial.separable.of_pow Polynomial.Separable.of_pow theorem Separable.map {p : R[X]} (h : p.Separable) {f : R →+* S} : (p.map f).Separable := let ⟨a, b, H⟩ := h ⟨a.map f, b.map f, by rw [derivative_map, ← Polynomial.map_mul, ← Polynomial.map_mul, ← Polynomial.map_add, H, Polynomial.map_one]⟩ #align polynomial.separable.map Polynomial.Separable.map
Mathlib/FieldTheory/Separable.lean
138
149
theorem _root_.Associated.separable {f g : R[X]} (ha : Associated f g) (h : f.Separable) : g.Separable := by
obtain ⟨⟨u, v, h1, h2⟩, ha⟩ := ha obtain ⟨a, b, h⟩ := h refine ⟨a * v + b * derivative v, b * v, ?_⟩ replace h := congr($h * $(h1)) have h3 := congr(derivative $(h1)) simp only [← ha, derivative_mul, derivative_one] at h3 ⊢ calc _ = (a * f + b * derivative f) * (u * v) + (b * f) * (derivative u * v + u * derivative v) := by ring1 _ = 1 := by rw [h, h3]; ring1
1,981
import Mathlib.Algebra.Algebra.Subalgebra.Directed import Mathlib.FieldTheory.IntermediateField import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.IsSplittingField import Mathlib.RingTheory.TensorProduct.Basic #align_import field_theory.adjoin from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" set_option autoImplicit true open FiniteDimensional Polynomial open scoped Classical Polynomial namespace IntermediateField section AdjoinDef variable (F : Type*) [Field F] {E : Type*} [Field E] [Algebra F E] (S : Set E) -- Porting note: not adding `neg_mem'` causes an error. def adjoin : IntermediateField F E := { Subfield.closure (Set.range (algebraMap F E) ∪ S) with algebraMap_mem' := fun x => Subfield.subset_closure (Or.inl (Set.mem_range_self x)) } #align intermediate_field.adjoin IntermediateField.adjoin variable {S}
Mathlib/FieldTheory/Adjoin.lean
54
60
theorem mem_adjoin_iff (x : E) : x ∈ adjoin F S ↔ ∃ r s : MvPolynomial S F, x = MvPolynomial.aeval Subtype.val r / MvPolynomial.aeval Subtype.val s := by
simp only [adjoin, mem_mk, Subring.mem_toSubsemiring, Subfield.mem_toSubring, Subfield.mem_closure_iff, ← Algebra.adjoin_eq_ring_closure, Subalgebra.mem_toSubring, Algebra.adjoin_eq_range, AlgHom.mem_range, exists_exists_eq_and] tauto
1,982
import Mathlib.Algebra.Algebra.Subalgebra.Directed import Mathlib.FieldTheory.IntermediateField import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.IsSplittingField import Mathlib.RingTheory.TensorProduct.Basic #align_import field_theory.adjoin from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87" set_option autoImplicit true open FiniteDimensional Polynomial open scoped Classical Polynomial namespace IntermediateField section AdjoinDef variable (F : Type*) [Field F] {E : Type*} [Field E] [Algebra F E] (S : Set E) -- Porting note: not adding `neg_mem'` causes an error. def adjoin : IntermediateField F E := { Subfield.closure (Set.range (algebraMap F E) ∪ S) with algebraMap_mem' := fun x => Subfield.subset_closure (Or.inl (Set.mem_range_self x)) } #align intermediate_field.adjoin IntermediateField.adjoin variable {S} theorem mem_adjoin_iff (x : E) : x ∈ adjoin F S ↔ ∃ r s : MvPolynomial S F, x = MvPolynomial.aeval Subtype.val r / MvPolynomial.aeval Subtype.val s := by simp only [adjoin, mem_mk, Subring.mem_toSubsemiring, Subfield.mem_toSubring, Subfield.mem_closure_iff, ← Algebra.adjoin_eq_ring_closure, Subalgebra.mem_toSubring, Algebra.adjoin_eq_range, AlgHom.mem_range, exists_exists_eq_and] tauto
Mathlib/FieldTheory/Adjoin.lean
62
67
theorem mem_adjoin_simple_iff {α : E} (x : E) : x ∈ adjoin F {α} ↔ ∃ r s : F[X], x = aeval α r / aeval α s := by
simp only [adjoin, mem_mk, Subring.mem_toSubsemiring, Subfield.mem_toSubring, Subfield.mem_closure_iff, ← Algebra.adjoin_eq_ring_closure, Subalgebra.mem_toSubring, Algebra.adjoin_singleton_eq_range_aeval, AlgHom.mem_range, exists_exists_eq_and] tauto
1,982
import Mathlib.FieldTheory.Adjoin open Polynomial namespace IntermediateField variable (F E K : Type*) [Field F] [Field E] [Field K] [Algebra F E] [Algebra F K] {S : Set E} structure Lifts where carrier : IntermediateField F E emb : carrier →ₐ[F] K #align intermediate_field.lifts IntermediateField.Lifts variable {F E K} instance : PartialOrder (Lifts F E K) where le L₁ L₂ := ∃ h : L₁.carrier ≤ L₂.carrier, ∀ x, L₂.emb (inclusion h x) = L₁.emb x le_refl L := ⟨le_rfl, by simp⟩ le_trans L₁ L₂ L₃ := by rintro ⟨h₁₂, h₁₂'⟩ ⟨h₂₃, h₂₃'⟩ refine ⟨h₁₂.trans h₂₃, fun _ ↦ ?_⟩ rw [← inclusion_inclusion h₁₂ h₂₃, h₂₃', h₁₂'] le_antisymm := by rintro ⟨L₁, e₁⟩ ⟨L₂, e₂⟩ ⟨h₁₂, h₁₂'⟩ ⟨h₂₁, h₂₁'⟩ obtain rfl : L₁ = L₂ := h₁₂.antisymm h₂₁ congr exact AlgHom.ext h₂₁' noncomputable instance : OrderBot (Lifts F E K) where bot := ⟨⊥, (Algebra.ofId F K).comp (botEquiv F E)⟩ bot_le L := ⟨bot_le, fun x ↦ by obtain ⟨x, rfl⟩ := (botEquiv F E).symm.surjective x simp_rw [AlgHom.comp_apply, AlgHom.coe_coe, AlgEquiv.apply_symm_apply] exact L.emb.commutes x⟩ noncomputable instance : Inhabited (Lifts F E K) := ⟨⊥⟩
Mathlib/FieldTheory/Extension.lean
57
70
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) : ∃ ub, ∀ a ∈ c, a ≤ ub := by
let t (i : ↑(insert ⊥ c)) := i.val.carrier let t' (i) := (t i).toSubalgebra have hc := hc.insert fun _ _ _ ↦ .inl bot_le have dir : Directed (· ≤ ·) t := hc.directedOn.directed_val.mono_comp _ fun _ _ h ↦ h.1 refine ⟨⟨iSup t, (Subalgebra.iSupLift t' dir (fun i ↦ i.val.emb) (fun i j h ↦ ?_) _ rfl).comp (Subalgebra.equivOfEq _ _ <| toSubalgebra_iSup_of_directed dir)⟩, fun L hL ↦ have hL := Set.mem_insert_of_mem ⊥ hL; ⟨le_iSup t ⟨L, hL⟩, fun x ↦ ?_⟩⟩ · refine AlgHom.ext fun x ↦ (hc.total i.2 j.2).elim (fun hij ↦ (hij.snd x).symm) fun hji ↦ ?_ erw [AlgHom.comp_apply, ← hji.snd (Subalgebra.inclusion h x), inclusion_inclusion, inclusion_self, AlgHom.id_apply x] · dsimp only [AlgHom.comp_apply] exact Subalgebra.iSupLift_inclusion (K := t') (i := ⟨L, hL⟩) x (le_iSup t' ⟨L, hL⟩)
1,983
import Mathlib.FieldTheory.Extension import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.GroupTheory.Solvable #align_import field_theory.normal from "leanprover-community/mathlib"@"9fb8964792b4237dac6200193a0d533f1b3f7423" noncomputable section open scoped Classical Polynomial open Polynomial IsScalarTower variable (F K : Type*) [Field F] [Field K] [Algebra F K] class Normal extends Algebra.IsAlgebraic F K : Prop where splits' (x : K) : Splits (algebraMap F K) (minpoly F x) #align normal Normal variable {F K} theorem Normal.isIntegral (_ : Normal F K) (x : K) : IsIntegral F x := Algebra.IsIntegral.isIntegral x #align normal.is_integral Normal.isIntegral theorem Normal.splits (_ : Normal F K) (x : K) : Splits (algebraMap F K) (minpoly F x) := Normal.splits' x #align normal.splits Normal.splits theorem normal_iff : Normal F K ↔ ∀ x : K, IsIntegral F x ∧ Splits (algebraMap F K) (minpoly F x) := ⟨fun h x => ⟨h.isIntegral x, h.splits x⟩, fun h => { isAlgebraic := fun x => (h x).1.isAlgebraic splits' := fun x => (h x).2 }⟩ #align normal_iff normal_iff theorem Normal.out : Normal F K → ∀ x : K, IsIntegral F x ∧ Splits (algebraMap F K) (minpoly F x) := normal_iff.1 #align normal.out Normal.out variable (F K) instance normal_self : Normal F F where isAlgebraic := fun _ => isIntegral_algebraMap.isAlgebraic splits' := fun x => (minpoly.eq_X_sub_C' x).symm ▸ splits_X_sub_C _ #align normal_self normal_self
Mathlib/FieldTheory/Normal.lean
66
81
theorem Normal.exists_isSplittingField [h : Normal F K] [FiniteDimensional F K] : ∃ p : F[X], IsSplittingField F K p := by
let s := Basis.ofVectorSpace F K refine ⟨∏ x, minpoly F (s x), splits_prod _ fun x _ => h.splits (s x), Subalgebra.toSubmodule.injective ?_⟩ rw [Algebra.top_toSubmodule, eq_top_iff, ← s.span_eq, Submodule.span_le, Set.range_subset_iff] refine fun x => Algebra.subset_adjoin (Multiset.mem_toFinset.mpr <| (mem_roots <| mt (Polynomial.map_eq_zero <| algebraMap F K).1 <| Finset.prod_ne_zero_iff.2 fun x _ => ?_).2 ?_) · exact minpoly.ne_zero (h.isIntegral (s x)) rw [IsRoot.def, eval_map, ← aeval_def, AlgHom.map_prod] exact Finset.prod_eq_zero (Finset.mem_univ _) (minpoly.aeval _ _)
1,984
import Mathlib.FieldTheory.Extension import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.GroupTheory.Solvable #align_import field_theory.normal from "leanprover-community/mathlib"@"9fb8964792b4237dac6200193a0d533f1b3f7423" noncomputable section open scoped Classical Polynomial open Polynomial IsScalarTower variable (F K : Type*) [Field F] [Field K] [Algebra F K] class Normal extends Algebra.IsAlgebraic F K : Prop where splits' (x : K) : Splits (algebraMap F K) (minpoly F x) #align normal Normal variable {F K} theorem Normal.isIntegral (_ : Normal F K) (x : K) : IsIntegral F x := Algebra.IsIntegral.isIntegral x #align normal.is_integral Normal.isIntegral theorem Normal.splits (_ : Normal F K) (x : K) : Splits (algebraMap F K) (minpoly F x) := Normal.splits' x #align normal.splits Normal.splits theorem normal_iff : Normal F K ↔ ∀ x : K, IsIntegral F x ∧ Splits (algebraMap F K) (minpoly F x) := ⟨fun h x => ⟨h.isIntegral x, h.splits x⟩, fun h => { isAlgebraic := fun x => (h x).1.isAlgebraic splits' := fun x => (h x).2 }⟩ #align normal_iff normal_iff theorem Normal.out : Normal F K → ∀ x : K, IsIntegral F x ∧ Splits (algebraMap F K) (minpoly F x) := normal_iff.1 #align normal.out Normal.out variable (F K) instance normal_self : Normal F F where isAlgebraic := fun _ => isIntegral_algebraMap.isAlgebraic splits' := fun x => (minpoly.eq_X_sub_C' x).symm ▸ splits_X_sub_C _ #align normal_self normal_self theorem Normal.exists_isSplittingField [h : Normal F K] [FiniteDimensional F K] : ∃ p : F[X], IsSplittingField F K p := by let s := Basis.ofVectorSpace F K refine ⟨∏ x, minpoly F (s x), splits_prod _ fun x _ => h.splits (s x), Subalgebra.toSubmodule.injective ?_⟩ rw [Algebra.top_toSubmodule, eq_top_iff, ← s.span_eq, Submodule.span_le, Set.range_subset_iff] refine fun x => Algebra.subset_adjoin (Multiset.mem_toFinset.mpr <| (mem_roots <| mt (Polynomial.map_eq_zero <| algebraMap F K).1 <| Finset.prod_ne_zero_iff.2 fun x _ => ?_).2 ?_) · exact minpoly.ne_zero (h.isIntegral (s x)) rw [IsRoot.def, eval_map, ← aeval_def, AlgHom.map_prod] exact Finset.prod_eq_zero (Finset.mem_univ _) (minpoly.aeval _ _) #align normal.exists_is_splitting_field Normal.exists_isSplittingField section NormalTower variable (E : Type*) [Field E] [Algebra F E] [Algebra K E] [IsScalarTower F K E] theorem Normal.tower_top_of_normal [h : Normal F E] : Normal K E := normal_iff.2 fun x => by cases' h.out x with hx hhx rw [algebraMap_eq F K E] at hhx exact ⟨hx.tower_top, Polynomial.splits_of_splits_of_dvd (algebraMap K E) (Polynomial.map_ne_zero (minpoly.ne_zero hx)) ((Polynomial.splits_map_iff (algebraMap F K) (algebraMap K E)).mpr hhx) (minpoly.dvd_map_of_isScalarTower F K x)⟩ #align normal.tower_top_of_normal Normal.tower_top_of_normal theorem AlgHom.normal_bijective [h : Normal F E] (ϕ : E →ₐ[F] K) : Function.Bijective ϕ := h.toIsAlgebraic.bijective_of_isScalarTower' ϕ #align alg_hom.normal_bijective AlgHom.normal_bijective -- Porting note: `[Field F] [Field E] [Algebra F E]` added by hand. variable {F E} {E' : Type*} [Field F] [Field E] [Algebra F E] [Field E'] [Algebra F E']
Mathlib/FieldTheory/Normal.lean
107
111
theorem Normal.of_algEquiv [h : Normal F E] (f : E ≃ₐ[F] E') : Normal F E' := by
rw [normal_iff] at h ⊢ intro x; specialize h (f.symm x) rw [← f.apply_symm_apply x, minpoly.algEquiv_eq, ← f.toAlgHom.comp_algebraMap] exact ⟨h.1.map f, splits_comp_of_splits _ _ h.2⟩
1,984
import Mathlib.FieldTheory.Extension import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.GroupTheory.Solvable #align_import field_theory.normal from "leanprover-community/mathlib"@"9fb8964792b4237dac6200193a0d533f1b3f7423" noncomputable section open scoped Classical Polynomial open Polynomial IsScalarTower variable (F K : Type*) [Field F] [Field K] [Algebra F K] class Normal extends Algebra.IsAlgebraic F K : Prop where splits' (x : K) : Splits (algebraMap F K) (minpoly F x) #align normal Normal variable {F K} theorem Normal.isIntegral (_ : Normal F K) (x : K) : IsIntegral F x := Algebra.IsIntegral.isIntegral x #align normal.is_integral Normal.isIntegral theorem Normal.splits (_ : Normal F K) (x : K) : Splits (algebraMap F K) (minpoly F x) := Normal.splits' x #align normal.splits Normal.splits theorem normal_iff : Normal F K ↔ ∀ x : K, IsIntegral F x ∧ Splits (algebraMap F K) (minpoly F x) := ⟨fun h x => ⟨h.isIntegral x, h.splits x⟩, fun h => { isAlgebraic := fun x => (h x).1.isAlgebraic splits' := fun x => (h x).2 }⟩ #align normal_iff normal_iff theorem Normal.out : Normal F K → ∀ x : K, IsIntegral F x ∧ Splits (algebraMap F K) (minpoly F x) := normal_iff.1 #align normal.out Normal.out variable (F K) instance normal_self : Normal F F where isAlgebraic := fun _ => isIntegral_algebraMap.isAlgebraic splits' := fun x => (minpoly.eq_X_sub_C' x).symm ▸ splits_X_sub_C _ #align normal_self normal_self theorem Normal.exists_isSplittingField [h : Normal F K] [FiniteDimensional F K] : ∃ p : F[X], IsSplittingField F K p := by let s := Basis.ofVectorSpace F K refine ⟨∏ x, minpoly F (s x), splits_prod _ fun x _ => h.splits (s x), Subalgebra.toSubmodule.injective ?_⟩ rw [Algebra.top_toSubmodule, eq_top_iff, ← s.span_eq, Submodule.span_le, Set.range_subset_iff] refine fun x => Algebra.subset_adjoin (Multiset.mem_toFinset.mpr <| (mem_roots <| mt (Polynomial.map_eq_zero <| algebraMap F K).1 <| Finset.prod_ne_zero_iff.2 fun x _ => ?_).2 ?_) · exact minpoly.ne_zero (h.isIntegral (s x)) rw [IsRoot.def, eval_map, ← aeval_def, AlgHom.map_prod] exact Finset.prod_eq_zero (Finset.mem_univ _) (minpoly.aeval _ _) #align normal.exists_is_splitting_field Normal.exists_isSplittingField section NormalTower variable (E : Type*) [Field E] [Algebra F E] [Algebra K E] [IsScalarTower F K E] theorem Normal.tower_top_of_normal [h : Normal F E] : Normal K E := normal_iff.2 fun x => by cases' h.out x with hx hhx rw [algebraMap_eq F K E] at hhx exact ⟨hx.tower_top, Polynomial.splits_of_splits_of_dvd (algebraMap K E) (Polynomial.map_ne_zero (minpoly.ne_zero hx)) ((Polynomial.splits_map_iff (algebraMap F K) (algebraMap K E)).mpr hhx) (minpoly.dvd_map_of_isScalarTower F K x)⟩ #align normal.tower_top_of_normal Normal.tower_top_of_normal theorem AlgHom.normal_bijective [h : Normal F E] (ϕ : E →ₐ[F] K) : Function.Bijective ϕ := h.toIsAlgebraic.bijective_of_isScalarTower' ϕ #align alg_hom.normal_bijective AlgHom.normal_bijective -- Porting note: `[Field F] [Field E] [Algebra F E]` added by hand. variable {F E} {E' : Type*} [Field F] [Field E] [Algebra F E] [Field E'] [Algebra F E'] theorem Normal.of_algEquiv [h : Normal F E] (f : E ≃ₐ[F] E') : Normal F E' := by rw [normal_iff] at h ⊢ intro x; specialize h (f.symm x) rw [← f.apply_symm_apply x, minpoly.algEquiv_eq, ← f.toAlgHom.comp_algebraMap] exact ⟨h.1.map f, splits_comp_of_splits _ _ h.2⟩ #align normal.of_alg_equiv Normal.of_algEquiv theorem AlgEquiv.transfer_normal (f : E ≃ₐ[F] E') : Normal F E ↔ Normal F E' := ⟨fun _ ↦ Normal.of_algEquiv f, fun _ ↦ Normal.of_algEquiv f.symm⟩ #align alg_equiv.transfer_normal AlgEquiv.transfer_normal open IntermediateField
Mathlib/FieldTheory/Normal.lean
120
142
theorem Normal.of_isSplittingField (p : F[X]) [hFEp : IsSplittingField F E p] : Normal F E := by
rcases eq_or_ne p 0 with (rfl | hp) · have := hFEp.adjoin_rootSet rw [rootSet_zero, Algebra.adjoin_empty] at this exact Normal.of_algEquiv (AlgEquiv.ofBijective (Algebra.ofId F E) (Algebra.bijective_algebraMap_iff.2 this.symm)) refine normal_iff.mpr fun x ↦ ?_ haveI : FiniteDimensional F E := IsSplittingField.finiteDimensional E p have hx := IsIntegral.of_finite F x let L := (p * minpoly F x).SplittingField have hL := splits_of_splits_mul' _ ?_ (SplittingField.splits (p * minpoly F x)) · let j : E →ₐ[F] L := IsSplittingField.lift E p hL.1 refine ⟨hx, splits_of_comp _ (j : E →+* L) (j.comp_algebraMap ▸ hL.2) fun a ha ↦ ?_⟩ rw [j.comp_algebraMap] at ha letI : Algebra F⟮x⟯ L := ((algHomAdjoinIntegralEquiv F hx).symm ⟨a, ha⟩).toRingHom.toAlgebra let j' : E →ₐ[F⟮x⟯] L := IsSplittingField.lift E (p.map (algebraMap F F⟮x⟯)) ?_ · change a ∈ j.range rw [← IsSplittingField.adjoin_rootSet_eq_range E p j, IsSplittingField.adjoin_rootSet_eq_range E p (j'.restrictScalars F)] exact ⟨x, (j'.commutes _).trans (algHomAdjoinIntegralEquiv_symm_apply_gen F hx _)⟩ · rw [splits_map_iff, ← IsScalarTower.algebraMap_eq]; exact hL.1 · rw [Polynomial.map_ne_zero_iff (algebraMap F L).injective, mul_ne_zero_iff] exact ⟨hp, minpoly.ne_zero hx⟩
1,984
import Mathlib.FieldTheory.Separable import Mathlib.RingTheory.IntegralDomain import Mathlib.Algebra.CharP.Reduced import Mathlib.Tactic.ApplyFun #align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43" variable {K : Type*} {R : Type*} local notation "q" => Fintype.card K open Finset open scoped Polynomial namespace FiniteField section Polynomial variable [CommRing R] [IsDomain R] open Polynomial theorem card_image_polynomial_eval [DecidableEq R] [Fintype R] {p : R[X]} (hp : 0 < p.degree) : Fintype.card R ≤ natDegree p * (univ.image fun x => eval x p).card := Finset.card_le_mul_card_image _ _ (fun a _ => calc _ = (p - C a).roots.toFinset.card := congr_arg card (by simp [Finset.ext_iff, ← mem_roots_sub_C hp]) _ ≤ Multiset.card (p - C a).roots := Multiset.toFinset_card_le _ _ ≤ _ := card_roots_sub_C' hp) #align finite_field.card_image_polynomial_eval FiniteField.card_image_polynomial_eval
Mathlib/FieldTheory/Finite/Basic.lean
76
98
theorem exists_root_sum_quadratic [Fintype R] {f g : R[X]} (hf2 : degree f = 2) (hg2 : degree g = 2) (hR : Fintype.card R % 2 = 1) : ∃ a b, f.eval a + g.eval b = 0 := letI := Classical.decEq R suffices ¬Disjoint (univ.image fun x : R => eval x f) (univ.image fun x : R => eval x (-g)) by simp only [disjoint_left, mem_image] at this push_neg at this rcases this with ⟨x, ⟨a, _, ha⟩, ⟨b, _, hb⟩⟩ exact ⟨a, b, by rw [ha, ← hb, eval_neg, neg_add_self]⟩ fun hd : Disjoint _ _ => lt_irrefl (2 * ((univ.image fun x : R => eval x f) ∪ univ.image fun x : R => eval x (-g)).card) <| calc 2 * ((univ.image fun x : R => eval x f) ∪ univ.image fun x : R => eval x (-g)).card ≤ 2 * Fintype.card R := Nat.mul_le_mul_left _ (Finset.card_le_univ _) _ = Fintype.card R + Fintype.card R := two_mul _ _ < natDegree f * (univ.image fun x : R => eval x f).card + natDegree (-g) * (univ.image fun x : R => eval x (-g)).card := (add_lt_add_of_lt_of_le (lt_of_le_of_ne (card_image_polynomial_eval (by rw [hf2]; decide)) (mt (congr_arg (· % 2)) (by simp [natDegree_eq_of_degree_eq_some hf2, hR]))) (card_image_polynomial_eval (by rw [degree_neg, hg2]; decide))) _ = 2 * ((univ.image fun x : R => eval x f) ∪ univ.image fun x : R => eval x (-g)).card := by
rw [card_union_of_disjoint hd]; simp [natDegree_eq_of_degree_eq_some hf2, natDegree_eq_of_degree_eq_some hg2, mul_add]
1,985
import Mathlib.FieldTheory.Separable import Mathlib.RingTheory.IntegralDomain import Mathlib.Algebra.CharP.Reduced import Mathlib.Tactic.ApplyFun #align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43" variable {K : Type*} {R : Type*} local notation "q" => Fintype.card K open Finset open scoped Polynomial namespace FiniteField
Mathlib/FieldTheory/Finite/Basic.lean
104
111
theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] : ∏ x : Kˣ, x = (-1 : Kˣ) := by
classical have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 := prod_involution (fun x _ => x⁻¹) (by simp) (fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff]) (fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp) rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one]
1,985
import Mathlib.FieldTheory.Separable import Mathlib.RingTheory.IntegralDomain import Mathlib.Algebra.CharP.Reduced import Mathlib.Tactic.ApplyFun #align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43" variable {K : Type*} {R : Type*} local notation "q" => Fintype.card K open Finset open scoped Polynomial namespace FiniteField theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] : ∏ x : Kˣ, x = (-1 : Kˣ) := by classical have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 := prod_involution (fun x _ => x⁻¹) (by simp) (fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff]) (fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp) rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one] #align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
Mathlib/FieldTheory/Finite/Basic.lean
115
139
theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K] (G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by
let n := Fintype.card G intro nzero have ⟨p, char_p⟩ := CharP.exists K have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero cases CharP.char_is_prime_or_zero K p with | inr pzero => exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd | inl pprime => have fact_pprime := Fact.mk pprime -- G has an element x of order p by Cauchy's theorem have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd -- F has an element u (= ↑↑x) of order p let u := ((x : Kˣ) : K) have hu : orderOf u = p := by rwa [orderOf_units, Subgroup.orderOf_coe] -- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ... have h : u = 1 := by rw [← sub_left_inj, sub_self 1] apply pow_eq_zero (n := p) rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self] exact Commute.one_right u -- ... meaning x didn't have order p after all, contradiction apply pprime.one_lt.ne rw [← hu, h, orderOf_one]
1,985
import Mathlib.FieldTheory.Separable import Mathlib.RingTheory.IntegralDomain import Mathlib.Algebra.CharP.Reduced import Mathlib.Tactic.ApplyFun #align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43" variable {K : Type*} {R : Type*} local notation "q" => Fintype.card K open Finset open scoped Polynomial namespace FiniteField theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] : ∏ x : Kˣ, x = (-1 : Kˣ) := by classical have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 := prod_involution (fun x _ => x⁻¹) (by simp) (fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff]) (fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp) rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one] #align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532 theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K] (G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by let n := Fintype.card G intro nzero have ⟨p, char_p⟩ := CharP.exists K have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero cases CharP.char_is_prime_or_zero K p with | inr pzero => exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd | inl pprime => have fact_pprime := Fact.mk pprime -- G has an element x of order p by Cauchy's theorem have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd -- F has an element u (= ↑↑x) of order p let u := ((x : Kˣ) : K) have hu : orderOf u = p := by rwa [orderOf_units, Subgroup.orderOf_coe] -- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ... have h : u = 1 := by rw [← sub_left_inj, sub_self 1] apply pow_eq_zero (n := p) rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self] exact Commute.one_right u -- ... meaning x didn't have order p after all, contradiction apply pprime.one_lt.ne rw [← hu, h, orderOf_one]
Mathlib/FieldTheory/Finite/Basic.lean
142
164
theorem sum_subgroup_units_eq_zero [Ring K] [NoZeroDivisors K] {G : Subgroup Kˣ} [Fintype G] (hg : G ≠ ⊥) : ∑ x : G, (x.val : K) = 0 := by
rw [Subgroup.ne_bot_iff_exists_ne_one] at hg rcases hg with ⟨a, ha⟩ -- The action of a on G as an embedding let a_mul_emb : G ↪ G := mulLeftEmbedding a -- ... and leaves G unchanged have h_unchanged : Finset.univ.map a_mul_emb = Finset.univ := by simp -- Therefore the sum of x over a G is the sum of a x over G have h_sum_map := Finset.univ.sum_map a_mul_emb fun x => ((x : Kˣ) : K) -- ... and the former is the sum of x over G. -- By algebraic manipulation, we have Σ G, x = ∑ G, a x = a ∑ G, x simp only [a_mul_emb, h_unchanged, Function.Embedding.coeFn_mk, Function.Embedding.toFun_eq_coe, mulLeftEmbedding_apply, Submonoid.coe_mul, Subgroup.coe_toSubmonoid, Units.val_mul, ← Finset.mul_sum] at h_sum_map -- thus one of (a - 1) or ∑ G, x is zero have hzero : (((a : Kˣ) : K) - 1) = 0 ∨ ∑ x : ↥G, ((x : Kˣ) : K) = 0 := by rw [← mul_eq_zero, sub_mul, ← h_sum_map, one_mul, sub_self] apply Or.resolve_left hzero contrapose! ha ext rwa [← sub_eq_zero]
1,985
import Mathlib.FieldTheory.Separable import Mathlib.RingTheory.IntegralDomain import Mathlib.Algebra.CharP.Reduced import Mathlib.Tactic.ApplyFun #align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43" variable {K : Type*} {R : Type*} local notation "q" => Fintype.card K open Finset open scoped Polynomial namespace FiniteField theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] : ∏ x : Kˣ, x = (-1 : Kˣ) := by classical have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 := prod_involution (fun x _ => x⁻¹) (by simp) (fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff]) (fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp) rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one] #align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532 theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K] (G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by let n := Fintype.card G intro nzero have ⟨p, char_p⟩ := CharP.exists K have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero cases CharP.char_is_prime_or_zero K p with | inr pzero => exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd | inl pprime => have fact_pprime := Fact.mk pprime -- G has an element x of order p by Cauchy's theorem have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd -- F has an element u (= ↑↑x) of order p let u := ((x : Kˣ) : K) have hu : orderOf u = p := by rwa [orderOf_units, Subgroup.orderOf_coe] -- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ... have h : u = 1 := by rw [← sub_left_inj, sub_self 1] apply pow_eq_zero (n := p) rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self] exact Commute.one_right u -- ... meaning x didn't have order p after all, contradiction apply pprime.one_lt.ne rw [← hu, h, orderOf_one] theorem sum_subgroup_units_eq_zero [Ring K] [NoZeroDivisors K] {G : Subgroup Kˣ} [Fintype G] (hg : G ≠ ⊥) : ∑ x : G, (x.val : K) = 0 := by rw [Subgroup.ne_bot_iff_exists_ne_one] at hg rcases hg with ⟨a, ha⟩ -- The action of a on G as an embedding let a_mul_emb : G ↪ G := mulLeftEmbedding a -- ... and leaves G unchanged have h_unchanged : Finset.univ.map a_mul_emb = Finset.univ := by simp -- Therefore the sum of x over a G is the sum of a x over G have h_sum_map := Finset.univ.sum_map a_mul_emb fun x => ((x : Kˣ) : K) -- ... and the former is the sum of x over G. -- By algebraic manipulation, we have Σ G, x = ∑ G, a x = a ∑ G, x simp only [a_mul_emb, h_unchanged, Function.Embedding.coeFn_mk, Function.Embedding.toFun_eq_coe, mulLeftEmbedding_apply, Submonoid.coe_mul, Subgroup.coe_toSubmonoid, Units.val_mul, ← Finset.mul_sum] at h_sum_map -- thus one of (a - 1) or ∑ G, x is zero have hzero : (((a : Kˣ) : K) - 1) = 0 ∨ ∑ x : ↥G, ((x : Kˣ) : K) = 0 := by rw [← mul_eq_zero, sub_mul, ← h_sum_map, one_mul, sub_self] apply Or.resolve_left hzero contrapose! ha ext rwa [← sub_eq_zero] @[simp]
Mathlib/FieldTheory/Finite/Basic.lean
168
176
theorem sum_subgroup_units [Ring K] [NoZeroDivisors K] {G : Subgroup Kˣ} [Fintype G] [Decidable (G = ⊥)] : ∑ x : G, (x.val : K) = if G = ⊥ then 1 else 0 := by
by_cases G_bot : G = ⊥ · subst G_bot simp only [ite_true, Subgroup.mem_bot, Fintype.card_ofSubsingleton, Nat.cast_ite, Nat.cast_one, Nat.cast_zero, univ_unique, Set.default_coe_singleton, sum_singleton, Units.val_one] · simp only [G_bot, ite_false] exact sum_subgroup_units_eq_zero G_bot
1,985
import Mathlib.FieldTheory.Separable import Mathlib.RingTheory.IntegralDomain import Mathlib.Algebra.CharP.Reduced import Mathlib.Tactic.ApplyFun #align_import field_theory.finite.basic from "leanprover-community/mathlib"@"12a85fac627bea918960da036049d611b1a3ee43" variable {K : Type*} {R : Type*} local notation "q" => Fintype.card K open Finset open scoped Polynomial namespace FiniteField theorem prod_univ_units_id_eq_neg_one [CommRing K] [IsDomain K] [Fintype Kˣ] : ∏ x : Kˣ, x = (-1 : Kˣ) := by classical have : (∏ x ∈ (@univ Kˣ _).erase (-1), x) = 1 := prod_involution (fun x _ => x⁻¹) (by simp) (fun a => by simp (config := { contextual := true }) [Units.inv_eq_self_iff]) (fun a => by simp [@inv_eq_iff_eq_inv _ _ a]) (by simp) rw [← insert_erase (mem_univ (-1 : Kˣ)), prod_insert (not_mem_erase _ _), this, mul_one] #align finite_field.prod_univ_units_id_eq_neg_one FiniteField.prod_univ_units_id_eq_neg_one set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532 theorem card_cast_subgroup_card_ne_zero [Ring K] [NoZeroDivisors K] [Nontrivial K] (G : Subgroup Kˣ) [Fintype G] : (Fintype.card G : K) ≠ 0 := by let n := Fintype.card G intro nzero have ⟨p, char_p⟩ := CharP.exists K have hd : p ∣ n := (CharP.cast_eq_zero_iff K p n).mp nzero cases CharP.char_is_prime_or_zero K p with | inr pzero => exact (Fintype.card_pos).ne' <| Nat.eq_zero_of_zero_dvd <| pzero ▸ hd | inl pprime => have fact_pprime := Fact.mk pprime -- G has an element x of order p by Cauchy's theorem have ⟨x, hx⟩ := exists_prime_orderOf_dvd_card p hd -- F has an element u (= ↑↑x) of order p let u := ((x : Kˣ) : K) have hu : orderOf u = p := by rwa [orderOf_units, Subgroup.orderOf_coe] -- u ^ p = 1 implies (u - 1) ^ p = 0 and hence u = 1 ... have h : u = 1 := by rw [← sub_left_inj, sub_self 1] apply pow_eq_zero (n := p) rw [sub_pow_char_of_commute, one_pow, ← hu, pow_orderOf_eq_one, sub_self] exact Commute.one_right u -- ... meaning x didn't have order p after all, contradiction apply pprime.one_lt.ne rw [← hu, h, orderOf_one] theorem sum_subgroup_units_eq_zero [Ring K] [NoZeroDivisors K] {G : Subgroup Kˣ} [Fintype G] (hg : G ≠ ⊥) : ∑ x : G, (x.val : K) = 0 := by rw [Subgroup.ne_bot_iff_exists_ne_one] at hg rcases hg with ⟨a, ha⟩ -- The action of a on G as an embedding let a_mul_emb : G ↪ G := mulLeftEmbedding a -- ... and leaves G unchanged have h_unchanged : Finset.univ.map a_mul_emb = Finset.univ := by simp -- Therefore the sum of x over a G is the sum of a x over G have h_sum_map := Finset.univ.sum_map a_mul_emb fun x => ((x : Kˣ) : K) -- ... and the former is the sum of x over G. -- By algebraic manipulation, we have Σ G, x = ∑ G, a x = a ∑ G, x simp only [a_mul_emb, h_unchanged, Function.Embedding.coeFn_mk, Function.Embedding.toFun_eq_coe, mulLeftEmbedding_apply, Submonoid.coe_mul, Subgroup.coe_toSubmonoid, Units.val_mul, ← Finset.mul_sum] at h_sum_map -- thus one of (a - 1) or ∑ G, x is zero have hzero : (((a : Kˣ) : K) - 1) = 0 ∨ ∑ x : ↥G, ((x : Kˣ) : K) = 0 := by rw [← mul_eq_zero, sub_mul, ← h_sum_map, one_mul, sub_self] apply Or.resolve_left hzero contrapose! ha ext rwa [← sub_eq_zero] @[simp] theorem sum_subgroup_units [Ring K] [NoZeroDivisors K] {G : Subgroup Kˣ} [Fintype G] [Decidable (G = ⊥)] : ∑ x : G, (x.val : K) = if G = ⊥ then 1 else 0 := by by_cases G_bot : G = ⊥ · subst G_bot simp only [ite_true, Subgroup.mem_bot, Fintype.card_ofSubsingleton, Nat.cast_ite, Nat.cast_one, Nat.cast_zero, univ_unique, Set.default_coe_singleton, sum_singleton, Units.val_one] · simp only [G_bot, ite_false] exact sum_subgroup_units_eq_zero G_bot @[simp]
Mathlib/FieldTheory/Finite/Basic.lean
179
210
theorem sum_subgroup_pow_eq_zero [CommRing K] [NoZeroDivisors K] {G : Subgroup Kˣ} [Fintype G] {k : ℕ} (k_pos : k ≠ 0) (k_lt_card_G : k < Fintype.card G) : ∑ x : G, ((x : Kˣ) : K) ^ k = 0 := by
nontriviality K have := NoZeroDivisors.to_isDomain K rcases (exists_pow_ne_one_of_isCyclic k_pos k_lt_card_G) with ⟨a, ha⟩ rw [Finset.sum_eq_multiset_sum] have h_multiset_map : Finset.univ.val.map (fun x : G => ((x : Kˣ) : K) ^ k) = Finset.univ.val.map (fun x : G => ((x : Kˣ) : K) ^ k * ((a : Kˣ) : K) ^ k) := by simp_rw [← mul_pow] have as_comp : (fun x : ↥G => (((x : Kˣ) : K) * ((a : Kˣ) : K)) ^ k) = (fun x : ↥G => ((x : Kˣ) : K) ^ k) ∘ fun x : ↥G => x * a := by funext x simp only [Function.comp_apply, Submonoid.coe_mul, Subgroup.coe_toSubmonoid, Units.val_mul] rw [as_comp, ← Multiset.map_map] congr rw [eq_comm] exact Multiset.map_univ_val_equiv (Equiv.mulRight a) have h_multiset_map_sum : (Multiset.map (fun x : G => ((x : Kˣ) : K) ^ k) Finset.univ.val).sum = (Multiset.map (fun x : G => ((x : Kˣ) : K) ^ k * ((a : Kˣ) : K) ^ k) Finset.univ.val).sum := by rw [h_multiset_map] rw [Multiset.sum_map_mul_right] at h_multiset_map_sum have hzero : (((a : Kˣ) : K) ^ k - 1 : K) * (Multiset.map (fun i : G => (i.val : K) ^ k) Finset.univ.val).sum = 0 := by rw [sub_mul, mul_comm, ← h_multiset_map_sum, one_mul, sub_self] rw [mul_eq_zero] at hzero refine hzero.resolve_left fun h => ha ?_ ext rw [← sub_eq_zero] simp_rw [SubmonoidClass.coe_pow, Units.val_pow_eq_pow_val, OneMemClass.coe_one, Units.val_one, h]
1,985
import Mathlib.FieldTheory.Finite.Basic #align_import number_theory.wilson from "leanprover-community/mathlib"@"c471da714c044131b90c133701e51b877c246677" open Finset Nat FiniteField ZMod open scoped Nat namespace ZMod variable (p : ℕ) [Fact p.Prime] @[simp]
Mathlib/NumberTheory/Wilson.lean
40
69
theorem wilsons_lemma : ((p - 1)! : ZMod p) = -1 := by
refine calc ((p - 1)! : ZMod p) = ∏ x ∈ Ico 1 (succ (p - 1)), (x : ZMod p) := by rw [← Finset.prod_Ico_id_eq_factorial, prod_natCast] _ = ∏ x : (ZMod p)ˣ, (x : ZMod p) := ?_ _ = -1 := by -- Porting note: `simp` is less powerful. -- simp_rw [← Units.coeHom_apply, ← (Units.coeHom (ZMod p)).map_prod, -- prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one] simp_rw [← Units.coeHom_apply] rw [← map_prod (Units.coeHom (ZMod p))] simp_rw [prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one] have hp : 0 < p := (Fact.out (p := p.Prime)).pos symm refine prod_bij (fun a _ => (a : ZMod p).val) ?_ ?_ ?_ ?_ · intro a ha rw [mem_Ico, ← Nat.succ_sub hp, Nat.add_one_sub_one] constructor · apply Nat.pos_of_ne_zero; rw [← @val_zero p] intro h; apply Units.ne_zero a (val_injective p h) · exact val_lt _ · intro _ _ _ _ h; rw [Units.ext_iff]; exact val_injective p h · intro b hb rw [mem_Ico, Nat.succ_le_iff, ← succ_sub hp, Nat.add_one_sub_one, pos_iff_ne_zero] at hb refine ⟨Units.mk0 b ?_, Finset.mem_univ _, ?_⟩ · intro h; apply hb.1; apply_fun val at h simpa only [val_cast_of_lt hb.right, val_zero] using h · simp only [val_cast_of_lt hb.right, Units.val_mk0] · rintro a -; simp only [cast_id, natCast_val]
1,986
import Mathlib.FieldTheory.Finite.Basic #align_import number_theory.wilson from "leanprover-community/mathlib"@"c471da714c044131b90c133701e51b877c246677" open Finset Nat FiniteField ZMod open scoped Nat namespace ZMod variable (p : ℕ) [Fact p.Prime] @[simp] theorem wilsons_lemma : ((p - 1)! : ZMod p) = -1 := by refine calc ((p - 1)! : ZMod p) = ∏ x ∈ Ico 1 (succ (p - 1)), (x : ZMod p) := by rw [← Finset.prod_Ico_id_eq_factorial, prod_natCast] _ = ∏ x : (ZMod p)ˣ, (x : ZMod p) := ?_ _ = -1 := by -- Porting note: `simp` is less powerful. -- simp_rw [← Units.coeHom_apply, ← (Units.coeHom (ZMod p)).map_prod, -- prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one] simp_rw [← Units.coeHom_apply] rw [← map_prod (Units.coeHom (ZMod p))] simp_rw [prod_univ_units_id_eq_neg_one, Units.coeHom_apply, Units.val_neg, Units.val_one] have hp : 0 < p := (Fact.out (p := p.Prime)).pos symm refine prod_bij (fun a _ => (a : ZMod p).val) ?_ ?_ ?_ ?_ · intro a ha rw [mem_Ico, ← Nat.succ_sub hp, Nat.add_one_sub_one] constructor · apply Nat.pos_of_ne_zero; rw [← @val_zero p] intro h; apply Units.ne_zero a (val_injective p h) · exact val_lt _ · intro _ _ _ _ h; rw [Units.ext_iff]; exact val_injective p h · intro b hb rw [mem_Ico, Nat.succ_le_iff, ← succ_sub hp, Nat.add_one_sub_one, pos_iff_ne_zero] at hb refine ⟨Units.mk0 b ?_, Finset.mem_univ _, ?_⟩ · intro h; apply hb.1; apply_fun val at h simpa only [val_cast_of_lt hb.right, val_zero] using h · simp only [val_cast_of_lt hb.right, Units.val_mk0] · rintro a -; simp only [cast_id, natCast_val] #align zmod.wilsons_lemma ZMod.wilsons_lemma @[simp]
Mathlib/NumberTheory/Wilson.lean
73
79
theorem prod_Ico_one_prime : ∏ x ∈ Ico 1 p, (x : ZMod p) = -1 := by
-- Porting note: was `conv in Ico 1 p =>` conv => congr congr rw [← Nat.add_one_sub_one p, succ_sub (Fact.out (p := p.Prime)).pos] rw [← prod_natCast, Finset.prod_Ico_id_eq_factorial, wilsons_lemma]
1,986
import Mathlib.FieldTheory.Finite.Basic #align_import number_theory.wilson from "leanprover-community/mathlib"@"c471da714c044131b90c133701e51b877c246677" open Finset Nat FiniteField ZMod open scoped Nat namespace Nat variable {n : ℕ}
Mathlib/NumberTheory/Wilson.lean
89
97
theorem prime_of_fac_equiv_neg_one (h : ((n - 1)! : ZMod n) = -1) (h1 : n ≠ 1) : Prime n := by
rcases eq_or_ne n 0 with (rfl | h0) · norm_num at h replace h1 : 1 < n := n.two_le_iff.mpr ⟨h0, h1⟩ by_contra h2 obtain ⟨m, hm1, hm2 : 1 < m, hm3⟩ := exists_dvd_of_not_prime2 h1 h2 have hm : m ∣ (n - 1)! := Nat.dvd_factorial (pos_of_gt hm2) (le_pred_of_lt hm3) refine hm2.ne' (Nat.dvd_one.mp ((Nat.dvd_add_right hm).mp (hm1.trans ?_))) rw [← ZMod.natCast_zmod_eq_zero_iff_dvd, cast_add, cast_one, h, add_left_neg]
1,986
import Mathlib.FieldTheory.Finite.Basic #align_import field_theory.chevalley_warning from "leanprover-community/mathlib"@"e001509c11c4d0f549d91d89da95b4a0b43c714f" universe u v section FiniteField open MvPolynomial open Function hiding eval open Finset FiniteField variable {K σ ι : Type*} [Fintype K] [Field K] [Fintype σ] [DecidableEq σ] local notation "q" => Fintype.card K
Mathlib/FieldTheory/ChevalleyWarning.lean
53
97
theorem MvPolynomial.sum_eval_eq_zero (f : MvPolynomial σ K) (h : f.totalDegree < (q - 1) * Fintype.card σ) : ∑ x, eval x f = 0 := by
haveI : DecidableEq K := Classical.decEq K calc ∑ x, eval x f = ∑ x : σ → K, ∑ d ∈ f.support, f.coeff d * ∏ i, x i ^ d i := by simp only [eval_eq'] _ = ∑ d ∈ f.support, ∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i := sum_comm _ = 0 := sum_eq_zero ?_ intro d hd obtain ⟨i, hi⟩ : ∃ i, d i < q - 1 := f.exists_degree_lt (q - 1) h hd calc (∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i) = f.coeff d * ∑ x : σ → K, ∏ i, x i ^ d i := (mul_sum ..).symm _ = 0 := (mul_eq_zero.mpr ∘ Or.inr) ?_ calc (∑ x : σ → K, ∏ i, x i ^ d i) = ∑ x₀ : { j // j ≠ i } → K, ∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j := (Fintype.sum_fiberwise _ _).symm _ = 0 := Fintype.sum_eq_zero _ ?_ intro x₀ let e : K ≃ { x // x ∘ ((↑) : _ → σ) = x₀ } := (Equiv.subtypeEquivCodomain _).symm calc (∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j) = ∑ a : K, ∏ j : σ, (e a : σ → K) j ^ d j := (e.sum_comp _).symm _ = ∑ a : K, (∏ j, x₀ j ^ d j) * a ^ d i := Fintype.sum_congr _ _ ?_ _ = (∏ j, x₀ j ^ d j) * ∑ a : K, a ^ d i := by rw [mul_sum] _ = 0 := by rw [sum_pow_lt_card_sub_one K _ hi, mul_zero] intro a let e' : Sum { j // j = i } { j // j ≠ i } ≃ σ := Equiv.sumCompl _ letI : Unique { j // j = i } := { default := ⟨i, rfl⟩ uniq := fun ⟨j, h⟩ => Subtype.val_injective h } calc (∏ j : σ, (e a : σ → K) j ^ d j) = (e a : σ → K) i ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [← e'.prod_comp, Fintype.prod_sum_type, univ_unique, prod_singleton]; rfl _ = a ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [Equiv.subtypeEquivCodomain_symm_apply_eq] _ = a ^ d i * ∏ j, x₀ j ^ d j := congr_arg _ (Fintype.prod_congr _ _ ?_) -- see below _ = (∏ j, x₀ j ^ d j) * a ^ d i := mul_comm _ _ -- the remaining step of the calculation above rintro ⟨j, hj⟩ show (e a : σ → K) j ^ d j = x₀ ⟨j, hj⟩ ^ d j rw [Equiv.subtypeEquivCodomain_symm_apply_ne]
1,987
import Mathlib.FieldTheory.Finite.Basic #align_import field_theory.chevalley_warning from "leanprover-community/mathlib"@"e001509c11c4d0f549d91d89da95b4a0b43c714f" universe u v section FiniteField open MvPolynomial open Function hiding eval open Finset FiniteField variable {K σ ι : Type*} [Fintype K] [Field K] [Fintype σ] [DecidableEq σ] local notation "q" => Fintype.card K theorem MvPolynomial.sum_eval_eq_zero (f : MvPolynomial σ K) (h : f.totalDegree < (q - 1) * Fintype.card σ) : ∑ x, eval x f = 0 := by haveI : DecidableEq K := Classical.decEq K calc ∑ x, eval x f = ∑ x : σ → K, ∑ d ∈ f.support, f.coeff d * ∏ i, x i ^ d i := by simp only [eval_eq'] _ = ∑ d ∈ f.support, ∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i := sum_comm _ = 0 := sum_eq_zero ?_ intro d hd obtain ⟨i, hi⟩ : ∃ i, d i < q - 1 := f.exists_degree_lt (q - 1) h hd calc (∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i) = f.coeff d * ∑ x : σ → K, ∏ i, x i ^ d i := (mul_sum ..).symm _ = 0 := (mul_eq_zero.mpr ∘ Or.inr) ?_ calc (∑ x : σ → K, ∏ i, x i ^ d i) = ∑ x₀ : { j // j ≠ i } → K, ∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j := (Fintype.sum_fiberwise _ _).symm _ = 0 := Fintype.sum_eq_zero _ ?_ intro x₀ let e : K ≃ { x // x ∘ ((↑) : _ → σ) = x₀ } := (Equiv.subtypeEquivCodomain _).symm calc (∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j) = ∑ a : K, ∏ j : σ, (e a : σ → K) j ^ d j := (e.sum_comp _).symm _ = ∑ a : K, (∏ j, x₀ j ^ d j) * a ^ d i := Fintype.sum_congr _ _ ?_ _ = (∏ j, x₀ j ^ d j) * ∑ a : K, a ^ d i := by rw [mul_sum] _ = 0 := by rw [sum_pow_lt_card_sub_one K _ hi, mul_zero] intro a let e' : Sum { j // j = i } { j // j ≠ i } ≃ σ := Equiv.sumCompl _ letI : Unique { j // j = i } := { default := ⟨i, rfl⟩ uniq := fun ⟨j, h⟩ => Subtype.val_injective h } calc (∏ j : σ, (e a : σ → K) j ^ d j) = (e a : σ → K) i ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [← e'.prod_comp, Fintype.prod_sum_type, univ_unique, prod_singleton]; rfl _ = a ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by rw [Equiv.subtypeEquivCodomain_symm_apply_eq] _ = a ^ d i * ∏ j, x₀ j ^ d j := congr_arg _ (Fintype.prod_congr _ _ ?_) -- see below _ = (∏ j, x₀ j ^ d j) * a ^ d i := mul_comm _ _ -- the remaining step of the calculation above rintro ⟨j, hj⟩ show (e a : σ → K) j ^ d j = x₀ ⟨j, hj⟩ ^ d j rw [Equiv.subtypeEquivCodomain_symm_apply_ne] #align mv_polynomial.sum_eval_eq_zero MvPolynomial.sum_eval_eq_zero variable [DecidableEq K] (p : ℕ) [CharP K p]
Mathlib/FieldTheory/ChevalleyWarning.lean
107
160
theorem char_dvd_card_solutions_of_sum_lt {s : Finset ι} {f : ι → MvPolynomial σ K} (h : (∑ i ∈ s, (f i).totalDegree) < Fintype.card σ) : p ∣ Fintype.card { x : σ → K // ∀ i ∈ s, eval x (f i) = 0 } := by
have hq : 0 < q - 1 := by rw [← Fintype.card_units, Fintype.card_pos_iff]; exact ⟨1⟩ let S : Finset (σ → K) := { x ∈ univ | ∀ i ∈ s, eval x (f i) = 0 }.toFinset have hS : ∀ x : σ → K, x ∈ S ↔ ∀ i : ι, i ∈ s → eval x (f i) = 0 := by intro x simp only [S, Set.toFinset_setOf, mem_univ, true_and, mem_filter] /- The polynomial `F = ∏ i ∈ s, (1 - (f i)^(q - 1))` has the nice property that it takes the value `1` on elements of `{x : σ → K // ∀ i ∈ s, (f i).eval x = 0}` while it is `0` outside that locus. Hence the sum of its values is equal to the cardinality of `{x : σ → K // ∀ i ∈ s, (f i).eval x = 0}` modulo `p`. -/ let F : MvPolynomial σ K := ∏ i ∈ s, (1 - f i ^ (q - 1)) have hF : ∀ x, eval x F = if x ∈ S then 1 else 0 := by intro x calc eval x F = ∏ i ∈ s, eval x (1 - f i ^ (q - 1)) := eval_prod s _ x _ = if x ∈ S then 1 else 0 := ?_ simp only [(eval x).map_sub, (eval x).map_pow, (eval x).map_one] split_ifs with hx · apply Finset.prod_eq_one intro i hi rw [hS] at hx rw [hx i hi, zero_pow hq.ne', sub_zero] · obtain ⟨i, hi, hx⟩ : ∃ i ∈ s, eval x (f i) ≠ 0 := by simpa [hS, not_forall, Classical.not_imp] using hx apply Finset.prod_eq_zero hi rw [pow_card_sub_one_eq_one (eval x (f i)) hx, sub_self] -- In particular, we can now show: have key : ∑ x, eval x F = Fintype.card { x : σ → K // ∀ i ∈ s, eval x (f i) = 0 } := by rw [Fintype.card_of_subtype S hS, card_eq_sum_ones, Nat.cast_sum, Nat.cast_one, ← Fintype.sum_extend_by_zero S, sum_congr rfl fun x _ => hF x] -- With these preparations under our belt, we will approach the main goal. show p ∣ Fintype.card { x // ∀ i : ι, i ∈ s → eval x (f i) = 0 } rw [← CharP.cast_eq_zero_iff K, ← key] show (∑ x, eval x F) = 0 -- We are now ready to apply the main machine, proven before. apply F.sum_eval_eq_zero -- It remains to verify the crucial assumption of this machine show F.totalDegree < (q - 1) * Fintype.card σ calc F.totalDegree ≤ ∑ i ∈ s, (1 - f i ^ (q - 1)).totalDegree := totalDegree_finset_prod s _ _ ≤ ∑ i ∈ s, (q - 1) * (f i).totalDegree := sum_le_sum fun i _ => ?_ -- see ↓ _ = (q - 1) * ∑ i ∈ s, (f i).totalDegree := (mul_sum ..).symm _ < (q - 1) * Fintype.card σ := by rwa [mul_lt_mul_left hq] -- Now we prove the remaining step from the preceding calculation show (1 - f i ^ (q - 1)).totalDegree ≤ (q - 1) * (f i).totalDegree calc (1 - f i ^ (q - 1)).totalDegree ≤ max (1 : MvPolynomial σ K).totalDegree (f i ^ (q - 1)).totalDegree := totalDegree_sub _ _ _ ≤ (f i ^ (q - 1)).totalDegree := by simp _ ≤ (q - 1) * (f i).totalDegree := totalDegree_pow _ _
1,987
import Mathlib.FieldTheory.Finite.Basic import Mathlib.Order.Filter.Cofinite #align_import number_theory.fermat_psp from "leanprover-community/mathlib"@"c0439b4877c24a117bfdd9e32faf62eee9b115eb" namespace Nat def ProbablePrime (n b : ℕ) : Prop := n ∣ b ^ (n - 1) - 1 #align fermat_psp.probable_prime Nat.ProbablePrime def FermatPsp (n b : ℕ) : Prop := ProbablePrime n b ∧ ¬n.Prime ∧ 1 < n #align fermat_psp Nat.FermatPsp instance decidableProbablePrime (n b : ℕ) : Decidable (ProbablePrime n b) := Nat.decidable_dvd _ _ #align fermat_psp.decidable_probable_prime Nat.decidableProbablePrime instance decidablePsp (n b : ℕ) : Decidable (FermatPsp n b) := And.decidable #align fermat_psp.decidable_psp Nat.decidablePsp
Mathlib/NumberTheory/FermatPsp.lean
75
99
theorem coprime_of_probablePrime {n b : ℕ} (h : ProbablePrime n b) (h₁ : 1 ≤ n) (h₂ : 1 ≤ b) : Nat.Coprime n b := by
by_cases h₃ : 2 ≤ n · -- To prove that `n` is coprime with `b`, we need to show that for all prime factors of `n`, -- we can derive a contradiction if `n` divides `b`. apply Nat.coprime_of_dvd -- If `k` is a prime number that divides both `n` and `b`, then we know that `n = m * k` and -- `b = j * k` for some natural numbers `m` and `j`. We substitute these into the hypothesis. rintro k hk ⟨m, rfl⟩ ⟨j, rfl⟩ -- Because prime numbers do not divide 1, it suffices to show that `k ∣ 1` to prove a -- contradiction apply Nat.Prime.not_dvd_one hk -- Since `n` divides `b ^ (n - 1) - 1`, `k` also divides `b ^ (n - 1) - 1` replace h := dvd_of_mul_right_dvd h -- Because `k` divides `b ^ (n - 1) - 1`, if we can show that `k` also divides `b ^ (n - 1)`, -- then we know `k` divides 1. rw [Nat.dvd_add_iff_right h, Nat.sub_add_cancel (Nat.one_le_pow _ _ h₂)] -- Since `k` divides `b`, `k` also divides any power of `b` except `b ^ 0`. Therefore, it -- suffices to show that `n - 1` isn't zero. However, we know that `n - 1` isn't zero because we -- assumed `2 ≤ n` when doing `by_cases`. refine dvd_of_mul_right_dvd (dvd_pow_self (k * j) ?_) omega -- If `n = 1`, then it follows trivially that `n` is coprime with `b`. · rw [show n = 1 by omega] norm_num
1,988
import Mathlib.FieldTheory.Finite.Basic import Mathlib.Order.Filter.Cofinite #align_import number_theory.fermat_psp from "leanprover-community/mathlib"@"c0439b4877c24a117bfdd9e32faf62eee9b115eb" namespace Nat def ProbablePrime (n b : ℕ) : Prop := n ∣ b ^ (n - 1) - 1 #align fermat_psp.probable_prime Nat.ProbablePrime def FermatPsp (n b : ℕ) : Prop := ProbablePrime n b ∧ ¬n.Prime ∧ 1 < n #align fermat_psp Nat.FermatPsp instance decidableProbablePrime (n b : ℕ) : Decidable (ProbablePrime n b) := Nat.decidable_dvd _ _ #align fermat_psp.decidable_probable_prime Nat.decidableProbablePrime instance decidablePsp (n b : ℕ) : Decidable (FermatPsp n b) := And.decidable #align fermat_psp.decidable_psp Nat.decidablePsp theorem coprime_of_probablePrime {n b : ℕ} (h : ProbablePrime n b) (h₁ : 1 ≤ n) (h₂ : 1 ≤ b) : Nat.Coprime n b := by by_cases h₃ : 2 ≤ n · -- To prove that `n` is coprime with `b`, we need to show that for all prime factors of `n`, -- we can derive a contradiction if `n` divides `b`. apply Nat.coprime_of_dvd -- If `k` is a prime number that divides both `n` and `b`, then we know that `n = m * k` and -- `b = j * k` for some natural numbers `m` and `j`. We substitute these into the hypothesis. rintro k hk ⟨m, rfl⟩ ⟨j, rfl⟩ -- Because prime numbers do not divide 1, it suffices to show that `k ∣ 1` to prove a -- contradiction apply Nat.Prime.not_dvd_one hk -- Since `n` divides `b ^ (n - 1) - 1`, `k` also divides `b ^ (n - 1) - 1` replace h := dvd_of_mul_right_dvd h -- Because `k` divides `b ^ (n - 1) - 1`, if we can show that `k` also divides `b ^ (n - 1)`, -- then we know `k` divides 1. rw [Nat.dvd_add_iff_right h, Nat.sub_add_cancel (Nat.one_le_pow _ _ h₂)] -- Since `k` divides `b`, `k` also divides any power of `b` except `b ^ 0`. Therefore, it -- suffices to show that `n - 1` isn't zero. However, we know that `n - 1` isn't zero because we -- assumed `2 ≤ n` when doing `by_cases`. refine dvd_of_mul_right_dvd (dvd_pow_self (k * j) ?_) omega -- If `n = 1`, then it follows trivially that `n` is coprime with `b`. · rw [show n = 1 by omega] norm_num #align fermat_psp.coprime_of_probable_prime Nat.coprime_of_probablePrime
Mathlib/NumberTheory/FermatPsp.lean
102
112
theorem probablePrime_iff_modEq (n : ℕ) {b : ℕ} (h : 1 ≤ b) : ProbablePrime n b ↔ b ^ (n - 1) ≡ 1 [MOD n] := by
have : 1 ≤ b ^ (n - 1) := one_le_pow_of_one_le h (n - 1) -- For exact mod_cast rw [Nat.ModEq.comm] constructor · intro h₁ apply Nat.modEq_of_dvd exact mod_cast h₁ · intro h₁ exact mod_cast Nat.ModEq.dvd h₁
1,988
import Mathlib.FieldTheory.Finite.Basic import Mathlib.Order.Filter.Cofinite #align_import number_theory.fermat_psp from "leanprover-community/mathlib"@"c0439b4877c24a117bfdd9e32faf62eee9b115eb" namespace Nat def ProbablePrime (n b : ℕ) : Prop := n ∣ b ^ (n - 1) - 1 #align fermat_psp.probable_prime Nat.ProbablePrime def FermatPsp (n b : ℕ) : Prop := ProbablePrime n b ∧ ¬n.Prime ∧ 1 < n #align fermat_psp Nat.FermatPsp instance decidableProbablePrime (n b : ℕ) : Decidable (ProbablePrime n b) := Nat.decidable_dvd _ _ #align fermat_psp.decidable_probable_prime Nat.decidableProbablePrime instance decidablePsp (n b : ℕ) : Decidable (FermatPsp n b) := And.decidable #align fermat_psp.decidable_psp Nat.decidablePsp theorem coprime_of_probablePrime {n b : ℕ} (h : ProbablePrime n b) (h₁ : 1 ≤ n) (h₂ : 1 ≤ b) : Nat.Coprime n b := by by_cases h₃ : 2 ≤ n · -- To prove that `n` is coprime with `b`, we need to show that for all prime factors of `n`, -- we can derive a contradiction if `n` divides `b`. apply Nat.coprime_of_dvd -- If `k` is a prime number that divides both `n` and `b`, then we know that `n = m * k` and -- `b = j * k` for some natural numbers `m` and `j`. We substitute these into the hypothesis. rintro k hk ⟨m, rfl⟩ ⟨j, rfl⟩ -- Because prime numbers do not divide 1, it suffices to show that `k ∣ 1` to prove a -- contradiction apply Nat.Prime.not_dvd_one hk -- Since `n` divides `b ^ (n - 1) - 1`, `k` also divides `b ^ (n - 1) - 1` replace h := dvd_of_mul_right_dvd h -- Because `k` divides `b ^ (n - 1) - 1`, if we can show that `k` also divides `b ^ (n - 1)`, -- then we know `k` divides 1. rw [Nat.dvd_add_iff_right h, Nat.sub_add_cancel (Nat.one_le_pow _ _ h₂)] -- Since `k` divides `b`, `k` also divides any power of `b` except `b ^ 0`. Therefore, it -- suffices to show that `n - 1` isn't zero. However, we know that `n - 1` isn't zero because we -- assumed `2 ≤ n` when doing `by_cases`. refine dvd_of_mul_right_dvd (dvd_pow_self (k * j) ?_) omega -- If `n = 1`, then it follows trivially that `n` is coprime with `b`. · rw [show n = 1 by omega] norm_num #align fermat_psp.coprime_of_probable_prime Nat.coprime_of_probablePrime theorem probablePrime_iff_modEq (n : ℕ) {b : ℕ} (h : 1 ≤ b) : ProbablePrime n b ↔ b ^ (n - 1) ≡ 1 [MOD n] := by have : 1 ≤ b ^ (n - 1) := one_le_pow_of_one_le h (n - 1) -- For exact mod_cast rw [Nat.ModEq.comm] constructor · intro h₁ apply Nat.modEq_of_dvd exact mod_cast h₁ · intro h₁ exact mod_cast Nat.ModEq.dvd h₁ #align fermat_psp.probable_prime_iff_modeq Nat.probablePrime_iff_modEq
Mathlib/NumberTheory/FermatPsp.lean
120
122
theorem coprime_of_fermatPsp {n b : ℕ} (h : FermatPsp n b) (h₁ : 1 ≤ b) : Nat.Coprime n b := by
rcases h with ⟨hp, _, hn₂⟩ exact coprime_of_probablePrime hp (by omega) h₁
1,988
import Mathlib.FieldTheory.Finite.Basic import Mathlib.Order.Filter.Cofinite #align_import number_theory.fermat_psp from "leanprover-community/mathlib"@"c0439b4877c24a117bfdd9e32faf62eee9b115eb" namespace Nat def ProbablePrime (n b : ℕ) : Prop := n ∣ b ^ (n - 1) - 1 #align fermat_psp.probable_prime Nat.ProbablePrime def FermatPsp (n b : ℕ) : Prop := ProbablePrime n b ∧ ¬n.Prime ∧ 1 < n #align fermat_psp Nat.FermatPsp instance decidableProbablePrime (n b : ℕ) : Decidable (ProbablePrime n b) := Nat.decidable_dvd _ _ #align fermat_psp.decidable_probable_prime Nat.decidableProbablePrime instance decidablePsp (n b : ℕ) : Decidable (FermatPsp n b) := And.decidable #align fermat_psp.decidable_psp Nat.decidablePsp theorem coprime_of_probablePrime {n b : ℕ} (h : ProbablePrime n b) (h₁ : 1 ≤ n) (h₂ : 1 ≤ b) : Nat.Coprime n b := by by_cases h₃ : 2 ≤ n · -- To prove that `n` is coprime with `b`, we need to show that for all prime factors of `n`, -- we can derive a contradiction if `n` divides `b`. apply Nat.coprime_of_dvd -- If `k` is a prime number that divides both `n` and `b`, then we know that `n = m * k` and -- `b = j * k` for some natural numbers `m` and `j`. We substitute these into the hypothesis. rintro k hk ⟨m, rfl⟩ ⟨j, rfl⟩ -- Because prime numbers do not divide 1, it suffices to show that `k ∣ 1` to prove a -- contradiction apply Nat.Prime.not_dvd_one hk -- Since `n` divides `b ^ (n - 1) - 1`, `k` also divides `b ^ (n - 1) - 1` replace h := dvd_of_mul_right_dvd h -- Because `k` divides `b ^ (n - 1) - 1`, if we can show that `k` also divides `b ^ (n - 1)`, -- then we know `k` divides 1. rw [Nat.dvd_add_iff_right h, Nat.sub_add_cancel (Nat.one_le_pow _ _ h₂)] -- Since `k` divides `b`, `k` also divides any power of `b` except `b ^ 0`. Therefore, it -- suffices to show that `n - 1` isn't zero. However, we know that `n - 1` isn't zero because we -- assumed `2 ≤ n` when doing `by_cases`. refine dvd_of_mul_right_dvd (dvd_pow_self (k * j) ?_) omega -- If `n = 1`, then it follows trivially that `n` is coprime with `b`. · rw [show n = 1 by omega] norm_num #align fermat_psp.coprime_of_probable_prime Nat.coprime_of_probablePrime theorem probablePrime_iff_modEq (n : ℕ) {b : ℕ} (h : 1 ≤ b) : ProbablePrime n b ↔ b ^ (n - 1) ≡ 1 [MOD n] := by have : 1 ≤ b ^ (n - 1) := one_le_pow_of_one_le h (n - 1) -- For exact mod_cast rw [Nat.ModEq.comm] constructor · intro h₁ apply Nat.modEq_of_dvd exact mod_cast h₁ · intro h₁ exact mod_cast Nat.ModEq.dvd h₁ #align fermat_psp.probable_prime_iff_modeq Nat.probablePrime_iff_modEq theorem coprime_of_fermatPsp {n b : ℕ} (h : FermatPsp n b) (h₁ : 1 ≤ b) : Nat.Coprime n b := by rcases h with ⟨hp, _, hn₂⟩ exact coprime_of_probablePrime hp (by omega) h₁ #align fermat_psp.coprime_of_fermat_psp Nat.coprime_of_fermatPsp
Mathlib/NumberTheory/FermatPsp.lean
127
130
theorem fermatPsp_base_one {n : ℕ} (h₁ : 1 < n) (h₂ : ¬n.Prime) : FermatPsp n 1 := by
refine ⟨show n ∣ 1 ^ (n - 1) - 1 from ?_, h₂, h₁⟩ exact show 0 = 1 ^ (n - 1) - 1 by set_option tactic.skipAssignedInstances false in norm_num ▸ dvd_zero n
1,988
import Mathlib.Algebra.MvPolynomial.Expand import Mathlib.FieldTheory.Finite.Basic import Mathlib.RingTheory.MvPolynomial.Basic #align_import field_theory.finite.polynomial from "leanprover-community/mathlib"@"5aa3c1de9f3c642eac76e11071c852766f220fd0" namespace MvPolynomial variable {σ : Type*} theorem C_dvd_iff_zmod (n : ℕ) (φ : MvPolynomial σ ℤ) : C (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 := C_dvd_iff_map_hom_eq_zero _ _ (CharP.intCast_eq_zero_iff (ZMod n) n) _ set_option linter.uppercaseLean3 false in #align mv_polynomial.C_dvd_iff_zmod MvPolynomial.C_dvd_iff_zmod section frobenius variable {p : ℕ} [Fact p.Prime]
Mathlib/FieldTheory/Finite/Polynomial.lean
33
38
theorem frobenius_zmod (f : MvPolynomial σ (ZMod p)) : frobenius _ p f = expand p f := by
apply induction_on f · intro a; rw [expand_C, frobenius_def, ← C_pow, ZMod.pow_card] · simp only [AlgHom.map_add, RingHom.map_add]; intro _ _ hf hg; rw [hf, hg] · simp only [expand_X, RingHom.map_mul, AlgHom.map_mul] intro _ _ hf; rw [hf, frobenius_def]
1,989
import Mathlib.FieldTheory.Finite.Polynomial import Mathlib.NumberTheory.Basic import Mathlib.RingTheory.WittVector.WittPolynomial #align_import ring_theory.witt_vector.structure_polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open MvPolynomial Set open Finset (range) open Finsupp (single) -- This lemma reduces a bundled morphism to a "mere" function, -- and consequently the simplifier cannot use a lot of powerful simp-lemmas. -- We disable this locally, and probably it should be disabled globally in mathlib. attribute [-simp] coe_eval₂Hom variable {p : ℕ} {R : Type*} {idx : Type*} [CommRing R] open scoped Witt section PPrime variable (p) [hp : Fact p.Prime] -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ noncomputable def wittStructureRat (Φ : MvPolynomial idx ℚ) (n : ℕ) : MvPolynomial (idx × ℕ) ℚ := bind₁ (fun k => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) (xInTermsOfW p ℚ n) #align witt_structure_rat wittStructureRat
Mathlib/RingTheory/WittVector/StructurePolynomial.lean
140
148
theorem wittStructureRat_prop (Φ : MvPolynomial idx ℚ) (n : ℕ) : bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := calc bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun k => bind₁ (fun i => (rename (Prod.mk i)) (W_ ℚ k)) Φ) (bind₁ (xInTermsOfW p ℚ) (W_ ℚ n)) := by
rw [bind₁_bind₁]; exact eval₂Hom_congr (RingHom.ext_rat _ _) rfl rfl _ = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by rw [bind₁_xInTermsOfW_wittPolynomial p _ n, bind₁_X_right]
1,990
import Mathlib.FieldTheory.Finite.Polynomial import Mathlib.NumberTheory.Basic import Mathlib.RingTheory.WittVector.WittPolynomial #align_import ring_theory.witt_vector.structure_polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open MvPolynomial Set open Finset (range) open Finsupp (single) -- This lemma reduces a bundled morphism to a "mere" function, -- and consequently the simplifier cannot use a lot of powerful simp-lemmas. -- We disable this locally, and probably it should be disabled globally in mathlib. attribute [-simp] coe_eval₂Hom variable {p : ℕ} {R : Type*} {idx : Type*} [CommRing R] open scoped Witt section PPrime variable (p) [hp : Fact p.Prime] -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ noncomputable def wittStructureRat (Φ : MvPolynomial idx ℚ) (n : ℕ) : MvPolynomial (idx × ℕ) ℚ := bind₁ (fun k => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) (xInTermsOfW p ℚ n) #align witt_structure_rat wittStructureRat theorem wittStructureRat_prop (Φ : MvPolynomial idx ℚ) (n : ℕ) : bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := calc bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun k => bind₁ (fun i => (rename (Prod.mk i)) (W_ ℚ k)) Φ) (bind₁ (xInTermsOfW p ℚ) (W_ ℚ n)) := by rw [bind₁_bind₁]; exact eval₂Hom_congr (RingHom.ext_rat _ _) rfl rfl _ = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by rw [bind₁_xInTermsOfW_wittPolynomial p _ n, bind₁_X_right] #align witt_structure_rat_prop wittStructureRat_prop
Mathlib/RingTheory/WittVector/StructurePolynomial.lean
151
161
theorem wittStructureRat_existsUnique (Φ : MvPolynomial idx ℚ) : ∃! φ : ℕ → MvPolynomial (idx × ℕ) ℚ, ∀ n : ℕ, bind₁ φ (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by
refine ⟨wittStructureRat p Φ, ?_, ?_⟩ · intro n; apply wittStructureRat_prop · intro φ H funext n rw [show φ n = bind₁ φ (bind₁ (W_ ℚ) (xInTermsOfW p ℚ n)) by rw [bind₁_wittPolynomial_xInTermsOfW p, bind₁_X_right]] rw [bind₁_bind₁] exact eval₂Hom_congr (RingHom.ext_rat _ _) (funext H) rfl
1,990
import Mathlib.FieldTheory.Finite.Polynomial import Mathlib.NumberTheory.Basic import Mathlib.RingTheory.WittVector.WittPolynomial #align_import ring_theory.witt_vector.structure_polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open MvPolynomial Set open Finset (range) open Finsupp (single) -- This lemma reduces a bundled morphism to a "mere" function, -- and consequently the simplifier cannot use a lot of powerful simp-lemmas. -- We disable this locally, and probably it should be disabled globally in mathlib. attribute [-simp] coe_eval₂Hom variable {p : ℕ} {R : Type*} {idx : Type*} [CommRing R] open scoped Witt section PPrime variable (p) [hp : Fact p.Prime] -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ noncomputable def wittStructureRat (Φ : MvPolynomial idx ℚ) (n : ℕ) : MvPolynomial (idx × ℕ) ℚ := bind₁ (fun k => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) (xInTermsOfW p ℚ n) #align witt_structure_rat wittStructureRat theorem wittStructureRat_prop (Φ : MvPolynomial idx ℚ) (n : ℕ) : bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := calc bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun k => bind₁ (fun i => (rename (Prod.mk i)) (W_ ℚ k)) Φ) (bind₁ (xInTermsOfW p ℚ) (W_ ℚ n)) := by rw [bind₁_bind₁]; exact eval₂Hom_congr (RingHom.ext_rat _ _) rfl rfl _ = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by rw [bind₁_xInTermsOfW_wittPolynomial p _ n, bind₁_X_right] #align witt_structure_rat_prop wittStructureRat_prop theorem wittStructureRat_existsUnique (Φ : MvPolynomial idx ℚ) : ∃! φ : ℕ → MvPolynomial (idx × ℕ) ℚ, ∀ n : ℕ, bind₁ φ (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by refine ⟨wittStructureRat p Φ, ?_, ?_⟩ · intro n; apply wittStructureRat_prop · intro φ H funext n rw [show φ n = bind₁ φ (bind₁ (W_ ℚ) (xInTermsOfW p ℚ n)) by rw [bind₁_wittPolynomial_xInTermsOfW p, bind₁_X_right]] rw [bind₁_bind₁] exact eval₂Hom_congr (RingHom.ext_rat _ _) (funext H) rfl #align witt_structure_rat_exists_unique wittStructureRat_existsUnique
Mathlib/RingTheory/WittVector/StructurePolynomial.lean
164
175
theorem wittStructureRat_rec_aux (Φ : MvPolynomial idx ℚ) (n : ℕ) : wittStructureRat p Φ n * C ((p : ℚ) ^ n) = bind₁ (fun b => rename (fun i => (b, i)) (W_ ℚ n)) Φ - ∑ i ∈ range n, C ((p : ℚ) ^ i) * wittStructureRat p Φ i ^ p ^ (n - i) := by
have := xInTermsOfW_aux p ℚ n replace := congr_arg (bind₁ fun k : ℕ => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) this rw [AlgHom.map_mul, bind₁_C_right] at this rw [wittStructureRat, this]; clear this conv_lhs => simp only [AlgHom.map_sub, bind₁_X_right] rw [sub_right_inj] simp only [AlgHom.map_sum, AlgHom.map_mul, bind₁_C_right, AlgHom.map_pow] rfl
1,990
import Mathlib.FieldTheory.Finite.Polynomial import Mathlib.NumberTheory.Basic import Mathlib.RingTheory.WittVector.WittPolynomial #align_import ring_theory.witt_vector.structure_polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open MvPolynomial Set open Finset (range) open Finsupp (single) -- This lemma reduces a bundled morphism to a "mere" function, -- and consequently the simplifier cannot use a lot of powerful simp-lemmas. -- We disable this locally, and probably it should be disabled globally in mathlib. attribute [-simp] coe_eval₂Hom variable {p : ℕ} {R : Type*} {idx : Type*} [CommRing R] open scoped Witt section PPrime variable (p) [hp : Fact p.Prime] -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ noncomputable def wittStructureRat (Φ : MvPolynomial idx ℚ) (n : ℕ) : MvPolynomial (idx × ℕ) ℚ := bind₁ (fun k => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) (xInTermsOfW p ℚ n) #align witt_structure_rat wittStructureRat theorem wittStructureRat_prop (Φ : MvPolynomial idx ℚ) (n : ℕ) : bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := calc bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun k => bind₁ (fun i => (rename (Prod.mk i)) (W_ ℚ k)) Φ) (bind₁ (xInTermsOfW p ℚ) (W_ ℚ n)) := by rw [bind₁_bind₁]; exact eval₂Hom_congr (RingHom.ext_rat _ _) rfl rfl _ = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by rw [bind₁_xInTermsOfW_wittPolynomial p _ n, bind₁_X_right] #align witt_structure_rat_prop wittStructureRat_prop theorem wittStructureRat_existsUnique (Φ : MvPolynomial idx ℚ) : ∃! φ : ℕ → MvPolynomial (idx × ℕ) ℚ, ∀ n : ℕ, bind₁ φ (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by refine ⟨wittStructureRat p Φ, ?_, ?_⟩ · intro n; apply wittStructureRat_prop · intro φ H funext n rw [show φ n = bind₁ φ (bind₁ (W_ ℚ) (xInTermsOfW p ℚ n)) by rw [bind₁_wittPolynomial_xInTermsOfW p, bind₁_X_right]] rw [bind₁_bind₁] exact eval₂Hom_congr (RingHom.ext_rat _ _) (funext H) rfl #align witt_structure_rat_exists_unique wittStructureRat_existsUnique theorem wittStructureRat_rec_aux (Φ : MvPolynomial idx ℚ) (n : ℕ) : wittStructureRat p Φ n * C ((p : ℚ) ^ n) = bind₁ (fun b => rename (fun i => (b, i)) (W_ ℚ n)) Φ - ∑ i ∈ range n, C ((p : ℚ) ^ i) * wittStructureRat p Φ i ^ p ^ (n - i) := by have := xInTermsOfW_aux p ℚ n replace := congr_arg (bind₁ fun k : ℕ => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) this rw [AlgHom.map_mul, bind₁_C_right] at this rw [wittStructureRat, this]; clear this conv_lhs => simp only [AlgHom.map_sub, bind₁_X_right] rw [sub_right_inj] simp only [AlgHom.map_sum, AlgHom.map_mul, bind₁_C_right, AlgHom.map_pow] rfl #align witt_structure_rat_rec_aux wittStructureRat_rec_aux
Mathlib/RingTheory/WittVector/StructurePolynomial.lean
179
188
theorem wittStructureRat_rec (Φ : MvPolynomial idx ℚ) (n : ℕ) : wittStructureRat p Φ n = C (1 / (p : ℚ) ^ n) * (bind₁ (fun b => rename (fun i => (b, i)) (W_ ℚ n)) Φ - ∑ i ∈ range n, C ((p : ℚ) ^ i) * wittStructureRat p Φ i ^ p ^ (n - i)) := by
calc wittStructureRat p Φ n = C (1 / (p : ℚ) ^ n) * (wittStructureRat p Φ n * C ((p : ℚ) ^ n)) := ?_ _ = _ := by rw [wittStructureRat_rec_aux] rw [mul_left_comm, ← C_mul, div_mul_cancel₀, C_1, mul_one] exact pow_ne_zero _ (Nat.cast_ne_zero.2 hp.1.ne_zero)
1,990
import Mathlib.FieldTheory.Finite.Polynomial import Mathlib.NumberTheory.Basic import Mathlib.RingTheory.WittVector.WittPolynomial #align_import ring_theory.witt_vector.structure_polynomial from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a" open MvPolynomial Set open Finset (range) open Finsupp (single) -- This lemma reduces a bundled morphism to a "mere" function, -- and consequently the simplifier cannot use a lot of powerful simp-lemmas. -- We disable this locally, and probably it should be disabled globally in mathlib. attribute [-simp] coe_eval₂Hom variable {p : ℕ} {R : Type*} {idx : Type*} [CommRing R] open scoped Witt section PPrime variable (p) [hp : Fact p.Prime] -- Notation with ring of coefficients explicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W_" => wittPolynomial p -- Notation with ring of coefficients implicit set_option quotPrecheck false in @[inherit_doc] scoped[Witt] notation "W" => wittPolynomial p _ noncomputable def wittStructureRat (Φ : MvPolynomial idx ℚ) (n : ℕ) : MvPolynomial (idx × ℕ) ℚ := bind₁ (fun k => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) (xInTermsOfW p ℚ n) #align witt_structure_rat wittStructureRat theorem wittStructureRat_prop (Φ : MvPolynomial idx ℚ) (n : ℕ) : bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := calc bind₁ (wittStructureRat p Φ) (W_ ℚ n) = bind₁ (fun k => bind₁ (fun i => (rename (Prod.mk i)) (W_ ℚ k)) Φ) (bind₁ (xInTermsOfW p ℚ) (W_ ℚ n)) := by rw [bind₁_bind₁]; exact eval₂Hom_congr (RingHom.ext_rat _ _) rfl rfl _ = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by rw [bind₁_xInTermsOfW_wittPolynomial p _ n, bind₁_X_right] #align witt_structure_rat_prop wittStructureRat_prop theorem wittStructureRat_existsUnique (Φ : MvPolynomial idx ℚ) : ∃! φ : ℕ → MvPolynomial (idx × ℕ) ℚ, ∀ n : ℕ, bind₁ φ (W_ ℚ n) = bind₁ (fun i => rename (Prod.mk i) (W_ ℚ n)) Φ := by refine ⟨wittStructureRat p Φ, ?_, ?_⟩ · intro n; apply wittStructureRat_prop · intro φ H funext n rw [show φ n = bind₁ φ (bind₁ (W_ ℚ) (xInTermsOfW p ℚ n)) by rw [bind₁_wittPolynomial_xInTermsOfW p, bind₁_X_right]] rw [bind₁_bind₁] exact eval₂Hom_congr (RingHom.ext_rat _ _) (funext H) rfl #align witt_structure_rat_exists_unique wittStructureRat_existsUnique theorem wittStructureRat_rec_aux (Φ : MvPolynomial idx ℚ) (n : ℕ) : wittStructureRat p Φ n * C ((p : ℚ) ^ n) = bind₁ (fun b => rename (fun i => (b, i)) (W_ ℚ n)) Φ - ∑ i ∈ range n, C ((p : ℚ) ^ i) * wittStructureRat p Φ i ^ p ^ (n - i) := by have := xInTermsOfW_aux p ℚ n replace := congr_arg (bind₁ fun k : ℕ => bind₁ (fun i => rename (Prod.mk i) (W_ ℚ k)) Φ) this rw [AlgHom.map_mul, bind₁_C_right] at this rw [wittStructureRat, this]; clear this conv_lhs => simp only [AlgHom.map_sub, bind₁_X_right] rw [sub_right_inj] simp only [AlgHom.map_sum, AlgHom.map_mul, bind₁_C_right, AlgHom.map_pow] rfl #align witt_structure_rat_rec_aux wittStructureRat_rec_aux theorem wittStructureRat_rec (Φ : MvPolynomial idx ℚ) (n : ℕ) : wittStructureRat p Φ n = C (1 / (p : ℚ) ^ n) * (bind₁ (fun b => rename (fun i => (b, i)) (W_ ℚ n)) Φ - ∑ i ∈ range n, C ((p : ℚ) ^ i) * wittStructureRat p Φ i ^ p ^ (n - i)) := by calc wittStructureRat p Φ n = C (1 / (p : ℚ) ^ n) * (wittStructureRat p Φ n * C ((p : ℚ) ^ n)) := ?_ _ = _ := by rw [wittStructureRat_rec_aux] rw [mul_left_comm, ← C_mul, div_mul_cancel₀, C_1, mul_one] exact pow_ne_zero _ (Nat.cast_ne_zero.2 hp.1.ne_zero) #align witt_structure_rat_rec wittStructureRat_rec noncomputable def wittStructureInt (Φ : MvPolynomial idx ℤ) (n : ℕ) : MvPolynomial (idx × ℕ) ℤ := Finsupp.mapRange Rat.num (Rat.num_intCast 0) (wittStructureRat p (map (Int.castRingHom ℚ) Φ) n) #align witt_structure_int wittStructureInt variable {p}
Mathlib/RingTheory/WittVector/StructurePolynomial.lean
209
226
theorem bind₁_rename_expand_wittPolynomial (Φ : MvPolynomial idx ℤ) (n : ℕ) (IH : ∀ m : ℕ, m < n + 1 → map (Int.castRingHom ℚ) (wittStructureInt p Φ m) = wittStructureRat p (map (Int.castRingHom ℚ) Φ) m) : bind₁ (fun b => rename (fun i => (b, i)) (expand p (W_ ℤ n))) Φ = bind₁ (fun i => expand p (wittStructureInt p Φ i)) (W_ ℤ n) := by
apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective simp only [map_bind₁, map_rename, map_expand, rename_expand, map_wittPolynomial] have key := (wittStructureRat_prop p (map (Int.castRingHom ℚ) Φ) n).symm apply_fun expand p at key simp only [expand_bind₁] at key rw [key]; clear key apply eval₂Hom_congr' rfl _ rfl rintro i hi - rw [wittPolynomial_vars, Finset.mem_range] at hi simp only [IH i hi]
1,990
import Mathlib.RingTheory.WittVector.StructurePolynomial #align_import ring_theory.witt_vector.defs from "leanprover-community/mathlib"@"f1944b30c97c5eb626e498307dec8b022a05bd0a" noncomputable section structure WittVector (p : ℕ) (R : Type*) where mk' :: coeff : ℕ → R #align witt_vector WittVector -- Porting note: added to make the `p` argument explicit def WittVector.mk (p : ℕ) {R : Type*} (coeff : ℕ → R) : WittVector p R := mk' coeff variable {p : ℕ} local notation "𝕎" => WittVector p -- type as `\bbW` namespace WittVector variable {R : Type*} @[ext]
Mathlib/RingTheory/WittVector/Defs.lean
74
78
theorem ext {x y : 𝕎 R} (h : ∀ n, x.coeff n = y.coeff n) : x = y := by
cases x cases y simp only at h simp [Function.funext_iff, h]
1,991
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue.
Mathlib/RingTheory/WittVector/Basic.lean
73
76
theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by
intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _)
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue. theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _) #align witt_vector.map_fun.injective WittVector.mapFun.injective theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x => ⟨mk _ fun n => Classical.choose <| hf <| x.coeff n, by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩ #align witt_vector.map_fun.surjective WittVector.mapFun.surjective -- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries. variable (f : R →+* S) (x y : WittVector p R) -- porting note: a very crude port. macro "map_fun_tac" : tactic => `(tactic| ( ext n simp only [mapFun, mk, comp_apply, zero_coeff, map_zero, -- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4 add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff, peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;> try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one` apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;> ext ⟨i, k⟩ <;> fin_cases i <;> rfl)) -- and until `pow`. -- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on.
Mathlib/RingTheory/WittVector/Basic.lean
102
102
theorem zero : mapFun f (0 : 𝕎 R) = 0 := by
map_fun_tac
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue. theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _) #align witt_vector.map_fun.injective WittVector.mapFun.injective theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x => ⟨mk _ fun n => Classical.choose <| hf <| x.coeff n, by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩ #align witt_vector.map_fun.surjective WittVector.mapFun.surjective -- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries. variable (f : R →+* S) (x y : WittVector p R) -- porting note: a very crude port. macro "map_fun_tac" : tactic => `(tactic| ( ext n simp only [mapFun, mk, comp_apply, zero_coeff, map_zero, -- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4 add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff, peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;> try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one` apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;> ext ⟨i, k⟩ <;> fin_cases i <;> rfl)) -- and until `pow`. -- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on. theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac #align witt_vector.map_fun.zero WittVector.mapFun.zero
Mathlib/RingTheory/WittVector/Basic.lean
105
105
theorem one : mapFun f (1 : 𝕎 R) = 1 := by
map_fun_tac
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue. theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _) #align witt_vector.map_fun.injective WittVector.mapFun.injective theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x => ⟨mk _ fun n => Classical.choose <| hf <| x.coeff n, by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩ #align witt_vector.map_fun.surjective WittVector.mapFun.surjective -- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries. variable (f : R →+* S) (x y : WittVector p R) -- porting note: a very crude port. macro "map_fun_tac" : tactic => `(tactic| ( ext n simp only [mapFun, mk, comp_apply, zero_coeff, map_zero, -- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4 add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff, peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;> try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one` apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;> ext ⟨i, k⟩ <;> fin_cases i <;> rfl)) -- and until `pow`. -- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on. theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac #align witt_vector.map_fun.zero WittVector.mapFun.zero theorem one : mapFun f (1 : 𝕎 R) = 1 := by map_fun_tac #align witt_vector.map_fun.one WittVector.mapFun.one
Mathlib/RingTheory/WittVector/Basic.lean
108
108
theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by
map_fun_tac
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue. theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _) #align witt_vector.map_fun.injective WittVector.mapFun.injective theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x => ⟨mk _ fun n => Classical.choose <| hf <| x.coeff n, by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩ #align witt_vector.map_fun.surjective WittVector.mapFun.surjective -- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries. variable (f : R →+* S) (x y : WittVector p R) -- porting note: a very crude port. macro "map_fun_tac" : tactic => `(tactic| ( ext n simp only [mapFun, mk, comp_apply, zero_coeff, map_zero, -- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4 add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff, peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;> try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one` apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;> ext ⟨i, k⟩ <;> fin_cases i <;> rfl)) -- and until `pow`. -- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on. theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac #align witt_vector.map_fun.zero WittVector.mapFun.zero theorem one : mapFun f (1 : 𝕎 R) = 1 := by map_fun_tac #align witt_vector.map_fun.one WittVector.mapFun.one theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac #align witt_vector.map_fun.add WittVector.mapFun.add
Mathlib/RingTheory/WittVector/Basic.lean
111
111
theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by
map_fun_tac
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue. theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _) #align witt_vector.map_fun.injective WittVector.mapFun.injective theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x => ⟨mk _ fun n => Classical.choose <| hf <| x.coeff n, by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩ #align witt_vector.map_fun.surjective WittVector.mapFun.surjective -- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries. variable (f : R →+* S) (x y : WittVector p R) -- porting note: a very crude port. macro "map_fun_tac" : tactic => `(tactic| ( ext n simp only [mapFun, mk, comp_apply, zero_coeff, map_zero, -- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4 add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff, peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;> try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one` apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;> ext ⟨i, k⟩ <;> fin_cases i <;> rfl)) -- and until `pow`. -- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on. theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac #align witt_vector.map_fun.zero WittVector.mapFun.zero theorem one : mapFun f (1 : 𝕎 R) = 1 := by map_fun_tac #align witt_vector.map_fun.one WittVector.mapFun.one theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac #align witt_vector.map_fun.add WittVector.mapFun.add theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac #align witt_vector.map_fun.sub WittVector.mapFun.sub
Mathlib/RingTheory/WittVector/Basic.lean
114
114
theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by
map_fun_tac
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue. theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _) #align witt_vector.map_fun.injective WittVector.mapFun.injective theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x => ⟨mk _ fun n => Classical.choose <| hf <| x.coeff n, by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩ #align witt_vector.map_fun.surjective WittVector.mapFun.surjective -- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries. variable (f : R →+* S) (x y : WittVector p R) -- porting note: a very crude port. macro "map_fun_tac" : tactic => `(tactic| ( ext n simp only [mapFun, mk, comp_apply, zero_coeff, map_zero, -- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4 add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff, peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;> try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one` apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;> ext ⟨i, k⟩ <;> fin_cases i <;> rfl)) -- and until `pow`. -- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on. theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac #align witt_vector.map_fun.zero WittVector.mapFun.zero theorem one : mapFun f (1 : 𝕎 R) = 1 := by map_fun_tac #align witt_vector.map_fun.one WittVector.mapFun.one theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac #align witt_vector.map_fun.add WittVector.mapFun.add theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac #align witt_vector.map_fun.sub WittVector.mapFun.sub theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac #align witt_vector.map_fun.mul WittVector.mapFun.mul
Mathlib/RingTheory/WittVector/Basic.lean
117
117
theorem neg : mapFun f (-x) = -mapFun f x := by
map_fun_tac
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue. theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _) #align witt_vector.map_fun.injective WittVector.mapFun.injective theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x => ⟨mk _ fun n => Classical.choose <| hf <| x.coeff n, by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩ #align witt_vector.map_fun.surjective WittVector.mapFun.surjective -- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries. variable (f : R →+* S) (x y : WittVector p R) -- porting note: a very crude port. macro "map_fun_tac" : tactic => `(tactic| ( ext n simp only [mapFun, mk, comp_apply, zero_coeff, map_zero, -- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4 add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff, peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;> try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one` apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;> ext ⟨i, k⟩ <;> fin_cases i <;> rfl)) -- and until `pow`. -- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on. theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac #align witt_vector.map_fun.zero WittVector.mapFun.zero theorem one : mapFun f (1 : 𝕎 R) = 1 := by map_fun_tac #align witt_vector.map_fun.one WittVector.mapFun.one theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac #align witt_vector.map_fun.add WittVector.mapFun.add theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac #align witt_vector.map_fun.sub WittVector.mapFun.sub theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac #align witt_vector.map_fun.mul WittVector.mapFun.mul theorem neg : mapFun f (-x) = -mapFun f x := by map_fun_tac #align witt_vector.map_fun.neg WittVector.mapFun.neg
Mathlib/RingTheory/WittVector/Basic.lean
120
120
theorem nsmul (n : ℕ) (x : WittVector p R) : mapFun f (n • x) = n • mapFun f x := by
map_fun_tac
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue. theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _) #align witt_vector.map_fun.injective WittVector.mapFun.injective theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x => ⟨mk _ fun n => Classical.choose <| hf <| x.coeff n, by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩ #align witt_vector.map_fun.surjective WittVector.mapFun.surjective -- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries. variable (f : R →+* S) (x y : WittVector p R) -- porting note: a very crude port. macro "map_fun_tac" : tactic => `(tactic| ( ext n simp only [mapFun, mk, comp_apply, zero_coeff, map_zero, -- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4 add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff, peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;> try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one` apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;> ext ⟨i, k⟩ <;> fin_cases i <;> rfl)) -- and until `pow`. -- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on. theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac #align witt_vector.map_fun.zero WittVector.mapFun.zero theorem one : mapFun f (1 : 𝕎 R) = 1 := by map_fun_tac #align witt_vector.map_fun.one WittVector.mapFun.one theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac #align witt_vector.map_fun.add WittVector.mapFun.add theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac #align witt_vector.map_fun.sub WittVector.mapFun.sub theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac #align witt_vector.map_fun.mul WittVector.mapFun.mul theorem neg : mapFun f (-x) = -mapFun f x := by map_fun_tac #align witt_vector.map_fun.neg WittVector.mapFun.neg theorem nsmul (n : ℕ) (x : WittVector p R) : mapFun f (n • x) = n • mapFun f x := by map_fun_tac #align witt_vector.map_fun.nsmul WittVector.mapFun.nsmul
Mathlib/RingTheory/WittVector/Basic.lean
123
123
theorem zsmul (z : ℤ) (x : WittVector p R) : mapFun f (z • x) = z • mapFun f x := by
map_fun_tac
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace mapFun -- Porting note: switched the proof to tactic mode. I think that `ext` was the issue. theorem injective (f : α → β) (hf : Injective f) : Injective (mapFun f : 𝕎 α → 𝕎 β) := by intros _ _ h ext p exact hf (congr_arg (fun x => coeff x p) h : _) #align witt_vector.map_fun.injective WittVector.mapFun.injective theorem surjective (f : α → β) (hf : Surjective f) : Surjective (mapFun f : 𝕎 α → 𝕎 β) := fun x => ⟨mk _ fun n => Classical.choose <| hf <| x.coeff n, by ext n; simp only [mapFun, coeff_mk, comp_apply, Classical.choose_spec (hf (x.coeff n))]⟩ #align witt_vector.map_fun.surjective WittVector.mapFun.surjective -- Porting note: using `(x y : 𝕎 R)` instead of `(x y : WittVector p R)` produced sorries. variable (f : R →+* S) (x y : WittVector p R) -- porting note: a very crude port. macro "map_fun_tac" : tactic => `(tactic| ( ext n simp only [mapFun, mk, comp_apply, zero_coeff, map_zero, -- Porting note: the lemmas on the next line do not have the `simp` tag in mathlib4 add_coeff, sub_coeff, mul_coeff, neg_coeff, nsmul_coeff, zsmul_coeff, pow_coeff, peval, map_aeval, algebraMap_int_eq, coe_eval₂Hom] <;> try { cases n <;> simp <;> done } <;> -- Porting note: this line solves `one` apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl <;> ext ⟨i, k⟩ <;> fin_cases i <;> rfl)) -- and until `pow`. -- We do not tag these lemmas as `@[simp]` because they will be bundled in `map` later on. theorem zero : mapFun f (0 : 𝕎 R) = 0 := by map_fun_tac #align witt_vector.map_fun.zero WittVector.mapFun.zero theorem one : mapFun f (1 : 𝕎 R) = 1 := by map_fun_tac #align witt_vector.map_fun.one WittVector.mapFun.one theorem add : mapFun f (x + y) = mapFun f x + mapFun f y := by map_fun_tac #align witt_vector.map_fun.add WittVector.mapFun.add theorem sub : mapFun f (x - y) = mapFun f x - mapFun f y := by map_fun_tac #align witt_vector.map_fun.sub WittVector.mapFun.sub theorem mul : mapFun f (x * y) = mapFun f x * mapFun f y := by map_fun_tac #align witt_vector.map_fun.mul WittVector.mapFun.mul theorem neg : mapFun f (-x) = -mapFun f x := by map_fun_tac #align witt_vector.map_fun.neg WittVector.mapFun.neg theorem nsmul (n : ℕ) (x : WittVector p R) : mapFun f (n • x) = n • mapFun f x := by map_fun_tac #align witt_vector.map_fun.nsmul WittVector.mapFun.nsmul theorem zsmul (z : ℤ) (x : WittVector p R) : mapFun f (z • x) = z • mapFun f x := by map_fun_tac #align witt_vector.map_fun.zsmul WittVector.mapFun.zsmul
Mathlib/RingTheory/WittVector/Basic.lean
126
126
theorem pow (n : ℕ) : mapFun f (x ^ n) = mapFun f x ^ n := by
map_fun_tac
1,992
import Mathlib.Algebra.MvPolynomial.Counit import Mathlib.Algebra.MvPolynomial.Invertible import Mathlib.RingTheory.WittVector.Defs #align_import ring_theory.witt_vector.basic from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a" noncomputable section open MvPolynomial Function variable {p : ℕ} {R S T : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] [CommRing T] variable {α : Type*} {β : Type*} local notation "𝕎" => WittVector p local notation "W_" => wittPolynomial p -- type as `\bbW` open scoped Witt namespace WittVector def mapFun (f : α → β) : 𝕎 α → 𝕎 β := fun x => mk _ (f ∘ x.coeff) #align witt_vector.map_fun WittVector.mapFun namespace WittVector private def ghostFun : 𝕎 R → ℕ → R := fun x n => aeval x.coeff (W_ ℤ n) section GhostFun variable (x y : WittVector p R) -- The following lemmas are not `@[simp]` because they will be bundled in `ghostMap` later on. @[local simp]
Mathlib/RingTheory/WittVector/Basic.lean
183
185
theorem matrix_vecEmpty_coeff {R} (i j) : @coeff p R (Matrix.vecEmpty i) j = (Matrix.vecEmpty i : ℕ → R) j := by
rcases i with ⟨_ | _ | _ | _ | i_val, ⟨⟩⟩
1,992
import Mathlib.Algebra.MvPolynomial.Funext import Mathlib.Algebra.Ring.ULift import Mathlib.RingTheory.WittVector.Basic #align_import ring_theory.witt_vector.is_poly from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" namespace WittVector universe u variable {p : ℕ} {R S : Type u} {σ idx : Type*} [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` open MvPolynomial open Function (uncurry) variable (p) noncomputable section
Mathlib/RingTheory/WittVector/IsPoly.lean
114
122
theorem poly_eq_of_wittPolynomial_bind_eq' [Fact p.Prime] (f g : ℕ → MvPolynomial (idx × ℕ) ℤ) (h : ∀ n, bind₁ f (wittPolynomial p _ n) = bind₁ g (wittPolynomial p _ n)) : f = g := by
ext1 n apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective rw [← Function.funext_iff] at h replace h := congr_arg (fun fam => bind₁ (MvPolynomial.map (Int.castRingHom ℚ) ∘ fam) (xInTermsOfW p ℚ n)) h simpa only [Function.comp, map_bind₁, map_wittPolynomial, ← bind₁_bind₁, bind₁_wittPolynomial_xInTermsOfW, bind₁_X_right] using h
1,993
import Mathlib.Algebra.MvPolynomial.Funext import Mathlib.Algebra.Ring.ULift import Mathlib.RingTheory.WittVector.Basic #align_import ring_theory.witt_vector.is_poly from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" namespace WittVector universe u variable {p : ℕ} {R S : Type u} {σ idx : Type*} [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` open MvPolynomial open Function (uncurry) variable (p) noncomputable section theorem poly_eq_of_wittPolynomial_bind_eq' [Fact p.Prime] (f g : ℕ → MvPolynomial (idx × ℕ) ℤ) (h : ∀ n, bind₁ f (wittPolynomial p _ n) = bind₁ g (wittPolynomial p _ n)) : f = g := by ext1 n apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective rw [← Function.funext_iff] at h replace h := congr_arg (fun fam => bind₁ (MvPolynomial.map (Int.castRingHom ℚ) ∘ fam) (xInTermsOfW p ℚ n)) h simpa only [Function.comp, map_bind₁, map_wittPolynomial, ← bind₁_bind₁, bind₁_wittPolynomial_xInTermsOfW, bind₁_X_right] using h #align witt_vector.poly_eq_of_witt_polynomial_bind_eq' WittVector.poly_eq_of_wittPolynomial_bind_eq'
Mathlib/RingTheory/WittVector/IsPoly.lean
125
133
theorem poly_eq_of_wittPolynomial_bind_eq [Fact p.Prime] (f g : ℕ → MvPolynomial ℕ ℤ) (h : ∀ n, bind₁ f (wittPolynomial p _ n) = bind₁ g (wittPolynomial p _ n)) : f = g := by
ext1 n apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective rw [← Function.funext_iff] at h replace h := congr_arg (fun fam => bind₁ (MvPolynomial.map (Int.castRingHom ℚ) ∘ fam) (xInTermsOfW p ℚ n)) h simpa only [Function.comp, map_bind₁, map_wittPolynomial, ← bind₁_bind₁, bind₁_wittPolynomial_xInTermsOfW, bind₁_X_right] using h
1,993
import Mathlib.Algebra.MvPolynomial.Funext import Mathlib.Algebra.Ring.ULift import Mathlib.RingTheory.WittVector.Basic #align_import ring_theory.witt_vector.is_poly from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4" namespace WittVector universe u variable {p : ℕ} {R S : Type u} {σ idx : Type*} [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` open MvPolynomial open Function (uncurry) variable (p) noncomputable section theorem poly_eq_of_wittPolynomial_bind_eq' [Fact p.Prime] (f g : ℕ → MvPolynomial (idx × ℕ) ℤ) (h : ∀ n, bind₁ f (wittPolynomial p _ n) = bind₁ g (wittPolynomial p _ n)) : f = g := by ext1 n apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective rw [← Function.funext_iff] at h replace h := congr_arg (fun fam => bind₁ (MvPolynomial.map (Int.castRingHom ℚ) ∘ fam) (xInTermsOfW p ℚ n)) h simpa only [Function.comp, map_bind₁, map_wittPolynomial, ← bind₁_bind₁, bind₁_wittPolynomial_xInTermsOfW, bind₁_X_right] using h #align witt_vector.poly_eq_of_witt_polynomial_bind_eq' WittVector.poly_eq_of_wittPolynomial_bind_eq' theorem poly_eq_of_wittPolynomial_bind_eq [Fact p.Prime] (f g : ℕ → MvPolynomial ℕ ℤ) (h : ∀ n, bind₁ f (wittPolynomial p _ n) = bind₁ g (wittPolynomial p _ n)) : f = g := by ext1 n apply MvPolynomial.map_injective (Int.castRingHom ℚ) Int.cast_injective rw [← Function.funext_iff] at h replace h := congr_arg (fun fam => bind₁ (MvPolynomial.map (Int.castRingHom ℚ) ∘ fam) (xInTermsOfW p ℚ n)) h simpa only [Function.comp, map_bind₁, map_wittPolynomial, ← bind₁_bind₁, bind₁_wittPolynomial_xInTermsOfW, bind₁_X_right] using h #align witt_vector.poly_eq_of_witt_polynomial_bind_eq WittVector.poly_eq_of_wittPolynomial_bind_eq -- Ideally, we would generalise this to n-ary functions -- But we don't have a good theory of n-ary compositions in mathlib class IsPoly (f : ∀ ⦃R⦄ [CommRing R], WittVector p R → 𝕎 R) : Prop where mk' :: poly : ∃ φ : ℕ → MvPolynomial ℕ ℤ, ∀ ⦃R⦄ [CommRing R] (x : 𝕎 R), (f x).coeff = fun n => aeval x.coeff (φ n) #align witt_vector.is_poly WittVector.IsPoly instance idIsPoly : IsPoly p fun _ _ => id := ⟨⟨X, by intros; simp only [aeval_X, id]⟩⟩ #align witt_vector.id_is_poly WittVector.idIsPoly instance idIsPolyI' : IsPoly p fun _ _ a => a := WittVector.idIsPoly _ #align witt_vector.id_is_poly_i' WittVector.idIsPolyI' namespace IsPoly instance : Inhabited (IsPoly p fun _ _ => id) := ⟨WittVector.idIsPoly p⟩ variable {p}
Mathlib/RingTheory/WittVector/IsPoly.lean
172
195
theorem ext [Fact p.Prime] {f g} (hf : IsPoly p f) (hg : IsPoly p g) (h : ∀ (R : Type u) [_Rcr : CommRing R] (x : 𝕎 R) (n : ℕ), ghostComponent n (f x) = ghostComponent n (g x)) : ∀ (R : Type u) [_Rcr : CommRing R] (x : 𝕎 R), f x = g x := by
obtain ⟨φ, hf⟩ := hf obtain ⟨ψ, hg⟩ := hg intros ext n rw [hf, hg, poly_eq_of_wittPolynomial_bind_eq p φ ψ] intro k apply MvPolynomial.funext intro x simp only [hom_bind₁] specialize h (ULift ℤ) (mk p fun i => ⟨x i⟩) k simp only [ghostComponent_apply, aeval_eq_eval₂Hom] at h apply (ULift.ringEquiv.symm : ℤ ≃+* _).injective simp only [← RingEquiv.coe_toRingHom, map_eval₂Hom] convert h using 1 all_goals simp only [hf, hg, MvPolynomial.eval, map_eval₂Hom] apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl ext1 apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl simp only [coeff_mk]; rfl
1,993
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.init_tail from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c" variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) {R : Type*} [CommRing R] -- type as `\bbW` local notation "𝕎" => WittVector p namespace WittVector open MvPolynomial open scoped Classical noncomputable section section def select (P : ℕ → Prop) (x : 𝕎 R) : 𝕎 R := mk p fun n => if P n then x.coeff n else 0 #align witt_vector.select WittVector.select section Select variable (P : ℕ → Prop) def selectPoly (n : ℕ) : MvPolynomial ℕ ℤ := if P n then X n else 0 #align witt_vector.select_poly WittVector.selectPoly
Mathlib/RingTheory/WittVector/InitTail.lean
72
77
theorem coeff_select (x : 𝕎 R) (n : ℕ) : (select P x).coeff n = aeval x.coeff (selectPoly P n) := by
dsimp [select, selectPoly] split_ifs with hi · rw [aeval_X, mk]; simp only [hi]; rfl · rw [AlgHom.map_zero, mk]; simp only [hi]; rfl
1,994
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.init_tail from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c" variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) {R : Type*} [CommRing R] -- type as `\bbW` local notation "𝕎" => WittVector p namespace WittVector open MvPolynomial open scoped Classical noncomputable section section def select (P : ℕ → Prop) (x : 𝕎 R) : 𝕎 R := mk p fun n => if P n then x.coeff n else 0 #align witt_vector.select WittVector.select section Select variable (P : ℕ → Prop) def selectPoly (n : ℕ) : MvPolynomial ℕ ℤ := if P n then X n else 0 #align witt_vector.select_poly WittVector.selectPoly theorem coeff_select (x : 𝕎 R) (n : ℕ) : (select P x).coeff n = aeval x.coeff (selectPoly P n) := by dsimp [select, selectPoly] split_ifs with hi · rw [aeval_X, mk]; simp only [hi]; rfl · rw [AlgHom.map_zero, mk]; simp only [hi]; rfl #align witt_vector.coeff_select WittVector.coeff_select -- Porting note: replaced `@[is_poly]` with `instance`. Made the argument `P` implicit in doing so. instance select_isPoly {P : ℕ → Prop} : IsPoly p fun _ _ x => select P x := by use selectPoly P rintro R _Rcr x funext i apply coeff_select #align witt_vector.select_is_poly WittVector.select_isPoly
Mathlib/RingTheory/WittVector/InitTail.lean
88
109
theorem select_add_select_not : ∀ x : 𝕎 R, select P x + select (fun i => ¬P i) x = x := by
-- Porting note: TC search was insufficient to find this instance, even though all required -- instances exist. See zulip: [https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/WittVector.20saga/near/370073526] have : IsPoly p fun {R} [CommRing R] x ↦ select P x + select (fun i ↦ ¬P i) x := IsPoly₂.diag (hf := IsPoly₂.comp) ghost_calc x intro n simp only [RingHom.map_add] suffices (bind₁ (selectPoly P)) (wittPolynomial p ℤ n) + (bind₁ (selectPoly fun i => ¬P i)) (wittPolynomial p ℤ n) = wittPolynomial p ℤ n by apply_fun aeval x.coeff at this simpa only [AlgHom.map_add, aeval_bind₁, ← coeff_select] simp only [wittPolynomial_eq_sum_C_mul_X_pow, selectPoly, AlgHom.map_sum, AlgHom.map_pow, AlgHom.map_mul, bind₁_X_right, bind₁_C_right, ← Finset.sum_add_distrib, ← mul_add] apply Finset.sum_congr rfl refine fun m _ => mul_eq_mul_left_iff.mpr (Or.inl ?_) rw [ite_pow, zero_pow (pow_ne_zero _ hp.out.ne_zero)] by_cases Pm : P m · rw [if_pos Pm, if_neg $ not_not_intro Pm, zero_pow Fin.size_pos'.ne', add_zero] · rwa [if_neg Pm, if_pos, zero_add]
1,994
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.init_tail from "leanprover-community/mathlib"@"0798037604b2d91748f9b43925fb7570a5f3256c" variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) {R : Type*} [CommRing R] -- type as `\bbW` local notation "𝕎" => WittVector p namespace WittVector open MvPolynomial open scoped Classical noncomputable section section def select (P : ℕ → Prop) (x : 𝕎 R) : 𝕎 R := mk p fun n => if P n then x.coeff n else 0 #align witt_vector.select WittVector.select section Select variable (P : ℕ → Prop) def selectPoly (n : ℕ) : MvPolynomial ℕ ℤ := if P n then X n else 0 #align witt_vector.select_poly WittVector.selectPoly theorem coeff_select (x : 𝕎 R) (n : ℕ) : (select P x).coeff n = aeval x.coeff (selectPoly P n) := by dsimp [select, selectPoly] split_ifs with hi · rw [aeval_X, mk]; simp only [hi]; rfl · rw [AlgHom.map_zero, mk]; simp only [hi]; rfl #align witt_vector.coeff_select WittVector.coeff_select -- Porting note: replaced `@[is_poly]` with `instance`. Made the argument `P` implicit in doing so. instance select_isPoly {P : ℕ → Prop} : IsPoly p fun _ _ x => select P x := by use selectPoly P rintro R _Rcr x funext i apply coeff_select #align witt_vector.select_is_poly WittVector.select_isPoly theorem select_add_select_not : ∀ x : 𝕎 R, select P x + select (fun i => ¬P i) x = x := by -- Porting note: TC search was insufficient to find this instance, even though all required -- instances exist. See zulip: [https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/WittVector.20saga/near/370073526] have : IsPoly p fun {R} [CommRing R] x ↦ select P x + select (fun i ↦ ¬P i) x := IsPoly₂.diag (hf := IsPoly₂.comp) ghost_calc x intro n simp only [RingHom.map_add] suffices (bind₁ (selectPoly P)) (wittPolynomial p ℤ n) + (bind₁ (selectPoly fun i => ¬P i)) (wittPolynomial p ℤ n) = wittPolynomial p ℤ n by apply_fun aeval x.coeff at this simpa only [AlgHom.map_add, aeval_bind₁, ← coeff_select] simp only [wittPolynomial_eq_sum_C_mul_X_pow, selectPoly, AlgHom.map_sum, AlgHom.map_pow, AlgHom.map_mul, bind₁_X_right, bind₁_C_right, ← Finset.sum_add_distrib, ← mul_add] apply Finset.sum_congr rfl refine fun m _ => mul_eq_mul_left_iff.mpr (Or.inl ?_) rw [ite_pow, zero_pow (pow_ne_zero _ hp.out.ne_zero)] by_cases Pm : P m · rw [if_pos Pm, if_neg $ not_not_intro Pm, zero_pow Fin.size_pos'.ne', add_zero] · rwa [if_neg Pm, if_pos, zero_add] #align witt_vector.select_add_select_not WittVector.select_add_select_not
Mathlib/RingTheory/WittVector/InitTail.lean
112
133
theorem coeff_add_of_disjoint (x y : 𝕎 R) (h : ∀ n, x.coeff n = 0 ∨ y.coeff n = 0) : (x + y).coeff n = x.coeff n + y.coeff n := by
let P : ℕ → Prop := fun n => y.coeff n = 0 haveI : DecidablePred P := Classical.decPred P set z := mk p fun n => if P n then x.coeff n else y.coeff n have hx : select P z = x := by ext1 n; rw [select, coeff_mk, coeff_mk] split_ifs with hn · rfl · rw [(h n).resolve_right hn] have hy : select (fun i => ¬P i) z = y := by ext1 n; rw [select, coeff_mk, coeff_mk] split_ifs with hn · exact hn.symm · rfl calc (x + y).coeff n = z.coeff n := by rw [← hx, ← hy, select_add_select_not P z] _ = x.coeff n + y.coeff n := by simp only [z, mk.eq_1] split_ifs with y0 · rw [y0, add_zero] · rw [h n |>.resolve_right y0, zero_add]
1,994
import Mathlib.RingTheory.WittVector.InitTail #align_import ring_theory.witt_vector.truncated from "leanprover-community/mathlib"@"acbe099ced8be9c9754d62860110295cde0d7181" open Function (Injective Surjective) noncomputable section variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) (R : Type*) local notation "𝕎" => WittVector p -- type as `\bbW` @[nolint unusedArguments] def TruncatedWittVector (_ : ℕ) (n : ℕ) (R : Type*) := Fin n → R #align truncated_witt_vector TruncatedWittVector instance (p n : ℕ) (R : Type*) [Inhabited R] : Inhabited (TruncatedWittVector p n R) := ⟨fun _ => default⟩ variable {n R} namespace TruncatedWittVector variable (p) def mk (x : Fin n → R) : TruncatedWittVector p n R := x #align truncated_witt_vector.mk TruncatedWittVector.mk variable {p} def coeff (i : Fin n) (x : TruncatedWittVector p n R) : R := x i #align truncated_witt_vector.coeff TruncatedWittVector.coeff @[ext] theorem ext {x y : TruncatedWittVector p n R} (h : ∀ i, x.coeff i = y.coeff i) : x = y := funext h #align truncated_witt_vector.ext TruncatedWittVector.ext theorem ext_iff {x y : TruncatedWittVector p n R} : x = y ↔ ∀ i, x.coeff i = y.coeff i := ⟨fun h i => by rw [h], ext⟩ #align truncated_witt_vector.ext_iff TruncatedWittVector.ext_iff @[simp] theorem coeff_mk (x : Fin n → R) (i : Fin n) : (mk p x).coeff i = x i := rfl #align truncated_witt_vector.coeff_mk TruncatedWittVector.coeff_mk @[simp]
Mathlib/RingTheory/WittVector/Truncated.lean
100
101
theorem mk_coeff (x : TruncatedWittVector p n R) : (mk p fun i => x.coeff i) = x := by
ext i; rw [coeff_mk]
1,995
import Mathlib.RingTheory.WittVector.InitTail #align_import ring_theory.witt_vector.truncated from "leanprover-community/mathlib"@"acbe099ced8be9c9754d62860110295cde0d7181" open Function (Injective Surjective) noncomputable section variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) (R : Type*) local notation "𝕎" => WittVector p -- type as `\bbW` @[nolint unusedArguments] def TruncatedWittVector (_ : ℕ) (n : ℕ) (R : Type*) := Fin n → R #align truncated_witt_vector TruncatedWittVector instance (p n : ℕ) (R : Type*) [Inhabited R] : Inhabited (TruncatedWittVector p n R) := ⟨fun _ => default⟩ variable {n R} namespace TruncatedWittVector variable (p) def mk (x : Fin n → R) : TruncatedWittVector p n R := x #align truncated_witt_vector.mk TruncatedWittVector.mk variable {p} def coeff (i : Fin n) (x : TruncatedWittVector p n R) : R := x i #align truncated_witt_vector.coeff TruncatedWittVector.coeff @[ext] theorem ext {x y : TruncatedWittVector p n R} (h : ∀ i, x.coeff i = y.coeff i) : x = y := funext h #align truncated_witt_vector.ext TruncatedWittVector.ext theorem ext_iff {x y : TruncatedWittVector p n R} : x = y ↔ ∀ i, x.coeff i = y.coeff i := ⟨fun h i => by rw [h], ext⟩ #align truncated_witt_vector.ext_iff TruncatedWittVector.ext_iff @[simp] theorem coeff_mk (x : Fin n → R) (i : Fin n) : (mk p x).coeff i = x i := rfl #align truncated_witt_vector.coeff_mk TruncatedWittVector.coeff_mk @[simp] theorem mk_coeff (x : TruncatedWittVector p n R) : (mk p fun i => x.coeff i) = x := by ext i; rw [coeff_mk] #align truncated_witt_vector.mk_coeff TruncatedWittVector.mk_coeff variable [CommRing R] def out (x : TruncatedWittVector p n R) : 𝕎 R := @WittVector.mk' p _ fun i => if h : i < n then x.coeff ⟨i, h⟩ else 0 #align truncated_witt_vector.out TruncatedWittVector.out @[simp]
Mathlib/RingTheory/WittVector/Truncated.lean
114
115
theorem coeff_out (x : TruncatedWittVector p n R) (i : Fin n) : x.out.coeff i = x.coeff i := by
rw [out]; dsimp only; rw [dif_pos i.is_lt, Fin.eta]
1,995
import Mathlib.RingTheory.WittVector.InitTail #align_import ring_theory.witt_vector.truncated from "leanprover-community/mathlib"@"acbe099ced8be9c9754d62860110295cde0d7181" open Function (Injective Surjective) noncomputable section variable {p : ℕ} [hp : Fact p.Prime] (n : ℕ) (R : Type*) local notation "𝕎" => WittVector p -- type as `\bbW` @[nolint unusedArguments] def TruncatedWittVector (_ : ℕ) (n : ℕ) (R : Type*) := Fin n → R #align truncated_witt_vector TruncatedWittVector instance (p n : ℕ) (R : Type*) [Inhabited R] : Inhabited (TruncatedWittVector p n R) := ⟨fun _ => default⟩ variable {n R} namespace TruncatedWittVector variable (p) def mk (x : Fin n → R) : TruncatedWittVector p n R := x #align truncated_witt_vector.mk TruncatedWittVector.mk variable {p} def coeff (i : Fin n) (x : TruncatedWittVector p n R) : R := x i #align truncated_witt_vector.coeff TruncatedWittVector.coeff @[ext] theorem ext {x y : TruncatedWittVector p n R} (h : ∀ i, x.coeff i = y.coeff i) : x = y := funext h #align truncated_witt_vector.ext TruncatedWittVector.ext theorem ext_iff {x y : TruncatedWittVector p n R} : x = y ↔ ∀ i, x.coeff i = y.coeff i := ⟨fun h i => by rw [h], ext⟩ #align truncated_witt_vector.ext_iff TruncatedWittVector.ext_iff @[simp] theorem coeff_mk (x : Fin n → R) (i : Fin n) : (mk p x).coeff i = x i := rfl #align truncated_witt_vector.coeff_mk TruncatedWittVector.coeff_mk @[simp] theorem mk_coeff (x : TruncatedWittVector p n R) : (mk p fun i => x.coeff i) = x := by ext i; rw [coeff_mk] #align truncated_witt_vector.mk_coeff TruncatedWittVector.mk_coeff variable [CommRing R] def out (x : TruncatedWittVector p n R) : 𝕎 R := @WittVector.mk' p _ fun i => if h : i < n then x.coeff ⟨i, h⟩ else 0 #align truncated_witt_vector.out TruncatedWittVector.out @[simp] theorem coeff_out (x : TruncatedWittVector p n R) (i : Fin n) : x.out.coeff i = x.coeff i := by rw [out]; dsimp only; rw [dif_pos i.is_lt, Fin.eta] #align truncated_witt_vector.coeff_out TruncatedWittVector.coeff_out
Mathlib/RingTheory/WittVector/Truncated.lean
118
122
theorem out_injective : Injective (@out p n R _) := by
intro x y h ext i rw [WittVector.ext_iff] at h simpa only [coeff_out] using h ↑i
1,995
import Mathlib.Algebra.MvPolynomial.Supported import Mathlib.RingTheory.WittVector.Truncated #align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section namespace WittVector variable (p : ℕ) [hp : Fact p.Prime] variable {k : Type*} [CommRing k] local notation "𝕎" => WittVector p -- Porting note: new notation local notation "𝕄" => MvPolynomial (Fin 2 × ℕ) ℤ open Finset MvPolynomial def wittPolyProd (n : ℕ) : 𝕄 := rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ n) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ n) #align witt_vector.witt_poly_prod WittVector.wittPolyProd
Mathlib/RingTheory/WittVector/MulCoeff.lean
56
61
theorem wittPolyProd_vars (n : ℕ) : (wittPolyProd p n).vars ⊆ univ ×ˢ range (n + 1) := by
rw [wittPolyProd] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_rename _ _) ?_ simp [wittPolynomial_vars, image_subset_iff]
1,996
import Mathlib.Algebra.MvPolynomial.Supported import Mathlib.RingTheory.WittVector.Truncated #align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section namespace WittVector variable (p : ℕ) [hp : Fact p.Prime] variable {k : Type*} [CommRing k] local notation "𝕎" => WittVector p -- Porting note: new notation local notation "𝕄" => MvPolynomial (Fin 2 × ℕ) ℤ open Finset MvPolynomial def wittPolyProd (n : ℕ) : 𝕄 := rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ n) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ n) #align witt_vector.witt_poly_prod WittVector.wittPolyProd theorem wittPolyProd_vars (n : ℕ) : (wittPolyProd p n).vars ⊆ univ ×ˢ range (n + 1) := by rw [wittPolyProd] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_rename _ _) ?_ simp [wittPolynomial_vars, image_subset_iff] #align witt_vector.witt_poly_prod_vars WittVector.wittPolyProd_vars def wittPolyProdRemainder (n : ℕ) : 𝕄 := ∑ i ∈ range n, (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i) #align witt_vector.witt_poly_prod_remainder WittVector.wittPolyProdRemainder
Mathlib/RingTheory/WittVector/MulCoeff.lean
69
85
theorem wittPolyProdRemainder_vars (n : ℕ) : (wittPolyProdRemainder p n).vars ⊆ univ ×ˢ range n := by
rw [wittPolyProdRemainder] refine Subset.trans (vars_sum_subset _ _) ?_ rw [biUnion_subset] intro x hx apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ · apply Subset.trans (vars_pow _ _) have : (p : 𝕄) = C (p : ℤ) := by simp only [Int.cast_natCast, eq_intCast] rw [this, vars_C] apply empty_subset · apply Subset.trans (vars_pow _ _) apply Subset.trans (wittMul_vars _ _) apply product_subset_product (Subset.refl _) simp only [mem_range, range_subset] at hx ⊢ exact hx
1,996
import Mathlib.Algebra.MvPolynomial.Supported import Mathlib.RingTheory.WittVector.Truncated #align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section namespace WittVector variable (p : ℕ) [hp : Fact p.Prime] variable {k : Type*} [CommRing k] local notation "𝕎" => WittVector p -- Porting note: new notation local notation "𝕄" => MvPolynomial (Fin 2 × ℕ) ℤ open Finset MvPolynomial def wittPolyProd (n : ℕ) : 𝕄 := rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ n) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ n) #align witt_vector.witt_poly_prod WittVector.wittPolyProd theorem wittPolyProd_vars (n : ℕ) : (wittPolyProd p n).vars ⊆ univ ×ˢ range (n + 1) := by rw [wittPolyProd] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_rename _ _) ?_ simp [wittPolynomial_vars, image_subset_iff] #align witt_vector.witt_poly_prod_vars WittVector.wittPolyProd_vars def wittPolyProdRemainder (n : ℕ) : 𝕄 := ∑ i ∈ range n, (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i) #align witt_vector.witt_poly_prod_remainder WittVector.wittPolyProdRemainder theorem wittPolyProdRemainder_vars (n : ℕ) : (wittPolyProdRemainder p n).vars ⊆ univ ×ˢ range n := by rw [wittPolyProdRemainder] refine Subset.trans (vars_sum_subset _ _) ?_ rw [biUnion_subset] intro x hx apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ · apply Subset.trans (vars_pow _ _) have : (p : 𝕄) = C (p : ℤ) := by simp only [Int.cast_natCast, eq_intCast] rw [this, vars_C] apply empty_subset · apply Subset.trans (vars_pow _ _) apply Subset.trans (wittMul_vars _ _) apply product_subset_product (Subset.refl _) simp only [mem_range, range_subset] at hx ⊢ exact hx #align witt_vector.witt_poly_prod_remainder_vars WittVector.wittPolyProdRemainder_vars def remainder (n : ℕ) : 𝕄 := (∑ x ∈ range (n + 1), (rename (Prod.mk 0)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : ℤ) ^ x))) * ∑ x ∈ range (n + 1), (rename (Prod.mk 1)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : ℤ) ^ x)) #align witt_vector.remainder WittVector.remainder
Mathlib/RingTheory/WittVector/MulCoeff.lean
99
110
theorem remainder_vars (n : ℕ) : (remainder p n).vars ⊆ univ ×ˢ range (n + 1) := by
rw [remainder] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_sum_subset _ _) ?_ rw [biUnion_subset] intro x hx rw [rename_monomial, vars_monomial, Finsupp.mapDomain_single] · apply Subset.trans Finsupp.support_single_subset simpa using mem_range.mp hx · apply pow_ne_zero exact mod_cast hp.out.ne_zero
1,996
import Mathlib.Algebra.MvPolynomial.Supported import Mathlib.RingTheory.WittVector.Truncated #align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section namespace WittVector variable (p : ℕ) [hp : Fact p.Prime] variable {k : Type*} [CommRing k] local notation "𝕎" => WittVector p -- Porting note: new notation local notation "𝕄" => MvPolynomial (Fin 2 × ℕ) ℤ open Finset MvPolynomial def wittPolyProd (n : ℕ) : 𝕄 := rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ n) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ n) #align witt_vector.witt_poly_prod WittVector.wittPolyProd theorem wittPolyProd_vars (n : ℕ) : (wittPolyProd p n).vars ⊆ univ ×ˢ range (n + 1) := by rw [wittPolyProd] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_rename _ _) ?_ simp [wittPolynomial_vars, image_subset_iff] #align witt_vector.witt_poly_prod_vars WittVector.wittPolyProd_vars def wittPolyProdRemainder (n : ℕ) : 𝕄 := ∑ i ∈ range n, (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i) #align witt_vector.witt_poly_prod_remainder WittVector.wittPolyProdRemainder theorem wittPolyProdRemainder_vars (n : ℕ) : (wittPolyProdRemainder p n).vars ⊆ univ ×ˢ range n := by rw [wittPolyProdRemainder] refine Subset.trans (vars_sum_subset _ _) ?_ rw [biUnion_subset] intro x hx apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ · apply Subset.trans (vars_pow _ _) have : (p : 𝕄) = C (p : ℤ) := by simp only [Int.cast_natCast, eq_intCast] rw [this, vars_C] apply empty_subset · apply Subset.trans (vars_pow _ _) apply Subset.trans (wittMul_vars _ _) apply product_subset_product (Subset.refl _) simp only [mem_range, range_subset] at hx ⊢ exact hx #align witt_vector.witt_poly_prod_remainder_vars WittVector.wittPolyProdRemainder_vars def remainder (n : ℕ) : 𝕄 := (∑ x ∈ range (n + 1), (rename (Prod.mk 0)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : ℤ) ^ x))) * ∑ x ∈ range (n + 1), (rename (Prod.mk 1)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : ℤ) ^ x)) #align witt_vector.remainder WittVector.remainder theorem remainder_vars (n : ℕ) : (remainder p n).vars ⊆ univ ×ˢ range (n + 1) := by rw [remainder] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_sum_subset _ _) ?_ rw [biUnion_subset] intro x hx rw [rename_monomial, vars_monomial, Finsupp.mapDomain_single] · apply Subset.trans Finsupp.support_single_subset simpa using mem_range.mp hx · apply pow_ne_zero exact mod_cast hp.out.ne_zero #align witt_vector.remainder_vars WittVector.remainder_vars def polyOfInterest (n : ℕ) : 𝕄 := wittMul p (n + 1) + (p : 𝕄) ^ (n + 1) * X (0, n + 1) * X (1, n + 1) - X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ (n + 1)) - X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ (n + 1)) #align witt_vector.poly_of_interest WittVector.polyOfInterest
Mathlib/RingTheory/WittVector/MulCoeff.lean
120
135
theorem mul_polyOfInterest_aux1 (n : ℕ) : ∑ i ∈ range (n + 1), (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i) = wittPolyProd p n := by
simp only [wittPolyProd] convert wittStructureInt_prop p (X (0 : Fin 2) * X 1) n using 1 · simp only [wittPolynomial, wittMul] rw [AlgHom.map_sum] congr 1 with i congr 1 have hsupp : (Finsupp.single i (p ^ (n - i))).support = {i} := by rw [Finsupp.support_eq_singleton] simp only [and_true_iff, Finsupp.single_eq_same, eq_self_iff_true, Ne] exact pow_ne_zero _ hp.out.ne_zero simp only [bind₁_monomial, hsupp, Int.cast_natCast, prod_singleton, eq_intCast, Finsupp.single_eq_same, C_pow, mul_eq_mul_left_iff, true_or_iff, eq_self_iff_true, Int.cast_pow] · simp only [map_mul, bind₁_X_right]
1,996
import Mathlib.Algebra.MvPolynomial.Supported import Mathlib.RingTheory.WittVector.Truncated #align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section namespace WittVector variable (p : ℕ) [hp : Fact p.Prime] variable {k : Type*} [CommRing k] local notation "𝕎" => WittVector p -- Porting note: new notation local notation "𝕄" => MvPolynomial (Fin 2 × ℕ) ℤ open Finset MvPolynomial def wittPolyProd (n : ℕ) : 𝕄 := rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ n) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ n) #align witt_vector.witt_poly_prod WittVector.wittPolyProd theorem wittPolyProd_vars (n : ℕ) : (wittPolyProd p n).vars ⊆ univ ×ˢ range (n + 1) := by rw [wittPolyProd] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_rename _ _) ?_ simp [wittPolynomial_vars, image_subset_iff] #align witt_vector.witt_poly_prod_vars WittVector.wittPolyProd_vars def wittPolyProdRemainder (n : ℕ) : 𝕄 := ∑ i ∈ range n, (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i) #align witt_vector.witt_poly_prod_remainder WittVector.wittPolyProdRemainder theorem wittPolyProdRemainder_vars (n : ℕ) : (wittPolyProdRemainder p n).vars ⊆ univ ×ˢ range n := by rw [wittPolyProdRemainder] refine Subset.trans (vars_sum_subset _ _) ?_ rw [biUnion_subset] intro x hx apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ · apply Subset.trans (vars_pow _ _) have : (p : 𝕄) = C (p : ℤ) := by simp only [Int.cast_natCast, eq_intCast] rw [this, vars_C] apply empty_subset · apply Subset.trans (vars_pow _ _) apply Subset.trans (wittMul_vars _ _) apply product_subset_product (Subset.refl _) simp only [mem_range, range_subset] at hx ⊢ exact hx #align witt_vector.witt_poly_prod_remainder_vars WittVector.wittPolyProdRemainder_vars def remainder (n : ℕ) : 𝕄 := (∑ x ∈ range (n + 1), (rename (Prod.mk 0)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : ℤ) ^ x))) * ∑ x ∈ range (n + 1), (rename (Prod.mk 1)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : ℤ) ^ x)) #align witt_vector.remainder WittVector.remainder theorem remainder_vars (n : ℕ) : (remainder p n).vars ⊆ univ ×ˢ range (n + 1) := by rw [remainder] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_sum_subset _ _) ?_ rw [biUnion_subset] intro x hx rw [rename_monomial, vars_monomial, Finsupp.mapDomain_single] · apply Subset.trans Finsupp.support_single_subset simpa using mem_range.mp hx · apply pow_ne_zero exact mod_cast hp.out.ne_zero #align witt_vector.remainder_vars WittVector.remainder_vars def polyOfInterest (n : ℕ) : 𝕄 := wittMul p (n + 1) + (p : 𝕄) ^ (n + 1) * X (0, n + 1) * X (1, n + 1) - X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ (n + 1)) - X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ (n + 1)) #align witt_vector.poly_of_interest WittVector.polyOfInterest theorem mul_polyOfInterest_aux1 (n : ℕ) : ∑ i ∈ range (n + 1), (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i) = wittPolyProd p n := by simp only [wittPolyProd] convert wittStructureInt_prop p (X (0 : Fin 2) * X 1) n using 1 · simp only [wittPolynomial, wittMul] rw [AlgHom.map_sum] congr 1 with i congr 1 have hsupp : (Finsupp.single i (p ^ (n - i))).support = {i} := by rw [Finsupp.support_eq_singleton] simp only [and_true_iff, Finsupp.single_eq_same, eq_self_iff_true, Ne] exact pow_ne_zero _ hp.out.ne_zero simp only [bind₁_monomial, hsupp, Int.cast_natCast, prod_singleton, eq_intCast, Finsupp.single_eq_same, C_pow, mul_eq_mul_left_iff, true_or_iff, eq_self_iff_true, Int.cast_pow] · simp only [map_mul, bind₁_X_right] #align witt_vector.mul_poly_of_interest_aux1 WittVector.mul_polyOfInterest_aux1
Mathlib/RingTheory/WittVector/MulCoeff.lean
138
142
theorem mul_polyOfInterest_aux2 (n : ℕ) : (p : 𝕄) ^ n * wittMul p n + wittPolyProdRemainder p n = wittPolyProd p n := by
convert mul_polyOfInterest_aux1 p n rw [sum_range_succ, add_comm, Nat.sub_self, pow_zero, pow_one] rfl
1,996
import Mathlib.Algebra.MvPolynomial.Supported import Mathlib.RingTheory.WittVector.Truncated #align_import ring_theory.witt_vector.mul_coeff from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" noncomputable section namespace WittVector variable (p : ℕ) [hp : Fact p.Prime] variable {k : Type*} [CommRing k] local notation "𝕎" => WittVector p -- Porting note: new notation local notation "𝕄" => MvPolynomial (Fin 2 × ℕ) ℤ open Finset MvPolynomial def wittPolyProd (n : ℕ) : 𝕄 := rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ n) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ n) #align witt_vector.witt_poly_prod WittVector.wittPolyProd theorem wittPolyProd_vars (n : ℕ) : (wittPolyProd p n).vars ⊆ univ ×ˢ range (n + 1) := by rw [wittPolyProd] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_rename _ _) ?_ simp [wittPolynomial_vars, image_subset_iff] #align witt_vector.witt_poly_prod_vars WittVector.wittPolyProd_vars def wittPolyProdRemainder (n : ℕ) : 𝕄 := ∑ i ∈ range n, (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i) #align witt_vector.witt_poly_prod_remainder WittVector.wittPolyProdRemainder theorem wittPolyProdRemainder_vars (n : ℕ) : (wittPolyProdRemainder p n).vars ⊆ univ ×ˢ range n := by rw [wittPolyProdRemainder] refine Subset.trans (vars_sum_subset _ _) ?_ rw [biUnion_subset] intro x hx apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ · apply Subset.trans (vars_pow _ _) have : (p : 𝕄) = C (p : ℤ) := by simp only [Int.cast_natCast, eq_intCast] rw [this, vars_C] apply empty_subset · apply Subset.trans (vars_pow _ _) apply Subset.trans (wittMul_vars _ _) apply product_subset_product (Subset.refl _) simp only [mem_range, range_subset] at hx ⊢ exact hx #align witt_vector.witt_poly_prod_remainder_vars WittVector.wittPolyProdRemainder_vars def remainder (n : ℕ) : 𝕄 := (∑ x ∈ range (n + 1), (rename (Prod.mk 0)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : ℤ) ^ x))) * ∑ x ∈ range (n + 1), (rename (Prod.mk 1)) ((monomial (Finsupp.single x (p ^ (n + 1 - x)))) ((p : ℤ) ^ x)) #align witt_vector.remainder WittVector.remainder theorem remainder_vars (n : ℕ) : (remainder p n).vars ⊆ univ ×ˢ range (n + 1) := by rw [remainder] apply Subset.trans (vars_mul _ _) refine union_subset ?_ ?_ <;> · refine Subset.trans (vars_sum_subset _ _) ?_ rw [biUnion_subset] intro x hx rw [rename_monomial, vars_monomial, Finsupp.mapDomain_single] · apply Subset.trans Finsupp.support_single_subset simpa using mem_range.mp hx · apply pow_ne_zero exact mod_cast hp.out.ne_zero #align witt_vector.remainder_vars WittVector.remainder_vars def polyOfInterest (n : ℕ) : 𝕄 := wittMul p (n + 1) + (p : 𝕄) ^ (n + 1) * X (0, n + 1) * X (1, n + 1) - X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ (n + 1)) - X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ (n + 1)) #align witt_vector.poly_of_interest WittVector.polyOfInterest theorem mul_polyOfInterest_aux1 (n : ℕ) : ∑ i ∈ range (n + 1), (p : 𝕄) ^ i * wittMul p i ^ p ^ (n - i) = wittPolyProd p n := by simp only [wittPolyProd] convert wittStructureInt_prop p (X (0 : Fin 2) * X 1) n using 1 · simp only [wittPolynomial, wittMul] rw [AlgHom.map_sum] congr 1 with i congr 1 have hsupp : (Finsupp.single i (p ^ (n - i))).support = {i} := by rw [Finsupp.support_eq_singleton] simp only [and_true_iff, Finsupp.single_eq_same, eq_self_iff_true, Ne] exact pow_ne_zero _ hp.out.ne_zero simp only [bind₁_monomial, hsupp, Int.cast_natCast, prod_singleton, eq_intCast, Finsupp.single_eq_same, C_pow, mul_eq_mul_left_iff, true_or_iff, eq_self_iff_true, Int.cast_pow] · simp only [map_mul, bind₁_X_right] #align witt_vector.mul_poly_of_interest_aux1 WittVector.mul_polyOfInterest_aux1 theorem mul_polyOfInterest_aux2 (n : ℕ) : (p : 𝕄) ^ n * wittMul p n + wittPolyProdRemainder p n = wittPolyProd p n := by convert mul_polyOfInterest_aux1 p n rw [sum_range_succ, add_comm, Nat.sub_self, pow_zero, pow_one] rfl #align witt_vector.mul_poly_of_interest_aux2 WittVector.mul_polyOfInterest_aux2
Mathlib/RingTheory/WittVector/MulCoeff.lean
145
176
theorem mul_polyOfInterest_aux3 (n : ℕ) : wittPolyProd p (n + 1) = -((p : 𝕄) ^ (n + 1) * X (0, n + 1)) * ((p : 𝕄) ^ (n + 1) * X (1, n + 1)) + (p : 𝕄) ^ (n + 1) * X (0, n + 1) * rename (Prod.mk (1 : Fin 2)) (wittPolynomial p ℤ (n + 1)) + (p : 𝕄) ^ (n + 1) * X (1, n + 1) * rename (Prod.mk (0 : Fin 2)) (wittPolynomial p ℤ (n + 1)) + remainder p n := by
-- a useful auxiliary fact have mvpz : (p : 𝕄) ^ (n + 1) = MvPolynomial.C ((p : ℤ) ^ (n + 1)) := by norm_cast -- Porting note: the original proof applies `sum_range_succ` through a non-`conv` rewrite, -- but this does not work in Lean 4; the whole proof also times out very badly. The proof has been -- nearly totally rewritten here and now finishes quite fast. rw [wittPolyProd, wittPolynomial, AlgHom.map_sum, AlgHom.map_sum] conv_lhs => arg 1 rw [sum_range_succ, ← C_mul_X_pow_eq_monomial, tsub_self, pow_zero, pow_one, map_mul, rename_C, rename_X, ← mvpz] conv_lhs => arg 2 rw [sum_range_succ, ← C_mul_X_pow_eq_monomial, tsub_self, pow_zero, pow_one, map_mul, rename_C, rename_X, ← mvpz] conv_rhs => enter [1, 1, 2, 2] rw [sum_range_succ, ← C_mul_X_pow_eq_monomial, tsub_self, pow_zero, pow_one, map_mul, rename_C, rename_X, ← mvpz] conv_rhs => enter [1, 2, 2] rw [sum_range_succ, ← C_mul_X_pow_eq_monomial, tsub_self, pow_zero, pow_one, map_mul, rename_C, rename_X, ← mvpz] simp only [add_mul, mul_add] rw [add_comm _ (remainder p n)] simp only [add_assoc] apply congrArg (Add.add _) ring
1,996
import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.mul_p from "leanprover-community/mathlib"@"7abfbc92eec87190fba3ed3d5ec58e7c167e7144" namespace WittVector variable {p : ℕ} {R : Type*} [hp : Fact p.Prime] [CommRing R] local notation "𝕎" => WittVector p -- type as `\bbW` open MvPolynomial noncomputable section variable (p) noncomputable def wittMulN : ℕ → ℕ → MvPolynomial ℕ ℤ | 0 => 0 | n + 1 => fun k => bind₁ (Function.uncurry <| ![wittMulN n, X]) (wittAdd p k) #align witt_vector.witt_mul_n WittVector.wittMulN variable {p}
Mathlib/RingTheory/WittVector/MulP.lean
50
60
theorem mulN_coeff (n : ℕ) (x : 𝕎 R) (k : ℕ) : (x * n).coeff k = aeval x.coeff (wittMulN p n k) := by
induction' n with n ih generalizing k · simp only [Nat.zero_eq, Nat.cast_zero, mul_zero, zero_coeff, wittMulN, AlgHom.map_zero, Pi.zero_apply] · rw [wittMulN, Nat.cast_add, Nat.cast_one, mul_add, mul_one, aeval_bind₁, add_coeff] apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl ext1 ⟨b, i⟩ fin_cases b · simp [Function.uncurry, Matrix.cons_val_zero, ih] · simp [Function.uncurry, Matrix.cons_val_one, Matrix.head_cons, aeval_X]
1,997
import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.mul_p from "leanprover-community/mathlib"@"7abfbc92eec87190fba3ed3d5ec58e7c167e7144" namespace WittVector variable {p : ℕ} {R : Type*} [hp : Fact p.Prime] [CommRing R] local notation "𝕎" => WittVector p -- type as `\bbW` open MvPolynomial noncomputable section variable (p) noncomputable def wittMulN : ℕ → ℕ → MvPolynomial ℕ ℤ | 0 => 0 | n + 1 => fun k => bind₁ (Function.uncurry <| ![wittMulN n, X]) (wittAdd p k) #align witt_vector.witt_mul_n WittVector.wittMulN variable {p} theorem mulN_coeff (n : ℕ) (x : 𝕎 R) (k : ℕ) : (x * n).coeff k = aeval x.coeff (wittMulN p n k) := by induction' n with n ih generalizing k · simp only [Nat.zero_eq, Nat.cast_zero, mul_zero, zero_coeff, wittMulN, AlgHom.map_zero, Pi.zero_apply] · rw [wittMulN, Nat.cast_add, Nat.cast_one, mul_add, mul_one, aeval_bind₁, add_coeff] apply eval₂Hom_congr (RingHom.ext_int _ _) _ rfl ext1 ⟨b, i⟩ fin_cases b · simp [Function.uncurry, Matrix.cons_val_zero, ih] · simp [Function.uncurry, Matrix.cons_val_one, Matrix.head_cons, aeval_X] #align witt_vector.mul_n_coeff WittVector.mulN_coeff variable (p) @[is_poly] theorem mulN_isPoly (n : ℕ) : IsPoly p fun R _Rcr x => x * n := ⟨⟨wittMulN p n, fun R _Rcr x => by funext k; exact mulN_coeff n x k⟩⟩ #align witt_vector.mul_n_is_poly WittVector.mulN_isPoly @[simp]
Mathlib/RingTheory/WittVector/MulP.lean
72
80
theorem bind₁_wittMulN_wittPolynomial (n k : ℕ) : bind₁ (wittMulN p n) (wittPolynomial p ℤ k) = n * wittPolynomial p ℤ k := by
induction' n with n ih · simp [wittMulN, Nat.cast_zero, zero_mul, bind₁_zero_wittPolynomial] · rw [wittMulN, ← bind₁_bind₁, wittAdd, wittStructureInt_prop] simp only [AlgHom.map_add, Nat.cast_succ, bind₁_X_right] rw [add_mul, one_mul, bind₁_rename, bind₁_rename] simp only [ih, Function.uncurry, Function.comp, bind₁_X_left, AlgHom.id_apply, Matrix.cons_val_zero, Matrix.head_cons, Matrix.cons_val_one]
1,997
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.verschiebung from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c" namespace WittVector open MvPolynomial variable {p : ℕ} {R S : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` noncomputable section def verschiebungFun (x : 𝕎 R) : 𝕎 R := @mk' p _ fun n => if n = 0 then 0 else x.coeff (n - 1) #align witt_vector.verschiebung_fun WittVector.verschiebungFun
Mathlib/RingTheory/WittVector/Verschiebung.lean
42
44
theorem verschiebungFun_coeff (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n = if n = 0 then 0 else x.coeff (n - 1) := by
simp only [verschiebungFun, ge_iff_le]
1,998
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.verschiebung from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c" namespace WittVector open MvPolynomial variable {p : ℕ} {R S : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` noncomputable section def verschiebungFun (x : 𝕎 R) : 𝕎 R := @mk' p _ fun n => if n = 0 then 0 else x.coeff (n - 1) #align witt_vector.verschiebung_fun WittVector.verschiebungFun theorem verschiebungFun_coeff (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n = if n = 0 then 0 else x.coeff (n - 1) := by simp only [verschiebungFun, ge_iff_le] #align witt_vector.verschiebung_fun_coeff WittVector.verschiebungFun_coeff
Mathlib/RingTheory/WittVector/Verschiebung.lean
47
48
theorem verschiebungFun_coeff_zero (x : 𝕎 R) : (verschiebungFun x).coeff 0 = 0 := by
rw [verschiebungFun_coeff, if_pos rfl]
1,998
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.verschiebung from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c" namespace WittVector open MvPolynomial variable {p : ℕ} {R S : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` noncomputable section def verschiebungFun (x : 𝕎 R) : 𝕎 R := @mk' p _ fun n => if n = 0 then 0 else x.coeff (n - 1) #align witt_vector.verschiebung_fun WittVector.verschiebungFun theorem verschiebungFun_coeff (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n = if n = 0 then 0 else x.coeff (n - 1) := by simp only [verschiebungFun, ge_iff_le] #align witt_vector.verschiebung_fun_coeff WittVector.verschiebungFun_coeff theorem verschiebungFun_coeff_zero (x : 𝕎 R) : (verschiebungFun x).coeff 0 = 0 := by rw [verschiebungFun_coeff, if_pos rfl] #align witt_vector.verschiebung_fun_coeff_zero WittVector.verschiebungFun_coeff_zero @[simp] theorem verschiebungFun_coeff_succ (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n.succ = x.coeff n := rfl #align witt_vector.verschiebung_fun_coeff_succ WittVector.verschiebungFun_coeff_succ @[ghost_simps]
Mathlib/RingTheory/WittVector/Verschiebung.lean
58
61
theorem ghostComponent_zero_verschiebungFun (x : 𝕎 R) : ghostComponent 0 (verschiebungFun x) = 0 := by
rw [ghostComponent_apply, aeval_wittPolynomial, Finset.range_one, Finset.sum_singleton, verschiebungFun_coeff_zero, pow_zero, pow_zero, pow_one, one_mul]
1,998
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.verschiebung from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c" namespace WittVector open MvPolynomial variable {p : ℕ} {R S : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` noncomputable section def verschiebungFun (x : 𝕎 R) : 𝕎 R := @mk' p _ fun n => if n = 0 then 0 else x.coeff (n - 1) #align witt_vector.verschiebung_fun WittVector.verschiebungFun theorem verschiebungFun_coeff (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n = if n = 0 then 0 else x.coeff (n - 1) := by simp only [verschiebungFun, ge_iff_le] #align witt_vector.verschiebung_fun_coeff WittVector.verschiebungFun_coeff theorem verschiebungFun_coeff_zero (x : 𝕎 R) : (verschiebungFun x).coeff 0 = 0 := by rw [verschiebungFun_coeff, if_pos rfl] #align witt_vector.verschiebung_fun_coeff_zero WittVector.verschiebungFun_coeff_zero @[simp] theorem verschiebungFun_coeff_succ (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n.succ = x.coeff n := rfl #align witt_vector.verschiebung_fun_coeff_succ WittVector.verschiebungFun_coeff_succ @[ghost_simps] theorem ghostComponent_zero_verschiebungFun (x : 𝕎 R) : ghostComponent 0 (verschiebungFun x) = 0 := by rw [ghostComponent_apply, aeval_wittPolynomial, Finset.range_one, Finset.sum_singleton, verschiebungFun_coeff_zero, pow_zero, pow_zero, pow_one, one_mul] #align witt_vector.ghost_component_zero_verschiebung_fun WittVector.ghostComponent_zero_verschiebungFun @[ghost_simps]
Mathlib/RingTheory/WittVector/Verschiebung.lean
65
71
theorem ghostComponent_verschiebungFun (x : 𝕎 R) (n : ℕ) : ghostComponent (n + 1) (verschiebungFun x) = p * ghostComponent n x := by
simp only [ghostComponent_apply, aeval_wittPolynomial] rw [Finset.sum_range_succ', verschiebungFun_coeff, if_pos rfl, zero_pow (pow_ne_zero _ hp.1.ne_zero), mul_zero, add_zero, Finset.mul_sum, Finset.sum_congr rfl] rintro i - simp only [pow_succ', verschiebungFun_coeff_succ, Nat.succ_sub_succ_eq_sub, mul_assoc]
1,998
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.verschiebung from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c" namespace WittVector open MvPolynomial variable {p : ℕ} {R S : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` noncomputable section def verschiebungFun (x : 𝕎 R) : 𝕎 R := @mk' p _ fun n => if n = 0 then 0 else x.coeff (n - 1) #align witt_vector.verschiebung_fun WittVector.verschiebungFun theorem verschiebungFun_coeff (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n = if n = 0 then 0 else x.coeff (n - 1) := by simp only [verschiebungFun, ge_iff_le] #align witt_vector.verschiebung_fun_coeff WittVector.verschiebungFun_coeff theorem verschiebungFun_coeff_zero (x : 𝕎 R) : (verschiebungFun x).coeff 0 = 0 := by rw [verschiebungFun_coeff, if_pos rfl] #align witt_vector.verschiebung_fun_coeff_zero WittVector.verschiebungFun_coeff_zero @[simp] theorem verschiebungFun_coeff_succ (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n.succ = x.coeff n := rfl #align witt_vector.verschiebung_fun_coeff_succ WittVector.verschiebungFun_coeff_succ @[ghost_simps] theorem ghostComponent_zero_verschiebungFun (x : 𝕎 R) : ghostComponent 0 (verschiebungFun x) = 0 := by rw [ghostComponent_apply, aeval_wittPolynomial, Finset.range_one, Finset.sum_singleton, verschiebungFun_coeff_zero, pow_zero, pow_zero, pow_one, one_mul] #align witt_vector.ghost_component_zero_verschiebung_fun WittVector.ghostComponent_zero_verschiebungFun @[ghost_simps] theorem ghostComponent_verschiebungFun (x : 𝕎 R) (n : ℕ) : ghostComponent (n + 1) (verschiebungFun x) = p * ghostComponent n x := by simp only [ghostComponent_apply, aeval_wittPolynomial] rw [Finset.sum_range_succ', verschiebungFun_coeff, if_pos rfl, zero_pow (pow_ne_zero _ hp.1.ne_zero), mul_zero, add_zero, Finset.mul_sum, Finset.sum_congr rfl] rintro i - simp only [pow_succ', verschiebungFun_coeff_succ, Nat.succ_sub_succ_eq_sub, mul_assoc] #align witt_vector.ghost_component_verschiebung_fun WittVector.ghostComponent_verschiebungFun def verschiebungPoly (n : ℕ) : MvPolynomial ℕ ℤ := if n = 0 then 0 else X (n - 1) #align witt_vector.verschiebung_poly WittVector.verschiebungPoly @[simp] theorem verschiebungPoly_zero : verschiebungPoly 0 = 0 := rfl #align witt_vector.verschiebung_poly_zero WittVector.verschiebungPoly_zero
Mathlib/RingTheory/WittVector/Verschiebung.lean
86
92
theorem aeval_verschiebung_poly' (x : 𝕎 R) (n : ℕ) : aeval x.coeff (verschiebungPoly n) = (verschiebungFun x).coeff n := by
cases' n with n · simp only [verschiebungPoly, Nat.zero_eq, ge_iff_le, tsub_eq_zero_of_le, ite_true, map_zero, verschiebungFun_coeff_zero] · rw [verschiebungPoly, verschiebungFun_coeff_succ, if_neg n.succ_ne_zero, aeval_X, add_tsub_cancel_right]
1,998
import Mathlib.RingTheory.WittVector.Basic import Mathlib.RingTheory.WittVector.IsPoly #align_import ring_theory.witt_vector.verschiebung from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c" namespace WittVector open MvPolynomial variable {p : ℕ} {R S : Type*} [hp : Fact p.Prime] [CommRing R] [CommRing S] local notation "𝕎" => WittVector p -- type as `\bbW` noncomputable section def verschiebungFun (x : 𝕎 R) : 𝕎 R := @mk' p _ fun n => if n = 0 then 0 else x.coeff (n - 1) #align witt_vector.verschiebung_fun WittVector.verschiebungFun theorem verschiebungFun_coeff (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n = if n = 0 then 0 else x.coeff (n - 1) := by simp only [verschiebungFun, ge_iff_le] #align witt_vector.verschiebung_fun_coeff WittVector.verschiebungFun_coeff theorem verschiebungFun_coeff_zero (x : 𝕎 R) : (verschiebungFun x).coeff 0 = 0 := by rw [verschiebungFun_coeff, if_pos rfl] #align witt_vector.verschiebung_fun_coeff_zero WittVector.verschiebungFun_coeff_zero @[simp] theorem verschiebungFun_coeff_succ (x : 𝕎 R) (n : ℕ) : (verschiebungFun x).coeff n.succ = x.coeff n := rfl #align witt_vector.verschiebung_fun_coeff_succ WittVector.verschiebungFun_coeff_succ @[ghost_simps] theorem ghostComponent_zero_verschiebungFun (x : 𝕎 R) : ghostComponent 0 (verschiebungFun x) = 0 := by rw [ghostComponent_apply, aeval_wittPolynomial, Finset.range_one, Finset.sum_singleton, verschiebungFun_coeff_zero, pow_zero, pow_zero, pow_one, one_mul] #align witt_vector.ghost_component_zero_verschiebung_fun WittVector.ghostComponent_zero_verschiebungFun @[ghost_simps] theorem ghostComponent_verschiebungFun (x : 𝕎 R) (n : ℕ) : ghostComponent (n + 1) (verschiebungFun x) = p * ghostComponent n x := by simp only [ghostComponent_apply, aeval_wittPolynomial] rw [Finset.sum_range_succ', verschiebungFun_coeff, if_pos rfl, zero_pow (pow_ne_zero _ hp.1.ne_zero), mul_zero, add_zero, Finset.mul_sum, Finset.sum_congr rfl] rintro i - simp only [pow_succ', verschiebungFun_coeff_succ, Nat.succ_sub_succ_eq_sub, mul_assoc] #align witt_vector.ghost_component_verschiebung_fun WittVector.ghostComponent_verschiebungFun def verschiebungPoly (n : ℕ) : MvPolynomial ℕ ℤ := if n = 0 then 0 else X (n - 1) #align witt_vector.verschiebung_poly WittVector.verschiebungPoly @[simp] theorem verschiebungPoly_zero : verschiebungPoly 0 = 0 := rfl #align witt_vector.verschiebung_poly_zero WittVector.verschiebungPoly_zero theorem aeval_verschiebung_poly' (x : 𝕎 R) (n : ℕ) : aeval x.coeff (verschiebungPoly n) = (verschiebungFun x).coeff n := by cases' n with n · simp only [verschiebungPoly, Nat.zero_eq, ge_iff_le, tsub_eq_zero_of_le, ite_true, map_zero, verschiebungFun_coeff_zero] · rw [verschiebungPoly, verschiebungFun_coeff_succ, if_neg n.succ_ne_zero, aeval_X, add_tsub_cancel_right] #align witt_vector.aeval_verschiebung_poly' WittVector.aeval_verschiebung_poly' variable (p) -- Porting note: replaced `@[is_poly]` with `instance`. instance verschiebungFun_isPoly : IsPoly p fun R _Rcr => @verschiebungFun p R _Rcr := by use verschiebungPoly simp only [aeval_verschiebung_poly', eq_self_iff_true, forall₃_true_iff] #align witt_vector.verschiebung_fun_is_poly WittVector.verschiebungFun_isPoly -- Porting note: we add this example as a verification that Lean 4's instance resolution -- can handle what in Lean 3 we needed the `@[is_poly]` attribute to help with. example (p : ℕ) (f : ⦃R : Type _⦄ → [CommRing R] → WittVector p R → WittVector p R) [IsPoly p f] : IsPoly p (fun (R : Type*) (I : CommRing R) ↦ verschiebungFun ∘ (@f R I)) := inferInstance variable {p} noncomputable def verschiebung : 𝕎 R →+ 𝕎 R where toFun := verschiebungFun map_zero' := by ext ⟨⟩ <;> rw [verschiebungFun_coeff] <;> simp only [if_true, eq_self_iff_true, zero_coeff, ite_self] map_add' := by dsimp ghost_calc _ _ rintro ⟨⟩ <;> -- Uses the dumb induction principle, hence adding `Nat.zero_eq` to ghost_simps. ghost_simp #align witt_vector.verschiebung WittVector.verschiebung @[is_poly] theorem verschiebung_isPoly : IsPoly p fun R _Rcr => @verschiebung p R hp _Rcr := verschiebungFun_isPoly p #align witt_vector.verschiebung_is_poly WittVector.verschiebung_isPoly @[simp]
Mathlib/RingTheory/WittVector/Verschiebung.lean
139
143
theorem map_verschiebung (f : R →+* S) (x : 𝕎 R) : map f (verschiebung x) = verschiebung (map f x) := by
ext ⟨-, -⟩ · exact f.map_zero · rfl
1,998
import Mathlib.Algebra.Ring.Int import Mathlib.Data.ZMod.Basic import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Fintype.BigOperators #align_import number_theory.sum_four_squares from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc" open Finset Polynomial FiniteField Equiv
Mathlib/NumberTheory/SumFourSquares.lean
28
31
theorem euler_four_squares {R : Type*} [CommRing R] (a b c d x y z w : R) : (a * x - b * y - c * z - d * w) ^ 2 + (a * y + b * x + c * w - d * z) ^ 2 + (a * z - b * w + c * x + d * y) ^ 2 + (a * w + b * z - c * y + d * x) ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by
ring
1,999
import Mathlib.Algebra.Ring.Int import Mathlib.Data.ZMod.Basic import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Fintype.BigOperators #align_import number_theory.sum_four_squares from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc" open Finset Polynomial FiniteField Equiv theorem euler_four_squares {R : Type*} [CommRing R] (a b c d x y z w : R) : (a * x - b * y - c * z - d * w) ^ 2 + (a * y + b * x + c * w - d * z) ^ 2 + (a * z - b * w + c * x + d * y) ^ 2 + (a * w + b * z - c * y + d * x) ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by ring
Mathlib/NumberTheory/SumFourSquares.lean
34
42
theorem Nat.euler_four_squares (a b c d x y z w : ℕ) : ((a : ℤ) * x - b * y - c * z - d * w).natAbs ^ 2 + ((a : ℤ) * y + b * x + c * w - d * z).natAbs ^ 2 + ((a : ℤ) * z - b * w + c * x + d * y).natAbs ^ 2 + ((a : ℤ) * w + b * z - c * y + d * x).natAbs ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by
rw [← Int.natCast_inj] push_cast simp only [sq_abs, _root_.euler_four_squares]
1,999
import Mathlib.Algebra.Ring.Int import Mathlib.Data.ZMod.Basic import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Fintype.BigOperators #align_import number_theory.sum_four_squares from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc" open Finset Polynomial FiniteField Equiv theorem euler_four_squares {R : Type*} [CommRing R] (a b c d x y z w : R) : (a * x - b * y - c * z - d * w) ^ 2 + (a * y + b * x + c * w - d * z) ^ 2 + (a * z - b * w + c * x + d * y) ^ 2 + (a * w + b * z - c * y + d * x) ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by ring theorem Nat.euler_four_squares (a b c d x y z w : ℕ) : ((a : ℤ) * x - b * y - c * z - d * w).natAbs ^ 2 + ((a : ℤ) * y + b * x + c * w - d * z).natAbs ^ 2 + ((a : ℤ) * z - b * w + c * x + d * y).natAbs ^ 2 + ((a : ℤ) * w + b * z - c * y + d * x).natAbs ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by rw [← Int.natCast_inj] push_cast simp only [sq_abs, _root_.euler_four_squares] namespace Int
Mathlib/NumberTheory/SumFourSquares.lean
46
59
theorem sq_add_sq_of_two_mul_sq_add_sq {m x y : ℤ} (h : 2 * m = x ^ 2 + y ^ 2) : m = ((x - y) / 2) ^ 2 + ((x + y) / 2) ^ 2 := have : Even (x ^ 2 + y ^ 2) := by
simp [← h, even_mul] have hxaddy : Even (x + y) := by simpa [sq, parity_simps] have hxsuby : Even (x - y) := by simpa [sq, parity_simps] mul_right_injective₀ (show (2 * 2 : ℤ) ≠ 0 by decide) <| calc 2 * 2 * m = (x - y) ^ 2 + (x + y) ^ 2 := by rw [mul_assoc, h]; ring _ = (2 * ((x - y) / 2)) ^ 2 + (2 * ((x + y) / 2)) ^ 2 := by rw [even_iff_two_dvd] at hxsuby hxaddy rw [Int.mul_ediv_cancel' hxsuby, Int.mul_ediv_cancel' hxaddy] _ = 2 * 2 * (((x - y) / 2) ^ 2 + ((x + y) / 2) ^ 2) := by set_option simprocs false in simp [mul_add, pow_succ, mul_comm, mul_assoc, mul_left_comm]
1,999
import Mathlib.Algebra.Ring.Int import Mathlib.Data.ZMod.Basic import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Fintype.BigOperators #align_import number_theory.sum_four_squares from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc" open Finset Polynomial FiniteField Equiv theorem euler_four_squares {R : Type*} [CommRing R] (a b c d x y z w : R) : (a * x - b * y - c * z - d * w) ^ 2 + (a * y + b * x + c * w - d * z) ^ 2 + (a * z - b * w + c * x + d * y) ^ 2 + (a * w + b * z - c * y + d * x) ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by ring theorem Nat.euler_four_squares (a b c d x y z w : ℕ) : ((a : ℤ) * x - b * y - c * z - d * w).natAbs ^ 2 + ((a : ℤ) * y + b * x + c * w - d * z).natAbs ^ 2 + ((a : ℤ) * z - b * w + c * x + d * y).natAbs ^ 2 + ((a : ℤ) * w + b * z - c * y + d * x).natAbs ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by rw [← Int.natCast_inj] push_cast simp only [sq_abs, _root_.euler_four_squares] namespace Int theorem sq_add_sq_of_two_mul_sq_add_sq {m x y : ℤ} (h : 2 * m = x ^ 2 + y ^ 2) : m = ((x - y) / 2) ^ 2 + ((x + y) / 2) ^ 2 := have : Even (x ^ 2 + y ^ 2) := by simp [← h, even_mul] have hxaddy : Even (x + y) := by simpa [sq, parity_simps] have hxsuby : Even (x - y) := by simpa [sq, parity_simps] mul_right_injective₀ (show (2 * 2 : ℤ) ≠ 0 by decide) <| calc 2 * 2 * m = (x - y) ^ 2 + (x + y) ^ 2 := by rw [mul_assoc, h]; ring _ = (2 * ((x - y) / 2)) ^ 2 + (2 * ((x + y) / 2)) ^ 2 := by rw [even_iff_two_dvd] at hxsuby hxaddy rw [Int.mul_ediv_cancel' hxsuby, Int.mul_ediv_cancel' hxaddy] _ = 2 * 2 * (((x - y) / 2) ^ 2 + ((x + y) / 2) ^ 2) := by set_option simprocs false in simp [mul_add, pow_succ, mul_comm, mul_assoc, mul_left_comm] #align int.sq_add_sq_of_two_mul_sq_add_sq Int.sq_add_sq_of_two_mul_sq_add_sq -- Porting note (#10756): new theorem
Mathlib/NumberTheory/SumFourSquares.lean
63
75
theorem lt_of_sum_four_squares_eq_mul {a b c d k m : ℕ} (h : a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2 = k * m) (ha : 2 * a < m) (hb : 2 * b < m) (hc : 2 * c < m) (hd : 2 * d < m) : k < m := by
refine _root_.lt_of_mul_lt_mul_right (_root_.lt_of_mul_lt_mul_left ?_ (zero_le (2 ^ 2))) (zero_le m) calc 2 ^ 2 * (k * ↑m) = ∑ i : Fin 4, (2 * ![a, b, c, d] i) ^ 2 := by simp [← h, Fin.sum_univ_succ, mul_add, mul_pow, add_assoc] _ < ∑ _i : Fin 4, m ^ 2 := Finset.sum_lt_sum_of_nonempty Finset.univ_nonempty fun i _ ↦ by refine pow_lt_pow_left ?_ (zero_le _) two_ne_zero fin_cases i <;> assumption _ = 2 ^ 2 * (m * m) := by simp; ring
1,999
import Mathlib.Algebra.Ring.Int import Mathlib.Data.ZMod.Basic import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Fintype.BigOperators #align_import number_theory.sum_four_squares from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc" open Finset Polynomial FiniteField Equiv theorem euler_four_squares {R : Type*} [CommRing R] (a b c d x y z w : R) : (a * x - b * y - c * z - d * w) ^ 2 + (a * y + b * x + c * w - d * z) ^ 2 + (a * z - b * w + c * x + d * y) ^ 2 + (a * w + b * z - c * y + d * x) ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by ring theorem Nat.euler_four_squares (a b c d x y z w : ℕ) : ((a : ℤ) * x - b * y - c * z - d * w).natAbs ^ 2 + ((a : ℤ) * y + b * x + c * w - d * z).natAbs ^ 2 + ((a : ℤ) * z - b * w + c * x + d * y).natAbs ^ 2 + ((a : ℤ) * w + b * z - c * y + d * x).natAbs ^ 2 = (a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2) * (x ^ 2 + y ^ 2 + z ^ 2 + w ^ 2) := by rw [← Int.natCast_inj] push_cast simp only [sq_abs, _root_.euler_four_squares] namespace Int theorem sq_add_sq_of_two_mul_sq_add_sq {m x y : ℤ} (h : 2 * m = x ^ 2 + y ^ 2) : m = ((x - y) / 2) ^ 2 + ((x + y) / 2) ^ 2 := have : Even (x ^ 2 + y ^ 2) := by simp [← h, even_mul] have hxaddy : Even (x + y) := by simpa [sq, parity_simps] have hxsuby : Even (x - y) := by simpa [sq, parity_simps] mul_right_injective₀ (show (2 * 2 : ℤ) ≠ 0 by decide) <| calc 2 * 2 * m = (x - y) ^ 2 + (x + y) ^ 2 := by rw [mul_assoc, h]; ring _ = (2 * ((x - y) / 2)) ^ 2 + (2 * ((x + y) / 2)) ^ 2 := by rw [even_iff_two_dvd] at hxsuby hxaddy rw [Int.mul_ediv_cancel' hxsuby, Int.mul_ediv_cancel' hxaddy] _ = 2 * 2 * (((x - y) / 2) ^ 2 + ((x + y) / 2) ^ 2) := by set_option simprocs false in simp [mul_add, pow_succ, mul_comm, mul_assoc, mul_left_comm] #align int.sq_add_sq_of_two_mul_sq_add_sq Int.sq_add_sq_of_two_mul_sq_add_sq -- Porting note (#10756): new theorem theorem lt_of_sum_four_squares_eq_mul {a b c d k m : ℕ} (h : a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2 = k * m) (ha : 2 * a < m) (hb : 2 * b < m) (hc : 2 * c < m) (hd : 2 * d < m) : k < m := by refine _root_.lt_of_mul_lt_mul_right (_root_.lt_of_mul_lt_mul_left ?_ (zero_le (2 ^ 2))) (zero_le m) calc 2 ^ 2 * (k * ↑m) = ∑ i : Fin 4, (2 * ![a, b, c, d] i) ^ 2 := by simp [← h, Fin.sum_univ_succ, mul_add, mul_pow, add_assoc] _ < ∑ _i : Fin 4, m ^ 2 := Finset.sum_lt_sum_of_nonempty Finset.univ_nonempty fun i _ ↦ by refine pow_lt_pow_left ?_ (zero_le _) two_ne_zero fin_cases i <;> assumption _ = 2 ^ 2 * (m * m) := by simp; ring -- Porting note (#10756): new theorem
Mathlib/NumberTheory/SumFourSquares.lean
78
96
theorem exists_sq_add_sq_add_one_eq_mul (p : ℕ) [hp : Fact p.Prime] : ∃ (a b k : ℕ), 0 < k ∧ k < p ∧ a ^ 2 + b ^ 2 + 1 = k * p := by
rcases hp.1.eq_two_or_odd' with (rfl | hodd) · use 1, 0, 1; simp rcases Nat.sq_add_sq_zmodEq p (-1) with ⟨a, b, ha, hb, hab⟩ rcases Int.modEq_iff_dvd.1 hab.symm with ⟨k, hk⟩ rw [sub_neg_eq_add, mul_comm] at hk have hk₀ : 0 < k := by refine pos_of_mul_pos_left ?_ (Nat.cast_nonneg p) rw [← hk] positivity lift k to ℕ using hk₀.le refine ⟨a, b, k, Nat.cast_pos.1 hk₀, ?_, mod_cast hk⟩ replace hk : a ^ 2 + b ^ 2 + 1 ^ 2 + 0 ^ 2 = k * p := mod_cast hk refine lt_of_sum_four_squares_eq_mul hk ?_ ?_ ?_ ?_ · exact (mul_le_mul' le_rfl ha).trans_lt (Nat.mul_div_lt_iff_not_dvd.2 hodd.not_two_dvd_nat) · exact (mul_le_mul' le_rfl hb).trans_lt (Nat.mul_div_lt_iff_not_dvd.2 hodd.not_two_dvd_nat) · exact lt_of_le_of_ne hp.1.two_le (hodd.ne_two_of_dvd_nat (dvd_refl _)).symm · exact hp.1.pos
1,999
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Matrix.CharP #align_import linear_algebra.matrix.charpoly.finite_field from "leanprover-community/mathlib"@"b95b8c7a484a298228805c72c142f6b062eb0d70" noncomputable section open Polynomial Matrix open scoped Polynomial variable {n : Type*} [DecidableEq n] [Fintype n] @[simp]
Mathlib/LinearAlgebra/Matrix/Charpoly/FiniteField.lean
26
43
theorem FiniteField.Matrix.charpoly_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) : (M ^ Fintype.card K).charpoly = M.charpoly := by
cases (isEmpty_or_nonempty n).symm · cases' CharP.exists K with p hp; letI := hp rcases FiniteField.card K p with ⟨⟨k, kpos⟩, ⟨hp, hk⟩⟩ haveI : Fact p.Prime := ⟨hp⟩ dsimp at hk; rw [hk] apply (frobenius_inj K[X] p).iterate k repeat' rw [iterate_frobenius (R := K[X])]; rw [← hk] rw [← FiniteField.expand_card] unfold charpoly rw [AlgHom.map_det, ← coe_detMonoidHom, ← (detMonoidHom : Matrix n n K[X] →* K[X]).map_pow] apply congr_arg det refine matPolyEquiv.injective ?_ rw [AlgEquiv.map_pow, matPolyEquiv_charmatrix, hk, sub_pow_char_pow_of_commute, ← C_pow] · exact (id (matPolyEquiv_eq_X_pow_sub_C (p ^ k) M) : _) · exact (C M).commute_X · exact congr_arg _ (Subsingleton.elim _ _)
2,000
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Matrix.CharP #align_import linear_algebra.matrix.charpoly.finite_field from "leanprover-community/mathlib"@"b95b8c7a484a298228805c72c142f6b062eb0d70" noncomputable section open Polynomial Matrix open scoped Polynomial variable {n : Type*} [DecidableEq n] [Fintype n] @[simp] theorem FiniteField.Matrix.charpoly_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) : (M ^ Fintype.card K).charpoly = M.charpoly := by cases (isEmpty_or_nonempty n).symm · cases' CharP.exists K with p hp; letI := hp rcases FiniteField.card K p with ⟨⟨k, kpos⟩, ⟨hp, hk⟩⟩ haveI : Fact p.Prime := ⟨hp⟩ dsimp at hk; rw [hk] apply (frobenius_inj K[X] p).iterate k repeat' rw [iterate_frobenius (R := K[X])]; rw [← hk] rw [← FiniteField.expand_card] unfold charpoly rw [AlgHom.map_det, ← coe_detMonoidHom, ← (detMonoidHom : Matrix n n K[X] →* K[X]).map_pow] apply congr_arg det refine matPolyEquiv.injective ?_ rw [AlgEquiv.map_pow, matPolyEquiv_charmatrix, hk, sub_pow_char_pow_of_commute, ← C_pow] · exact (id (matPolyEquiv_eq_X_pow_sub_C (p ^ k) M) : _) · exact (C M).commute_X · exact congr_arg _ (Subsingleton.elim _ _) #align finite_field.matrix.charpoly_pow_card FiniteField.Matrix.charpoly_pow_card @[simp]
Mathlib/LinearAlgebra/Matrix/Charpoly/FiniteField.lean
47
50
theorem ZMod.charpoly_pow_card {p : ℕ} [Fact p.Prime] (M : Matrix n n (ZMod p)) : (M ^ p).charpoly = M.charpoly := by
have h := FiniteField.Matrix.charpoly_pow_card M rwa [ZMod.card] at h
2,000
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Matrix.CharP #align_import linear_algebra.matrix.charpoly.finite_field from "leanprover-community/mathlib"@"b95b8c7a484a298228805c72c142f6b062eb0d70" noncomputable section open Polynomial Matrix open scoped Polynomial variable {n : Type*} [DecidableEq n] [Fintype n] @[simp] theorem FiniteField.Matrix.charpoly_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) : (M ^ Fintype.card K).charpoly = M.charpoly := by cases (isEmpty_or_nonempty n).symm · cases' CharP.exists K with p hp; letI := hp rcases FiniteField.card K p with ⟨⟨k, kpos⟩, ⟨hp, hk⟩⟩ haveI : Fact p.Prime := ⟨hp⟩ dsimp at hk; rw [hk] apply (frobenius_inj K[X] p).iterate k repeat' rw [iterate_frobenius (R := K[X])]; rw [← hk] rw [← FiniteField.expand_card] unfold charpoly rw [AlgHom.map_det, ← coe_detMonoidHom, ← (detMonoidHom : Matrix n n K[X] →* K[X]).map_pow] apply congr_arg det refine matPolyEquiv.injective ?_ rw [AlgEquiv.map_pow, matPolyEquiv_charmatrix, hk, sub_pow_char_pow_of_commute, ← C_pow] · exact (id (matPolyEquiv_eq_X_pow_sub_C (p ^ k) M) : _) · exact (C M).commute_X · exact congr_arg _ (Subsingleton.elim _ _) #align finite_field.matrix.charpoly_pow_card FiniteField.Matrix.charpoly_pow_card @[simp] theorem ZMod.charpoly_pow_card {p : ℕ} [Fact p.Prime] (M : Matrix n n (ZMod p)) : (M ^ p).charpoly = M.charpoly := by have h := FiniteField.Matrix.charpoly_pow_card M rwa [ZMod.card] at h #align zmod.charpoly_pow_card ZMod.charpoly_pow_card
Mathlib/LinearAlgebra/Matrix/Charpoly/FiniteField.lean
53
58
theorem FiniteField.trace_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) : trace (M ^ Fintype.card K) = trace M ^ Fintype.card K := by
cases isEmpty_or_nonempty n · simp [Matrix.trace] rw [Matrix.trace_eq_neg_charpoly_coeff, Matrix.trace_eq_neg_charpoly_coeff, FiniteField.Matrix.charpoly_pow_card, FiniteField.pow_card]
2,000
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.FieldTheory.Finite.Basic import Mathlib.Data.Matrix.CharP #align_import linear_algebra.matrix.charpoly.finite_field from "leanprover-community/mathlib"@"b95b8c7a484a298228805c72c142f6b062eb0d70" noncomputable section open Polynomial Matrix open scoped Polynomial variable {n : Type*} [DecidableEq n] [Fintype n] @[simp] theorem FiniteField.Matrix.charpoly_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) : (M ^ Fintype.card K).charpoly = M.charpoly := by cases (isEmpty_or_nonempty n).symm · cases' CharP.exists K with p hp; letI := hp rcases FiniteField.card K p with ⟨⟨k, kpos⟩, ⟨hp, hk⟩⟩ haveI : Fact p.Prime := ⟨hp⟩ dsimp at hk; rw [hk] apply (frobenius_inj K[X] p).iterate k repeat' rw [iterate_frobenius (R := K[X])]; rw [← hk] rw [← FiniteField.expand_card] unfold charpoly rw [AlgHom.map_det, ← coe_detMonoidHom, ← (detMonoidHom : Matrix n n K[X] →* K[X]).map_pow] apply congr_arg det refine matPolyEquiv.injective ?_ rw [AlgEquiv.map_pow, matPolyEquiv_charmatrix, hk, sub_pow_char_pow_of_commute, ← C_pow] · exact (id (matPolyEquiv_eq_X_pow_sub_C (p ^ k) M) : _) · exact (C M).commute_X · exact congr_arg _ (Subsingleton.elim _ _) #align finite_field.matrix.charpoly_pow_card FiniteField.Matrix.charpoly_pow_card @[simp] theorem ZMod.charpoly_pow_card {p : ℕ} [Fact p.Prime] (M : Matrix n n (ZMod p)) : (M ^ p).charpoly = M.charpoly := by have h := FiniteField.Matrix.charpoly_pow_card M rwa [ZMod.card] at h #align zmod.charpoly_pow_card ZMod.charpoly_pow_card theorem FiniteField.trace_pow_card {K : Type*} [Field K] [Fintype K] (M : Matrix n n K) : trace (M ^ Fintype.card K) = trace M ^ Fintype.card K := by cases isEmpty_or_nonempty n · simp [Matrix.trace] rw [Matrix.trace_eq_neg_charpoly_coeff, Matrix.trace_eq_neg_charpoly_coeff, FiniteField.Matrix.charpoly_pow_card, FiniteField.pow_card] #align finite_field.trace_pow_card FiniteField.trace_pow_card
Mathlib/LinearAlgebra/Matrix/Charpoly/FiniteField.lean
61
62
theorem ZMod.trace_pow_card {p : ℕ} [Fact p.Prime] (M : Matrix n n (ZMod p)) : trace (M ^ p) = trace M ^ p := by
have h := FiniteField.trace_pow_card M; rwa [ZMod.card] at h
2,000
import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.Algebra.CharP.Reduced open Function Polynomial class PerfectRing (R : Type*) (p : ℕ) [CommSemiring R] [ExpChar R p] : Prop where bijective_frobenius : Bijective <| frobenius R p section PerfectRing variable (R : Type*) (p m n : ℕ) [CommSemiring R] [ExpChar R p] lemma PerfectRing.ofSurjective (R : Type*) (p : ℕ) [CommRing R] [ExpChar R p] [IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p := ⟨frobenius_inj R p, h⟩ #align perfect_ring.of_surjective PerfectRing.ofSurjective instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p] [Finite R] [IsReduced R] : PerfectRing R p := ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p) variable [PerfectRing R p] @[simp] theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) := coe_iterateFrobenius R p n ▸ (bijective_frobenius R p).iterate n @[simp] theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1 @[simp] theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2 @[simps! apply] noncomputable def frobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius #align frobenius_equiv frobeniusEquiv @[simp] theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl #align coe_frobenius_equiv coe_frobeniusEquiv theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl @[simps! apply] noncomputable def iterateFrobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n) @[simp] theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x = iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) := iterateFrobenius_add_apply R p m n x theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) = (iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) := RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n) theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x = (iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) := (iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm, iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply] theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm = (iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm := RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n)
Mathlib/FieldTheory/Perfect.lean
113
114
theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by
rw [iterateFrobeniusEquiv_def, pow_zero, pow_one]
2,001
import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.Algebra.CharP.Reduced open Function Polynomial class PerfectRing (R : Type*) (p : ℕ) [CommSemiring R] [ExpChar R p] : Prop where bijective_frobenius : Bijective <| frobenius R p section PerfectRing variable (R : Type*) (p m n : ℕ) [CommSemiring R] [ExpChar R p] lemma PerfectRing.ofSurjective (R : Type*) (p : ℕ) [CommRing R] [ExpChar R p] [IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p := ⟨frobenius_inj R p, h⟩ #align perfect_ring.of_surjective PerfectRing.ofSurjective instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p] [Finite R] [IsReduced R] : PerfectRing R p := ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p) variable [PerfectRing R p] @[simp] theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) := coe_iterateFrobenius R p n ▸ (bijective_frobenius R p).iterate n @[simp] theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1 @[simp] theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2 @[simps! apply] noncomputable def frobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius #align frobenius_equiv frobeniusEquiv @[simp] theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl #align coe_frobenius_equiv coe_frobeniusEquiv theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl @[simps! apply] noncomputable def iterateFrobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n) @[simp] theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x = iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) := iterateFrobenius_add_apply R p m n x theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) = (iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) := RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n) theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x = (iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) := (iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm, iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply] theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm = (iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm := RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n) theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by rw [iterateFrobeniusEquiv_def, pow_zero, pow_one]
Mathlib/FieldTheory/Perfect.lean
116
117
theorem iterateFrobeniusEquiv_one_apply (x : R) : iterateFrobeniusEquiv R p 1 x = x ^ p := by
rw [iterateFrobeniusEquiv_def, pow_one]
2,001
import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.Algebra.CharP.Reduced open Function Polynomial class PerfectRing (R : Type*) (p : ℕ) [CommSemiring R] [ExpChar R p] : Prop where bijective_frobenius : Bijective <| frobenius R p section PerfectRing variable (R : Type*) (p m n : ℕ) [CommSemiring R] [ExpChar R p] lemma PerfectRing.ofSurjective (R : Type*) (p : ℕ) [CommRing R] [ExpChar R p] [IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p := ⟨frobenius_inj R p, h⟩ #align perfect_ring.of_surjective PerfectRing.ofSurjective instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p] [Finite R] [IsReduced R] : PerfectRing R p := ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p) variable [PerfectRing R p] @[simp] theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) := coe_iterateFrobenius R p n ▸ (bijective_frobenius R p).iterate n @[simp] theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1 @[simp] theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2 @[simps! apply] noncomputable def frobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius #align frobenius_equiv frobeniusEquiv @[simp] theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl #align coe_frobenius_equiv coe_frobeniusEquiv theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl @[simps! apply] noncomputable def iterateFrobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n) @[simp] theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x = iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) := iterateFrobenius_add_apply R p m n x theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) = (iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) := RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n) theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x = (iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) := (iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm, iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply] theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm = (iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm := RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n) theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by rw [iterateFrobeniusEquiv_def, pow_zero, pow_one] theorem iterateFrobeniusEquiv_one_apply (x : R) : iterateFrobeniusEquiv R p 1 x = x ^ p := by rw [iterateFrobeniusEquiv_def, pow_one] @[simp] theorem iterateFrobeniusEquiv_zero : iterateFrobeniusEquiv R p 0 = RingEquiv.refl R := RingEquiv.ext (iterateFrobeniusEquiv_zero_apply R p) @[simp] theorem iterateFrobeniusEquiv_one : iterateFrobeniusEquiv R p 1 = frobeniusEquiv R p := RingEquiv.ext (iterateFrobeniusEquiv_one_apply R p) theorem iterateFrobeniusEquiv_eq_pow : iterateFrobeniusEquiv R p n = frobeniusEquiv R p ^ n := DFunLike.ext' <| show _ = ⇑(RingAut.toPerm _ _) by rw [map_pow, Equiv.Perm.coe_pow]; exact (pow_iterate p n).symm
Mathlib/FieldTheory/Perfect.lean
131
133
theorem iterateFrobeniusEquiv_symm : (iterateFrobeniusEquiv R p n).symm = (frobeniusEquiv R p).symm ^ n := by
rw [iterateFrobeniusEquiv_eq_pow]; exact (inv_pow _ _).symm
2,001
import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.Algebra.CharP.Reduced open Function Polynomial class PerfectRing (R : Type*) (p : ℕ) [CommSemiring R] [ExpChar R p] : Prop where bijective_frobenius : Bijective <| frobenius R p section PerfectRing variable (R : Type*) (p m n : ℕ) [CommSemiring R] [ExpChar R p] lemma PerfectRing.ofSurjective (R : Type*) (p : ℕ) [CommRing R] [ExpChar R p] [IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p := ⟨frobenius_inj R p, h⟩ #align perfect_ring.of_surjective PerfectRing.ofSurjective instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p] [Finite R] [IsReduced R] : PerfectRing R p := ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p) variable [PerfectRing R p] @[simp] theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) := coe_iterateFrobenius R p n ▸ (bijective_frobenius R p).iterate n @[simp] theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1 @[simp] theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2 @[simps! apply] noncomputable def frobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius #align frobenius_equiv frobeniusEquiv @[simp] theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl #align coe_frobenius_equiv coe_frobeniusEquiv theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl @[simps! apply] noncomputable def iterateFrobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n) @[simp] theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x = iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) := iterateFrobenius_add_apply R p m n x theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) = (iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) := RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n) theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x = (iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) := (iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm, iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply] theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm = (iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm := RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n) theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by rw [iterateFrobeniusEquiv_def, pow_zero, pow_one] theorem iterateFrobeniusEquiv_one_apply (x : R) : iterateFrobeniusEquiv R p 1 x = x ^ p := by rw [iterateFrobeniusEquiv_def, pow_one] @[simp] theorem iterateFrobeniusEquiv_zero : iterateFrobeniusEquiv R p 0 = RingEquiv.refl R := RingEquiv.ext (iterateFrobeniusEquiv_zero_apply R p) @[simp] theorem iterateFrobeniusEquiv_one : iterateFrobeniusEquiv R p 1 = frobeniusEquiv R p := RingEquiv.ext (iterateFrobeniusEquiv_one_apply R p) theorem iterateFrobeniusEquiv_eq_pow : iterateFrobeniusEquiv R p n = frobeniusEquiv R p ^ n := DFunLike.ext' <| show _ = ⇑(RingAut.toPerm _ _) by rw [map_pow, Equiv.Perm.coe_pow]; exact (pow_iterate p n).symm theorem iterateFrobeniusEquiv_symm : (iterateFrobeniusEquiv R p n).symm = (frobeniusEquiv R p).symm ^ n := by rw [iterateFrobeniusEquiv_eq_pow]; exact (inv_pow _ _).symm @[simp] theorem frobeniusEquiv_symm_apply_frobenius (x : R) : (frobeniusEquiv R p).symm (frobenius R p x) = x := leftInverse_surjInv PerfectRing.bijective_frobenius x @[simp] theorem frobenius_apply_frobeniusEquiv_symm (x : R) : frobenius R p ((frobeniusEquiv R p).symm x) = x := surjInv_eq _ _ @[simp]
Mathlib/FieldTheory/Perfect.lean
146
148
theorem frobenius_comp_frobeniusEquiv_symm : (frobenius R p).comp (frobeniusEquiv R p).symm = RingHom.id R := by
ext; simp
2,001
import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.Algebra.CharP.Reduced open Function Polynomial class PerfectRing (R : Type*) (p : ℕ) [CommSemiring R] [ExpChar R p] : Prop where bijective_frobenius : Bijective <| frobenius R p section PerfectRing variable (R : Type*) (p m n : ℕ) [CommSemiring R] [ExpChar R p] lemma PerfectRing.ofSurjective (R : Type*) (p : ℕ) [CommRing R] [ExpChar R p] [IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p := ⟨frobenius_inj R p, h⟩ #align perfect_ring.of_surjective PerfectRing.ofSurjective instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p] [Finite R] [IsReduced R] : PerfectRing R p := ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p) variable [PerfectRing R p] @[simp] theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) := coe_iterateFrobenius R p n ▸ (bijective_frobenius R p).iterate n @[simp] theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1 @[simp] theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2 @[simps! apply] noncomputable def frobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius #align frobenius_equiv frobeniusEquiv @[simp] theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl #align coe_frobenius_equiv coe_frobeniusEquiv theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl @[simps! apply] noncomputable def iterateFrobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n) @[simp] theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x = iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) := iterateFrobenius_add_apply R p m n x theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) = (iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) := RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n) theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x = (iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) := (iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm, iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply] theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm = (iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm := RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n) theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by rw [iterateFrobeniusEquiv_def, pow_zero, pow_one] theorem iterateFrobeniusEquiv_one_apply (x : R) : iterateFrobeniusEquiv R p 1 x = x ^ p := by rw [iterateFrobeniusEquiv_def, pow_one] @[simp] theorem iterateFrobeniusEquiv_zero : iterateFrobeniusEquiv R p 0 = RingEquiv.refl R := RingEquiv.ext (iterateFrobeniusEquiv_zero_apply R p) @[simp] theorem iterateFrobeniusEquiv_one : iterateFrobeniusEquiv R p 1 = frobeniusEquiv R p := RingEquiv.ext (iterateFrobeniusEquiv_one_apply R p) theorem iterateFrobeniusEquiv_eq_pow : iterateFrobeniusEquiv R p n = frobeniusEquiv R p ^ n := DFunLike.ext' <| show _ = ⇑(RingAut.toPerm _ _) by rw [map_pow, Equiv.Perm.coe_pow]; exact (pow_iterate p n).symm theorem iterateFrobeniusEquiv_symm : (iterateFrobeniusEquiv R p n).symm = (frobeniusEquiv R p).symm ^ n := by rw [iterateFrobeniusEquiv_eq_pow]; exact (inv_pow _ _).symm @[simp] theorem frobeniusEquiv_symm_apply_frobenius (x : R) : (frobeniusEquiv R p).symm (frobenius R p x) = x := leftInverse_surjInv PerfectRing.bijective_frobenius x @[simp] theorem frobenius_apply_frobeniusEquiv_symm (x : R) : frobenius R p ((frobeniusEquiv R p).symm x) = x := surjInv_eq _ _ @[simp] theorem frobenius_comp_frobeniusEquiv_symm : (frobenius R p).comp (frobeniusEquiv R p).symm = RingHom.id R := by ext; simp @[simp]
Mathlib/FieldTheory/Perfect.lean
151
153
theorem frobeniusEquiv_symm_comp_frobenius : ((frobeniusEquiv R p).symm : R →+* R).comp (frobenius R p) = RingHom.id R := by
ext; simp
2,001
import Mathlib.FieldTheory.Separable import Mathlib.FieldTheory.SplittingField.Construction import Mathlib.Algebra.CharP.Reduced open Function Polynomial class PerfectRing (R : Type*) (p : ℕ) [CommSemiring R] [ExpChar R p] : Prop where bijective_frobenius : Bijective <| frobenius R p section PerfectRing variable (R : Type*) (p m n : ℕ) [CommSemiring R] [ExpChar R p] lemma PerfectRing.ofSurjective (R : Type*) (p : ℕ) [CommRing R] [ExpChar R p] [IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p := ⟨frobenius_inj R p, h⟩ #align perfect_ring.of_surjective PerfectRing.ofSurjective instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p] [Finite R] [IsReduced R] : PerfectRing R p := ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p) variable [PerfectRing R p] @[simp] theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) := coe_iterateFrobenius R p n ▸ (bijective_frobenius R p).iterate n @[simp] theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1 @[simp] theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2 @[simps! apply] noncomputable def frobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius #align frobenius_equiv frobeniusEquiv @[simp] theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl #align coe_frobenius_equiv coe_frobeniusEquiv theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl @[simps! apply] noncomputable def iterateFrobeniusEquiv : R ≃+* R := RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n) @[simp] theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x = iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) := iterateFrobenius_add_apply R p m n x theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) = (iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) := RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n) theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x = (iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) := (iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm, iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply] theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm = (iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm := RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n) theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by rw [iterateFrobeniusEquiv_def, pow_zero, pow_one] theorem iterateFrobeniusEquiv_one_apply (x : R) : iterateFrobeniusEquiv R p 1 x = x ^ p := by rw [iterateFrobeniusEquiv_def, pow_one] @[simp] theorem iterateFrobeniusEquiv_zero : iterateFrobeniusEquiv R p 0 = RingEquiv.refl R := RingEquiv.ext (iterateFrobeniusEquiv_zero_apply R p) @[simp] theorem iterateFrobeniusEquiv_one : iterateFrobeniusEquiv R p 1 = frobeniusEquiv R p := RingEquiv.ext (iterateFrobeniusEquiv_one_apply R p) theorem iterateFrobeniusEquiv_eq_pow : iterateFrobeniusEquiv R p n = frobeniusEquiv R p ^ n := DFunLike.ext' <| show _ = ⇑(RingAut.toPerm _ _) by rw [map_pow, Equiv.Perm.coe_pow]; exact (pow_iterate p n).symm theorem iterateFrobeniusEquiv_symm : (iterateFrobeniusEquiv R p n).symm = (frobeniusEquiv R p).symm ^ n := by rw [iterateFrobeniusEquiv_eq_pow]; exact (inv_pow _ _).symm @[simp] theorem frobeniusEquiv_symm_apply_frobenius (x : R) : (frobeniusEquiv R p).symm (frobenius R p x) = x := leftInverse_surjInv PerfectRing.bijective_frobenius x @[simp] theorem frobenius_apply_frobeniusEquiv_symm (x : R) : frobenius R p ((frobeniusEquiv R p).symm x) = x := surjInv_eq _ _ @[simp] theorem frobenius_comp_frobeniusEquiv_symm : (frobenius R p).comp (frobeniusEquiv R p).symm = RingHom.id R := by ext; simp @[simp] theorem frobeniusEquiv_symm_comp_frobenius : ((frobeniusEquiv R p).symm : R →+* R).comp (frobenius R p) = RingHom.id R := by ext; simp @[simp] theorem frobeniusEquiv_symm_pow_p (x : R) : ((frobeniusEquiv R p).symm x) ^ p = x := frobenius_apply_frobeniusEquiv_symm R p x theorem injective_pow_p {x y : R} (h : x ^ p = y ^ p) : x = y := (frobeniusEquiv R p).injective h #align injective_pow_p injective_pow_p lemma polynomial_expand_eq (f : R[X]) : expand R p f = (f.map (frobeniusEquiv R p).symm) ^ p := by rw [← (f.map (S := R) (frobeniusEquiv R p).symm).expand_char p, map_expand, map_map, frobenius_comp_frobeniusEquiv_symm, map_id] @[simp]
Mathlib/FieldTheory/Perfect.lean
168
171
theorem not_irreducible_expand (R p) [CommSemiring R] [Fact p.Prime] [CharP R p] [PerfectRing R p] (f : R[X]) : ¬ Irreducible (expand R p f) := by
rw [polynomial_expand_eq] exact not_irreducible_pow (Fact.out : p.Prime).ne_one
2,001