Theorem: Turing.PartrecToTM2.splitAtPred_eq
File: Mathlib/Computability/TMToPartrec.lean

tactic: simp at h₃
state_before: α : Type u_1
p : α → Bool
l₁ : List α
o : α
l₂ : List α
x✝ : ∀ (x : α), x ∈ l₁ → p x = false
left✝ : p o = true
h₃ : [] = l₁ ++ o :: l₂
⊢ splitAtPred p [] = (l₁, some o, l₂)

tactic: rw [splitAtPred]
state_before: α : Type u_1
p : α → Bool
a : α
L l₁ : List α
o : Option α
l₂ : List α
h₁ : ∀ (x : α), x ∈ l₁ → p x = false
h₂ : Option.elim' (a :: L = l₁ ∧ l₂ = []) (fun a_1 => p a_1 = true ∧ a :: L = l₁ ++ a_1 :: l₂) o
⊢ splitAtPred p (a :: L) = (l₁, o, l₂)

tactic: have IH := splitAtPred_eq p L
state_before: α : Type u_1
p : α → Bool
a : α
L l₁ : List α
o : Option α
l₂ : List α
h₁ : ∀ (x : α), x ∈ l₁ → p x = false
h₂ : Option.elim' (a :: L = l₁ ∧ l₂ = []) (fun a_1 => p a_1 = true ∧ a :: L = l₁ ++ a_1 :: l₂) o
⊢ (bif p a then ([], some a, L)
    else
      match splitAtPred p L with
      | (l₁, o, l₂) => (a :: l₁, o, l₂)) =
    (l₁, o, l₂)

tactic: cases' o with o
state_before: α : Type u_1
p : α → Bool
a : α
L l₁ : List α
o : Option α
l₂ : List α
h₁ : ∀ (x : α), x ∈ l₁ → p x = false
h₂ : Option.elim' (a :: L = l₁ ∧ l₂ = []) (fun a_1 => p a_1 = true ∧ a :: L = l₁ ++ a_1 :: l₂) o
IH :
  ∀ (l₁ : List α) (o : Option α) (l₂ : List α),
    (∀ (x : α), x ∈ l₁ → p x = false) →
      Option.elim' (L = l₁ ∧ l₂ = []) (fun a => p a = true ∧ L = l₁ ++ a :: l₂) o → splitAtPred p L = (l₁, o, l₂)
⊢ (bif p a then ([], some a, L)
    else
      match splitAtPred p L with
      | (l₁, o, l₂) => (a :: l₁, o, l₂)) =
    (l₁, o, l₂)

tactic: cases' l₁ with a' l₁ <;> rcases h₂ with ⟨⟨⟩, rfl⟩
state_before: case none
α : Type u_1
p : α → Bool
a : α
L l₁ l₂ : List α
h₁ : ∀ (x : α), x ∈ l₁ → p x = false
IH :
  ∀ (l₁ : List α) (o : Option α) (l₂ : List α),
    (∀ (x : α), x ∈ l₁ → p x = false) →
      Option.elim' (L = l₁ ∧ l₂ = []) (fun a => p a = true ∧ L = l₁ ++ a :: l₂) o → splitAtPred p L = (l₁, o, l₂)
h₂ : Option.elim' (a :: L = l₁ ∧ l₂ = []) (fun a_1 => p a_1 = true ∧ a :: L = l₁ ++ a_1 :: l₂) none
⊢ (bif p a then ([], some a, L)
    else
      match splitAtPred p L with
      | (l₁, o, l₂) => (a :: l₁, o, l₂)) =
    (l₁, none, l₂)

tactic: rw [h₁ a (List.Mem.head _), cond, IH L none [] _ ⟨rfl, rfl⟩]
state_before: case none.cons.intro.refl
α : Type u_1
p : α → Bool
a : α
L : List α
IH :
  ∀ (l₁ : List α) (o : Option α) (l₂ : List α),
    (∀ (x : α), x ∈ l₁ → p x = false) →
      Option.elim' (L = l₁ ∧ l₂ = []) (fun a => p a = true ∧ L = l₁ ++ a :: l₂) o → splitAtPred p L = (l₁, o, l₂)
h₁ : ∀ (x : α), x ∈ a :: L → p x = false
⊢ (bif p a then ([], some a, L)
    else
      match splitAtPred p L with
      | (l₁, o, l₂) => (a :: l₁, o, l₂)) =
    (a :: L, none, [])

tactic: exact fun x h => h₁ x (List.Mem.tail _ h)
state_before: α : Type u_1
p : α → Bool
a : α
L : List α
IH :
  ∀ (l₁ : List α) (o : Option α) (l₂ : List α),
    (∀ (x : α), x ∈ l₁ → p x = false) →
      Option.elim' (L = l₁ ∧ l₂ = []) (fun a => p a = true ∧ L = l₁ ++ a :: l₂) o → splitAtPred p L = (l₁, o, l₂)
h₁ : ∀ (x : α), x ∈ a :: L → p x = false
⊢ ∀ (x : α), x ∈ L → p x = false

tactic: cases' l₁ with a' l₁ <;> rcases h₂ with ⟨h₂, ⟨⟩⟩
state_before: case some
α : Type u_1
p : α → Bool
a : α
L l₁ l₂ : List α
h₁ : ∀ (x : α), x ∈ l₁ → p x = false
IH :
  ∀ (l₁ : List α) (o : Option α) (l₂ : List α),
    (∀ (x : α), x ∈ l₁ → p x = false) →
      Option.elim' (L = l₁ ∧ l₂ = []) (fun a => p a = true ∧ L = l₁ ++ a :: l₂) o → splitAtPred p L = (l₁, o, l₂)
o : α
h₂ : Option.elim' (a :: L = l₁ ∧ l₂ = []) (fun a_1 => p a_1 = true ∧ a :: L = l₁ ++ a_1 :: l₂) (some o)
⊢ (bif p a then ([], some a, L)
    else
      match splitAtPred p L with
      | (l₁, o, l₂) => (a :: l₁, o, l₂)) =
    (l₁, some o, l₂)

tactic: rw [h₁ a (List.Mem.head _), cond, IH l₁ (some o) l₂ _ ⟨h₂, _⟩] <;> try rfl
state_before: case some.cons.intro.refl
α : Type u_1
p : α → Bool
a : α
l₂ : List α
o : α
l₁ : List α
h₂ : p o = true
h₁ : ∀ (x : α), x ∈ a :: l₁ → p x = false
IH :
  ∀ (l₁_1 : List α) (o_1 : Option α) (l₂_1 : List α),
    (∀ (x : α), x ∈ l₁_1 → p x = false) →
      Option.elim' (List.append l₁ (o :: l₂) = l₁_1 ∧ l₂_1 = [])
          (fun a => p a = true ∧ List.append l₁ (o :: l₂) = l₁_1 ++ a :: l₂_1) o_1 →
        splitAtPred p (List.append l₁ (o :: l₂)) = (l₁_1, o_1, l₂_1)
⊢ (bif p a then ([], some a, List.append l₁ (o :: l₂))
    else
      match splitAtPred p (List.append l₁ (o :: l₂)) with
      | (l₁, o, l₂) => (a :: l₁, o, l₂)) =
    (a :: l₁, some o, l₂)

tactic: exact fun x h => h₁ x (List.Mem.tail _ h)
state_before: α : Type u_1
p : α → Bool
a : α
l₂ : List α
o : α
l₁ : List α
h₂ : p o = true
h₁ : ∀ (x : α), x ∈ a :: l₁ → p x = false
IH :
  ∀ (l₁_1 : List α) (o_1 : Option α) (l₂_1 : List α),
    (∀ (x : α), x ∈ l₁_1 → p x = false) →
      Option.elim' (List.append l₁ (o :: l₂) = l₁_1 ∧ l₂_1 = [])
          (fun a => p a = true ∧ List.append l₁ (o :: l₂) = l₁_1 ++ a :: l₂_1) o_1 →
        splitAtPred p (List.append l₁ (o :: l₂)) = (l₁_1, o_1, l₂_1)
⊢ ∀ (x : α), x ∈ l₁ → p x = false

tactic: rw [h₂, cond]
state_before: case some.nil.intro.refl
α : Type u_1
p : α → Bool
a : α
L : List α
IH :
  ∀ (l₁ : List α) (o : Option α) (l₂ : List α),
    (∀ (x : α), x ∈ l₁ → p x = false) →
      Option.elim' (L = l₁ ∧ l₂ = []) (fun a => p a = true ∧ L = l₁ ++ a :: l₂) o → splitAtPred p L = (l₁, o, l₂)
h₁ : ∀ (x : α), x ∈ [] → p x = false
h₂ : p a = true
⊢ (bif p a then ([], some a, L)
    else
      match splitAtPred p L with
      | (l₁, o, l₂) => (a :: l₁, o, l₂)) =
    ([], some a, L)

tactic: rfl
state_before: α : Type u_1
p : α → Bool
a : α
l₂ : List α
o : α
l₁ : List α
h₂ : p o = true
h₁ : ∀ (x : α), x ∈ a :: l₁ → p x = false
IH :
  ∀ (l₁_1 : List α) (o_1 : Option α) (l₂_1 : List α),
    (∀ (x : α), x ∈ l₁_1 → p x = false) →
      Option.elim' (List.append l₁ (o :: l₂) = l₁_1 ∧ l₂_1 = [])
          (fun a => p a = true ∧ List.append l₁ (o :: l₂) = l₁_1 ++ a :: l₂_1) o_1 →
        splitAtPred p (List.append l₁ (o :: l₂)) = (l₁_1, o_1, l₂_1)
⊢ List.append l₁ (o :: l₂) = l₁ ++ o :: l₂