Documentation

RegexCorrectness.VM.Path.VMPath

theorem Regex.NFA.Step.εStep_or_charStep {nfa : NFA} {it it' : String.Iterator} {i j : } {update : Option ( × String.Pos)} (wf : nfa.WellFormed) (step : nfa.Step 0 i it j it' update) :
nfa.εStep' it i, j, update it' = it nfa.CharStep it i, j, it' = it.next update = none
inductive Regex.NFA.VMPath (nfa : NFA) (wf : nfa.WellFormed) (it₀ : String.Iterator) :
Instances For
    theorem Regex.NFA.VMPath.more_εStep {nfa : NFA} {wf : nfa.WellFormed} {it₀ it : String.Iterator} {i j : Fin nfa.nodes.size} {update₁ : List ( × String.Pos)} {update₂ : Option ( × String.Pos)} (prev : nfa.VMPath wf it₀ it i update₁) (step : nfa.εStep' it i j update₂) :
    nfa.VMPath wf it₀ it j (update₁ ++ List.ofOption update₂)
    theorem Regex.NFA.VMPath.more_charStep {nfa : NFA} {wf : nfa.WellFormed} {it₀ it : String.Iterator} {i j : Fin nfa.nodes.size} {update : List ( × String.Pos)} (prev : nfa.VMPath wf it₀ it i update) (step : nfa.CharStep it i j) :
    nfa.VMPath wf it₀ it.next j update
    theorem Regex.NFA.VMPath.more_step {nfa : NFA} {wf : nfa.WellFormed} {it₀ it it' : String.Iterator} {i : Fin nfa.nodes.size} {j : } {update₁ : List ( × String.Pos)} {update₂ : Option ( × String.Pos)} (prev : nfa.VMPath wf it₀ it i update₁) (step : nfa.Step 0 (↑i) it j it' update₂) :
    nfa.VMPath wf it₀ it' j, (update₁ ++ List.ofOption update₂)
    theorem Regex.NFA.VMPath.valid {nfa : NFA} {wf : nfa.WellFormed} {it₀ it : String.Iterator} {i : Fin nfa.nodes.size} {update : List ( × String.Pos)} (path : nfa.VMPath wf it₀ it i update) :
    theorem Regex.NFA.VMPath.toString {nfa : NFA} {wf : nfa.WellFormed} {it₀ it : String.Iterator} {i : Fin nfa.nodes.size} {update : List ( × String.Pos)} (path : nfa.VMPath wf it₀ it i update) :
    theorem Regex.NFA.VMPath.le_pos {nfa : NFA} {wf : nfa.WellFormed} {it₀ it : String.Iterator} {i : Fin nfa.nodes.size} {update : List ( × String.Pos)} (path : nfa.VMPath wf it₀ it i update) :
    it₀.pos it.pos
    theorem Regex.NFA.VMPath.εClosure_of_eq_it {nfa : NFA} {wf : nfa.WellFormed} {it : String.Iterator} {i : Fin nfa.nodes.size} {update : List ( × String.Pos)} (path : nfa.VMPath wf it it i update) :
    nfa.εClosure' it nfa.start, i update
    theorem Regex.NFA.VMPath.eq_or_nfaPath {nfa : NFA} {wf : nfa.WellFormed} {it₀ it : String.Iterator} {i : Fin nfa.nodes.size} {update : List ( × String.Pos)} (path : nfa.VMPath wf it₀ it i update) :
    i = nfa.start update = [] it.toString = it₀.toString it₀.pos it.pos ∃ (its : String.Iterator), its.toString = it₀.toString it₀.pos its.pos nfa.Path 0 nfa.start its (↑i) it update
    theorem Regex.NFA.VMPath.nfaPath_of_ne {nfa : NFA} {wf : nfa.WellFormed} {it₀ it : String.Iterator} {i : Fin nfa.nodes.size} {update : List ( × String.Pos)} (path : nfa.VMPath wf it₀ it i update) (ne : i nfa.start) :
    ∃ (its : String.Iterator), its.toString = it₀.toString it₀.pos its.pos nfa.Path 0 nfa.start its (↑i) it update
    theorem Regex.NFA.VMPath.concat_nfaPath {nfa : NFA} {wf : nfa.WellFormed} {it₀ it it' : String.Iterator} {i j : } {update₁ update₂ : List ( × String.Pos)} (isLt₁ : i < nfa.nodes.size) (path₁ : nfa.VMPath wf it₀ it i, isLt₁ update₁) (path₂ : nfa.Path 0 i it j it' update₂) :
    nfa.VMPath wf it₀ it' j, (update₁ ++ update₂)
    theorem Regex.NFA.VMPath.of_nfaPath {nfa : NFA} {it₀ it it' : String.Iterator} {i : } {update : List ( × String.Pos)} (wf : nfa.WellFormed) (eqs : it.toString = it₀.toString) (le : it₀.pos it.pos) (path : nfa.Path 0 nfa.start it i it' update) :
    nfa.VMPath wf it₀ it' i, update
    def Regex.VM.SearchState.Inv (nfa : NFA) (wf : nfa.WellFormed) (it₀ it : String.Iterator) (next : SearchState HistoryStrategy nfa) :

    The invariant for the soundness theorem.

    All states in next.state have a corresponding path from nfa.start to the state ending at it, and their updates are written to next.updates when necessary.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Regex.VM.SearchState.Inv.of_empty {nfa : NFA} {wf : nfa.WellFormed} {it₀ it : String.Iterator} {next : SearchState HistoryStrategy nfa} (h : next.states.isEmpty = true) :
      Inv nfa wf it₀ it next

      The invariant for the completeness theorem. The invariant holds only when returning .none, since we short-circuit when encountering .done.

      For all paths ending at it, the state must be tracked in next.states. We don't care about the updates for the completeness.

      Equations
      Instances For
        def Regex.VM.SearchState.NotDoneInv (σ : Strategy) (nfa : NFA) (next : SearchState σ nfa) :

        Invariant for the completeness theorem.

        The .done state is not in next.states.

        Equations
        Instances For
          theorem Regex.VM.SearchState.NotDoneInv.of_empty {σ : Strategy} {nfa : NFA} {next : SearchState σ nfa} (h : next.states.isEmpty = true) :
          NotDoneInv σ nfa next