Definition type_term_log_monotonic st st' :=
    type st' = Leader ->
    type st = Leader /\
    currentTerm st' = currentTerm st /\
    (forall e, In e (log st) -> In e (log st')).Notation appendEntries_leader_predicate ps st :=
    (forall p t lid pli plt es lci e,
      In p ps ->
      pBody p = AppendEntries t lid pli plt es lci ->
      In e es ->
      currentTerm st = t ->
      type st = Leader ->
      In e (log st)).

(* Specifications: *)
Lemma appendEntries_leader_predicate_TTLM_preserved : forall ps st st', appendEntries_leader_predicate ps st -> type_term_log_monotonic st st' -> appendEntries_leader_predicate ps st'.
Lemma handleClientRequest_TTLM : forall h st client id c out st' l, handleClientRequest h st client id c = (out, st', l) -> type_term_log_monotonic st st'.
Lemma appendEntries_leader_client_request : refined_raft_net_invariant_client_request appendEntries_leader.
Lemma handleTimeout_TTLM : forall h st out st' l, handleTimeout h st = (out, st', l) -> type_term_log_monotonic st st'.
Lemma appendEntries_leader_timeout : refined_raft_net_invariant_timeout appendEntries_leader.
Lemma handleAppendEntries_TTLM : forall h st t n pli plt es ci st' ps, handleAppendEntries h st t n pli plt es ci = (st', ps) -> type_term_log_monotonic st st'.
Lemma appendEntries_leader_append_entries : refined_raft_net_invariant_append_entries appendEntries_leader.
Lemma handleAppendEntriesReply_TTLM : forall h st h' t es r st' ms, handleAppendEntriesReply h st h' t es r = (st', ms) -> type_term_log_monotonic st st'.
Lemma appendEntries_leader_append_entries_reply : refined_raft_net_invariant_append_entries_reply appendEntries_leader.
Lemma handleRequestVote_TTLM : forall st h h' t lli llt st' m, handleRequestVote h st t h' lli llt = (st', m) -> type_term_log_monotonic st st'.
Lemma appendEntries_leader_request_vote : refined_raft_net_invariant_request_vote appendEntries_leader.
Lemma handleRequestVoteReply_spec' : forall h st h' t r st', handleRequestVoteReply h st h' t r = st' -> type st' = Follower \/ st' = st \/ type st' = Candidate \/ (type st' = Leader /\ type st = Candidate /\ log st' = log st /\ r = true /\ t = currentTerm st /\ wonElection (dedup name_eq_dec (h' :: votesReceived st)) = true /\ currentTerm st' = currentTerm st).
Lemma update_elections_data_RVR_ascending_leaderLog : forall h src t1 v st, type (snd st) = Candidate -> type (handleRequestVoteReply h (snd st) src t1 v) = Leader -> exists ll, In (currentTerm (snd st), ll) (leaderLogs (update_elections_data_requestVoteReply h src t1 v st)).
Lemma appendEntries_leader_request_vote_reply : refined_raft_net_invariant_request_vote_reply' appendEntries_leader.
Lemma doLeader_TTLM : forall st h os st' ms, doLeader st h = (os, st', ms) -> type_term_log_monotonic st st'.
Lemma doLeader_message_entries : forall st h os st' ms m t n pli plt es ci e, doLeader st h = (os, st', ms) -> In m ms -> snd m = AppendEntries t n pli plt es ci -> In e es -> currentTerm st = t /\ type st = Leader /\ In e (log st).
Lemma lifted_one_leader_per_term : forall net h h', refined_raft_intermediate_reachable net -> currentTerm (snd (nwState net h)) = currentTerm (snd (nwState net h')) -> type (snd (nwState net h)) = Leader -> type (snd (nwState net h')) = Leader -> h = h'.
Lemma appendEntries_leader_do_leader : refined_raft_net_invariant_do_leader appendEntries_leader.
Lemma doGenericServer_TTLM : forall h st os st' ps, doGenericServer h st = (os, st', ps) -> type_term_log_monotonic st st'.
Lemma appendEntries_leader_do_generic_server : refined_raft_net_invariant_do_generic_server appendEntries_leader.
Lemma appendEntries_leader_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset appendEntries_leader.
Lemma appendEntries_leader_reboot : refined_raft_net_invariant_reboot appendEntries_leader.
Lemma appendEntries_leader_invariant : forall net, refined_raft_intermediate_reachable net -> appendEntries_leader net.