Fixpoint insert {X} (x : X) (xs : list X) (n : nat) :=
match xs with
| [] => [x]
| y :: ys =>
match n with
| O => x :: xs
| S m => y :: insert x ys m
end
end.
Inductive parts_into {X} : list X -> list X -> list X -> Prop :=
| part_nil : parts_into [] [] []
| parts_cons_l {xs zs} {x} i ys :
parts_into xs ys zs ->
parts_into (x :: xs) (insert x ys i) zs
| parts_cons_r {xs ys} {x} i zs :
parts_into xs ys zs ->
parts_into (x :: xs) ys (insert x zs i).
Goal parts_into [1;2;3;4;5] [5;2] [1;4;3].

Axiom HleafNodeConst: forall x p leafIdx lvl dt,
isLeafNode x (writeToNode p leafIdx lvl dt) ->
isLeafNode x p.