field_theory.finite.polynomial
⟷
Mathlib.FieldTheory.Finite.Polynomial
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -28,7 +28,7 @@ variable {σ : Type _}
if and only if it is zero over `zmod n`. -/
theorem C_dvd_iff_zmod (n : ℕ) (φ : MvPolynomial σ ℤ) :
C (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 :=
- C_dvd_iff_map_hom_eq_zero _ _ (CharP.int_cast_eq_zero_iff (ZMod n) n) _
+ C_dvd_iff_map_hom_eq_zero _ _ (CharP.intCast_eq_zero_iff (ZMod n) n) _
#align mv_polynomial.C_dvd_iff_zmod MvPolynomial.C_dvd_iff_zmod
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -6,7 +6,7 @@ Authors: Johan Commelin
import LinearAlgebra.FiniteDimensional
import Algebra.Module.Submodule.Ker
import RingTheory.MvPolynomial.Basic
-import Data.MvPolynomial.Expand
+import Algebra.MvPolynomial.Expand
import FieldTheory.Finite.Basic
#align_import field_theory.finite.polynomial from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-/
import LinearAlgebra.FiniteDimensional
-import LinearAlgebra.Basic
+import Algebra.Module.Submodule.Ker
import RingTheory.MvPolynomial.Basic
import Data.MvPolynomial.Expand
import FieldTheory.Finite.Basic
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -132,7 +132,7 @@ variable [Field K]
theorem eval_indicator_apply_eq_zero (a b : σ → K) (h : a ≠ b) : eval a (indicator b) = 0 :=
by
obtain ⟨i, hi⟩ : ∃ i, a i ≠ b i := by
- rwa [(· ≠ ·), Function.funext_iff, Classical.not_forall] at h
+ rwa [(· ≠ ·), Function.funext_iff, Classical.not_forall] at h
simp only [indicator, map_prod, map_sub, map_one, map_pow, eval_X, eval_C, sub_self,
Finset.prod_eq_zero_iff]
refine' ⟨i, Finset.mem_univ _, _⟩
@@ -285,7 +285,7 @@ theorem eq_zero_of_eval_eq_zero [Finite σ] (p : MvPolynomial σ K) (h : ∀ v :
(hp : p ∈ restrictDegree σ K (Fintype.card K - 1)) : p = 0 :=
let p' : R σ K := ⟨p, hp⟩
have : p' ∈ (evalᵢ σ K).ker := funext h
- show p'.1 = (0 : R σ K).1 from congr_arg _ <| by rwa [ker_evalₗ, mem_bot] at this
+ show p'.1 = (0 : R σ K).1 from congr_arg _ <| by rwa [ker_evalₗ, mem_bot] at this
#align mv_polynomial.eq_zero_of_eval_eq_zero MvPolynomial.eq_zero_of_eval_eq_zero
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -100,7 +100,7 @@ theorem degrees_indicator (c : σ → K) :
refine' le_trans (degrees_prod _ _) (Finset.sum_le_sum fun s hs => _)
refine' le_trans (degrees_sub _ _) _
rw [degrees_one, ← bot_eq_zero, bot_sup_eq]
- refine' le_trans (degrees_pow _ _) (nsmul_le_nsmul_of_le_right _ _)
+ refine' le_trans (degrees_pow _ _) (nsmul_le_nsmul_right _ _)
refine' le_trans (degrees_sub _ _) _
rw [degrees_C, ← bot_eq_zero, sup_bot_eq]
exact degrees_X' _
mathlib commit https://github.com/leanprover-community/mathlib/commit/b1abe23ae96fef89ad30d9f4362c307f72a55010
@@ -131,7 +131,8 @@ variable [Field K]
#print MvPolynomial.eval_indicator_apply_eq_zero /-
theorem eval_indicator_apply_eq_zero (a b : σ → K) (h : a ≠ b) : eval a (indicator b) = 0 :=
by
- obtain ⟨i, hi⟩ : ∃ i, a i ≠ b i := by rwa [(· ≠ ·), Function.funext_iff, not_forall] at h
+ obtain ⟨i, hi⟩ : ∃ i, a i ≠ b i := by
+ rwa [(· ≠ ·), Function.funext_iff, Classical.not_forall] at h
simp only [indicator, map_prod, map_sub, map_one, map_pow, eval_X, eval_C, sub_self,
Finset.prod_eq_zero_iff]
refine' ⟨i, Finset.mem_univ _, _⟩
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -169,7 +169,7 @@ theorem map_restrict_dom_evalₗ : (restrictDegree σ K (Fintype.card K - 1)).ma
refine' ⟨∑ n : σ → K, e n • indicator n, _, _⟩
· exact sum_mem fun c _ => smul_mem _ _ (indicator_mem_restrict_degree _)
· ext n
- simp only [LinearMap.map_sum, @Finset.sum_apply (σ → K) (fun _ => K) _ _ _ _ _, Pi.smul_apply,
+ simp only [map_sum, @Finset.sum_apply (σ → K) (fun _ => K) _ _ _ _ _, Pi.smul_apply,
LinearMap.map_smul]
simp only [evalₗ_apply]
trans
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,11 +3,11 @@ Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-/
-import Mathbin.LinearAlgebra.FiniteDimensional
-import Mathbin.LinearAlgebra.Basic
-import Mathbin.RingTheory.MvPolynomial.Basic
-import Mathbin.Data.MvPolynomial.Expand
-import Mathbin.FieldTheory.Finite.Basic
+import LinearAlgebra.FiniteDimensional
+import LinearAlgebra.Basic
+import RingTheory.MvPolynomial.Basic
+import Data.MvPolynomial.Expand
+import FieldTheory.Finite.Basic
#align_import field_theory.finite.polynomial from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-
-! This file was ported from Lean 3 source module field_theory.finite.polynomial
-! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.LinearAlgebra.FiniteDimensional
import Mathbin.LinearAlgebra.Basic
@@ -14,6 +9,8 @@ import Mathbin.RingTheory.MvPolynomial.Basic
import Mathbin.Data.MvPolynomial.Expand
import Mathbin.FieldTheory.Finite.Basic
+#align_import field_theory.finite.polynomial from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
+
/-!
## Polynomials over finite fields
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -26,17 +26,20 @@ namespace MvPolynomial
variable {σ : Type _}
+#print MvPolynomial.C_dvd_iff_zmod /-
/-- A polynomial over the integers is divisible by `n : ℕ`
if and only if it is zero over `zmod n`. -/
theorem C_dvd_iff_zmod (n : ℕ) (φ : MvPolynomial σ ℤ) :
C (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 :=
C_dvd_iff_map_hom_eq_zero _ _ (CharP.int_cast_eq_zero_iff (ZMod n) n) _
#align mv_polynomial.C_dvd_iff_zmod MvPolynomial.C_dvd_iff_zmod
+-/
section frobenius
variable {p : ℕ} [Fact p.Prime]
+#print MvPolynomial.frobenius_zmod /-
theorem frobenius_zmod (f : MvPolynomial σ (ZMod p)) : frobenius _ p f = expand p f :=
by
apply induction_on f
@@ -45,10 +48,13 @@ theorem frobenius_zmod (f : MvPolynomial σ (ZMod p)) : frobenius _ p f = expand
· simp only [expand_X, RingHom.map_mul, AlgHom.map_mul]
intro _ _ hf; rw [hf, frobenius_def]
#align mv_polynomial.frobenius_zmod MvPolynomial.frobenius_zmod
+-/
+#print MvPolynomial.expand_zmod /-
theorem expand_zmod (f : MvPolynomial σ (ZMod p)) : expand p f = f ^ p :=
(frobenius_zmod _).symm
#align mv_polynomial.expand_zmod MvPolynomial.expand_zmod
+-/
end frobenius
@@ -79,6 +85,7 @@ section CommRing
variable [CommRing K]
+#print MvPolynomial.eval_indicator_apply_eq_one /-
theorem eval_indicator_apply_eq_one (a : σ → K) : eval a (indicator a) = 1 :=
by
nontriviality
@@ -86,7 +93,9 @@ theorem eval_indicator_apply_eq_one (a : σ → K) : eval a (indicator a) = 1 :=
simp only [indicator, map_prod, map_sub, map_one, map_pow, eval_X, eval_C, sub_self,
zero_pow this, sub_zero, Finset.prod_const_one]
#align mv_polynomial.eval_indicator_apply_eq_one MvPolynomial.eval_indicator_apply_eq_one
+-/
+#print MvPolynomial.degrees_indicator /-
theorem degrees_indicator (c : σ → K) :
degrees (indicator c) ≤ ∑ s : σ, (Fintype.card K - 1) • {s} :=
by
@@ -99,6 +108,7 @@ theorem degrees_indicator (c : σ → K) :
rw [degrees_C, ← bot_eq_zero, sup_bot_eq]
exact degrees_X' _
#align mv_polynomial.degrees_indicator MvPolynomial.degrees_indicator
+-/
#print MvPolynomial.indicator_mem_restrictDegree /-
theorem indicator_mem_restrictDegree (c : σ → K) :
@@ -121,6 +131,7 @@ end CommRing
variable [Field K]
+#print MvPolynomial.eval_indicator_apply_eq_zero /-
theorem eval_indicator_apply_eq_zero (a b : σ → K) (h : a ≠ b) : eval a (indicator b) = 0 :=
by
obtain ⟨i, hi⟩ : ∃ i, a i ≠ b i := by rwa [(· ≠ ·), Function.funext_iff, not_forall] at h
@@ -130,6 +141,7 @@ theorem eval_indicator_apply_eq_zero (a b : σ → K) (h : a ≠ b) : eval a (in
rw [FiniteField.pow_card_sub_one_eq_one, sub_self]
rwa [(· ≠ ·), sub_eq_zero]
#align mv_polynomial.eval_indicator_apply_eq_zero MvPolynomial.eval_indicator_apply_eq_zero
+-/
end Indicator
@@ -152,6 +164,7 @@ end
variable [Field K] [Fintype K] [Finite σ]
+#print MvPolynomial.map_restrict_dom_evalₗ /-
theorem map_restrict_dom_evalₗ : (restrictDegree σ K (Fintype.card K - 1)).map (evalₗ K σ) = ⊤ :=
by
cases nonempty_fintype σ
@@ -168,6 +181,7 @@ theorem map_restrict_dom_evalₗ : (restrictDegree σ K (Fintype.card K - 1)).ma
· exact fun h => (h <| Finset.mem_univ n).elim
· rw [eval_indicator_apply_eq_one, smul_eq_mul, mul_one]
#align mv_polynomial.map_restrict_dom_evalₗ MvPolynomial.map_restrict_dom_evalₗ
+-/
end MvPolynomial
@@ -215,6 +229,7 @@ end CommRing
variable [Field K]
+#print MvPolynomial.rank_R /-
theorem rank_R [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :=
calc
Module.rank K (R σ K) =
@@ -234,6 +249,7 @@ theorem rank_R [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :
_ = (#σ → K) := (Equiv.arrowCongr (Equiv.refl σ) (Fintype.equivFin K).symm).cardinal_eq
_ = Fintype.card (σ → K) := Cardinal.mk_fintype _
#align mv_polynomial.rank_R MvPolynomial.rank_R
+-/
instance [Finite σ] : FiniteDimensional K (R σ K) :=
by
@@ -249,25 +265,31 @@ theorem finrank_R [Fintype σ] : FiniteDimensional.finrank K (R σ K) = Fintype.
#align mv_polynomial.finrank_R MvPolynomial.finrank_R
-/
+#print MvPolynomial.range_evalᵢ /-
theorem range_evalᵢ [Finite σ] : (evalᵢ σ K).range = ⊤ :=
by
rw [evalᵢ, LinearMap.range_comp, range_subtype]
exact map_restrict_dom_evalₗ
#align mv_polynomial.range_evalᵢ MvPolynomial.range_evalᵢ
+-/
+#print MvPolynomial.ker_evalₗ /-
theorem ker_evalₗ [Finite σ] : (evalᵢ σ K).ker = ⊥ :=
by
cases nonempty_fintype σ
refine' (ker_eq_bot_iff_range_eq_top_of_finrank_eq_finrank _).mpr (range_evalᵢ _ _)
rw [FiniteDimensional.finrank_fintype_fun_eq_card, finrank_R]
#align mv_polynomial.ker_evalₗ MvPolynomial.ker_evalₗ
+-/
+#print MvPolynomial.eq_zero_of_eval_eq_zero /-
theorem eq_zero_of_eval_eq_zero [Finite σ] (p : MvPolynomial σ K) (h : ∀ v : σ → K, eval v p = 0)
(hp : p ∈ restrictDegree σ K (Fintype.card K - 1)) : p = 0 :=
let p' : R σ K := ⟨p, hp⟩
have : p' ∈ (evalᵢ σ K).ker := funext h
show p'.1 = (0 : R σ K).1 from congr_arg _ <| by rwa [ker_evalₗ, mem_bot] at this
#align mv_polynomial.eq_zero_of_eval_eq_zero MvPolynomial.eq_zero_of_eval_eq_zero
+-/
end MvPolynomial
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -71,7 +71,7 @@ variable [Fintype K] [Fintype σ]
#print MvPolynomial.indicator /-
/-- Over a field, this is the indicator function as an `mv_polynomial`. -/
def indicator [CommRing K] (a : σ → K) : MvPolynomial σ K :=
- ∏ n, 1 - (X n - C (a n)) ^ (Fintype.card K - 1)
+ ∏ n, (1 - (X n - C (a n)) ^ (Fintype.card K - 1))
#align mv_polynomial.indicator MvPolynomial.indicator
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -233,7 +233,6 @@ theorem rank_R [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :
(Equiv.arrowCongr (Equiv.refl σ) Fin.equivSubtype.symm).cardinal_eq
_ = (#σ → K) := (Equiv.arrowCongr (Equiv.refl σ) (Fintype.equivFin K).symm).cardinal_eq
_ = Fintype.card (σ → K) := Cardinal.mk_fintype _
-
#align mv_polynomial.rank_R MvPolynomial.rank_R
instance [Finite σ] : FiniteDimensional K (R σ K) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/13361559d66b84f80b6d5a1c4a26aa5054766725
@@ -28,27 +28,27 @@ variable {σ : Type _}
/-- A polynomial over the integers is divisible by `n : ℕ`
if and only if it is zero over `zmod n`. -/
-theorem c_dvd_iff_zMod (n : ℕ) (φ : MvPolynomial σ ℤ) :
+theorem C_dvd_iff_zmod (n : ℕ) (φ : MvPolynomial σ ℤ) :
C (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 :=
C_dvd_iff_map_hom_eq_zero _ _ (CharP.int_cast_eq_zero_iff (ZMod n) n) _
-#align mv_polynomial.C_dvd_iff_zmod MvPolynomial.c_dvd_iff_zMod
+#align mv_polynomial.C_dvd_iff_zmod MvPolynomial.C_dvd_iff_zmod
section frobenius
variable {p : ℕ} [Fact p.Prime]
-theorem frobenius_zMod (f : MvPolynomial σ (ZMod p)) : frobenius _ p f = expand p f :=
+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]
-#align mv_polynomial.frobenius_zmod MvPolynomial.frobenius_zMod
+#align mv_polynomial.frobenius_zmod MvPolynomial.frobenius_zmod
-theorem expand_zMod (f : MvPolynomial σ (ZMod p)) : expand p f = f ^ p :=
- (frobenius_zMod _).symm
-#align mv_polynomial.expand_zmod MvPolynomial.expand_zMod
+theorem expand_zmod (f : MvPolynomial σ (ZMod p)) : expand p f = f ^ p :=
+ (frobenius_zmod _).symm
+#align mv_polynomial.expand_zmod MvPolynomial.expand_zmod
end frobenius
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
! This file was ported from Lean 3 source module field_theory.finite.polynomial
-! leanprover-community/mathlib commit 5aa3c1de9f3c642eac76e11071c852766f220fd0
+! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -16,6 +16,9 @@ import Mathbin.FieldTheory.Finite.Basic
/-!
## Polynomials over finite fields
+
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
-/
@@ -65,10 +68,12 @@ section Indicator
variable [Fintype K] [Fintype σ]
+#print MvPolynomial.indicator /-
/-- Over a field, this is the indicator function as an `mv_polynomial`. -/
def indicator [CommRing K] (a : σ → K) : MvPolynomial σ K :=
∏ n, 1 - (X n - C (a n)) ^ (Fintype.card K - 1)
#align mv_polynomial.indicator MvPolynomial.indicator
+-/
section CommRing
@@ -95,6 +100,7 @@ theorem degrees_indicator (c : σ → K) :
exact degrees_X' _
#align mv_polynomial.degrees_indicator MvPolynomial.degrees_indicator
+#print MvPolynomial.indicator_mem_restrictDegree /-
theorem indicator_mem_restrictDegree (c : σ → K) :
indicator c ∈ restrictDegree σ K (Fintype.card K - 1) :=
by
@@ -109,6 +115,7 @@ theorem indicator_mem_restrictDegree (c : σ → K) :
· intro h; exact (h <| Finset.mem_univ _).elim
· rw [Multiset.count_singleton_self, mul_one]
#align mv_polynomial.indicator_mem_restrict_degree MvPolynomial.indicator_mem_restrictDegree
+-/
end CommRing
@@ -130,6 +137,7 @@ section
variable (K σ)
+#print MvPolynomial.evalₗ /-
/-- `mv_polynomial.eval` as a `K`-linear map. -/
@[simps]
def evalₗ [CommSemiring K] : MvPolynomial σ K →ₗ[K] (σ → K) → K
@@ -138,6 +146,7 @@ def evalₗ [CommSemiring K] : MvPolynomial σ K →ₗ[K] (σ → K) → K
map_add' p q := by ext x; rw [RingHom.map_add]; rfl
map_smul' a p := by ext e; rw [smul_eq_C_mul, RingHom.map_mul, eval_C]; rfl
#align mv_polynomial.evalₗ MvPolynomial.evalₗ
+-/
end
@@ -172,42 +181,48 @@ universe u
variable (σ : Type u) (K : Type u) [Fintype K]
-/- ./././Mathport/Syntax/Translate/Command.lean:42:9: unsupported derive handler module[module] K -/
+/- ./././Mathport/Syntax/Translate/Command.lean:43:9: unsupported derive handler module[module] K -/
+#print MvPolynomial.R /-
/-- The submodule of multivariate polynomials whose degree of each variable is strictly less
than the cardinality of K. -/
def R [CommRing K] : Type u :=
restrictDegree σ K (Fintype.card K - 1)
deriving AddCommGroup,
- «./././Mathport/Syntax/Translate/Command.lean:42:9: unsupported derive handler module[module] K»,
+ «./././Mathport/Syntax/Translate/Command.lean:43:9: unsupported derive handler module[module] K»,
Inhabited
#align mv_polynomial.R MvPolynomial.R
+-/
+#print MvPolynomial.evalᵢ /-
/-- Evaluation in the `mv_polynomial.R` subtype. -/
def evalᵢ [CommRing K] : R σ K →ₗ[K] (σ → K) → K :=
(evalₗ K σ).comp (restrictDegree σ K (Fintype.card K - 1)).Subtype
#align mv_polynomial.evalᵢ MvPolynomial.evalᵢ
+-/
section CommRing
variable [CommRing K]
+#print MvPolynomial.decidableRestrictDegree /-
noncomputable instance decidableRestrictDegree (m : ℕ) :
- DecidablePred (· ∈ { n : σ →₀ ℕ | ∀ i, n i ≤ m }) := by
+ DecidablePred (· ∈ {n : σ →₀ ℕ | ∀ i, n i ≤ m}) := by
simp only [Set.mem_setOf_eq] <;> infer_instance
#align mv_polynomial.decidable_restrict_degree MvPolynomial.decidableRestrictDegree
+-/
end CommRing
variable [Field K]
-theorem rank_r [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :=
+theorem rank_R [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :=
calc
Module.rank K (R σ K) =
- Module.rank K (↥{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 } →₀ K) :=
+ Module.rank K (↥{s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1} →₀ K) :=
LinearEquiv.rank_eq
- (Finsupp.supportedEquivFinsupp { s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 })
- _ = (#{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 }) := by rw [rank_finsupp_self']
- _ = (#{ s : σ → ℕ | ∀ n : σ, s n < Fintype.card K }) :=
+ (Finsupp.supportedEquivFinsupp {s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1})
+ _ = (#{s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1}) := by rw [rank_finsupp_self']
+ _ = (#{s : σ → ℕ | ∀ n : σ, s n < Fintype.card K}) :=
by
refine' Quotient.sound ⟨Equiv.subtypeEquiv Finsupp.equivFunOnFinite fun f => _⟩
refine' forall_congr' fun n => le_tsub_iff_right _
@@ -219,7 +234,7 @@ theorem rank_r [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :
_ = (#σ → K) := (Equiv.arrowCongr (Equiv.refl σ) (Fintype.equivFin K).symm).cardinal_eq
_ = Fintype.card (σ → K) := Cardinal.mk_fintype _
-#align mv_polynomial.rank_R MvPolynomial.rank_r
+#align mv_polynomial.rank_R MvPolynomial.rank_R
instance [Finite σ] : FiniteDimensional K (R σ K) :=
by
@@ -229,9 +244,11 @@ instance [Finite σ] : FiniteDimensional K (R σ K) :=
(is_noetherian.iff_rank_lt_aleph_0.mpr <| by
simpa only [rank_R] using Cardinal.nat_lt_aleph0 (Fintype.card (σ → K)))
-theorem finrank_r [Fintype σ] : FiniteDimensional.finrank K (R σ K) = Fintype.card (σ → K) :=
- FiniteDimensional.finrank_eq_of_rank_eq (rank_r σ K)
-#align mv_polynomial.finrank_R MvPolynomial.finrank_r
+#print MvPolynomial.finrank_R /-
+theorem finrank_R [Fintype σ] : FiniteDimensional.finrank K (R σ K) = Fintype.card (σ → K) :=
+ FiniteDimensional.finrank_eq_of_rank_eq (rank_R σ K)
+#align mv_polynomial.finrank_R MvPolynomial.finrank_R
+-/
theorem range_evalᵢ [Finite σ] : (evalᵢ σ K).range = ⊤ :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -116,7 +116,7 @@ variable [Field K]
theorem eval_indicator_apply_eq_zero (a b : σ → K) (h : a ≠ b) : eval a (indicator b) = 0 :=
by
- obtain ⟨i, hi⟩ : ∃ i, a i ≠ b i := by rwa [(· ≠ ·), Function.funext_iff, not_forall] at h
+ obtain ⟨i, hi⟩ : ∃ i, a i ≠ b i := by rwa [(· ≠ ·), Function.funext_iff, not_forall] at h
simp only [indicator, map_prod, map_sub, map_one, map_pow, eval_X, eval_C, sub_self,
Finset.prod_eq_zero_iff]
refine' ⟨i, Finset.mem_univ _, _⟩
@@ -176,7 +176,8 @@ variable (σ : Type u) (K : Type u) [Fintype K]
/-- The submodule of multivariate polynomials whose degree of each variable is strictly less
than the cardinality of K. -/
def R [CommRing K] : Type u :=
- restrictDegree σ K (Fintype.card K - 1)deriving AddCommGroup,
+ restrictDegree σ K (Fintype.card K - 1)
+deriving AddCommGroup,
«./././Mathport/Syntax/Translate/Command.lean:42:9: unsupported derive handler module[module] K»,
Inhabited
#align mv_polynomial.R MvPolynomial.R
@@ -249,7 +250,7 @@ theorem eq_zero_of_eval_eq_zero [Finite σ] (p : MvPolynomial σ K) (h : ∀ v :
(hp : p ∈ restrictDegree σ K (Fintype.card K - 1)) : p = 0 :=
let p' : R σ K := ⟨p, hp⟩
have : p' ∈ (evalᵢ σ K).ker := funext h
- show p'.1 = (0 : R σ K).1 from congr_arg _ <| by rwa [ker_evalₗ, mem_bot] at this
+ show p'.1 = (0 : R σ K).1 from congr_arg _ <| by rwa [ker_evalₗ, mem_bot] at this
#align mv_polynomial.eq_zero_of_eval_eq_zero MvPolynomial.eq_zero_of_eval_eq_zero
end MvPolynomial
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -55,7 +55,7 @@ namespace MvPolynomial
noncomputable section
-open BigOperators Classical
+open scoped BigOperators Classical
open Set LinearMap Submodule
@@ -164,7 +164,7 @@ end MvPolynomial
namespace MvPolynomial
-open Classical Cardinal
+open scoped Classical Cardinal
open LinearMap Submodule
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -37,14 +37,10 @@ variable {p : ℕ} [Fact p.Prime]
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]
+ · 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]
+ intro _ _ hf; rw [hf, frobenius_def]
#align mv_polynomial.frobenius_zmod MvPolynomial.frobenius_zMod
theorem expand_zMod (f : MvPolynomial σ (ZMod p)) : expand p f = f ^ p :=
@@ -109,10 +105,8 @@ theorem indicator_mem_restrictDegree (c : σ → K) :
AddMonoidHom.map_nsmul, Multiset.coe_countAddMonoidHom, nsmul_eq_mul, Nat.cast_id]
trans
refine' Finset.sum_eq_single n _ _
- · intro b hb ne
- rw [Multiset.count_singleton, if_neg Ne.symm, MulZeroClass.mul_zero]
- · intro h
- exact (h <| Finset.mem_univ _).elim
+ · intro b hb ne; rw [Multiset.count_singleton, if_neg Ne.symm, MulZeroClass.mul_zero]
+ · intro h; exact (h <| Finset.mem_univ _).elim
· rw [Multiset.count_singleton_self, mul_one]
#align mv_polynomial.indicator_mem_restrict_degree MvPolynomial.indicator_mem_restrictDegree
@@ -141,14 +135,8 @@ variable (K σ)
def evalₗ [CommSemiring K] : MvPolynomial σ K →ₗ[K] (σ → K) → K
where
toFun p e := eval e p
- map_add' p q := by
- ext x
- rw [RingHom.map_add]
- rfl
- map_smul' a p := by
- ext e
- rw [smul_eq_C_mul, RingHom.map_mul, eval_C]
- rfl
+ map_add' p q := by ext x; rw [RingHom.map_add]; rfl
+ map_smul' a p := by ext e; rw [smul_eq_C_mul, RingHom.map_mul, eval_C]; rfl
#align mv_polynomial.evalₗ MvPolynomial.evalₗ
end
mathlib commit https://github.com/leanprover-community/mathlib/commit/5ec62c8106221a3f9160e4e4fcc3eed79fe213e9
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
! This file was ported from Lean 3 source module field_theory.finite.polynomial
-! leanprover-community/mathlib commit 039a089d2a4b93c761b234f3e5f5aeb752bac60f
+! leanprover-community/mathlib commit 5aa3c1de9f3c642eac76e11071c852766f220fd0
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -217,8 +217,7 @@ theorem rank_r [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :
Module.rank K (↥{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 } →₀ K) :=
LinearEquiv.rank_eq
(Finsupp.supportedEquivFinsupp { s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 })
- _ = (#{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 }) := by
- rw [Finsupp.rank_eq, rank_self, mul_one]
+ _ = (#{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 }) := by rw [rank_finsupp_self']
_ = (#{ s : σ → ℕ | ∀ n : σ, s n < Fintype.card K }) :=
by
refine' Quotient.sound ⟨Equiv.subtypeEquiv Finsupp.equivFunOnFinite fun f => _⟩
mathlib commit https://github.com/leanprover-community/mathlib/commit/06a655b5fcfbda03502f9158bbf6c0f1400886f9
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
! This file was ported from Lean 3 source module field_theory.finite.polynomial
-! leanprover-community/mathlib commit 5fd3186f1ec30a75d5f65732e3ce5e623382556f
+! leanprover-community/mathlib commit 039a089d2a4b93c761b234f3e5f5aeb752bac60f
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -211,14 +211,14 @@ end CommRing
variable [Field K]
-theorem dim_r [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :=
+theorem rank_r [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :=
calc
Module.rank K (R σ K) =
Module.rank K (↥{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 } →₀ K) :=
- LinearEquiv.dim_eq
+ LinearEquiv.rank_eq
(Finsupp.supportedEquivFinsupp { s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 })
_ = (#{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 }) := by
- rw [Finsupp.dim_eq, dim_self, mul_one]
+ rw [Finsupp.rank_eq, rank_self, mul_one]
_ = (#{ s : σ → ℕ | ∀ n : σ, s n < Fintype.card K }) :=
by
refine' Quotient.sound ⟨Equiv.subtypeEquiv Finsupp.equivFunOnFinite fun f => _⟩
@@ -231,18 +231,18 @@ theorem dim_r [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :=
_ = (#σ → K) := (Equiv.arrowCongr (Equiv.refl σ) (Fintype.equivFin K).symm).cardinal_eq
_ = Fintype.card (σ → K) := Cardinal.mk_fintype _
-#align mv_polynomial.dim_R MvPolynomial.dim_r
+#align mv_polynomial.rank_R MvPolynomial.rank_r
instance [Finite σ] : FiniteDimensional K (R σ K) :=
by
cases nonempty_fintype σ
exact
IsNoetherian.iff_fg.1
- (is_noetherian.iff_dim_lt_aleph_0.mpr <| by
- simpa only [dim_R] using Cardinal.nat_lt_aleph0 (Fintype.card (σ → K)))
+ (is_noetherian.iff_rank_lt_aleph_0.mpr <| by
+ simpa only [rank_R] using Cardinal.nat_lt_aleph0 (Fintype.card (σ → K)))
theorem finrank_r [Fintype σ] : FiniteDimensional.finrank K (R σ K) = Fintype.card (σ → K) :=
- FiniteDimensional.finrank_eq_of_dim_eq (dim_r σ K)
+ FiniteDimensional.finrank_eq_of_rank_eq (rank_r σ K)
#align mv_polynomial.finrank_R MvPolynomial.finrank_r
theorem range_evalᵢ [Finite σ] : (evalᵢ σ K).range = ⊤ :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/1a313d8bba1bad05faba71a4a4e9742ab5bd9efd
@@ -26,8 +26,8 @@ variable {σ : Type _}
/-- A polynomial over the integers is divisible by `n : ℕ`
if and only if it is zero over `zmod n`. -/
theorem c_dvd_iff_zMod (n : ℕ) (φ : MvPolynomial σ ℤ) :
- c (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 :=
- c_dvd_iff_map_hom_eq_zero _ _ (CharP.int_cast_eq_zero_iff (ZMod n) n) _
+ C (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 :=
+ C_dvd_iff_map_hom_eq_zero _ _ (CharP.int_cast_eq_zero_iff (ZMod n) n) _
#align mv_polynomial.C_dvd_iff_zmod MvPolynomial.c_dvd_iff_zMod
section frobenius
@@ -71,7 +71,7 @@ variable [Fintype K] [Fintype σ]
/-- Over a field, this is the indicator function as an `mv_polynomial`. -/
def indicator [CommRing K] (a : σ → K) : MvPolynomial σ K :=
- ∏ n, 1 - (x n - c (a n)) ^ (Fintype.card K - 1)
+ ∏ n, 1 - (X n - C (a n)) ^ (Fintype.card K - 1)
#align mv_polynomial.indicator MvPolynomial.indicator
section CommRing
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -110,7 +110,7 @@ theorem indicator_mem_restrictDegree (c : σ → K) :
trans
refine' Finset.sum_eq_single n _ _
· intro b hb ne
- rw [Multiset.count_singleton, if_neg Ne.symm, mul_zero]
+ rw [Multiset.count_singleton, if_neg Ne.symm, MulZeroClass.mul_zero]
· intro h
exact (h <| Finset.mem_univ _).elim
· rw [Multiset.count_singleton_self, mul_one]
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
nat_cast
/int_cast
/rat_cast
to natCast
/intCast
/ratCast
(#11486)
Now that I am defining NNRat.cast
, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast
/intCast
/ratCast
over nat_cast
/int_cast
/rat_cast
, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.
@@ -22,7 +22,7 @@ variable {σ : Type*}
if and only if it is zero over `ZMod n`. -/
theorem C_dvd_iff_zmod (n : ℕ) (φ : MvPolynomial σ ℤ) :
C (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 :=
- C_dvd_iff_map_hom_eq_zero _ _ (CharP.int_cast_eq_zero_iff (ZMod n) n) _
+ 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
A mix of various changes; generated with a script and manually tweaked.
@@ -133,7 +133,7 @@ def evalₗ [CommSemiring K] : MvPolynomial σ K →ₗ[K] (σ → K) → K wher
variable [Field K] [Fintype K] [Finite σ]
-- Porting note: `K` and `σ` were implicit in mathlib3, even if they were declared via
--- `variables (K σ)` (I don't understand why). They are now explicit, as expected.
+-- `variable (K σ)` (I don't understand why). They are now explicit, as expected.
theorem map_restrict_dom_evalₗ : (restrictDegree σ K (Fintype.card K - 1)).map (evalₗ K σ) = ⊤ := by
cases nonempty_fintype σ
refine' top_unique (SetLike.le_def.2 fun e _ => mem_map.2 _)
Data
(#11751)
Polynomial
and MvPolynomial
are algebraic objects, hence should be under Algebra
(or at least not under Data
)
@@ -3,7 +3,7 @@ Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-/
-import Mathlib.Data.MvPolynomial.Expand
+import Mathlib.Algebra.MvPolynomial.Expand
import Mathlib.FieldTheory.Finite.Basic
import Mathlib.RingTheory.MvPolynomial.Basic
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -166,7 +166,7 @@ universe u
variable (σ : Type u) (K : Type u) [Fintype K]
---Porting note: `@[derive [add_comm_group, module K, inhabited]]` done by hand.
+-- Porting note: `@[derive [add_comm_group, module K, inhabited]]` done by hand.
/-- The submodule of multivariate polynomials whose degree of each variable is strictly less
than the cardinality of K. -/
def R [CommRing K] : Type u :=
@@ -239,7 +239,7 @@ theorem range_evalᵢ [Finite σ] : range (evalᵢ σ K) = ⊤ := by
exact map_restrict_dom_evalₗ K σ
#align mv_polynomial.range_evalᵢ MvPolynomial.range_evalᵢ
---Porting note: was `(evalᵢ σ K).ker`.
+-- Porting note: was `(evalᵢ σ K).ker`.
theorem ker_evalₗ [Finite σ] : ker (evalᵢ σ K) = ⊥ := by
cases nonempty_fintype σ
refine' (ker_eq_bot_iff_range_eq_top_of_finrank_eq_finrank _).mpr (range_evalᵢ σ K)
f ^ n
(#9617)
This involves moving lemmas from Algebra.GroupPower.Ring
to Algebra.GroupWithZero.Basic
and changing some 0 < n
assumptions to n ≠ 0
.
From LeanAPAP
@@ -73,7 +73,7 @@ theorem eval_indicator_apply_eq_one (a : σ → K) : eval a (indicator a) = 1 :=
nontriviality
have : 0 < Fintype.card K - 1 := tsub_pos_of_lt Fintype.one_lt_card
simp only [indicator, map_prod, map_sub, map_one, map_pow, eval_X, eval_C, sub_self,
- zero_pow this, sub_zero, Finset.prod_const_one]
+ zero_pow this.ne', sub_zero, Finset.prod_const_one]
#align mv_polynomial.eval_indicator_apply_eq_one MvPolynomial.eval_indicator_apply_eq_one
theorem degrees_indicator (c : σ → K) :
The names for lemmas about monotonicity of (a ^ ·)
and (· ^ n)
were a mess. This PR tidies up everything related by following the naming convention for (a * ·)
and (· * b)
. Namely, (a ^ ·)
is pow_right
and (· ^ n)
is pow_left
in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.
Algebra.GroupPower.Order
pow_mono
→ pow_right_mono
pow_le_pow
→ pow_le_pow_right
pow_le_pow_of_le_left
→ pow_le_pow_left
pow_lt_pow_of_lt_left
→ pow_lt_pow_left
strictMonoOn_pow
→ pow_left_strictMonoOn
pow_strictMono_right
→ pow_right_strictMono
pow_lt_pow
→ pow_lt_pow_right
pow_lt_pow_iff
→ pow_lt_pow_iff_right
pow_le_pow_iff
→ pow_le_pow_iff_right
self_lt_pow
→ lt_self_pow
strictAnti_pow
→ pow_right_strictAnti
pow_lt_pow_iff_of_lt_one
→ pow_lt_pow_iff_right_of_lt_one
pow_lt_pow_of_lt_one
→ pow_lt_pow_right_of_lt_one
lt_of_pow_lt_pow
→ lt_of_pow_lt_pow_left
le_of_pow_le_pow
→ le_of_pow_le_pow_left
pow_lt_pow₀
→ pow_lt_pow_right₀
Algebra.GroupPower.CovariantClass
pow_le_pow_of_le_left'
→ pow_le_pow_left'
nsmul_le_nsmul_of_le_right
→ nsmul_le_nsmul_right
pow_lt_pow'
→ pow_lt_pow_right'
nsmul_lt_nsmul
→ nsmul_lt_nsmul_left
pow_strictMono_left
→ pow_right_strictMono'
nsmul_strictMono_right
→ nsmul_left_strictMono
StrictMono.pow_right'
→ StrictMono.pow_const
StrictMono.nsmul_left
→ StrictMono.const_nsmul
pow_strictMono_right'
→ pow_left_strictMono
nsmul_strictMono_left
→ nsmul_right_strictMono
Monotone.pow_right
→ Monotone.pow_const
Monotone.nsmul_left
→ Monotone.const_nsmul
lt_of_pow_lt_pow'
→ lt_of_pow_lt_pow_left'
lt_of_nsmul_lt_nsmul
→ lt_of_nsmul_lt_nsmul_right
pow_le_pow'
→ pow_le_pow_right'
nsmul_le_nsmul
→ nsmul_le_nsmul_left
pow_le_pow_of_le_one'
→ pow_le_pow_right_of_le_one'
nsmul_le_nsmul_of_nonpos
→ nsmul_le_nsmul_left_of_nonpos
le_of_pow_le_pow'
→ le_of_pow_le_pow_left'
le_of_nsmul_le_nsmul'
→ le_of_nsmul_le_nsmul_right'
pow_le_pow_iff'
→ pow_le_pow_iff_right'
nsmul_le_nsmul_iff
→ nsmul_le_nsmul_iff_left
pow_lt_pow_iff'
→ pow_lt_pow_iff_right'
nsmul_lt_nsmul_iff
→ nsmul_lt_nsmul_iff_left
Data.Nat.Pow
Nat.pow_lt_pow_of_lt_left
→ Nat.pow_lt_pow_left
Nat.pow_le_iff_le_left
→ Nat.pow_le_pow_iff_left
Nat.pow_lt_iff_lt_left
→ Nat.pow_lt_pow_iff_left
pow_le_pow_iff_left
pow_lt_pow_iff_left
pow_right_injective
pow_right_inj
Nat.pow_le_pow_left
to have the correct name since Nat.pow_le_pow_of_le_left
is in Std.Nat.pow_le_pow_right
to have the correct name since Nat.pow_le_pow_of_le_right
is in Std.self_le_pow
was a duplicate of le_self_pow
.Nat.pow_lt_pow_of_lt_right
is defeq to pow_lt_pow_right
.Nat.pow_right_strictMono
is defeq to pow_right_strictMono
.Nat.pow_le_iff_le_right
is defeq to pow_le_pow_iff_right
.Nat.pow_lt_iff_lt_right
is defeq to pow_lt_pow_iff_right
.0 < n
or 1 ≤ n
to n ≠ 0
.Nat
lemmas have been protected
.@@ -82,7 +82,7 @@ theorem degrees_indicator (c : σ → K) :
refine' le_trans (degrees_prod _ _) (Finset.sum_le_sum fun s _ => _)
refine' le_trans (degrees_sub _ _) _
rw [degrees_one, ← bot_eq_zero, bot_sup_eq]
- refine' le_trans (degrees_pow _ _) (nsmul_le_nsmul_of_le_right _ _)
+ refine' le_trans (degrees_pow _ _) (nsmul_le_nsmul_right _ _)
refine' le_trans (degrees_sub _ _) _
rw [degrees_C, ← bot_eq_zero, sup_bot_eq]
exact degrees_X' _
@@ -93,7 +93,7 @@ theorem indicator_mem_restrictDegree (c : σ → K) :
rw [mem_restrictDegree_iff_sup, indicator]
intro n
refine' le_trans (Multiset.count_le_of_le _ <| degrees_indicator _) (le_of_eq _)
- simp_rw [← Multiset.coe_countAddMonoidHom, (Multiset.countAddMonoidHom n).map_sum,
+ simp_rw [← Multiset.coe_countAddMonoidHom, map_sum,
AddMonoidHom.map_nsmul, Multiset.coe_countAddMonoidHom, nsmul_eq_mul, Nat.cast_id]
trans
refine' Finset.sum_eq_single n _ _
This reduces the file from ~2600 lines to ~1600 lines.
Co-authored-by: Vierkantor <vierkantor@vierkantor.com> Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>
@@ -3,11 +3,9 @@ Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-/
-import Mathlib.LinearAlgebra.FiniteDimensional
-import Mathlib.LinearAlgebra.Basic
-import Mathlib.RingTheory.MvPolynomial.Basic
import Mathlib.Data.MvPolynomial.Expand
import Mathlib.FieldTheory.Finite.Basic
+import Mathlib.RingTheory.MvPolynomial.Basic
#align_import field_theory.finite.polynomial from "leanprover-community/mathlib"@"5aa3c1de9f3c642eac76e11071c852766f220fd0"
@@ -146,9 +146,9 @@ theorem map_restrict_dom_evalₗ : (restrictDegree σ K (Fintype.card K - 1)).ma
map_smul]
simp only [evalₗ_apply]
trans
- refine' Finset.sum_eq_single n (fun b _ h => _) _
- · rw [eval_indicator_apply_eq_zero _ _ h.symm, smul_zero]
- · exact fun h => (h <| Finset.mem_univ n).elim
+ · refine' Finset.sum_eq_single n (fun b _ h => _) _
+ · rw [eval_indicator_apply_eq_zero _ _ h.symm, smul_zero]
+ · exact fun h => (h <| Finset.mem_univ n).elim
· rw [eval_indicator_apply_eq_one, smul_eq_mul, mul_one]
#align mv_polynomial.map_restrict_dom_evalₗ MvPolynomial.map_restrict_dom_evalₗ
_root_.map_sum
more consistently (#7189)
Also _root_.map_smul
when in the neighbourhood.
@@ -142,8 +142,8 @@ theorem map_restrict_dom_evalₗ : (restrictDegree σ K (Fintype.card K - 1)).ma
refine' ⟨∑ n : σ → K, e n • indicator n, _, _⟩
· exact sum_mem fun c _ => smul_mem _ _ (indicator_mem_restrictDegree _)
· ext n
- simp only [LinearMap.map_sum, @Finset.sum_apply (σ → K) (fun _ => K) _ _ _ _ _, Pi.smul_apply,
- LinearMap.map_smul]
+ simp only [_root_.map_sum, @Finset.sum_apply (σ → K) (fun _ => K) _ _ _ _ _, Pi.smul_apply,
+ map_smul]
simp only [evalₗ_apply]
trans
refine' Finset.sum_eq_single n (fun b _ h => _) _
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -18,7 +18,7 @@ import Mathlib.FieldTheory.Finite.Basic
namespace MvPolynomial
-variable {σ : Type _}
+variable {σ : Type*}
/-- A polynomial over the integers is divisible by `n : ℕ`
if and only if it is zero over `ZMod n`. -/
@@ -56,7 +56,7 @@ open scoped BigOperators Classical
open Set LinearMap Submodule
-variable {K : Type _} {σ : Type _}
+variable {K : Type*} {σ : Type*}
section Indicator
@@ -2,11 +2,6 @@
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-
-! This file was ported from Lean 3 source module field_theory.finite.polynomial
-! leanprover-community/mathlib commit 5aa3c1de9f3c642eac76e11071c852766f220fd0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.Basic
@@ -14,6 +9,8 @@ import Mathlib.RingTheory.MvPolynomial.Basic
import Mathlib.Data.MvPolynomial.Expand
import Mathlib.FieldTheory.Finite.Basic
+#align_import field_theory.finite.polynomial from "leanprover-community/mathlib"@"5aa3c1de9f3c642eac76e11071c852766f220fd0"
+
/-!
## Polynomials over finite fields
-/
@@ -212,16 +212,16 @@ theorem rank_R [Fintype σ] : Module.rank K (R σ K) = Fintype.card (σ → K) :
Module.rank K (↥{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 } →₀ K) :=
LinearEquiv.rank_eq
(Finsupp.supportedEquivFinsupp { s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 })
- _ = (#{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 }) := by rw [rank_finsupp_self']
- _ = (#{ s : σ → ℕ | ∀ n : σ, s n < Fintype.card K }) := by
+ _ = #{ s : σ →₀ ℕ | ∀ n : σ, s n ≤ Fintype.card K - 1 } := by rw [rank_finsupp_self']
+ _ = #{ s : σ → ℕ | ∀ n : σ, s n < Fintype.card K } := by
refine' Quotient.sound ⟨Equiv.subtypeEquiv Finsupp.equivFunOnFinite fun f => _⟩
refine' forall_congr' fun n => le_tsub_iff_right _
exact Fintype.card_pos_iff.2 ⟨0⟩
- _ = (#σ → { n // n < Fintype.card K }) :=
+ _ = #(σ → { n // n < Fintype.card K }) :=
(@Equiv.subtypePiEquivPi σ (fun _ => ℕ) fun s n => n < Fintype.card K).cardinal_eq
- _ = (#σ → Fin (Fintype.card K)) :=
+ _ = #(σ → Fin (Fintype.card K)) :=
(Equiv.arrowCongr (Equiv.refl σ) Fin.equivSubtype.symm).cardinal_eq
- _ = (#σ → K) := (Equiv.arrowCongr (Equiv.refl σ) (Fintype.equivFin K).symm).cardinal_eq
+ _ = #(σ → K) := (Equiv.arrowCongr (Equiv.refl σ) (Fintype.equivFin K).symm).cardinal_eq
_ = Fintype.card (σ → K) := Cardinal.mk_fintype _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.rank_R MvPolynomial.rank_R
@@ -25,27 +25,27 @@ variable {σ : Type _}
/-- A polynomial over the integers is divisible by `n : ℕ`
if and only if it is zero over `ZMod n`. -/
-theorem c_dvd_iff_zMod (n : ℕ) (φ : MvPolynomial σ ℤ) :
+theorem C_dvd_iff_zmod (n : ℕ) (φ : MvPolynomial σ ℤ) :
C (n : ℤ) ∣ φ ↔ map (Int.castRingHom (ZMod n)) φ = 0 :=
C_dvd_iff_map_hom_eq_zero _ _ (CharP.int_cast_eq_zero_iff (ZMod n) n) _
set_option linter.uppercaseLean3 false in
-#align mv_polynomial.C_dvd_iff_zmod MvPolynomial.c_dvd_iff_zMod
+#align mv_polynomial.C_dvd_iff_zmod MvPolynomial.C_dvd_iff_zmod
section frobenius
variable {p : ℕ} [Fact p.Prime]
-theorem frobenius_zMod (f : MvPolynomial σ (ZMod p)) : frobenius _ p f = expand p f := by
+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]
-#align mv_polynomial.frobenius_zmod MvPolynomial.frobenius_zMod
+#align mv_polynomial.frobenius_zmod MvPolynomial.frobenius_zmod
-theorem expand_zMod (f : MvPolynomial σ (ZMod p)) : expand p f = f ^ p :=
- (frobenius_zMod _).symm
-#align mv_polynomial.expand_zmod MvPolynomial.expand_zMod
+theorem expand_zmod (f : MvPolynomial σ (ZMod p)) : expand p f = f ^ p :=
+ (frobenius_zmod _).symm
+#align mv_polynomial.expand_zmod MvPolynomial.expand_zmod
end frobenius
The unported dependencies are