theorem perm.perm_erase_dup_of_perm [congr] : ∀ {A : Type} [H : decidable_eq A] {l₁ l₂ : list A}, l₁ ~ l₂ → erase_dup l₁ ~ erase_dup l₂ := λ A H l₁ l₂ p, perm_induction_on p nil (λ x t₁ t₂ p r, decidable.by_cases (λ xint₁, have xint₂ : x ∈ t₂, from mem_of_mem_erase_dup …, … …) (λ nxint₁, have nxint₂ : x ∉ t₂, from λ xint₂, … nxint₁, eq.rec … (eq.symm …))) (λ y x t₁ t₂ p r, decidable.by_cases (λ xinyt₁, decidable.by_cases (λ yint₁, …) (λ nyint₁, have nyint₂ : …, from …, …)) (λ nxinyt₁, have xney : x ≠ y, from ne_of_not_mem_cons nxinyt₁, have nxint₁ : x ∉ t₁, from not_mem_of_not_mem_cons nxinyt₁, have nxint₂ : x ∉ t₂, from λ xint₂, …, … …)) (λ t₁ t₂ t₃ p₁ p₂, trans)