Proof using rmri si rri.
unfold msg_refined_raft_net_invariant_do_leader,
lifted_maxIndex_sanity, maxIndex_lastApplied, maxIndex_commitIndex.
intuition; repeat find_higher_order_rewrite; update_destruct_simplify; auto.
- erewrite doLeader_same_log by eauto.
erewrite doLeader_same_lastApplied by eauto.
repeat match goal with
| [ H : forall _ , _ |- _ ] => specialize (H h0)
end.
unfold mgv_refined_base_params, raft_refined_base_params, refined_base_params in *.
simpl in *.
repeat find_rewrite. auto.
- repeat match goal with
| [ H : forall _ , _ |- _ ] => specialize (H h0)
end.
unfold mgv_refined_base_params, raft_refined_base_params, refined_base_params in *.
simpl in *.
repeat find_rewrite. simpl in *.
erewrite doLeader_same_commitIndex; eauto.
find_eapply_lem_hyp (msg_lifted_sorted_host net h0).
unfold mgv_refined_base_params, raft_refined_base_params, refined_base_params in *.
simpl in *.
find_rewrite. auto.
Qed.

(* Specifications: *)
Lemma doGenericServer_lastApplied :
forall h st out st' ms,
doGenericServer h st = (out, st', ms) ->
lastApplied st' = lastApplied st \/
(lastApplied st < commitIndex st  /\
lastApplied st' = commitIndex st).