-
Notifications
You must be signed in to change notification settings - Fork 297
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(algebra/char_p/mixed_char_zero): define mixed/equal characteristic zero #14672
Conversation
f5cc61e
to
a6765cb
Compare
src/algebra/char_p/algebra.lean
Outdated
lemma Q_algebra_char_p_zero [semiring R] [algebra ℚ R] : char_p R 0 := | ||
char_p_of_injective_algebra_map (algebra_map ℚ R).injective 0 | ||
|
||
lemma Q_algebra_char_zero [ring R] [algebra ℚ R] : char_zero R := | ||
@char_p.char_p_to_char_zero R _ (Q_algebra_char_p_zero R) |
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 must say that I can't really think of a case where we already have an instance algebra ℚ R
on our hands but no char_zero
. Do you have a specific use case in mind? (I was thinking along the lines of polynomial ℚ
, but we already directly show that polynomial
has the same characteristic without going through algebra
.)
Otherwise these definitions are definitely not suitable as (local) instances as you remark above, so let's add a docstring to warn the users. (I believe using it as haveI : char_zero R := Q_algebra_char_zero R
is safe, since char_zero
lives in Prop
there won't be any defeq issues.)
Another remark is that we assume semiring R
in the first lemma but algebra ℚ R
means that R
contains -1
so it is at least a ring. This is probably fine, but a little surprising.
A final little thing is that I don't really like the names. How about these?
lemma Q_algebra_char_p_zero [semiring R] [algebra ℚ R] : char_p R 0 := | |
char_p_of_injective_algebra_map (algebra_map ℚ R).injective 0 | |
lemma Q_algebra_char_zero [ring R] [algebra ℚ R] : char_zero R := | |
@char_p.char_p_to_char_zero R _ (Q_algebra_char_p_zero R) | |
/-- A nontrivial `ℚ`-algebra has `char_p` equal to zero. | |
This cannot be a (local) instance because it would immediately form a loop with the instance `algebra_rat`. | |
It's probably easier to go the other way: prove `char_zero R` and automatically receive an `algebra ℚ R` instance. | |
-/ | |
lemma algebra_rat.char_p_zero [semiring R] [algebra ℚ R] : char_p R 0 := | |
char_p_of_injective_algebra_map (algebra_map ℚ R).injective 0 | |
/-- A nontrivial `ℚ`-algebra has characteristic zero. | |
This cannot be a (local) instance because it would immediately form a loop with the instance `algebra_rat`. | |
It's probably easier to go the other way: prove `char_zero R` and automatically receive an `algebra ℚ R` instance. | |
-/ | |
lemma algebra_rat.char_zero [ring R] [algebra ℚ R] : char_zero R := | |
@char_p.char_p_to_char_zero R _ (Q_algebra_char_p_zero R) |
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.
Update: I see, something like this gets used for example in Q_algebra_to_equal_char_zero
.
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.
Another remark is that we assume semiring R in the first lemma but algebra ℚ R means that R contains -1 so it is at least a ring. This is probably fine, but a little surprising.
Would it be worth adding that comment as something likeinstance xyz [semiring R] [algebra ℚ R] : ring R := sorry
in a new PR?
I personally don't care (here in this PR) about semirings and that first lemma, just added it because char_p _ 0
and char_zero
run somewhat parallel.
intros a b, | ||
field_simp, | ||
repeat { rw equal_char_zero.pnat_coe_units_coe_eq_coe R }, | ||
convert_to (↑((a * b).num * (a.denom) * (b.denom)) : R) = _, |
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.
The nicer way I know is the transitivity
tactic.
Co-authored-by: Johan Commelin <johan@commelin.net>
Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
Thank you @Vierkantor and @jcommelin ! (especially also for the tactics-tutorial) |
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.
Thanks 🎉
bors merge
…ic zero (#14672) API for equal/mixed characteristic zero with main theorem to split propositions by characteristics. Co-authored-by: Jon <jon.eugster@gmx.ch> Co-authored-by: Jon Eugster <eugster.jon@gmail.com>
Pull request successfully merged into master. Build succeeded: |
API for equal/mixed characteristic zero with main theorem to split propositions by characteristics.
This is a stand-alone PR
contained in one fileand should therefore be rather quick to review. The main result of this PR istheorem split_by_characteristic
.Often it is useful to consider mixed characteristic (0, p) and equal characteristic zero independently. This document provides the definitions and API.
This definition exists for example in nLab.
Similar the definition exists in Stacks Project (Tag 09EK), although in a slightly less general context.
field_simp
to partial division and units #14897pnat_denom
of 0 and 1 #15864