Unrestricted Lifting #
This file lifts unrestricted grammars across embeddings of nonterminal types.
Main declarations #
Equations
- lift_symbol_ lift_N (symbol.terminal t) = symbol.terminal t
- lift_symbol_ lift_N (symbol.nonterminal n) = symbol.nonterminal (lift_N n)
Instances For
Equations
- sink_symbol_ sink_N (symbol.terminal t) = some (symbol.terminal t)
- sink_symbol_ sink_N (symbol.nonterminal n) = Option.map symbol.nonterminal (sink_N n)
Instances For
Equations
- lift_string_ lift_N = List.map (lift_symbol_ lift_N)
Instances For
Equations
- sink_string_ sink_N = List.filterMap (sink_symbol_ sink_N)
Instances For
Equations
- lift_rule_ lift_N r = { input_L := lift_string_ lift_N r.input_L, input_N := lift_N r.input_N, input_R := lift_string_ lift_N r.input_R, output_string := lift_string_ lift_N r.output_string }
Instances For
sink_string_ preserves terminal-only lists.
lift_string_ preserves terminal-only lists.
- g₀ : grammar T
- g : grammar T
- lift_inj : Function.Injective self.lift_nt
Instances For
theorem
lift_deri_
{T : Type}
(lg : lifted_grammar_ T)
{w₁ w₂ : List (symbol T lg.g₀.nt)}
(hyp : grammar_derives lg.g₀ w₁ w₂)
:
grammar_derives lg.g (lift_string_ lg.lift_nt w₁) (lift_string_ lg.lift_nt w₂)
Equations
- good_letter_ (symbol.terminal _t) = True
- good_letter_ (symbol.nonterminal n) = ∃ (n₀ : lg.g₀.nt), lg.sink_nt n = some n₀
Instances For
Equations
- good_string_ s = ∀ a ∈ s, good_letter_ a
Instances For
theorem
sink_deri_
{T : Type}
(lg : lifted_grammar_ T)
{w₁ w₂ : List (symbol T lg.g.nt)}
(hyp : grammar_derives lg.g w₁ w₂)
(ok_input : good_string_ w₁)
:
grammar_derives lg.g₀ (sink_string_ lg.sink_nt w₁) (sink_string_ lg.sink_nt w₂)