+  induction xs.
- constructor.
- simpl in H.
destruct xs.
* constructor.
* constructor. simpl in H. apply IHxs. remember (a <=? z)%Z. destruct b.
simpl. apply H. congruence.
apply Z.leb_le. destruct (a <=? z)%Z; congruence.
+  induction xs.
- auto.
- simpl. destruct xs. auto.
simpl. remember (a <=? z)%Z. destruct b.
inv H. intuition.
inv H. apply Z.leb_le in H4. congruence.
Qed.

Lemma insert_sorted : forall x xs, LocallySorted Z.le xs -> LocallySorted Z.le (insert x xs).