-- Mathlib/GroupTheory/Coxeter/Basic.lean
lemma getElem_alternatingWord_swapIndices (i j : B) (p k : ℕ) (h : k + 1 < p) :
   (alternatingWord i j p)[k+1]'(by simp; exact h) =
   (alternatingWord j i p)[k]'(by simp [h]; omega)

Proof state:
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
⊢ (if Even (p + (k + 1)) then i else j) = if Even (p + k) then j else i

Tactic:
by_cases h_even : Even (p + k)

Result:
case pos
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
h_even : Even (p + k)
⊢ (if Even (p + (k + 1)) then i else j) = if Even (p + k) then j else i

case neg
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
h_even : ¬Even (p + k)
⊢ (if Even (p + (k + 1)) then i else j) = if Even (p + k) then j else i

Proof state:
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
⊢ k + 1 < p

Tactic:
omega

Result:
no goals

Proof state:
B : Type u_1
B' : Type u_2
e : B ≃ B'
W : Type u_3
H : Type u_4
inst✝¹ : Group W
inst✝ : Group H
M : CoxeterMatrix B
cs : CoxeterSystem M W
i j : B
p k : ℕ
h : k + 1 < p
⊢ k < (alternatingWord j i p).length

Tactic:
simp [h]

Result:
B : Type u_1
B' : Type u_2
e : B ≃ B'
W : Type u_3
H : Type u_4
inst✝¹ : Group W
inst✝ : Group H
M : CoxeterMatrix B
cs : CoxeterSystem M W
i j : B
p k : ℕ
h : k + 1 < p
⊢ k < p

Proof state:
B : Type u_1
B' : Type u_2
e : B ≃ B'
W : Type u_3
H : Type u_4
inst✝¹ : Group W
inst✝ : Group H
M : CoxeterMatrix B
cs : CoxeterSystem M W
i j : B
p k : ℕ
h : k + 1 < p
⊢ k + 1 < (alternatingWord i j p).length

Tactic:
simp

Result:
B : Type u_1
B' : Type u_2
e : B ≃ B'
W : Type u_3
H : Type u_4
inst✝¹ : Group W
inst✝ : Group H
M : CoxeterMatrix B
cs : CoxeterSystem M W
i j : B
p k : ℕ
h : k + 1 < p
⊢ k + 1 < p

Proof state:
case neg
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
h_even : ¬Even (p + k)
⊢ (if Even (p + (k + 1)) then i else j) = if Even (p + k) then j else i

Tactic:
rw [if_neg h_even, ← add_assoc]

Result:
case neg
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
h_even : ¬Even (p + k)
⊢ (if Even (p + k + 1) then i else j) = i

Proof state:
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
⊢ (alternatingWord i j p)[k + 1] = (alternatingWord j i p)[k]

Tactic:
rw [getElem_alternatingWord i j p (k+1) (by omega), getElem_alternatingWord j i p k (by omega)]

Result:
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
⊢ (if Even (p + (k + 1)) then i else j) = if Even (p + k) then j else i

Proof state:
case neg
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
h_even : ¬Even (p + k)
⊢ (if Even (p + k + 1) then i else j) = i

Tactic:
simp [Odd.add_one (Nat.not_even_iff_odd.mp h_even)]

Result:
no goals

Proof state:
B : Type u_1
B' : Type u_2
e : B ≃ B'
W : Type u_3
H : Type u_4
inst✝¹ : Group W
inst✝ : Group H
M : CoxeterMatrix B
cs : CoxeterSystem M W
i j : B
p k : ℕ
h : k + 1 < p
⊢ k + 1 < p

Tactic:
exact h

Result:
no goals

Proof state:
case pos
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
h_even : Even (p + k)
⊢ (if Even (p + k + 1) then i else j) = j

Tactic:
simp only [ite_eq_right_iff, isEmpty_Prop, Nat.not_even_iff_odd, Even.add_one h_even,
  IsEmpty.forall_iff]

Result:
no goals

Proof state:
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
⊢ k < p

Tactic:
omega

Result:
no goals

Proof state:
case pos
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
h_even : Even (p + k)
⊢ (if Even (p + (k + 1)) then i else j) = if Even (p + k) then j else i

Tactic:
rw [if_pos h_even, ← add_assoc]

Result:
case pos
B : Type u_1
i j : B
p k : ℕ
h : k + 1 < p
h_even : Even (p + k)
⊢ (if Even (p + k + 1) then i else j) = j

Proof state:
B : Type u_1
B' : Type u_2
e : B ≃ B'
W : Type u_3
H : Type u_4
inst✝¹ : Group W
inst✝ : Group H
M : CoxeterMatrix B
cs : CoxeterSystem M W
i j : B
p k : ℕ
h : k + 1 < p
⊢ k < p

Tactic:
omega

Result:
no goals