-
Notifications
You must be signed in to change notification settings - Fork 252
[Add] Initial files for Domain theory #2721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
4486fd0
34be6b0
502e288
63810b7
87d5f16
51954b6
85192d0
ceb39d6
2384bd3
b753478
1e41d41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- Order-theoretic Domains | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --cubical-compatible --safe #-} | ||
|
||
module Relation.Binary.Domain where | ||
|
||
------------------------------------------------------------------------ | ||
-- Re-export various components of the Domain hierarchy | ||
|
||
open import Relation.Binary.Domain.Definitions public | ||
open import Relation.Binary.Domain.Structures public | ||
open import Relation.Binary.Domain.Bundles public |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- Bundles for domain theory | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --cubical-compatible --safe #-} | ||
|
||
module Relation.Binary.Domain.Bundles where | ||
|
||
open import Level using (Level; _⊔_; suc) | ||
open import Relation.Binary.Bundles using (Poset) | ||
open import Relation.Binary.Domain.Structures | ||
open import Relation.Binary.Domain.Definitions | ||
|
||
private | ||
variable | ||
o ℓ e o' ℓ' e' ℓ₂ : Level | ||
Ix A B : Set o | ||
|
||
------------------------------------------------------------------------ | ||
-- DCPOs | ||
------------------------------------------------------------------------ | ||
|
||
record DCPO (c ℓ₁ ℓ₂ : Level) : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where | ||
field | ||
poset : Poset c ℓ₁ ℓ₂ | ||
DcpoStr : IsDCPO poset | ||
|
||
open Poset poset public | ||
open IsDCPO DcpoStr public | ||
|
||
------------------------------------------------------------------------ | ||
-- Scott-continuous functions | ||
------------------------------------------------------------------------ | ||
|
||
record ScottContinuous {c ℓ₁ ℓ₂ : Level} {P : Poset c ℓ₁ ℓ₂} {Q : Poset c ℓ₁ ℓ₂} : | ||
Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where | ||
field | ||
f : Poset.Carrier P → Poset.Carrier Q | ||
Scottfunction : IsScottContinuous {P = P} {Q = Q} f | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
------------------------------------------------------------------------ | ||
-- Lubs | ||
------------------------------------------------------------------------ | ||
|
||
record Lub {c ℓ₁ ℓ₂ : Level} {P : Poset c ℓ₁ ℓ₂} {Ix : Set c} (s : Ix → Poset.Carrier P) : Set (c ⊔ ℓ₁ ⊔ ℓ₂) where | ||
private | ||
module P = Poset P | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
field | ||
lub : P.Carrier | ||
is-upperbound : ∀ i → P._≤_ (s i) lub | ||
is-least : ∀ y → (∀ i → P._≤_ (s i) y) → P._≤_ lub y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- Definitions for domain theory | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --cubical-compatible --safe #-} | ||
|
||
module Relation.Binary.Domain.Definitions where | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that neither of the definitions here depend on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I mean is that all 3 definitions below should be moved to |
||
|
||
open import Data.Product using (∃-syntax; _×_; _,_) | ||
open import Level using (Level; _⊔_) | ||
open import Relation.Binary.Bundles using (Poset) | ||
open import Relation.Binary.Morphism.Structures using (IsOrderHomomorphism) | ||
|
||
private | ||
variable | ||
c o ℓ e o' ℓ' e' ℓ₁ ℓ₂ : Level | ||
Ix A B : Set o | ||
P : Poset c ℓ e | ||
|
||
------------------------------------------------------------------------ | ||
-- Directed families | ||
------------------------------------------------------------------------ | ||
|
||
IsSemidirectedFamily : (P : Poset c ℓ₁ ℓ₂) → ∀ {Ix : Set c} → (s : Ix → Poset.Carrier P) → Set _ | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
IsSemidirectedFamily P {Ix} s = ∀ i j → ∃[ k ] (Poset._≤_ P (s i) (s k) × Poset._≤_ P (s j) (s k)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- Structures for domain theory | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --cubical-compatible --safe #-} | ||
|
||
module Relation.Binary.Domain.Structures where | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To 'fit' the rest of |
||
|
||
open import Data.Product using (_×_; _,_) | ||
open import Data.Nat.Properties using (≤-trans) | ||
open import Function using (_∘_) | ||
open import Level using (Level; _⊔_; suc) | ||
open import Relation.Binary.Bundles using (Poset) | ||
open import Relation.Binary.Domain.Definitions | ||
open import Relation.Binary.Morphism.Structures using (IsOrderHomomorphism) | ||
|
||
private variable | ||
o ℓ e o' ℓ' e' ℓ₂ : Level | ||
Ix A B : Set o | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
module _ {c ℓ₁ ℓ₂ : Level} (P : Poset c ℓ₁ ℓ₂) where | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do these definitions really need a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The definition doesn't need a Poset, but this is essentially always going to be used with a Poset/Preorder. Using a bare relation could cause rather poor inference later down the line, so I'd hesitate a bit on this generalization. We could also use a Preorder here, but that doesn't really buy us much. Doing posetal completions is really, really cheap with setoids, and the preorder versions of lemmas would be essentially the same thing as the plugging in a posetal completion to a poset-based version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Speaking of which: is posetal completion anywhere in the stdlib? |
||
open Poset P | ||
|
||
record IsDirectedFamily {Ix : Set c} (s : Ix → Carrier) : Set (c ⊔ ℓ₁ ⊔ ℓ₂) where | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
no-eta-equality | ||
field | ||
elt : Ix | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. elt stands for element, should I change it ? |
||
SemiDirected : IsSemidirectedFamily P s | ||
|
||
record IsLub {Ix : Set c} (s : Ix → Carrier) (lub : Carrier) : Set (c ⊔ ℓ₁ ⊔ ℓ₂) where | ||
field | ||
is-upperbound : ∀ i → s i ≤ lub | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
is-least : ∀ y → (∀ i → s i ≤ y) → lub ≤ y | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
record IsDCPO : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
field | ||
⋁ : ∀ {Ix : Set c} | ||
→ (s : Ix → Carrier) | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
→ IsDirectedFamily s | ||
→ Carrier | ||
⋁-isLub : ∀ {Ix : Set c} | ||
→ (s : Ix → Carrier) | ||
→ (dir : IsDirectedFamily s) | ||
→ IsLub s (⋁ s dir) | ||
|
||
module _ {Ix : Set c} {s : Ix → Carrier} {dir : IsDirectedFamily s} where | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the point of this module's renaming? Could we document it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the renaming to simplify domain properties proofs for instance in the following proof :
But let me know if changes are needed |
||
open IsLub (⋁-isLub s dir) | ||
renaming (is-upperbound to ⋁-≤; is-least to ⋁-least) | ||
public | ||
|
||
module _ {c ℓ₁ ℓ₂ : Level} {P : Poset c ℓ₁ ℓ₂} {Q : Poset c ℓ₁ ℓ₂} where | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
private | ||
module P = Poset P | ||
module Q = Poset Q | ||
|
||
record IsScottContinuous (f : P.Carrier → Q.Carrier) : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where | ||
field | ||
PreserveLub : ∀ {Ix : Set c} {s : Ix → P.Carrier} | ||
jmougeot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
→ (dir : IsDirectedFamily P s) | ||
→ (lub : P.Carrier) | ||
→ IsLub P s lub | ||
→ IsLub Q (f ∘ s) (f lub) | ||
PreserveEquality : ∀ {x y} → x P.≈ y → f x Q.≈ f y |
Uh oh!
There was an error while loading. Please reload this page.