Skip to content

Commit 0b3e5cd

Browse files
committed
fixes agda#2091
1 parent 3515c22 commit 0b3e5cd

File tree

4 files changed

+75
-35
lines changed

4 files changed

+75
-35
lines changed

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,20 @@ Additions to existing modules
8888

8989
* In `Function.Bundles`, added `_⟶ₛ_` as a synonym for `Func` that can
9090
be used infix.
91+
92+
* Added new definitions in `Relation.Binary`
93+
```
94+
Stable : Pred A ℓ → Set _
95+
```
96+
97+
* Added new definitions in `Relation.Nullary`
98+
```
99+
Recomputable : Set _
100+
WeaklyDecidable : Set _
101+
```
102+
103+
* Added new definitions in `Relation.Unary`
104+
```
105+
Stable : Pred A ℓ → Set _
106+
WeaklyDecidable : Pred A ℓ → Set _
107+
```

src/Relation/Binary/Definitions.agda

+23-20
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ module Relation.Binary.Definitions where
1212

1313
open import Agda.Builtin.Equality using (_≡_)
1414

15-
open import Data.Maybe.Base using (Maybe)
1615
open import Data.Product.Base using (_×_; ∃-syntax)
1716
open import Data.Sum.Base using (_⊎_)
1817
open import Function.Base using (_on_; flip)
1918
open import Level
2019
open import Relation.Binary.Core
21-
open import Relation.Nullary.Decidable.Core using (Dec)
22-
open import Relation.Nullary.Negation.Core using (¬_)
20+
open import Relation.Nullary as Nullary using (¬_; Dec)
2321

2422
private
2523
variable
@@ -206,35 +204,40 @@ P Respects₂ _∼_ = (P Respectsʳ _∼_) × (P Respectsˡ _∼_)
206204
Substitutive : Rel A ℓ₁ (ℓ₂ : Level) Set _
207205
Substitutive {A = A} _∼_ p = (P : A Set p) P Respects _∼_
208206

209-
-- Decidability - it is possible to determine whether a given pair of
210-
-- elements are related.
207+
-- Irrelevancy - all proofs that a given pair of elements are related
208+
-- are indistinguishable.
211209

212-
Decidable : REL A B ℓ Set _
213-
Decidable _∼_ = x y Dec (x ∼ y)
210+
Irrelevant : REL A B ℓ Set _
211+
Irrelevant _∼_ = {x y} Nullary.Irrelevant (x ∼ y)
212+
213+
-- Recomputability - we can rebuild a relevant proof given an
214+
-- irrelevant one.
215+
216+
Recomputable : REL A B ℓ Set _
217+
Recomputable _∼_ = {x y} Nullary.Recomputable (x ∼ y)
218+
219+
-- Stability
220+
221+
Stable : REL A B ℓ Set _
222+
Stable _∼_ = x y Nullary.Stable (x ∼ y)
214223

215224
-- Weak decidability - it is sometimes possible to determine if a given
216225
-- pair of elements are related.
217226

218227
WeaklyDecidable : REL A B ℓ Set _
219-
WeaklyDecidable _∼_ = x y Maybe (x ∼ y)
228+
WeaklyDecidable _∼_ = x y Nullary.WeaklyDecidable (x ∼ y)
229+
230+
-- Decidability - it is possible to determine whether a given pair of
231+
-- elements are related.
232+
233+
Decidable : REL A B ℓ Set _
234+
Decidable _∼_ = x y Dec (x ∼ y)
220235

221236
-- Propositional equality is decidable for the type.
222237

223238
DecidableEquality : (A : Set a) Set _
224239
DecidableEquality A = Decidable {A = A} _≡_
225240

226-
-- Irrelevancy - all proofs that a given pair of elements are related
227-
-- are indistinguishable.
228-
229-
Irrelevant : REL A B ℓ Set _
230-
Irrelevant _∼_ = {x y} (a b : x ∼ y) a ≡ b
231-
232-
-- Recomputability - we can rebuild a relevant proof given an
233-
-- irrelevant one.
234-
235-
Recomputable : REL A B ℓ Set _
236-
Recomputable _∼_ = {x y} .(x ∼ y) x ∼ y
237-
238241
-- Universal - all pairs of elements are related
239242

240243
Universal : REL A B ℓ Set _

src/Relation/Nullary.agda

+12-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
module Relation.Nullary where
1212

13-
open import Agda.Builtin.Equality
13+
open import Agda.Builtin.Equality using (_≡_)
14+
open import Agda.Builtin.Maybe public
15+
using (nothing; just)
16+
renaming (Maybe to WeaklyDecidable)
1417

1518
------------------------------------------------------------------------
1619
-- Re-exports
@@ -24,3 +27,11 @@ open import Relation.Nullary.Decidable.Core public
2427

2528
Irrelevant : {p} Set p Set p
2629
Irrelevant P = (p₁ p₂ : P) p₁ ≡ p₂
30+
31+
------------------------------------------------------------------------
32+
-- Recomputability - we can rebuild a relevant proof given an
33+
-- irrelevant one.
34+
35+
Recomputable : {p} Set p Set p
36+
Recomputable P = .P P
37+

src/Relation/Unary.agda

+23-14
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ open import Data.Product.Base using (_×_; _,_; Σ-syntax; ∃; uncurry; swap)
1414
open import Data.Sum.Base using (_⊎_; [_,_])
1515
open import Function.Base using (_∘_; _|>_)
1616
open import Level using (Level; _⊔_; 0ℓ; suc; Lift)
17-
open import Relation.Nullary.Decidable.Core using (Dec; True)
18-
open import Relation.Nullary.Negation.Core using (¬_)
17+
open import Relation.Nullary as Nullary using (¬_; Dec; True)
1918
open import Relation.Binary.PropositionalEquality.Core using (_≡_)
2019

2120
private
@@ -162,6 +161,28 @@ IUniversal P = ∀ {x} → x ∈ P
162161

163162
syntax IUniversal P = ∀[ P ]
164163

164+
-- Irrelevance - any two proofs that an element satifies P are
165+
-- indistinguishable.
166+
167+
Irrelevant : Pred A ℓ Set _
168+
Irrelevant P = {x} Nullary.Irrelevant (P x)
169+
170+
-- Recomputability - we can rebuild a relevant proof given an
171+
-- irrelevant one.
172+
173+
Recomputable : Pred A ℓ Set _
174+
Recomputable P = {x} Nullary.Recomputable (P x)
175+
176+
-- Weak Decidability
177+
178+
Stable : Pred A ℓ Set _
179+
Stable P = x Nullary.Stable (P x)
180+
181+
-- Weak Decidability
182+
183+
WeaklyDecidable : Pred A ℓ Set _
184+
WeaklyDecidable P = x Nullary.WeaklyDecidable (P x)
185+
165186
-- Decidability - it is possible to determine if an arbitrary element
166187
-- satisfies P.
167188

@@ -174,18 +195,6 @@ Decidable P = ∀ x → Dec (P x)
174195
⌊_⌋ : {P : Pred A ℓ} Decidable P Pred A ℓ
175196
⌊ P? ⌋ a = Lift _ (True (P? a))
176197

177-
-- Irrelevance - any two proofs that an element satifies P are
178-
-- indistinguishable.
179-
180-
Irrelevant : Pred A ℓ Set _
181-
Irrelevant P = {x} (a : P x) (b : P x) a ≡ b
182-
183-
-- Recomputability - we can rebuild a relevant proof given an
184-
-- irrelevant one.
185-
186-
Recomputable : Pred A ℓ Set _
187-
Recomputable P = {x} .(P x) P x
188-
189198
------------------------------------------------------------------------
190199
-- Operations on sets
191200

0 commit comments

Comments
 (0)