-
Notifications
You must be signed in to change notification settings - Fork 298
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] - chore(algebra/char_p): refactor char_p #5132
Closed
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import algebra.char_p.basic | ||
import algebra.char_p.pi | ||
import algebra.char_p.quotient | ||
import algebra.char_p.subring |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/- | ||
Copyright (c) 2020 Kenny Lau. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Kenny Lau | ||
-/ | ||
|
||
import algebra.char_p.basic | ||
import algebra.ring.pi | ||
|
||
/-! | ||
# Characteristic of semirings of functions | ||
-/ | ||
|
||
universes u v | ||
|
||
namespace char_p | ||
|
||
instance pi (ι : Type u) [hi : nonempty ι] (R : Type v) [semiring R] (p : ℕ) [char_p R p] : | ||
char_p (ι → R) p := | ||
⟨λ x, let ⟨i⟩ := hi in iff.symm $ (char_p.cast_eq_zero_iff R p x).symm.trans | ||
⟨λ h, funext $ λ j, show ring_hom.apply (λ _, R) j (↑x : ι → R) = 0, | ||
by rw [ring_hom.map_nat_cast, h], | ||
λ h, (ring_hom.apply (λ _, R) i).map_nat_cast x ▸ by rw [h, ring_hom.map_zero]⟩⟩ | ||
|
||
-- diamonds | ||
instance pi' (ι : Type u) [hi : nonempty ι] (R : Type v) [comm_ring R] (p : ℕ) [char_p R p] : | ||
char_p (ι → R) p := | ||
char_p.pi ι R p | ||
|
||
end char_p |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/- | ||
Copyright (c) 2020 Kenny Lau. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Kenny Lau | ||
-/ | ||
|
||
import algebra.char_p.basic | ||
import algebra.ring_quot | ||
|
||
/-! | ||
# Characteristic of quotients rings | ||
-/ | ||
|
||
universes u v | ||
|
||
namespace char_p | ||
|
||
theorem quotient (R : Type u) [comm_ring R] (p : ℕ) [hp1 : fact p.prime] (hp2 : ↑p ∈ nonunits R) : | ||
char_p (ideal.span {p} : ideal R).quotient p := | ||
have hp0 : (p : (ideal.span {p} : ideal R).quotient) = 0, | ||
from (ideal.quotient.mk (ideal.span {p} : ideal R)).map_nat_cast p ▸ | ||
ideal.quotient.eq_zero_iff_mem.2 (ideal.subset_span $ set.mem_singleton _), | ||
ring_char.of_eq $ or.resolve_left ((nat.dvd_prime hp1).1 $ ring_char.dvd hp0) $ λ h1, | ||
hp2 $ is_unit_iff_dvd_one.2 $ ideal.mem_span_singleton.1 $ ideal.quotient.eq_zero_iff_mem.1 $ | ||
@@subsingleton.elim (@@char_p.subsingleton _ $ ring_char.of_eq h1) _ _ | ||
|
||
end char_p |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/- | ||
Copyright (c) 2020 Kenny Lau. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Kenny Lau | ||
-/ | ||
|
||
import algebra.char_p.basic | ||
import ring_theory.subring | ||
|
||
/-! | ||
# Characteristic of subrings | ||
-/ | ||
|
||
universes u v | ||
|
||
namespace char_p | ||
|
||
instance subsemiring (R : Type u) [semiring R] (p : ℕ) [char_p R p] (S : subsemiring R) : | ||
char_p S p := | ||
⟨λ x, iff.symm $ (char_p.cast_eq_zero_iff R p x).symm.trans | ||
⟨λ h, subtype.eq $ show S.subtype x = 0, by rw [ring_hom.map_nat_cast, h], | ||
λ h, S.subtype.map_nat_cast x ▸ by rw [h, ring_hom.map_zero]⟩⟩ | ||
|
||
instance subring (R : Type u) [ring R] (p : ℕ) [char_p R p] (S : subring R) : | ||
char_p S p := | ||
⟨λ x, iff.symm $ (char_p.cast_eq_zero_iff R p x).symm.trans | ||
⟨λ h, subtype.eq $ show S.subtype x = 0, by rw [ring_hom.map_nat_cast, h], | ||
λ h, S.subtype.map_nat_cast x ▸ by rw [h, ring_hom.map_zero]⟩⟩ | ||
|
||
instance subring' (R : Type u) [comm_ring R] (p : ℕ) [char_p R p] (S : subring R) : | ||
char_p S p := | ||
char_p.subring R p S | ||
|
||
end char_p |
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
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
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
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.
Would it make sense to generalise
ring_char R
toq
(given the instance above this statement)?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.
I don't understand. What is the alternative statement?
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.
Maybe it should be called
char_p.congr
: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.
But then why can't I just rewrite?
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.
Why can't you rewrite instead of the current statement?
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.
Done