internlm/Lean-Github huggingface dataset:
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
case inr
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝ : target ∉ next
target₁ target₂ : ℕ
hn : nfa[↑target] = Node.split target₁ target₂
h :
  exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target₁, ⋯⟩
      (stack.push (StackEntry.explore ⟨target₂, ⋯⟩)) =
    (matched', next', saveSlots')
isLt : (Node.split target₁ target₂).inBounds nfa.nodes.size
j : Fin nfa.nodes.size
hj✝ : StackEntry.explore j ∈ stack.push (StackEntry.explore ⟨target₂, ⋯⟩)
hj : StackEntry.explore j = StackEntry.explore ⟨target₂, ⋯⟩
⊢ ↑j ∈ nfa.εClosure ↑i
Tactic:
simp at hj
Proof state after:
case inr
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝ : target ∉ next
target₁ target₂ : ℕ
hn : nfa[↑target] = Node.split target₁ target₂
h :
  exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target₁, ⋯⟩
      (stack.push (StackEntry.explore ⟨target₂, ⋯⟩)) =
    (matched', next', saveSlots')
isLt : (Node.split target₁ target₂).inBounds nfa.nodes.size
j : Fin nfa.nodes.size
hj✝ : StackEntry.explore j ∈ stack.push (StackEntry.explore ⟨target₂, ⋯⟩)
hj : j = ⟨target₂, ⋯⟩
⊢ ↑j ∈ nfa.εClosure ↑i
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
case inr
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝ : target ∉ next
target₁ target₂ : ℕ
hn : nfa[↑target] = Node.split target₁ target₂
h :
  exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target₁, ⋯⟩
      (stack.push (StackEntry.explore ⟨target₂, ⋯⟩)) =
    (matched', next', saveSlots')
isLt : (Node.split target₁ target₂).inBounds nfa.nodes.size
j : Fin nfa.nodes.size
hj✝ : StackEntry.explore j ∈ stack.push (StackEntry.explore ⟨target₂, ⋯⟩)
hj : j = ⟨target₂, ⋯⟩
⊢ ↑j ∈ nfa.εClosure ↑i
Tactic:
exact εClosure_snoc inv.1 (by simp [εStep, Node.εStep, hn, hj])
Proof state after:
no goals
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝ : target ∉ next
target₁ target₂ : ℕ
hn : nfa[↑target] = Node.split target₁ target₂
h :
  exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target₁, ⋯⟩
      (stack.push (StackEntry.explore ⟨target₂, ⋯⟩)) =
    (matched', next', saveSlots')
isLt : (Node.split target₁ target₂).inBounds nfa.nodes.size
j : Fin nfa.nodes.size
hj✝ : StackEntry.explore j ∈ stack.push (StackEntry.explore ⟨target₂, ⋯⟩)
hj : j = ⟨target₂, ⋯⟩
⊢ ↑j ∈ nfa.εStep ↑target
Tactic:
simp [εStep, Node.εStep, hn, hj]
Proof state after:
no goals
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
h :
  (if h : offset✝ < currentSave.size then
      exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots
        ⟨target', ⋯⟩ (stack.push (StackEntry.restore currentSave))
    else exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target', ⋯⟩ stack) =
    (matched', next', saveSlots')
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Tactic:
have isLt := nfa.inBounds' target hn
Proof state after:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
h :
  (if h : offset✝ < currentSave.size then
      exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots
        ⟨target', ⋯⟩ (stack.push (StackEntry.restore currentSave))
    else exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target', ⋯⟩ stack) =
    (matched', next', saveSlots')
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
h :
  (if h : offset✝ < currentSave.size then
      exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots
        ⟨target', ⋯⟩ (stack.push (StackEntry.restore currentSave))
    else exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target', ⋯⟩ stack) =
    (matched', next', saveSlots')
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Tactic:
split at h
Proof state after:
case inl
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
⊢ UpperBoundεClosure nfa i (next.insert target) next'

case inr
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : ¬offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target', ⋯⟩ stack =
    (matched', next', saveSlots')
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
case inl
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
⊢ UpperBoundεClosure nfa i (next.insert target) next'

case inr
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : ¬offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target', ⋯⟩ stack =
    (matched', next', saveSlots')
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Tactic:
next =>
  have inv' : UpperInvExploreεClosure nfa i ⟨target', isLt⟩ (stack.push (.restore currentSave)) := by
    refine ⟨εClosure_snoc inv.1 (by simp [εStep, Node.εStep, hn]), ?_⟩
    intro j hj
    cases (Array.mem_push ..).mp hj with
    | inl hj => exact inv.2 j hj
    | inr hj => contradiction
  exact upper_bound_exploreεClosure h inv'
Proof state after:
case inr
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : ¬offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target', ⋯⟩ stack =
    (matched', next', saveSlots')
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
case inr
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : ¬offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) currentSave matched saveSlots ⟨target', ⋯⟩ stack =
    (matched', next', saveSlots')
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Tactic:
next =>
  have inv' : UpperInvExploreεClosure nfa i ⟨target', isLt⟩ stack :=
    ⟨εClosure_snoc inv.1 (by simp [εStep, Node.εStep, hn]), inv.2⟩
  exact upper_bound_exploreεClosure h inv'
Proof state after:
no goals
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Tactic:
have inv' : UpperInvExploreεClosure nfa i ⟨target', isLt⟩ (stack.push (.restore currentSave)) := by
  refine ⟨εClosure_snoc inv.1 (by simp [εStep, Node.εStep, hn]), ?_⟩
  intro j hj
  cases (Array.mem_push ..).mp hj with
  | inl hj => exact inv.2 j hj
  | inr hj => contradiction
Proof state after:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
inv' : UpperInvExploreεClosure nfa i ⟨target', isLt⟩ (stack.push (StackEntry.restore currentSave))
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
inv' : UpperInvExploreεClosure nfa i ⟨target', isLt⟩ (stack.push (StackEntry.restore currentSave))
⊢ UpperBoundεClosure nfa i (next.insert target) next'
Tactic:
exact upper_bound_exploreεClosure h inv'
Proof state after:
no goals
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
⊢ UpperInvExploreεClosure nfa i ⟨target', isLt⟩ (stack.push (StackEntry.restore currentSave))
Tactic:
refine ⟨εClosure_snoc inv.1 (by simp [εStep, Node.εStep, hn]), ?_⟩
Proof state after:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
⊢ ∀ (j : Fin nfa.nodes.size), StackEntry.explore j ∈ stack.push (StackEntry.restore currentSave) → ↑j ∈ nfa.εClosure ↑i
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
⊢ ∀ (j : Fin nfa.nodes.size), StackEntry.explore j ∈ stack.push (StackEntry.restore currentSave) → ↑j ∈ nfa.εClosure ↑i
Tactic:
intro j hj
Proof state after:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
j : Fin nfa.nodes.size
hj : StackEntry.explore j ∈ stack.push (StackEntry.restore currentSave)
⊢ ↑j ∈ nfa.εClosure ↑i
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
j : Fin nfa.nodes.size
hj : StackEntry.explore j ∈ stack.push (StackEntry.restore currentSave)
⊢ ↑j ∈ nfa.εClosure ↑i
Tactic:
cases (Array.mem_push ..).mp hj with
| inl hj => exact inv.2 j hj
| inr hj => contradiction
Proof state after:
no goals
Theorem: Regex.VM.upper_bound_exploreεClosure
Proof state before:
nfa : NFA
pos : String.Pos
next : SparseSet nfa.nodes.size
currentSave : Array (Option String.Pos)
matched : Option (Array (Option String.Pos))
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
stack : Array (StackEntry nfa.nodes.size)
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
i : Fin nfa.nodes.size
inv : UpperInvExploreεClosure nfa i target stack
h✝¹ : target ∉ next
offset✝ target' : ℕ
hn : nfa[↑target] = Node.save offset✝ target'
isLt : (Node.save offset✝ target').inBounds nfa.nodes.size
h✝ : offset✝ < currentSave.size
h :
  exploreεClosure nfa pos (next.insert target) (currentSave.set ⟨offset✝, ⋯⟩ (some pos)) matched saveSlots ⟨target', ⋯⟩
      (stack.push (StackEntry.restore currentSave)) =
    (matched', next', saveSlots')
⊢ ↑⟨target', isLt⟩ ∈ nfa.εStep ↑target
Tactic:
simp [εStep, Node.εStep, hn]
Proof state after:
no goals