agda / agda-stdlib

The Agda standard library

Home Page:https://wiki.portal.chalmers.se/agda/Libraries/StandardLibrary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redundant `zero` in `IsRing`

Akshobhya1234 opened this issue · comments

When defining IsRing, zero is provided in the definition. Instead, we can prove zero as its property.

Here is proof of right zero

RightZero : ∀ x → x * 0# ≈ 0# 
RightZero x = begin 
  x * 0#                    ≈⟨ sym(+-identityʳ _) ⟩ 
  x * 0# + 0#               ≈⟨ +-congˡ (sym(-‿inverseʳ  x)) ⟩ 
  x * 0# + (x - x)          ≈⟨ sym(+-assoc _ _ _) ⟩ 
  (x * 0# + x) - x          ≈⟨ +-congʳ (+-congˡ ( sym(*-identityʳ x))) ⟩ 
  ((x * 0#) + (x * 1#)) - x ≈⟨ +-congʳ (sym(distribˡ _ _ _ )) ⟩ 
  (x * (0# + 1#)) - x       ≈⟨ +-congʳ (*-congˡ ( +-identityˡ 1# )) ⟩ 
  (x * (1#)) - x            ≈⟨ +-congʳ (*-identityʳ x) ⟩ 
  x - x                     ≈⟨ -‿inverseʳ  x ⟩ 
  0#                        ∎  

Similarly, we can prove left zero. This proof should be used in -‿distribˡ-* : ∀ x y → - (x * y) ≈ - x * y and -‿distribʳ-* : ∀ x y → - (x * y) ≈ x * - y
Also in the literature, I don't see zero given in the definition. Was this part of some design decision?

Yes, that appears to be a bug. Nice spot.

What's the most general structure in which this lemma becomes provable?

  • IsNearring
  • IsRingWithoutOne
  • IsNonAssociativeRing
  • ...?

Related/subsidiary issue: do we really want the names

    ; inverse                 to -‿inverse
    ; inverseˡ                to -‿inverseˡ
    ; inverseʳ                to -‿inverseʳ

in the +-IsAbelianGroup instance of IsRing. Why not more simply +-inverse etc.?

Related/subsidiary issue: do we really want the names

Maybe, maybe not. But we should open a separate issue for that, and it won't make it into v2.0.

Weirdly, IsNearring and IsRingWithoutOne don't have a common ancestor. But the constructions work for IsNearring as well. But I confess I'm not across all these subtle precursors to Ring ... (does IsRingWithoutOne give rise to an instance of IsNearring?) not least because IsNearring needs a 1#!