Classical.Structures.CommutativeRing¶
Commutative Rings¶
This is the Classical.Structures.CommutativeRing module of the Agda Universal Algebra Library.
Σ[ 𝑨 ∈ Algebra α ρ ] 𝑨 ⊨ Th-CommutativeRing over Sig-Ring. An equation-only
extension of Ring, structurally identical to the way CommutativeMonoid extends
Monoid and AbelianGroup extends Group: commutativeRing→ring is a pure
theory-reindex (proj₁ on the underlying algebra), and CommutativeRing-Op inherits
the additive (_+_, 0R, -_), the multiplicative (_·_, 1R), and all eleven ring laws
through it, adding ·-comm-law.
Satisfaction predicate and the CommutativeRing type¶
infix 4 _⊨ᶜʳᵍ_ _⊨ᶜʳᵍ_ : (𝑨 : Algebra α ρ) (ℰ : Eq-CommutativeRing → Term (Fin 3) × Term (Fin 3)) → Type (α ⊔ ρ) 𝑨 ⊨ᶜʳᵍ ℰ = ∀ i → 𝑨 ⊧ proj₁ (ℰ i) ≈ proj₂ (ℰ i) CommutativeRing : (α ρ : Level) → Type (suc α ⊔ suc ρ) CommutativeRing α ρ = Σ[ 𝑨 ∈ Algebra α ρ ] 𝑨 ⊨ᶜʳᵍ Th-CommutativeRing
The forgetful projection to rings¶
commutativeRing→ring : CommutativeRing α ρ → Ring α ρ commutativeRing→ring (𝑨 , mod) = 𝑨 , λ { +-assoc → mod +-assocᶜ ; +-idˡ → mod +-idˡᶜ ; +-idʳ → mod +-idʳᶜ ; +-invˡ → mod +-invˡᶜ ; +-invʳ → mod +-invʳᶜ ; +-comm → mod +-commᶜ ; ·-assoc → mod ·-assocᶜ ; ·-idˡ → mod ·-idˡᶜ ; ·-idʳ → mod ·-idʳᶜ ; distribˡ → mod distribˡᶜ ; distribʳ → mod distribʳᶜ }
The CommutativeRing-Op module¶
module CommutativeRing-Op {α ρ : Level} (𝑪 : CommutativeRing α ρ) where private 𝑨 = proj₁ 𝑪 open Setoid 𝔻[ 𝑨 ] open Ring-Op (commutativeRing→ring 𝑪) public using ( _+_ ; _·_ ; 0R ; 1R ; -_ ; +-cong ; ·-cong ; neg-cong ; interp-node-+ ; interp-node-· ; interp-node-0 ; interp-node-1 ; interp-node-neg ; +-assoc-law ; +-idˡ-law ; +-idʳ-law ; +-invˡ-law ; +-invʳ-law ; +-comm-law ; ·-assoc-law ; ·-idˡ-law ; ·-idʳ-law ; distribˡ-law ; distribʳ-law ) equations : 𝑨 ⊨ᶜʳᵍ Th-CommutativeRing equations = proj₂ 𝑪 ·-comm-law : ∀ x y → x · y ≈ y · x ·-comm-law x y = trans (sym (interp-node-· (ℊ 0F) (ℊ 1F) {η})) (trans (equations ·-comm η) (interp-node-· (ℊ 1F) (ℊ 0F) {η})) where η : Fin 3 → 𝕌[ 𝑨 ] η = λ { 0F → x ; 1F → y ; 2F → x }
eqsToCommutativeRing¶
eqsToCommutativeRing : (A : Type α) (_+'_ : A → A → A) (0' : A) (-'_ : A → A) (_*'_ : A → A → A) (1' : A) → (+-assoc-≡ : ∀ a b c → (a +' b) +' c ≡ a +' (b +' c)) → (+-idˡ-≡ : ∀ a → 0' +' a ≡ a) (+-idʳ-≡ : ∀ a → a +' 0' ≡ a) → (+-invˡ-≡ : ∀ a → (-' a) +' a ≡ 0') (+-invʳ-≡ : ∀ a → a +' (-' a) ≡ 0') → (+-comm-≡ : ∀ a b → a +' b ≡ b +' a) → (*-assoc-≡ : ∀ a b c → (a *' b) *' c ≡ a *' (b *' c)) → (*-idˡ-≡ : ∀ a → 1' *' a ≡ a) (*-idʳ-≡ : ∀ a → a *' 1' ≡ a) → (*-comm-≡ : ∀ a b → a *' b ≡ b *' a) → (distribˡ-≡ : ∀ a b c → a *' (b +' c) ≡ (a *' b) +' (a *' c)) → (distribʳ-≡ : ∀ a b c → (b +' c) *' a ≡ (b *' a) +' (c *' a)) → CommutativeRing α α eqsToCommutativeRing A _+'_ 0' -'_ _*'_ 1' +-assoc-≡ +-idˡ-≡ +-idʳ-≡ +-invˡ-≡ +-invʳ-≡ +-comm-≡ *-assoc-≡ *-idˡ-≡ *-idʳ-≡ *-comm-≡ distribˡ-≡ distribʳ-≡ = opsToBareRing A _+'_ 0' -'_ _*'_ 1' , proof where proof : opsToBareRing A _+'_ 0' -'_ _*'_ 1' ⊨ᶜʳᵍ Th-CommutativeRing proof +-assocᶜ ρ = +-assoc-≡ (ρ 0F) (ρ 1F) (ρ 2F) proof +-idˡᶜ ρ = +-idˡ-≡ (ρ 0F) proof +-idʳᶜ ρ = +-idʳ-≡ (ρ 0F) proof +-invˡᶜ ρ = +-invˡ-≡ (ρ 0F) proof +-invʳᶜ ρ = +-invʳ-≡ (ρ 0F) proof +-commᶜ ρ = +-comm-≡ (ρ 0F) (ρ 1F) proof ·-assocᶜ ρ = *-assoc-≡ (ρ 0F) (ρ 1F) (ρ 2F) proof ·-idˡᶜ ρ = *-idˡ-≡ (ρ 0F) proof ·-idʳᶜ ρ = *-idʳ-≡ (ρ 0F) proof ·-comm ρ = *-comm-≡ (ρ 0F) (ρ 1F) proof distribˡᶜ ρ = distribˡ-≡ (ρ 0F) (ρ 1F) (ρ 2F) proof distribʳᶜ ρ = distribʳ-≡ (ρ 0F) (ρ 1F) (ρ 2F)