{-# OPTIONS --safe --without-K #-}
import Relation.Unary
open import Core.Functor
open import Core.Ternary as Ternary
open import Function hiding (_⟨_⟩_)
open import Level
open import Data.Product
open import Relation.Binary hiding (_⇒_)
open import Relation.Binary.Bundles
open import Relation.Binary.PropositionalEquality renaming (refl to ≡-refl ; trans to ≡-trans)
module Core.MonotonePredicate {c ℓ}
(Carrier : Set c)
(_~_ : Rel Carrier ℓ) where
open Relation.Unary
variable P Q P₁ P₂ Q₁ Q₂ P′ Q′ : Pred Carrier ℓ
record Monotone (P : Pred Carrier ℓ) : Set (suc ℓ ⊔ c) where
field
weaken : ∀ {x y} → x ~ y → P x → P y
open Monotone ⦃...⦄ public
record HMonotone (T : Pred Carrier ℓ → Pred Carrier ℓ) : Set (suc ℓ ⊔ c) where
field
⦃ T-respects-monotonicity ⦄ : ⦃ Monotone P ⦄ → Monotone (T P)
transform : ∀[ P ⇒ Q ] → ∀[ T P ⇒ T Q ]
open HMonotone ⦃...⦄ public
record Antitone (P : Pred Carrier ℓ) : Set (suc ℓ ⊔ c) where
field strengthen : ∀ {x y} → x ~ y → P y → P x
open Antitone ⦃...⦄ public
record _⊣_ (L R : Pred Carrier ℓ → Pred Carrier ℓ) ⦃ _ : HMonotone L ⦄ ⦃ _ : HMonotone R ⦄ : Set (suc ℓ ⊔ c) where
field
φ : ⦃ Monotone P ⦄ → ⦃ Monotone Q ⦄ → ∀[ L P ⇒ Q ] → ∀[ P ⇒ R Q ]
φᵒ : ⦃ Monotone P ⦄ → ⦃ Monotone Q ⦄ → ∀[ P ⇒ R Q ] → ∀[ L P ⇒ Q ]
M : Pred Carrier ℓ → Pred Carrier ℓ
M = R ∘ L
W : Pred Carrier ℓ → Pred Carrier ℓ
W = L ∘ R
unit : ⦃ Monotone P ⦄ → ∀[ P ⇒ M P ]
unit = φ id
counit : ⦃ Monotone P ⦄ → ∀[ W P ⇒ P ]
counit = φᵒ id
join : ⦃ Monotone P ⦄ → ∀[ M (M P) ⇒ M P ]
join = transform counit
duplicate : ⦃ Monotone P ⦄ → ∀[ W P ⇒ W (W P) ]
duplicate = transform unit
open _⊣_ public