Section PrevLogLeaderSublogProof.
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}.
Context {vci : votes_correct_interface}.
Context {cci : cronies_correct_interface}.
Context {lsi : leader_sublog_interface}.
Context {plceti : prevLog_candidateEntriesTerm_interface}.
Proof using.
unfold raft_net_invariant_init, prevLog_leader_sublog.
simpl. intuition.
Qed.
Proof using.
intros.
find_apply_lem_hyp handleClientRequest_log.
intuition.
- find_rewrite. auto.
- break_exists. intuition. find_rewrite. intuition.
Qed.
Proof using.
unfold raft_net_invariant_client_request, prevLog_leader_sublog.
intros. simpl in *.
repeat find_higher_order_rewrite.
find_apply_hyp_hyp. break_or_hyp.
- break_if; eauto.
find_copy_apply_lem_hyp handleClientRequest_type. break_and.
repeat find_rewrite.
eapply_prop_hyp In In; eauto.
break_exists_exists. intuition.
eauto using handleClientRequest_log_In.
- find_apply_lem_hyp in_map_iff. break_exists. break_and.
exfalso. eapply handleClientRequest_no_append_entries; eauto.
subst. simpl in *. find_rewrite. eauto 10.
Qed.
Proof using.
unfold raft_net_invariant_timeout, prevLog_leader_sublog.
intros. simpl in *.
repeat find_higher_order_rewrite.
find_apply_hyp_hyp. break_or_hyp.
- break_if; eauto.
find_copy_apply_lem_hyp handleTimeout_type.
intuition; repeat find_rewrite; try discriminate.
eapply_prop_hyp In In; eauto.
break_exists_exists. intuition.
erewrite handleTimeout_log_same by eauto.
eauto.
- find_apply_lem_hyp in_map_iff. break_exists. break_and.
exfalso. subst. simpl in *.
eapply handleTimeout_packets; eauto.
find_rewrite. eauto 10.
Qed.

Lemma handleAppendEntries_type_log :
forall h st t n pli plt es ci st' ps,
handleAppendEntries h st t n pli plt es ci = (st', ps) ->
type st' = Follower \/ (type st' = type st /\ log st' = log st /\ currentTerm st' = currentTerm st).