Theorem: List.formPerm_ext_iff
File: Mathlib/GroupTheory/Perm/List.lean

tactic: refine' ⟨fun h => _, fun hr => formPerm_eq_of_isRotated hd hr⟩
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
⊢ formPerm (x :: y :: l) = formPerm (x' :: y' :: l') ↔ (x :: y :: l) ~r (x' :: y' :: l')

tactic: rw [Equiv.Perm.ext_iff] at h
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : formPerm (x :: y :: l) = formPerm (x' :: y' :: l')
⊢ (x :: y :: l) ~r (x' :: y' :: l')

tactic: have hx : x' ∈ x :: y :: l := by
  have : x' ∈ { z | formPerm (x :: y :: l) z ≠ z } := by
    rw [Set.mem_setOf_eq, h x', formPerm_apply_head _ _ _ hd']
    simp only [mem_cons, nodup_cons] at hd'
    push_neg  at hd'
    exact hd'.left.left.symm
  simpa using support_formPerm_le' _ this
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
⊢ (x :: y :: l) ~r (x' :: y' :: l')

tactic: obtain ⟨n, hn, hx'⟩ := nthLe_of_mem hx
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
⊢ (x :: y :: l) ~r (x' :: y' :: l')

tactic: have hl : (x :: y :: l).length = (x' :: y' :: l').length := by
  rw [← dedup_eq_self.mpr hd, ← dedup_eq_self.mpr hd', ← card_toFinset, ← card_toFinset]
  refine' congr_arg Finset.card _
  rw [← Finset.coe_inj, ← support_formPerm_of_nodup' _ hd (by simp), ←
    support_formPerm_of_nodup' _ hd' (by simp)]
  simp only [h]
state_before: case intro.intro
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
⊢ (x :: y :: l) ~r (x' :: y' :: l')

tactic: use n
state_before: case intro.intro
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
⊢ (x :: y :: l) ~r (x' :: y' :: l')

tactic: apply List.ext_nthLe
state_before: case intro.intro
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
⊢ rotate (x :: y :: l) n = x' :: y' :: l'

tactic: have : x' ∈ { z | formPerm (x :: y :: l) z ≠ z } := by
  rw [Set.mem_setOf_eq, h x', formPerm_apply_head _ _ _ hd']
  simp only [mem_cons, nodup_cons] at hd'
  push_neg  at hd'
  exact hd'.left.left.symm
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
⊢ x' ∈ x :: y :: l

tactic: simpa using support_formPerm_le' _ this
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
this : x' ∈ {z | ↑(formPerm (x :: y :: l)) z ≠ z}
⊢ x' ∈ x :: y :: l

tactic: rw [Set.mem_setOf_eq, h x', formPerm_apply_head _ _ _ hd']
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
⊢ x' ∈ {z | ↑(formPerm (x :: y :: l)) z ≠ z}

tactic: simp only [mem_cons, nodup_cons] at hd'
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
⊢ y' ≠ x'

tactic: push_neg  at hd'
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hd' : ¬(x' = y' ∨ x' ∈ l') ∧ ¬y' ∈ l' ∧ Nodup l'
⊢ y' ≠ x'

tactic: exact hd'.left.left.symm
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hd' : (x' ≠ y' ∧ ¬x' ∈ l') ∧ ¬y' ∈ l' ∧ Nodup l'
⊢ y' ≠ x'

tactic: rw [← dedup_eq_self.mpr hd, ← dedup_eq_self.mpr hd', ← card_toFinset, ← card_toFinset]
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
⊢ length (x :: y :: l) = length (x' :: y' :: l')

tactic: refine' congr_arg Finset.card _
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
⊢ Finset.card (toFinset (x :: y :: l)) = Finset.card (toFinset (x' :: y' :: l'))

tactic: rw [← Finset.coe_inj, ← support_formPerm_of_nodup' _ hd (by simp), ←
  support_formPerm_of_nodup' _ hd' (by simp)]
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
⊢ toFinset (x :: y :: l) = toFinset (x' :: y' :: l')

tactic: simp only [h]
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
⊢ {x_1 | ↑(formPerm (x :: y :: l)) x_1 ≠ x_1} = {x | ↑(formPerm (x' :: y' :: l')) x ≠ x}

tactic: simp
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
⊢ ∀ (x_1 : α), x :: y :: l ≠ [x_1]

tactic: simp
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
⊢ ∀ (x : α), x' :: y' :: l' ≠ [x]

tactic: rw [length_rotate, hl]
state_before: case intro.intro.hl
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
⊢ length (rotate (x :: y :: l) n) = length (x' :: y' :: l')

tactic: intro k hk hk'
state_before: case intro.intro.h
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
⊢ ∀ (n_1 : ℕ) (h₁ : n_1 < length (rotate (x :: y :: l) n)) (h₂ : n_1 < length (x' :: y' :: l')),
    nthLe (rotate (x :: y :: l) n) n_1 h₁ = nthLe (x' :: y' :: l') n_1 h₂

tactic: rw [nthLe_rotate]
state_before: case intro.intro.h
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k : ℕ
hk : k < length (rotate (x :: y :: l) n)
hk' : k < length (x' :: y' :: l')
⊢ nthLe (rotate (x :: y :: l) n) k hk = nthLe (x' :: y' :: l') k hk'

tactic: induction' k with k IH
state_before: case intro.intro.h
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k : ℕ
hk : k < length (rotate (x :: y :: l) n)
hk' : k < length (x' :: y' :: l')
⊢ nthLe (x :: y :: l) ((k + n) % length (x :: y :: l)) (_ : (k + n) % length (x :: y :: l) < length (x :: y :: l)) =
    nthLe (x' :: y' :: l') k hk'

tactic: refine' Eq.trans _ hx'
state_before: case intro.intro.h.zero
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k : ℕ
hk✝ : k < length (rotate (x :: y :: l) n)
hk'✝ : k < length (x' :: y' :: l')
hk : Nat.zero < length (rotate (x :: y :: l) n)
hk' : Nat.zero < length (x' :: y' :: l')
⊢ nthLe (x :: y :: l) ((Nat.zero + n) % length (x :: y :: l))
      (_ : (Nat.zero + n) % length (x :: y :: l) < length (x :: y :: l)) =
    nthLe (x' :: y' :: l') Nat.zero hk'

tactic: congr
state_before: case intro.intro.h.zero
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k : ℕ
hk✝ : k < length (rotate (x :: y :: l) n)
hk'✝ : k < length (x' :: y' :: l')
hk : Nat.zero < length (rotate (x :: y :: l) n)
hk' : Nat.zero < length (x' :: y' :: l')
⊢ nthLe (x :: y :: l) ((Nat.zero + n) % length (x :: y :: l))
      (_ : (Nat.zero + n) % length (x :: y :: l) < length (x :: y :: l)) =
    nthLe (x :: y :: l) n hn

tactic: simpa using hn
state_before: case intro.intro.h.zero.e_n
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k : ℕ
hk✝ : k < length (rotate (x :: y :: l) n)
hk'✝ : k < length (x' :: y' :: l')
hk : Nat.zero < length (rotate (x :: y :: l) n)
hk' : Nat.zero < length (x' :: y' :: l')
⊢ (Nat.zero + n) % length (x :: y :: l) = n

tactic: have : k.succ = (k + 1) % (x' :: y' :: l').length := by
  rw [← Nat.succ_eq_add_one, Nat.mod_eq_of_lt hk']
state_before: case intro.intro.h.succ
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k✝ : ℕ
hk✝ : k✝ < length (rotate (x :: y :: l) n)
hk'✝ : k✝ < length (x' :: y' :: l')
k : ℕ
IH :
  ∀ (hk : k < length (rotate (x :: y :: l) n)) (hk' : k < length (x' :: y' :: l')),
    nthLe (x :: y :: l) ((k + n) % length (x :: y :: l)) (_ : (k + n) % length (x :: y :: l) < length (x :: y :: l)) =
      nthLe (x' :: y' :: l') k hk'
hk : Nat.succ k < length (rotate (x :: y :: l) n)
hk' : Nat.succ k < length (x' :: y' :: l')
⊢ nthLe (x :: y :: l) ((Nat.succ k + n) % length (x :: y :: l))
      (_ : (Nat.succ k + n) % length (x :: y :: l) < length (x :: y :: l)) =
    nthLe (x' :: y' :: l') (Nat.succ k) hk'

tactic: simp_rw [this]
state_before: case intro.intro.h.succ
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k✝ : ℕ
hk✝ : k✝ < length (rotate (x :: y :: l) n)
hk'✝ : k✝ < length (x' :: y' :: l')
k : ℕ
IH :
  ∀ (hk : k < length (rotate (x :: y :: l) n)) (hk' : k < length (x' :: y' :: l')),
    nthLe (x :: y :: l) ((k + n) % length (x :: y :: l)) (_ : (k + n) % length (x :: y :: l) < length (x :: y :: l)) =
      nthLe (x' :: y' :: l') k hk'
hk : Nat.succ k < length (rotate (x :: y :: l) n)
hk' : Nat.succ k < length (x' :: y' :: l')
this : Nat.succ k = (k + 1) % length (x' :: y' :: l')
⊢ nthLe (x :: y :: l) ((Nat.succ k + n) % length (x :: y :: l))
      (_ : (Nat.succ k + n) % length (x :: y :: l) < length (x :: y :: l)) =
    nthLe (x' :: y' :: l') (Nat.succ k) hk'

tactic: rw [← formPerm_apply_nthLe _ hd' k (k.lt_succ_self.trans hk'), ←
  IH (k.lt_succ_self.trans hk), ← h, formPerm_apply_nthLe _ hd]
state_before: case intro.intro.h.succ
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k✝ : ℕ
hk✝ : k✝ < length (rotate (x :: y :: l) n)
hk'✝ : k✝ < length (x' :: y' :: l')
k : ℕ
IH :
  ∀ (hk : k < length (rotate (x :: y :: l) n)) (hk' : k < length (x' :: y' :: l')),
    nthLe (x :: y :: l) ((k + n) % length (x :: y :: l)) (_ : (k + n) % length (x :: y :: l) < length (x :: y :: l)) =
      nthLe (x' :: y' :: l') k hk'
hk : Nat.succ k < length (rotate (x :: y :: l) n)
hk' : Nat.succ k < length (x' :: y' :: l')
this : Nat.succ k = (k + 1) % length (x' :: y' :: l')
⊢ nthLe (x :: y :: l) (((k + 1) % length (x' :: y' :: l') + n) % length (x :: y :: l))
      (_ : ((k + 1) % length (x' :: y' :: l') + n) % length (x :: y :: l) < length (x :: y :: l)) =
    nthLe (x' :: y' :: l') ((k + 1) % length (x' :: y' :: l'))
      (_ : (k + 1) % length (x' :: y' :: l') < length (x' :: y' :: l'))

tactic: congr 1
state_before: case intro.intro.h.succ
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k✝ : ℕ
hk✝ : k✝ < length (rotate (x :: y :: l) n)
hk'✝ : k✝ < length (x' :: y' :: l')
k : ℕ
IH :
  ∀ (hk : k < length (rotate (x :: y :: l) n)) (hk' : k < length (x' :: y' :: l')),
    nthLe (x :: y :: l) ((k + n) % length (x :: y :: l)) (_ : (k + n) % length (x :: y :: l) < length (x :: y :: l)) =
      nthLe (x' :: y' :: l') k hk'
hk : Nat.succ k < length (rotate (x :: y :: l) n)
hk' : Nat.succ k < length (x' :: y' :: l')
this : Nat.succ k = (k + 1) % length (x' :: y' :: l')
⊢ nthLe (x :: y :: l) (((k + 1) % length (x' :: y' :: l') + n) % length (x :: y :: l))
      (_ : ((k + 1) % length (x' :: y' :: l') + n) % length (x :: y :: l) < length (x :: y :: l)) =
    nthLe (x :: y :: l) (((k + n) % length (x :: y :: l) + 1) % length (x :: y :: l))
      (_ : ((k + n) % length (x :: y :: l) + 1) % length (x :: y :: l) < length (x :: y :: l))

tactic: have h1 : 1 = 1 % (x' :: y' :: l').length := by simp
state_before: case intro.intro.h.succ.e_n
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k✝ : ℕ
hk✝ : k✝ < length (rotate (x :: y :: l) n)
hk'✝ : k✝ < length (x' :: y' :: l')
k : ℕ
IH :
  ∀ (hk : k < length (rotate (x :: y :: l) n)) (hk' : k < length (x' :: y' :: l')),
    nthLe (x :: y :: l) ((k + n) % length (x :: y :: l)) (_ : (k + n) % length (x :: y :: l) < length (x :: y :: l)) =
      nthLe (x' :: y' :: l') k hk'
hk : Nat.succ k < length (rotate (x :: y :: l) n)
hk' : Nat.succ k < length (x' :: y' :: l')
this : Nat.succ k = (k + 1) % length (x' :: y' :: l')
⊢ ((k + 1) % length (x' :: y' :: l') + n) % length (x :: y :: l) =
    ((k + n) % length (x :: y :: l) + 1) % length (x :: y :: l)

tactic: rw [hl, Nat.mod_eq_of_lt hk', h1, ← Nat.add_mod, Nat.succ_add, Nat.succ_eq_add_one]
state_before: case intro.intro.h.succ.e_n
α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k✝ : ℕ
hk✝ : k✝ < length (rotate (x :: y :: l) n)
hk'✝ : k✝ < length (x' :: y' :: l')
k : ℕ
IH :
  ∀ (hk : k < length (rotate (x :: y :: l) n)) (hk' : k < length (x' :: y' :: l')),
    nthLe (x :: y :: l) ((k + n) % length (x :: y :: l)) (_ : (k + n) % length (x :: y :: l) < length (x :: y :: l)) =
      nthLe (x' :: y' :: l') k hk'
hk : Nat.succ k < length (rotate (x :: y :: l) n)
hk' : Nat.succ k < length (x' :: y' :: l')
this : Nat.succ k = (k + 1) % length (x' :: y' :: l')
h1 : 1 = 1 % length (x' :: y' :: l')
⊢ ((k + 1) % length (x' :: y' :: l') + n) % length (x :: y :: l) =
    ((k + n) % length (x :: y :: l) + 1) % length (x :: y :: l)

tactic: rw [← Nat.succ_eq_add_one, Nat.mod_eq_of_lt hk']
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k✝ : ℕ
hk✝ : k✝ < length (rotate (x :: y :: l) n)
hk'✝ : k✝ < length (x' :: y' :: l')
k : ℕ
IH :
  ∀ (hk : k < length (rotate (x :: y :: l) n)) (hk' : k < length (x' :: y' :: l')),
    nthLe (x :: y :: l) ((k + n) % length (x :: y :: l)) (_ : (k + n) % length (x :: y :: l) < length (x :: y :: l)) =
      nthLe (x' :: y' :: l') k hk'
hk : Nat.succ k < length (rotate (x :: y :: l) n)
hk' : Nat.succ k < length (x' :: y' :: l')
⊢ Nat.succ k = (k + 1) % length (x' :: y' :: l')

tactic: simp
state_before: α : Type u_1
β : Type ?u.792756
inst✝ : DecidableEq α
l✝ : List α
x✝ x y x' y' : α
l l' : List α
hd : Nodup (x :: y :: l)
hd' : Nodup (x' :: y' :: l')
h : ∀ (x_1 : α), ↑(formPerm (x :: y :: l)) x_1 = ↑(formPerm (x' :: y' :: l')) x_1
hx : x' ∈ x :: y :: l
n : ℕ
hn : n < length (x :: y :: l)
hx' : nthLe (x :: y :: l) n hn = x'
hl : length (x :: y :: l) = length (x' :: y' :: l')
k✝ : ℕ
hk✝ : k✝ < length (rotate (x :: y :: l) n)
hk'✝ : k✝ < length (x' :: y' :: l')
k : ℕ
IH :
  ∀ (hk : k < length (rotate (x :: y :: l) n)) (hk' : k < length (x' :: y' :: l')),
    nthLe (x :: y :: l) ((k + n) % length (x :: y :: l)) (_ : (k + n) % length (x :: y :: l) < length (x :: y :: l)) =
      nthLe (x' :: y' :: l') k hk'
hk : Nat.succ k < length (rotate (x :: y :: l) n)
hk' : Nat.succ k < length (x' :: y' :: l')
this : Nat.succ k = (k + 1) % length (x' :: y' :: l')
⊢ 1 = 1 % length (x' :: y' :: l')