Documentation

CslibFrontier.Computability.Automata.MPDA.WellNestedWitness

Well-nested witnesses #

A pair (s, s') of the set WR of [AGKR20] is unrolled into a well-nested run of the control from s to s' (Algorithm 5 of Appendix C). The search MPDA.wnWitness k tries the closure rules of WellNestedReach with fuel k: the identity pair, a nop transition followed by a pair, and a push, a pair, the matching pop and a pair. Each rule recurses with one unit of fuel less, so the search always terminates. A found sequence is a well-nested run, and the search succeeds on every pair of the k-th iterate of the fixed point that computes WR (MPDA.wellNestedStep). With the fuel used for WR (MPDA.wrWitness), it therefore succeeds exactly on the pairs of WR.

Algorithm 5 as printed recurses on pairs chosen without such a measure: its last case may choose the pair it was called on, so it need not terminate. The fuel is the repair.

The search enumerates letters, stack symbols and control states, so these types are FinEnum.

Main definitions #

Main results #

References #

def Cslib.Automata.MPDA.wnWitness {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} [FinEnum State] [FinEnum Symbol] [FinEnum Γ] (M : MPDA n State Symbol Γ) [(s : State) → (μ : Symbol × Op n Γ) → (s' : State) → Decidable (M.Tr s μ s')] :
ℕ → State → State → Option (List (Symbol × Op n Γ))

The search for a well-nested run of the control from s to s', with fuel k: the empty run, a nop transition followed by a run, or a push, a run, the matching pop and a run.

def Cslib.Automata.MPDA.wrWitness {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} [FinEnum State] [FinEnum Symbol] [FinEnum Γ] (M : MPDA n State Symbol Γ) [(s : State) → (μ : Symbol × Op n Γ) → (s' : State) → Decidable (M.Tr s μ s')] (s s' : State) :
Option (List (Symbol × Op n Γ))

The search for a well-nested run of the control from s to s', with the fuel that computes WR.

theorem Cslib.Automata.MPDA.wnWitness_spec {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} [FinEnum State] [FinEnum Symbol] [FinEnum Γ] {M : MPDA n State Symbol Γ} [(s : State) → (μ : Symbol × Op n Γ) → (s' : State) → Decidable (M.Tr s μ s')] {k : ℕ} {s s' : State} {w : List (Symbol × Op n Γ)} :
M.wnWitness k s s' = some w → WellNested w ∧ M.MTr s w s'

Soundness of the search: a found sequence is well-nested and runs the control from s to s'.

theorem Cslib.Automata.MPDA.isSome_wnWitness {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} [FinEnum State] [FinEnum Symbol] [FinEnum Γ] {M : MPDA n State Symbol Γ} [(s : State) → (μ : Symbol × Op n Γ) → (s' : State) → Decidable (M.Tr s μ s')] {k : ℕ} {s s' : State} :

Completeness of the search: it succeeds on every pair of the k-th iterate of the fixed point that computes WR.

theorem Cslib.Automata.MPDA.isSome_wrWitness {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} [FinEnum State] [FinEnum Symbol] [FinEnum Γ] {M : MPDA n State Symbol Γ} [(s : State) → (μ : Symbol × Op n Γ) → (s' : State) → Decidable (M.Tr s μ s')] {s s' : State} (h : (s, s') ∈ M.wellNestedPairs) :

The search with the fuel of WR succeeds on every pair of WR.

theorem Cslib.Automata.MPDA.isSome_wrWitness_iff {n : ℕ} {State : Type u_1} {Symbol : Type u_2} {Γ : Type u_3} [FinEnum State] [FinEnum Symbol] [FinEnum Γ] {M : MPDA n State Symbol Γ} [(s : State) → (μ : Symbol × Op n Γ) → (s' : State) → Decidable (M.Tr s μ s')] {s s' : State} :

A pair has a found well-nested run exactly when it is in WR.