Productive weak sequences #
This file defines the property of a weak sequence being productive as never stalling – the next
output always comes after a finite time. Given a productive weak sequence, a regular sequence
(Seq) can be derived from it using toSeq.
A weak sequence is productive if it never stalls forever - there are
always a finite number of thinks between cons constructors.
The sequence itself is allowed to be infinite though.
- get?_terminates (n : ℕ) : (s.get? n).Terminates
Instances
theorem
Stream'.WSeq.productive_iff
{α : Type u}
(s : WSeq α)
:
s.Productive ↔ ∀ (n : ℕ), (s.get? n).Terminates
instance
Stream'.WSeq.get?_terminates
{α : Type u}
(s : WSeq α)
[h : s.Productive]
(n : ℕ)
:
(s.get? n).Terminates
instance
Stream'.WSeq.productive_dropn
{α : Type u}
(s : WSeq α)
[s.Productive]
(n : ℕ)
:
(s.drop n).Productive
theorem
Stream'.WSeq.productive_congr
{α : Type u}
{s t : WSeq α}
(h : s ~ʷ t)
:
s.Productive ↔ t.Productive
Given a productive weak sequence, we can collapse all the thinks to
produce a sequence.