Induction principles for lists #
Induction principle from the right for lists: if a property holds for the empty list, and
for l ++ [a]
if it holds for l
, then it holds for all lists. The principle is given for
a Sort
-valued predicate, i.e., it can also be used to construct data.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Bidirectional induction principle for lists: if a property holds for the empty list, the
singleton list, and a :: (l ++ [b])
from l
, then it holds for all lists. This can be used to
prove statements about palindromes. The principle is given for a Sort
-valued predicate, i.e., it
can also be used to construct data.
Equations
- One or more equations did not get rendered due to their size.
- List.bidirectionalRec nil singleton cons_append [] = nil
- List.bidirectionalRec nil singleton cons_append [a] = singleton a
Instances For
Like bidirectionalRec
, but with the list parameter placed first.
Equations
- l.bidirectionalRecOn H0 H1 Hn = List.bidirectionalRec H0 H1 Hn l
Instances For
A dependent recursion principle for nonempty lists. Useful for dealing with
operations like List.head
which are not defined on the empty list.
Equations
- List.recNeNil singleton cons [x] h_2 = singleton x
- List.recNeNil singleton cons (x :: y :: xs) h_2 = cons x (y :: xs) ⋯ (List.recNeNil singleton cons (y :: xs) ⋯)
Instances For
A dependent recursion principle for nonempty lists. Useful for dealing with
operations like List.head
which are not defined on the empty list.
Same as List.recNeNil
, with a more convenient argument order.
Equations
- List.recOnNeNil l h singleton cons = List.recNeNil singleton cons l h