+  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 insertion_sort_sorted : forall xs, LocallySorted Z.le (insertion_sort xs).