case node_odd_next x i hi hl hr hx =>
  simp only [Subarray.getElem_swap]
  if hlk : 2*i+1 = k then
    cases hlk; simp only [ite_true]
    exact ⟨i, hi, .refl i, rfl⟩
  else if hik : i = k then
    cases hik; simp only [if_neg hlk, ite_true]
    exact ⟨2*k+1, hl, .child_left k, rfl⟩
  else
    simp only [if_neg hlk, if_neg hik]
    exact ⟨k, hk, hdesc, rfl⟩
α : Type u
lt : α → α → Bool
x✝ : Subarray α
i✝ : Nat
y : Subarray α
k : Nat
x : Subarray α
i : Nat
hi : i < Subarray.size x
hl : 2 * i + 1 < Subarray.size x
hr : 2 * i + 2 ≥ Subarray.size x
hx : lt x[i] x[2 * i + 1] = true
hk : k < Subarray.size x
hdesc : Descendant i k
⊢ ∃ l hl_1, Descendant i l ∧ (Subarray.swap x { val := i, isLt := hi } { val := 2 * i + 1, isLt := hl })[k] = x[l]
no goals