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 11 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
→ (scott : IsScottContinuous P Q f)
→ IsOrderHomomorphism (Poset._≈_ P) (Poset._≈_ Q) (Poset._≤_ P) (Poset._≤_ Q) f
DirectedCompletePartialOrder+scott→monotone P-DirectedCompletePartialOrder f scott = record
{ cong = λ {x} {y} x≈y → IsScottContinuous.preserveEquality scott x≈y
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't name implicits that you do not use. Try to eta-reduce too.

→ IsOrderHomomorphism (Poset._≈_ P) (Poset._≈_ Q) (Poset._≤_ P) (Poset._≤_ Q) f
DirectedCompletePartialOrder+scott→monotone P-DirectedCompletePartialOrder f scott = record
{ cong = λ {x} {y} x≈y → IsScottContinuous.preserveEquality scott x≈y
; mono = λ {x} {y} x≤y → mono-proof x y x≤y
Copy link
Contributor

Choose a reason for hiding this comment

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

See if you can get away with _ for x and y in the rhs. If so, then make them implicit in the proof below. Otherwise leave a comment about not being able to do that.

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.

IsLub-cong : ∀ {s : Ix → D.Carrier} → {x y : D.Carrier} → x D.≈ y →
IsLub D.poset s x → IsLub D.poset s y
IsLub-cong x≈y x-lub = record
{ isLeastUpperBound =
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would be clearer if the two parts were defined in a where clause

isMonotone : (P-DirectedCompletePartialOrder : IsDirectedCompletePartialOrder P) →
(f : P.Carrier → Q.Carrier) → (scott : IsScottContinuous P Q f) →
IsOrderHomomorphism P._≈_ Q._≈_ P._≤_ Q._≤_ f
isMonotone P-DirectedCompletePartialOrder f scott = record
Copy link
Contributor

Choose a reason for hiding this comment

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

scott -> cts. It is the fact that it is continuous that is important, not the fact that this is 'Scott' continuity. isCts would be fine too.

}

s-lub : IsLub P s y
s-lub = record { isLeastUpperBound = sx≤sfalse , (λ z proof → proof (lift false))}
Copy link
Contributor

Choose a reason for hiding this comment

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

elide z as it is not used.

IsDirectedFamily P s → IsDirectedFamily Q (f ∘ s)
map-directed f ismonotone dir = record
{ elt = IsDirectedFamily.elt dir
; isSemidirected = λ i j → let (k , s[i]≤s[k] , s[j]≤s[k]) = IsDirectedFamily.isSemidirected dir i j
Copy link
Contributor

Choose a reason for hiding this comment

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

put the rhs of isSemiDirected in the where clause to improve readability

module Q = Poset Q
module R = Poset R

ScottId : {P : Poset c ℓ₁ ℓ₂} → IsScottContinuous P P id
Copy link
Contributor

Choose a reason for hiding this comment

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

id-cts

{ preserveLub = λ _ _ → id
; cong = id }

scott-cong : (f : R.Carrier → Q.Carrier) (g : P.Carrier → R.Carrier) →
Copy link
Contributor

Choose a reason for hiding this comment

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

cts-cong

------------------------------------------------------------------------
-- Scott continuity module

module Scott
Copy link
Contributor

Choose a reason for hiding this comment

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

Scott -> ScottContinuity

EP = E.poset

module _ (f : D.Carrier → E.Carrier)
(isScott : IsScottContinuous DP EP f)
Copy link
Contributor

Choose a reason for hiding this comment

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

isScott -> isCts

(λ i → f.mono (D.⋁-≤ i))
)

to-scott : (∀ {Ix} (s : Ix → D.Carrier) (dir : IsDirectedFamily DP s) →
Copy link
Contributor

Choose a reason for hiding this comment

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

toScott -> isScottContinuous

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.

3 participants