-
Notifications
You must be signed in to change notification settings - Fork 295
[Merged by Bors] - refactor(ring_theory/ideal/quotient): extract a ring_con
structure
#17833
Conversation
…, to be used for `ring_quot` too
ce74267
to
0a4fdb2
Compare
src/ring_theory/congruence.lean
Outdated
section data | ||
|
||
section add_mul | ||
variables [has_add R] [has_mul R] (c : ring_con R) | ||
instance : has_add c.quotient := c.to_add_con.has_add | ||
@[simp, norm_cast] lemma coe_add (x y : R) : (↑(x + y) : c.quotient) = ↑x + ↑y := rfl | ||
instance : has_mul c.quotient := c.to_con.has_mul | ||
@[simp, norm_cast] lemma coe_mul (x y : R) : (↑(x * y) : c.quotient) = ↑x * ↑y := rfl | ||
end add_mul | ||
|
||
section zero | ||
variables [add_zero_class R] [has_mul R] (c : ring_con R) | ||
instance : has_zero c.quotient := c.to_add_con^.quotient.has_zero | ||
@[simp, norm_cast] lemma coe_zero : (↑(0 : R) : c.quotient) = 0 := rfl | ||
end zero | ||
|
||
section one | ||
variables [has_add R] [mul_one_class R] (c : ring_con R) | ||
instance : has_one c.quotient := c.to_con^.quotient.has_one | ||
@[simp, norm_cast] lemma coe_one : (↑(1 : R) : c.quotient) = 1 := rfl | ||
end one | ||
|
||
section neg_sub_zsmul | ||
variables [add_group R] [has_mul R] (c : ring_con R) | ||
instance : has_neg c.quotient := c.to_add_con^.has_neg | ||
@[simp, norm_cast] lemma coe_neg (x : R) : (↑(-x) : c.quotient) = -x := rfl | ||
instance : has_sub c.quotient := c.to_add_con^.has_sub | ||
@[simp, norm_cast] lemma coe_sub (x y : R) : (↑(x - y) : c.quotient) = x - y := rfl | ||
instance has_zsmul : has_smul ℤ c.quotient := c.to_add_con^.quotient.has_zsmul | ||
@[simp, norm_cast] lemma coe_zsmul (z : ℤ) (x : R) : (↑(z • x) : c.quotient) = z • x := rfl | ||
end neg_sub_zsmul | ||
|
||
section nsmul | ||
variables [add_monoid R] [has_mul R] (c : ring_con R) | ||
instance has_nsmul : has_smul ℕ c.quotient := c.to_add_con^.quotient.has_nsmul | ||
@[simp, norm_cast] lemma coe_nsmul (n : ℕ) (x : R) : (↑(n • x) : c.quotient) = n • x := rfl | ||
end nsmul | ||
|
||
section pow | ||
variables [has_add R] [monoid R] (c : ring_con R) | ||
instance : has_pow c.quotient ℕ := c.to_con^.nat.has_pow | ||
@[simp, norm_cast] lemma coe_pow (x : R) (n : ℕ) : (↑(x ^ n) : c.quotient) = x ^ n := rfl | ||
end pow | ||
|
||
section nat_cast | ||
variables [add_monoid_with_one R] [has_mul R] (c : ring_con R) | ||
instance : has_nat_cast c.quotient := ⟨λ n, ↑(n : R)⟩ | ||
@[simp, norm_cast] lemma coe_nat_cast (n : ℕ) : (↑(n : R) : c.quotient) = n := rfl | ||
end nat_cast | ||
|
||
section int_cast | ||
variables [add_group_with_one R] [has_mul R] (c : ring_con R) | ||
instance : has_int_cast c.quotient := ⟨λ z, ↑(z : R)⟩ | ||
@[simp, norm_cast] lemma coe_int_cast (n : ℕ) : (↑(n : R) : c.quotient) = n := rfl | ||
end int_cast | ||
|
||
instance [inhabited R] [has_add R] [has_mul R] (c : ring_con R) : inhabited c.quotient := | ||
⟨↑(default : R)⟩ | ||
|
||
end data |
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 know that we'd normally put blank lines here, but there's so little actualy going on (copy an existing instance, write the lemma unfolding it) that it feels like a waste of space.
ring_con
structurering_con
structure
This PR/issue depends on: |
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 immediately see how this would make it easier to work with ring_quot
: it looks like this is basically just a reimplementation of ring_quot
that doesn't yet have as many lemmas. Is the point to (nearly) replace all of ring_quot
with quotient (ring_con.r _)
?
Co-authored-by: Anne Baanen <[email protected]>
Co-authored-by: Anne Baanen <[email protected]>
The main advantages are that:
|
Thanks! bors d+ |
✌️ eric-wieser can now approve this pull request. To approve and merge a pull request, simply reply with |
bors merge |
…17833) The intent here is to remove some duplication with `ring_quot`. I've only copied across the basic lemmas from `group_theory/congruence`; I imagine most of the rest won't be that useful, and that if we do want them, we should look for a means to deduplicate them. Note that `ring_con.quotient` can be used to take quotients of semirings.
Pull request successfully merged into master. Build succeeded: |
ring_con
structurering_con
structure
The intent here is to remove some duplication with
ring_quot
.I've only copied across the basic lemmas from
group_theory/congruence
; I imagine most of the rest won't be that useful, and that if we do want them, we should look for a means to deduplicate them.Note that
ring_con.quotient
can be used to take quotients of semirings.