The areas / V33. Data structures and computation
Mathlib.Data.Seq.Parallel
12 declarations. Mathlib docs · Source
Parallel computation
Parallel computation of a computable sequence of computations by a diagonal enumeration. The important theorems of this operation are proven as terminates_parallel and exists_of_mem_parallel. (This operation is nondeterministic in the sense that it does not honor sequence equivalence (irrelevance of computation time).)
theorem Computation.Corec.f.match_1.hcongr_6 E1 #
∀ (α α' : Type u_1),
α = α' →
∀ (β β' : Type u_2),
β = β' →
∀ (motive : α ⊕ β → Sort u_3) (motive' : α' ⊕ β' → Sort u_3),
motive ≍ motive' →
∀ (x : α ⊕ β) (x' : α' ⊕ β'),
x ≍ x' →
∀ (h_1 : (a : α) → motive (Sum.inl a)) (h_1' : (a : α') → motive' (Sum.inl a)),
h_1 ≍ h_1' →
∀ (h_2 : (val : β) → motive (Sum.inr val)) (h_2' : (val : β') → motive' (Sum.inr val)),
h_2 ≍ h_2' →
(match x with
| Sum.inl a => h_1 a
| Sum.inr val => h_2 val) ≍
match x' with
| Sum.inl a => h_1' a
| Sum.inr val => h_2' val
def Computation.parallel E1 #
{α : Type u} → Stream'.WSeq (Computation α) → Computation α
Parallel computation of an infinite stream of computations, taking the first result
theorem Computation.terminates_parallel E1 #
∀ {α : Type u} {S : Stream'.WSeq (Computation α)} {c : Computation α},
c ∈ S → ∀ [T : c.Terminates], (Computation.parallel S).Terminates
theorem Computation.exists_of_mem_parallel E1 #
∀ {α : Type u} {S : Stream'.WSeq (Computation α)} {a : α}, a ∈ Computation.parallel S → ∃ c ∈ S, a ∈ c
theorem Computation.map_parallel E0 #
∀ {α : Type u} {β : Type v} (f : α → β) (S : Stream'.WSeq (Computation α)),
Computation.map f (Computation.parallel S) = Computation.parallel (Stream'.WSeq.map (Computation.map f) S)
theorem Computation.parallel_empty E1 #
∀ {α : Type u} (S : Stream'.WSeq (Computation α)), S.head.Promises none → Computation.parallel S = Computation.empty α
def Computation.parallelRec E1 #
{α : Type u} →
{S : Stream'.WSeq (Computation α)} →
(C : α → Sort v) →
((s : Computation α) → s ∈ S → (a : α) → a ∈ s → C a) → {a : α} → a ∈ Computation.parallel S → C a
Induction principle for parallel computations.
The reason this isn't trivial from exists_of_mem_parallel is because it eliminates to Sort.
theorem Computation.parallel_promises E1 #
∀ {α : Type u} {S : Stream'.WSeq (Computation α)} {a : α}, (∀ s ∈ S, s.Promises a) → (Computation.parallel S).Promises a
theorem Computation.mem_parallel E0 #
∀ {α : Type u} {S : Stream'.WSeq (Computation α)} {a : α},
(∀ s ∈ S, s.Promises a) → ∀ {c : Computation α}, c ∈ S → a ∈ c → a ∈ Computation.parallel S
theorem Computation.parallel_congr_lem E1 #
∀ {α : Type u} {S T : Stream'.WSeq (Computation α)} {a : α},
Stream'.WSeq.LiftRel Computation.Equiv S T → ((∀ s ∈ S, s.Promises a) ↔ ∀ t ∈ T, t.Promises a)
theorem Computation.parallel_congr_left E1 #
∀ {α : Type u} {S T : Stream'.WSeq (Computation α)} {a : α},
(∀ s ∈ S, s.Promises a) →
Stream'.WSeq.LiftRel Computation.Equiv S T → (Computation.parallel S).Equiv (Computation.parallel T)
theorem Computation.parallel_congr_right E1 #
∀ {α : Type u} {S T : Stream'.WSeq (Computation α)} {a : α},
(∀ t ∈ T, t.Promises a) →
Stream'.WSeq.LiftRel Computation.Equiv S T → (Computation.parallel S).Equiv (Computation.parallel T)