Skip to content

Instantly share code, notes, and snippets.

@collares
Created July 11, 2019 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save collares/fdf91795968f808b14dcd06f41e201bc to your computer and use it in GitHub Desktop.
Save collares/fdf91795968f808b14dcd06f41e201bc to your computer and use it in GitHub Desktop.
module plfa.Lists where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_)
open import Data.Product using (_×_; proj₁; proj₂; ∃; ∃-syntax)
renaming (_,_ to ⟨_,_⟩)
open import plfa.Isomorphism using (_≃_)
data List (A : Set) : Set where
[] : List A
_∷_ : A → List A → List A
infixr 5 _∷_
data Any {A : Set} (P : A → Set) : List A → Set where
here : ∀ {x : A} {xs : List A} → P x → Any P (x ∷ xs)
there : ∀ {x : A} {xs : List A} → Any P xs → Any P (x ∷ xs)
infix 4 _∈_
_∈_ : ∀ {A : Set} (x : A) (xs : List A) → Set
x ∈ xs = Any (x ≡_) xs
Any-∃ : ∀ {A : Set} {P : A → Set} (xs : List A)
→ Any P xs ≃ (∃[ x ∈ xs ] P x)
Any-∃ xs = ?
{-
/home/collares/plfa/Lists.agda:25,21-36
Could not parse the application ∃[ x ∈ xs ] P x
Operators used in the grammar:
∈ (infix operator, level 4) [_∈_ (/home/collares/plfa/Lists.agda:21,1-4)]
∃[_] (prefix notation, level 20) [∃-syntax (/home/collares/.cabal/agda-stdlib-1.0.1/src/Data/Product.agda:40,1-9)]
when scope checking ∃[ x ∈ xs ] P x
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment