Theorem: Batteries.HashMap.Imp.mem_replaceF
File: .lake/packages/batteries/Batteries/Data/HashMap/WF.lean

tactic: exact .inr
state_before: case nil
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
⊢ x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) [] → x.fst = k ∨ x ∈ []
state_after: no goals

tactic: simp only [List.replaceF, List.mem_cons]
state_before: case cons
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
⊢ x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) (a :: l) → x.fst = k ∨ x ∈ a :: l
state_after: case cons
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
⊢ (x ∈
      match bif p a then some (k, f a) else none with
      | none => a :: List.replaceF (fun a => bif p a then some (k, f a) else none) l
      | some a => a :: l) →
    x.fst = k ∨ x = a ∨ x ∈ l

tactic: generalize e : cond .. = z
state_before: case cons
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
⊢ (x ∈
      match bif p a then some (k, f a) else none with
      | none => a :: List.replaceF (fun a => bif p a then some (k, f a) else none) l
      | some a => a :: l) →
    x.fst = k ∨ x = a ∨ x ∈ l
state_after: case cons
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
z : Option (α × β)
e : (bif p a then some (k, f a) else none) = z
⊢ (x ∈
      match z with
      | none => a :: List.replaceF (fun a => bif p a then some (k, f a) else none) l
      | some a => a :: l) →
    x.fst = k ∨ x = a ∨ x ∈ l

tactic: revert e
state_before: case cons
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
z : Option (α × β)
e : (bif p a then some (k, f a) else none) = z
⊢ (x ∈
      match z with
      | none => a :: List.replaceF (fun a => bif p a then some (k, f a) else none) l
      | some a => a :: l) →
    x.fst = k ∨ x = a ∨ x ∈ l
state_after: case cons
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
z : Option (α × β)
⊢ (bif p a then some (k, f a) else none) = z →
    (x ∈
        match z with
        | none => a :: List.replaceF (fun a => bif p a then some (k, f a) else none) l
        | some a => a :: l) →
      x.fst = k ∨ x = a ∨ x ∈ l

tactic: unfold cond
state_before: case cons
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
z : Option (α × β)
⊢ (bif p a then some (k, f a) else none) = z →
    (x ∈
        match z with
        | none => a :: List.replaceF (fun a => bif p a then some (k, f a) else none) l
        | some a => a :: l) →
      x.fst = k ∨ x = a ∨ x ∈ l
state_after: case cons
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
z : Option (α × β)
⊢ (match p a with
      | true => some (k, f a)
      | false => none) =
      z →
    (x ∈
        match z with
        | none =>
          a ::
            List.replaceF
              (fun a =>
                match p a with
                | true => some (k, f a)
                | false => none)
              l
        | some a => a :: l) →
      x.fst = k ∨ x = a ∨ x ∈ l

tactic: split <;> (intro h; subst h; simp)
state_before: case cons
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
z : Option (α × β)
⊢ (match p a with
      | true => some (k, f a)
      | false => none) =
      z →
    (x ∈
        match z with
        | none =>
          a ::
            List.replaceF
              (fun a =>
                match p a with
                | true => some (k, f a)
                | false => none)
              l
        | some a => a :: l) →
      x.fst = k ∨ x = a ∨ x ∈ l
state_after: case cons.h_1
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = true
⊢ x = (k, f a) ∨ x ∈ l → x.fst = k ∨ x = a ∨ x ∈ l

case cons.h_2
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = false
⊢ x = a ∨
      x ∈
        List.replaceF
          (fun a =>
            match p a with
            | true => some (k, f a)
            | false => none)
          l →
    x.fst = k ∨ x = a ∨ x ∈ l

tactic: intro h
state_before: case cons.h_2
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
z : Option (α × β)
c✝ : Bool
heq✝ : p a = false
⊢ none = z →
    (x ∈
        match z with
        | none =>
          a ::
            List.replaceF
              (fun a =>
                match p a with
                | true => some (k, f a)
                | false => none)
              l
        | some a => a :: l) →
      x.fst = k ∨ x = a ∨ x ∈ l
state_after: case cons.h_2
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
z : Option (α × β)
c✝ : Bool
heq✝ : p a = false
h : none = z
⊢ (x ∈
      match z with
      | none =>
        a ::
          List.replaceF
            (fun a =>
              match p a with
              | true => some (k, f a)
              | false => none)
            l
      | some a => a :: l) →
    x.fst = k ∨ x = a ∨ x ∈ l

tactic: subst h
state_before: case cons.h_2
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
z : Option (α × β)
c✝ : Bool
heq✝ : p a = false
h : none = z
⊢ (x ∈
      match z with
      | none =>
        a ::
          List.replaceF
            (fun a =>
              match p a with
              | true => some (k, f a)
              | false => none)
            l
      | some a => a :: l) →
    x.fst = k ∨ x = a ∨ x ∈ l
state_after: case cons.h_2
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = false
⊢ (x ∈
      match none with
      | none =>
        a ::
          List.replaceF
            (fun a =>
              match p a with
              | true => some (k, f a)
              | false => none)
            l
      | some a => a :: l) →
    x.fst = k ∨ x = a ∨ x ∈ l

tactic: simp
state_before: case cons.h_2
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = false
⊢ (x ∈
      match none with
      | none =>
        a ::
          List.replaceF
            (fun a =>
              match p a with
              | true => some (k, f a)
              | false => none)
            l
      | some a => a :: l) →
    x.fst = k ∨ x = a ∨ x ∈ l
state_after: case cons.h_2
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = false
⊢ x = a ∨
      x ∈
        List.replaceF
          (fun a =>
            match p a with
            | true => some (k, f a)
            | false => none)
          l →
    x.fst = k ∨ x = a ∨ x ∈ l

tactic: intro
| .inl eq => exact eq ▸ .inl rfl
| .inr h => exact .inr (.inr h)
state_before: case cons.h_1
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = true
⊢ x = (k, f a) ∨ x ∈ l → x.fst = k ∨ x = a ∨ x ∈ l
state_after: no goals

tactic: exact eq ▸ .inl rfl
state_before: α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = true
x✝ : x = (k, f a) ∨ x ∈ l
eq : x = (k, f a)
⊢ x.fst = k ∨ x = a ∨ x ∈ l
state_after: no goals

tactic: exact .inr (.inr h)
state_before: α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = true
x✝ : x = (k, f a) ∨ x ∈ l
h : x ∈ l
⊢ x.fst = k ∨ x = a ∨ x ∈ l
state_after: no goals

tactic: intro
| .inl eq => exact .inr (.inl eq)
| .inr h => exact (ih h).imp_right .inr
state_before: case cons.h_2
α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = false
⊢ x = a ∨
      x ∈
        List.replaceF
          (fun a =>
            match p a with
            | true => some (k, f a)
            | false => none)
          l →
    x.fst = k ∨ x = a ∨ x ∈ l
state_after: no goals

tactic: exact .inr (.inl eq)
state_before: α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = false
x✝ :
  x = a ∨
    x ∈
      List.replaceF
        (fun a =>
          match p a with
          | true => some (k, f a)
          | false => none)
        l
eq : x = a
⊢ x.fst = k ∨ x = a ∨ x ∈ l
state_after: no goals

tactic: exact (ih h).imp_right .inr
state_before: α : Type u_1
β : Type u_2
k : α
x : α × β
p : α × β → Bool
f : α × β → β
a : α × β
l : List (α × β)
ih : x ∈ List.replaceF (fun a => bif p a then some (k, f a) else none) l → x.fst = k ∨ x ∈ l
c✝ : Bool
heq✝ : p a = false
x✝ :
  x = a ∨
    x ∈
      List.replaceF
        (fun a =>
          match p a with
          | true => some (k, f a)
          | false => none)
        l
h :
  x ∈
    List.replaceF
      (fun a =>
        match p a with
        | true => some (k, f a)
        | false => none)
      l
⊢ x.fst = k ∨ x = a ∨ x ∈ l
state_after: no goals