| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- The max operator derived from an arbitrary total preorder. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Relation.Binary.Bundles using (TotalOrder) |
| 10 |
|
| 11 |
module Algebra.Construct.NaturalChoice.Max |
| 12 |
{a ℓ₁ ℓ₂} (totalOrder : TotalOrder a ℓ₁ ℓ₂) where |
| 13 |
|
| 14 |
open import Algebra.Core using (Op₂) |
| 15 |
open import Algebra.Construct.NaturalChoice.Base using (MaxOperator) |
| 16 |
open import Relation.Binary.Construct.Flip.EqAndOrd using () |
| 17 |
renaming (totalOrder to flip) |
| 18 |
|
| 19 |
open TotalOrder totalOrder renaming (Carrier to A) |
| 20 |
|
| 21 |
------------------------------------------------------------------------ |
| 22 |
-- Max is just min with a flipped order |
| 23 |
|
| 24 |
import Algebra.Construct.NaturalChoice.Min (flip totalOrder) as Min |
| 25 |
|
| 26 |
infixl 6 _⊔_ |
| 27 |
|
| 28 |
_⊔_ : Op₂ A |
| 29 |
_⊔_ = Min._⊓_ |
| 30 |
|
| 31 |
------------------------------------------------------------------------ |
| 32 |
-- Properties |
| 33 |
|
| 34 |
open Min public using () |
| 35 |
renaming |
| 36 |
( x≤y⇒x⊓y≈x to x≤y⇒y⊔x≈y |
| 37 |
; x≤y⇒y⊓x≈x to x≤y⇒x⊔y≈y |
| 38 |
) |
| 39 |
|
| 40 |
maxOperator : MaxOperator totalPreorder |
| 41 |
maxOperator = record |
| 42 |
{ x≤y⇒x⊔y≈y = x≤y⇒x⊔y≈y |
| 43 |
; x≥y⇒x⊔y≈x = x≤y⇒y⊔x≈y |
| 44 |
} |
| 45 |
|
| 46 |
open import Algebra.Construct.NaturalChoice.MaxOp maxOperator public |