Langlib

Langlib.Automata.Pushdown.Basics.CountingStepsLeftmost

inductive ContextFreeGrammar.DerivesLeftmostIn {T : Type uT} (g : ContextFreeGrammar T) :
List (Symbol T g.NT)List (Symbol T g.NT)Prop

Given a context-free grammar g, strings u and v, and number n g.DerivesLeftmostIn u v n means that g can transform u to v in n rewriting steps.

Instances For
    theorem ContextFreeGrammar.DerivesLeftmostIn.trans {T : Type uT} {g : ContextFreeGrammar T} {n : } {u v w : List (Symbol T g.NT)} {m : } (huv : g.DerivesLeftmostIn u v n) (hvw : g.DerivesLeftmostIn v w m) :
    g.DerivesLeftmostIn u w (n + m)

    Add extra prefix to context-free deriving (number of steps unchanged).

    theorem ContextFreeGrammar.DerivesLeftmostIn.append_right {T : Type uT} {g : ContextFreeGrammar T} {n : } {v w : List (Symbol T g.NT)} (hvw : g.DerivesLeftmostIn v w n) (p : List (Symbol T g.NT)) :
    g.DerivesLeftmostIn (v ++ p) (w ++ p) n

    Add extra postfix to context-free deriving (number of steps unchanged).

    theorem ContextFreeGrammar.derivesLeftmostIn_cons {T : Type uT} {g : ContextFreeGrammar T} {n : } {x : Symbol T g.NT} {v u : List (Symbol T g.NT)} (h : g.DerivesLeftmostIn (x :: v) u n) :
    (∃ (u' : List (Symbol T g.NT)), u = u' ++ v g.DerivesLeftmostIn [x] u' n) ∃ (w₁ : List T) (u₂ : List (Symbol T g.NT)) (m₁ : ) (m₂ : ), m₁ n m₂ n u = List.map Symbol.terminal w₁ ++ u₂ g.DerivesLeftmostIn [x] (List.map Symbol.terminal w₁) m₁ g.DerivesLeftmostIn v u₂ m₂
    theorem ContextFreeGrammar.derivesLeftmostIn_cons' {T : Type uT} {g : ContextFreeGrammar T} {n : } {x : Symbol T g.NT} {v : List (Symbol T g.NT)} {u : List T} (h : g.DerivesLeftmostIn (x :: v) (List.map Symbol.terminal u) n) :
    ∃ (w₁ : List T) (w₂ : List T) (m₁ : ) (m₂ : ), m₁ n m₂ n u = w₁ ++ w₂ g.DerivesLeftmostIn [x] (List.map Symbol.terminal w₁) m₁ g.DerivesLeftmostIn v (List.map Symbol.terminal w₂) m₂