Proof using.
induction l; intros; simpl in *; eauto using a_equiv_refl.
repeat break_if; simpl in *; eauto.
- do_bool.
destruct (clientId_eq_dec (eClient a) c); subst.
+ repeat rewrite assoc_set_assoc_set_same.
find_rewrite_lem assoc_default_assoc_set.
assert (i = eId a) by (eapply le_antisym; auto;
eapply le_trans; [|eauto];
eauto using log_to_ks'_assoc_default_ks).
subst. find_apply_hyp_hyp.
find_rewrite_lem assoc_set_assoc_set_same.
auto.
+ eapply a_equiv_sym.
eapply a_equiv_trans;
[eapply log_to_ks'_a_equiv;
eapply assoc_set_assoc_set_diff; auto|].
eapply a_equiv_sym. eauto.
- do_bool.
destruct (clientId_eq_dec (eClient a) c); subst.
+ find_rewrite_lem assoc_default_assoc_set.
find_apply_hyp_hyp.
find_rewrite_lem assoc_set_assoc_set_same.
auto.
+ rewrite assoc_default_assoc_set_diff in *; auto.
omega.
- do_bool.
destruct (clientId_eq_dec (eClient a) c); subst.
+ find_rewrite_lem assoc_default_assoc_set.
rewrite assoc_set_assoc_set_same.
assert (i = eId a); subst; eauto.
eapply le_antisym; eauto.
eapply le_trans; [|eauto].
eapply le_trans; [|eapply log_to_ks'_assoc_default_assoc_default_le].
omega.
+ rewrite assoc_default_assoc_set_diff in *; auto. omega.
Qed.

(* Specifications: *)
Lemma in_ks_log_to_ks'_le :
forall e l ks id,
assoc clientId_eq_dec ks (eClient e) = Some id ->
exists id', assoc clientId_eq_dec (log_to_ks' l ks) (eClient e) = Some id' /\
id <= id'.