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

tactic: cases' x with _ x
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a : α
x : List α
⊢ (char a).rmatch x = true ↔ x = [a]
state_after: case nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a : α
⊢ (char a).rmatch [] = true ↔ [] = [a]

case cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
x : List α
⊢ (char a).rmatch (head✝ :: x) = true ↔ head✝ :: x = [a]

tactic: cases' x with head tail
state_before: case cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
x : List α
⊢ (char a).rmatch (head✝ :: x) = true ↔ head✝ :: x = [a]
state_after: case cons.nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
⊢ (char a).rmatch [head✝] = true ↔ [head✝] = [a]

case cons.cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
⊢ (char a).rmatch (head✝ :: head :: tail) = true ↔ head✝ :: head :: tail = [a]

tactic: exact of_decide_eq_true rfl
state_before: case nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a : α
⊢ (char a).rmatch [] = true ↔ [] = [a]
state_after: no goals

tactic: rw [rmatch, deriv]
state_before: case cons.nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
⊢ (char a).rmatch [head✝] = true ↔ [head✝] = [a]
state_after: case cons.nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
⊢ (if a = head✝ then 1 else 0).rmatch [] = true ↔ [head✝] = [a]

tactic: split_ifs
state_before: case cons.nil
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
⊢ (if a = head✝ then 1 else 0).rmatch [] = true ↔ [head✝] = [a]
state_after: case pos
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
h✝ : a = head✝
⊢ rmatch 1 [] = true ↔ [head✝] = [a]

case neg
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
h✝ : ¬a = head✝
⊢ rmatch 0 [] = true ↔ [head✝] = [a]

tactic: tauto
state_before: case pos
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
h✝ : a = head✝
⊢ rmatch 1 [] = true ↔ [head✝] = [a]
state_after: no goals

tactic: simp [List.singleton_inj]
state_before: case neg
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
h✝ : ¬a = head✝
⊢ rmatch 0 [] = true ↔ [head✝] = [a]
state_after: case neg
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
h✝ : ¬a = head✝
⊢ ¬head✝ = a

tactic: tauto
state_before: case neg
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ : α
h✝ : ¬a = head✝
⊢ ¬head✝ = a
state_after: no goals

tactic: rw [rmatch, rmatch, deriv]
state_before: case cons.cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
⊢ (char a).rmatch (head✝ :: head :: tail) = true ↔ head✝ :: head :: tail = [a]
state_after: case cons.cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
⊢ ((if a = head✝ then 1 else 0).deriv head).rmatch tail = true ↔ head✝ :: head :: tail = [a]

tactic: split_ifs with h
state_before: case cons.cons
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
⊢ ((if a = head✝ then 1 else 0).deriv head).rmatch tail = true ↔ head✝ :: head :: tail = [a]
state_after: case pos
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
h : a = head✝
⊢ (deriv 1 head).rmatch tail = true ↔ head✝ :: head :: tail = [a]

case neg
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
h : ¬a = head✝
⊢ (deriv 0 head).rmatch tail = true ↔ head✝ :: head :: tail = [a]

tactic: simp only [deriv_one, zero_rmatch, cons.injEq, and_false]
state_before: case pos
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
h : a = head✝
⊢ (deriv 1 head).rmatch tail = true ↔ head✝ :: head :: tail = [a]
state_after: no goals

tactic: simp only [deriv_zero, zero_rmatch, cons.injEq, and_false]
state_before: case neg
α : Type u_1
β : Type u_2
γ : Type u_3
dec : DecidableEq α
a✝ b a head✝ head : α
tail : List α
h : ¬a = head✝
⊢ (deriv 0 head).rmatch tail = true ↔ head✝ :: head :: tail = [a]
state_after: no goals