l3lab/ntp-mathlib huggingface dataset:
theorem Nodup.sigma {σ : α → Type*} {l₂ : ∀ a , List (σ a)} (d₁ : Nodup l₁)
    (d₂ : ∀ a , Nodup (l₂ a)) : (l₁.sigma l₂).Nodup :=
  nodup_bind.2
    ⟨fun a _ => (d₂ a).map fun b b' h => by injection h with _ h,
      d₁.imp fun {a₁ a₂} n x h₁ h₂ => by
        rcases mem_map.1 h₁ with ⟨b₁, _, rfl⟩
        rcases mem_map.1 h₂ with ⟨b₂, mb₂, ⟨⟩⟩
        

Proof state:
case intro.intro.intro.intro.refl
α : Type u
β : Type v
l l₁ l₂✝ : List α
r : α → α → Prop
a b : α
σ : α → Type u_1
l₂ : (a : α) → List (σ a)
d₁ : Nodup l₁
d₂ : ∀ (a : α), Nodup (l₂ a)
a₁ : α
b₁ : σ a₁
left✝ : b₁ ∈ l₂ a₁
h₁ : { fst := a₁, snd := b₁ } ∈ map (Sigma.mk a₁) (l₂ a₁)
n : a₁ ≠ a₁
h₂ : { fst := a₁, snd := b₁ } ∈ map (Sigma.mk a₁) (l₂ a₁)
mb₂ : b₁ ∈ l₂ a₁
⊢ False

Next tactic:
exact n rfl
protected theorem Nodup.filterMap {f : α → Option β} (h : ∀ a a' b, b ∈ f a → b ∈ f a' → a = a') :
    Nodup l → Nodup (filterMap f l) :=
  (Pairwise.filter_map f) @fun a a' n b bm b' bm' e => n <| h a a' b' (by 

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a✝ b✝ : α
f : α → Option β
h : ∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a'
a a' : α
n : a ≠ a'
b : β
bm : b ∈ f a
b' : β
bm' : b' ∈ f a'
e : b = b'
⊢ b' ∈ f a

Next tactic:
rw [← e]
protected theorem Nodup.filterMap {f : α → Option β} (h : ∀ a a' b, b ∈ f a → b ∈ f a' → a = a') :
    Nodup l → Nodup (filterMap f l) :=
  (Pairwise.filter_map f) @fun a a' n b bm b' bm' e => n <| h a a' b' (by rw [← e]; 

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a✝ b✝ : α
f : α → Option β
h : ∀ (a a' : α), ∀ b ∈ f a, b ∈ f a' → a = a'
a a' : α
n : a ≠ a'
b : β
bm : b ∈ f a
b' : β
bm' : b' ∈ f a'
e : b = b'
⊢ b ∈ f a

Next tactic:
exact bm
protected theorem Nodup.concat (h : a ∉ l) (h' : l.Nodup) : (l.concat a).Nodup := by
  

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
h : a ∉ l
h' : Nodup l
⊢ Nodup (concat l a)

Next tactic:
rw [concat_eq_append]
protected theorem Nodup.concat (h : a ∉ l) (h' : l.Nodup) : (l.concat a).Nodup := by
  rw [concat_eq_append]; 

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
h : a ∉ l
h' : Nodup l
⊢ Nodup (l ++ [a])

Next tactic:
exact h'.append (nodup_singleton _) (disjoint_singleton.2 h)
protected theorem Nodup.insert [DecidableEq α] (h : l.Nodup) : (l.insert a).Nodup :=
  if h' : a ∈ l then by 

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
h : Nodup l
h' : a ∈ l
⊢ Nodup (List.insert a l)

Next tactic:
rw [insert_of_mem h']
protected theorem Nodup.insert [DecidableEq α] (h : l.Nodup) : (l.insert a).Nodup :=
  if h' : a ∈ l then by rw [insert_of_mem h']; 

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
h : Nodup l
h' : a ∈ l
⊢ Nodup l

Next tactic:
exact h
protected theorem Nodup.insert [DecidableEq α] (h : l.Nodup) : (l.insert a).Nodup :=
  if h' : a ∈ l then by rw [insert_of_mem h']; exact h
  else by 

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
h : Nodup l
h' : a ∉ l
⊢ Nodup (List.insert a l)

Next tactic:
rw [insert_of_not_mem h', nodup_cons]
protected theorem Nodup.insert [DecidableEq α] (h : l.Nodup) : (l.insert a).Nodup :=
  if h' : a ∈ l then by rw [insert_of_mem h']; exact h
  else by rw [insert_of_not_mem h', nodup_cons]; 

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
h : Nodup l
h' : a ∉ l
⊢ a ∉ l ∧ Nodup l

Next tactic:
constructor
protected theorem Nodup.insert [DecidableEq α] (h : l.Nodup) : (l.insert a).Nodup :=
  if h' : a ∈ l then by rw [insert_of_mem h']; exact h
  else by rw [insert_of_not_mem h', nodup_cons]; constructor <;> 

Proof state:
case left
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
h : Nodup l
h' : a ∉ l
⊢ a ∉ l

Next tactic:
assumption
protected theorem Nodup.insert [DecidableEq α] (h : l.Nodup) : (l.insert a).Nodup :=
  if h' : a ∈ l then by rw [insert_of_mem h']; exact h
  else by rw [insert_of_not_mem h', nodup_cons]; constructor <;> 

Proof state:
case right
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
h : Nodup l
h' : a ∉ l
⊢ Nodup l

Next tactic:
assumption
theorem Nodup.union [DecidableEq α] (l₁ : List α) (h : Nodup l₂) : (l₁ ∪ l₂).Nodup := by
  

Proof state:
α : Type u
β : Type v
l l₁✝ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
l₁ : List α
h : Nodup l₂
⊢ Nodup (l₁ ∪ l₂)

Next tactic:
induction' l₁ with a l₁ ih generalizing l₂
theorem Nodup.union [DecidableEq α] (l₁ : List α) (h : Nodup l₂) : (l₁ ∪ l₂).Nodup := by
  induction' l₁ with a l₁ ih generalizing l₂
  · 

Proof state:
case nil
α : Type u
β : Type v
l l₁ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
l₂ : List α
h : Nodup l₂
⊢ Nodup ([] ∪ l₂)

Next tactic:
exact h
theorem Nodup.union [DecidableEq α] (l₁ : List α) (h : Nodup l₂) : (l₁ ∪ l₂).Nodup := by
  induction' l₁ with a l₁ ih generalizing l₂
  · exact h
  · 

Proof state:
case cons
α : Type u
β : Type v
l l₁✝ : List α
r : α → α → Prop
a✝ b : α
inst✝ : DecidableEq α
a : α
l₁ : List α
ih : ∀ {l₂ : List α}, Nodup l₂ → Nodup (l₁ ∪ l₂)
l₂ : List α
h : Nodup l₂
⊢ Nodup (a :: l₁ ∪ l₂)

Next tactic:
exact (ih h).insert
theorem Nodup.diff_eq_filter [DecidableEq α] :
    ∀ {l₁ l₂ : List α} (_ : l₁.Nodup), l₁.diff l₂ = l₁.filter (· ∉ l₂)
  | l₁, [], _ => by 

Proof state:
α : Type u
β : Type v
l l₁✝ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
l₁ : List α
x✝ : Nodup l₁
⊢ List.diff l₁ [] = List.filter (fun x => decide (x ∉ [])) l₁

Next tactic:
simp
theorem Nodup.diff_eq_filter [DecidableEq α] :
    ∀ {l₁ l₂ : List α} (_ : l₁.Nodup), l₁.diff l₂ = l₁.filter (· ∉ l₂)
  | l₁, [], _ => by simp
  | l₁, a :: l₂, hl₁ => by
    

Proof state:
α : Type u
β : Type v
l l₁✝ l₂✝ : List α
r : α → α → Prop
a✝ b : α
inst✝ : DecidableEq α
l₁ : List α
a : α
l₂ : List α
hl₁ : Nodup l₁
⊢ List.diff l₁ (a :: l₂) = List.filter (fun x => decide (x ∉ a :: l₂)) l₁

Next tactic:
rw [diff_cons, (hl₁.erase _).diff_eq_filter, hl₁.erase_eq_filter, filter_filter]
theorem Nodup.diff_eq_filter [DecidableEq α] :
    ∀ {l₁ l₂ : List α} (_ : l₁.Nodup), l₁.diff l₂ = l₁.filter (· ∉ l₂)
  | l₁, [], _ => by simp
  | l₁, a :: l₂, hl₁ => by
    rw [diff_cons, (hl₁.erase _).diff_eq_filter, hl₁.erase_eq_filter, filter_filter]
    

Proof state:
α : Type u
β : Type v
l l₁✝ l₂✝ : List α
r : α → α → Prop
a✝ b : α
inst✝ : DecidableEq α
l₁ : List α
a : α
l₂ : List α
hl₁ : Nodup l₁
⊢ List.filter (fun a_1 => decide (decide (a_1 ∉ l₂) = true ∧ decide (a_1 ≠ a) = true)) l₁ =
    List.filter (fun x => decide (x ∉ a :: l₂)) l₁

Next tactic:
simp only [decide_not, Bool.not_eq_true', decide_eq_false_iff_not, ne_eq, and_comm,
      Bool.decide_and, find?, mem_cons, not_or]
theorem Nodup.mem_diff_iff [DecidableEq α] (hl₁ : l₁.Nodup) : a ∈ l₁.diff l₂ ↔ a ∈ l₁ ∧ a ∉ l₂ := by
  

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
hl₁ : Nodup l₁
⊢ a ∈ List.diff l₁ l₂ ↔ a ∈ l₁ ∧ a ∉ l₂

Next tactic:
rw [hl₁.diff_eq_filter, mem_filter, decide_eq_true_iff]
theorem Nodup.map_update [DecidableEq α] {l : List α} (hl : l.Nodup) (f : α → β) (x : α) (y : β) :
    l.map (Function.update f x y) =
      if x ∈ l then (l.map f).set (l.indexOf x) y else l.map f := by
  

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
l : List α
hl : Nodup l
f : α → β
x : α
y : β
⊢ map (update f x y) l = if x ∈ l then set (map f l) (indexOf x l) y else map f l

Next tactic:
induction' l with hd tl ihl
theorem Nodup.map_update [DecidableEq α] {l : List α} (hl : l.Nodup) (f : α → β) (x : α) (y : β) :
    l.map (Function.update f x y) =
      if x ∈ l then (l.map f).set (l.indexOf x) y else l.map f := by
  induction' l with hd tl ihl; · 

Proof state:
case nil
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
f : α → β
x : α
y : β
hl : Nodup []
⊢ map (update f x y) [] = if x ∈ [] then set (map f []) (indexOf x []) y else map f []

Next tactic:
simp
theorem Nodup.map_update [DecidableEq α] {l : List α} (hl : l.Nodup) (f : α → β) (x : α) (y : β) :
    l.map (Function.update f x y) =
      if x ∈ l then (l.map f).set (l.indexOf x) y else l.map f := by
  induction' l with hd tl ihl; · simp
  

Proof state:
case cons
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
f : α → β
x : α
y : β
hd : α
tl : List α
ihl : Nodup tl → map (update f x y) tl = if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl
hl : Nodup (hd :: tl)
⊢ map (update f x y) (hd :: tl) =
    if x ∈ hd :: tl then set (map f (hd :: tl)) (indexOf x (hd :: tl)) y else map f (hd :: tl)

Next tactic:
rw [nodup_cons] at hl
theorem Nodup.map_update [DecidableEq α] {l : List α} (hl : l.Nodup) (f : α → β) (x : α) (y : β) :
    l.map (Function.update f x y) =
      if x ∈ l then (l.map f).set (l.indexOf x) y else l.map f := by
  induction' l with hd tl ihl; · simp
  rw [nodup_cons] at hl
  

Proof state:
case cons
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
f : α → β
x : α
y : β
hd : α
tl : List α
ihl : Nodup tl → map (update f x y) tl = if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl
hl : hd ∉ tl ∧ Nodup tl
⊢ map (update f x y) (hd :: tl) =
    if x ∈ hd :: tl then set (map f (hd :: tl)) (indexOf x (hd :: tl)) y else map f (hd :: tl)

Next tactic:
simp only [mem_cons, map, ihl hl.2]
theorem Nodup.map_update [DecidableEq α] {l : List α} (hl : l.Nodup) (f : α → β) (x : α) (y : β) :
    l.map (Function.update f x y) =
      if x ∈ l then (l.map f).set (l.indexOf x) y else l.map f := by
  induction' l with hd tl ihl; · simp
  rw [nodup_cons] at hl
  simp only [mem_cons, map, ihl hl.2]
  

Proof state:
case cons
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
f : α → β
x : α
y : β
hd : α
tl : List α
ihl : Nodup tl → map (update f x y) tl = if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl
hl : hd ∉ tl ∧ Nodup tl
⊢ (update f x y hd :: if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl) =
    if x = hd ∨ x ∈ tl then set (f hd :: map f tl) (indexOf x (hd :: tl)) y else f hd :: map f tl

Next tactic:
by_cases H : hd = x
theorem Nodup.map_update [DecidableEq α] {l : List α} (hl : l.Nodup) (f : α → β) (x : α) (y : β) :
    l.map (Function.update f x y) =
      if x ∈ l then (l.map f).set (l.indexOf x) y else l.map f := by
  induction' l with hd tl ihl; · simp
  rw [nodup_cons] at hl
  simp only [mem_cons, map, ihl hl.2]
  by_cases H : hd = x
  · 

Proof state:
case pos
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
f : α → β
x : α
y : β
hd : α
tl : List α
ihl : Nodup tl → map (update f x y) tl = if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl
hl : hd ∉ tl ∧ Nodup tl
H : hd = x
⊢ (update f x y hd :: if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl) =
    if x = hd ∨ x ∈ tl then set (f hd :: map f tl) (indexOf x (hd :: tl)) y else f hd :: map f tl

Next tactic:
subst hd
theorem Nodup.map_update [DecidableEq α] {l : List α} (hl : l.Nodup) (f : α → β) (x : α) (y : β) :
    l.map (Function.update f x y) =
      if x ∈ l then (l.map f).set (l.indexOf x) y else l.map f := by
  induction' l with hd tl ihl; · simp
  rw [nodup_cons] at hl
  simp only [mem_cons, map, ihl hl.2]
  by_cases H : hd = x
  · subst hd
    

Proof state:
case pos
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
f : α → β
x : α
y : β
tl : List α
ihl : Nodup tl → map (update f x y) tl = if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl
hl : x ∉ tl ∧ Nodup tl
⊢ (update f x y x :: if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl) =
    if x = x ∨ x ∈ tl then set (f x :: map f tl) (indexOf x (x :: tl)) y else f x :: map f tl

Next tactic:
simp [set, hl.1]
theorem Nodup.map_update [DecidableEq α] {l : List α} (hl : l.Nodup) (f : α → β) (x : α) (y : β) :
    l.map (Function.update f x y) =
      if x ∈ l then (l.map f).set (l.indexOf x) y else l.map f := by
  induction' l with hd tl ihl; · simp
  rw [nodup_cons] at hl
  simp only [mem_cons, map, ihl hl.2]
  by_cases H : hd = x
  · subst hd
    simp [set, hl.1]
  · 

Proof state:
case neg
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
f : α → β
x : α
y : β
hd : α
tl : List α
ihl : Nodup tl → map (update f x y) tl = if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl
hl : hd ∉ tl ∧ Nodup tl
H : ¬hd = x
⊢ (update f x y hd :: if x ∈ tl then set (map f tl) (indexOf x tl) y else map f tl) =
    if x = hd ∨ x ∈ tl then set (f hd :: map f tl) (indexOf x (hd :: tl)) y else f hd :: map f tl

Next tactic:
simp [Ne.symm H, H, set, ← apply_ite (cons (f hd))]
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a b : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
⊢ Pairwise r l

Next tactic:
apply pairwise_iff_forall_sublist.mpr
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a b : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
⊢ ∀ {a b : α}, [a, b] <+ l → r a b

Next tactic:
intro a b hab
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
⊢ r a b

Next tactic:
if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> try (apply hab.subset; simp)
    exact heq
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : a = b
⊢ r a b

Next tactic:
cases heq
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; 

Proof state:
case refl
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a : α
hab : [a, a] <+ l
⊢ r a a

Next tactic:
have := nodup_iff_sublist.mp hl _ hab
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; 

Proof state:
case refl
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a : α
hab : [a, a] <+ l
this : False
⊢ r a a

Next tactic:
contradiction
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    

Proof state:
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ r a b

Next tactic:
apply h
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> 

Proof state:
case a
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ a ∈ l

Next tactic:
try (apply hab.subset; simp)
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> try (

Proof state:
case a
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ a ∈ l

Next tactic:
apply hab.subset
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> try (apply hab.subset; 

Proof state:
case a.a
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ a ∈ [a, b]

Next tactic:
simp
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> 

Proof state:
case a
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ b ∈ l

Next tactic:
try (apply hab.subset; simp)
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> try (

Proof state:
case a
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ b ∈ l

Next tactic:
apply hab.subset
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> try (apply hab.subset; 

Proof state:
case a.a
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ b ∈ [a, b]

Next tactic:
simp
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> 

Proof state:
case a
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ a ≠ b

Next tactic:
try (apply hab.subset; simp)
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> try (

Proof state:
case a
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ a ≠ b

Next tactic:
apply hab.subset
theorem Nodup.pairwise_of_forall_ne {l : List α} {r : α → α → Prop} (hl : l.Nodup)
    (h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b) : l.Pairwise r := by
  apply pairwise_iff_forall_sublist.mpr
  intro a b hab
  if heq : a = b then
    cases heq; have := nodup_iff_sublist.mp hl _ hab; contradiction
  else
    apply h <;> try (apply hab.subset; simp)
    

Proof state:
case a
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r✝ : α → α → Prop
a✝ b✝ : α
l : List α
r : α → α → Prop
hl : Nodup l
h : ∀ a ∈ l, ∀ b ∈ l, a ≠ b → r a b
a b : α
hab : [a, b] <+ l
heq : ¬a = b
⊢ a ≠ b

Next tactic:
exact heq
@[simp]
theorem Nodup.pairwise_coe [IsSymm α r] (hl : l.Nodup) :
    { a | a ∈ l }.Pairwise r ↔ l.Pairwise r := by
  

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : IsSymm α r
hl : Nodup l
⊢ Set.Pairwise {a | a ∈ l} r ↔ Pairwise r l

Next tactic:
induction' l with a l ih
@[simp]
theorem Nodup.pairwise_coe [IsSymm α r] (hl : l.Nodup) :
    { a | a ∈ l }.Pairwise r ↔ l.Pairwise r := by
  induction' l with a l ih
  · 

Proof state:
case nil
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : IsSymm α r
hl : Nodup []
⊢ Set.Pairwise {a | a ∈ []} r ↔ Pairwise r []

Next tactic:
simp
@[simp]
theorem Nodup.pairwise_coe [IsSymm α r] (hl : l.Nodup) :
    { a | a ∈ l }.Pairwise r ↔ l.Pairwise r := by
  induction' l with a l ih
  · simp
  

Proof state:
case cons
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a✝ b : α
inst✝ : IsSymm α r
a : α
l : List α
ih : Nodup l → (Set.Pairwise {a | a ∈ l} r ↔ Pairwise r l)
hl : Nodup (a :: l)
⊢ Set.Pairwise {a_1 | a_1 ∈ a :: l} r ↔ Pairwise r (a :: l)

Next tactic:
rw [List.nodup_cons] at hl
@[simp]
theorem Nodup.pairwise_coe [IsSymm α r] (hl : l.Nodup) :
    { a | a ∈ l }.Pairwise r ↔ l.Pairwise r := by
  induction' l with a l ih
  · simp
  rw [List.nodup_cons] at hl
  

Proof state:
case cons
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a✝ b : α
inst✝ : IsSymm α r
a : α
l : List α
ih : Nodup l → (Set.Pairwise {a | a ∈ l} r ↔ Pairwise r l)
hl : a ∉ l ∧ Nodup l
⊢ Set.Pairwise {a_1 | a_1 ∈ a :: l} r ↔ Pairwise r (a :: l)

Next tactic:
have : ∀ b ∈ l, ¬a = b → r a b ↔ r a b := fun b hb =>
    imp_iff_right (ne_of_mem_of_not_mem hb hl.1).symm
@[simp]
theorem Nodup.pairwise_coe [IsSymm α r] (hl : l.Nodup) :
    { a | a ∈ l }.Pairwise r ↔ l.Pairwise r := by
  induction' l with a l ih
  · simp
  rw [List.nodup_cons] at hl
  have : ∀ b ∈ l, ¬a = b → r a b ↔ r a b := fun b hb =>
    imp_iff_right (ne_of_mem_of_not_mem hb hl.1).symm
  

Proof state:
case cons
α : Type u
β : Type v
l✝ l₁ l₂ : List α
r : α → α → Prop
a✝ b : α
inst✝ : IsSymm α r
a : α
l : List α
ih : Nodup l → (Set.Pairwise {a | a ∈ l} r ↔ Pairwise r l)
hl : a ∉ l ∧ Nodup l
this : ∀ b ∈ l, ¬a = b → r a b ↔ r a b
⊢ Set.Pairwise {a_1 | a_1 ∈ a :: l} r ↔ Pairwise r (a :: l)

Next tactic:
simp [Set.setOf_or, Set.pairwise_insert_of_symmetric (@symm_of _ r _), ih hl.2, and_comm,
    forall₂_congr this]
theorem Nodup.take_eq_filter_mem [DecidableEq α] :
    ∀ {l : List α} {n : ℕ} (_ : l.Nodup), l.take n = l.filter (· ∈ l.take n)
  | [], n, _ => by 

Proof state:
α : Type u
β : Type v
l l₁ l₂ : List α
r : α → α → Prop
a b : α
inst✝ : DecidableEq α
n : ℕ
x✝ : Nodup []
⊢ take n [] = List.filter (fun x => decide (x ∈ take n [])) []

Next tactic:
simp