Theorem: Fin.succAbove_cycleRange
File: Mathlib/GroupTheory/Perm/Fin.lean

tactic: cases n
state_before: n : ℕ
i j : Fin n
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ
state_after: case zero
i j : Fin 0
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ

case succ
n✝ : ℕ
i j : Fin (n✝ + 1)
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ

tactic: rcases lt_trichotomy j i with (hlt | heq | hgt)
state_before: case succ
n✝ : ℕ
i j : Fin (n✝ + 1)
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ
state_after: case succ.inl
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ

case succ.inr.inl
n✝ : ℕ
i j : Fin (n✝ + 1)
heq : j = i
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ

case succ.inr.inr
n✝ : ℕ
i j : Fin (n✝ + 1)
hgt : i < j
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ

tactic: rcases j with ⟨_, ⟨⟩⟩
state_before: case zero
i j : Fin 0
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ
state_after: no goals

tactic: have : castSucc (j + 1) = j.succ := by
  ext
  rw [coe_castSucc, val_succ, Fin.val_add_one_of_lt (lt_of_lt_of_le hlt i.le_last)]
state_before: case succ.inl
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ
state_after: case succ.inl
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ

tactic: rw [Fin.cycleRange_of_lt hlt, Fin.succAbove_of_castSucc_lt, this, swap_apply_of_ne_of_ne]
state_before: case succ.inl
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ
state_after: case succ.inl.a
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ j.succ ≠ 0

case succ.inl.a
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ j.succ ≠ i.succ

case succ.inl.h
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ (j + 1).castSucc < i.succ

tactic: ext
state_before: n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
⊢ (j + 1).castSucc = j.succ
state_after: case h
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
⊢ ↑(j + 1).castSucc = ↑j.succ

tactic: rw [coe_castSucc, val_succ, Fin.val_add_one_of_lt (lt_of_lt_of_le hlt i.le_last)]
state_before: case h
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
⊢ ↑(j + 1).castSucc = ↑j.succ
state_after: no goals

tactic: apply Fin.succ_ne_zero
state_before: case succ.inl.a
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ j.succ ≠ 0
state_after: no goals

tactic: exact (Fin.succ_injective _).ne hlt.ne
state_before: case succ.inl.a
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ j.succ ≠ i.succ
state_after: no goals

tactic: rw [Fin.lt_iff_val_lt_val]
state_before: case succ.inl.h
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ (j + 1).castSucc < i.succ
state_after: case succ.inl.h
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ ↑(j + 1).castSucc < ↑i.succ

tactic: simpa [this] using hlt
state_before: case succ.inl.h
n✝ : ℕ
i j : Fin (n✝ + 1)
hlt : j < i
this : (j + 1).castSucc = j.succ
⊢ ↑(j + 1).castSucc < ↑i.succ
state_after: no goals

tactic: rw [heq, Fin.cycleRange_self, Fin.succAbove_of_castSucc_lt, swap_apply_right, Fin.castSucc_zero]
state_before: case succ.inr.inl
n✝ : ℕ
i j : Fin (n✝ + 1)
heq : j = i
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ
state_after: case succ.inr.inl.h
n✝ : ℕ
i j : Fin (n✝ + 1)
heq : j = i
⊢ castSucc 0 < i.succ

tactic: rw [Fin.castSucc_zero]
state_before: case succ.inr.inl.h
n✝ : ℕ
i j : Fin (n✝ + 1)
heq : j = i
⊢ castSucc 0 < i.succ
state_after: case succ.inr.inl.h
n✝ : ℕ
i j : Fin (n✝ + 1)
heq : j = i
⊢ 0 < i.succ

tactic: apply Fin.succ_pos
state_before: case succ.inr.inl.h
n✝ : ℕ
i j : Fin (n✝ + 1)
heq : j = i
⊢ 0 < i.succ
state_after: no goals

tactic: rw [Fin.cycleRange_of_gt hgt, Fin.succAbove_of_le_castSucc, swap_apply_of_ne_of_ne]
state_before: case succ.inr.inr
n✝ : ℕ
i j : Fin (n✝ + 1)
hgt : i < j
⊢ i.succ.succAbove (i.cycleRange j) = (swap 0 i.succ) j.succ
state_after: case succ.inr.inr.a
n✝ : ℕ
i j : Fin (n✝ + 1)
hgt : i < j
⊢ j.succ ≠ 0

case succ.inr.inr.a
n✝ : ℕ
i j : Fin (n✝ + 1)
hgt : i < j
⊢ j.succ ≠ i.succ

case succ.inr.inr.h
n✝ : ℕ
i j : Fin (n✝ + 1)
hgt : i < j
⊢ i.succ ≤ j.castSucc

tactic: apply Fin.succ_ne_zero
state_before: case succ.inr.inr.a
n✝ : ℕ
i j : Fin (n✝ + 1)
hgt : i < j
⊢ j.succ ≠ 0
state_after: no goals

tactic: apply (Fin.succ_injective _).ne hgt.ne.symm
state_before: case succ.inr.inr.a
n✝ : ℕ
i j : Fin (n✝ + 1)
hgt : i < j
⊢ j.succ ≠ i.succ
state_after: no goals

tactic: simpa [Fin.le_iff_val_le_val] using hgt
state_before: case succ.inr.inr.h
n✝ : ℕ
i j : Fin (n✝ + 1)
hgt : i < j
⊢ i.succ ≤ j.castSucc
state_after: no goals