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

tactic: cases' xs with x xs
state_before: α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x : α
xs : List α
w : xs.Nodup
i : ℕ
h : i < xs.length
⊢ xs.formPerm xs[i] = xs[(i + 1) % xs.length]
state_after: case nil
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x : α
i : ℕ
w : [].Nodup
h : i < [].length
⊢ [].formPerm [][i] = [][(i + 1) % [].length]

case cons
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
⊢ (x :: xs).formPerm (x :: xs)[i] = (x :: xs)[(i + 1) % (x :: xs).length]

tactic: simp at h
state_before: case nil
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x : α
i : ℕ
w : [].Nodup
h : i < [].length
⊢ [].formPerm [][i] = [][(i + 1) % [].length]
state_after: no goals

tactic: have : i ≤ xs.length := by
  refine Nat.le_of_lt_succ ?_
  simpa using h
state_before: case cons
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
⊢ (x :: xs).formPerm (x :: xs)[i] = (x :: xs)[(i + 1) % (x :: xs).length]
state_after: case cons
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
⊢ (x :: xs).formPerm (x :: xs)[i] = (x :: xs)[(i + 1) % (x :: xs).length]

tactic: rcases this.eq_or_lt with (rfl | hn')
state_before: case cons
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
⊢ (x :: xs).formPerm (x :: xs)[i] = (x :: xs)[(i + 1) % (x :: xs).length]
state_after: case cons.inl
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ x : α
xs : List α
w : (x :: xs).Nodup
h : xs.length < (x :: xs).length
this : xs.length ≤ xs.length
⊢ (x :: xs).formPerm (x :: xs)[xs.length] = (x :: xs)[(xs.length + 1) % (x :: xs).length]

case cons.inr
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
hn' : i < xs.length
⊢ (x :: xs).formPerm (x :: xs)[i] = (x :: xs)[(i + 1) % (x :: xs).length]

tactic: refine Nat.le_of_lt_succ ?_
state_before: α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
⊢ i ≤ xs.length
state_after: α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
⊢ i < xs.length.succ

tactic: simpa using h
state_before: α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
⊢ i < xs.length.succ
state_after: no goals

tactic: simp
state_before: case cons.inl
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ x : α
xs : List α
w : (x :: xs).Nodup
h : xs.length < (x :: xs).length
this : xs.length ≤ xs.length
⊢ (x :: xs).formPerm (x :: xs)[xs.length] = (x :: xs)[(xs.length + 1) % (x :: xs).length]
state_after: no goals

tactic: rw [formPerm_apply_lt_getElem (x :: xs) w _ (Nat.succ_lt_succ hn')]
state_before: case cons.inr
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
hn' : i < xs.length
⊢ (x :: xs).formPerm (x :: xs)[i] = (x :: xs)[(i + 1) % (x :: xs).length]
state_after: case cons.inr
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
hn' : i < xs.length
⊢ (x :: xs)[i + 1] = (x :: xs)[(i + 1) % (x :: xs).length]

tactic: congr
state_before: case cons.inr
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
hn' : i < xs.length
⊢ (x :: xs)[i + 1] = (x :: xs)[(i + 1) % (x :: xs).length]
state_after: case cons.inr.e_i
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
hn' : i < xs.length
⊢ i + 1 = (i + 1) % (x :: xs).length

tactic: rw [Nat.mod_eq_of_lt]
state_before: case cons.inr.e_i
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
hn' : i < xs.length
⊢ i + 1 = (i + 1) % (x :: xs).length
state_after: case cons.inr.e_i
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
hn' : i < xs.length
⊢ i + 1 < (x :: xs).length

tactic: simpa [Nat.succ_eq_add_one]
state_before: case cons.inr.e_i
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
i : ℕ
x : α
xs : List α
w : (x :: xs).Nodup
h : i < (x :: xs).length
this : i ≤ xs.length
hn' : i < xs.length
⊢ i + 1 < (x :: xs).length
state_after: no goals