Section inner.
Variable client : clientId.
Variable id : nat.
Proof using.
intros. unfold key_in_output_trace in *.
break_exists_exists.
intuition. do_in_app; intuition.
exfalso. eauto.
Qed.
Proof using.
intros.
unfold key_in_output_list in *.
break_exists; do_in_app; intuition eauto.
Qed.
Proof using.
intuition.
unfold key_in_output_list in *.
break_exists; intuition.
Qed.
Proof using.
intros. unfold doLeader, advanceCommitIndex in *.
repeat break_match; find_inversion; intuition eauto using key_in_output_list_empty.
Qed.
Proof using.
intros. unfold handleInput, handleTimeout, handleClientRequest, tryToBecomeLeader in *.
repeat break_match; find_inversion; intuition eauto using key_in_output_list_empty;
unfold key_in_output_list in *; break_exists; simpl in *; intuition; congruence.
Qed.
Proof using.
induction l; intros.
- simpl in *.
find_inversion; simpl in *; intuition.
- simpl in *. repeat break_let.
repeat break_match; find_inversion; simpl in *; intuition;
try find_inversion; simpl in *; try do_in_app; intuition eauto;
try solve [find_eapply_lem_hyp IHl; eauto;
break_exists_exists; intuition];
try do_in_map; find_inversion; eexists; eauto.
Qed.

Lemma doGenericServer_key_in_output_list :
forall net h os st' ms,
raft_intermediate_reachable net ->
doGenericServer h (nwState net h) = (os, st', ms) ->
key_in_output_list client id os ->
exists e : entry,
eClient e = client /\
eId e = id /\ In e (applied_entries (update name_eq_dec (nwState net) h st')).