- init {s : String} {nfa : NFA} {wf : nfa.WellFormed} {pos₀ pos : s.ValidPos} {i : Fin nfa.nodes.size} {update : List (ℕ × s.ValidPos)} (le : pos₀ ≤ pos) (cls : nfa.εClosure' pos ⟨nfa.start, ⋯⟩ i update) : nfa.VMPath wf pos₀ pos i update
- more {s : String} {nfa : NFA} {wf : nfa.WellFormed} {pos₀ : s.ValidPos} {i j k : Fin nfa.nodes.size} {pos pos' : s.ValidPos} {update₁ update₂ update₃ : List (ℕ × s.ValidPos)} (prev : nfa.VMPath wf pos₀ pos i update₁) (step : nfa.CharStep pos i j) (cls : nfa.εClosure' (pos.next ⋯) j k update₂) (hupdate : update₃ = update₁ ++ update₂) (hpos : pos' = pos.next ⋯) : nfa.VMPath wf pos₀ pos' k update₃
Instances For
theorem
Regex.NFA.VMPath.more_εStep
{s : String}
{nfa : NFA}
{wf : nfa.WellFormed}
{pos₀ pos : s.ValidPos}
{i j : Fin nfa.nodes.size}
{update₁ : List (ℕ × s.ValidPos)}
{update₂ : Option (ℕ × s.ValidPos)}
(prev : nfa.VMPath wf pos₀ pos i update₁)
(step : nfa.εStep' pos i j update₂)
:
nfa.VMPath wf pos₀ pos j (update₁ ++ List.ofOption update₂)
theorem
Regex.NFA.VMPath.more_step
{s : String}
{nfa : NFA}
{wf : nfa.WellFormed}
{pos₀ pos pos' : s.ValidPos}
{i : Fin nfa.nodes.size}
{j : ℕ}
{update₁ : List (ℕ × s.ValidPos)}
{update₂ : Option (ℕ × s.ValidPos)}
(prev : nfa.VMPath wf pos₀ pos i update₁)
(step : nfa.Step 0 (↑i) pos j pos' update₂)
:
nfa.VMPath wf pos₀ pos' ⟨j, ⋯⟩ (update₁ ++ List.ofOption update₂)
def
Regex.VM.SearchState.Inv
{s : String}
(nfa : NFA)
(wf : nfa.WellFormed)
(pos₀ pos : s.ValidPos)
(next : SearchState (HistoryStrategy s) nfa)
:
The invariant for the soundness theorem.
All states in next.state have a corresponding path from nfa.start to the state ending at pos,
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
{s : String}
{nfa : NFA}
{wf : nfa.WellFormed}
{pos₀ pos : s.ValidPos}
{next : SearchState (HistoryStrategy s) nfa}
(h : next.states.isEmpty = true)
:
Inv nfa wf pos₀ pos next
def
Regex.VM.SearchState.MemOfPathInv
{s : String}
(nfa : NFA)
(wf : nfa.WellFormed)
(pos₀ pos : s.ValidPos)
(next : SearchState (HistoryStrategy s) nfa)
:
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 pos, 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
{s : String}
(σ : Strategy s)
(nfa : NFA)
(next : SearchState σ nfa)
:
Invariant for the completeness theorem.
The .done state is not in next.states.
Equations
- Regex.VM.SearchState.NotDoneInv σ nfa next = ∀ i ∈ next.states, nfa[i] ≠ Regex.NFA.Node.done
Instances For
theorem
Regex.VM.SearchState.NotDoneInv.of_empty
{s : String}
{σ : Strategy s}
{nfa : NFA}
{next : SearchState σ nfa}
(h : next.states.isEmpty = true)
:
NotDoneInv σ nfa next