|
| 1 | +------------------------------------------------------------------------ |
| 2 | +-- The Agda standard library |
| 3 | +-- |
| 4 | +-- Definition of the centre of a Ring |
| 5 | +------------------------------------------------------------------------ |
| 6 | + |
| 7 | +{-# OPTIONS --safe --cubical-compatible #-} |
| 8 | + |
| 9 | +open import Algebra.Bundles |
| 10 | + using (Ring; CommutativeRing; Monoid; RawRing; RawMonoid) |
| 11 | + |
| 12 | +module Algebra.Construct.Centre.Ring {c ℓ} (ring : Ring c ℓ) where |
| 13 | + |
| 14 | +open import Algebra.Core using (Op₁; Op₂) |
| 15 | +open import Algebra.Consequences.Setoid using (zero⇒central) |
| 16 | +open import Algebra.Morphism.Structures |
| 17 | +open import Algebra.Morphism.RingMonomorphism using (isRing) |
| 18 | +open import Function.Base using (id; const; _$_) |
| 19 | + |
| 20 | + |
| 21 | +private |
| 22 | + module R = Ring ring |
| 23 | + module R* = Monoid R.*-monoid |
| 24 | + |
| 25 | +open import Relation.Binary.Reasoning.Setoid R.setoid as ≈-Reasoning |
| 26 | +open import Algebra.Properties.Ring ring using (-‿distribˡ-*; -‿distribʳ-*) |
| 27 | + |
| 28 | + |
| 29 | +------------------------------------------------------------------------ |
| 30 | +-- Definition |
| 31 | + |
| 32 | +-- Re-export the underlying sub-Monoid |
| 33 | + |
| 34 | +open import Algebra.Construct.Centre.Monoid R.*-monoid as Z public |
| 35 | + using (Center; ι; ∙-comm) |
| 36 | + |
| 37 | +-- Now, can define a commutative sub-Ring |
| 38 | + |
| 39 | +_+_ : Op₂ Center |
| 40 | +g + h = record |
| 41 | + { ι = ι g R.+ ι h |
| 42 | + ; central = λ r → begin |
| 43 | + (ι g R.+ ι h) R.* r ≈⟨ R.distribʳ _ _ _ ⟩ |
| 44 | + ι g R.* r R.+ ι h R.* r ≈⟨ R.+-cong (Center.central g r) (Center.central h r) ⟩ |
| 45 | + r R.* ι g R.+ r R.* ι h ≈⟨ R.distribˡ _ _ _ ⟨ |
| 46 | + r R.* (ι g R.+ ι h) ∎ |
| 47 | + } |
| 48 | + |
| 49 | +-_ : Op₁ Center |
| 50 | +- g = record |
| 51 | + { ι = R.- ι g |
| 52 | + ; central = λ r → begin R.- ι g R.* r ≈⟨ -‿distribˡ-* (ι g) r ⟨ |
| 53 | + R.- (ι g R.* r) ≈⟨ R.-‿cong (Center.central g r) ⟩ |
| 54 | + R.- (r R.* ι g) ≈⟨ -‿distribʳ-* r (ι g) ⟩ |
| 55 | + r R.* R.- ι g ∎ |
| 56 | + } |
| 57 | + |
| 58 | +0# : Center |
| 59 | +0# = record |
| 60 | + { ι = R.0# |
| 61 | + ; central = zero⇒central R.setoid {_∙_ = R._*_} R.zero |
| 62 | + } |
| 63 | + |
| 64 | +domain : RawRing _ _ |
| 65 | +domain = record |
| 66 | + { _≈_ = _≈_ |
| 67 | + ; _+_ = _+_ |
| 68 | + ; _*_ = _*_ |
| 69 | + ; -_ = -_ |
| 70 | + ; 0# = 0# |
| 71 | + ; 1# = 1# |
| 72 | + } where open RawMonoid Z.domain renaming (ε to 1#; _∙_ to _*_) |
| 73 | + |
| 74 | +isRingHomomorphism : IsRingHomomorphism domain R.rawRing ι |
| 75 | +isRingHomomorphism = record |
| 76 | + { isSemiringHomomorphism = record |
| 77 | + { isNearSemiringHomomorphism = record |
| 78 | + { +-isMonoidHomomorphism = record |
| 79 | + { isMagmaHomomorphism = record |
| 80 | + { isRelHomomorphism = record { cong = id } |
| 81 | + ; homo = λ _ _ → R.refl |
| 82 | + } |
| 83 | + ; ε-homo = R.refl |
| 84 | + } |
| 85 | + ; *-homo = λ _ _ → R.refl |
| 86 | + } |
| 87 | + ; 1#-homo = R.refl |
| 88 | + } |
| 89 | + ; -‿homo = λ _ → R.refl |
| 90 | + } |
| 91 | + |
| 92 | +isRingMonomorphism : IsRingMonomorphism domain R.rawRing ι |
| 93 | +isRingMonomorphism = record |
| 94 | + { isRingHomomorphism = isRingHomomorphism |
| 95 | + ; injective = id |
| 96 | + } |
| 97 | + |
| 98 | +commutativeRing : CommutativeRing _ _ |
| 99 | +commutativeRing = record |
| 100 | + { isCommutativeRing = record |
| 101 | + { isRing = isRing isRingMonomorphism R.isRing |
| 102 | + ; *-comm = ∙-comm |
| 103 | + } |
| 104 | + } |
| 105 | + |
| 106 | +Z[_] = commutativeRing |
0 commit comments