Fixpoint prev_append (i j: positive) {struct i} : positive :=
    match i with
      | xH => j
      | xI i' => prev_append i' (xI j)
      | xO i' => prev_append i' (xO j)
    end.Definition prev (i: positive) : positive :=
    prev_append i xH.

Lemma prev_append_prev i j: prev (prev_append i j) = prev_append j i.