l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x : List α
⊢ rmatch (P * Q) x = true ↔ x ∈ matches' (P * Q)

Next tactic:
case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x : List α
⊢ rmatch (P * Q) x = true ↔ x ∈ matches' (P * Q)

Next tactic:
simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x : List α
⊢ (∃ t u, x = t ++ u ∧ rmatch P t = true ∧ rmatch Q u = true) ↔ x ∈ matches' (P * Q)

Next tactic:
constructor
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · 

Proof state:
case mp
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x : List α
⊢ (∃ t u, x = t ++ u ∧ rmatch P t = true ∧ rmatch Q u = true) → x ∈ matches' (P * Q)

Next tactic:
rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      

Proof state:
case mp.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x✝ x y : List α
hsum : x✝ = x ++ y
hmatch₁ : rmatch P x = true
hmatch₂ : rmatch Q y = true
⊢ x✝ ∈ matches' (P * Q)

Next tactic:
rw [ih₁] at hmatch₁
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      

Proof state:
case mp.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x✝ x y : List α
hsum : x✝ = x ++ y
hmatch₁ : x ∈ matches' P
hmatch₂ : rmatch Q y = true
⊢ x✝ ∈ matches' (P * Q)

Next tactic:
rw [ih₂] at hmatch₂
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      

Proof state:
case mp.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x✝ x y : List α
hsum : x✝ = x ++ y
hmatch₁ : x ∈ matches' P
hmatch₂ : y ∈ matches' Q
⊢ x✝ ∈ matches' (P * Q)

Next tactic:
exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x : List α
⊢ x ∈ matches' (P * Q) → ∃ t u, x = t ++ u ∧ rmatch P t = true ∧ rmatch Q u = true

Next tactic:
rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      

Proof state:
case mpr.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x✝ x y : List α
hmatch₁ : x ∈ matches' P
hmatch₂ : y ∈ matches' Q
hsum : (fun x x_1 => x ++ x_1) x y = x✝
⊢ ∃ t u, x✝ = t ++ u ∧ rmatch P t = true ∧ rmatch Q u = true

Next tactic:
rw [← ih₁] at hmatch₁
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      

Proof state:
case mpr.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x✝ x y : List α
hmatch₁ : rmatch P x = true
hmatch₂ : y ∈ matches' Q
hsum : (fun x x_1 => x ++ x_1) x y = x✝
⊢ ∃ t u, x✝ = t ++ u ∧ rmatch P t = true ∧ rmatch Q u = true

Next tactic:
rw [← ih₂] at hmatch₂
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      

Proof state:
case mpr.intro.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
P Q : RegularExpression α
ih₁ : ∀ (x : List α), rmatch P x = true ↔ x ∈ matches' P
ih₂ : ∀ (x : List α), rmatch Q x = true ↔ x ∈ matches' Q
x✝ x y : List α
hmatch₁ : rmatch P x = true
hmatch₂ : rmatch Q y = true
hsum : (fun x x_1 => x ++ x_1) x y = x✝
⊢ ∃ t u, x✝ = t ++ u ∧ rmatch P t = true ∧ rmatch Q u = true

Next tactic:
exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
  

Proof state:
case star
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
a✝ : RegularExpression α
a_ih✝ : ∀ (x : List α), rmatch a✝ x = true ↔ x ∈ matches' a✝
x : List α
⊢ rmatch (star a✝) x = true ↔ x ∈ matches' (star a✝)

Next tactic:
case star _ ih =>
    rw [star_rmatch_iff]
    simp only [ne_eq, matches', Language.kstar_def_nonempty, mem_setOf_eq]
    constructor
    all_goals
      rintro ⟨S, hx, hS⟩
      refine' ⟨S, hx, _⟩
      intro y
      specialize hS y
    · rw [← ih y]
      tauto
    · rw [ih y]
      tauto
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
a✝ : RegularExpression α
ih : ∀ (x : List α), rmatch a✝ x = true ↔ x ∈ matches' a✝
x : List α
⊢ rmatch (star a✝) x = true ↔ x ∈ matches' (star a✝)

Next tactic:
case star _ ih =>
    rw [star_rmatch_iff]
    simp only [ne_eq, matches', Language.kstar_def_nonempty, mem_setOf_eq]
    constructor
    all_goals
      rintro ⟨S, hx, hS⟩
      refine' ⟨S, hx, _⟩
      intro y
      specialize hS y
    · rw [← ih y]
      tauto
    · rw [ih y]
      tauto
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
  case star _ ih =>
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
a✝ : RegularExpression α
ih : ∀ (x : List α), rmatch a✝ x = true ↔ x ∈ matches' a✝
x : List α
⊢ rmatch (star a✝) x = true ↔ x ∈ matches' (star a✝)

Next tactic:
rw [star_rmatch_iff]
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
  case star _ ih =>
    rw [star_rmatch_iff]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
a✝ : RegularExpression α
ih : ∀ (x : List α), rmatch a✝ x = true ↔ x ∈ matches' a✝
x : List α
⊢ (∃ S, x = join S ∧ ∀ t ∈ S, t ≠ [] ∧ rmatch a✝ t = true) ↔ x ∈ matches' (star a✝)

Next tactic:
simp only [ne_eq, matches', Language.kstar_def_nonempty, mem_setOf_eq]
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
  case star _ ih =>
    rw [star_rmatch_iff]
    simp only [ne_eq, matches', Language.kstar_def_nonempty, mem_setOf_eq]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
a✝ : RegularExpression α
ih : ∀ (x : List α), rmatch a✝ x = true ↔ x ∈ matches' a✝
x : List α
⊢ (∃ S, x = join S ∧ ∀ t ∈ S, ¬t = [] ∧ rmatch a✝ t = true) ↔
    x ∈ {x | ∃ S, x = join S ∧ ∀ y ∈ S, y ∈ matches' a✝ ∧ ¬y = []}

Next tactic:
constructor
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
  case star _ ih =>
    rw [star_rmatch_iff]
    simp only [ne_eq, matches', Language.kstar_def_nonempty, mem_setOf_eq]
    constructor
    

Proof state:
case mp
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
a✝ : RegularExpression α
ih : ∀ (x : List α), rmatch a✝ x = true ↔ x ∈ matches' a✝
x : List α
⊢ (∃ S, x = join S ∧ ∀ t ∈ S, ¬t = [] ∧ rmatch a✝ t = true) →
    x ∈ {x | ∃ S, x = join S ∧ ∀ y ∈ S, y ∈ matches' a✝ ∧ ¬y = []}
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
a✝ : RegularExpression α
ih : ∀ (x : List α), rmatch a✝ x = true ↔ x ∈ matches' a✝
x : List α
⊢ x ∈ {x | ∃ S, x = join S ∧ ∀ y ∈ S, y ∈ matches' a✝ ∧ ¬y = []} →
    ∃ S, x = join S ∧ ∀ t ∈ S, ¬t = [] ∧ rmatch a✝ t = true

Next tactic:
all_goals
      rintro ⟨S, hx, hS⟩
      refine' ⟨S, hx, _⟩
      intro y
      specialize hS y
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
  case star _ ih =>
    rw [star_rmatch_iff]
    simp only [ne_eq, matches', Language.kstar_def_nonempty, mem_setOf_eq]
    constructor
    all_goals
      

Proof state:
case mp
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
a✝ : RegularExpression α
ih : ∀ (x : List α), rmatch a✝ x = true ↔ x ∈ matches' a✝
x : List α
⊢ (∃ S, x = join S ∧ ∀ t ∈ S, ¬t = [] ∧ rmatch a✝ t = true) →
    x ∈ {x | ∃ S, x = join S ∧ ∀ y ∈ S, y ∈ matches' a✝ ∧ ¬y = []}

Next tactic:
rintro ⟨S, hx, hS⟩
@[simp]
theorem rmatch_iff_matches' (P : RegularExpression α) :
    ∀ x : List α, P.rmatch x ↔ x ∈ P.matches' := by
  intro x
  induction P generalizing x
  all_goals
    try rw [zero_def]
    try rw [one_def]
    try rw [plus_def]
    try rw [comp_def]
  case zero =>
    rw [zero_rmatch]
    tauto
  case epsilon =>
    rw [one_rmatch_iff]
    rfl
  case char =>
    rw [char_rmatch_iff]
    rfl
  case plus _ _ ih₁ ih₂ =>
    rw [add_rmatch_iff, ih₁, ih₂]
    rfl
  case comp P Q ih₁ ih₂ =>
    simp only [mul_rmatch_iff, comp_def, Language.mul_def, exists_and_left, Set.mem_image2,
      Set.image_prod]
    constructor
    · rintro ⟨x, y, hsum, hmatch₁, hmatch₂⟩
      rw [ih₁] at hmatch₁
      rw [ih₂] at hmatch₂
      exact ⟨x, y, hmatch₁, hmatch₂, hsum.symm⟩
    · rintro ⟨x, y, hmatch₁, hmatch₂, hsum⟩
      rw [← ih₁] at hmatch₁
      rw [← ih₂] at hmatch₂
      exact ⟨x, y, hsum.symm, hmatch₁, hmatch₂⟩
  case star _ ih =>
    rw [star_rmatch_iff]
    simp only [ne_eq, matches', Language.kstar_def_nonempty, mem_setOf_eq]
    constructor
    all_goals
      rintro ⟨S, hx, hS⟩
      

Proof state:
case mp.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a b : α
a✝ : RegularExpression α
ih : ∀ (x : List α), rmatch a✝ x = true ↔ x ∈ matches' a✝
x : List α
S : List (List α)
hx : x = join S
hS : ∀ t ∈ S, ¬t = [] ∧ rmatch a✝ t = true
⊢ x ∈ {x | ∃ S, x = join S ∧ ∀ y ∈ S, y ∈ matches' a✝ ∧ ¬y = []}

Next tactic:
refine' ⟨S, hx, _⟩