Theorem: Std.HashMap.Imp.pairwise_replaceF
File: Std/Data/HashMap/WF.lean

tactic: simp [H]
state_before: case nil
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
H : List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) []
⊢ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
    (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) [])

tactic: simp at H ⊢
state_before: case cons
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) (a :: l)
⊢ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
    (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) (a :: l))

tactic: generalize e : cond .. = z
state_before: case cons
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
⊢ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
    (match bif a.fst == k then some (k, f a) else none with
    | none => a :: List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
    | some a => a :: l)

tactic: unfold cond at e
state_before: case cons
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
z : Option (α × β)
e : (bif a.fst == k then some (k, f a) else none) = z
⊢ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
    (match z with
    | none => a :: List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
    | some a => a :: l)

tactic: revert e
state_before: case cons
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
z : Option (α × β)
e :
  (match a.fst == k with
    | true => some (k, f a)
    | false => none) =
    z
⊢ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
    (match z with
    | none => a :: List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
    | some a => a :: l)

tactic: split <;> (intro h; subst h; simp)
state_before: case cons
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
z : Option (α × β)
⊢ (match a.fst == k with
      | true => some (k, f a)
      | false => none) =
      z →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (match z with
      | none => a :: List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
      | some a => a :: l)

tactic: intro h
state_before: case cons.h_2
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
z : Option (α × β)
c✝ : Bool
heq✝ : (a.fst == k) = false
⊢ none = z →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (match z with
      | none => a :: List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
      | some a => a :: l)

tactic: subst h
state_before: case cons.h_2
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
z : Option (α × β)
c✝ : Bool
heq✝ : (a.fst == k) = false
h : none = z
⊢ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
    (match z with
    | none => a :: List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
    | some a => a :: l)

tactic: simp
state_before: case cons.h_2
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
c✝ : Bool
heq✝ : (a.fst == k) = false
⊢ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
    (match none with
    | none => a :: List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
    | some a => a :: l)

tactic: next e =>
refine ⟨fun a h => ?_, ih H.2⟩
match mem_replaceF h with
| .inl eq => exact eq ▸ ne_true_of_eq_false e
| .inr h => exact H.1 a h
state_before: case cons.h_2
α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
c✝ : Bool
heq✝ : (a.fst == k) = false
⊢ (∀ (a' : α × β),
      a' ∈ List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l → ¬(a.fst == a'.fst) = true) ∧
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)

tactic: refine ⟨fun a h => ?_, ih H.2⟩
state_before: α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
c✝ : Bool
e : (a.fst == k) = false
⊢ (∀ (a' : α × β),
      a' ∈ List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l → ¬(a.fst == a'.fst) = true) ∧
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)

tactic: match mem_replaceF h with
| .inl eq => exact eq ▸ ne_true_of_eq_false e
| .inr h => exact H.1 a h
state_before: α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a✝ : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a✝.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
c✝ : Bool
e : (a✝.fst == k) = false
a : α × β
h : a ∈ List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
⊢ ¬(a✝.fst == a.fst) = true

tactic: exact eq ▸ ne_true_of_eq_false e
state_before: α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a✝ : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a✝.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
c✝ : Bool
e : (a✝.fst == k) = false
a : α × β
h : a ∈ List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
eq : a.fst = k
⊢ ¬(a✝.fst == a.fst) = true

tactic: exact H.1 a h
state_before: α : Type u_1
β : Type u_2
k : α
inst✝¹ : BEq α
inst✝ : PartialEquivBEq α
f : α × β → β
a✝ : α × β
l : List (α × β)
ih :
  List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l →
    List.Pairwise (fun a b => ¬(a.fst == b.fst) = true)
      (List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l)
H : (∀ (a' : α × β), a' ∈ l → ¬(a✝.fst == a'.fst) = true) ∧ List.Pairwise (fun a b => ¬(a.fst == b.fst) = true) l
c✝ : Bool
e : (a✝.fst == k) = false
a : α × β
h✝ : a ∈ List.replaceF (fun a => bif a.fst == k then some (k, f a) else none) l
h : a ∈ l
⊢ ¬(a✝.fst == a.fst) = true