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

Adds unary disjoint relation #2595

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -143,3 +143,16 @@ Additions to existing modules
```agda
filter-↭ : ∀ (P? : Pred.Decidable P) → xs ↭ ys → filter P? xs ↭ filter P? ys
```

* In `Relation.Unary`:
```agda
_⊥_ _⊥′_ : Pred A ℓ₁ → Pred A ℓ₂ → Set _
```

* In `Relation.Unary.Properties`:
```agda
≬-sym : Symmetric {A = Pred A ℓ₁} _≬_
⊥-sym : Symmetric {A = Pred A ℓ₁} _⊥_
≬⇒¬⊥ : Binary._⇒_ {A = Pred A ℓ₁} {B = Pred A ℓ₂} _≬_ (¬_ ∘₂ _⊥_)
⊥⇒¬≬ : Binary._⇒_ {A = Pred A ℓ₁} {B = Pred A ℓ₂} _⊥_ (¬_ ∘₂ _≬_)
```
10 changes: 9 additions & 1 deletion src/Relation/Unary.agda
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ infixr 8 _⇒_
infixr 7 _∩_
infixr 6 _∪_
infixr 6 _∖_
infix 4 _≬_
infix 4 _≬_ _⊥_ _⊥′_

-- Complement.

@@ -253,6 +253,14 @@ syntax ⋂ I (λ i → P) = ⋂[ i ∶ I ] P
_≬_ : Pred A ℓ₁ → Pred A ℓ₂ → Set _
P ≬ Q = ∃ λ x → x ∈ P × x ∈ Q

-- Disjoint

_⊥_ : Pred A ℓ₁ → Pred A ℓ₂ → Set _
P ⊥ Q = P ∩ Q ⊆ ∅

_⊥′_ : Pred A ℓ₁ → Pred A ℓ₂ → Set _
P ⊥′ Q = P ∩ Q ⊆′ ∅

-- Update.

_⊢_ : (A → B) → Pred B ℓ → Pred A ℓ
18 changes: 17 additions & 1 deletion src/Relation/Unary/Properties.agda
Original file line number Diff line number Diff line change
@@ -18,7 +18,8 @@ open import Relation.Binary.Definitions
open import Relation.Binary.PropositionalEquality.Core using (refl; _≗_)
open import Relation.Unary
open import Relation.Nullary.Decidable as Dec using (yes; no; _⊎-dec_; _×-dec_; ¬?; map′; does)
open import Function.Base using (id; _$_; _∘_)
open import Relation.Nullary.Negation.Core using (¬_)
open import Function.Base using (id; _$_; _∘_; _∘₂_)

private
variable
@@ -197,6 +198,21 @@ U-Universal = λ _ → _
≐′⇒≐ : Binary._⇒_ {A = Pred A ℓ₁} {B = Pred A ℓ₂} _≐′_ _≐_
≐′⇒≐ = Product.map ⊆′⇒⊆ ⊆′⇒⊆

------------------------------------------------------------------------
-- Between/Disjoint properties

≬-sym : Symmetric {A = Pred A ℓ₁} _≬_
≬-sym = Product.map₂ swap

⊥-sym : Symmetric {A = Pred A ℓ₁} _⊥_
⊥-sym = _∘ swap

≬⇒¬⊥ : Binary._⇒_ {A = Pred A ℓ₁} {B = Pred A ℓ₂} _≬_ (¬_ ∘₂ _⊥_)
≬⇒¬⊥ P≬Q ¬P⊥Q = ¬P⊥Q (Product.proj₂ P≬Q)

⊥⇒¬≬ : Binary._⇒_ {A = Pred A ℓ₁} {B = Pred A ℓ₂} _⊥_ (¬_ ∘₂ _≬_)
⊥⇒¬≬ P⊥Q = P⊥Q ∘ Product.proj₂

------------------------------------------------------------------------
-- Decidability properties