Documentation

CslibFrontier.Computability.Streaming.Nondeterministic

Nondeterministic multi-pass streaming algorithms give covers #

A nondeterministic multi-pass streaming algorithm (Cslib.Streaming.Nondeterministic.Algorithm σ α β) reads the stream several times from left to right, like a deterministic one (Cslib.Streaming.MultiPass), but each update and each transition at the end of a pass may lead to any of a set of memory states. Its memory is measured as in the deterministic case: A.SpaceLE p m b says that the states held between items by some computation during p passes over streams of at most m items have an injective b-bit encoding.

A function f is decided with answer z when, on the stream u x ++ v y, f x y = z holds exactly when some computation of p passes ends in a state whose answer d maps to z. For z = true this is a nondeterministic algorithm, which accepts when some computation accepts; for z = false it is a co-nondeterministic one, which rejects when some computation rejects. Computations that get stuck (an empty set of successors) neither accept nor reject, as usual for nondeterministic machines; so $N^0(f)$ is $N^1$ of the negation of f.

Covers. For $p \ge 1$ passes, a computation on u x ++ v y is determined, as far as the two players are concerned, by the $2p-1$ memory states at the boundaries between u x and v y: the state after Alice's part of each pass, and the state at the start of each later pass. For a guess of these states, the inputs x whose parts of the passes connect them form a set, and so do the inputs y; their product is a rectangle on which f is z, and every pair with f x y = z lies in the rectangle of the boundary states of an accepting computation. So f has a z-cover by $2^{(2p-1)b}$ rectangles, and nondeterministic complexity at most $(2p-1)b$ (Cslib.Streaming.Nondeterministic.Algorithm.ecomplexityFun_le_of_spaceLE). Unlike the deterministic simulation (Cslib.Streaming.MultiPass.ecomplexityFun_le_of_spaceLE), no final bit is needed: the cover is checked, not computed. This adapts the one-pass reduction of Alon, Matias and Szegedy [AlonMatiasSzegedy1999, Section 3] to p passes and to nondeterministic algorithms, with nondeterministic communication complexity defined by covers as in Cslib.Communication.Nondeterministic. For one pass, Das, Fraigniaud, Paz and Rosén give the corresponding bound for streaming certification schemes, in which the algorithm receives a certificate before the stream [DasFraigniaudPazRosen2025, Lemma 7].

Main definitions #

Main results #

References #

structure Cslib.Streaming.Nondeterministic.Algorithm (σ : Type u_1) (α : Type u_2) (β : Type u_3) :
Type (max (max u_1 u_2) u_3)

A nondeterministic multi-pass streaming algorithm over items of type α with answers in β: memory states σ, an initial state, the possible states after reading one more item, the possible states at the start of the next pass given the state at the end of a pass, and an answer for each state.

  • init : σ

    The initial memory state.

  • update : σ → α → Set σ

    The possible memory states after reading one more item.

  • endPass : σ → Set σ

    The possible memory states at the start of the next pass.

  • output : σ → β

    The answer reported in a memory state.

def Cslib.Streaming.Nondeterministic.Algorithm.statesFrom {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) :
σ → List α → Set σ

The possible memory states after reading the stream s from q.

def Cslib.Streaming.Nondeterministic.Algorithm.pass {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) (s : List α) (q : σ) :
Set σ

The possible memory states after one pass over s from q, including endPass.

def Cslib.Streaming.Nondeterministic.Algorithm.passes {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) (s : List α) :
ℕ → Set σ

The possible memory states after k passes over s.

def Cslib.Streaming.Nondeterministic.Algorithm.answers {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) (p : ℕ) (s : List α) :
Set β

The possible answers after p passes over s.

@[simp]
theorem Cslib.Streaming.Nondeterministic.Algorithm.mem_statesFrom_nil {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {q q' : σ} :
q' ∈ A.statesFrom q [] ↔ q' = q
theorem Cslib.Streaming.Nondeterministic.Algorithm.mem_statesFrom_append {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {q q'' : σ} {s t : List α} :
q'' ∈ A.statesFrom q (s ++ t) ↔ ∃ q' ∈ A.statesFrom q s, q'' ∈ A.statesFrom q' t
theorem Cslib.Streaming.Nondeterministic.Algorithm.mem_pass {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {q q' : σ} {s : List α} :
q' ∈ A.pass s q ↔ ∃ q'' ∈ A.statesFrom q s, q' ∈ A.endPass q''
theorem Cslib.Streaming.Nondeterministic.Algorithm.mem_pass_append {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {q q'' : σ} {s t : List α} :
q'' ∈ A.pass (s ++ t) q ↔ ∃ q' ∈ A.statesFrom q s, q'' ∈ A.pass t q'

A pass over s ++ t is a pass over s continued on t.

@[simp]
theorem Cslib.Streaming.Nondeterministic.Algorithm.mem_passes_zero {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {s : List α} {q : σ} :
q ∈ A.passes s 0 ↔ q = A.init
theorem Cslib.Streaming.Nondeterministic.Algorithm.mem_passes_succ {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {s : List α} {k : ℕ} {q : σ} :
q ∈ A.passes s (k + 1) ↔ ∃ q' ∈ A.passes s k, q ∈ A.pass s q'
theorem Cslib.Streaming.Nondeterministic.Algorithm.mem_passes_iff_exists_chain {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {s t : List α} {k : ℕ} {q : σ} :
q ∈ A.passes (s ++ t) k ↔ ∃ (st : ℕ → σ) (mid : ℕ → σ), st 0 = A.init ∧ st k = q ∧ ∀ j < k, mid j ∈ A.statesFrom (st j) s ∧ st (j + 1) ∈ A.pass t (mid j)

Boundary states. A state is possible after k passes over s ++ t exactly when it ends a chain of states st 0 = init, mid 0, st 1, …, mid (k - 1), st k in which each mid j is possible after reading s from st j, and each st (j + 1) after finishing the pass on t from mid j.

def Cslib.Streaming.Nondeterministic.Algorithm.reachable {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) (p m : ℕ) :
Set σ

The memory states reachable during p passes over streams of length at most m: the states possible between items during each pass, from its start to its end (before endPass).

def Cslib.Streaming.Nondeterministic.Algorithm.SpaceLE {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) (p m b : ℕ) :

A uses at most b bits of memory during p passes over streams of length at most m: the memory states it can reach have an injective encoding by b-bit strings.

theorem Cslib.Streaming.Nondeterministic.Algorithm.mem_reachable_of_statesFrom {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {p m k : ℕ} {s t : List α} {q₀ q : σ} (hs : s.length ≤ m) (hk : k < p) (ht : t <+: s) (hq₀ : q₀ ∈ A.passes s k) (hq : q ∈ A.statesFrom q₀ t) :
q ∈ A.reachable p m
theorem Cslib.Streaming.Nondeterministic.Algorithm.mem_reachable_of_passes {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {p m k : ℕ} {s : List α} {q : σ} (hs : s.length ≤ m) (hk : k < p) (hq : q ∈ A.passes s k) :
q ∈ A.reachable p m
noncomputable def Cslib.Streaming.Nondeterministic.Algorithm.decode {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) (p m b : ℕ) (enc : σ → BitString b) (w : BitString b) :
σ

Decoding a b-bit guess: the reachable state that enc maps to it, if any.

theorem Cslib.Streaming.Nondeterministic.Algorithm.decode_enc {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {p m b : ℕ} {enc : σ → BitString b} (henc : Set.InjOn enc (A.reachable p m)) {q : σ} (hq : q ∈ A.reachable p m) :
A.decode p m b enc (enc q) = q
theorem Cslib.Streaming.Nondeterministic.Algorithm.ecomplexityFun_le_of_spaceLE {σ : Type u_1} {α : Type u_2} {β : Type u_3} (A : Algorithm σ α β) {X : Type u_4} {Y : Type u_5} {p m b : ℕ} (hp : 0 < p) (hA : A.SpaceLE p m b) (u : X → List α) (v : Y → List α) (hm : ∀ (x : X) (y : Y), (u x ++ v y).length ≤ m) (d : β → Bool) (z : Bool) (f : X → Y → Bool) (hf : ∀ (x : X) (y : Y), f x y = z ↔ ∃ c ∈ A.answers p (u x ++ v y), d c = z) :

Nondeterministic multi-pass streaming space bounds nondeterministic communication: if, for $p \ge 1$, a nondeterministic p-pass streaming algorithm with b bits of memory on streams of length at most m decides f with answer z on the streams u x ++ v y, which have length at most m, that is, f x y = z exactly when some computation ends in a state whose answer d maps to z, then the z-nondeterministic complexity of f is at most $(2p-1)b$. For z = true the algorithm is nondeterministic and the bound is on N¹; for z = false it is co-nondeterministic and the bound is on N⁰.