{-# OPTIONS --without-K --safe #-}
open import Tools.Level
open import Tools.Relation
module Definition.Modality {a ℓ} (M′ : Setoid a ℓ) where
open Setoid M′ renaming (Carrier to M)
open import Tools.Algebra M′
open import Tools.Nat hiding (_+_)
open import Tools.Product
record Modality : Set (a ⊔ ℓ) where
infixr 40 _+_
infixr 40 _∧_
infixr 45 _·_
infix 10 _≤_
field
_+_ : Op₂ M
_·_ : Op₂ M
_∧_ : Op₂ M
nrⁿ : Nat → Op₃ M
𝟘 : M
𝟙 : M
+-CommutativeMonoid : IsCommutativeMonoid _+_ 𝟘
·-Monoid : IsMonoid _·_ 𝟙
∧-Semilattice : IsSemilattice _∧_
_≤_ : Rel M ℓ
p ≤ q = p ≈ (p ∧ q)
field
·-zero : Zero 𝟘 _·_
+-positive : (p q : M) → 𝟘 ≤ (p + q) → 𝟘 ≤ p × 𝟘 ≤ q
nrⁿ-rec : (n : Nat) (p q r : M) → nrⁿ (1+ n) p q r ≈ p ∧ (q + r · nrⁿ n p q r)
nrⁿ-0 : (p q r : M) → nrⁿ 0 p q r ≈ 𝟘
nrⁿ-fix : ∃ (λ n → ∀ (p q r : M) → nrⁿ (1+ n) p q r ≈ nrⁿ n p q r)
·-distrib-+ : _·_ DistributesOver _+_
·-distrib-∧ : _·_ DistributesOver _∧_
+-distrib-∧ : _+_ DistributesOver _∧_
≈-equivalence : IsEquivalence _≈_
nr : Op₃ M
nr = nrⁿ (proj₁ nrⁿ-fix)
+-comm : Commutative _+_
+-comm = IsCommutativeMonoid.comm +-CommutativeMonoid
+-assoc : Associative _+_
+-assoc = IsCommutativeMonoid.assoc +-CommutativeMonoid
+-identity : Identity 𝟘 _+_
+-identity = IsCommutativeMonoid.identity +-CommutativeMonoid
·-assoc : Associative _·_
·-assoc = IsMonoid.assoc ·-Monoid
·-identity : Identity 𝟙 _·_
·-identity = IsMonoid.identity ·-Monoid
∧-comm : Commutative _∧_
∧-comm = IsSemilattice.comm ∧-Semilattice
∧-assoc : Associative _∧_
∧-assoc = IsSemilattice.assoc ∧-Semilattice
∧-idem : Idempotent _∧_
∧-idem = IsSemilattice.idem ∧-Semilattice
≈-refl : Reflexive _≈_
≈-refl = IsEquivalence.refl ≈-equivalence
≈-sym : Symmetric _≈_
≈-sym = IsEquivalence.sym ≈-equivalence
≈-trans : Transitive _≈_
≈-trans = IsEquivalence.trans ≈-equivalence
+-cong : Congruent₂ _+_
+-cong = IsCommutativeMonoid.∙-cong +-CommutativeMonoid
·-cong : Congruent₂ _·_
·-cong = IsMonoid.∙-cong ·-Monoid
∧-cong : Congruent₂ _∧_
∧-cong = IsSemilattice.∧-cong ∧-Semilattice