Section inner.
Variable client : clientId.
Variable id : nat.
Fixpoint client_id_in l :=
match l with
| [] => false
| e :: l' =>
if (andb (if clientId_eq_dec (eClient e) client then true else false)
(eId e =? id)) then
true
else
client_id_in l'
end.
Proof using.
intros. unfold in_applied_entries.
induction (applied_entries (nwState net)); simpl in *; try congruence.
break_if; break_if; do_bool; intuition; try congruence; do_bool; eauto;
break_exists_exists; intuition.
Qed.
Proof using.
intros. unfold in_applied_entries.
induction (applied_entries (nwState net)); simpl in *; try congruence; intuition.
- break_exists; intuition.
- break_if; try congruence.
do_bool.
break_exists; break_if; try congruence; intuition; do_bool; subst; eauto.
Qed.

Lemma doGenericServer_applied_entries :
forall ps h sigma os st' ms,
raft_intermediate_reachable (mkNetwork ps sigma) ->
doGenericServer h (sigma h) = (os, st', ms) ->
exists es, applied_entries (update name_eq_dec sigma h st') = (applied_entries sigma) ++ es /\
(forall e, In e es -> exists h, In e (log (sigma h)) /\ eIndex e <= commitIndex (sigma h)).