Sequences are basic forms of construction in mathematics, often written
.
With the widespread use of programming languages we have come
to distinguish several data types associated with sequences as distinct types.
There are lists, arraysarray, and
sequencessequence, and they have different mathematical
properties. We first look at lists.
If A is a type, then so is A list. We could write an informal rule
like this
All lists are built up from nil and the operation of pairing an element of A with a list. The typing rules are
![]() |
![]() |
![]() |
Equality on lists is given by these rules.
![]() ![]() |
![]() |
![]() ![]() |
![]() ![]() |
For every type A, A list is an inductive type with base case of
nil. The inductive character of the type is given by its induction
rule stated below for
![]() |
![]() ![]() |
![]() |
We can define the usual head-and-tail
head tail
functions by induction. Define
in
.
![]() ![]() |
by
![]() |
![]() ![]() |
by ![]() |
![]() ![]() |
by VRl |
![]() ![]() |
by VRr |
![]() ![]() |
by
![]() ![]() |