Theorem: RegularExpression.star_rmatch_iff
File: Mathlib/Computability/RegularExpressions.lean

tactic: have A : ∀ m n : ℕ, n < m + n + 1 := by
  intro m n
  convert add_lt_add_of_le_of_lt (add_le_add (zero_le m) (le_refl n)) zero_lt_one
  simp
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
⊢ rmatch (star P) x = true ↔ ∃ S, x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: have IH := fun t (_h : List.length t < List.length x) => star_rmatch_iff P t
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
A : ∀ (m n : ℕ), n < m + n + 1
⊢ rmatch (star P) x = true ↔ ∃ S, x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: clear star_rmatch_iff
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length x →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
⊢ rmatch (star P) x = true ↔ ∃ S, x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: constructor
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length x →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
⊢ rmatch (star P) x = true ↔ ∃ S, x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: intro m n
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
⊢ ∀ (m n : ℕ), n < m + n + 1

tactic: convert add_lt_add_of_le_of_lt (add_le_add (zero_le m) (le_refl n)) zero_lt_one
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
m n : ℕ
⊢ n < m + n + 1

tactic: simp
state_before: case h.e'_3
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
m n : ℕ
⊢ n = 0 + n + 0

tactic: cases' x with a x
state_before: case mp
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length x →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
⊢ rmatch (star P) x = true → ∃ S, x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: intro _h
state_before: case mp.nil
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length [] →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
⊢ rmatch (star P) [] = true → ∃ S, [] = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: use []
state_before: case mp.nil
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length [] →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
_h : rmatch (star P) [] = true
⊢ ∃ S, [] = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: dsimp
state_before: case mp.nil
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length [] →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
_h : rmatch (star P) [] = true
⊢ [] = join [] ∧ ∀ (t : List α), t ∈ [] → t ≠ [] ∧ rmatch P t = true

tactic: tauto
state_before: case mp.nil
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length [] →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
_h : rmatch (star P) [] = true
⊢ [] = [] ∧ ∀ (t : List α), t ∈ [] → ¬t = [] ∧ rmatch P t = true

tactic: rw [rmatch, deriv, mul_rmatch_iff]
state_before: case mp.cons
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
⊢ rmatch (star P) (a :: x) = true → ∃ S, a :: x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: rintro ⟨t, u, hs, ht, hu⟩
state_before: case mp.cons
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
⊢ (∃ t u, x = t ++ u ∧ rmatch (deriv P a) t = true ∧ rmatch (star P) u = true) →
    ∃ S, a :: x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: have hwf : u.length < (List.cons a x).length := by
  rw [hs, List.length_cons, List.length_append]
  apply A
state_before: case mp.cons.intro.intro.intro.intro
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hu : rmatch (star P) u = true
⊢ ∃ S, a :: x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: rw [IH _ hwf] at hu
state_before: case mp.cons.intro.intro.intro.intro
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hu : rmatch (star P) u = true
hwf : length u < length (a :: x)
⊢ ∃ S, a :: x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: rcases hu with ⟨S', hsum, helem⟩
state_before: case mp.cons.intro.intro.intro.intro
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hu : ∃ S, u = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true
hwf : length u < length (a :: x)
⊢ ∃ S, a :: x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: use (a :: t) :: S'
state_before: case mp.cons.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
⊢ ∃ S, a :: x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: constructor
state_before: case mp.cons.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
⊢ a :: x = join ((a :: t) :: S') ∧ ∀ (t_1 : List α), t_1 ∈ (a :: t) :: S' → t_1 ≠ [] ∧ rmatch P t_1 = true

tactic: rw [hs, List.length_cons, List.length_append]
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hu : rmatch (star P) u = true
⊢ length u < length (a :: x)

tactic: apply A
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hu : rmatch (star P) u = true
⊢ length u < Nat.succ (length t + length u)

tactic: simp [hs, hsum]
state_before: case mp.cons.intro.intro.intro.intro.intro.intro.left
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
⊢ a :: x = join ((a :: t) :: S')

tactic: intro t' ht'
state_before: case mp.cons.intro.intro.intro.intro.intro.intro.right
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
⊢ ∀ (t_1 : List α), t_1 ∈ (a :: t) :: S' → t_1 ≠ [] ∧ rmatch P t_1 = true

tactic: cases ht'
state_before: case mp.cons.intro.intro.intro.intro.intro.intro.right
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
t' : List α
ht' : t' ∈ (a :: t) :: S'
⊢ t' ≠ [] ∧ rmatch P t' = true

tactic: case head ht' =>
  simp only [ne_eq, not_false_iff, true_and, rmatch]
  exact ht
state_before: case mp.cons.intro.intro.intro.intro.intro.intro.right.head
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
⊢ a :: t ≠ [] ∧ rmatch P (a :: t) = true

case mp.cons.intro.intro.intro.intro.intro.intro.right.tail
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝¹ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
t' : List α
a✝ : Mem t' S'
⊢ t' ≠ [] ∧ rmatch P t' = true

tactic: case tail ht' => exact helem t' ht'
state_before: case mp.cons.intro.intro.intro.intro.intro.intro.right.tail
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝¹ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
t' : List α
a✝ : Mem t' S'
⊢ t' ≠ [] ∧ rmatch P t' = true

tactic: simp only [ne_eq, not_false_iff, true_and, rmatch]
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
ht' b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
⊢ a :: t ≠ [] ∧ rmatch P (a :: t) = true

tactic: exact ht
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
ht' b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
⊢ rmatch (deriv P a) t = true

tactic: exact helem t' ht'
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t u : List α
hs : x = t ++ u
ht : rmatch (deriv P a) t = true
hwf : length u < length (a :: x)
S' : List (List α)
hsum : u = join S'
helem : ∀ (t : List α), t ∈ S' → t ≠ [] ∧ rmatch P t = true
t' : List α
ht' : Mem t' S'
⊢ t' ≠ [] ∧ rmatch P t' = true

tactic: rintro ⟨S, hsum, helem⟩
state_before: case mpr
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length x →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
⊢ (∃ S, x = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true) → rmatch (star P) x = true

tactic: dsimp
state_before: case mpr.intro.intro
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length x →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
S : List (List α)
hsum : x = join S
helem : ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true
⊢ rmatch (star P) x = true

tactic: cases' x with a x
state_before: case mpr.intro.intro
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
x : List α
A : ∀ (m n : ℕ), n < m + n + 1
IH :
  ∀ (t : List α),
    length t < length x →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
S : List (List α)
hsum : x = join S
helem : ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true
⊢ rmatch (star P) x = true

tactic: rfl
state_before: case mpr.intro.intro.nil
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
S : List (List α)
helem : ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true
IH :
  ∀ (t : List α),
    length t < length [] →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
hsum : [] = join S
⊢ rmatch (star P) [] = true

tactic: rw [rmatch, deriv, mul_rmatch_iff]
state_before: case mpr.intro.intro.cons
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
S : List (List α)
helem : ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
hsum : a :: x = join S
⊢ rmatch (star P) (a :: x) = true

tactic: cases' S with t' U
state_before: case mpr.intro.intro.cons
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
S : List (List α)
helem : ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
hsum : a :: x = join S
⊢ ∃ t u, x = t ++ u ∧ rmatch (deriv P a) t = true ∧ rmatch (star P) u = true

tactic: exact ⟨[], [], by tauto⟩
state_before: case mpr.intro.intro.cons.nil
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
helem : ∀ (t : List α), t ∈ [] → t ≠ [] ∧ rmatch P t = true
hsum : a :: x = join []
⊢ ∃ t u, x = t ++ u ∧ rmatch (deriv P a) t = true ∧ rmatch (star P) u = true

tactic: tauto
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
helem : ∀ (t : List α), t ∈ [] → t ≠ [] ∧ rmatch P t = true
hsum : a :: x = join []
⊢ x = [] ++ [] ∧ rmatch (deriv P a) [] = true ∧ rmatch (star P) [] = true

tactic: cases' t' with b t
state_before: case mpr.intro.intro.cons.cons
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
t' : List α
U : List (List α)
helem : ∀ (t : List α), t ∈ t' :: U → t ≠ [] ∧ rmatch P t = true
hsum : a :: x = join (t' :: U)
⊢ ∃ t u, x = t ++ u ∧ rmatch (deriv P a) t = true ∧ rmatch (star P) u = true

tactic: simp only [List.join, List.cons_append, List.cons_eq_cons] at hsum
state_before: case mpr.intro.intro.cons.cons.cons
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a :: x = join ((b :: t) :: U)
⊢ ∃ t u, x = t ++ u ∧ rmatch (deriv P a) t = true ∧ rmatch (star P) u = true

tactic: refine' ⟨t, U.join, hsum.2, _, _⟩
state_before: case mpr.intro.intro.cons.cons.cons
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a = b ∧ x = t ++ join U
⊢ ∃ t u, x = t ++ u ∧ rmatch (deriv P a) t = true ∧ rmatch (star P) u = true

tactic: simp only [forall_eq_or_imp, List.mem_cons] at helem
state_before: case mpr.intro.intro.cons.cons.nil
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
helem : ∀ (t : List α), t ∈ [] :: U → t ≠ [] ∧ rmatch P t = true
hsum : a :: x = join ([] :: U)
⊢ ∃ t u, x = t ++ u ∧ rmatch (deriv P a) t = true ∧ rmatch (star P) u = true

tactic: simp only [eq_self_iff_true, not_true, Ne.def, false_and_iff] at helem
state_before: case mpr.intro.intro.cons.cons.nil
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
hsum : a :: x = join ([] :: U)
helem : ([] ≠ [] ∧ rmatch P [] = true) ∧ ∀ (a : List α), a ∈ U → a ≠ [] ∧ rmatch P a = true
⊢ ∃ t u, x = t ++ u ∧ rmatch (deriv P a) t = true ∧ rmatch (star P) u = true

tactic: specialize helem (b :: t) (by simp)
state_before: case mpr.intro.intro.cons.cons.cons.refine'_1
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a = b ∧ x = t ++ join U
⊢ rmatch (deriv P a) t = true

tactic: rw [rmatch] at helem
state_before: case mpr.intro.intro.cons.cons.cons.refine'_1
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
hsum : a = b ∧ x = t ++ join U
helem : b :: t ≠ [] ∧ rmatch P (b :: t) = true
⊢ rmatch (deriv P a) t = true

tactic: convert helem.2
state_before: case mpr.intro.intro.cons.cons.cons.refine'_1
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
hsum : a = b ∧ x = t ++ join U
helem : b :: t ≠ [] ∧ rmatch (deriv P b) t = true
⊢ rmatch (deriv P a) t = true

tactic: exact hsum.1
state_before: case h.e'_2.h.e'_3.h.e'_4
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
hsum : a = b ∧ x = t ++ join U
helem : b :: t ≠ [] ∧ rmatch (deriv P b) t = true
⊢ a = b

tactic: simp
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a = b ∧ x = t ++ join U
⊢ b :: t ∈ (b :: t) :: U

tactic: have hwf : U.join.length < (List.cons a x).length := by
  rw [hsum.1, hsum.2]
  simp only [List.length_append, List.length_join, List.length]
  apply A
state_before: case mpr.intro.intro.cons.cons.cons.refine'_2
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a = b ∧ x = t ++ join U
⊢ rmatch (star P) (join U) = true

tactic: rw [IH _ hwf]
state_before: case mpr.intro.intro.cons.cons.cons.refine'_2
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a = b ∧ x = t ++ join U
hwf : length (join U) < length (a :: x)
⊢ rmatch (star P) (join U) = true

tactic: refine' ⟨U, rfl, fun t h => helem t _⟩
state_before: case mpr.intro.intro.cons.cons.cons.refine'_2
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a = b ∧ x = t ++ join U
hwf : length (join U) < length (a :: x)
⊢ ∃ S, join U = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true

tactic: right
state_before: case mpr.intro.intro.cons.cons.cons.refine'_2
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t✝ : List α
helem : ∀ (t : List α), t ∈ (b :: t✝) :: U → t ≠ [] ∧ rmatch P t = true
hsum : a = b ∧ x = t✝ ++ join U
hwf : length (join U) < length (a :: x)
t : List α
h : t ∈ U
⊢ t ∈ (b :: t✝) :: U

tactic: assumption
state_before: case mpr.intro.intro.cons.cons.cons.refine'_2.a
α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t✝ : List α
helem : ∀ (t : List α), t ∈ (b :: t✝) :: U → t ≠ [] ∧ rmatch P t = true
hsum : a = b ∧ x = t✝ ++ join U
hwf : length (join U) < length (a :: x)
t : List α
h : t ∈ U
⊢ Mem t U

tactic: rw [hsum.1, hsum.2]
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a = b ∧ x = t ++ join U
⊢ length (join U) < length (a :: x)

tactic: simp only [List.length_append, List.length_join, List.length]
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a = b ∧ x = t ++ join U
⊢ length (join U) < length (b :: (t ++ join U))

tactic: apply A
state_before: α : Type u_1
β : Type ?u.53385
γ : Type ?u.53388
dec : DecidableEq α
a✝ b✝ : α
P : RegularExpression α
A : ∀ (m n : ℕ), n < m + n + 1
a : α
x : List α
IH :
  ∀ (t : List α),
    length t < length (a :: x) →
      (rmatch (star P) t = true ↔ ∃ S, t = join S ∧ ∀ (t : List α), t ∈ S → t ≠ [] ∧ rmatch P t = true)
U : List (List α)
b : α
t : List α
helem : ∀ (t_1 : List α), t_1 ∈ (b :: t) :: U → t_1 ≠ [] ∧ rmatch P t_1 = true
hsum : a = b ∧ x = t ++ join U
⊢ sum (map length U) < length t + sum (map length U) + 1