Possibly infinite lists #
This file provides a Seq α
type representing possibly infinite lists (referred here as sequences).
It is encoded as an infinite stream of options such that if f n = none
, then
f m = none
for all m ≥ n
.
Constructors #
Prepend an element to a sequence
Equations
Instances For
Destructors #
Get the first element of a sequence
Equations
Instances For
Recursion and corecursion principles #
Recursion principle for sequences, compare with List.recOn
.
Equations
Instances For
Bisimulation #
Termination #
It is decidable whether a sequence terminates at a given position.
Equations
A sequence terminates if there is some position n
at which it has terminated.
Equations
Instances For
The length of a terminating sequence.
Equations
Instances For
If a sequence terminated at position n
, it also terminated at m ≥ n
.
The statement of length_le_iff'
does not assume that the sequence terminates. For a
simpler statement of the theorem where the sequence is known to terminate see length_le_iff
The statement of length_le_iff
assumes that the sequence terminates. For a
statement of the where the sequence is not known to terminate see length_le_iff'
The statement of lt_length_iff'
does not assume that the sequence terminates. For a
simpler statement of the theorem where the sequence is known to terminate see lt_length_iff
The statement of length_le_iff
assumes that the sequence terminates. For a
statement of the where the sequence is not known to terminate see length_le_iff'
Membership #
Alias of Stream'.Seq.notMem_nil
.
Converting from/to other types #
Embed a list as a sequence
Equations
Instances For
Embed an infinite stream as a sequence
Equations
Instances For
Translate a sequence to a list. This function will run forever if run on an infinite sequence.
Equations
Instances For
Convert a sequence which is known to terminate into a list
Equations
Instances For
Convert a sequence which is known not to terminate into a stream
Equations
Instances For
Convert a sequence into either a list or a stream depending on whether it is finite or infinite. (Without decidability of the infiniteness predicate, this is not constructively possible.)
Equations
Instances For
Convert a sequence into a list, embedded in a computation to allow for the possibility of infinite sequences (in which case the computation never returns anything).
Equations
Instances For
Operations on sequences #
The sequence of natural numbers some 0, some 1, ...