-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - feat: units of polynomial rings #4691
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7b23a56
add Commute.IsNilpotent.add_isUnit
EmilieUthaiwat d554f70
add IsNilpotent.C_mul_X_pow_isNilpotent
EmilieUthaiwat f810f24
add IsUnit.isUnit_of_isNilpotent
EmilieUthaiwat 5a11d98
change comment
EmilieUthaiwat f575a6c
add IsUnit.coeff_isUnit_isNilpotent
EmilieUthaiwat fe70406
add Polynomial.isUnit_iff_coeff_isUnit_isNilpotent
EmilieUthaiwat 2e490b8
added comment
EmilieUthaiwat dddcbdb
Update Mathlib/RingTheory/Polynomial/Quotient.lean
EmilieUthaiwat f1d02e8
changed a name
EmilieUthaiwat eddac65
fix
EmilieUthaiwat b5c1cbd
moved some results
EmilieUthaiwat 68a3c4e
removed the results
EmilieUthaiwat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import Mathlib.Data.MvPolynomial.CommRing | |
import Mathlib.Data.MvPolynomial.Equiv | ||
import Mathlib.RingTheory.Polynomial.Content | ||
import Mathlib.RingTheory.UniqueFactorizationDomain | ||
import Mathlib.RingTheory.Ideal.QuotientOperations | ||
|
||
/-! | ||
# Ring-theoretic supplement of Data.Polynomial. | ||
|
@@ -256,6 +257,13 @@ theorem monic_geom_sum_X {n : ℕ} (hn : n ≠ 0) : (∑ i in range n, (X : R[X] | |
set_option linter.uppercaseLean3 false in | ||
#align polynomial.monic_geom_sum_X Polynomial.monic_geom_sum_X | ||
|
||
theorem IsNilpotent.C_mul_X_pow_isNilpotent {r : R} (n : ℕ) (hnil : IsNilpotent r) : | ||
IsNilpotent ((C r) * X ^ n) := by | ||
refine' Commute.isNilpotent_mul_left (commute_X_pow _ _).symm _ | ||
obtain ⟨m, hm⟩ := hnil | ||
refine' ⟨m, _⟩ | ||
rw [← C_pow, hm, C_0] | ||
|
||
end Semiring | ||
|
||
section Ring | ||
|
@@ -460,6 +468,58 @@ theorem ker_modByMonicHom (hq : q.Monic) : | |
|
||
end ModByMonic | ||
|
||
/-- Let `P` be a polynomial over `R`. If its constant term is a unit and its other coefficients are | ||
nilpotent, then `P` is a unit. -/ | ||
theorem isUnit_of_coeff_isUnit_isNilpotent {P : Polynomial R} (hunit : IsUnit (P.coeff 0)) | ||
(hnil : ∀ i, i ≠ 0 → IsNilpotent (P.coeff i)) : IsUnit P := by | ||
induction' h : P.natDegree using Nat.strong_induction_on with k hind generalizing P | ||
by_cases hdeg : P.natDegree = 0 | ||
{ rw [eq_C_of_natDegree_eq_zero hdeg] | ||
exact hunit.map C } | ||
set P₁ := P.eraseLead with hP₁ | ||
suffices IsUnit P₁ by | ||
rw [← eraseLead_add_monomial_natDegree_leadingCoeff P, ← C_mul_X_pow_eq_monomial] | ||
obtain ⟨Q, hQ⟩ := this | ||
rw [← hP₁, ← hQ] | ||
refine' Commute.IsNilpotent.add_isUnit (IsNilpotent.C_mul_X_pow_isNilpotent _ (hnil _ hdeg)) | ||
((Commute.all _ _).mul_left (Commute.all _ _)) | ||
have hdeg₂ := lt_of_le_of_lt P.eraseLead_natDegree_le (Nat.sub_lt | ||
(Nat.pos_of_ne_zero hdeg) zero_lt_one) | ||
refine' hind P₁.natDegree _ _ (fun i hi => _) rfl | ||
· simp_rw [← h, hdeg₂] | ||
· simp_rw [eraseLead_coeff_of_ne _ (Ne.symm hdeg), hunit] | ||
· by_cases H : i ≤ P₁.natDegree | ||
simp_rw [eraseLead_coeff_of_ne _ (ne_of_lt (lt_of_le_of_lt H hdeg₂)), hnil i hi] | ||
simp_rw [coeff_eq_zero_of_natDegree_lt (lt_of_not_ge H), IsNilpotent.zero] | ||
|
||
/-- Let `P` be a polynomial over `R`. If `P` is a unit, then all its coefficients are nilpotent, | ||
except its constant term which is a unit. -/ | ||
theorem coeff_isUnit_isNilpotent_of_isUnit {P : Polynomial R} (hunit : IsUnit P) : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case the previous name was fine. I don't really have a preference, so keep the one you prefer. |
||
IsUnit (P.coeff 0) ∧ (∀ i, i ≠ 0 → IsNilpotent (P.coeff i)) := by | ||
obtain ⟨Q, hQ⟩ := IsUnit.exists_right_inv hunit | ||
constructor | ||
. refine' isUnit_of_mul_eq_one _ (Q.coeff 0) _ | ||
have h := (mul_coeff_zero P Q).symm | ||
rwa [hQ, coeff_one_zero] at h | ||
. intros n hn | ||
rw [nilpotent_iff_mem_prime] | ||
intros I hI | ||
let f := mapRingHom (Ideal.Quotient.mk I) | ||
have hPQ : degree (f P) = 0 ∧ degree (f Q) = 0 := by | ||
rw [← Nat.WithBot.add_eq_zero_iff, ← degree_mul, ← _root_.map_mul, hQ, map_one, degree_one] | ||
have hcoeff : (f P).coeff n = 0 := by | ||
refine' coeff_eq_zero_of_degree_lt _ | ||
rw [hPQ.1] | ||
exact (@WithBot.coe_pos _ _ _ n).2 (Ne.bot_lt hn) | ||
rw [coe_mapRingHom, coeff_map, ← RingHom.mem_ker, Ideal.mk_ker] at hcoeff | ||
exact hcoeff | ||
|
||
/-- Let `P` be a polynomial over `R`. `P` is a unit if and only if all its coefficients are | ||
nilpotent, except its constant term which is a unit. -/ | ||
theorem isUnit_iff_coeff_isUnit_isNilpotent (P : Polynomial R) : | ||
IsUnit P ↔ IsUnit (P.coeff 0) ∧ (∀ i, i ≠ 0 → IsNilpotent (P.coeff i)) := | ||
⟨coeff_isUnit_isNilpotent_of_isUnit, fun H => isUnit_of_coeff_isUnit_isNilpotent H.1 H.2⟩ | ||
|
||
end CommRing | ||
|
||
end Polynomial | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much extra does this pull in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mathlib.Algebra.GeomSum imports the following files:
import Mathlib.Algebra.BigOperators.Order
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Tactic.Abel
import Mathlib.Data.Nat.Parity
Mathlib.RingTheory.Nilpotent already pulls in every file mentioned above, except Mathlib.Data.Nat.Parity, so the only new file imported by Mathlib.Algebra.GeomSum is Mathlib.Data.Nat.Parity.