Skip to content

Commit 8e2754f

Browse files
authored
add: de Morgan dual of agda#2507 (agda#2508)
1 parent 84dd2f8 commit 8e2754f

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@ Additions to existing modules
313313
deduplicate _≟_ (xs ++ ys) ↭ deduplicate _≟_ xs ++ deduplicate _≟_ ys
314314
```
315315

316+
* In `Data.List.Relation.Unary.First.Properties`:
317+
```agda
318+
¬First⇒All : ∁ Q ⊆ P → ∁ (First P Q) ⊆ All P
319+
¬All⇒First : Decidable P → ∁ P ⊆ Q → ∁ (All P) ⊆ First P Q
320+
```
321+
316322
* In `Data.Maybe.Properties`:
317323
```agda
318324
maybe′-∘ : ∀ f g → f ∘ (maybe′ g b) ≗ maybe′ (f ∘ g) (f b)
@@ -417,9 +423,3 @@ Additions to existing modules
417423
does-≐ : P ≐ Q → (P? : Decidable P) → (Q? : Decidable Q) → does ∘ P? ≗ does ∘ Q?
418424
does-≡ : (P? P?′ : Decidable P) → does ∘ P? ≗ does ∘ P?′
419425
```
420-
421-
* In `Data.List.Relation.Unary.First.Properties`:
422-
```agda
423-
¬First⇒All : ∁ Q ⊆ P → ∁ (First P Q) ⊆ All P
424-
```
425-

src/Data/List/Relation/Unary/First/Properties.agda

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
module Data.List.Relation.Unary.First.Properties where
1010

11+
open import Data.Bool.Base using (true; false)
1112
open import Data.Fin.Base using (suc)
1213
open import Data.List.Base as List using (List; []; _∷_)
1314
open import Data.List.Relation.Unary.All as All using (All; []; _∷_)
@@ -16,8 +17,9 @@ open import Data.List.Relation.Unary.First
1617
import Data.Sum.Base as Sum
1718
open import Function.Base using (_∘′_; _∘_; id)
1819
open import Relation.Binary.PropositionalEquality.Core as ≡ using (_≡_; refl; _≗_)
19-
import Relation.Nullary.Decidable.Core as Dec
20+
open import Relation.Nullary.Decidable.Core as Dec
2021
open import Relation.Nullary.Negation.Core using (contradiction)
22+
open import Relation.Nullary.Reflects using (invert)
2123
open import Relation.Unary using (Pred; _⊆_; ∁; Irrelevant; Decidable)
2224

2325
------------------------------------------------------------------------
@@ -65,6 +67,13 @@ module _ {a p q} {A : Set a} {P : Pred A p} {Q : Pred A q} where
6567
let px = ¬q⇒p (¬pqxxs ∘ [_]) in
6668
px ∷ ¬First⇒All ¬q⇒p (¬pqxxs ∘ (px ∷_))
6769

70+
¬All⇒First : Decidable P ∁ P ⊆ Q ∁ (All P) ⊆ First P Q
71+
¬All⇒First P? ¬p⇒q {x = []} ¬⊤ = contradiction [] ¬⊤
72+
¬All⇒First P? ¬p⇒q {x = x ∷ xs} ¬∀ with P? x
73+
... | true because [px] = let px = invert [px] in
74+
px ∷ ¬All⇒First P? ¬p⇒q (¬∀ ∘ (px ∷_))
75+
... | false because [¬px] = [ ¬p⇒q (invert [¬px]) ]
76+
6877
------------------------------------------------------------------------
6978
-- Irrelevance
7079

0 commit comments

Comments
 (0)