Section CroniesTermProof.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Context {rri : raft_refinement_interface}.
Proof using.
intros. unfold handleClientRequest in *.
break_match; find_inversion; intuition.
Qed.
Proof using.
unfold refined_raft_net_invariant_client_request, cronies_term,
update_elections_data_client_request in *.
intros. subst. simpl in *. repeat find_higher_order_rewrite.
update_destruct; subst; rewrite_update; eauto.
simpl in *. find_apply_lem_hyp handleClientRequest_spec.
repeat find_rewrite.
repeat break_match; simpl in *; eauto.
Qed.
(*   H : handleTimeout h' (snd (nwState net h')) = (out, d, l) In h0 (cronies (update_elections_data_timeout h' (nwState net h')) t) *)
Proof using.
intros.
unfold handleTimeout, tryToBecomeLeader, update_elections_data_timeout in *.
repeat (break_match; repeat find_inversion; simpl in *; auto);
intuition;
unfold handleTimeout, tryToBecomeLeader in *;
repeat (break_match; repeat find_inversion; simpl in *; auto); congruence.
Qed.
Proof using.
unfold refined_raft_net_invariant_timeout, cronies_term.
intros. subst. simpl in *. repeat find_higher_order_rewrite.
update_destruct; subst; rewrite_update; eauto.
simpl in *.
find_eapply_lem_hyp handleTimeout_spec; eauto. intuition.
eapply le_trans; [|eauto]; eauto.
Qed.

Lemma doLeader_spec :
forall st h os st' ms,
doLeader st h = (os, st', ms) ->
currentTerm st' = currentTerm st.