|
| 1 | +------------------------------------------------------------------------ |
| 2 | +-- The Agda standard library |
| 3 | +-- |
| 4 | +-- Definitions of ordered algebraic structures like promonoids and |
| 5 | +-- posemigroups (packed in records together with sets, orders, |
| 6 | +-- operations, etc.) |
| 7 | +------------------------------------------------------------------------ |
| 8 | + |
| 9 | +-- The contents of this module should be accessed via `Algebra.Order`. |
| 10 | + |
| 11 | +{-# OPTIONS --without-K --safe #-} |
| 12 | + |
| 13 | +module Algebra.Ordered.Bundles where |
| 14 | + |
| 15 | +open import Algebra.Core |
| 16 | +open import Algebra.Bundles |
| 17 | +open import Algebra.Ordered.Structures |
| 18 | +open import Level using (suc; _⊔_) |
| 19 | +open import Relation.Binary using (Rel) |
| 20 | +open import Relation.Binary.Bundles using (Preorder; Poset) |
| 21 | + |
| 22 | +------------------------------------------------------------------------ |
| 23 | +-- Bundles of preordered structures |
| 24 | + |
| 25 | +-- Preordered semigroups (prosemigroups) |
| 26 | + |
| 27 | +record Prosemigroup c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where |
| 28 | + infix 4 _≈_ _∼_ |
| 29 | + infixl 7 _∙_ |
| 30 | + field |
| 31 | + Carrier : Set c |
| 32 | + _≈_ : Rel Carrier ℓ₁ -- The underlying equality. |
| 33 | + _∼_ : Rel Carrier ℓ₂ -- The preorder. |
| 34 | + _∙_ : Op₂ Carrier -- Multiplication. |
| 35 | + isProsemigroup : IsProsemigroup _≈_ _∼_ _∙_ |
| 36 | + |
| 37 | + open IsProsemigroup isProsemigroup public |
| 38 | + |
| 39 | + preorder : Preorder c ℓ₁ ℓ₂ |
| 40 | + preorder = record { isPreorder = isPreorder } |
| 41 | + |
| 42 | + semigroup : Semigroup c ℓ₁ |
| 43 | + semigroup = record { isSemigroup = isSemigroup } |
| 44 | + |
| 45 | + open Semigroup semigroup public using (magma) |
| 46 | + |
| 47 | +-- Preordered monoids (promonoids) |
| 48 | + |
| 49 | +record Promonoid c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where |
| 50 | + infix 4 _≈_ _∼_ |
| 51 | + infixl 7 _∙_ |
| 52 | + field |
| 53 | + Carrier : Set c |
| 54 | + _≈_ : Rel Carrier ℓ₁ -- The underlying equality. |
| 55 | + _∼_ : Rel Carrier ℓ₂ -- The preorder. |
| 56 | + _∙_ : Op₂ Carrier -- The monoid multiplication. |
| 57 | + ε : Carrier -- The monoid unit. |
| 58 | + isPromonoid : IsPromonoid _≈_ _∼_ _∙_ ε |
| 59 | + |
| 60 | + open IsPromonoid isPromonoid public |
| 61 | + |
| 62 | + prosemigroup : Prosemigroup c ℓ₁ ℓ₂ |
| 63 | + prosemigroup = record { isProsemigroup = isProsemigroup } |
| 64 | + |
| 65 | + open Prosemigroup prosemigroup public using (preorder; magma; semigroup) |
| 66 | + |
| 67 | + monoid : Monoid c ℓ₁ |
| 68 | + monoid = record { isMonoid = isMonoid } |
| 69 | + |
| 70 | +record CommutativePromonoid c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where |
| 71 | + infix 4 _≈_ _∼_ |
| 72 | + infixl 7 _∙_ |
| 73 | + field |
| 74 | + Carrier : Set c |
| 75 | + _≈_ : Rel Carrier ℓ₁ -- The underlying equality. |
| 76 | + _∼_ : Rel Carrier ℓ₂ -- The preorder. |
| 77 | + _∙_ : Op₂ Carrier -- The monoid multiplication. |
| 78 | + ε : Carrier -- The monoid unit. |
| 79 | + isCommutativePromonoid : IsCommutativePromonoid _≈_ _∼_ _∙_ ε |
| 80 | + |
| 81 | + open IsCommutativePromonoid isCommutativePromonoid public |
| 82 | + |
| 83 | + promonoid : Promonoid c ℓ₁ ℓ₂ |
| 84 | + promonoid = record { isPromonoid = isPromonoid } |
| 85 | + |
| 86 | + open Promonoid promonoid public |
| 87 | + using (preorder; magma; semigroup; monoid) |
| 88 | + |
| 89 | + commutativeMonoid : CommutativeMonoid c ℓ₁ |
| 90 | + commutativeMonoid = record { isCommutativeMonoid = isCommutativeMonoid } |
| 91 | + |
| 92 | +record Prosemiring c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where |
| 93 | + infix 4 _≈_ _∼_ |
| 94 | + infixl 7 _*_ |
| 95 | + infixl 6 _+_ |
| 96 | + field |
| 97 | + Carrier : Set c |
| 98 | + _≈_ : Rel Carrier ℓ₁ |
| 99 | + _∼_ : Rel Carrier ℓ₂ |
| 100 | + _+_ : Op₂ Carrier |
| 101 | + _*_ : Op₂ Carrier |
| 102 | + 0# : Carrier |
| 103 | + 1# : Carrier |
| 104 | + isProsemiring : IsProsemiring _≈_ _∼_ _+_ _*_ 0# 1# |
| 105 | + |
| 106 | + open IsProsemiring isProsemiring public |
| 107 | + |
| 108 | + +-commutativePromonoid : CommutativePromonoid c ℓ₁ ℓ₂ |
| 109 | + +-commutativePromonoid = record |
| 110 | + { isCommutativePromonoid = +-isCommutativePromonoid } |
| 111 | + |
| 112 | + open CommutativePromonoid +-commutativePromonoid public |
| 113 | + using (preorder) |
| 114 | + renaming |
| 115 | + ( magma to +-magma |
| 116 | + ; semigroup to +-semigroup |
| 117 | + ; monoid to +-monoid |
| 118 | + ) |
| 119 | + |
| 120 | + *-promonoid : Promonoid c ℓ₁ ℓ₂ |
| 121 | + *-promonoid = record { isPromonoid = *-isPromonoid } |
| 122 | + |
| 123 | + open Promonoid *-promonoid public |
| 124 | + using () |
| 125 | + renaming |
| 126 | + ( magma to *-magma |
| 127 | + ; semigroup to *-semigroup |
| 128 | + ) |
| 129 | + |
| 130 | +------------------------------------------------------------------------ |
| 131 | +-- Bundles of partially ordered structures |
| 132 | + |
| 133 | +-- Partially ordered semigroups (posemigroups) |
| 134 | + |
| 135 | +record Posemigroup c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where |
| 136 | + infix 4 _≈_ _≤_ |
| 137 | + infixl 7 _∙_ |
| 138 | + field |
| 139 | + Carrier : Set c |
| 140 | + _≈_ : Rel Carrier ℓ₁ -- The underlying equality. |
| 141 | + _≤_ : Rel Carrier ℓ₂ -- The partial order. |
| 142 | + _∙_ : Op₂ Carrier -- Multiplication. |
| 143 | + isPosemigroup : IsPosemigroup _≈_ _≤_ _∙_ |
| 144 | + |
| 145 | + open IsPosemigroup isPosemigroup public |
| 146 | + |
| 147 | + poset : Poset c ℓ₁ ℓ₂ |
| 148 | + poset = record { isPartialOrder = isPartialOrder } |
| 149 | + |
| 150 | + open Poset poset public using (preorder) |
| 151 | + |
| 152 | + semigroup : Semigroup c ℓ₁ |
| 153 | + semigroup = record { isSemigroup = isSemigroup } |
| 154 | + |
| 155 | + open Semigroup semigroup public using (setoid; magma) |
| 156 | + |
| 157 | + prosemigroup : Prosemigroup c ℓ₁ ℓ₂ |
| 158 | + prosemigroup = record { isProsemigroup = isProsemigroup } |
| 159 | + |
| 160 | +-- Partially ordered monoids (pomonoids) |
| 161 | + |
| 162 | +record Pomonoid c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where |
| 163 | + infix 4 _≈_ _≤_ |
| 164 | + infixl 7 _∙_ |
| 165 | + field |
| 166 | + Carrier : Set c |
| 167 | + _≈_ : Rel Carrier ℓ₁ -- The underlying equality. |
| 168 | + _≤_ : Rel Carrier ℓ₂ -- The partial order. |
| 169 | + _∙_ : Op₂ Carrier -- The monoid multiplication. |
| 170 | + ε : Carrier -- The monoid unit. |
| 171 | + isPomonoid : IsPomonoid _≈_ _≤_ _∙_ ε |
| 172 | + |
| 173 | + open IsPomonoid isPomonoid public |
| 174 | + |
| 175 | + posemigroup : Posemigroup c ℓ₁ ℓ₂ |
| 176 | + posemigroup = record { isPosemigroup = isPosemigroup } |
| 177 | + |
| 178 | + open Posemigroup posemigroup public using |
| 179 | + ( setoid |
| 180 | + ; preorder |
| 181 | + ; poset |
| 182 | + ; magma |
| 183 | + ; semigroup |
| 184 | + ; prosemigroup |
| 185 | + ) |
| 186 | + |
| 187 | + promonoid : Promonoid c ℓ₁ ℓ₂ |
| 188 | + promonoid = record { isPromonoid = isPromonoid } |
| 189 | + |
| 190 | + open Promonoid promonoid public using (monoid) |
| 191 | + |
| 192 | +-- Partially ordered commutative monoids (commutative pomonoids) |
| 193 | + |
| 194 | +record CommutativePomonoid c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where |
| 195 | + infix 4 _≈_ _≤_ |
| 196 | + infixl 7 _∙_ |
| 197 | + field |
| 198 | + Carrier : Set c |
| 199 | + _≈_ : Rel Carrier ℓ₁ -- The underlying equality. |
| 200 | + _≤_ : Rel Carrier ℓ₂ -- The partial order. |
| 201 | + _∙_ : Op₂ Carrier -- The monoid multiplication. |
| 202 | + ε : Carrier -- The monoid unit. |
| 203 | + isCommutativePomonoid : IsCommutativePomonoid _≈_ _≤_ _∙_ ε |
| 204 | + |
| 205 | + open IsCommutativePomonoid isCommutativePomonoid public |
| 206 | + |
| 207 | + pomonoid : Pomonoid c ℓ₁ ℓ₂ |
| 208 | + pomonoid = record { isPomonoid = isPomonoid } |
| 209 | + |
| 210 | + open Pomonoid pomonoid public using |
| 211 | + ( setoid |
| 212 | + ; preorder |
| 213 | + ; poset |
| 214 | + ; magma |
| 215 | + ; semigroup |
| 216 | + ; posemigroup |
| 217 | + ; prosemigroup |
| 218 | + ; promonoid |
| 219 | + ) |
| 220 | + |
| 221 | + commutativePromonoid : CommutativePromonoid c ℓ₁ ℓ₂ |
| 222 | + commutativePromonoid = |
| 223 | + record { isCommutativePromonoid = isCommutativePromonoid } |
0 commit comments