1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253-------------------------------------------------------------------------- The Agda standard library---- The min operator derived from an arbitrary total preorder.------------------------------------------------------------------------ {-# OPTIONS --cubical-compatible --safe #-} open import Algebra.Coreopen import Algebra.Bundlesopen import Algebra.Construct.NaturalChoice.Baseopen import Data.Sum.Base using (inj₁; inj₂; [_,_])open import Data.Product.Base using (_,_)open import Function.Base using (id)open import Relation.Binary.Bundles using (TotalOrder)import Algebra.Construct.NaturalChoice.MinOp as MinOp module Algebra.Construct.NaturalChoice.Min {a ℓ₁ ℓ₂} (O : TotalOrder a ℓ₁ ℓ₂) where open TotalOrder O renaming (Carrier to A) -------------------------------------------------------------------------- Definition infixl 7 _⊓_ _⊓_ : Op₂ Ax ⊓ y with total x y... | inj₁ x≤y = x... | inj₂ y≤x = y -------------------------------------------------------------------------- Properties x≤y⇒x⊓y≈x : ∀ {x y} → x ≤ y → x ⊓ y ≈ xx≤y⇒x⊓y≈x {x} {y} x≤y with total x y... | inj₁ _ = Eq.refl... | inj₂ y≤x = antisym y≤x x≤y x≤y⇒y⊓x≈x : ∀ {x y} → x ≤ y → y ⊓ x ≈ xx≤y⇒y⊓x≈x {x} {y} x≤y with total y x... | inj₁ y≤x = antisym y≤x x≤y... | inj₂ _ = Eq.refl minOperator : MinOperator totalPreorderminOperator = record { x≤y⇒x⊓y≈x = x≤y⇒x⊓y≈x ; x≥y⇒x⊓y≈y = x≤y⇒y⊓x≈x } open MinOp minOperator public