# Data.List.Quantifiers

data All : (P : a -> Type) -> List a -> Type

  A proof that all elements of a list satisfy a property. It is a list of
  proofs, corresponding element-wise to the `List`.

  Nil : All P []
  (::) : P x -> All P xs -> All P (x :: xs)
    Fixity
      Left associative, precedence 7
data Any : (P : a -> Type) -> List a -> Type

  A proof that some element of a list satisfies some property

  P

    the property to be satsified

  Here : P x -> Any P (x :: xs)

    A proof that the satisfying element is the first one in the `List`

  There : Any P xs -> Any P (x :: xs)

    A proof that the satsifying element is in the tail of the `List`

all : (dec : (x : a) -> Dec (P x)) -> (xs : List a) -> Dec (All P xs)

  Given a decision procedure for a property, decide whether all elements of
  a list satisfy it.

  P

    the property

  dec

    the decision procedure

  xs

    the list to examine

any : (dec : (x : a) -> Dec (P x)) -> (xs : List a) -> Dec (Any P xs)

  Given a decision procedure for a property, determine if an element of a
  list satisfies it.

  P

    the property to be satisfied

  dec

    the decision procedure

  xs

    the list to examine

anyElim : (Any P xs -> b) -> (P x -> b) -> Any P (x :: xs) -> b

  Eliminator for `Any`

anyNilAbsurd : Any P [] -> Void

  No element of an empty list satisfies any property

indexAll : Elem x xs -> All p xs -> p x

  Given a proof of membership for some element, extract the property proof for it

negAnyAll : Not (Any P xs) -> All (\x => Not (P x)) xs

  If there does not exist an element that satifies the property, then it is
  the case that all elements do not satisfy.

notAllHere : Not (P x) -> All P (x :: xs) -> Void
notAllThere : Not (All P xs) -> All P (x :: xs) -> Void