Skip to content

Commit 660bd65

Browse files
Saransh-cppMatthewDaggitt
authored andcommitted
Rename and deprecate excluded-middle (#2026)
1 parent ed293b5 commit 660bd65

File tree

7 files changed

+20
-11
lines changed

7 files changed

+20
-11
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,8 @@ Non-backwards compatible changes
881881
lookup : All P xs → (∀ {x} → x ∈ₚ xs → P x)
882882
lookupₛ : P Respects _≈_ → All P xs → (∀ {x} → x ∈ xs → P x)
883883
```
884-
884+
* `excluded-middle` in `Relation.Nullary.Decidable.Core` has been renamed to
885+
`¬¬-excluded-middle`.
885886
886887
Major improvements
887888
------------------

src/Axiom/DoubleNegationElimination.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ em⇒dne : ∀ {ℓ} → ExcludedMiddle ℓ → DoubleNegationElimination ℓ
3232
em⇒dne em = decidable-stable em
3333

3434
dne⇒em : {ℓ} DoubleNegationElimination ℓ ExcludedMiddle ℓ
35-
dne⇒em dne = dne excluded-middle
35+
dne⇒em dne = dne ¬¬-excluded-middle

src/Codata/Musical/Colist.agda

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ open import Relation.Binary.PropositionalEquality as P using (_≡_)
3636
open import Relation.Nullary.Reflects using (invert)
3737
open import Relation.Nullary
3838
open import Relation.Nullary.Negation
39-
open import Relation.Nullary.Decidable using (excluded-middle)
39+
open import Relation.Nullary.Decidable using (¬¬-excluded-middle)
4040
open import Relation.Unary using (Pred)
4141

4242
private
@@ -244,7 +244,7 @@ not-finite-is-infinite (x ∷ xs) hyp =
244244

245245
finite-or-infinite :
246246
(xs : Colist A) ¬ ¬ (Finite xs ⊎ Infinite xs)
247-
finite-or-infinite xs = helper <$> excluded-middle
247+
finite-or-infinite xs = helper <$> ¬¬-excluded-middle
248248
where
249249
helper : Dec (Finite xs) Finite xs ⊎ Infinite xs
250250
helper ( true because [fin]) = inj₁ (invert [fin])

src/Data/List/Membership/Propositional/Properties.agda

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import Relation.Nullary.Reflects as Reflects
4444
open import Relation.Nullary.Reflects using (invert)
4545
open import Relation.Nullary using (¬_; Dec; does; yes; no; _because_)
4646
open import Relation.Nullary.Negation using (contradiction)
47-
open import Relation.Nullary.Decidable using (excluded-middle)
47+
open import Relation.Nullary.Decidable using (¬¬-excluded-middle)
4848

4949
private
5050
open module ListMonad {ℓ} = RawMonad (monad {ℓ = ℓ})
@@ -345,7 +345,7 @@ module _ {_•_ : Op₂ A} where
345345

346346
finite : (f : ℕ ↣ A) xs ¬ ( i Injection.to f ⟨$⟩ i ∈ xs)
347347
finite inj [] fᵢ∈[] = ¬Any[] (fᵢ∈[] 0)
348-
finite inj (x ∷ xs) fᵢ∈x∷xs = excluded-middle helper
348+
finite inj (x ∷ xs) fᵢ∈x∷xs = ¬¬-excluded-middle helper
349349
where
350350
open Injection inj renaming (injective to f-inj)
351351

src/Effect/Monad/Partiality.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ module _ {A : Set a} {_∼_ : A → A → Set ℓ} where
401401
now-or-never : Reflexive _∼_
402402
{k} (x : A ⊥)
403403
¬ ¬ ((∃ λ y x ⇓[ other k ] y) ⊎ x ⇑[ other k ])
404-
now-or-never refl x = helper <$> excluded-middle
404+
now-or-never refl x = helper <$> ¬¬-excluded-middle
405405
where
406406
open RawMonad ¬¬-Monad
407407

src/Relation/Nullary/Decidable/Core.agda

+9-1
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,13 @@ decidable-stable (no ¬p) ¬¬p = ⊥-elim (¬¬p ¬p)
176176
-- A double-negation-translated variant of excluded middle (or: every
177177
-- nullary relation is decidable in the double-negation monad).
178178

179+
¬¬-excluded-middle : DoubleNegation (Dec P)
180+
¬¬-excluded-middle ¬h = ¬h (no (λ p ¬h (yes p)))
181+
179182
excluded-middle : DoubleNegation (Dec P)
180-
excluded-middle ¬h = ¬h (no (λ p ¬h (yes p)))
183+
excluded-middle = ¬¬-excluded-middle
184+
185+
{-# WARNING_ON_USAGE excluded-middle
186+
"Warning: excluded-middle was deprecated in v2.0.
187+
Please use ¬¬-excluded-middle instead."
188+
#-}

src/Relation/Nullary/Negation.agda

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ open import Data.Product.Base as Prod using (_,_; Σ; Σ-syntax; ∃; curry; unc
1515
open import Data.Sum.Base as Sum using (_⊎_; inj₁; inj₂; [_,_])
1616
open import Function.Base using (flip; _∘_; const; _∘′_)
1717
open import Level using (Level)
18-
open import Relation.Nullary.Decidable.Core using (Dec; yes; no; excluded-middle)
18+
open import Relation.Nullary.Decidable.Core using (Dec; yes; no; ¬¬-excluded-middle)
1919
open import Relation.Unary using (Universal)
2020

2121
private
@@ -85,7 +85,7 @@ call/cc hyp ¬p = hyp (λ p → ⊥-elim (¬p p)) ¬p
8585

8686
independence-of-premise : {R : Q Set r}
8787
Q (P Σ Q R) DoubleNegation (Σ[ x ∈ Q ] (P R x))
88-
independence-of-premise {P = P} q f = ¬¬-map helper excluded-middle
88+
independence-of-premise {P = P} q f = ¬¬-map helper ¬¬-excluded-middle
8989
where
9090
helper : Dec P _
9191
helper (yes p) = Prod.map₂ const (f p)
@@ -94,7 +94,7 @@ independence-of-premise {P = P} q f = ¬¬-map helper excluded-middle
9494
-- The independence of premise rule for binary sums.
9595

9696
independence-of-premise-⊎ : (P Q ⊎ R) DoubleNegation ((P Q) ⊎ (P R))
97-
independence-of-premise-⊎ {P = P} f = ¬¬-map helper excluded-middle
97+
independence-of-premise-⊎ {P = P} f = ¬¬-map helper ¬¬-excluded-middle
9898
where
9999
helper : Dec P _
100100
helper (yes p) = Sum.map const const (f p)

0 commit comments

Comments
 (0)