internlm/Lean-Github huggingface dataset:
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
pcs scs : List Char
path :
  (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).start)
    i pcs
step✝ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size i (↑next) scs
this✝ : i < nfa.nodes.size + 1
this : i = nfa.nodes.size
c : Char
h₁✝ : nfa.nodes.size ≤ i
h₂✝ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step : ↑next ∈ (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯))[i].charStep c
eqs : cs = pcs ++ [c]
⊢ Expr.matches cs (Expr.classes cls)
Tactic:
simp [this, NFA.Node.charStep, NFA.Node.εStep] at *
Proof state after:
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
pcs scs : List Char
c : Char
h₂✝ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
eqs : cs = pcs ++ [c]
path : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size nfa.nodes.size nfa.nodes.size pcs
step✝ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝ : True
step : c ∈ cls
⊢ Expr.matches cs (Expr.classes cls)
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
pcs scs : List Char
c : Char
h₂✝ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
eqs : cs = pcs ++ [c]
path : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size nfa.nodes.size nfa.nodes.size pcs
step✝ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝ : True
step : c ∈ cls
⊢ Expr.matches cs (Expr.classes cls)
Tactic:
cases path with
| base _ =>
  simp [eqs]
  exact .sparse cls c step
| step step rest =>
  cases step with
  | charStep _ _ step =>
    simp [NFA.Node.charStep] at step
    have := le_of_pathIn_left rest
    exact absurd next.isLt (Nat.not_lt_of_ge (step.right ▸ this))
  | εStep _ _ step => simp [NFA.Node.εStep] at step
Proof state after:
no goals
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case base
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝ : True
step : c ∈ cls
h✝ : nfa.nodes.size ≤ nfa.nodes.size
eqs : cs = [] ++ [c]
⊢ Expr.matches cs (Expr.classes cls)
Tactic:
simp [eqs]
Proof state after:
case base
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝ : True
step : c ∈ cls
h✝ : nfa.nodes.size ≤ nfa.nodes.size
eqs : cs = [] ++ [c]
⊢ Expr.matches [c] (Expr.classes cls)
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case base
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝ : True
step : c ∈ cls
h✝ : nfa.nodes.size ≤ nfa.nodes.size
eqs : cs = [] ++ [c]
⊢ Expr.matches [c] (Expr.classes cls)
Tactic:
exact .sparse cls c step
Proof state after:
no goals
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case step
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝¹ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝ : True
step✝ : c ∈ cls
j✝ : ℕ
cs₁✝ cs₂✝ : List Char
step : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size j✝ cs₁✝
rest : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size j✝ nfa.nodes.size cs₂✝
eqs : cs = cs₁✝ ++ cs₂✝ ++ [c]
⊢ Expr.matches cs (Expr.classes cls)
Tactic:
cases step with
| charStep _ _ step =>
  simp [NFA.Node.charStep] at step
  have := le_of_pathIn_left rest
  exact absurd next.isLt (Nat.not_lt_of_ge (step.right ▸ this))
| εStep _ _ step => simp [NFA.Node.εStep] at step
Proof state after:
no goals
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case step.charStep
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝¹ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝¹ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝¹ : True
step✝ : c ∈ cls
j✝ : ℕ
cs₂✝ : List Char
rest : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size j✝ nfa.nodes.size cs₂✝
c✝ : Char
h₁✝ : nfa.nodes.size ≤ nfa.nodes.size
h₂✝ : nfa.nodes.size < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step : j✝ ∈ (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯))[nfa.nodes.size].charStep c✝
eqs : cs = [c✝] ++ cs₂✝ ++ [c]
⊢ Expr.matches cs (Expr.classes cls)
Tactic:
simp [NFA.Node.charStep] at step
Proof state after:
case step.charStep
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝¹ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝¹ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝¹ : True
step✝ : c ∈ cls
j✝ : ℕ
cs₂✝ : List Char
rest : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size j✝ nfa.nodes.size cs₂✝
c✝ : Char
h₁✝ : nfa.nodes.size ≤ nfa.nodes.size
h₂✝ : nfa.nodes.size < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
eqs : cs = [c✝] ++ cs₂✝ ++ [c]
step : c✝ ∈ cls ∧ j✝ = ↑next
⊢ Expr.matches cs (Expr.classes cls)
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case step.charStep
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝¹ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝¹ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝¹ : True
step✝ : c ∈ cls
j✝ : ℕ
cs₂✝ : List Char
rest : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size j✝ nfa.nodes.size cs₂✝
c✝ : Char
h₁✝ : nfa.nodes.size ≤ nfa.nodes.size
h₂✝ : nfa.nodes.size < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
eqs : cs = [c✝] ++ cs₂✝ ++ [c]
step : c✝ ∈ cls ∧ j✝ = ↑next
⊢ Expr.matches cs (Expr.classes cls)
Tactic:
have := le_of_pathIn_left rest
Proof state after:
case step.charStep
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝¹ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝¹ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝¹ this✝ h₁✝¹ : True
step✝ : c ∈ cls
j✝ : ℕ
cs₂✝ : List Char
rest : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size j✝ nfa.nodes.size cs₂✝
c✝ : Char
h₁✝ : nfa.nodes.size ≤ nfa.nodes.size
h₂✝ : nfa.nodes.size < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
eqs : cs = [c✝] ++ cs₂✝ ++ [c]
step : c✝ ∈ cls ∧ j✝ = ↑next
this : nfa.nodes.size ≤ j✝
⊢ Expr.matches cs (Expr.classes cls)
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case step.charStep
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝¹ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝¹ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝¹ this✝ h₁✝¹ : True
step✝ : c ∈ cls
j✝ : ℕ
cs₂✝ : List Char
rest : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size j✝ nfa.nodes.size cs₂✝
c✝ : Char
h₁✝ : nfa.nodes.size ≤ nfa.nodes.size
h₂✝ : nfa.nodes.size < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
eqs : cs = [c✝] ++ cs₂✝ ++ [c]
step : c✝ ∈ cls ∧ j✝ = ↑next
this : nfa.nodes.size ≤ j✝
⊢ Expr.matches cs (Expr.classes cls)
Tactic:
exact absurd next.isLt (Nat.not_lt_of_ge (step.right ▸ this))
Proof state after:
no goals
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case step.εStep
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
scs : List Char
c : Char
h₂✝¹ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step✝¹ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size nfa.nodes.size (↑next) scs
this✝ this h₁✝¹ : True
step✝ : c ∈ cls
j✝ : ℕ
cs₂✝ : List Char
rest : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size j✝ nfa.nodes.size cs₂✝
h₁✝ : nfa.nodes.size ≤ nfa.nodes.size
h₂✝ : nfa.nodes.size < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step : j✝ ∈ (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯))[nfa.nodes.size].εStep
eqs : cs = [] ++ cs₂✝ ++ [c]
⊢ Expr.matches cs (Expr.classes cls)
Tactic:
simp [NFA.Node.εStep] at step
Proof state after:
no goals
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
cls : Data.Classes
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next (Expr.classes cls) = result
eq : result = nfa.pushNode (Node.sparse cls ↑next) ⋯
i : ℕ
pcs scs : List Char
path :
  (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).start)
    i pcs
step✝ : (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).stepIn nfa.nodes.size i (↑next) scs
this✝ : i < nfa.nodes.size + 1
this : i = nfa.nodes.size
h₁✝ : nfa.nodes.size ≤ i
h₂✝ : i < (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯)).nodes.size
step : ↑next ∈ (↑(nfa.pushNode (Node.sparse cls ↑next) ⋯))[i].εStep
eqs : cs = pcs ++ []
⊢ Expr.matches cs (Expr.classes cls)
Tactic:
simp [this, NFA.Node.charStep, NFA.Node.εStep] at *
Proof state after:
no goals
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case empty
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq : nfa.pushRegex next Expr.empty = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
⊢ Expr.matches cs Expr.empty
Tactic:
apply pushRegex.empty eq
Proof state after:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq : nfa.pushRegex next Expr.empty = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
⊢ result = nfa.pushNode Node.fail ⋯ → Expr.matches cs Expr.empty
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq : nfa.pushRegex next Expr.empty = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
⊢ result = nfa.pushNode Node.fail ⋯ → Expr.matches cs Expr.empty
Tactic:
intro eq
Proof state after:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
eq : result = nfa.pushNode Node.fail ⋯
⊢ Expr.matches cs Expr.empty
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
eq : result = nfa.pushNode Node.fail ⋯
⊢ Expr.matches cs Expr.empty
Tactic:
rw [eq] at path
Proof state after:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
path : (↑(nfa.pushNode Node.fail ⋯)).pathToNext (↑next) nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) cs
eq : result = nfa.pushNode Node.fail ⋯
⊢ Expr.matches cs Expr.empty
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
path : (↑(nfa.pushNode Node.fail ⋯)).pathToNext (↑next) nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) cs
eq : result = nfa.pushNode Node.fail ⋯
⊢ Expr.matches cs Expr.empty
Tactic:
obtain ⟨i, _, _, _, path, step⟩ := path
Proof state after:
case intro.intro.intro.intro.intro
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
⊢ Expr.matches cs Expr.empty
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case intro.intro.intro.intro.intro
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
⊢ Expr.matches cs Expr.empty
Tactic:
have : i < nfa.nodes.size + 1 := by
  have := step.h₂
  simp at this
  exact this
Proof state after:
case intro.intro.intro.intro.intro
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
this : i < nfa.nodes.size + 1
⊢ Expr.matches cs Expr.empty
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case intro.intro.intro.intro.intro
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
this : i < nfa.nodes.size + 1
⊢ Expr.matches cs Expr.empty
Tactic:
have : i = nfa.nodes.size := Nat.eq_of_le_of_lt_succ (le_of_pathIn_right path) this
Proof state after:
case intro.intro.intro.intro.intro
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
this✝ : i < nfa.nodes.size + 1
this : i = nfa.nodes.size
⊢ Expr.matches cs Expr.empty
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case intro.intro.intro.intro.intro
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
this✝ : i < nfa.nodes.size + 1
this : i = nfa.nodes.size
⊢ Expr.matches cs Expr.empty
Tactic:
cases step <;> simp [this, NFA.Node.charStep, NFA.Node.εStep] at *
Proof state after:
no goals
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
⊢ i < nfa.nodes.size + 1
Tactic:
have := step.h₂
Proof state after:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
this : i < (↑(nfa.pushNode Node.fail ⋯)).nodes.size
⊢ i < nfa.nodes.size + 1
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
this : i < (↑(nfa.pushNode Node.fail ⋯)).nodes.size
⊢ i < nfa.nodes.size + 1
Tactic:
simp at this
Proof state after:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
this : i < nfa.nodes.size + 1
⊢ i < nfa.nodes.size + 1
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.empty = result
eq : result = nfa.pushNode Node.fail ⋯
i : ℕ
w✝¹ w✝ : List Char
left✝ : cs = w✝¹ ++ w✝
path : (↑(nfa.pushNode Node.fail ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode Node.fail ⋯)).start) i w✝¹
step : (↑(nfa.pushNode Node.fail ⋯)).stepIn nfa.nodes.size i (↑next) w✝
this : i < nfa.nodes.size + 1
⊢ i < nfa.nodes.size + 1
Tactic:
exact this
Proof state after:
no goals
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
case epsilon
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq : nfa.pushRegex next Expr.epsilon = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
⊢ Expr.matches cs Expr.epsilon
Tactic:
apply pushRegex.epsilon eq
Proof state after:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq : nfa.pushRegex next Expr.epsilon = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
⊢ result = nfa.pushNode (Node.epsilon ↑next) ⋯ → Expr.matches cs Expr.epsilon
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq : nfa.pushRegex next Expr.epsilon = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
⊢ result = nfa.pushNode (Node.epsilon ↑next) ⋯ → Expr.matches cs Expr.epsilon
Tactic:
intro eq
Proof state after:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.epsilon = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
eq : result = nfa.pushNode (Node.epsilon ↑next) ⋯
⊢ Expr.matches cs Expr.epsilon
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.epsilon = result
path : (↑result).pathToNext (↑next) nfa.nodes.size (↑(↑result).start) cs
eq : result = nfa.pushNode (Node.epsilon ↑next) ⋯
⊢ Expr.matches cs Expr.epsilon
Tactic:
rw [eq] at path
Proof state after:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.epsilon = result
path :
  (↑(nfa.pushNode (Node.epsilon ↑next) ⋯)).pathToNext (↑next) nfa.nodes.size
    (↑(↑(nfa.pushNode (Node.epsilon ↑next) ⋯)).start) cs
eq : result = nfa.pushNode (Node.epsilon ↑next) ⋯
⊢ Expr.matches cs Expr.epsilon
Theorem: Regex.NFA.matches_of_pathToNext_pushRegex
Proof state before:
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.epsilon = result
path :
  (↑(nfa.pushNode (Node.epsilon ↑next) ⋯)).pathToNext (↑next) nfa.nodes.size
    (↑(↑(nfa.pushNode (Node.epsilon ↑next) ⋯)).start) cs
eq : result = nfa.pushNode (Node.epsilon ↑next) ⋯
⊢ Expr.matches cs Expr.epsilon
Tactic:
obtain ⟨i, _, _, eqs, path, step⟩ := path
Proof state after:
case intro.intro.intro.intro.intro
nfa : NFA
next : Fin nfa.nodes.size
result : { nfa' // nfa.nodes.size < nfa'.nodes.size }
cs : List Char
eq✝ : nfa.pushRegex next Expr.epsilon = result
eq : result = nfa.pushNode (Node.epsilon ↑next) ⋯
i : ℕ
w✝¹ w✝ : List Char
eqs : cs = w✝¹ ++ w✝
path :
  (↑(nfa.pushNode (Node.epsilon ↑next) ⋯)).pathIn nfa.nodes.size (↑(↑(nfa.pushNode (Node.epsilon ↑next) ⋯)).start) i w✝¹
step : (↑(nfa.pushNode (Node.epsilon ↑next) ⋯)).stepIn nfa.nodes.size i (↑next) w✝
⊢ Expr.matches cs Expr.epsilon