Debian Codegraph @

src/Algebra/Properties/RingWithoutOne.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Some basic properties of RingWithoutOne
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 open import Algebra.Bundles using (RingWithoutOne)
10
11 module Algebra.Properties.RingWithoutOne {r₁ r₂} (R : RingWithoutOne r₁ r₂) where
12
13 open RingWithoutOne R
14
15 import Algebra.Properties.AbelianGroup as AbelianGroupProperties
16 open import Function.Base using (_$_)
17 open import Relation.Binary.Reasoning.Setoid setoid
18
19 ------------------------------------------------------------------------
20 -- Export properties of abelian groups
21
22 open AbelianGroupProperties +-abelianGroup public
23 renaming
24 ( ε⁻¹≈ε to -0#≈0#
25 ; ∙-cancelˡ to +-cancelˡ
26 ; ∙-cancelʳ to +-cancelʳ
27 ; ∙-cancel to +-cancel
28 ; ⁻¹-involutive to -‿involutive
29 ; ⁻¹-injective to -‿injective
30 ; ⁻¹-anti-homo-∙ to -‿anti-homo-+
31 ; identityˡ-unique to +-identityˡ-unique
32 ; identityʳ-unique to +-identityʳ-unique
33 ; identity-unique to +-identity-unique
34 ; inverseˡ-unique to +-inverseˡ-unique
35 ; inverseʳ-unique to +-inverseʳ-unique
36 ; ⁻¹-∙-comm to -‿+-comm
37 )
38
39 -‿distribˡ-* : ∀ x y → - (x * y) ≈ - x * y
40 -‿distribˡ-* x y = sym $ begin
41 - x * y ≈⟨ +-identityʳ (- x * y) ⟨
42 - x * y + 0# ≈⟨ +-congˡ $ -‿inverseʳ (x * y) ⟨
43 - x * y + (x * y + - (x * y)) ≈⟨ +-assoc (- x * y) (x * y) (- (x * y)) ⟨
44 - x * y + x * y + - (x * y) ≈⟨ +-congʳ $ distribʳ y (- x) x ⟨
45 (- x + x) * y + - (x * y) ≈⟨ +-congʳ $ *-congʳ $ -‿inverseˡ x ⟩
46 0# * y + - (x * y) ≈⟨ +-congʳ $ zeroˡ y ⟩
47 0# + - (x * y) ≈⟨ +-identityˡ (- (x * y)) ⟩
48 - (x * y) ∎
49
50 -‿distribʳ-* : ∀ x y → - (x * y) ≈ x * - y
51 -‿distribʳ-* x y = sym $ begin
52 x * - y ≈⟨ +-identityˡ (x * - y) ⟨
53 0# + x * - y ≈⟨ +-congʳ $ -‿inverseˡ (x * y) ⟨
54 - (x * y) + x * y + x * - y ≈⟨ +-assoc (- (x * y)) (x * y) (x * - y) ⟩
55 - (x * y) + (x * y + x * - y) ≈⟨ +-congˡ $ distribˡ x y (- y) ⟨
56 - (x * y) + x * (y + - y) ≈⟨ +-congˡ $ *-congˡ $ -‿inverseʳ y ⟩
57 - (x * y) + x * 0# ≈⟨ +-congˡ $ zeroʳ x ⟩
58 - (x * y) + 0# ≈⟨ +-identityʳ (- (x * y)) ⟩
59 - (x * y) ∎
60
61 x+x≈x⇒x≈0 : ∀ x → x + x ≈ x → x ≈ 0#
62 x+x≈x⇒x≈0 x eq = +-identityˡ-unique x x eq
63
64 x[y-z]≈xy-xz : ∀ x y z → x * (y - z) ≈ x * y - x * z
65 x[y-z]≈xy-xz x y z = begin
66 x * (y - z) ≈⟨ distribˡ x y (- z) ⟩
67 x * y + x * - z ≈⟨ +-congˡ (sym (-‿distribʳ-* x z)) ⟩
68 x * y - x * z ∎
69
70 [y-z]x≈yx-zx : ∀ x y z → (y - z) * x ≈ (y * x) - (z * x)
71 [y-z]x≈yx-zx x y z = begin
72 (y - z) * x ≈⟨ distribʳ x y (- z) ⟩
73 y * x + - z * x ≈⟨ +-congˡ (sym (-‿distribˡ-* z x)) ⟩
74 y * x - z * x ∎