Skip to content
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_zero): add char_zero lemma for ordered_semirings #6038

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/algebra/char_zero.lean
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ theorem char_zero_of_inj_zero {R : Type*} [add_left_cancel_monoid R] [has_one R]
rw [H k h, add_zero]
end⟩

/-- Note this is not an instances as `char_zero` implies `nontrivial`,
adomani marked this conversation as resolved.
Show resolved Hide resolved
and this would risk forming a loop. -/
lemma ordered_semiring.to_char_zero {R : Type*} [ordered_semiring R] [nontrivial R] :
char_zero R :=
⟨nat.strict_mono_cast.injective⟩

@[priority 100] -- see Note [lower instance priority]
instance linear_ordered_semiring.to_char_zero {R : Type*}
[linear_ordered_semiring R] : char_zero R :=
⟨nat.strict_mono_cast.injective⟩
ordered_semiring.to_char_zero

namespace nat
variables {R : Type*} [add_monoid R] [has_one R] [char_zero R]
Expand Down