internlm/Lean-Github huggingface dataset:
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : 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')
⊢ ∀ (j : Fin nfa.nodes.size), j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i

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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
h✝ : ¬c = c'
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ ∀ (j : Fin nfa.nodes.size), j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
next hc =>
  simp at h
  have mem_next_iff := exploreεClosure_spec.mem_next_iff h inv
  intro j
  apply Iff.intro
  . intro hj
    cases (mem_next_iff j).mp hj with
    | inl hj => exact .inl hj
    | inr hj =>
      refine .inr ⟨target', ?_, hj⟩
      simp [charStep, Node.charStep, hn, hc]
  . intro hj
    cases hj with
    | inl hj => exact (mem_next_iff j).mpr (.inl hj)
    | inr hj =>
      simp [charStep, Node.charStep, hn, hc] at hj
      exact (mem_next_iff j).mpr (.inr hj)
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
h✝ : ¬c = c'
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ ∀ (j : Fin nfa.nodes.size), j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
h✝ : ¬c = c'
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ ∀ (j : Fin nfa.nodes.size), j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
next hc =>
  have : ∀ i, ¬i ∈ nfa.charStep target c := by
    intro i
    simp [charStep, Node.charStep, hn, hc]
  simp at h
  simp [h, this]
Proof state after:
no goals
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  (let_fun isLt := ⋯;
    let currentSave := saveSlots.get ↑target ⋯;
    exploreεClosure nfa pos next currentSave none saveSlots ⟨target', isLt⟩ #[]) =
    (matched', next', saveSlots')
⊢ ∀ (j : Fin nfa.nodes.size), j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
simp at h
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
⊢ ∀ (j : Fin nfa.nodes.size), j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
⊢ ∀ (j : Fin nfa.nodes.size), j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
have mem_next_iff := exploreεClosure_spec.mem_next_iff h inv
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
⊢ ∀ (j : Fin nfa.nodes.size), j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
⊢ ∀ (j : Fin nfa.nodes.size), j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
intro j
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof 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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ j ∈ next' ↔ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
apply Iff.intro
Proof state after:
case mp
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ j ∈ next' → j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i

case mpr
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ (j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i) → j ∈ next'
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mp
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ j ∈ next' → j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i

case mpr
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ (j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i) → j ∈ next'
Tactic:
. intro hj
  cases (mem_next_iff j).mp hj with
  | inl hj => exact .inl hj
  | inr hj =>
    refine .inr ⟨target', ?_, hj⟩
    simp [charStep, Node.charStep, hn, hc]
Proof state after:
case mpr
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ (j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i) → j ∈ next'
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mpr
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ (j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i) → j ∈ next'
Tactic:
. intro hj
  cases hj with
  | inl hj => exact (mem_next_iff j).mpr (.inl hj)
  | inr hj =>
    simp [charStep, Node.charStep, hn, hc] at hj
    exact (mem_next_iff j).mpr (.inr hj)
Proof state after:
no goals
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mp
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ j ∈ next' → j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
intro hj
Proof state after:
case mp
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
hj : j ∈ next'
⊢ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mp
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
hj : j ∈ next'
⊢ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
cases (mem_next_iff j).mp hj with
| inl hj => exact .inl hj
| inr hj =>
  refine .inr ⟨target', ?_, hj⟩
  simp [charStep, Node.charStep, hn, hc]
Proof state after:
no goals
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mp.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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
hj✝ : j ∈ next'
hj : j ∈ next
⊢ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
exact .inl hj
Proof state after:
no goals
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mp.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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
hj✝ : j ∈ next'
hj : ↑j ∈ nfa.εClosure ↑⟨target', ⋯⟩
⊢ j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
Tactic:
refine .inr ⟨target', ?_, hj⟩
Proof state after:
case mp.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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
hj✝ : j ∈ next'
hj : ↑j ∈ nfa.εClosure ↑⟨target', ⋯⟩
⊢ target' ∈ nfa.charStep (↑target) c
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mp.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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
hj✝ : j ∈ next'
hj : ↑j ∈ nfa.εClosure ↑⟨target', ⋯⟩
⊢ target' ∈ nfa.charStep (↑target) c
Tactic:
simp [charStep, Node.charStep, hn, hc]
Proof state after:
no goals
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mpr
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
⊢ (j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i) → j ∈ next'
Tactic:
intro hj
Proof state after:
case mpr
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
hj : j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
⊢ j ∈ next'
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mpr
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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
hj : j ∈ next ∨ ∃ i ∈ nfa.charStep (↑target) c, ↑j ∈ nfa.εClosure i
⊢ j ∈ next'
Tactic:
cases hj with
| inl hj => exact (mem_next_iff j).mpr (.inl hj)
| inr hj =>
  simp [charStep, Node.charStep, hn, hc] at hj
  exact (mem_next_iff j).mpr (.inr hj)
Proof state after:
no goals
Theorem: Regex.VM.stepChar_spec.mem_next_iff
Proof state before:
case mpr.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
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
c' : Char
target' : ℕ
hn : nfa[↑target] = Node.char c' target'
hc : c = c'
h :
  exploreεClosure nfa pos next (saveSlots.get ↑target ⋯) none saveSlots ⟨target', ⋯⟩ #[] = (matched', next', saveSlots')
mem_next_iff : ∀ (i : Fin nfa.nodes.size), i ∈ next' ↔ i ∈ next ∨ ↑i ∈ nfa.εClosure ↑⟨target', ⋯⟩
j : Fin nfa.nodes.size
hj : j ∈ next
⊢ j ∈ next'
Tactic:
exact (mem_next_iff j).mpr (.inl hj)
Proof state after:
no goals