Skip to content

[Add] Properties for DCPOs in Relation.Binary.Properties.Domain #2734

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

jmougeot
Copy link
Contributor

This pull request introduces new modules and properties for directed complete partial orders (DCPOs) in the Agda standard library. These additions are adapted from the 1Lab library.

The first part of this pull request is available at [Add] Initial files for Domain theory #2721 .
Please comment only on the src/Relation/Binary/Properties/Domain.agda file here

Key Changes:

1. Properties of Least Upper Bounds:

  • Added uniqueLub: Proves the uniqueness of least upper bounds.
  • Added IsLub-cong: Demonstrates congruence of least upper bounds under equivalence.

2. Scott Continuity and Monotonicity:

  • Added DirectedCompletePartialOrder+scott→monotone: Proves that Scott continuous functions are monotone.
  • Added monotone∘directed: Shows that monotone functions preserve directed families.

3. Scott Continuous Functions:

  • Added ScottId: Identity function as a Scott continuous function.
  • Added scott-∘: Composition of Scott continuous functions.

4. Suprema and Pointwise Ordering:

  • Added ⋃-pointwise : Proves pointwise ordering of suprema in directed families.

5. Scott Continuity Module:

  • Added pres-⋁ : Proves preservation of least upper bounds under Scott continuous functions.

6. Conversion to Scott Continuity:

-Added to-scott: Converts monotone functions with preservation of least upper bounds into Scott continuous functions.

Source :

1Lab library

@jmougeot jmougeot changed the title [Add} Properties for Directed Complete Partial Orders in Relation.Binary.Properties.Domain [Add] Properties for DCPOs in Relation.Binary.Properties.Domain Jun 11, 2025
record IsScottContinuous (f : P.Carrier → Q.Carrier)
: Set (suc (c₁ ⊔ ℓ₁₁ ⊔ ℓ₁₂ ⊔ c₂ ⊔ ℓ₂₁ ⊔ ℓ₂₂)) where
field
preserveLub : ∀ {B : Set c₁} {g : B → P.Carrier}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this layout is as per the style guide.

Copy link
Contributor

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good - but depends on a previous PR, so cannot be merged in quite yet.

@JacquesCarette
Copy link
Contributor

Could we get another review? @jamesmckinna ? @MatthewDaggitt ?

------------------------------------------------------------------------

-- IsSemidirectedFamily : (P : Poset c ℓ₁ ℓ₂) → ∀ {Ix : Set c} → (s : Ix → Poset.Carrier P) → Set _
-- IsSemidirectedFamily P {Ix} s = ∀ i j → ∃[ k ] (Poset._≤_ P (s i) (s k) × Poset._≤_ P (s j) (s k))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should either be removed or uncommented?

-- IsSemidirectedFamily : (P : Poset c ℓ₁ ℓ₂) → ∀ {Ix : Set c} → (s : Ix → Poset.Carrier P) → Set _
-- IsSemidirectedFamily P {Ix} s = ∀ i j → ∃[ k ] (Poset._≤_ P (s i) (s k) × Poset._≤_ P (s j) (s k))

semidirected : {A : Set a} → Rel A ℓ → (B : Set b) → (B → A) → Set _
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implicit {A} is already available as a variable? Can B not be made implicit as well? It feels like it should be inferable from B -> A?

-- Least upper bounds
------------------------------------------------------------------------

leastupperbound : {A : Set a} → Rel A ℓ → (B : Set b) → (B → A) → A → Set _
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The capitalisation on this name is odd. Same comments as before though.





Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too much whitespace.

A B : Set a


module _ {c ℓ₁ ℓ₂ : Level} (P : Poset c ℓ₁ ℓ₂) where
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c ℓ₁ ℓ₂ already exist as variables.

isLeast : ∀ y → (∀ i → f i ≤ y) → lub ≤ y
isLeast = proj₂ isLeastUpperBound

record IsDirectedFamily {b : Level} {B : Set b} (f : B → Carrier)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of variables

open Poset P

record IsLub {b : Level} {B : Set b} (f : B → Carrier)
(lub : Carrier) : Set (b ⊔ c ⊔ ℓ₁ ⊔ ℓ₂) where
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of this record if it just wraps leastupperbound?

module _ {B : Set c} {f : B → Carrier} {dir : IsDirectedFamily f} where
open IsLub (⋁-isLub f dir)
renaming (isUpperBound to ⋁-≤; isLeast to ⋁-least)
public
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public should before renaming according to the style guide

elt : B
isSemidirected : semidirected _≤_ B f

record IsDirectedCompletePartialOrder : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These levels look deeply suspicious. It feels like the c level shouldn't exposed in the interface. I know you'll run into level problems in the type of the record if you internalise it so I'm not sure what the solution is, but it feels like a strong code smell.

: Set (b ⊔ c ⊔ ℓ₁ ⊔ ℓ₂) where
no-eta-equality
field
elt : B
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this simply trying to encode the fact that B is non-empty? Wouldn't be better to define and use a NonEmpty type (probably defining it in Relation.Nullary if it is not already there)

@JacquesCarette
Copy link
Contributor

I've asked @e-mniang to take over this PR.

@jamesmckinna
Copy link
Contributor

I've asked @e-mniang to take over this PR.

And so... I'll come back to review once they've had a chance to grok the details, and @MatthewDaggitt 's initial feedback... and I've recovered some bandwidth after the latest round of comments on #2795 and #2769 ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants