Theorem: List.Perm.drop_inter
File: Mathlib/Data/List/Perm.lean

tactic: by_cases h'' : n ≤ xs.length
state_before: α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
⊢ drop n xs ~ ys.inter (drop n xs)
state_after: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
⊢ drop n xs ~ ys.inter (drop n xs)

case neg
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : ¬n ≤ xs.length
⊢ drop n xs ~ ys.inter (drop n xs)

tactic: let n' := xs.length - n
state_before: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
⊢ drop n xs ~ ys.inter (drop n xs)
state_after: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
⊢ drop n xs ~ ys.inter (drop n xs)

tactic: have h₀ : n = xs.length - n' := by rwa [Nat.sub_sub_self]
state_before: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
⊢ drop n xs ~ ys.inter (drop n xs)
state_after: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
⊢ drop n xs ~ ys.inter (drop n xs)

tactic: have h₁ : n' ≤ xs.length := Nat.sub_le ..
state_before: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
⊢ drop n xs ~ ys.inter (drop n xs)
state_after: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
⊢ drop n xs ~ ys.inter (drop n xs)

tactic: have h₂ : xs.drop n = (xs.reverse.take n').reverse := by
  rw [take_reverse _ h₁, h₀, reverse_reverse]
state_before: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
⊢ drop n xs ~ ys.inter (drop n xs)
state_after: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ drop n xs ~ ys.inter (drop n xs)

tactic: rw [h₂]
state_before: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ drop n xs ~ ys.inter (drop n xs)
state_after: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ (take n' xs.reverse).reverse ~ ys.inter (take n' xs.reverse).reverse

tactic: apply (reverse_perm _).trans
state_before: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ (take n' xs.reverse).reverse ~ ys.inter (take n' xs.reverse).reverse
state_after: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ take n' xs.reverse ~ ys.inter (take n' xs.reverse).reverse

tactic: rw [inter_reverse]
state_before: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ take n' xs.reverse ~ ys.inter (take n' xs.reverse).reverse
state_after: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ take n' xs.reverse ~ ys.inter (take n' xs.reverse)

tactic: apply Perm.take_inter _ _ h'
state_before: case pos
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ take n' xs.reverse ~ ys.inter (take n' xs.reverse)
state_after: α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ xs.reverse ~ ys

tactic: apply (reverse_perm _).trans
state_before: α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ xs.reverse ~ ys
state_after: α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ xs ~ ys

tactic: assumption
state_before: α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
h₂ : drop n xs = (take n' xs.reverse).reverse
⊢ xs ~ ys
state_after: no goals

tactic: rwa [Nat.sub_sub_self]
state_before: α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
⊢ n = xs.length - n'
state_after: no goals

tactic: rw [take_reverse _ h₁, h₀, reverse_reverse]
state_before: α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : n ≤ xs.length
n' : ℕ := xs.length - n
h₀ : n = xs.length - n'
h₁ : n' ≤ xs.length
⊢ drop n xs = (take n' xs.reverse).reverse
state_after: no goals

tactic: have : drop n xs = [] := by
  apply eq_nil_of_length_eq_zero
  rw [length_drop, Nat.sub_eq_zero_iff_le]
  apply le_of_not_ge h''
state_before: case neg
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : ¬n ≤ xs.length
⊢ drop n xs ~ ys.inter (drop n xs)
state_after: case neg
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : ¬n ≤ xs.length
this : drop n xs = []
⊢ drop n xs ~ ys.inter (drop n xs)

tactic: simp [this, List.inter]
state_before: case neg
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : ¬n ≤ xs.length
this : drop n xs = []
⊢ drop n xs ~ ys.inter (drop n xs)
state_after: no goals

tactic: apply eq_nil_of_length_eq_zero
state_before: α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : ¬n ≤ xs.length
⊢ drop n xs = []
state_after: case x
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : ¬n ≤ xs.length
⊢ (drop n xs).length = 0

tactic: rw [length_drop, Nat.sub_eq_zero_iff_le]
state_before: case x
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : ¬n ≤ xs.length
⊢ (drop n xs).length = 0
state_after: case x
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : ¬n ≤ xs.length
⊢ xs.length ≤ n

tactic: apply le_of_not_ge h''
state_before: case x
α : Type u_1
β : Type u_2
l l₁ l₂ : List α
a : α
inst✝ : DecidableEq α
xs ys : List α
n : ℕ
h : xs ~ ys
h' : ys.Nodup
h'' : ¬n ≤ xs.length
⊢ xs.length ≤ n
state_after: no goals