Theorem: Regex.VM.eachStepChar_spec.preserve_cls.go (RegexCorrectness/VM/Auxiliary.lean)

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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 : eachStepChar.go nfa c pos current i hle next saveSlots = (matched', next', saveSlots')
inv : ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
unfold eachStepChar.go at h
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h :
  (if h : i = current.count then (none, next, saveSlots)
    else
      let_fun hlt := ⋯;
      let result := stepChar nfa c pos next saveSlots current[i];
      match result.1 with
      | none => eachStepChar.go nfa c pos current (i + 1) hlt result.2.1 result.2.2
      | some val => result) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h :
  (if h : i = current.count then (none, next, saveSlots)
    else
      let_fun hlt := ⋯;
      let result := stepChar nfa c pos next saveSlots current[i];
      match result.1 with
      | none => eachStepChar.go nfa c pos current (i + 1) hlt result.2.1 result.2.2
      | some val => result) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
split at h
State after:
case inl
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : i = current.count
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

case inr
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : ¬i = current.count
h :
  (let_fun hlt := ⋯;
    let result := stepChar nfa c pos next saveSlots current[i];
    match result.1 with
    | none => eachStepChar.go nfa c pos current (i + 1) hlt result.2.1 result.2.2
    | some val => result) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
case inl
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : i = current.count
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

case inr
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : ¬i = current.count
h :
  (let_fun hlt := ⋯;
    let result := stepChar nfa c pos next saveSlots current[i];
    match result.1 with
    | none => eachStepChar.go nfa c pos current (i + 1) hlt result.2.1 result.2.2
    | some val => result) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
next =>
  simp at h
  simp only [←h]
  exact inv
State after:
case inr
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : ¬i = current.count
h :
  (let_fun hlt := ⋯;
    let result := stepChar nfa c pos next saveSlots current[i];
    match result.1 with
    | none => eachStepChar.go nfa c pos current (i + 1) hlt result.2.1 result.2.2
    | some val => result) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
case inr
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : ¬i = current.count
h :
  (let_fun hlt := ⋯;
    let result := stepChar nfa c pos next saveSlots current[i];
    match result.1 with
    | none => eachStepChar.go nfa c pos current (i + 1) hlt result.2.1 result.2.2
    | some val => result) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
next hi =>
  have hlt : i < current.count := Nat.lt_of_le_of_ne hle hi
  simp at h
  generalize hres : stepChar nfa c pos next saveSlots current[i] = result at h
  let (matched'', next'', saveSlots'') := result
  split at h
  next =>
    simp at h
    exact eachStepChar_spec.preserve_cls.go h (stepChar_spec.preserve_cls hres inv)
  next =>
    simp at h
    simp only [←h]
    exact stepChar_spec.preserve_cls hres inv
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : i = current.count
h : (none, next, saveSlots) = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
simp at h
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : i = current.count
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : i = current.count
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
simp only [←h]
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : i = current.count
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
h✝ : i = current.count
h : none = matched' ∧ next = next' ∧ saveSlots = saveSlots'
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next → ↑j ∈ nfa.εStep ↑i → j ∈ next
Tactic:
exact inv
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
h :
  (let_fun hlt := ⋯;
    let result := stepChar nfa c pos next saveSlots current[i];
    match result.1 with
    | none => eachStepChar.go nfa c pos current (i + 1) hlt result.2.1 result.2.2
    | some val => result) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
have hlt : i < current.count := Nat.lt_of_le_of_ne hle hi
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
h :
  (let_fun hlt := ⋯;
    let result := stepChar nfa c pos next saveSlots current[i];
    match result.1 with
    | none => eachStepChar.go nfa c pos current (i + 1) hlt result.2.1 result.2.2
    | some val => result) =
    (matched', next', saveSlots')
hlt : i < current.count
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
h :
  (let_fun hlt := ⋯;
    let result := stepChar nfa c pos next saveSlots current[i];
    match result.1 with
    | none => eachStepChar.go nfa c pos current (i + 1) hlt result.2.1 result.2.2
    | some val => result) =
    (matched', next', saveSlots')
hlt : i < current.count
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
simp at h
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
h :
  (match (stepChar nfa c pos next saveSlots current[i]).1 with
    | none =>
      eachStepChar.go nfa c pos current (i + 1) ⋯ (stepChar nfa c pos next saveSlots current[i]).2.1
        (stepChar nfa c pos next saveSlots current[i]).2.2
    | some val => stepChar nfa c pos next saveSlots current[i]) =
    (matched', next', saveSlots')
hlt : i < current.count
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
h :
  (match (stepChar nfa c pos next saveSlots current[i]).1 with
    | none =>
      eachStepChar.go nfa c pos current (i + 1) ⋯ (stepChar nfa c pos next saveSlots current[i]).2.1
        (stepChar nfa c pos next saveSlots current[i]).2.2
    | some val => stepChar nfa c pos next saveSlots current[i]) =
    (matched', next', saveSlots')
hlt : i < current.count
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
generalize hres : stepChar nfa c pos next saveSlots current[i] = result at h
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = result
h :
  (match result.1 with
    | none => eachStepChar.go nfa c pos current (i + 1) ⋯ result.2.1 result.2.2
    | some val => result) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = result
h :
  (match result.1 with
    | none => eachStepChar.go nfa c pos current (i + 1) ⋯ result.2.1 result.2.2
    | some val => result) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
let (matched'', next'', saveSlots'') := result
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
h :
  (match (matched'', next'', saveSlots'').1 with
    | none =>
      eachStepChar.go nfa c pos current (i + 1) ⋯ (matched'', next'', saveSlots'').2.1
        (matched'', next'', saveSlots'').2.2
    | some val => (matched'', next'', saveSlots'')) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
h :
  (match (matched'', next'', saveSlots'').1 with
    | none =>
      eachStepChar.go nfa c pos current (i + 1) ⋯ (matched'', next'', saveSlots'').2.1
        (matched'', next'', saveSlots'').2.2
    | some val => (matched'', next'', saveSlots'')) =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
split at h
State after:
case h_1
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
heq✝ : (matched'', next'', saveSlots'').1 = none
h :
  eachStepChar.go nfa c pos current (i + 1) ⋯ (matched'', next'', saveSlots'').2.1
      (matched'', next'', saveSlots'').2.2 =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

case h_2
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
val✝ : Array (Option String.Pos)
heq✝ : (matched'', next'', saveSlots'').1 = some val✝
h : (matched'', next'', saveSlots'') = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
case h_1
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
heq✝ : (matched'', next'', saveSlots'').1 = none
h :
  eachStepChar.go nfa c pos current (i + 1) ⋯ (matched'', next'', saveSlots'').2.1
      (matched'', next'', saveSlots'').2.2 =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

case h_2
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
val✝ : Array (Option String.Pos)
heq✝ : (matched'', next'', saveSlots'').1 = some val✝
h : (matched'', next'', saveSlots'') = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
next =>
  simp at h
  exact eachStepChar_spec.preserve_cls.go h (stepChar_spec.preserve_cls hres inv)
State after:
case h_2
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
val✝ : Array (Option String.Pos)
heq✝ : (matched'', next'', saveSlots'').1 = some val✝
h : (matched'', next'', saveSlots'') = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
case h_2
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
val✝ : Array (Option String.Pos)
heq✝ : (matched'', next'', saveSlots'').1 = some val✝
h : (matched'', next'', saveSlots'') = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
next =>
  simp at h
  simp only [←h]
  exact stepChar_spec.preserve_cls hres inv
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
heq✝ : (matched'', next'', saveSlots'').1 = none
h :
  eachStepChar.go nfa c pos current (i + 1) ⋯ (matched'', next'', saveSlots'').2.1
      (matched'', next'', saveSlots'').2.2 =
    (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
simp at h
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
heq✝ : (matched'', next'', saveSlots'').1 = none
h : eachStepChar.go nfa c pos current (i + 1) ⋯ next'' saveSlots'' = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
heq✝ : (matched'', next'', saveSlots'').1 = none
h : eachStepChar.go nfa c pos current (i + 1) ⋯ next'' saveSlots'' = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
exact eachStepChar_spec.preserve_cls.go h (stepChar_spec.preserve_cls hres inv)
State after:
no goals

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
val✝ : Array (Option String.Pos)
heq✝ : (matched'', next'', saveSlots'').1 = some val✝
h : (matched'', next'', saveSlots'') = (matched', next', saveSlots')
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
simp at h
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
val✝ : Array (Option String.Pos)
heq✝ : (matched'', next'', saveSlots'').1 = some val✝
h : matched'' = matched' ∧ next'' = next' ∧ saveSlots'' = saveSlots'
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
val✝ : Array (Option String.Pos)
heq✝ : (matched'', next'', saveSlots'').1 = some val✝
h : matched'' = matched' ∧ next'' = next' ∧ saveSlots'' = saveSlots'
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next' → ↑j ∈ nfa.εStep ↑i → j ∈ next'
Tactic:
simp only [←h]
State after:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
val✝ : Array (Option String.Pos)
heq✝ : (matched'', next'', saveSlots'').1 = some val✝
h : matched'' = matched' ∧ next'' = next' ∧ saveSlots'' = saveSlots'
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next'' → ↑j ∈ nfa.εStep ↑i → j ∈ next''

State before:
nfa : NFA
c : Char
pos : String.Pos
current : SparseSet nfa.nodes.size
i : ℕ
hle : i ≤ current.count
next : SparseSet nfa.nodes.size
saveSlots : Data.Vec (Array (Option String.Pos)) 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
hi : ¬i = current.count
hlt : i < current.count
result :
  Option (Array (Option String.Pos)) × SparseSet nfa.nodes.size × Data.Vec (Array (Option String.Pos)) nfa.nodes.size
matched'' : Option (Array (Option String.Pos))
next'' : SparseSet nfa.nodes.size
saveSlots'' : Data.Vec (Array (Option String.Pos)) nfa.nodes.size
hres : stepChar nfa c pos next saveSlots current[i] = (matched'', next'', saveSlots'')
x✝ : Option (Array (Option String.Pos))
val✝ : Array (Option String.Pos)
heq✝ : (matched'', next'', saveSlots'').1 = some val✝
h : matched'' = matched' ∧ next'' = next' ∧ saveSlots'' = saveSlots'
⊢ ∀ (i j : Fin nfa.nodes.size), i ∈ next'' → ↑j ∈ nfa.εStep ↑i → j ∈ next''
Tactic:
exact stepChar_spec.preserve_cls hres inv
State after:
no goals