The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Data.WSeq.Productive

13 declarations. Mathlib docs · Source

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.

theorem Computation.get.congr_simp E1 #

∀ {α : Type u} (s s_1 : Computation α) (e_s : s = s_1) [h : s.Terminates], s.get = s_1.get

class Stream'.WSeq.Productive E1 #

{α : Type u} → Stream'.WSeq α → Prop

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.

ctor Stream'.WSeq.Productive.mk E0 #

∀ {α : Type u} {s : Stream'.WSeq α}, (∀ (n : ℕ), (s.get? n).Terminates) → s.Productive

theorem Stream'.WSeq.Productive.get?_terminates E1 #

∀ {α : Type u} {s : Stream'.WSeq α} [self : s.Productive] (n : ℕ), (s.get? n).Terminates

theorem Stream'.WSeq.productive_iff E0 #

∀ {α : Type u} (s : Stream'.WSeq α), s.Productive ↔ ∀ (n : ℕ), (s.get? n).Terminates

instance Stream'.WSeq.get?_terminates E0 #

∀ {α : Type u} (s : Stream'.WSeq α) [h : s.Productive] (n : ℕ), (s.get? n).Terminates

instance Stream'.WSeq.head_terminates E0 #

∀ {α : Type u} (s : Stream'.WSeq α) [s.Productive], s.head.Terminates

instance Stream'.WSeq.productive_tail E0 #

∀ {α : Type u} (s : Stream'.WSeq α) [s.Productive], s.tail.Productive

instance Stream'.WSeq.productive_dropn E0 #

∀ {α : Type u} (s : Stream'.WSeq α) [s.Productive] (n : ℕ), (s.drop n).Productive

instance Stream'.WSeq.productive_ofSeq E0 #

∀ {α : Type u} (s : Stream'.Seq α), (↑s).Productive

theorem Stream'.WSeq.productive_congr E1 #

∀ {α : Type u} {s t : Stream'.WSeq α}, s ~ʷ t → (s.Productive ↔ t.Productive)

def Stream'.WSeq.toSeq E1 #

{α : Type u} → (s : Stream'.WSeq α) → [s.Productive] → Stream'.Seq α

Given a productive weak sequence, we can collapse all the thinks to produce a sequence.

theorem Stream'.WSeq.toSeq_ofSeq E1 #

∀ {α : Type u} (s : Stream'.Seq α), (↑s).toSeq = s