Skip to content

Commit dd64a3a

Browse files
authored
[ fix ] Relation.Nullary.Decidable.Core names for combinators (#2843)
* refactor: fixes #2842 * refactor: knock-ons * refactor: more knock-ons * refactor: resolve merge conflict following #2793
1 parent 133bdb1 commit dd64a3a

File tree

44 files changed

+166
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+166
-126
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ Deprecated names
5959
¬∀⟶∃¬- ↦ ¬∀⇒∃¬
6060
```
6161

62+
* In `Relation.Nullary.Decidable.Core`:
63+
```agda
64+
⊤-dec ↦ ⊤?
65+
⊥-dec ↦ ⊥?
66+
_×-dec_ ↦ _×?_
67+
_⊎-dec_ ↦ _⊎?_
68+
_→-dec_ ↦ _→?_
69+
6270
* In `Relation.Nullary.Negation`:
6371
```agda
6472
∃⟶¬∀¬ ↦ ∃⇒¬∀¬

doc/README/Design/Decidability.agda

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ suc m ≟₂ suc n = map′ (cong suc) suc-injective (m ≟₂ n)
106106
_ : (m n : ℕ) does (5 + m ≟₂ 3 + n) ≡ does (2 + m ≟₂ n)
107107
_ = λ m n refl
108108

109-
-- `map′` can be used in conjunction with combinators such as `_⊎-dec_` and
110-
-- `_×-dec_` to build complex (simply typed) decision procedures.
109+
-- `map′` can be used in conjunction with combinators such as `_⊎?_` and
110+
-- `_×?_` to build complex (simply typed) decision procedures.
111111

112112
module ListDecEq₀ {a} {A : Set a} (_≟ᴬ_ : (x y : A) Dec (x ≡ y)) where
113113

@@ -116,13 +116,13 @@ module ListDecEq₀ {a} {A : Set a} (_≟ᴬ_ : (x y : A) → Dec (x ≡ y)) whe
116116
[] ≟ᴸᴬ (y ∷ ys) = no λ ()
117117
(x ∷ xs) ≟ᴸᴬ [] = no λ ()
118118
(x ∷ xs) ≟ᴸᴬ (y ∷ ys) =
119-
map′ (uncurry (cong₂ _∷_)) ∷-injective (x ≟ᴬ y ×-dec xs ≟ᴸᴬ ys)
119+
map′ (uncurry (cong₂ _∷_)) ∷-injective (x ≟ᴬ y ×? xs ≟ᴸᴬ ys)
120120

121121
-- The final case says that `x ∷ xs ≡ y ∷ ys` exactly when `x ≡ y` *and*
122122
-- `xs ≡ ys`. The proofs are updated by the first two arguments to `map′`.
123123

124124
-- In the case of ≡-equality tests, the pattern
125-
-- `map′ (congₙ c) c-injective (x₀ ≟ y₀ ×-dec ... ×-dec xₙ₋₁ ≟ yₙ₋₁)`
125+
-- `map′ (congₙ c) c-injective (x₀ ≟ y₀ ×? ... ×? xₙ₋₁ ≟ yₙ₋₁)`
126126
-- is captured by `≟-mapₙ n c c-injective (x₀ ≟ y₀) ... (xₙ₋₁ ≟ yₙ₋₁)`.
127127

128128
module ListDecEq₁ {a} {A : Set a} (_≟ᴬ_ : (x y : A) Dec (x ≡ y)) where

src/Data/Fin/Properties.agda

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ open import Relation.Binary.PropositionalEquality.Properties as ≡
4848
open import Relation.Binary.PropositionalEquality as ≡
4949
using (≡-≟-identity; ≢-≟-identity)
5050
open import Relation.Nullary.Decidable as Dec
51-
using (Dec; _because_; yes; no; _×-dec_; _⊎-dec_; map′; decidable-stable)
51+
using (Dec; _because_; yes; no; _×?_; _⊎?_; map′; decidable-stable)
5252
open import Relation.Nullary.Negation.Core
5353
using (¬_; contradiction; contradiction′)
5454
open import Relation.Nullary.Reflects using (invert)
@@ -1025,11 +1025,11 @@ module _ {P : Pred (Fin (suc n)) p} where
10251025

10261026
any? : {P : Pred (Fin n) p} Decidable P Dec (∃ P)
10271027
any? {zero} P? = no λ{ (() , _) }
1028-
any? {suc _} P? = Dec.map ⊎⇔∃ (P? zero ⊎-dec any? (P? ∘ suc))
1028+
any? {suc _} P? = Dec.map ⊎⇔∃ (P? zero ⊎? any? (P? ∘ suc))
10291029

10301030
all? : {P : Pred (Fin n) p} Decidable P Dec ( i P i)
10311031
all? {zero} P? = yes λ()
1032-
all? {suc _} P? = Dec.map ∀-cons-⇔ (P? zero ×-dec all? (P? ∘ suc))
1032+
all? {suc _} P? = Dec.map ∀-cons-⇔ (P? zero ×? all? (P? ∘ suc))
10331033

10341034
private
10351035
-- A nice computational property of `all?`:
@@ -1104,7 +1104,7 @@ decFinSubset {suc _} {P = P} {Q = Q} Q? P? = dec[Q⊆P]
11041104
dec[Q⊆P] : Dec (Q ⊆ P)
11051105
dec[Q⊆P] with Q? zero
11061106
... | no ¬q₀ = map′ (cons (contradiction′ ¬q₀)) Q⊆P⇒Q⊆ₛP ih
1107-
... | yes q₀ = map′ (uncurry (cons ∘ const)) < _$ q₀ , Q⊆P⇒Q⊆ₛP > (P? q₀ ×-dec ih)
1107+
... | yes q₀ = map′ (uncurry (cons ∘ const)) < _$ q₀ , Q⊆P⇒Q⊆ₛP > (P? q₀ ×? ih)
11081108

11091109
------------------------------------------------------------------------
11101110
-- Properties of functions to and from Fin
@@ -1148,7 +1148,7 @@ cantor-schröder-bernstein f-inj g-inj = ℕ.≤-antisym
11481148
injective⇒existsPivot : {f : Fin n Fin m} Injective _≡_ _≡_ f
11491149
(i : Fin n) λ j j ≤ i × i ≤ f j
11501150
injective⇒existsPivot {f = f} f-injective i
1151-
with any? (λ j j ≤? i ×-dec i ≤? f j)
1151+
with any? (λ j j ≤? i ×? i ≤? f j)
11521152
... | yes result = result
11531153
... | no ¬result = contradiction′ notInjective-Fin[1+n]→Fin[n] f∘inject!-injective
11541154
where

src/Data/Fin/Subset/Properties.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ open import Relation.Binary.PropositionalEquality.Core
4646
using (_≡_; refl; cong; cong₂; subst; _≢_; sym)
4747
open import Relation.Binary.PropositionalEquality.Properties
4848
using (module ≡-Reasoning; isEquivalence)
49-
open import Relation.Nullary.Decidable as Dec using (Dec; yes; no; _⊎-dec_)
49+
open import Relation.Nullary.Decidable as Dec using (Dec; yes; no; _⊎?_)
5050
open import Relation.Nullary.Negation using (contradiction)
5151
open import Relation.Unary using (Pred; Decidable; Satisfiable)
5252

@@ -879,7 +879,7 @@ module _ {P : Pred (Subset (suc n)) ℓ} where
879879
anySubset? : {P : Pred (Subset n) ℓ} Decidable P Dec ∃⟨ P ⟩
880880
anySubset? {n = zero} P? = Dec.map ∃-Subset-[]-⇔ (P? [])
881881
anySubset? {n = suc n} P? = Dec.map ∃-Subset-∷-⇔
882-
(anySubset? (P? ∘ (inside ∷_)) ⊎-dec anySubset? (P? ∘ (outside ∷_)))
882+
(anySubset? (P? ∘ (inside ∷_)) ⊎? anySubset? (P? ∘ (outside ∷_)))
883883

884884

885885

src/Data/List/Fresh/Relation/Unary/All.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ open import Data.Product.Base using (_×_; _,_; proj₁; uncurry)
1414
open import Data.Sum.Base as Sum using (inj₁; inj₂; [_,_]′)
1515
open import Function.Base using (_∘_; _$_)
1616
open import Level using (Level; _⊔_; Lift)
17-
open import Relation.Nullary.Decidable as Dec using (Dec; yes; no; _×-dec_)
17+
open import Relation.Nullary.Decidable as Dec using (Dec; yes; no; _×?_)
1818
open import Relation.Unary as U
1919
using (Pred; IUniversal; Universal; Decidable; _⇒_; _∪_; _∩_)
2020
open import Relation.Binary.Core using (Rel)
@@ -67,7 +67,7 @@ module _ {R : Rel A r} {P : Pred A p} (P? : Decidable P) where
6767

6868
all? : (xs : List# A R) Dec (All P xs)
6969
all? [] = yes []
70-
all? (x ∷# xs) = Dec.map′ (uncurry _∷_) uncons (P? x ×-dec all? xs)
70+
all? (x ∷# xs) = Dec.map′ (uncurry _∷_) uncons (P? x ×? all? xs)
7171

7272
------------------------------------------------------------------------
7373
-- Generalised decidability procedure

src/Data/List/Fresh/Relation/Unary/Any.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ open import Data.Sum.Base using (_⊎_; [_,_]′; inj₁; inj₂)
1515
open import Function.Bundles using (_⇔_; mk⇔)
1616
open import Level using (Level; _⊔_; Lift)
1717
open import Relation.Nullary.Negation using (¬_; contradiction)
18-
open import Relation.Nullary.Decidable as Dec using (Dec; no; _⊎-dec_)
18+
open import Relation.Nullary.Decidable as Dec using (Dec; no; _⊎?_)
1919
open import Relation.Unary as U using (Pred; IUniversal; Universal; Decidable; _⇒_; _∪_; _∩_)
2020
open import Relation.Binary.Core using (Rel)
2121

@@ -78,4 +78,4 @@ module _ {R : Rel A r} {P : Pred A p} (P? : Decidable P) where
7878

7979
any? : (xs : List# A R) Dec (Any P xs)
8080
any? [] = no (λ ())
81-
any? (x ∷# xs) = Dec.map ⊎⇔Any (P? x ⊎-dec any? xs)
81+
any? (x ∷# xs) = Dec.map ⊎⇔Any (P? x ⊎? any? xs)

src/Data/List/Relation/Binary/Infix/Heterogeneous/Properties.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ open import Data.Nat.Base using (zero; suc; _≤_)
2323
import Data.Nat.Properties as ℕ
2424
open import Data.Sum.Base using (_⊎_; inj₁; inj₂; [_,_]′)
2525
open import Function.Base using (case_of_; _$′_)
26-
open import Relation.Nullary.Decidable using (yes; no; does; map′; _⊎-dec_)
26+
open import Relation.Nullary.Decidable using (yes; no; does; map′; _⊎?_)
2727
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
2828
open import Relation.Unary as U using (Pred)
2929
open import Relation.Binary.Core using (REL; _⇒_)
@@ -167,4 +167,4 @@ infix? R? [] [] = yes (here [])
167167
infix? R? (a ∷ as) [] = no (λ where (here ()))
168168
infix? R? as bbs@(_ ∷ bs) =
169169
map′ [ here , there ]′ ∷⁻
170-
(Prefix.prefix? R? as bbs ⊎-dec infix? R? as bs)
170+
(Prefix.prefix? R? as bbs ⊎? infix? R? as bs)

src/Data/List/Relation/Binary/Lex.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ open import Function.Bundles using (_⇔_; mk⇔)
1919
open import Level using (_⊔_)
2020
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
2121
open import Relation.Nullary.Decidable as Dec
22-
using (Dec; yes; no; _×-dec_; _⊎-dec_)
22+
using (Dec; yes; no; _×?_; _⊎?_)
2323
open import Relation.Binary.Core using (Rel)
2424
open import Relation.Binary.Structures using (IsEquivalence)
2525
open import Relation.Binary.Definitions
@@ -116,4 +116,4 @@ module _ {a ℓ₁ ℓ₂} {A : Set a} {P : Set}
116116
decidable [] (y ∷ ys) = yes halt
117117
decidable (x ∷ xs) [] = no λ()
118118
decidable (x ∷ xs) (y ∷ ys) =
119-
Dec.map ∷<∷-⇔ (dec-≺ x y ⊎-dec (dec-≈ x y ×-dec decidable xs ys))
119+
Dec.map ∷<∷-⇔ (dec-≺ x y ⊎? (dec-≈ x y ×? decidable xs ys))

src/Data/List/Relation/Binary/Pointwise/Properties.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ open import Level
1616
open import Relation.Binary.Core using (REL; _⇒_)
1717
open import Relation.Binary.Definitions
1818
open import Relation.Binary.PropositionalEquality.Core as ≡ using (_≡_)
19-
open import Relation.Nullary using (yes; no; _×-dec_)
19+
open import Relation.Nullary using (yes; no; _×?_)
2020
import Relation.Nullary.Decidable as Dec
2121

2222
open import Data.List.Relation.Binary.Pointwise.Base
@@ -71,7 +71,7 @@ decidable _ [] [] = yes []
7171
decidable _ [] (y ∷ ys) = no λ()
7272
decidable _ (x ∷ xs) [] = no λ()
7373
decidable R? (x ∷ xs) (y ∷ ys) = Dec.map′ (uncurry _∷_) uncons
74-
(R? x y ×-dec decidable R? xs ys)
74+
(R? x y ×? decidable R? xs ys)
7575

7676
irrelevant : Irrelevant R Irrelevant (Pointwise R)
7777
irrelevant irr [] [] = ≡.refl

src/Data/List/Relation/Binary/Prefix/Heterogeneous/Properties.agda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ open import Relation.Binary.Definitions
2828
open import Relation.Binary.PropositionalEquality.Core
2929
using (_≡_; _≢_; refl; cong₂)
3030
open import Relation.Nullary.Decidable.Core as Dec
31-
using (_×-dec_; yes; no; _because_)
31+
using (_×?_; yes; no; _because_)
3232
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
3333
open import Relation.Unary as U using (Pred)
3434

@@ -221,4 +221,4 @@ module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} where
221221
prefix? R? [] bs = yes []
222222
prefix? R? (a ∷ as) [] = no (λ ())
223223
prefix? R? (a ∷ as) (b ∷ bs) = Dec.map′ (uncurry _∷_) uncons
224-
$ R? a b ×-dec prefix? R? as bs
224+
$ R? a b ×? prefix? R? as bs

0 commit comments

Comments
 (0)