Documentation

CslibFrontier.Computability.Automata.MPDA.WellNested

Well-nested runs of multistack pushdown automata #

A sequence of transitions is well-nested when every push has a matching pop later in the sequence, every pop has a matching push earlier in the sequence, and matching pairs do not cross. Following Section 3 of [AGKR20], well-nested sequences are generated by sequences of nop transitions, by surrounding a well-nested sequence with a matching push and pop on the same stack and with the same symbol, and by concatenation.

Well-nested runs are the building block of the reachability algorithm of [AGKR20]. Its first phase computes the relation WR of control states joined by a well-nested run, by saturation; Lemma 1 of the paper states that the saturation computes exactly this relation.

Main definitions #

Main results #

Implementation notes #

WellNestedReach is the relation computed by WellNestedReach (Algorithm 2, Appendix B of [AGKR20]), given as an inductive definition instead of a fixed-point computation. Algorithm 2 starts from the identity pairs and the nop transitions; the description in the main text (Section 3, item 1) mentions only the nop transitions. The identity pairs account for the empty well-nested run.

References #

inductive Cslib.Automata.MPDA.WellNested {n : ℕ} {Symbol : Type u_2} {Γ : Type u_3} :
List (Symbol × Op n Γ) → Prop

A sequence of transition labels is well-nested if it is generated by the empty sequence, prefixing a nop, and surrounding a well-nested sequence by a matching push and pop, followed by another well-nested sequence.

theorem Cslib.Automata.MPDA.WellNested.append {n : ℕ} {Symbol : Type u_2} {Γ : Type u_3} {w w' : List (Symbol × Op n Γ)} (h : WellNested w) (h' : WellNested w') :
WellNested (w ++ w')

Well-nested sequences are closed under concatenation.

theorem Cslib.Automata.MPDA.WellNested.contents_eq {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} {M : MPDA n State Symbol Γ} {w : List (Symbol × Op n Γ)} (hw : WellNested w) {c c' : Config n State Γ} (h : M.configLTS.MTr c w c') :

A well-nested run on configurations leaves the stacks unchanged.

theorem Cslib.Automata.MPDA.WellNested.configLTS_mTr {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} {M : MPDA n State Symbol Γ} {w : List (Symbol × Op n Γ)} (hw : WellNested w) {s s' : State} (h : M.MTr s w s') (σ : Stacks n Γ) :
M.configLTS.MTr { state := s, contents := σ } w { state := s', contents := σ }

A well-nested run of the control lifts to a run on configurations that starts and ends with the same, arbitrary, stack contents.

theorem Cslib.Automata.MPDA.WellNested.configLTS_mTr_iff {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} {M : MPDA n State Symbol Γ} {w : List (Symbol × Op n Γ)} (hw : WellNested w) {c c' : Config n State Γ} :
M.configLTS.MTr c w c' ↔ M.MTr c.state w c'.state ∧ c'.contents = c.contents

A well-nested sequence labels a run on configurations exactly when it labels a run of the control, and then the stacks are left unchanged.

inductive Cslib.Automata.MPDA.WellNestedReach {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} (M : MPDA n State Symbol Γ) :
State → State → Prop

Well-nested reachability between control states: the least relation containing the identity and closed under prefixing a nop transition, and under pushPop: a push, a related pair, the matching pop, and then a second, independently related pair. The suffix gives concatenation, so two consecutive matched pairs are related. This is the inductive characterization of the relation WR that the procedure WellNestedReach (Algorithm 2, Appendix B of [AGKR20]) computes by iterating on a finite table until it stabilizes; that finite computation and its termination are not formalized here.

theorem Cslib.Automata.MPDA.wellNestedReach_iff {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} {M : MPDA n State Symbol Γ} {s s' : State} :
M.WellNestedReach s s' ↔ ∃ (w : List (Symbol × Op n Γ)), WellNested w ∧ M.MTr s w s'

Lemma 1 in Section 3 of [AGKR20] (arXiv:2002.05950v2): a pair of control states is in WR exactly when there is a well-nested run of the control from the first to the second.

theorem Cslib.Automata.MPDA.accepts_of_wellNestedReach {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} {M : MPDA n State Symbol Γ} {s s' : State} (hs : s ∈ M.start) (hs' : s' ∈ M.accept) (h : M.WellNestedReach s s') :
∃ (xs : List Symbol), Acceptor.Accepts M xs

If an accepting state is well-nested reachable from an initial state, the MPDA accepts some word. This is the soundness of the first check of the emptiness procedure (Algorithm 1, Section 3 of [AGKR20]).