Documentation

CslibFrontier.Computability.Automata.MPDA.OneHole

One hole is no hole #

For complete runs, one open hole at a time is no more permissive than none: the label sequence of a run of an MPDA from empty stacks to empty stacks is 1-hole-bounded exactly when it is well-nested. Theorem 2 in Appendix G.1 of [AGKR20] states this for accepting runs, in the discussion of the multi-producer consumer benchmark, with an informal proof.

The argument goes through crossings. A crossing is a push on stack i with its matching pop, and a push on another stack strictly between them that is still pending at the pop.

Well-nested sequences are 0-hole-bounded (MPDA.WellNested.holeBounded_zero), so a complete run is also 0-hole-bounded exactly when it is well-nested.

Main definitions #

Main results #

References #

Factors #

theorem Cslib.Automata.MPDA.net_extract_succ {n : ℕ} {Γ : Type u_1} {α : Type u_2} {w : List (α × Op n Γ)} {a : ℕ} {μ : α × Op n Γ} (h : w[a]? = some μ) (i : Fin n) :
net i (w.extract a (a + 1)) = Op.net i μ.2

Unpacking matches and pending pushes #

theorem Cslib.Automata.MPDA.Matches.of_isPushOn {n : ℕ} {Γ : Type u_1} {α : Type u_2} {w : List (α × Op n Γ)} {i : Fin n} {p m : ℕ} (h : Matches w p m) (hp : IsPushOn w i p) :
p < m ∧ (∃ (b : α) (γ : Γ), w[m]? = some (b, Op.pop i γ)) ∧ (∀ (k : ℕ), 0 ≤ net i (List.take k (w.extract (p + 1) m))) ∧ net i (w.extract (p + 1) m) = 0
theorem Cslib.Automata.MPDA.PendingAt.of_isPushOn {n : ℕ} {Γ : Type u_1} {α : Type u_2} {w : List (α × Op n Γ)} {i : Fin n} {p x : ℕ} (h : PendingAt w p x) (hp : IsPushOn w i p) :
p ≤ x ∧ x < w.length ∧ ∀ (k : ℕ), 0 ≤ net i (List.take k (w.extract (p + 1) (x + 1)))
theorem Cslib.Automata.MPDA.net_neg_of_pop {n : ℕ} {Γ : Type u_1} {α : Type u_2} {w : List (α × Op n Γ)} {i : Fin n} {a m m' : ℕ} {b : α} {γ : Γ} (ham : a ≤ m) (hmm' : m < m') (hm : w[m]? = some (b, Op.pop i γ)) (hnet : net i (w.extract a m) = 0) :
net i (List.take (m + 1 - a) (w.extract a m')) < 0

If the stack i returns to its height before position m, where it pops, then the factor up to m' pops below that height.

Crossings #

def Cslib.Automata.MPDA.Crossing {n : ℕ} {Γ : Type u_1} {α : Type u_2} (w : List (α × Op n Γ)) :

A crossing of w: the push at p on stack i is matched by the pop at z, and the push at q on another stack j, strictly between them, is still pending at z.

theorem Cslib.Automata.MPDA.Crossing.not_holeBounded_one {n : ℕ} {Γ : Type u_1} {α : Type u_2} {w : List (α × Op n Γ)} (h : Crossing w) :

A sequence with a crossing is not 1-hole-bounded.

Shifting crossings into larger sequences #

Balanced sequences #

def Cslib.Automata.MPDA.Balanced {n : ℕ} {Γ : Type u_1} {α : Type u_2} (w : List (α × Op n Γ)) :

A sequence is balanced if no prefix pops below the initial height of any stack and every stack returns to its initial height. The label sequences of complete runs are balanced.

theorem Cslib.Automata.MPDA.exists_first_pop {n : ℕ} {Γ : Type u_1} {α : Type u_2} (i : Fin n) (v : List (α × Op n Γ)) (d : ℕ) :
↑d + net i v < 0 → ∃ (u : List (α × Op n Γ)) (b : α) (δ : Γ) (u' : List (α × Op n Γ)), v = u ++ (b, Op.pop i δ) :: u' ∧ ↑d + net i u = 0 ∧ ∀ (k : ℕ), 0 ≤ ↑d + net i (List.take k u)

The first point where the height of stack i, starting at d, drops below zero is a pop on stack i.

theorem Cslib.Automata.MPDA.exists_pending_push {n : ℕ} {Γ : Type u_1} {α : Type u_2} {j : Fin n} {u : List (α × Op n Γ)} (hk : ∀ (k : ℕ), 0 ≤ net j (List.take k u)) (hpos : 0 < net j u) :
∃ q < u.length, IsPushOn u j q ∧ ∀ (k : ℕ), 0 ≤ net j (List.take k (List.drop (q + 1) u))

If no prefix of u pops below the initial height of stack j and u ends strictly above it, then some push on stack j in u is still pending at the end of u.

Prefixes and suffixes of balanced sequences #

Stacks along runs #

theorem Cslib.Automata.MPDA.balanced_of_configLTS_mTr {n : ℕ} {Γ : Type u_1} {α : Type u_2} {State : Type u_4} {M : MPDA n State α Γ} {s s' : State} {w : List (α × Op n Γ)} (h : M.configLTS.MTr { state := s, contents := Stacks.empty } w { state := s', contents := Stacks.empty }) :

The label sequence of a run from empty stacks to empty stacks is balanced.

Complete runs without crossings are well-nested #

theorem Cslib.Automata.MPDA.wellNested_of_not_crossing {n : ℕ} {Γ : Type u_1} {α : Type u_2} {State : Type u_4} {M : MPDA n State α Γ} {c c' : Config n State Γ} {w : List (α × Op n Γ)} (h : M.configLTS.MTr c w c') (hb : Balanced w) (hc : ¬Crossing w) :

A balanced run without crossings is well-nested.

One hole is no hole #

theorem Cslib.Automata.MPDA.holeBounded_one_iff_wellNested {n : ℕ} {Γ : Type u_1} {α : Type u_2} {State : Type u_4} {M : MPDA n State α Γ} {s s' : State} {w : List (α × Op n Γ)} (h : M.configLTS.MTr { state := s, contents := Stacks.empty } w { state := s', contents := Stacks.empty }) :

One hole is no hole, Theorem 2 in Appendix G.1 of [AGKR20] (arXiv:2002.05950v2): the label sequence of a complete run, from empty stacks to empty stacks, is 1-hole-bounded exactly when it is well-nested.