Theorem: List.pwFilter_map
File: .lake/packages/batteries/Batteries/Data/List/Pairwise.lean

tactic: if h : ∀ b ∈ pwFilter R (map f xs), R (f x) b then
  have h' : ∀ b : β, b ∈ pwFilter (fun x y : β => R (f x) (f y)) xs → R (f x) (f b) :=
    fun b hb => h _ (by rw [pwFilter_map f xs]; apply mem_map_of_mem _ hb)
  rw [map, pwFilter_cons_of_pos h, pwFilter_cons_of_pos h', pwFilter_map f xs, map]
else
  rw [map, pwFilter_cons_of_neg h, pwFilter_cons_of_neg ?_, pwFilter_map f xs]
  refine fun hh => h fun a ha => ?_
  rw [pwFilter_map f xs, mem_map] at ha
  let ⟨b, hb₀, hb₁⟩ := ha; exact hb₁ ▸ hh _ hb₀
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
⊢ pwFilter R (map f (x :: xs)) = map f (pwFilter (fun x y => R (f x) (f y)) (x :: xs))
state_after: no goals

tactic: have h' : ∀ b : β, b ∈ pwFilter (fun x y : β => R (f x) (f y)) xs → R (f x) (f b) :=
  fun b hb => h _ (by rw [pwFilter_map f xs]; apply mem_map_of_mem _ hb)
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
⊢ pwFilter R (map f (x :: xs)) = map f (pwFilter (fun x y => R (f x) (f y)) (x :: xs))
state_after: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
h' : ∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)
⊢ pwFilter R (map f (x :: xs)) = map f (pwFilter (fun x y => R (f x) (f y)) (x :: xs))

tactic: rw [map, pwFilter_cons_of_pos h, pwFilter_cons_of_pos h', pwFilter_map f xs, map]
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
h' : ∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)
⊢ pwFilter R (map f (x :: xs)) = map f (pwFilter (fun x y => R (f x) (f y)) (x :: xs))
state_after: no goals

tactic: rw [pwFilter_map f xs]
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
b : β
hb : b ∈ pwFilter (fun x y => R (f x) (f y)) xs
⊢ f b ∈ pwFilter R (map f xs)
state_after: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
b : β
hb : b ∈ pwFilter (fun x y => R (f x) (f y)) xs
⊢ f b ∈ map f (pwFilter (fun x y => R (f x) (f y)) xs)

tactic: apply mem_map_of_mem _ hb
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
b : β
hb : b ∈ pwFilter (fun x y => R (f x) (f y)) xs
⊢ f b ∈ map f (pwFilter (fun x y => R (f x) (f y)) xs)
state_after: no goals

tactic: rw [map, pwFilter_cons_of_neg h, pwFilter_cons_of_neg ?_, pwFilter_map f xs]
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ¬∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
⊢ pwFilter R (map f (x :: xs)) = map f (pwFilter (fun x y => R (f x) (f y)) (x :: xs))
state_after: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ¬∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
⊢ ¬∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)

tactic: refine fun hh => h fun a ha => ?_
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ¬∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
⊢ ¬∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)
state_after: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ¬∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
hh : ∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)
a : α
ha : a ∈ pwFilter R (map f xs)
⊢ R (f x) a

tactic: rw [pwFilter_map f xs, mem_map] at ha
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ¬∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
hh : ∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)
a : α
ha : a ∈ pwFilter R (map f xs)
⊢ R (f x) a
state_after: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ¬∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
hh : ∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)
a : α
ha : ∃ a_1, a_1 ∈ pwFilter (fun x y => R (f x) (f y)) xs ∧ f a_1 = a
⊢ R (f x) a

tactic: let ⟨b, hb₀, hb₁⟩ := ha
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ¬∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
hh : ∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)
a : α
ha : ∃ a_1, a_1 ∈ pwFilter (fun x y => R (f x) (f y)) xs ∧ f a_1 = a
⊢ R (f x) a
state_after: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ¬∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
hh : ∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)
a : α
ha : ∃ a_1, a_1 ∈ pwFilter (fun x y => R (f x) (f y)) xs ∧ f a_1 = a
b : β
hb₀ : b ∈ pwFilter (fun x y => R (f x) (f y)) xs
hb₁ : f b = a
⊢ R (f x) a

tactic: exact hb₁ ▸ hh _ hb₀
state_before: α : Type u_1
R : α → α → Prop
β : Type u_2
inst✝ : DecidableRel R
f : β → α
x : β
xs : List β
h : ¬∀ (b : α), b ∈ pwFilter R (map f xs) → R (f x) b
hh : ∀ (b : β), b ∈ pwFilter (fun x y => R (f x) (f y)) xs → R (f x) (f b)
a : α
ha : ∃ a_1, a_1 ∈ pwFilter (fun x y => R (f x) (f y)) xs ∧ f a_1 = a
b : β
hb₀ : b ∈ pwFilter (fun x y => R (f x) (f y)) xs
hb₁ : f b = a
⊢ R (f x) a
state_after: no goals