Skip to content

[ add ] flipped version of Relation.Nullary.Negation.Core.contradiction #2797

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Minor improvements
* The type of `Relation.Nullary.Negation.Core.contradiction-irr` has been further
weakened so that the negated hypothesis `¬ A` is marked as irrelevant. This is
safe to do, in view of `Relation.Nullary.Recomputable.Properties.¬-recompute`.
Furthermore, because the *eager* insertion of implicit arguments during type
inference interacts badly with `contradiction`, we introduce an explicit name
`contradiction′` for its `flip`ped version.

* Refactored usages of `+-∸-assoc 1` to `∸-suc` in:
```agda
Expand Down Expand Up @@ -101,5 +104,6 @@ Additions to existing modules

* In `Relation.Nullary.Negation.Core`
```agda
¬¬-η : A → ¬ ¬ A
¬¬-η : A → ¬ ¬ A
contradiction′ : ¬ A → A → Whatever
```
6 changes: 3 additions & 3 deletions src/Relation/Nullary/Negation.agda
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ open import Relation.Nullary.Negation.Core public
-- ⊥).

call/cc : ((A → Whatever) → DoubleNegation A) → DoubleNegation A
call/cc hyp ¬a = hyp (flip contradiction ¬a) ¬a
call/cc hyp ¬a = hyp (contradiction ¬a) ¬a

-- The "independence of premise" rule, in the double-negation monad.
-- It is assumed that the index set (A) is inhabited.
Expand All @@ -82,7 +82,7 @@ independence-of-premise {A = A} {B = B} {P = P} q f = ¬¬-map helper ¬¬-exclu
where
helper : Dec B → Σ[ x ∈ A ] (B → P x)
helper (yes p) = Product.map₂ const (f p)
helper (no ¬p) = (q , flip contradiction ¬p)
helper (no ¬p) = (q , contradiction ¬p)

-- The independence of premise rule for binary sums.

Expand All @@ -91,7 +91,7 @@ independence-of-premise-⊎ {A = A} {B = B} {C = C} f = ¬¬-map helper ¬¬-exc
where
helper : Dec A → (A → B) ⊎ (A → C)
helper (yes p) = Sum.map const const (f p)
helper (no ¬p) = inj₁ (flip contradiction ¬p)
helper (no ¬p) = inj₁ (contradiction ¬p)

private

Expand Down
3 changes: 3 additions & 0 deletions src/Relation/Nullary/Negation/Core.agda
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ contradiction-irr a ¬a = ⊥-elim-irr (¬a a)
contradiction : A → ¬ A → Whatever
contradiction a ¬a = contradiction-irr a ¬a

contradiction′ : ¬ A → A → Whatever
contradiction′ ¬a a = contradiction-irr a ¬a

contradiction₂ : A ⊎ B → ¬ A → ¬ B → Whatever
contradiction₂ (inj₁ a) ¬a ¬b = contradiction a ¬a
contradiction₂ (inj₂ b) ¬a ¬b = contradiction b ¬b
Expand Down