Skip to content
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

Ob #453: added Dense relations and DenseLinearOrder #2111

Merged
merged 9 commits into from
Oct 2, 2023
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3019,6 +3019,7 @@ Additions to existing modules

* Added new definitions in `Relation.Binary.Definitions`:
```
Dense _<_ = ∀ {x y} → x < y → ∃[ z ] x < z × z < y
Cotransitive _#_ = ∀ {x y} → x # y → ∀ z → (x # z) ⊎ (z # y)
Tight _≈_ _#_ = ∀ x y → (¬ x # y → x ≈ y) × (x ≈ y → ¬ x # y)

Expand All @@ -3033,11 +3034,13 @@ Additions to existing modules

* Added new definitions in `Relation.Binary.Bundles`:
```
record DenseLinearOrder c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
record ApartnessRelation c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
```

* Added new definitions in `Relation.Binary.Structures`:
```
record IsDenseLinearOrder (_<_ : Rel A ℓ₂) : Set (a ⊔ ℓ ⊔ ℓ₂) where
record IsApartnessRelation (_#_ : Rel A ℓ₂) : Set (a ⊔ ℓ ⊔ ℓ₂) where
```

Expand Down
1 change: 1 addition & 0 deletions src/Data/Tree/AVL/Indexed/WithK.agda
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Data.Tree.AVL.Indexed.WithK
{k r} (Key : Set k) {_<_ : Rel Key r}
(isStrictTotalOrder : IsStrictTotalOrder _≡_ _<_) where

strictTotalOrder : StrictTotalOrder _ _ _
strictTotalOrder = record { isStrictTotalOrder = isStrictTotalOrder }

open import Data.Tree.AVL.Indexed strictTotalOrder as AVL hiding (Value)
Expand Down
4 changes: 3 additions & 1 deletion src/Data/Tree/AVL/NonEmpty/Propositional.agda
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ module Data.Tree.AVL.NonEmpty.Propositional

open import Level

private strictTotalOrder = record { isStrictTotalOrder = isStrictTotalOrder}
private
strictTotalOrder : StrictTotalOrder _ _ _
strictTotalOrder = record { isStrictTotalOrder = isStrictTotalOrder}
open import Data.Tree.AVL.Value (StrictTotalOrder.Eq.setoid strictTotalOrder)
import Data.Tree.AVL.NonEmpty strictTotalOrder as AVL⁺

Expand Down
17 changes: 17 additions & 0 deletions src/Relation/Binary/Bundles.agda
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,23 @@ record StrictTotalOrder c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) wh
Please use Eq.decSetoid instead."
#-}

record DenseLinearOrder c ℓ₁ ℓ₂ : Set (suc (c ⊔ ℓ₁ ⊔ ℓ₂)) where
infix 4 _≈_ _<_
field
Carrier : Set c
_≈_ : Rel Carrier ℓ₁
_<_ : Rel Carrier ℓ₂
isDenseLinearOrder : IsDenseLinearOrder _≈_ _<_

open IsDenseLinearOrder isDenseLinearOrder public

strictTotalOrder : StrictTotalOrder c ℓ₁ ℓ₂
strictTotalOrder = record
{ isStrictTotalOrder = isStrictTotalOrder
}

--open StrictTotalOrder strictTotalOrder public
jamesmckinna marked this conversation as resolved.
Show resolved Hide resolved


------------------------------------------------------------------------
-- Apartness relations
Expand Down
7 changes: 6 additions & 1 deletion src/Relation/Binary/Definitions.agda
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Relation.Binary.Definitions where
open import Agda.Builtin.Equality using (_≡_)

open import Data.Maybe.Base using (Maybe)
open import Data.Product.Base using (_×_)
open import Data.Product.Base using (_×_; ∃-syntax)
open import Data.Sum.Base using (_⊎_)
open import Function.Base using (_on_; flip)
open import Level
Expand Down Expand Up @@ -88,6 +88,11 @@ Irreflexive _≈_ _<_ = ∀ {x y} → x ≈ y → ¬ (x < y)
Asymmetric : Rel A ℓ → Set _
Asymmetric _<_ = ∀ {x y} → x < y → ¬ (y < x)

-- Density

Dense : Rel A ℓ → Set _
Dense _<_ = ∀ {x y} → x < y → ∃[ z ] x < z × z < y

-- Generalised connex - exactly one of the two relations holds.

Connex : REL A B ℓ₁ → REL B A ℓ₂ → Set _
Expand Down
8 changes: 8 additions & 0 deletions src/Relation/Binary/Structures.agda
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@ record IsStrictTotalOrder (_<_ : Rel A ℓ₂) : Set (a ⊔ ℓ ⊔ ℓ₂) wher
using (irrefl; asym; <-respʳ-≈; <-respˡ-≈; <-resp-≈)


record IsDenseLinearOrder (_<_ : Rel A ℓ₂) : Set (a ⊔ ℓ ⊔ ℓ₂) where
field
isStrictTotalOrder : IsStrictTotalOrder _<_
dense : Dense _<_

open IsStrictTotalOrder isStrictTotalOrder public


------------------------------------------------------------------------
-- Apartness relations
------------------------------------------------------------------------
Expand Down
Loading