Theorem: List.nodupKeys_dedupKeys
File: Mathlib/Data/List/Sigma.lean

tactic: dsimp [dedupKeys]
state_before: α : Type u
β : α → Type v
l✝ l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l : List (Sigma β)
⊢ NodupKeys (dedupKeys l)

tactic: generalize hl : nil = l'
state_before: α : Type u
β : α → Type v
l✝ l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l : List (Sigma β)
⊢ NodupKeys (foldr (fun x => kinsert x.fst x.snd) [] l)

tactic: have : NodupKeys l' := by
  rw [← hl]
  apply nodup_nil
state_before: α : Type u
β : α → Type v
l✝ l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l : List (Sigma β)
l' : List (Sigma β)
hl : [] = l'
⊢ NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' l)

tactic: clear hl
state_before: α : Type u
β : α → Type v
l✝ l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l : List (Sigma β)
l' : List (Sigma β)
hl : [] = l'
this : NodupKeys l'
⊢ NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' l)

tactic: induction' l with x xs l_ih
state_before: α : Type u
β : α → Type v
l✝ l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l : List (Sigma β)
l' : List (Sigma β)
this : NodupKeys l'
⊢ NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' l)

tactic: rw [← hl]
state_before: α : Type u
β : α → Type v
l✝ l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l : List (Sigma β)
l' : List (Sigma β)
hl : [] = l'
⊢ NodupKeys l'

tactic: apply nodup_nil
state_before: α : Type u
β : α → Type v
l✝ l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l : List (Sigma β)
l' : List (Sigma β)
hl : [] = l'
⊢ NodupKeys []

tactic: apply this
state_before: case nil
α : Type u
β : α → Type v
l l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l' : List (Sigma β)
this : NodupKeys l'
⊢ NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' [])

tactic: cases x
state_before: case cons
α : Type u
β : α → Type v
l l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l' : List (Sigma β)
this : NodupKeys l'
x : Sigma β
xs : List (Sigma β)
l_ih : NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' xs)
⊢ NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' (x :: xs))

tactic: simp [dedupKeys]
state_before: case cons.mk
α : Type u
β : α → Type v
l l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l' : List (Sigma β)
this : NodupKeys l'
xs : List (Sigma β)
l_ih : NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' xs)
fst✝ : α
snd✝ : β fst✝
⊢ NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' ({ fst := fst✝, snd := snd✝ } :: xs))

tactic: constructor
state_before: case cons.mk
α : Type u
β : α → Type v
l l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l' : List (Sigma β)
this : NodupKeys l'
xs : List (Sigma β)
l_ih : NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' xs)
fst✝ : α
snd✝ : β fst✝
⊢ ¬fst✝ ∈ keys (kerase fst✝ (foldr (fun x => kinsert x.fst x.snd) l' xs)) ∧
    NodupKeys (kerase fst✝ (foldr (fun x => kinsert x.fst x.snd) l' xs))

tactic: simp [keys_kerase]
state_before: case cons.mk.left
α : Type u
β : α → Type v
l l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l' : List (Sigma β)
this : NodupKeys l'
xs : List (Sigma β)
l_ih : NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' xs)
fst✝ : α
snd✝ : β fst✝
⊢ ¬fst✝ ∈ keys (kerase fst✝ (foldr (fun x => kinsert x.fst x.snd) l' xs))

tactic: apply l_ih.not_mem_erase
state_before: case cons.mk.left
α : Type u
β : α → Type v
l l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l' : List (Sigma β)
this : NodupKeys l'
xs : List (Sigma β)
l_ih : NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' xs)
fst✝ : α
snd✝ : β fst✝
⊢ ¬fst✝ ∈ List.erase (keys (foldr (fun x => kinsert x.fst x.snd) l' xs)) fst✝

tactic: exact l_ih.kerase _
state_before: case cons.mk.right
α : Type u
β : α → Type v
l l₁ l₂ : List (Sigma β)
inst✝ : DecidableEq α
l' : List (Sigma β)
this : NodupKeys l'
xs : List (Sigma β)
l_ih : NodupKeys (foldr (fun x => kinsert x.fst x.snd) l' xs)
fst✝ : α
snd✝ : β fst✝
⊢ NodupKeys (kerase fst✝ (foldr (fun x => kinsert x.fst x.snd) l' xs))