IdrisDoc: Data.List.Extra

# Data.List.Extra

reverseSingletonId : (x : a) -> reverse [x] = [x]

  Reversing a singleton list is a no-op.

reverseReverseId : (xs : List a) -> reverse (reverse xs) = xs

  Reversing a reverse gives the original.

reverseOntoSpec : (xs : List a) -> (ys : List a) -> reverseOnto xs ys = reverse ys ++ xs

  Serves as a specification for reverseOnto.

reverseNil : reverse [] = []

  The reverse of an empty list is an empty list. Together with reverseCons,
  serves as a specification for reverse.

reverseCons : (x : a) -> (xs : List a) -> reverse (x :: xs) = reverse xs ++ [x]

  The reverse of a cons is the reverse of the tail followed by the head.
  Together with reverseNil serves as a specification for reverse.

reverseAppend : (xs : List a) -> (ys : List a) -> reverse (xs ++ ys) = reverse ys ++ reverse xs

  Reversing an append is appending reversals backwards.