diff --git a/Utils.agda b/Utils.agda index 804c40e..a8f9b64 100644 --- a/Utils.agda +++ b/Utils.agda @@ -2,9 +2,9 @@ module Utils where open import Data.List using (List; []; _∷_; _++_) open import Data.List.Membership.Propositional using (_∈_) -open import Data.List.Relation.Unary.All using (All; []; _∷_) +open import Data.List.Relation.Unary.All using (All; []; _∷_; map) open import Data.List.Relation.Unary.Any using (Any; here; there) -- TODO: re-export these with nicer names from map -open import Relation.Binary.PropositionalEquality using (_≡_; sym) +open import Relation.Binary.PropositionalEquality using (_≡_; sym; refl) open import Relation.Nullary using (¬_) data Unique {c} {C : Set c} : List C → Set c where @@ -30,3 +30,7 @@ Unique-append {c} {C} {x} {x' ∷ xs'} x∉xs (push x'≢ uxs') = All¬-¬Any : ∀ {p c} {C : Set c} {P : C → Set p} {l : List C} → All (λ x → ¬ P x) l → ¬ Any P l All¬-¬Any {l = x ∷ xs} (¬Px ∷ _) (here Px) = ¬Px Px All¬-¬Any {l = x ∷ xs} (_ ∷ ¬Pxs) (there Pxs) = All¬-¬Any ¬Pxs Pxs + +All-x∈xs : ∀ {a} {A : Set a} (xs : List A) → All (λ x → x ∈ xs) xs +All-x∈xs [] = [] +All-x∈xs (x ∷ xs') = here refl ∷ map there (All-x∈xs xs')