Proof using.
unfold client_cache_keys_correct, client_cache_complete.
intros.
unfold getLastId.
enough (exists id, assoc clientId_eq_dec (clientCache_to_ks (clientCache (nwState net h))) (eClient e) = Some id /\
eId e <= id).
- break_exists_exists.
intuition.
find_apply_lem_hyp clientCache_to_ks_assoc.
break_exists_exists. intuition.
- erewrite assoc_a_equiv by eauto.
find_apply_lem_hyp in_rev.
auto using in_l_log_to_ks'_le.
Qed.

Lemma deduplicate_log'_app :
forall l1 l2 ks,
deduplicate_log' (l1 ++ l2) ks =
deduplicate_log' l1 ks ++ (deduplicate_log' l2 (log_to_ks' l1 ks)).