Theorem: Regex.VM.stepChar_mem_done_iff (RegexCorrectness/VM/Auxiliary.lean)

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
h : stepChar nfa c pos next saveSlots target = (matched', next', saveSlots')
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
unfold stepChar at h
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
h :
  (match hn : nfa[target] with
    | Node.char c' target' =>
      if c = c' then
        let_fun isLt := ⋯;
        let currentSave := saveSlots.get ↑target ⋯;
        exploreεClosure nfa pos next currentSave none saveSlots ⟨target', isLt⟩ #[]
      else (none, next, saveSlots)
    | Node.sparse cs target' =>
      if c ∈ cs then
        let_fun isLt := ⋯;
        let currentSave := saveSlots.get ↑target ⋯;
        exploreεClosure nfa pos next currentSave none saveSlots ⟨target', isLt⟩ #[]
      else (none, next, saveSlots)
    | x => (none, next, saveSlots)) =
    (matched', next', saveSlots')
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
h :
  (match hn : nfa[target] with
    | Node.char c' target' =>
      if c = c' then
        let_fun isLt := ⋯;
        let currentSave := saveSlots.get ↑target ⋯;
        exploreεClosure nfa pos next currentSave none saveSlots ⟨target', isLt⟩ #[]
      else (none, next, saveSlots)
    | Node.sparse cs target' =>
      if c ∈ cs then
        let_fun isLt := ⋯;
        let currentSave := saveSlots.get ↑target ⋯;
        exploreεClosure nfa pos next currentSave none saveSlots ⟨target', isLt⟩ #[]
      else (none, next, saveSlots)
    | x => (none, next, saveSlots)) =
    (matched', next', saveSlots')
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
split at h
State after:
case h_1
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h :
  (if c = c'✝ then
      let_fun isLt := ⋯;
      let currentSave := saveSlots.get ↑target ⋯;
      exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]
    else (none, next, saveSlots)) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case h_2
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h :
  (if c ∈ cs✝ then
      let_fun isLt := ⋯;
      let currentSave := saveSlots.get ↑target ⋯;
      exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]
    else (none, next, saveSlots)) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case h_3
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
case h_1
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h :
  (if c = c'✝ then
      let_fun isLt := ⋯;
      let currentSave := saveSlots.get ↑target ⋯;
      exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]
    else (none, next, saveSlots)) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case h_2
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h :
  (if c ∈ cs✝ then
      let_fun isLt := ⋯;
      let currentSave := saveSlots.get ↑target ⋯;
      exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]
    else (none, next, saveSlots)) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case h_3
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
next =>
  split at h
  next =>
    simp at h
    exact exploreεClosure_mem_done_iff h (by simp; exact hnotDone)
  next =>
    simp at h
    simp [←h]
    exact hnotDone
State after:
case h_2
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h :
  (if c ∈ cs✝ then
      let_fun isLt := ⋯;
      let currentSave := saveSlots.get ↑target ⋯;
      exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]
    else (none, next, saveSlots)) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case h_3
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
case h_2
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h :
  (if c ∈ cs✝ then
      let_fun isLt := ⋯;
      let currentSave := saveSlots.get ↑target ⋯;
      exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]
    else (none, next, saveSlots)) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case h_3
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
next =>
  split at h
  next =>
    simp at h
    exact exploreεClosure_mem_done_iff h (by simp; exact hnotDone)
  next =>
    simp at h
    simp [←h]
    exact hnotDone
State after:
case h_3
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
case h_3
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
next =>
  simp at h
  simp [←h]
  exact hnotDone
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h :
  (if c = c'✝ then
      let_fun isLt := ⋯;
      let currentSave := saveSlots.get ↑target ⋯;
      exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]
    else (none, next, saveSlots)) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
split at h
State after:
case inl
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : c = c'✝
h :
  (let_fun isLt := ⋯;
    let currentSave := saveSlots.get ↑target ⋯;
    exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case inr
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : ¬c = c'✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
case inl
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : c = c'✝
h :
  (let_fun isLt := ⋯;
    let currentSave := saveSlots.get ↑target ⋯;
    exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case inr
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : ¬c = c'✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
next =>
  simp at h
  exact exploreεClosure_mem_done_iff h (by simp; exact hnotDone)
State after:
case inr
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : ¬c = c'✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
case inr
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : ¬c = c'✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
next =>
  simp at h
  simp [←h]
  exact hnotDone
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : c = c'✝
h :
  (let_fun isLt := ⋯;
    let currentSave := saveSlots.get ↑target ⋯;
    exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
simp at h
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : c = c'✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : c = c'✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
exact exploreεClosure_mem_done_iff h (by simp; exact hnotDone)
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : c = c'✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next, nfa[i] = Node.done) ↔ none.isSome = true
Tactic:
simp
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : c = c'✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : c = c'✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done
Tactic:
exact hnotDone
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : ¬c = c'✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
simp at h
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : ¬c = c'✝
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : ¬c = c'✝
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
simp [←h]
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : ¬c = c'✝
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
c'✝ : Char
target'✝ : ℕ
heq✝ : nfa[target] = Node.char c'✝ target'✝
h✝ : ¬c = c'✝
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done
Tactic:
exact hnotDone
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h :
  (if c ∈ cs✝ then
      let_fun isLt := ⋯;
      let currentSave := saveSlots.get ↑target ⋯;
      exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]
    else (none, next, saveSlots)) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
split at h
State after:
case inl
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∈ cs✝
h :
  (let_fun isLt := ⋯;
    let currentSave := saveSlots.get ↑target ⋯;
    exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case inr
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∉ cs✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
case inl
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∈ cs✝
h :
  (let_fun isLt := ⋯;
    let currentSave := saveSlots.get ↑target ⋯;
    exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

case inr
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∉ cs✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
next =>
  simp at h
  exact exploreεClosure_mem_done_iff h (by simp; exact hnotDone)
State after:
case inr
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∉ cs✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
case inr
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∉ cs✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
next =>
  simp at h
  simp [←h]
  exact hnotDone
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∈ cs✝
h :
  (let_fun isLt := ⋯;
    let currentSave := saveSlots.get ↑target ⋯;
    exploreεClosure nfa pos next currentSave none saveSlots ⟨target'✝, isLt⟩ #[]) =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
simp at h
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∈ cs✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∈ cs✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
exact exploreεClosure_mem_done_iff h (by simp; exact hnotDone)
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∈ cs✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ (∃ i ∈ next, nfa[i] = Node.done) ↔ none.isSome = true
Tactic:
simp
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∈ cs✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∈ cs✝
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target'✝, ⋯⟩ #[] =
    (matched', next', saveSlots')
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done
Tactic:
exact hnotDone
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∉ cs✝
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
simp at h
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∉ cs✝
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∉ cs✝
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
simp [←h]
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∉ cs✝
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
cs✝ : Data.Classes
target'✝ : ℕ
heq✝ : nfa[target] = Node.sparse cs✝ target'✝
h✝ : c ∉ cs✝
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done
Tactic:
exact hnotDone
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
simp at h
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ (∃ i ∈ next', nfa[i] = Node.done) ↔ matched'.isSome = true
Tactic:
simp [←h]
State after:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done

State before:
nfa : NFA
c : Char
pos : String.Pos
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
target : Fin nfa.nodes.size
matched' : Option (Array (Option String.Pos))
next' : SparseSet nfa.nodes.size
saveSlots' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hnotDone : ∀ i ∈ next, nfa[i] ≠ Node.done
x✝¹ : ∀ (c' : Char) (target' : ℕ), nfa[target] = Node.char c' target' → False
x✝ : ∀ (cs : Data.Classes) (target' : ℕ), nfa[target] = Node.sparse cs target' → False
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (x : Fin nfa.nodes.size), next.mem x = true → ¬nfa[↑x] = Node.done
Tactic:
exact hnotDone
State after:
no goals