8
8
9
9
module Data.List.Relation.Unary.First.Properties where
10
10
11
+ open import Data.Bool.Base using (true; false)
11
12
open import Data.Fin.Base using (suc)
12
13
open import Data.List.Base as List using (List; []; _∷_)
13
14
open import Data.List.Relation.Unary.All as All using (All; []; _∷_)
@@ -16,8 +17,9 @@ open import Data.List.Relation.Unary.First
16
17
import Data.Sum.Base as Sum
17
18
open import Function.Base using (_∘′_; _∘_; id)
18
19
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
20
21
open import Relation.Nullary.Negation.Core using (contradiction)
22
+ open import Relation.Nullary.Reflects using (invert)
21
23
open import Relation.Unary using (Pred; _⊆_; ∁; Irrelevant; Decidable)
22
24
23
25
------------------------------------------------------------------------
@@ -65,6 +67,13 @@ module _ {a p q} {A : Set a} {P : Pred A p} {Q : Pred A q} where
65
67
let px = ¬q⇒p (¬pqxxs ∘ [_]) in
66
68
px ∷ ¬First⇒All ¬q⇒p (¬pqxxs ∘ (px ∷_))
67
69
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
+
68
77
------------------------------------------------------------------------
69
78
-- Irrelevance
70
79
0 commit comments