Definition size := length (A:=Term A n).Definition sizel m := match m with
                      | (l1, l2) => size l1 + size l2
                      end.Definition lessP m1 m2 := sizel m1 < sizel m2.

Lemma pX_invr : forall p q (a b : Term A n), pX a p = pX b q -> p = q.