fact: Definition swim1 (L : list A) (j : nat) : (list A) * (option nat) := if j <=? root_idx then (L, None) else match nth_error L j, nth_error L (parent j) with | None, _ | _, None => (L, None) | Some child, Some root => if child <<=? root then (exchange L j (parent j), Some (parent j)) else (L, None) end.
imports: Psatz List Arith.Div2 Even Relations RelationClasses PeanoNat Peano_dec Recdef Sorting Permutation Multiset