Proof using lmi.
intros.
find_apply_lem_hyp log_matching_invariant.
unfold log_matching, log_matching_nw in *.
intuition. destruct (pBody p) eqn:?; simpl in *; try congruence.
find_inversion.
find_apply_hyp_hyp. intuition.
Qed.

Lemma sorted_app :
forall l l',
sorted (l ++ l') ->
sorted l.