-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSemiLattices.agda~
55 lines (51 loc) · 2.07 KB
/
SemiLattices.agda~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{-# OPTIONS --cubical #-}
open import Level
open import CubicalBasics.cubical-prelude hiding (_∨_)
open import Data.Product
open import CubicalBasics.PointedTypesCubical
open import CubicalBasics.PropositionReasoning using (isSetIsProp)
-- open import CubicalBasics.CubicalFun
variable
o l e : Level
record SemiLattice (o l e : Level) : Type (suc o ⊔ suc e ⊔ suc l) where
field
Carrier : Set o
CarIsSet : isSet (Carrier)
_≤_ : Carrier → Carrier → Type e
infixl 5 _≤_
field
≤isProp : {x y : Carrier} → isProp (x ≤ y)
reflexivity : {i : Carrier} → i ≤ i
_■_ : {i j k : Carrier} → i ≤ j → j ≤ k → i ≤ k
_∨_ : Carrier → Carrier → Carrier
infixl 20 _∨_
infixl 20 _■_
re = reflexivity
field
comm : ∀ {i} {j} → i ∨ j ≡ j ∨ i
uB : ∀ {i} {j} → i ≤ (i ∨ j)
sup : ∀ {i} {j} {k} → i ≤ k → j ≤ k → (i ∨ j) ≤ k
module Funs (J : SemiLattice o ℓ e) where
open SemiLattice J
subst≤ : ∀ {e'} → {x y : Carrier} {p q : x ≤ y} → (A : x ≤ y → Set e' ) → A p → A q
subst≤ A = subst A (≤isProp _ _)
PathTo≤ : {x y : SemiLattice.Carrier J} → x ≡ y → SemiLattice._≤_ J x y
PathTo≤ {x = x} {y = y} p = (subst (λ a → SemiLattice._≤_ J x a ) p (SemiLattice.reflexivity J))
convertEq : {j k : Carrier} → j ≡ k → j ≤ k × k ≤ j
convertEq = λ p → PathTo≤ p , PathTo≤ (sym p)
uB' : ∀ {i j} → j ≤ (i ∨ j)
uB' {k} {j'} = uB {j'} {k} ■ PathTo≤ comm
left-Eat : ∀ {i j} → i ≤ j → i ∨ j ≤ j
left-Eat p = sup p reflexivity
infix 21 _∨R
_∨R = left-Eat
right-Eat : ∀ {i j} → i ≤ j → j ∨ i ≤ j
right-Eat p = sup reflexivity p
resp : ∀ {i j k l} → i ≤ k → j ≤ l → i ∨ j ≤ k ∨ l
resp p q = sup (p ■ uB) uB' ■ sup uB (q ■ uB')
R∨_ = right-Eat
infix 22 R∨_
right-map : ∀ {i j k} → j ≤ k → i ∨ j ≤ i ∨ k
right-map p = sup uB (p ■ uB')
left-map : ∀ {i j k} → j ≤ k → j ∨ i ≤ k ∨ i
left-map p = sup (p ■ uB) uB'