Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Minor improvements
weakened so that the negated hypothesis `¬ A` is marked as irrelevant. This is
safe to do, in view of `Relation.Nullary.Recomputable.Properties.¬-recompute`.

* More generally, `Relation.Nullary.Negation.Core` has been reorganised into two
parts: the first concerns definitions and properties of negation considered as
a connective in *minimal logic*; the second making actual use of *ex falso* in
the form of `Data.Empty.⊥-elim`.

* Refactored usages of `+-∸-assoc 1` to `∸-suc` in:
```agda
README.Data.Fin.Relation.Unary.Top
Expand Down
59 changes: 29 additions & 30 deletions src/Relation/Nullary/Negation/Core.agda
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,56 @@ private
Whatever : Set w

------------------------------------------------------------------------
-- Negation.
-- Definition.

infix 3 ¬_
¬_ : Set a → Set a
¬ A = A → ⊥

------------------------------------------------------------------------
-- Stability.
-- Properties, I: as a definition in *minimal logic*

-- Note the following use of flip:
private
note : (A → ¬ B) → B → ¬ A
note = flip

-- Contraposition
contraposition : (A → B) → ¬ B → ¬ A
contraposition f ¬b a = ¬b (f a)

-- Relationship to sum
infixr 1 _¬-⊎_
_¬-⊎_ : ¬ A → ¬ B → ¬ (A ⊎ B)
_¬-⊎_ = [_,_]

-- Self-contradictory propositions are false by 'diagonalisation'
contra-diagonal : (A → ¬ A) → ¬ A
contra-diagonal self a = self a a

-- Double-negation
DoubleNegation : Set a → Set a
DoubleNegation A = ¬ ¬ A

-- Eta law for double-negation

¬¬-η : A → ¬ ¬ A
¬¬-η a ¬a = ¬a a

-- Functoriality for double-negation
¬¬-map : (A → B) → ¬ ¬ A → ¬ ¬ B
¬¬-map = contraposition ∘ contraposition

------------------------------------------------------------------------
-- Stability under double-negation.
Stable : Set a → Set a
Stable A = ¬ ¬ A → A

------------------------------------------------------------------------
-- Relationship to sum

infixr 1 _¬-⊎_
_¬-⊎_ : ¬ A → ¬ B → ¬ (A ⊎ B)
_¬-⊎_ = [_,_]
-- Negated predicates are stable.
negated-stable : Stable (¬ A)
negated-stable ¬¬¬a a = ¬¬¬a (¬¬-η a)

------------------------------------------------------------------------
-- Uses of negation
-- Properties, II: using the *ex falso* rule ⊥-elim

contradiction-irr : .A → .(¬ A) → Whatever
contradiction-irr a ¬a = ⊥-elim-irr (¬a a)
Expand All @@ -62,27 +81,7 @@ contradiction₂ : A ⊎ B → ¬ A → ¬ B → Whatever
contradiction₂ (inj₁ a) ¬a ¬b = contradiction a ¬a
contradiction₂ (inj₂ b) ¬a ¬b = contradiction b ¬b

contraposition : (A → B) → ¬ B → ¬ A
contraposition f ¬b a = contradiction (f a) ¬b

-- Self-contradictory propositions are false by 'diagonalisation'

contra-diagonal : (A → ¬ A) → ¬ A
contra-diagonal self a = self a a

-- Everything is stable in the double-negation monad.
stable : ¬ ¬ Stable A
stable ¬[¬¬a→a] = ¬[¬¬a→a] (contradiction (¬[¬¬a→a] ∘ const))

-- Negated predicates are stable.
negated-stable : Stable (¬ A)
negated-stable ¬¬¬a a = ¬¬¬a (contradiction a)

¬¬-map : (A → B) → ¬ ¬ A → ¬ ¬ B
¬¬-map f = contraposition (contraposition f)

-- Note also the following use of flip:
private
note : (A → ¬ B) → B → ¬ A
note = flip