1
+ ------------------------------------------------------------------------
2
+ -- The Agda standard library
3
+ --
4
+ -- Defintions for domain theory
5
+ ------------------------------------------------------------------------
6
+
1
7
module Relation.Binary.Domain.Definitions where
2
8
3
9
open import Relation.Binary.Bundles using (Poset)
@@ -6,8 +12,9 @@ open import Level using (Level; _⊔_; suc; Lift; lift; lower)
6
12
open import Function using (_∘_; id)
7
13
open import Data.Product using (∃-syntax; _×_; _,_; proj₁; proj₂)
8
14
open import Relation.Unary using (Pred)
9
- open import Relation.Binary.PropositionalEquality using (_≡_)
15
+ open import Relation.Binary.PropositionalEquality using (_≡_; subst; cong )
10
16
open import Relation.Binary.Reasoning.PartialOrder
17
+ open import Relation.Binary.Structures
11
18
open import Data.Bool using (Bool; true; false; if_then_else_)
12
19
open import Relation.Binary.Morphism.Structures
13
20
open import Relation.Binary.Morphism.Structures using (IsOrderHomomorphism)
@@ -61,7 +68,6 @@ module _ {c ℓ₁ ℓ₂ : Level} (P : Poset c ℓ₁ ℓ₂) where
61
68
renaming (is-upperbound to ⋁-≤; is-least to ⋁-least)
62
69
public
63
70
64
-
65
71
record DCPO (c ℓ₁ ℓ₂ : Level) : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
66
72
field
67
73
poset : Poset c ℓ₁ ℓ₂
@@ -70,6 +76,27 @@ record DCPO (c ℓ₁ ℓ₂ : Level) : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) wher
70
76
open Poset poset public
71
77
open IsDCPO DcpoStr public
72
78
79
+ module _ {c ℓ₁ ℓ₂} (D : DCPO c ℓ₁ ℓ₂) where
80
+ private
81
+ module D = DCPO D
82
+
83
+ uniqueLub : ∀ {Ix} {s : Ix → D.Carrier}
84
+ → (x y : D.Carrier) → IsLub D.poset s x → IsLub D.poset s y
85
+ → x D.≈ y
86
+ uniqueLub x y x-lub y-lub = D.antisym
87
+ (IsLub.is-least x-lub y (IsLub.is-upperbound y-lub))
88
+ (IsLub.is-least y-lub x (IsLub.is-upperbound x-lub))
89
+
90
+ is-lub-cong : ∀ {Ix} {s : Ix → D.Carrier}
91
+ → (x y : D.Carrier)
92
+ → x D.≈ y
93
+ → IsLub D.poset s x → IsLub D.poset s y
94
+ is-lub-cong x y x≈y x-lub = record
95
+ { is-upperbound = λ i → D.trans (IsLub.is-upperbound x-lub i) (D.reflexive x≈y)
96
+ ; is-least = λ z ub → D.trans (D.reflexive (D.Eq.sym x≈y)) (IsLub.is-least x-lub z (λ i → D.trans (ub i) (D.reflexive D.Eq.refl)))
97
+ }
98
+
99
+
73
100
module _ {c ℓ₁ ℓ₂ : Level} {P : Poset c ℓ₁ ℓ₂} {Q : Poset c ℓ₁ ℓ₂} where
74
101
75
102
private
@@ -79,7 +106,7 @@ module _ {c ℓ₁ ℓ₂ : Level} {P : Poset c ℓ₁ ℓ₂} {Q : Poset c ℓ
79
106
record IsScottContinuous (f : P.Carrier → Q.Carrier) : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
80
107
field
81
108
PreserveLub : ∀ {Ix : Set c} {s : Ix → P.Carrier}
82
- → (dir-s : IsDirectedFamily P s)
109
+ → (dir : IsDirectedFamily P s)
83
110
→ (lub : P.Carrier)
84
111
→ IsLub P s lub
85
112
→ IsLub Q (f ∘ s) (f lub)
@@ -136,19 +163,19 @@ module _ where
136
163
137
164
ScottId : ∀ {c ℓ₁ ℓ₂} {P : Poset c ℓ₁ ℓ₂} → IsScottContinuous {P = P} {Q = P} id
138
165
ScottId = record
139
- { PreserveLub = λ dir-s lub z → z
166
+ { PreserveLub = λ dir lub z → z
140
167
; PreserveEquality = λ z → z }
141
168
142
169
scott-∘ : ∀ {c ℓ₁ ℓ₂} {P Q R : Poset c ℓ₁ ℓ₂}
143
170
→ (f : Poset.Carrier R → Poset.Carrier Q) (g : Poset.Carrier P → Poset.Carrier R)
144
171
→ IsScottContinuous {P = R} {Q = Q} f → IsScottContinuous {P = P} {Q = R} g
145
172
→ IsMonotone R Q f → IsMonotone P R g
146
173
→ IsScottContinuous {P = P} {Q = Q} (f ∘ g)
147
- scott-∘ f g scottf scottg monotonef monotoneg = record
148
- { PreserveLub = λ dir-s lub z → f.PreserveLub
149
- (monotone∘directed g monotoneg dir-s )
174
+ scott-∘ f g scottf scottg monof monog = record
175
+ { PreserveLub = λ dir lub z → f.PreserveLub
176
+ (monotone∘directed g monog dir)
150
177
(g lub)
151
- (g.PreserveLub dir-s lub z)
178
+ (g.PreserveLub dir lub z)
152
179
; PreserveEquality = λ {x} {y} z →
153
180
f.PreserveEquality (g.PreserveEquality z)
154
181
}
@@ -174,22 +201,29 @@ module Scott
174
201
(let module D = DCPO D)
175
202
(let module E = DCPO E)
176
203
(f : D.Carrier → E.Carrier)
204
+ (isScott : IsScottContinuous {P = D.poset} {Q = E.poset} f)
177
205
(mono : IsMonotone D.poset E.poset f) where
178
-
179
- res-directed-lub : ∀ {Ix} (s : Ix → D.Carrier)
180
- → IsDirectedFamily D.poset s
181
- → ∀ x → IsLub D.poset s x
182
- → IsLub E.poset (f ∘ s) (f x)
183
- res-directed-lub s dir x lub = {! !}
184
-
185
- directed : ∀ {Ix} {s : Ix → D.Carrier} → IsDirectedFamily D.poset s → IsDirectedFamily E.poset (f ∘ s)
186
- directed = monotone∘directed f mono
187
206
188
- pres-⋃
189
- : ∀ {Ix} (s : Ix → D.Carrier) → (dir : IsDirectedFamily D.poset s)
190
- → f (D.⋁ s dir) ≡ E.⋁ (f ∘ s) (monotone∘directed f mono dir)
191
- pres-⋃ s dir = {! !}
207
+ open DCPO D
208
+ open DCPO E
192
209
210
+ pres-⋁
211
+ : ∀ {Ix} (s : Ix → D.Carrier) → (dir : IsDirectedFamily D.poset s)
212
+ → f (D.⋁ s dir) E.≈ E.⋁ (f ∘ s) (monotone∘directed f mono dir)
213
+ pres-⋁ s dir = E.antisym
214
+ (IsLub.is-least
215
+ (IsScottContinuous.PreserveLub isScott dir (D.⋁ s dir) (D.⋁-isLub s dir))
216
+ (E.⋁ (f ∘ s) (monotone∘directed f mono dir))
217
+ E.⋁-≤
218
+ )
219
+ (IsLub.is-least
220
+ (E.⋁-isLub (f ∘ s) (monotone∘directed f mono dir))
221
+ (f (D.⋁ s dir))
222
+ (λ i → IsOrderHomomorphism.mono mono (D.⋁-≤ i))
223
+ )
224
+
225
+
226
+
193
227
module _ {c ℓ₁ ℓ₂} (D E : DCPO c ℓ₁ ℓ₂) where
194
228
private
195
229
module D = DCPO D
@@ -198,8 +232,8 @@ module _ {c ℓ₁ ℓ₂} (D E : DCPO c ℓ₁ ℓ₂) where
198
232
to-scott : (f : D.Carrier → E.Carrier) → IsMonotone D.poset E.poset f
199
233
→ (∀ {Ix} (s : Ix → D.Carrier) (dir : IsDirectedFamily D.poset s) →
200
234
IsLub E.poset (f ∘ s) (f (D.⋁ s dir))) → IsScottContinuous {P = D.poset} {Q = E.poset} f
201
- to-scott f monotone pres-⋃ = {! !}
202
-
203
- -- res-lub : ∀ {Ix} (s : Ix → D.Carrier) → ( dir : is-directed-family D.poset s)
204
- -- → ∀ x → is-lub D.poset s x → is-lub E.poset (f ⊙ s) (f x )
205
- -- pres-lub s dir x x-lub .is-lub.fam≤lub i = ?
235
+ to-scott f mono pres-⋁ = record
236
+ { PreserveLub = λ dir lub x → is-lub-cong E (f (D.⋁ _ dir)) (f lub)
237
+ (IsOrderHomomorphism.cong mono (uniqueLub D (D.⋁ _ dir) lub (D.⋁-isLub _ dir) x))
238
+ (pres-⋁ _ dir )
239
+ ; PreserveEquality = IsOrderHomomorphism.cong mono }
0 commit comments