Control-effect soundness for Aho's machine #
Grammar effects of local, close-crossing, and structural control moves.
Local grammar effects in the execution-order denotation #
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.plainBinary
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A B C : g.nt}
(haug : AugBinary g A B C)
(h : ExecRep g { left := left, focus := WorkSym.plain A, right := next :: right } form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.plainTerminal
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A : g.nt}
{a : T}
(haug : AugTerminal g A a)
(h : ExecRep g { left := left, focus := WorkSym.plain A, right := next :: right } form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.plainPushSkip
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A B : g.nt}
{f : g.flag}
(haug : AugPush g A B f)
(h : ExecRep g { left := left, focus := WorkSym.plain A, right := next :: right } form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.plainPushUse
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A B : g.nt}
{f : g.flag}
(haug : AugPush g A B f)
(h : ExecRep g { left := left, focus := WorkSym.plain A, right := next :: right } form)
:
∃ (form' : List g.ISym),
ExecRep g
{ left := left, focus := WorkSym.live B,
right := WorkSym.index (cflagBase g f) IndexMark.firstPending :: next :: right }
form' ∧ g.Derives form form'
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.liveBinaryBoth
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A B C : g.nt}
(haug : AugBinary g A B C)
(h : ExecRep g { left := left, focus := WorkSym.live A, right := next :: right } form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.liveBinaryLeft
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A B C : g.nt}
(haug : AugBinary g A B C)
(h : ExecRep g { left := left, focus := WorkSym.live A, right := next :: right } form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.liveBinaryRight
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A B C : g.nt}
(haug : AugBinary g A B C)
(h : ExecRep g { left := left, focus := WorkSym.live A, right := next :: right } form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.livePushFresh
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A B : g.nt}
{f : g.flag}
(haug : AugPush g A B f)
(h : ExecRep g { left := left, focus := WorkSym.live A, right := next :: right } form)
:
∃ (form' : List g.ISym),
ExecRep g
{ left := left, focus := WorkSym.live B,
right := WorkSym.index (cflagBase g f) IndexMark.laterPending :: next :: right }
form' ∧ g.Derives form form'
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.livePushCompress
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A B : g.nt}
{f : g.flag}
{R : CFlag g}
{d : IndexMark}
(haug : AugPush g A B f)
(h : ExecRep g { left := left, focus := WorkSym.live A, right := WorkSym.index R d :: next :: right } form)
:
Close-crossing pop effects #
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.invertLive
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{A : g.nt}
(h : ExecRep g { left := left, focus := WorkSym.live A, right := next :: right } form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.popPlain
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{alpha beta gamma : List (WorkSym g)}
{form : List g.ISym}
{R : CFlag g}
{d : IndexMark}
{A B : g.nt}
(hfree : IndexFree beta)
(hedge : R A B = true)
(h :
ExecRep g { left := alpha ++ [WorkSym.dollar], focus := WorkSym.live A, right := beta ++ WorkSym.index R d :: gamma }
form)
:
∃ (form' : List g.ISym),
ExecRep g
{ left := alpha ++ [WorkSym.dollar] ++ beta ++ [WorkSym.index R d, WorkSym.dollar], focus := WorkSym.plain B,
right := WorkSym.close :: gamma }
form' ∧ g.Derives form form'
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.popLive
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{alpha beta gamma : List (WorkSym g)}
{form : List g.ISym}
{R : CFlag g}
{d : IndexMark}
{A B : g.nt}
(hfree : IndexFree beta)
(hedge : R A B = true)
(hlater : d.later = true)
(h :
ExecRep g { left := alpha ++ [WorkSym.dollar], focus := WorkSym.live A, right := beta ++ WorkSym.index R d :: gamma }
form)
:
∃ (form' : List g.ISym),
ExecRep g
{ left := alpha ++ [WorkSym.dollar] ++ beta ++ [WorkSym.index R d, WorkSym.dollar], focus := WorkSym.live B,
right := WorkSym.close :: gamma }
form' ∧ g.Derives form form'
Structural execution effects #
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.matchTerminal
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{a : T}
(h : ExecRep g { left := left, focus := WorkSym.terminal a, right := next :: right } form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.eraseIndex
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left : List (WorkSym g)}
{next : WorkSym g}
{right : List (WorkSym g)}
{form : List g.ISym}
{R : CFlag g}
{d : IndexMark}
(h : ExecRep g { left := left, focus := WorkSym.index R d, right := next :: right } form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.invertClose
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{left right : List (WorkSym g)}
{form : List g.ISym}
(h : ExecRep g { left := left, focus := WorkSym.close, right := right } form)
:
Generic inversion at a close focus.
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.focus_ne_dollar
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{cursor : WorkCursor g}
{form : List g.ISym}
(h : ExecRep g cursor form)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.right_ne_nil_of_plain_focus
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{cursor : WorkCursor g}
{form : List g.ISym}
{A : g.nt}
(h : ExecRep g cursor form)
(hfocus : cursor.focus = WorkSym.plain A)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.right_ne_nil_of_index_focus
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{cursor : WorkCursor g}
{form : List g.ISym}
{R : CFlag g}
{d : IndexMark}
(h : ExecRep g cursor form)
(hfocus : cursor.focus = WorkSym.index R d)
:
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.popPlainErase
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{alpha gamma : List (WorkSym g)}
{form : List g.ISym}
{R : CFlag g}
{d : IndexMark}
{A B : g.nt}
(hedge : R A B = true)
(h : ExecRep g { left := alpha ++ [WorkSym.dollar], focus := WorkSym.live A, right := WorkSym.index R d :: gamma } form)
:
Consume an adjacent compressed block and erase its representation immediately. Unlike the framed pop, no saved index is needed because this block is owned exclusively by the active task.
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.popLiveErase
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{alpha gamma : List (WorkSym g)}
{form : List g.ISym}
{R : CFlag g}
{d : IndexMark}
{A B : g.nt}
(hedge : R A B = true)
(hlater : d.later = true)
(h : ExecRep g { left := alpha ++ [WorkSym.dollar], focus := WorkSym.live A, right := WorkSym.index R d :: gamma } form)
:
Live counterpart of popPlainErase for a lower represented stack that remains active.
theorem
IndexedGrammar.Aho.ControlDenotation.ExecRep.returnFrameSound
{T : Type}
{g : IndexedGrammar T}
[Fintype g.nt]
{alpha beta gamma : List (WorkSym g)}
{Z : WorkSym g}
{form : List g.ISym}
(hZ : Z ≠ WorkSym.dollar)
(hfree : DollarFree beta)
(h :
ExecRep g { left := alpha ++ [WorkSym.dollar, Z] ++ beta ++ [WorkSym.dollar], focus := WorkSym.close, right := gamma }
form)
: