(* Specifications: *)
Lemma candidate_term_gt_log_init : raft_net_invariant_init candidate_term_gt_log.
Lemma candidate_term_gt_log_client_request : raft_net_invariant_client_request candidate_term_gt_log.
Lemma candidate_term_gt_log_timeout : raft_net_invariant_timeout candidate_term_gt_log.
Lemma candidate_term_gt_log_append_entries : raft_net_invariant_append_entries candidate_term_gt_log.
Lemma msg_refined_raft_invariant_handle_message P : forall xs p ys net st' ps' gd d l, msg_refined_raft_net_invariant_append_entries P -> msg_refined_raft_net_invariant_append_entries_reply P -> msg_refined_raft_net_invariant_request_vote P -> msg_refined_raft_net_invariant_request_vote_reply P -> handleMessage (pSrc p) (pDst p) (snd (pBody p)) (snd (nwState net (pDst p))) = (d, l) -> update_elections_data_net (pDst p) (pSrc p) (snd (pBody p)) (nwState net (pDst p)) = gd -> P net -> msg_refined_raft_intermediate_reachable net -> nwPackets net = xs ++ p :: ys -> (forall h, st' h = update name_eq_dec (nwState net) (pDst p) (gd, d) h) -> (forall p', In p' ps' -> In p' (xs ++ ys) \/ In p' (send_packets (pDst p) (@add_ghost_msg _ _ ghost_log_params (pDst p) (gd, d) l))) -> P (mkNetwork ps' st').
Lemma msg_refined_raft_invariant_handle_input P : forall h inp net st' ps' gd out d l, msg_refined_raft_net_invariant_timeout P -> msg_refined_raft_net_invariant_client_request P -> handleInput h inp (snd (nwState net h)) = (out, d, l) -> update_elections_data_input h inp (nwState net h) = gd -> P net -> msg_refined_raft_intermediate_reachable net -> (forall h', st' h' = update name_eq_dec (nwState net) h (gd, d) h') -> (forall p', In p' ps' -> In p' (nwPackets net) \/ In p' (send_packets h (@add_ghost_msg _ _ ghost_log_params h (gd, d) l))) -> P (mkNetwork ps' st').
Theorem msg_refined_raft_net_invariant : forall P net, msg_refined_raft_net_invariant_init P -> msg_refined_raft_net_invariant_client_request P -> msg_refined_raft_net_invariant_timeout P -> msg_refined_raft_net_invariant_append_entries P -> msg_refined_raft_net_invariant_append_entries_reply P -> msg_refined_raft_net_invariant_request_vote P -> msg_refined_raft_net_invariant_request_vote_reply P -> msg_refined_raft_net_invariant_do_leader P -> msg_refined_raft_net_invariant_do_generic_server P -> msg_refined_raft_net_invariant_state_same_packet_subset P -> msg_refined_raft_net_invariant_reboot P -> msg_refined_raft_intermediate_reachable net -> P net.
Lemma msg_refined_raft_invariant_handle_message' P : forall xs p ys net st' ps' gd d l, msg_refined_raft_net_invariant_append_entries' P -> msg_refined_raft_net_invariant_append_entries_reply' P -> msg_refined_raft_net_invariant_request_vote' P -> msg_refined_raft_net_invariant_request_vote_reply' P -> handleMessage (pSrc p) (pDst p) (snd (pBody p)) (snd (nwState net (pDst p))) = (d, l) -> update_elections_data_net (pDst p) (pSrc p) (snd (pBody p)) (nwState net (pDst p)) = gd -> P net -> msg_refined_raft_intermediate_reachable net -> msg_refined_raft_intermediate_reachable (mkNetwork ps' st') -> nwPackets net = xs ++ p :: ys -> (forall h, st' h = update name_eq_dec (nwState net) (pDst p) (gd, d) h) -> (forall p', In p' ps' -> In p' (xs ++ ys) \/ In p' (send_packets (pDst p) (@add_ghost_msg _ _ ghost_log_params (pDst p) (gd, d) l))) -> P (mkNetwork ps' st').
Lemma msg_refined_raft_invariant_handle_input' P : forall h inp net st' ps' gd out d l, msg_refined_raft_net_invariant_timeout' P -> msg_refined_raft_net_invariant_client_request' P -> handleInput h inp (snd (nwState net h)) = (out, d, l) -> update_elections_data_input h inp (nwState net h) = gd -> P net -> msg_refined_raft_intermediate_reachable net -> msg_refined_raft_intermediate_reachable (mkNetwork ps' st') -> (forall h', st' h' = update name_eq_dec (nwState net) h (gd, d) h') -> (forall p', In p' ps' -> In p' (nwPackets net) \/ In p' (send_packets h (@add_ghost_msg _ _ ghost_log_params h (gd, d) l))) -> P (mkNetwork ps' st').
Theorem msg_refined_raft_net_invariant' : forall P net, msg_refined_raft_net_invariant_init P -> msg_refined_raft_net_invariant_client_request' P -> msg_refined_raft_net_invariant_timeout' P -> msg_refined_raft_net_invariant_append_entries' P -> msg_refined_raft_net_invariant_append_entries_reply' P -> msg_refined_raft_net_invariant_request_vote' P -> msg_refined_raft_net_invariant_request_vote_reply' P -> msg_refined_raft_net_invariant_do_leader' P -> msg_refined_raft_net_invariant_do_generic_server' P -> msg_refined_raft_net_invariant_state_same_packet_subset' P -> msg_refined_raft_net_invariant_reboot' P -> msg_refined_raft_intermediate_reachable net -> P net.
Theorem lift_sorted : forall net, refined_raft_intermediate_reachable net -> logs_sorted (deghost net).
Theorem lift_logs_sorted : forall net h, refined_raft_intermediate_reachable net -> sorted (log (snd (nwState net h))).
Theorem lift_log_matching : forall net, refined_raft_intermediate_reachable net -> log_matching (deghost net).
Lemma update_elections_data_client_request_leaderLogs : forall h st client id c, leaderLogs (update_elections_data_client_request h st client id c) = leaderLogs (fst st).
Lemma update_elections_data_timeout_leaderLogs : forall h st, leaderLogs (update_elections_data_timeout h st) = leaderLogs (fst st).
Lemma update_elections_data_appendEntries_leaderLogs : forall h st t h' pli plt es ci, leaderLogs (update_elections_data_appendEntries h st t h' pli plt es ci) = leaderLogs (fst st).
Lemma update_elections_data_requestVote_leaderLogs : forall h h' t lli llt st, leaderLogs (update_elections_data_requestVote h h' t h' lli llt st) = leaderLogs (fst st).
Lemma update_elections_data_requestVoteReply_leaderLogs : forall h h' t st t' ll' r, In (t', ll') (leaderLogs (fst st)) -> In (t', ll') (leaderLogs (update_elections_data_requestVoteReply h h' t r st)).
Lemma allEntries_leaderLogs_term_append_entries : refined_raft_net_invariant_append_entries allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_init : refined_raft_net_invariant_init allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_client_request : refined_raft_net_invariant_client_request allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_timeout : refined_raft_net_invariant_timeout allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_append_entries_reply : refined_raft_net_invariant_append_entries_reply allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_request_vote : refined_raft_net_invariant_request_vote allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_request_vote_reply : refined_raft_net_invariant_request_vote_reply allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_do_leader : refined_raft_net_invariant_do_leader allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_do_generic_server : refined_raft_net_invariant_do_generic_server allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_reboot : refined_raft_net_invariant_reboot allEntries_leaderLogs_term.
Lemma allEntries_leaderLogs_term_invariant : forall net, refined_raft_intermediate_reachable net -> allEntries_leaderLogs_term net.
Lemma handleAppendEntries_currentTerm_monotonic: forall h st (d : raft_data) (m : msg) (t : term) (n : name) (pli : logIndex) (plt : term) (es : list entry) (ci : logIndex), handleAppendEntries h st t n pli plt es ci = (d, m) -> currentTerm st <= currentTerm d.
Lemma allEntries_term_sanity_append_entries : refined_raft_net_invariant_append_entries allEntries_term_sanity.
Lemma allEntries_term_sanity_append_entries_reply : refined_raft_net_invariant_append_entries_reply allEntries_term_sanity.
Lemma allEntries_term_sanity_request_vote : refined_raft_net_invariant_request_vote allEntries_term_sanity.
Lemma allEntries_term_sanity_request_vote_reply : refined_raft_net_invariant_request_vote_reply allEntries_term_sanity.
Lemma allEntries_term_sanity_client_request : refined_raft_net_invariant_client_request allEntries_term_sanity.
Lemma allEntries_term_sanity_timeout : refined_raft_net_invariant_timeout allEntries_term_sanity.
Lemma allEntries_term_sanity_do_leader : refined_raft_net_invariant_do_leader allEntries_term_sanity.
Lemma allEntries_term_sanity_do_generic_server : refined_raft_net_invariant_do_generic_server allEntries_term_sanity.
Lemma allEntries_term_sanity_reboot : refined_raft_net_invariant_reboot allEntries_term_sanity.
Lemma allEntries_term_sanity_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset allEntries_term_sanity.
Lemma allEntries_term_sanity_init : refined_raft_net_invariant_init allEntries_term_sanity.
Theorem logs_sorted_init : raft_net_invariant_init logs_sorted.
Theorem logs_sorted_nw_packets_unchanged : forall net ps' st', logs_sorted_nw net -> (forall p, In p ps' -> In p (nwPackets net) \/ False) -> logs_sorted_nw (mkNetwork ps' st').
Theorem packets_gt_prevIndex_packets_unchanged : forall net ps' st', packets_gt_prevIndex net -> (forall p, In p ps' -> In p (nwPackets net) \/ False) -> packets_gt_prevIndex (mkNetwork ps' st').
Theorem packets_ge_prevTerm_packets_unchanged : forall net ps' st', packets_ge_prevTerm net -> (forall p, In p ps' -> In p (nwPackets net) \/ False) -> packets_ge_prevTerm (mkNetwork ps' st').
Lemma handleClientRequest_logs_sorted : forall h client id c out st l net, handleClientRequest h (nwState net h) client id c = (out, st, l) -> raft_intermediate_reachable net -> logs_sorted_host net -> sorted (log st).
Theorem logs_sorted_client_request : raft_net_invariant_client_request logs_sorted.
Theorem handleTimeout_log : forall h st out st' ps, handleTimeout h st = (out, st', ps) -> log st' = log st.
Theorem logs_sorted_nw_only_new_packets_matter : forall net ps' l st', logs_sorted_nw net -> (forall p, In p ps' -> In p (nwPackets net) \/ In p l) -> logs_sorted_nw (mkNetwork l st') -> logs_sorted_nw (mkNetwork ps' st').
Theorem logs_sorted_nw_no_append_entries : forall net ps' l st', logs_sorted_nw net -> (forall p, In p ps' -> In p (nwPackets net) \/ In p l) -> (forall p, In p l -> ~ is_append_entries (pBody p)) -> logs_sorted_nw (mkNetwork ps' st').
Theorem logs_sorted_nw_not_append_entries : forall net ps' p' st', logs_sorted_nw net -> (forall p, In p ps' -> In p (nwPackets net) \/ p = p') -> ~ is_append_entries (pBody p') -> logs_sorted_nw (mkNetwork ps' st').
Theorem packets_gt_prevIndex_only_new_packets_matter : forall net ps' l st', packets_gt_prevIndex net -> (forall p, In p ps' -> In p (nwPackets net) \/ In p l) -> packets_gt_prevIndex (mkNetwork l st') -> packets_gt_prevIndex (mkNetwork ps' st').
Theorem packets_gt_prevIndex_no_append_entries : forall net ps' l st', packets_gt_prevIndex net -> (forall p, In p ps' -> In p (nwPackets net) \/ In p l) -> (forall p, In p l -> ~ is_append_entries (pBody p)) -> packets_gt_prevIndex (mkNetwork ps' st').
Theorem packets_gt_prevIndex_not_append_entries : forall net ps' p' st', packets_gt_prevIndex net -> (forall p, In p ps' -> In p (nwPackets net) \/ p = p') -> ~ is_append_entries (pBody p') -> packets_gt_prevIndex (mkNetwork ps' st').
Theorem packets_ge_prevTerm_only_new_packets_matter : forall net ps' l st', packets_ge_prevTerm net -> (forall p, In p ps' -> In p (nwPackets net) \/ In p l) -> packets_ge_prevTerm (mkNetwork l st') -> packets_ge_prevTerm (mkNetwork ps' st').
Theorem packets_ge_prevTerm_no_append_entries : forall net ps' l st', packets_ge_prevTerm net -> (forall p, In p ps' -> In p (nwPackets net) \/ In p l) -> (forall p, In p l -> ~ is_append_entries (pBody p)) -> packets_ge_prevTerm (mkNetwork ps' st').
Theorem packets_ge_prevTerm_not_append_entries : forall net ps' p' st', packets_ge_prevTerm net -> (forall p, In p ps' -> In p (nwPackets net) \/ p = p') -> ~ is_append_entries (pBody p') -> packets_ge_prevTerm (mkNetwork ps' st').
Theorem handleTimeout_not_is_append_entries : forall h st st' ps p, handleTimeout h st = (st', ps) -> In p (send_packets h ps) -> ~ is_append_entries (pBody p).
Theorem logs_sorted_timeout : raft_net_invariant_timeout logs_sorted.
Theorem transitive_commit_invariant : forall net, refined_raft_intermediate_reachable net -> transitive_commit net.
Theorem raft_linearizable : forall failed net tr, input_correct tr -> step_failure_star (params := failure_params) step_failure_init (failed, net) tr -> exists l tr1 st, equivalent _ (import tr) l /\ exported (get_input tr) (get_output tr) l tr1 /\ step_1_star init st tr1.
Theorem in_output_trace_dec : forall tr : list (name * (raft_input + list raft_output)), {in_output_trace client id out tr} + {~ in_output_trace client id out tr}.
Lemma in_output_changed : forall tr o, ~ in_output_trace client id out tr -> in_output_trace client id out (tr ++ o) -> in_output_trace client id out o.
Lemma in_output_list_split : forall l l', in_output_list client id out (l ++ l') -> in_output_list client id out l \/ in_output_list client id out l'.
Lemma doLeader_key_in_output_list : forall st h os st' m, doLeader st h = (os, st', m) -> ~ in_output_list client id out os.
Lemma handleInput_key_in_output_list : forall st h i os st' m, handleInput h i st = (os, st', m) -> ~ in_output_list client id out os.
Lemma deduplicate_log'_app : forall l l' ks, exists l'', deduplicate_log' (l ++ l') ks = deduplicate_log' l ks ++ l''.
Lemma deduplicate_log_app : forall l l', exists l'', deduplicate_log (l ++ l') = deduplicate_log l ++ l''.
Lemma in_output_list_app_or : forall c i o l1 l2, in_output_list c i o (l1 ++ l2) -> in_output_list c i o l1 \/ in_output_list c i o l2.
Lemma in_output_trace_inp_inv : forall h i tr, in_output_trace client id out ((h, inl i) :: tr) -> in_output_trace client id out tr.
Lemma handleInput_in_output_list : forall h i st os st' ms, handleInput h i st = (os, st', ms) -> ~ in_output_list client id out os.
Lemma in_output_list_cons_or : forall a b c l, in_output_list client id out (ClientResponse a b c :: l) -> (a = client /\ b = id /\ c = out) \/ in_output_list client id out l.
Lemma assoc_Some_In : forall K V (K_eq_dec : forall k k' : K, {k = k'} + {k <> k'}) k v l, assoc (V:=V) K_eq_dec l k = Some v -> In (k, v) l.
Lemma getLastId_Some_In : forall st c n o, getLastId st c = Some (n, o) -> In (c, (n, o)) (clientCache st).
Lemma execute_log_app : forall xs ys, execute_log (xs ++ ys) = let (tr, st) := execute_log xs in execute_log' ys st tr.
Lemma assoc_None : forall K V K_eq_dec (l : list (K * V)) k v, assoc K_eq_dec l k = None -> In (k, v) l -> False.
Lemma getLastId_None : forall st c i o, getLastId st c = None -> In (c, (i, o)) (clientCache st) -> False.
Lemma output_correct_monotonic : forall c i o xs ys, output_correct c i o xs -> output_correct c i o (xs ++ ys).
Lemma deduplicate_log_In_if : forall e l, In e (deduplicate_log l) -> In e l.
Lemma applyEntry_clientCache : forall st e l st', applyEntry st e = (l, st') -> let (out, _) := handler (eInput e) (stateMachine st) in (clientCache st' = assoc_set clientId_eq_dec (clientCache st) (eClient e) (eId e, out) /\ In out l).
Lemma cacheApplyEntry_clientCache : forall st e l st', cacheApplyEntry st e = (l, st') -> (clientCache st' = clientCache st /\ (exists i o, getLastId st (eClient e) = Some (i, o) /\ eId e <= i) ) \/ ((let (out, _) := handler (eInput e) (stateMachine st) in (clientCache st' = assoc_set clientId_eq_dec (clientCache st) (eClient e) (eId e, out) /\ In out l)) /\ (getLastId st (eClient e) = None \/ (exists i o, getLastId st (eClient e) = Some (i, o) /\ i < eId e))).
Lemma getLastId_ext : forall st st' c, clientCache st' = clientCache st -> getLastId st' c = getLastId st c.
Lemma cacheAppliedEntry_clientCache_preserved : forall st e l st' c i o, cacheApplyEntry st e = (l, st') -> getLastId st c = Some (i, o) -> exists i' o', getLastId st' c = Some (i', o') /\ i <= i'.
Lemma cacheAppliedEntry_clientCache_nondecreasing : forall st e l st' c i o i' o', cacheApplyEntry st e = (l, st') -> getLastId st c = Some (i, o) -> getLastId st' c = Some (i', o') -> i <= i'.
Lemma applyEntries_output_correct : forall l c i o h st os st' es, applyEntries h st l = (os, st') -> in_output_list c i o os -> (stateMachine st = snd (execute_log (deduplicate_log es))) -> (forall c i o, getLastId st c = Some (i, o) -> output_correct c i o es) -> (forall c i o e', getLastId st c = Some (i, o) -> In e' es -> eClient e' = c -> eId e' <= i) -> (forall e', In e' es -> exists i o, getLastId st (eClient e') = Some (i, o) /\ eId e' <= i) -> output_correct c i o (es ++ l).
Lemma cacheApplyEntry_spec : forall st a l st', cacheApplyEntry st a = (l, st') -> log st' = log st /\ lastApplied st' = lastApplied st /\ commitIndex st' = commitIndex st.
Lemma applyEntries_spec : forall es h st os st', applyEntries h st es = (os, st') -> log st' = log st /\ lastApplied st' = lastApplied st /\ commitIndex st' = commitIndex st.
Lemma output_correct_prefix : forall l1 l2 client id out, Prefix l1 l2 -> output_correct client id out l1 -> output_correct client id out l2.
Lemma entries_contiguous : forall net, raft_intermediate_reachable net -> (forall h, contiguous_range_exact_lo (log (nwState net h)) 0).
Lemma doGenericServer_output_correct : forall h ps sigma os st' ms, raft_intermediate_reachable (mkNetwork ps sigma) -> doGenericServer h (sigma h) = (os, st', ms) -> in_output_list client id out os -> output_correct client id out (applied_entries (update name_eq_dec sigma h st')).
Lemma candidates_vote_for_selves_l_invariant : forall (net : network), refined_raft_intermediate_reachable net -> candidates_vote_for_selves (deghost net).
Lemma handleClientRequest_rvr : forall h net ps client id c out d l p t v, handleClientRequest h (snd (nwState net h)) client id c = (out, d, l) -> (forall p' : packet, In p' ps -> In p' (nwPackets net) \/ In p' (send_packets h l)) -> pBody p = RequestVoteReply t v -> In p ps -> In p (nwPackets net).
Lemma handleTimeout_rvr : forall h net ps out d l p t v, handleTimeout h (snd (nwState net h)) = (out, d, l) -> (forall p' : packet, In p' ps -> In p' (nwPackets net) \/ In p' (send_packets h l)) -> pBody p = RequestVoteReply t v -> In p ps -> In p (nwPackets net).
Lemma handleAppendEntries_rvr : forall h h' s ps ps' p d r tae li pli plt es lc t v, handleAppendEntries h s tae li pli plt es lc = (d, r) -> (forall p' : packet, In p' ps -> In p' ps' \/ p' = {| pSrc := h; pDst := h'; pBody := r |}) -> pBody p = RequestVoteReply t v -> In p ps -> In p ps'.
Lemma handleAppendEntriesReply_rvr : forall h s src ps ps' p d l tae es res t v, handleAppendEntriesReply h s src tae es res = (d, l) -> (forall p' : packet, In p' ps -> In p' ps' \/ In p' (send_packets h l)) -> pBody p = RequestVoteReply t v -> In p ps -> In p ps'.
Lemma cronies_correct_client_request : refined_raft_net_invariant_client_request cronies_correct.
Lemma cronies_correct_timeout : refined_raft_net_invariant_timeout cronies_correct.
Lemma cronies_correct_append_entries : refined_raft_net_invariant_append_entries cronies_correct.
Lemma cronies_correct_append_entries_reply : refined_raft_net_invariant_append_entries_reply cronies_correct.
Lemma handleRequestVote_true_votedFor : forall h st t src lli llt d t', handleRequestVote h st t src lli llt = (d, RequestVoteReply t' true) -> currentTerm d = t' /\ votedFor d = Some src.
Lemma update_elections_data_requestVote_cronies : forall h h' t h'' lli llt st, cronies (update_elections_data_requestVote h h' t h'' lli llt st) = cronies (fst st).
Lemma handleRequestVote_votesReceived : forall h st t h' lli llt st' m, handleRequestVote h st t h' lli llt = (st', m) -> votesReceived st' = votesReceived st.
Lemma handleRequestVote_currentTerm_same_or_follower : forall h st t h' lli llt st' m, handleRequestVote h st t h' lli llt = (st', m) -> (currentTerm st' = currentTerm st /\ type st' = type st) \/ type st' = Follower.
Lemma update_elections_data_requestVote_votes_preserved : forall t c h h' t' h'' lli llt st, In (t, c) (votes (fst st)) -> In (t, c) (votes (update_elections_data_requestVote h h' t' h'' lli llt st)).
Lemma update_elections_data_requestVote_votedFor : forall h h' t lli llt st st' m, handleRequestVote h (snd st) t h' lli llt = (st', m) -> votedFor st' = Some h' -> In (currentTerm st', h') (votes (update_elections_data_requestVote h h' t h' lli llt st)) \/ (votedFor st' = votedFor (snd st) /\ currentTerm st' = currentTerm (snd st)).
Lemma cronies_correct_request_vote : refined_raft_net_invariant_request_vote cronies_correct.
Lemma handleRequestVoteReply_candidate : forall h st src t v st', handleRequestVoteReply h st src t v = st' -> type st' = Candidate -> type st = Candidate /\ currentTerm st' = currentTerm st.
Lemma handleRequestVoteReply_votesReceived : forall h st src t v st' crony, handleRequestVoteReply h st src t v = st' -> In crony (votesReceived st') -> ((crony = src /\ v = true /\ currentTerm st' = t) \/ In crony (votesReceived st)).
Lemma handleRequestVoteReply_leader : forall h st src t v st', handleRequestVoteReply h st src t v = st' -> type st' = Leader -> (st' = st \/ (type st = Candidate /\ wonElection (dedup name_eq_dec (votesReceived st')) = true /\ currentTerm st' = currentTerm st)).
Lemma cronies_correct_request_vote_reply : refined_raft_net_invariant_request_vote_reply cronies_correct.
Lemma doLeader_st : forall st h os st' ms, doLeader st h = (os, st', ms) -> votesReceived st' = votesReceived st /\ currentTerm st' = currentTerm st /\ type st' = type st.
Lemma do_leader_rvr : forall st h os st' ms p t ps ps', doLeader st h = (os, st', ms) -> (forall p : packet, In p ps' -> In p ps \/ In p (send_packets h ms)) -> pBody p = RequestVoteReply t true -> In p ps' -> In p ps.
Lemma cronies_correct_do_leader : refined_raft_net_invariant_do_leader cronies_correct.
Lemma do_generic_server_pkts : forall h st os st' ms ps ps' p t v, doGenericServer h st = (os, st', ms) -> (forall p, In p ps' -> In p ps \/ In p (send_packets h ms)) -> pBody p = RequestVoteReply t v -> In p ps' -> In p ps.
Lemma cronies_correct_do_generic_server : refined_raft_net_invariant_do_generic_server cronies_correct.
Lemma cronies_correct_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset cronies_correct.
Lemma cronies_correct_reboot : refined_raft_net_invariant_reboot cronies_correct.
Lemma cronies_correct_init : refined_raft_net_invariant_init cronies_correct.
Theorem cronies_correct_invariant : forall (net : network), refined_raft_intermediate_reachable net -> cronies_correct net.
Lemma terms_and_indices_from_one_vwl_init : refined_raft_net_invariant_init terms_and_indices_from_one_vwl.
Lemma lifted_terms_and_indices_from_one_log : forall net h, refined_raft_intermediate_reachable net -> terms_and_indices_from_one (log (snd (nwState net h))).
Lemma terms_and_indices_from_one_vwl_client_request : refined_raft_net_invariant_client_request terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_timeout : refined_raft_net_invariant_timeout terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_append_entries : refined_raft_net_invariant_append_entries terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_append_entries_reply : refined_raft_net_invariant_append_entries_reply terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_request_vote : refined_raft_net_invariant_request_vote terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_request_vote_reply : refined_raft_net_invariant_request_vote_reply terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_do_leader : refined_raft_net_invariant_do_leader terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_do_generic_server : refined_raft_net_invariant_do_generic_server terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_reboot : refined_raft_net_invariant_reboot terms_and_indices_from_one_vwl.
Lemma terms_and_indices_from_one_vwl_invariant : forall net, refined_raft_intermediate_reachable net -> terms_and_indices_from_one_vwl net.
Lemma terms_and_indices_from_one_ll_init : refined_raft_net_invariant_init terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_client_request : refined_raft_net_invariant_client_request terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_timeout : refined_raft_net_invariant_timeout terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_append_entries : refined_raft_net_invariant_append_entries terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_append_entries_reply : refined_raft_net_invariant_append_entries_reply terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_request_vote : refined_raft_net_invariant_request_vote terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_request_vote_reply : refined_raft_net_invariant_request_vote_reply terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_do_leader : refined_raft_net_invariant_do_leader terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_do_generic_server : refined_raft_net_invariant_do_generic_server terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_reboot : refined_raft_net_invariant_reboot terms_and_indices_from_one_ll.
Lemma terms_and_indices_from_one_ll_invariant : forall net, refined_raft_intermediate_reachable net -> terms_and_indices_from_one_ll net.
Lemma requestVoteReply_term_sanity_append_entries : refined_raft_net_invariant_append_entries requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_append_entries_reply : refined_raft_net_invariant_append_entries_reply requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_request_vote : refined_raft_net_invariant_request_vote requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_request_vote_reply : refined_raft_net_invariant_request_vote_reply requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_timeout : refined_raft_net_invariant_timeout requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_client_request : refined_raft_net_invariant_client_request requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_do_leader : refined_raft_net_invariant_do_leader requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_do_generic_server : refined_raft_net_invariant_do_generic_server requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_reboot : refined_raft_net_invariant_reboot requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset requestVoteReply_term_sanity.
Lemma requestVoteReply_term_sanity_init : refined_raft_net_invariant_init requestVoteReply_term_sanity.
Lemma update_elections_data_client_request_leaderLogs : forall h st client id c, leaderLogs (update_elections_data_client_request h st client id c) = leaderLogs (fst st).
Lemma update_elections_data_timeout_leaderLogs : forall h st, leaderLogs (update_elections_data_timeout h st) = leaderLogs (fst st).
Lemma update_elections_data_appendEntries_leaderLogs : forall h st t h' pli plt es ci, leaderLogs (update_elections_data_appendEntries h st t h' pli plt es ci) = leaderLogs (fst st).
Lemma update_elections_data_requestVote_leaderLogs : forall h h' t lli llt st, leaderLogs (update_elections_data_requestVote h h' t h' lli llt st) = leaderLogs (fst st).
Lemma update_elections_data_requestVoteReply_leaderLogs : forall h h' t st t' ll' r, In (t', ll') (leaderLogs (fst st)) -> In (t', ll') (leaderLogs (update_elections_data_requestVoteReply h h' t r st)).
Lemma update_elections_data_requestVoteReply_leaderLogs' : forall h h' t st t' ll' r, In (t', ll') (leaderLogs (update_elections_data_requestVoteReply h h' t r st)) -> In (t', ll') (leaderLogs (fst st)) \/ (r = true /\ t = currentTerm (snd st) /\ ll' = log (snd st) /\ t' = currentTerm (snd st) /\ type (snd st) = Candidate /\ wonElection (dedup name_eq_dec (h' :: votesReceived (snd st))) = true).
Lemma leaderLogs_preserved_request_vote_reply : refined_raft_net_invariant_request_vote_reply leaderLogs_preserved.
Lemma leaderLogs_preserved_append_entries : refined_raft_net_invariant_append_entries leaderLogs_preserved.
Lemma leaderLogs_preserved_append_entries_reply : refined_raft_net_invariant_append_entries_reply leaderLogs_preserved.
Lemma leaderLogs_preserved_request_vote : refined_raft_net_invariant_request_vote leaderLogs_preserved.
Lemma leaderLogs_preserved_client_request : refined_raft_net_invariant_client_request leaderLogs_preserved.
Lemma leaderLogs_preserved_timeout : refined_raft_net_invariant_timeout leaderLogs_preserved.
Lemma leaderLogs_preserved_init : refined_raft_net_invariant_init leaderLogs_preserved.
Lemma leaderLogs_preserved_reboot : refined_raft_net_invariant_reboot leaderLogs_preserved.
Lemma leaderLogs_preserved_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset leaderLogs_preserved.
Lemma leaderLogs_preserved_do_generic_server : refined_raft_net_invariant_do_generic_server leaderLogs_preserved.
Lemma leaderLogs_preserved_do_leader : refined_raft_net_invariant_do_leader leaderLogs_preserved.
Theorem leaderLogs_preserved_invariant : forall net, refined_raft_intermediate_reachable net -> leaderLogs_preserved net.
Lemma lastApplied_le_commitIndex_appendEntries : raft_net_invariant_append_entries lastApplied_le_commitIndex.
Lemma lastApplied_le_commitIndex_appendEntriesReply : raft_net_invariant_append_entries_reply lastApplied_le_commitIndex.
Lemma lastApplied_le_commitIndex_requestVote : raft_net_invariant_request_vote lastApplied_le_commitIndex.
Lemma lastApplied_le_commitIndex_requestVoteReply : raft_net_invariant_request_vote_reply lastApplied_le_commitIndex.
Lemma doLeader_same_lastApplied: forall st (os : list raft_output) (d' : raft_data) (ms : list (name * msg)) (h0 : name), doLeader st h0 = (os, d', ms) -> lastApplied d' = lastApplied st.
Lemma fold_left_max : forall l y z, (forall x, In x l -> y <= x) -> y <= z -> y <= fold_left max l z.
Lemma advanceCommitIndex_commitIndex : forall st h, commitIndex st <= commitIndex (advanceCommitIndex st h).
Lemma doLeader_same_commitIndex : forall st (os : list raft_output) (d' : raft_data) (ms : list (name * msg)) (h0 : name), doLeader st h0 = (os, d', ms) -> commitIndex st <= commitIndex d'.
Lemma lastApplied_le_commitIndex_doLeader : raft_net_invariant_do_leader lastApplied_le_commitIndex.
Lemma doGenericServer_lastApplied: forall (h : name) (st : raft_data) (out : list raft_output) (st' : raft_data) (ms : list (name * msg)), doGenericServer h st = (out, st', ms) -> lastApplied st' <= max (lastApplied st) (commitIndex st).
Lemma lastApplied_le_commitIndex_doGenericServer : raft_net_invariant_do_generic_server lastApplied_le_commitIndex.
Lemma lastApplied_le_commitIndex_clientRequest : raft_net_invariant_client_request lastApplied_le_commitIndex.
Lemma lastApplied_le_commitIndex_timeout : raft_net_invariant_timeout lastApplied_le_commitIndex.
Lemma lastApplied_le_commitIndex_reboot : raft_net_invariant_reboot lastApplied_le_commitIndex.
Lemma lastApplied_le_commitIndex_state_same_packet_subset : raft_net_invariant_state_same_packet_subset lastApplied_le_commitIndex.
Lemma lastApplied_le_commitIndex_init : raft_net_invariant_init lastApplied_le_commitIndex.
Theorem lastApplied_le_commitIndex_invariant : forall net, raft_intermediate_reachable net -> lastApplied_le_commitIndex net.
Lemma nextIndex_safety_init : raft_net_invariant_init nextIndex_safety.
Lemma votesReceived_moreUpToDate_append_entries : refined_raft_net_invariant_append_entries votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_append_entries_reply : refined_raft_net_invariant_append_entries_reply votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_request_vote : refined_raft_net_invariant_request_vote votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_request_vote_reply : refined_raft_net_invariant_request_vote_reply votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_timeout : refined_raft_net_invariant_timeout votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_client_request : refined_raft_net_invariant_client_request votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_do_leader : refined_raft_net_invariant_do_leader votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_do_generic_server : refined_raft_net_invariant_do_generic_server votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_reboot : refined_raft_net_invariant_reboot votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset votesReceived_moreUpToDate.
Lemma votesReceived_moreUpToDate_init : refined_raft_net_invariant_init votesReceived_moreUpToDate.
Lemma log_properties_hold_on_ghost_logs_init : msg_refined_raft_net_invariant_init log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_request_vote_reply : msg_refined_raft_net_invariant_request_vote_reply log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_append_entries : msg_refined_raft_net_invariant_append_entries' log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_request_vote : msg_refined_raft_net_invariant_request_vote' log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_append_entries_reply : msg_refined_raft_net_invariant_append_entries_reply' log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_client_request : msg_refined_raft_net_invariant_client_request' log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_timeout : msg_refined_raft_net_invariant_timeout' log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_do_leader : msg_refined_raft_net_invariant_do_leader' log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_do_generic_server : msg_refined_raft_net_invariant_do_generic_server' log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_reboot : msg_refined_raft_net_invariant_reboot log_properties_hold_on_ghost_logs.
Lemma log_properties_hold_on_ghost_logs_state_same_packet_subset : msg_refined_raft_net_invariant_state_same_packet_subset log_properties_hold_on_ghost_logs.
Theorem log_properties_hold_on_ghost_logs_invariant : forall net, msg_refined_raft_intermediate_reachable net -> log_properties_hold_on_ghost_logs net.
Theorem leaderLogs_sublog_init : refined_raft_net_invariant_init leaderLogs_sublog.
Lemma votedFor_term_sanity_append_entries : refined_raft_net_invariant_append_entries votedFor_term_sanity.
Lemma votedFor_term_sanity_append_entries_reply : refined_raft_net_invariant_append_entries_reply votedFor_term_sanity.
Lemma votedFor_term_sanity_request_vote_reply : refined_raft_net_invariant_request_vote_reply votedFor_term_sanity.
Lemma votedFor_term_sanity_request_vote : refined_raft_net_invariant_request_vote votedFor_term_sanity.
Lemma votedFor_term_sanity_timeout : refined_raft_net_invariant_timeout votedFor_term_sanity.
Lemma votedFor_term_sanity_client_request : refined_raft_net_invariant_client_request votedFor_term_sanity.
Lemma votedFor_term_sanity_do_leader : refined_raft_net_invariant_do_leader votedFor_term_sanity.
Lemma votedFor_term_sanity_do_generic_server : refined_raft_net_invariant_do_generic_server votedFor_term_sanity.
Lemma votedFor_term_sanity_reboot : refined_raft_net_invariant_reboot votedFor_term_sanity.
Lemma votedFor_term_sanity_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset votedFor_term_sanity.
Lemma votedFor_term_sanity_init : refined_raft_net_invariant_init votedFor_term_sanity.
Lemma update_elections_data_client_request_leaderLogs : forall h st client id c, leaderLogs (update_elections_data_client_request h st client id c) = leaderLogs (fst st).
Lemma update_elections_data_timeout_leaderLogs : forall h st, leaderLogs (update_elections_data_timeout h st) = leaderLogs (fst st).
Lemma update_elections_data_appendEntries_leaderLogs : forall h st t h' pli plt es ci, leaderLogs (update_elections_data_appendEntries h st t h' pli plt es ci) = leaderLogs (fst st).
Lemma update_elections_data_requestVote_leaderLogs : forall h h' t lli llt st, leaderLogs (update_elections_data_requestVote h h' t h' lli llt st) = leaderLogs (fst st).
Lemma handleRequestVoteReply_spec : forall h st h' t v st', st' = handleRequestVoteReply h st h' t v -> log st' = log st /\ (currentTerm st' = currentTerm st \/ (currentTerm st <= currentTerm st' /\ type st' = Follower)).
Lemma update_elections_data_requestVoteReply_leaderLogs : forall h h' t r st, leaderLogs (update_elections_data_requestVoteReply h h' t r st) = leaderLogs (fst st) \/ leaderLogs (update_elections_data_requestVoteReply h h' t r st) = (currentTerm (snd st), log (snd st)) :: leaderLogs (fst st).
Theorem lift_log_matching : forall net, refined_raft_intermediate_reachable net -> log_matching (deghost net).
Theorem logs_contiguous : forall net h, refined_raft_intermediate_reachable net -> contiguous_range_exact_lo (log (snd (nwState net h))) 0.
Lemma votes_votesWithLog_correspond_cases : forall net h gd d ps' st', votes_votesWithLog_correspond net -> (forall h' : Net.name, st' h' = update name_eq_dec (nwState net) h (gd, d) h') -> (votes gd = votes (fst (nwState net h)) /\ (* unchanged *) votesWithLog gd = votesWithLog (fst (nwState net h))) \/ (exists t n l, (* add entry *) votes gd = (t, n) :: votes (fst (nwState net h)) /\ votesWithLog gd = (t, n, l) :: votesWithLog (fst (nwState net h))) -> votes_votesWithLog_correspond {| nwPackets := ps'; nwState := st' |}.
Lemma ghost_packet : forall (net : network (params := raft_refined_multi_params)) p, In p (nwPackets net) -> In (deghost_packet p) (nwPackets (deghost net)).
Lemma prevLog_leader_sublog_init : raft_net_invariant_init prevLog_leader_sublog.
Lemma handleClientRequest_log_In : forall h st client id c out st' ps e, handleClientRequest h st client id c = (out, st', ps) -> In e (log st) -> In e (log st').
Lemma prevLog_leader_sublog_client_request : raft_net_invariant_client_request prevLog_leader_sublog.
Lemma prevLog_leader_sublog_timeout : raft_net_invariant_timeout prevLog_leader_sublog.
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).
Lemma prevLog_leader_sublog_append_entries : raft_net_invariant_append_entries prevLog_leader_sublog.
Lemma prevLog_leader_sublog_append_entries_reply : raft_net_invariant_append_entries_reply prevLog_leader_sublog.
Lemma prevLog_leader_sublog_request_vote : raft_net_invariant_request_vote prevLog_leader_sublog.
Lemma exists_deghost_packet : forall net p, In p (nwPackets (deghost net)) -> exists (q : packet (params := raft_refined_multi_params)), In q (nwPackets net) /\ p = deghost_packet q.
Lemma state_machine_safety_deghost : forall net, commit_recorded_committed net -> state_machine_safety' net -> state_machine_safety (deghost net).
Lemma refined_raft_invariant_handle_message P : forall xs p ys net st' ps' gd d l, refined_raft_net_invariant_append_entries P -> refined_raft_net_invariant_append_entries_reply P -> refined_raft_net_invariant_request_vote P -> refined_raft_net_invariant_request_vote_reply P -> handleMessage (pSrc p) (pDst p) (pBody p) (snd (nwState net (pDst p))) = (d, l) -> update_elections_data_net (pDst p) (pSrc p) (pBody p) (nwState net (pDst p)) = gd -> P net -> refined_raft_intermediate_reachable net -> nwPackets net = xs ++ p :: ys -> (forall h, st' h = update name_eq_dec (nwState net) (pDst p) (gd, d) h) -> (forall p', In p' ps' -> In p' (xs ++ ys) \/ In p' (send_packets (pDst p) l)) -> P (mkNetwork ps' st').
Lemma refined_raft_invariant_handle_input P : forall h inp net st' ps' gd out d l, refined_raft_net_invariant_timeout P -> refined_raft_net_invariant_client_request P -> handleInput h inp (snd (nwState net h)) = (out, d, l) -> update_elections_data_input h inp (nwState net h) = gd -> P net -> refined_raft_intermediate_reachable net -> (forall h', st' h' = update name_eq_dec (nwState net) h (gd, d) h') -> (forall p', In p' ps' -> In p' (nwPackets net) \/ In p' (send_packets h l)) -> P (mkNetwork ps' st').
Theorem refined_raft_net_invariant : forall P net, refined_raft_net_invariant_init P -> refined_raft_net_invariant_client_request P -> refined_raft_net_invariant_timeout P -> refined_raft_net_invariant_append_entries P -> refined_raft_net_invariant_append_entries_reply P -> refined_raft_net_invariant_request_vote P -> refined_raft_net_invariant_request_vote_reply P -> refined_raft_net_invariant_do_leader P -> refined_raft_net_invariant_do_generic_server P -> refined_raft_net_invariant_state_same_packet_subset P -> refined_raft_net_invariant_reboot P -> refined_raft_intermediate_reachable net -> P net.
Lemma refined_raft_invariant_handle_message' P : forall xs p ys net st' ps' gd d l, refined_raft_net_invariant_append_entries' P -> refined_raft_net_invariant_append_entries_reply' P -> refined_raft_net_invariant_request_vote' P -> refined_raft_net_invariant_request_vote_reply' P -> handleMessage (pSrc p) (pDst p) (pBody p) (snd (nwState net (pDst p))) = (d, l) -> update_elections_data_net (pDst p) (pSrc p) (pBody p) (nwState net (pDst p)) = gd -> P net -> refined_raft_intermediate_reachable net -> refined_raft_intermediate_reachable (mkNetwork ps' st') -> nwPackets net = xs ++ p :: ys -> (forall h, st' h = update name_eq_dec (nwState net) (pDst p) (gd, d) h) -> (forall p', In p' ps' -> In p' (xs ++ ys) \/ In p' (send_packets (pDst p) l)) -> P (mkNetwork ps' st').
Lemma refined_raft_invariant_handle_input' P : forall h inp net st' ps' gd out d l, refined_raft_net_invariant_timeout' P -> refined_raft_net_invariant_client_request' P -> handleInput h inp (snd (nwState net h)) = (out, d, l) -> update_elections_data_input h inp (nwState net h) = gd -> P net -> refined_raft_intermediate_reachable net -> refined_raft_intermediate_reachable (mkNetwork ps' st') -> (forall h', st' h' = update name_eq_dec (nwState net) h (gd, d) h') -> (forall p', In p' ps' -> In p' (nwPackets net) \/ In p' (send_packets h l)) -> P (mkNetwork ps' st').
Theorem refined_raft_net_invariant' : forall P net, refined_raft_net_invariant_init P -> refined_raft_net_invariant_client_request' P -> refined_raft_net_invariant_timeout' P -> refined_raft_net_invariant_append_entries' P -> refined_raft_net_invariant_append_entries_reply' P -> refined_raft_net_invariant_request_vote' P -> refined_raft_net_invariant_request_vote_reply' P -> refined_raft_net_invariant_do_leader' P -> refined_raft_net_invariant_do_generic_server' P -> refined_raft_net_invariant_state_same_packet_subset P -> refined_raft_net_invariant_reboot' P -> refined_raft_intermediate_reachable net -> P net.
Lemma log_properties_hold_on_leader_logs_init : refined_raft_net_invariant_init log_properties_hold_on_leader_logs.
Theorem lift_sorted : forall net, refined_raft_intermediate_reachable net -> logs_sorted (deghost net).
Lemma ghost_packet : forall (net : network (params := raft_refined_multi_params)) p, In p (nwPackets net) -> In (deghost_packet p) (nwPackets (deghost net)).
Lemma logs_sorted_aerts : forall net, logs_sorted (deghost net) -> append_entries_request_term_sanity net.
Lemma candidate_term_gt_log_lifted : forall net, refined_raft_intermediate_reachable net -> candidate_term_gt_log (deghost net).
Lemma prevLog_candidateEntriesTerm_init : refined_raft_net_invariant_init prevLog_candidateEntriesTerm.
Lemma candidateEntriesTerm_ext : forall t sigma sigma', (forall h, sigma' h = sigma h) -> candidateEntriesTerm t sigma -> candidateEntriesTerm t sigma'.
Lemma candidateEntriesTerm_same : forall st st' t, candidateEntriesTerm t st -> (forall h, cronies (fst (st' h)) = cronies (fst (st h))) -> (forall h, currentTerm (snd (st' h)) = currentTerm (snd (st h))) -> (forall h, type (snd (st' h)) = type (snd (st h))) -> candidateEntriesTerm t st'.
Lemma prevLog_candidateEntriesTerm_client_request : refined_raft_net_invariant_client_request prevLog_candidateEntriesTerm.
Lemma update_elections_data_timeout_cronies : forall h d out d' l t, handleTimeout h (snd d) = (out, d', l) -> cronies (update_elections_data_timeout h d) t = cronies (fst d) t \/ (t = currentTerm d' /\ type d' = Candidate /\ cronies (update_elections_data_timeout h d) t = votesReceived d').
Lemma handleClientRequest_preserves_candidateEntriesTerm: forall net h d t out l, refined_raft_intermediate_reachable net -> handleTimeout h (snd (nwState net h)) = (out, d, l) -> candidateEntriesTerm t (nwState net) -> candidateEntriesTerm t (update name_eq_dec (nwState net) h (update_elections_data_timeout h (nwState net h), d)).
Lemma prevLog_candidateEntriesTerm_timeout : refined_raft_net_invariant_timeout prevLog_candidateEntriesTerm.
Lemma handleAppendEntries_preserves_candidateEntriesTerm : forall net h t n pli plt es ci d m t', handleAppendEntries h (snd (nwState net h)) t n pli plt es ci = (d, m) -> refined_raft_intermediate_reachable net -> candidateEntriesTerm t' (nwState net) -> candidateEntriesTerm t' (update name_eq_dec (nwState net) h (update_elections_data_appendEntries h (nwState net h) t n pli plt es ci, d)).
Lemma prevLog_candidateEntriesTerm_append_entries : refined_raft_net_invariant_append_entries prevLog_candidateEntriesTerm.
Lemma handleAppendEntriesReply_preserves_candidateEntriesTerm : forall net h h' t es r st' ms t', handleAppendEntriesReply h (snd (nwState net h)) h' t es r = (st', ms) -> refined_raft_intermediate_reachable net -> candidateEntriesTerm t' (nwState net) -> candidateEntriesTerm t' (update name_eq_dec (nwState net) h (fst (nwState net h), st')).
Lemma prevLog_candidateEntriesTerm_append_entries_reply : refined_raft_net_invariant_append_entries_reply prevLog_candidateEntriesTerm.
Lemma update_elections_data_requestVote_cronies_same : forall h h' t lli llt st, cronies (update_elections_data_requestVote h h' t h' lli llt st) = cronies (fst st).
Lemma advanceCurrentTerm_same_or_type_follower : forall st t, advanceCurrentTerm st t = st \/ type (advanceCurrentTerm st t) = Follower.
Lemma handleRV_advanceCurrentTerm_preserves_candidateEntriesTerm : forall net h h' t lli llt t', candidateEntriesTerm t' (nwState net) -> candidateEntriesTerm t' (update name_eq_dec (nwState net) h (update_elections_data_requestVote h h' t h' lli llt (nwState net h), advanceCurrentTerm (snd (nwState net h)) t)).
Lemma handleRequestVote_preserves_candidateEntriesTerm : forall net h h' t lli llt d t' m, handleRequestVote h (snd (nwState net h)) t h' lli llt = (d, m) -> candidateEntriesTerm t' (nwState net) -> candidateEntriesTerm t' (update name_eq_dec (nwState net) h (update_elections_data_requestVote h h' t h' lli llt (nwState net h), d)).
Lemma prevLog_candidateEntriesTerm_request_vote : refined_raft_net_invariant_request_vote prevLog_candidateEntriesTerm.
Lemma handleRequestVoteReply_preserves_candidateEntriesTerm : forall net h h' t r st' t', handleRequestVoteReply h (snd (nwState net h)) h' t r = st' -> refined_raft_intermediate_reachable net -> candidateEntriesTerm t' (nwState net) -> candidateEntriesTerm t' (update name_eq_dec (nwState net) h (update_elections_data_requestVoteReply h h' t r (nwState net h), st')).
Lemma prevLog_candidateEntriesTerm_request_vote_reply : refined_raft_net_invariant_request_vote_reply prevLog_candidateEntriesTerm.
Lemma doLeader_preserves_candidateEntriesTerm : forall net gd d h os d' ms t', nwState net h = (gd, d) -> doLeader d h = (os, d', ms) -> candidateEntriesTerm t' (nwState net) -> candidateEntriesTerm t' (update name_eq_dec (nwState net) h (gd, d')).
Lemma getNextIndex_ext : forall st st' h, nextIndex st' = nextIndex st -> log st' = log st -> getNextIndex st' h = getNextIndex st h.
Lemma replicaMessage_ext : forall st st' h h', nextIndex st' = nextIndex st -> log st' = log st -> currentTerm st' = currentTerm st -> commitIndex st' = commitIndex st -> replicaMessage st' h h' = replicaMessage st h h'.
Lemma prevLog_candidateEntriesTerm_do_leader : refined_raft_net_invariant_do_leader prevLog_candidateEntriesTerm.
Lemma doGenericServer_preserves_candidateEntriesTerm : forall net gd d h os d' ms t, nwState net h = (gd, d) -> doGenericServer h d = (os, d', ms) -> candidateEntriesTerm t (nwState net) -> candidateEntriesTerm t (update name_eq_dec (nwState net) h (gd, d')).
Lemma prevLog_candidateEntriesTerm_do_generic_server : refined_raft_net_invariant_do_generic_server prevLog_candidateEntriesTerm.
Lemma prevLog_candidateEntriesTerm_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset prevLog_candidateEntriesTerm.
Lemma prevLog_candidateEntriesTerm_reboot : refined_raft_net_invariant_reboot prevLog_candidateEntriesTerm.
Lemma prevLog_candidateEntriesTerm_invariant : forall net, refined_raft_intermediate_reachable net -> prevLog_candidateEntriesTerm net.
Lemma leader_without_missing_entry_invariant : forall net, refined_raft_intermediate_reachable net -> leader_without_missing_entry net.
Lemma appendEntriesRequest_exists_leaderLog_invariant : forall net, refined_raft_intermediate_reachable net -> appendEntriesRequest_exists_leaderLog net.
Lemma appendEntriesRequest_leaderLog_not_in_invariant : forall net, refined_raft_intermediate_reachable net -> appendEntriesRequest_leaderLog_not_in net.
Lemma leaderLogs_leader_invariant : forall net, refined_raft_intermediate_reachable net -> leaderLogs_leader net.
Theorem lastApplied_commitIndex_match_invariant : forall net, raft_intermediate_reachable net -> lastApplied_commitIndex_match net.
Theorem commitIndex_lastApplied_match_invariant : forall net, raft_intermediate_reachable net -> commitIndex_lastApplied_match net.
Theorem lastApplied_lastApplied_match_invariant : forall net, raft_intermediate_reachable net -> lastApplied_lastApplied_match net.
Lemma handleClientRequest_spec : forall h st client id c out st' l, handleClientRequest h st client id c = (out, st', l) -> currentTerm st' = currentTerm st.
Lemma cronies_term_client_request : refined_raft_net_invariant_client_request cronies_term.
Lemma handleTimeout_spec : forall h st out st' l t h', handleTimeout h (snd st) = (out, st', l) -> In h' (cronies (update_elections_data_timeout h st) t) -> (currentTerm (snd st) <= currentTerm st' /\ (In h' (cronies (fst st) t) \/ t = currentTerm st')).
Lemma cronies_term_timeout : refined_raft_net_invariant_timeout cronies_term.
Lemma doLeader_spec : forall st h os st' ms, doLeader st h = (os, st', ms) -> currentTerm st' = currentTerm st.
Lemma cronies_term_do_leader : refined_raft_net_invariant_do_leader cronies_term.
Lemma doGenericServer_spec : forall st h os st' ms, doGenericServer h st = (os, st', ms) -> currentTerm st' = currentTerm st.
Lemma cronies_term_do_generic_server : refined_raft_net_invariant_do_generic_server cronies_term.
Lemma handleAppendEntries_spec : forall h st t n pli plt es ci st' m, handleAppendEntries h st t n pli plt es ci = (st', m) -> currentTerm st <= currentTerm st'.
Lemma update_elections_data_appendEntries_spec : forall h st t n pli plt es ci st' e t', update_elections_data_appendEntries h st t n pli plt es ci = st' -> In e (cronies st' t') -> In e (cronies (fst st) t').
Lemma cronies_term_append_entries : refined_raft_net_invariant_append_entries cronies_term.
Lemma handleAppendEntriesReply_spec : forall h st h' t es r st' ms, handleAppendEntriesReply h st h' t es r = (st', ms) -> currentTerm st <= currentTerm st'.
Lemma cronies_term_append_entries_reply : refined_raft_net_invariant_append_entries_reply cronies_term.
Lemma handleRequestVote_spec : forall h st t h' pli plt st' m, handleRequestVote h st t h' pli plt = (st', m) -> currentTerm st <= currentTerm st'.
Lemma update_elections_data_requestVote_spec : forall h st t h' pli plt st' t' e s, update_elections_data_requestVote h h' t pli plt s st = st' -> In e (cronies st' t') -> In e (cronies (fst st) t').
Lemma cronies_term_request_vote : refined_raft_net_invariant_request_vote cronies_term.
Lemma handleRequestVoteReply_spec : forall h st h' t v st', st' = handleRequestVoteReply h st h' t v -> currentTerm st' = currentTerm st \/ (currentTerm st <= currentTerm st' /\ type st' = Follower).
Lemma cronies_term_request_vote_reply : refined_raft_net_invariant_request_vote_reply cronies_term.
Lemma cronies_term_init : refined_raft_net_invariant_init cronies_term.
Lemma cronies_term_reboot : refined_raft_net_invariant_reboot cronies_term.
Lemma cronies_term_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset cronies_term.
Theorem cronies_term_invariant : forall net, refined_raft_intermediate_reachable net -> cronies_term net.
Lemma candidate_entries_client_request : refined_raft_net_invariant_client_request CandidateEntries.
Lemma update_elections_data_timeout_leader_cronies_same : forall sigma h, type (snd (sigma h)) = Leader -> cronies (update_elections_data_timeout h (sigma h)) = cronies (fst (sigma h)).
Lemma handleTimeout_only_sends_RequestVotes : forall h d out d' l p, handleTimeout h d = (out, d', l) -> In p l -> exists t h' maxi maxt, snd p = RequestVote t h' maxi maxt.
Lemma handleTimeout_not_leader_inc_term : forall h d out d' l, handleTimeout h d = (out, d', l) -> type d <> Leader -> currentTerm d' = S (currentTerm d).
Lemma update_elections_data_timeout_cronies : forall h d out d' l t, handleTimeout h (snd d) = (out, d', l) -> cronies (update_elections_data_timeout h d) t = cronies (fst d) t \/ (t = currentTerm d' /\ cronies (update_elections_data_timeout h d) t = votesReceived d').
Lemma handleTimeout_preserves_candidateEntries : forall net h e out d l, refined_raft_intermediate_reachable net -> handleTimeout h (snd (nwState net h)) = (out, d, l) -> candidateEntries e (nwState net) -> candidateEntries e (update name_eq_dec (nwState net) h (update_elections_data_timeout h (nwState net h), d)).
Lemma candidate_entries_timeout : refined_raft_net_invariant_timeout CandidateEntries.
Lemma update_elections_data_appendEntries_cronies_same : forall h d t n pli plt es ci, cronies (update_elections_data_appendEntries h d t n pli plt es ci) = cronies (fst d).
Lemma handleAppendEntries_spec : forall h st t n pli plt es ci st' m, handleAppendEntries h st t n pli plt es ci = (st', m) -> (currentTerm st <= currentTerm st' /\ (forall e, In e (log st') -> In e (log st) \/ In e es /\ currentTerm st' = t) /\ ~ is_append_entries m).
Lemma handleAppendEntries_term_same_or_type_follower : forall h t n pli plt es ci d m st, handleAppendEntries h st t n pli plt es ci = (d, m) -> (currentTerm d = currentTerm st /\ type d = type st) \/ type d = Follower.
Lemma handleAppendEntries_preserves_candidate_entries : forall net h t n pli plt es ci d m e, handleAppendEntries h (snd (nwState net h)) t n pli plt es ci = (d, m) -> refined_raft_intermediate_reachable net -> candidateEntries e (nwState net) -> candidateEntries e (update name_eq_dec (nwState net) h (update_elections_data_appendEntries h (nwState net h) t n pli plt es ci, d)).
Lemma is_append_entries_intro : forall t n plt pli es ci, is_append_entries (AppendEntries t n pli plt es ci).
Lemma candidate_entries_append_entries : refined_raft_net_invariant_append_entries CandidateEntries.
Lemma handleAppendEntriesReply_spec : forall h st h' t es r st' ms, handleAppendEntriesReply h st h' t es r = (st', ms) -> log st' = log st /\ ((currentTerm st' = currentTerm st /\ type st' = type st) \/ type st' = Follower) /\ (forall m, In m ms -> ~ is_append_entries (snd m)).
Lemma handleAppendEntriesReply_preserves_candidate_entries : forall net h h' t es r st' ms e, handleAppendEntriesReply h (snd (nwState net h)) h' t es r = (st', ms) -> refined_raft_intermediate_reachable net -> candidateEntries e (nwState net) -> candidateEntries e (update name_eq_dec (nwState net) h (fst (nwState net h), st')).
Lemma lifted_leader_sublog_nw : forall net p t n pli plt es ci h e, refined_raft_intermediate_reachable net -> In p (nwPackets net) -> pBody p = AppendEntries t n pli plt es ci -> type (snd (nwState net h)) = Leader -> eTerm e = currentTerm (snd (nwState net h)) -> In e es -> In e (log (snd (nwState net h))).
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 map_snd : forall {A B} (a : A) (b : B) l, In (a, b) l -> In b (map snd l).
Lemma allEntries_leader_sublog_client_request : refined_raft_net_invariant_client_request allEntries_leader_sublog.
Lemma update_elections_data_appendEntries_log_allEntries_leader : forall (h : name) (st : electionsData * raft_data) (t : term) (n : name) (pli : logIndex) (plt : term) (es : list entry) (ci : logIndex) (st' : raft_data) (ps : msg), handleAppendEntries h (snd st) t n pli plt es ci = (st', ps) -> type st' = Leader -> (currentTerm st' = currentTerm (snd st) /\ type (snd st) = Leader /\ log st' = log (snd st) /\ allEntries (update_elections_data_appendEntries h st t n pli plt es ci) = allEntries (fst st)).
Lemma allEntries_leader_sublog_append_entries : refined_raft_net_invariant_append_entries allEntries_leader_sublog.
Lemma allEntries_leader_sublog_append_entries_reply : refined_raft_net_invariant_append_entries_reply allEntries_leader_sublog.
Lemma allEntries_leader_sublog_request_vote : refined_raft_net_invariant_request_vote allEntries_leader_sublog.
Lemma handleRequestVoteReply_RVR_spec : forall h st h' t r st', handleRequestVoteReply h st h' t r = st' -> st' = st \/ (type st' = Follower /\ currentTerm st' = t /\ log st' = log st) \/ (currentTerm st' = currentTerm st /\ log st' = log st /\ ((type st = Candidate /\ type st' = Leader /\ r = true /\ currentTerm st = t /\ wonElection (dedup name_eq_dec (h' :: votesReceived st)) = true) \/ type st' = type st)).
Lemma allEntries_leader_sublog_request_vote_reply : refined_raft_net_invariant_request_vote_reply allEntries_leader_sublog.
Lemma allEntries_leader_sublog_timeout : refined_raft_net_invariant_timeout allEntries_leader_sublog.
Lemma allEntries_leader_sublog_do_leader : refined_raft_net_invariant_do_leader allEntries_leader_sublog.
Lemma allEntries_leader_sublog_do_generic_server : refined_raft_net_invariant_do_generic_server allEntries_leader_sublog.
Lemma allEntries_leader_sublog_reboot : refined_raft_net_invariant_reboot allEntries_leader_sublog.
Lemma allEntries_leader_sublog_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset allEntries_leader_sublog.
Lemma allEntries_leader_sublog_init : refined_raft_net_invariant_init allEntries_leader_sublog.
Lemma doLeader_no_messages_to_self : forall st h os st' ms m, doLeader st h = (os, st', ms) -> In m ms -> fst m <> h.
Lemma no_append_entries_to_self_do_leader : raft_net_invariant_do_leader no_append_entries_to_self.
Lemma no_append_entries_to_self_do_generic_server : raft_net_invariant_do_generic_server no_append_entries_to_self.
Lemma no_append_entries_to_self_append_entries : raft_net_invariant_append_entries no_append_entries_to_self.
Lemma no_append_entries_to_self_append_entries_reply : raft_net_invariant_append_entries_reply no_append_entries_to_self.
Lemma no_append_entries_to_self_request_vote : raft_net_invariant_request_vote no_append_entries_to_self.
Lemma no_append_entries_to_self_request_vote_reply : raft_net_invariant_request_vote_reply no_append_entries_to_self.
Lemma no_append_entries_to_self_client_request : raft_net_invariant_client_request no_append_entries_to_self.
Lemma no_append_entries_to_self_timeout : raft_net_invariant_timeout no_append_entries_to_self.
Lemma no_append_entries_to_self_state_same_packet_subset : raft_net_invariant_state_same_packet_subset no_append_entries_to_self.
Lemma no_append_entries_to_self_reboot : raft_net_invariant_reboot no_append_entries_to_self.
Lemma no_append_entries_to_self_init : raft_net_invariant_init no_append_entries_to_self.
Theorem no_append_entries_to_self_invariant : forall net, raft_intermediate_reachable net -> no_append_entries_to_self net.
Lemma output_before_input_not_key_in_input_trace : forall tr tr' s s', ~ output_before_input client id client' id' tr -> step_failure s s' tr' -> output_before_input client id client' id' (tr ++ tr') -> ~ exists i, in_input_trace client' id' i (tr ++ tr').
Lemma output_before_input_key_in_output_trace : forall tr, output_before_input client id client' id' tr -> key_in_output_trace client id tr.
Lemma in_applied_entries_entries_ordered : forall net, in_applied_entries client id net -> ~ in_applied_entries client' id' net -> entries_ordered client id client' id' net.
Lemma in_applied_entries_applied_implies_input_state : forall net, in_applied_entries client' id' net -> exists e, eClient e = client' /\ eId e = id' /\ applied_implies_input_state client' id' (eInput e) net.
Lemma in_input_trace_or_app : forall c id i tr1 tr2, in_input_trace c id i tr1 \/ in_input_trace c id i tr2 -> in_input_trace c id i (tr1 ++ tr2).
Lemma applied_implies_input_update_split : forall client id i net h d ps, applied_implies_input_state client id i (mkNetwork ps (update name_eq_dec (nwState net) h d)) -> exists e, correct_entry client id i e /\ (In e (log d) \/ (exists h, In e (log (nwState net h))) \/ (exists p es, In p ps /\ mEntries (pBody p) = Some es /\ In e es)).
Lemma aiis_intro_state : forall client id i net e h, In e (log (nwState net h)) -> correct_entry client id i e -> applied_implies_input_state client id i net.
Lemma aiis_intro_packet : forall client id i net e p es, mEntries (pBody p) = Some es -> In p (nwPackets net) -> correct_entry client id i e -> In e es -> applied_implies_input_state client id i net.
Lemma doGenericServer_log : forall h st os st' ps, doGenericServer h st = (os, st', ps) -> log st' = log st.
Theorem handleTimeout_log : forall h st out st' ps, handleTimeout h st = (out, st', ps) -> log st' = log st.
Theorem handleClientRequest_no_messages : forall h st client id c out st' ps p, handleClientRequest h st client id c = (out, st', ps) -> In p ps -> False.
Lemma mEntries_some_is_applied_entries : forall m es, mEntries m = Some es -> is_append_entries m.
Lemma doGenericServer_packets : forall h st os st' ps p, doGenericServer h st = (os, st', ps) -> In p ps -> False.
Lemma doLeader_messages : forall d h os d' ms m es e, doLeader d h = (os, d', ms) -> In m ms -> mEntries (snd m) = Some es -> In e es -> In e (log d).
Lemma mEntries_intro : forall m t n l t' es l', m = AppendEntries t n l t' es l' -> mEntries m = Some es.
Lemma handleMessage_aais : forall client id i net p d' ms e, ~ applied_implies_input_state client id i net -> In p (nwPackets net) -> handleMessage (pSrc p) (pDst p) (pBody p) (nwState net (pDst p)) = (d', ms) -> correct_entry client id i e -> In e (log d') -> False.
Lemma handleRequestVote_doesn't_send_AE : forall h st t n lli llt d m, handleRequestVote h st t n lli llt = (d, m) -> ~ is_append_entries m.
Lemma handleAppendEntriesReply_doesn't_send_AE : forall n st src t es b st' l, handleAppendEntriesReply n st src t es b = (st', l) -> forall x, In x l -> ~ is_append_entries (snd x).
Lemma handleAppendEntries_doesn't_send_AE : forall n st t i l t' l' l'' st' m, handleAppendEntries n st t i l t' l' l'' = (st', m) -> ~ is_append_entries m.
Lemma handleMessage_sends_log : forall client id i net p d' ms m es e, In p (nwPackets net) -> handleMessage (pSrc p) (pDst p) (pBody p) (nwState net (pDst p)) = (d', ms) -> correct_entry client id i e -> In m ms -> mEntries (snd m) = Some es -> In e es -> In e (log (nwState net (pDst p))).
Lemma applied_implies_input_in_input_trace : forall net failed net' failed' tr, raft_intermediate_reachable net -> @step_failure _ _ failure_params (failed, net) (failed', net') tr -> ~ applied_implies_input_state client id i net -> applied_implies_input_state client id i net' -> in_input_trace client id i tr.
Lemma client_id_in_true_in_applied_entries : forall net, client_id_in (applied_entries (nwState net)) = true -> in_applied_entries client id net.
Lemma client_id_in_false_not_in_applied_entries : forall net, client_id_in (applied_entries (nwState net)) = false -> ~ in_applied_entries client id net.
Lemma doGenericServer_applied_entries : forall ps h sigma os st' ms, raft_intermediate_reachable (mkNetwork ps sigma) -> doGenericServer h (sigma h) = (os, st', ms) -> exists es, applied_entries (update name_eq_dec sigma h st') = (applied_entries sigma) ++ es /\ (forall e, In e es -> exists h, In e (log (sigma h)) /\ eIndex e <= commitIndex (sigma h)).
Lemma findAtIndex_max_thing : forall net h e i, raft_intermediate_reachable net -> In e (log (nwState net h)) -> eIndex e > i -> 1 <= i -> exists e', findAtIndex (log (nwState net h)) i = Some e'.
Lemma entries_max_thing : forall net p es, raft_intermediate_reachable net -> In p (nwPackets net) -> mEntries (pBody p) = Some es -> es <> nil -> 1 <= maxIndex es.
Lemma logs_contiguous : forall net h, raft_intermediate_reachable net -> contiguous_range_exact_lo (log (nwState net h)) 0.
Lemma entries_gt_0 : forall net p es e, raft_intermediate_reachable net -> In p (nwPackets net) -> mEntries (pBody p) = Some es -> In e es -> 0 < eIndex e.
Lemma entries_gt_pli : forall net p e t n pli plt es ci, raft_intermediate_reachable net -> In p (nwPackets net) -> pBody p = AppendEntries t n pli plt es ci -> In e es -> pli < eIndex e.
Lemma sorted_app : forall l l', sorted (l ++ l') -> sorted l.
Lemma handleMessage_applied_entries : forall net h h' m st' ms, raft_intermediate_reachable net -> In {| pBody := m; pDst := h; pSrc := h' |} (nwPackets net) -> handleMessage h' h m (nwState net h) = (st', ms) -> applied_entries (nwState net) = applied_entries (update name_eq_dec (nwState net) h st').
Lemma handleMessage_log : forall net h h' h'' e m st' ms, raft_intermediate_reachable net -> In {| pBody := m; pDst := h; pSrc := h' |} (nwPackets net) -> handleMessage h' h m (nwState net h) = (st', ms) -> In e (log (update name_eq_dec (nwState net) h st' h'')) -> applied_implies_input_state (eClient e) (eId e) (eInput e) net.
Lemma handleInput_applied_entries : forall net h inp os st' ms, raft_intermediate_reachable net -> handleInput h inp (nwState net h) = (os, st', ms) -> applied_entries (nwState net) = applied_entries (update name_eq_dec (nwState net) h st').
Lemma handleInput_log : forall net h inp os st' ms h' e, raft_intermediate_reachable net -> handleInput h inp (nwState net h) = (os, st', ms) -> In e (log (update name_eq_dec (nwState net) h st' h')) -> (applied_implies_input_state (eClient e) (eId e) (eInput e) net \/ inp = ClientRequest (eClient e) (eId e) (eInput e)).
Lemma in_applied_entries_step_applied_implies_input_state' : forall (failed : list name) net failed' net' o, raft_intermediate_reachable net -> step_failure (failed, net) (failed', net') o -> ~ in_applied_entries client id net -> in_applied_entries client id net' -> (exists e, eClient e = client /\ eId e = id /\ applied_implies_input_state client id (eInput e) net) \/ exists h o' inp, o = (h, inl (ClientRequest client id inp)) :: o'.
Lemma in_applied_entries_step_applied_implies_input_state : forall (s : list name * network) s' tr o, refl_trans_1n_trace step_failure step_failure_init s tr -> ~ in_applied_entries client id (snd s) -> step_failure s s' o -> in_applied_entries client id (snd s') -> (exists e, eClient e = client /\ eId e = id /\ applied_implies_input_state client id (eInput e) (snd s)) \/ exists h o' inp, o = (h, inl (ClientRequest client id inp)) :: o'.
Lemma in_input_not_in_output_input_before_output : forall client id i tr, in_input_trace client id i tr -> ~ key_in_output_trace client id tr -> input_before_output client id tr.
Lemma input_before_output_not_key_in_output_trace_snoc_key : forall client id tr h inp tr', ~ key_in_output_trace client id tr -> input_before_output client id (tr ++ (h, inl (ClientRequest client id inp)) :: tr').
Lemma in_output_changed : forall client id tr o, ~ key_in_output_trace client id tr -> key_in_output_trace client id (tr ++ o) -> key_in_output_trace client id o.
Lemma key_in_output_list_split : forall client id l l', key_in_output_list client id (l ++ l') -> key_in_output_list client id l \/ key_in_output_list client id l'.
Lemma doLeader_key_in_output_list : forall st h out st' m client id, doLeader st h = (out, st', m) -> ~ key_in_output_list client id out.
Lemma handleInput_key_in_output_list : forall st h i out st' m client id, handleInput h i st = (out, st', m) -> ~ key_in_output_list client id out.
Lemma has_key_own_key : forall e, has_key (eClient e) (eId e) e = true.
Lemma has_key_true_necessary : forall client id e, has_key client id e = true -> eClient e = client /\ eId e = id.
Lemma applyEntries_cache : forall l h st os st' o client id id' o', id < id' -> applyEntries h st l = (os, st') -> In (ClientResponse client id o) os -> getLastId st client <> Some (id', o').
Lemma applyEntries_before : forall l h st os st' o client id id', id < id' -> applyEntries h st l = (os, st') -> In (ClientResponse client id o) os -> before_func (has_key client id) (has_key client id') l.
Lemma entries_contiguous : forall net, raft_intermediate_reachable net -> (forall h, contiguous_range_exact_lo (log (nwState net h)) 0).
Lemma doGenericServer_key_in_output_list : forall net h os st' ms id' client id, raft_intermediate_reachable net -> doGenericServer h (nwState net h) = (os, st', ms) -> key_in_output_list client id os -> id < id' -> before_func (has_key client id) (has_key client id') (applied_entries (update name_eq_dec (nwState net) h st')).
Lemma output_implies_greatest : forall failed net failed' net' o client id id', raft_intermediate_reachable net -> @step_failure _ _ failure_params (failed, net) (failed', net') o -> key_in_output_trace client id o -> id < id' -> before_func (has_key client id) (has_key client id') (applied_entries (nwState net')).
Theorem handleAppendEntries_entries_in : forall h s t n prevT prevI entries c d m e, handleAppendEntries h s t n prevT prevI entries c = (d, m) -> In e (log d) -> (In e (log s) \/ In e entries).
Lemma log_matching_hosts_ignores_packets : forall net net', log_matching_hosts net -> (forall h, log (nwState net h) = log (nwState net' h)) -> log_matching_hosts net'.
Lemma requestVote_term_sanity_append_entries : refined_raft_net_invariant_append_entries requestVote_term_sanity.
Lemma requestVote_term_sanity_append_entries_reply : refined_raft_net_invariant_append_entries_reply requestVote_term_sanity.
Lemma requestVote_term_sanity_request_vote : refined_raft_net_invariant_request_vote requestVote_term_sanity.
Lemma requestVote_term_sanity_request_vote_reply : refined_raft_net_invariant_request_vote_reply requestVote_term_sanity.
Lemma requestVote_term_sanity_timeout : refined_raft_net_invariant_timeout requestVote_term_sanity.
Lemma requestVote_term_sanity_client_request : refined_raft_net_invariant_client_request requestVote_term_sanity.
Lemma requestVote_term_sanity_do_leader : refined_raft_net_invariant_do_leader requestVote_term_sanity.
Lemma requestVote_term_sanity_do_generic_server : refined_raft_net_invariant_do_generic_server requestVote_term_sanity.
Lemma requestVote_term_sanity_reboot : refined_raft_net_invariant_reboot requestVote_term_sanity.
Lemma requestVote_term_sanity_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset requestVote_term_sanity.
Lemma requestVote_term_sanity_init : refined_raft_net_invariant_init requestVote_term_sanity.
Lemma requestVote_maxIndex_maxTerm_append_entries : refined_raft_net_invariant_append_entries requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_append_entries_reply : refined_raft_net_invariant_append_entries_reply requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_request_vote : refined_raft_net_invariant_request_vote requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_request_vote_reply : refined_raft_net_invariant_request_vote_reply requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_timeout : refined_raft_net_invariant_timeout requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_client_request : refined_raft_net_invariant_client_request requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_do_leader : refined_raft_net_invariant_do_leader requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_do_generic_server : refined_raft_net_invariant_do_generic_server requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_reboot : refined_raft_net_invariant_reboot requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset requestVote_maxIndex_maxTerm.
Lemma requestVote_maxIndex_maxTerm_init : refined_raft_net_invariant_init requestVote_maxIndex_maxTerm.
Lemma votesWithLog_sorted_init : refined_raft_net_invariant_init votesWithLog_sorted.
Lemma votesWithLog_update_elections_data_client_request : forall me st client id c, votesWithLog (update_elections_data_client_request me st client id c) = votesWithLog (fst st).
Lemma votesWithLog_sorted_client_request : refined_raft_net_invariant_client_request votesWithLog_sorted.
Lemma sorted_host_lifted : forall net h, refined_raft_intermediate_reachable net -> sorted (log (snd (nwState net h))).
Lemma votesWithLog_update_elections_data_timeout : forall {h st out st' l}, handleTimeout h (snd st) = (out, st', l) -> forall (P : list (term * name * list entry) -> Prop), (forall t cid, P ((t, cid, log st') :: votesWithLog (fst st))) -> (P (votesWithLog (fst st))) -> (P (votesWithLog (update_elections_data_timeout h st))).
Lemma votesWithLog_sorted_timeout : refined_raft_net_invariant_timeout votesWithLog_sorted.
Lemma votesWithLog_update_elections_data_AE : forall me st t li pli plt es lci, votesWithLog (update_elections_data_appendEntries me st t li pli plt es lci) = votesWithLog (fst st).
Lemma votesWithLog_sorted_append_entries : refined_raft_net_invariant_append_entries votesWithLog_sorted.
Lemma votesWithLog_sorted_append_entries_reply : refined_raft_net_invariant_append_entries_reply votesWithLog_sorted.
Lemma votesWithLog_sorted_request_vote : refined_raft_net_invariant_request_vote votesWithLog_sorted.
Lemma votesWithLog_update_elections_data_RVR : forall me src t status st, votesWithLog (update_elections_data_requestVoteReply me src t status st) = votesWithLog (fst st).
Lemma votesWithLog_sorted_request_vote_reply : refined_raft_net_invariant_request_vote_reply votesWithLog_sorted.
Lemma votesWithLog_sorted_do_leader : refined_raft_net_invariant_do_leader votesWithLog_sorted.
Lemma votesWithLog_sorted_do_generic_server : refined_raft_net_invariant_do_generic_server votesWithLog_sorted.
Lemma votesWithLog_sorted_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset votesWithLog_sorted.
Lemma votesWithLog_sorted_reboot : refined_raft_net_invariant_reboot votesWithLog_sorted.
Lemma votesWithLog_sorted_invariant : forall net, refined_raft_intermediate_reachable net -> votesWithLog_sorted net.
Lemma match_index_leader_append_entries_reply : raft_net_invariant_append_entries_reply match_index_leader.
Lemma match_index_leader_client_request : raft_net_invariant_client_request match_index_leader.
Lemma match_index_leader_request_vote_reply : raft_net_invariant_request_vote_reply match_index_leader.
Lemma match_index_leader_append_entries : raft_net_invariant_append_entries match_index_leader.
Lemma match_index_leader_request_vote : raft_net_invariant_request_vote match_index_leader.
Lemma match_index_leader_timeout : raft_net_invariant_timeout match_index_leader.
Lemma match_index_leader_do_leader : raft_net_invariant_do_leader match_index_leader.
Lemma match_index_leader_do_generic_server : raft_net_invariant_do_generic_server match_index_leader.
Lemma match_index_leader_reboot : raft_net_invariant_reboot match_index_leader.
Lemma match_index_leader_state_same_packet_subset : raft_net_invariant_state_same_packet_subset match_index_leader.
Lemma match_index_leader_init : raft_net_invariant_init match_index_leader.
Lemma leaderLogs_sorted_init : refined_raft_net_invariant_init leaderLogs_sorted.
Lemma leaderLogs_update_elections_data_client_request : forall me st client id c, leaderLogs (update_elections_data_client_request me st client id c) = leaderLogs (fst st).
Lemma leaderLogs_sorted_client_request : refined_raft_net_invariant_client_request leaderLogs_sorted.
Lemma sorted_host_lifted : forall net h, refined_raft_intermediate_reachable net -> sorted (log (snd (nwState net h))).
Lemma leaderLogs_update_elections_data_timeout : forall h st, leaderLogs (update_elections_data_timeout h st) = leaderLogs (fst st).
Lemma leaderLogs_sorted_timeout : refined_raft_net_invariant_timeout leaderLogs_sorted.
Lemma leaderLogs_update_elections_data_AE : forall me st t li pli plt es lci, leaderLogs (update_elections_data_appendEntries me st t li pli plt es lci) = leaderLogs (fst st).
Lemma leaderLogs_sorted_append_entries : refined_raft_net_invariant_append_entries leaderLogs_sorted.
Lemma leaderLogs_sorted_append_entries_reply : refined_raft_net_invariant_append_entries_reply leaderLogs_sorted.
Lemma leaderLogs_sorted_request_vote : refined_raft_net_invariant_request_vote leaderLogs_sorted.
Lemma leaderLogs_update_elections_data_request_vote_reply : forall {h st h' t r st'}, handleRequestVoteReply h (snd st) h' t r = st' -> forall (P : list (term * list entry) -> Prop), (forall t, P ((t, log (snd st)) :: leaderLogs (fst st))) -> (P (leaderLogs (fst st))) -> (P (leaderLogs (update_elections_data_requestVoteReply h h' t r st))).
Lemma leaderLogs_sorted_request_vote_reply : refined_raft_net_invariant_request_vote_reply leaderLogs_sorted.
Lemma leaderLogs_sorted_do_leader : refined_raft_net_invariant_do_leader leaderLogs_sorted.
Lemma leaderLogs_sorted_do_generic_server : refined_raft_net_invariant_do_generic_server leaderLogs_sorted.
Lemma leaderLogs_sorted_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset leaderLogs_sorted.
Lemma leaderLogs_sorted_reboot : refined_raft_net_invariant_reboot leaderLogs_sorted.
Lemma leaderLogs_sorted_invariant : forall net, refined_raft_intermediate_reachable net -> leaderLogs_sorted net.
Lemma appendEntries_leader_init : refined_raft_net_invariant_init appendEntries_leader.
Lemma votedFor_moreUpToDate_append_entries : refined_raft_net_invariant_append_entries votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_append_entries_reply : refined_raft_net_invariant_append_entries_reply votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_request_vote : refined_raft_net_invariant_request_vote votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_request_vote_reply : refined_raft_net_invariant_request_vote_reply votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_timeout : refined_raft_net_invariant_timeout votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_client_request : refined_raft_net_invariant_client_request votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_do_leader : refined_raft_net_invariant_do_leader votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_do_generic_server : refined_raft_net_invariant_do_generic_server votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_reboot : refined_raft_net_invariant_reboot votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset votedFor_moreUpToDate.
Lemma votedFor_moreUpToDate_init : refined_raft_net_invariant_init votedFor_moreUpToDate.
Theorem lift_log_matching : forall net, refined_raft_intermediate_reachable net -> log_matching (deghost net).
Theorem lift_sorted : forall net, refined_raft_intermediate_reachable net -> logs_sorted (deghost net).
Theorem lift_entries_match : forall net h h', refined_raft_intermediate_reachable net -> entries_match (log (snd (nwState net h))) (log (snd (nwState net h'))).
Theorem lift_UniqueIndices : forall net, refined_raft_intermediate_reachable net -> UniqueIndices (deghost net).
Theorem lift_uniqueIndices_log : forall net h, refined_raft_intermediate_reachable net -> uniqueIndices (log (snd (nwState net h))).
Theorem lift_logs_sorted : forall net h, refined_raft_intermediate_reachable net -> sorted (log (snd (nwState net h))).
Theorem state_machine_safety_host'_invariant : forall net, refined_raft_intermediate_reachable net -> state_machine_safety_host' net.
Lemma quorum_preserved: forall (st st' : name -> electionsData * raft_data) (t0 : term) (ll : list entry) (leader : name), (forall h t leader log, In (t, leader, log) (votesWithLog (fst (st h))) -> In (t, leader, log) (votesWithLog (fst (st' h)))) -> (exists quorum : list name, NoDup quorum /\ length quorum > div2 (length nodes) /\ (forall h : name, In h quorum -> exists log : list entry, moreUpToDate (maxTerm ll) (maxIndex ll) (maxTerm log) (maxIndex log) = true /\ In (t0, leader, log) (votesWithLog (fst (st h))))) -> exists quorum : list name, NoDup quorum /\ length quorum > div2 (length nodes) /\ (forall h : name, In h quorum -> exists log : list entry, moreUpToDate (maxTerm ll) (maxIndex ll) (maxTerm log) (maxIndex log) = true /\ In (t0, leader, log) (votesWithLog (fst (st' h)))).
Lemma leaderLogs_votesWithLog_append_entries : refined_raft_net_invariant_append_entries leaderLogs_votesWithLog.
Lemma leaderLogs_votesWithLog_append_entries_reply : refined_raft_net_invariant_append_entries_reply leaderLogs_votesWithLog.
Lemma update_elections_data_request_vote_votesWithLog_old : forall (h : name) (st : electionsData * RaftState.raft_data term name entry logIndex serverType data clientId output) (t : nat) (src : fin N) (lli llt : nat) (t' : term) (h' : name) (l' : list entry), In (t', h', l') (votesWithLog (fst st)) -> In (t', h', l') (votesWithLog (update_elections_data_requestVote h src t src lli llt st)).
Lemma leaderLogs_votesWithLog_request_vote : refined_raft_net_invariant_request_vote leaderLogs_votesWithLog.
Lemma wonElection_dedup_spec : forall l, wonElection (dedup name_eq_dec l) = true -> exists quorum, NoDup quorum /\ length quorum > div2 (length nodes) /\ (forall h, In h quorum -> In h l).
Lemma leaderLogs_votesWithLog_request_vote_reply : refined_raft_net_invariant_request_vote_reply leaderLogs_votesWithLog.
Lemma update_elections_data_timeout_votesWithLog_old : forall h st t h' l, In (t, h', l) (votesWithLog (fst st)) -> In (t, h', l) (votesWithLog (update_elections_data_timeout h st)).
Lemma leaderLogs_votesWithLog_timeout : refined_raft_net_invariant_timeout leaderLogs_votesWithLog.
Lemma leaderLogs_votesWithLog_client_request : refined_raft_net_invariant_client_request leaderLogs_votesWithLog.
Lemma leaderLogs_votesWithLog_do_leader : refined_raft_net_invariant_do_leader leaderLogs_votesWithLog.
Lemma leaderLogs_votesWithLog_do_generic_server : refined_raft_net_invariant_do_generic_server leaderLogs_votesWithLog.
Lemma leaderLogs_votesWithLog_reboot : refined_raft_net_invariant_reboot leaderLogs_votesWithLog.
Lemma leaderLogs_votesWithLog_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset leaderLogs_votesWithLog.
Lemma leaderLogs_votesWithLog_init : refined_raft_net_invariant_init leaderLogs_votesWithLog.
Lemma in_log_in_all_entries_append_entries : refined_raft_net_invariant_append_entries in_log_in_all_entries.
Lemma in_log_in_all_entries_append_entries_reply : refined_raft_net_invariant_append_entries_reply in_log_in_all_entries.
Lemma in_log_in_all_entries_request_vote : refined_raft_net_invariant_request_vote in_log_in_all_entries.
Lemma in_log_in_all_entries_request_vote_reply : refined_raft_net_invariant_request_vote_reply in_log_in_all_entries.
Lemma in_log_in_all_entries_timeout : refined_raft_net_invariant_timeout in_log_in_all_entries.
Lemma in_log_in_all_entries_client_request : refined_raft_net_invariant_client_request in_log_in_all_entries.
Lemma in_log_in_all_entries_do_leader : refined_raft_net_invariant_do_leader in_log_in_all_entries.
Lemma in_log_in_all_entries_do_generic_server : refined_raft_net_invariant_do_generic_server in_log_in_all_entries.
Lemma in_log_in_all_entries_reboot : refined_raft_net_invariant_reboot in_log_in_all_entries.
Lemma in_log_in_all_entries_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset in_log_in_all_entries.
Lemma in_log_in_all_entries_init : refined_raft_net_invariant_init in_log_in_all_entries.
Lemma match_index_sanity_init : raft_net_invariant_init match_index_sanity.
Lemma match_index_sanity_client_request : raft_net_invariant_client_request match_index_sanity.
Lemma match_index_sanity_preserved : forall st st', matchIndex_preserved st st' -> (forall h, type st = Leader -> assoc_default name_eq_dec (matchIndex st) h 0 <= maxIndex (log st)) -> (forall h, type st' = Leader -> assoc_default name_eq_dec (matchIndex st') h 0 <= maxIndex (log st')).
Lemma match_index_sanity_timeout : raft_net_invariant_timeout match_index_sanity.
Lemma match_index_sanity_append_entries : raft_net_invariant_append_entries match_index_sanity.
Lemma handleAppendEntriesReply_matchIndex : forall h st st' m t es res h', handleAppendEntriesReply h st h' t es res = (st', m) -> type st' = Leader -> type st = Leader /\ (matchIndex st' = matchIndex st \/ res = true /\ currentTerm st = t /\ matchIndex st' = (assoc_set name_eq_dec (matchIndex st) h' (Nat.max (assoc_default name_eq_dec (matchIndex st) h' 0) (maxIndex es)))).
Lemma match_index_sanity_append_entries_reply : raft_net_invariant_append_entries_reply match_index_sanity.
Lemma match_index_sanity_request_vote : raft_net_invariant_request_vote match_index_sanity.
Lemma handleRequestVoteReply_matchIndex : forall n st src t v, type (handleRequestVoteReply n st src t v) = Leader -> type st = Leader /\ matchIndex (handleRequestVoteReply n st src t v) = matchIndex st \/ matchIndex (handleRequestVoteReply n st src t v) = (assoc_set name_eq_dec nil n (maxIndex (log st))).
Lemma match_index_sanity_request_vote_reply : raft_net_invariant_request_vote_reply match_index_sanity.
Lemma match_index_sanity_do_leader : raft_net_invariant_do_leader match_index_sanity.
Lemma match_index_sanity_do_generic_server : raft_net_invariant_do_generic_server match_index_sanity.
Lemma match_index_sanity_state_same_packet_subset : raft_net_invariant_state_same_packet_subset match_index_sanity.
Lemma match_index_sanity_reboot : raft_net_invariant_reboot match_index_sanity.
Lemma match_index_sanity_invariant : forall net, raft_intermediate_reachable net -> match_index_sanity net.
Lemma doLeader_no_messages_to_self : forall st h os st' ms m, doLeader st h = (os, st', ms) -> In m ms -> fst m <> h.
Lemma no_append_entries_replies_to_self_do_leader : raft_net_invariant_do_leader no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_do_generic_server : raft_net_invariant_do_generic_server no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_append_entries : raft_net_invariant_append_entries no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_append_entries_reply : raft_net_invariant_append_entries_reply no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_request_vote : raft_net_invariant_request_vote no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_request_vote_reply : raft_net_invariant_request_vote_reply no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_client_request : raft_net_invariant_client_request no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_timeout : raft_net_invariant_timeout no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_state_same_packet_subset : raft_net_invariant_state_same_packet_subset no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_reboot : raft_net_invariant_reboot no_append_entries_replies_to_self.
Lemma no_append_entries_replies_to_self_init : raft_net_invariant_init no_append_entries_replies_to_self.
Theorem no_append_entries_replies_to_self_invariant : forall net, raft_intermediate_reachable net -> no_append_entries_replies_to_self net.
Lemma requestVoteReply_moreUpToDate_append_entries : refined_raft_net_invariant_append_entries requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_append_entries_reply : refined_raft_net_invariant_append_entries_reply requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_request_vote : refined_raft_net_invariant_request_vote requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_request_vote_reply : refined_raft_net_invariant_request_vote_reply requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_timeout : refined_raft_net_invariant_timeout requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_client_request : refined_raft_net_invariant_client_request requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_do_leader : refined_raft_net_invariant_do_leader requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_do_generic_server : refined_raft_net_invariant_do_generic_server requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_reboot : refined_raft_net_invariant_reboot requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset requestVoteReply_moreUpToDate.
Lemma requestVoteReply_moreUpToDate_init : refined_raft_net_invariant_init requestVoteReply_moreUpToDate.
Lemma allEntries_indices_gt_0_init : refined_raft_net_invariant_init allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_client_request : refined_raft_net_invariant_client_request allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_timeout : refined_raft_net_invariant_timeout allEntries_indices_gt_0.
Lemma ghost_packet : forall (net : network (params := raft_refined_multi_params)) p, In p (nwPackets net) -> In (deghost_packet p) (nwPackets (deghost net)).
Lemma lifted_taifol_nw : forall net, refined_raft_intermediate_reachable net -> forall p t leaderId prevLogIndex prevLogTerm entries leaderCommit, In p (nwPackets net) -> pBody p = AppendEntries t leaderId prevLogIndex prevLogTerm entries leaderCommit -> terms_and_indices_from_one entries.
Lemma allEntries_indices_gt_0_append_entries : refined_raft_net_invariant_append_entries allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_append_entries_reply : refined_raft_net_invariant_append_entries_reply allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_request_vote : refined_raft_net_invariant_request_vote allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_request_vote_reply : refined_raft_net_invariant_request_vote_reply allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_do_leader : refined_raft_net_invariant_do_leader allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_do_generic_server : refined_raft_net_invariant_do_generic_server allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_reboot : refined_raft_net_invariant_reboot allEntries_indices_gt_0.
Lemma allEntries_indices_gt_0_invariant : forall net, refined_raft_intermediate_reachable net -> allEntries_indices_gt_0 net.
Lemma handleRequestVoteReply_spec : forall h st h' t r st', st' = handleRequestVoteReply h st h' t r -> log st' = log st /\ ((currentTerm st' = currentTerm st /\ type st' = type st) \/ type st' = Follower \/ (type st = Candidate /\ type st' = Leader)).
Lemma update_elections_data_appendEntries_allEntries' : forall h st t h' pli plt es ci t' e, In (t', e) (allEntries (update_elections_data_appendEntries h st t h' pli plt es ci)) -> In (t', e) (allEntries (fst st)) \/ currentTerm (snd st) <= t'.
Lemma allEntries_votesWithLog_append_entries : refined_raft_net_invariant_append_entries allEntries_votesWithLog.
Lemma allEntries_votesWithLog_append_entries_reply : refined_raft_net_invariant_append_entries_reply allEntries_votesWithLog.
Theorem UniqueIndices_invariant : forall net, raft_intermediate_reachable net -> UniqueIndices net.
Lemma handleRequestVoteReply_spec : forall h st h' t r st', st' = handleRequestVoteReply h st h' t r -> log st' = log st /\ ((currentTerm st' = currentTerm st /\ type st' = type st) \/ type st' = Follower \/ (type st = Candidate /\ type st' = Leader)).
Lemma findAtIndex_max_thing : forall net h e i, raft_intermediate_reachable net -> In e (log (nwState net h)) -> eIndex e > i -> 1 <= i -> exists e', findAtIndex (log (nwState net h)) i = Some e'.
Lemma entries_max_thing : forall net p es, raft_intermediate_reachable net -> In p (nwPackets net) -> mEntries (pBody p) = Some es -> es <> nil -> 1 <= maxIndex es.
Lemma deghost_snd : forall net h, snd (nwState net h) = nwState (deghost net) h.
Lemma lt_committed_committed : forall net e e' t h, log_matching (deghost net) -> committed net e t -> eIndex e' <= eIndex e -> In e (log (snd (nwState net h))) -> In e' (log (snd (nwState net h))) -> committed net e' t.
Lemma logs_contiguous : forall net h, raft_intermediate_reachable net -> contiguous_range_exact_lo (log (nwState net h)) 0.
Lemma entries_gt_0 : forall net p es e, raft_intermediate_reachable net -> In p (nwPackets net) -> mEntries (pBody p) = Some es -> In e es -> 0 < eIndex e.
Lemma entries_gt_pli : forall net p e t n pli plt es ci, raft_intermediate_reachable net -> In p (nwPackets net) -> pBody p = AppendEntries t n pli plt es ci -> In e es -> pli < eIndex e.
Lemma sorted_app : forall l l', sorted (l ++ l') -> sorted l.
Lemma handleMessage_applied_entries : forall net h h' m st' ms, raft_intermediate_reachable net -> In {| pBody := m; pDst := h; pSrc := h' |} (nwPackets net) -> handleMessage h' h m (nwState net h) = (st', ms) -> applied_entries (nwState net) = applied_entries (update name_eq_dec (nwState net) h st').
Theorem handleTimeout_log : forall h st out st' ps, handleTimeout h st = (out, st', ps) -> log st' = log st.
Lemma handleInput_applied_entries : forall net h inp os st' ms, raft_intermediate_reachable net -> handleInput h inp (nwState net h) = (os, st', ms) -> applied_entries (nwState net) = applied_entries (update name_eq_dec (nwState net) h st').
Lemma doGenericServer_applied_entries : forall ps h sigma os st' ms, raft_intermediate_reachable (mkNetwork ps sigma) -> doGenericServer h (sigma h) = (os, st', ms) -> exists es, applied_entries (update name_eq_dec sigma h st') = (applied_entries sigma) ++ es.
Theorem applied_entries_monotonic' : forall failed net failed' net' os, raft_intermediate_reachable net -> (@step_failure _ _ failure_params (failed, net) (failed', net') os) -> exists es, applied_entries (nwState net') = applied_entries (nwState net) ++ es.
Theorem applied_entries_monotonic : forall e failed net failed' net' os, raft_intermediate_reachable net -> (@step_failure _ _ failure_params (failed, net) (failed', net') os) -> In e (applied_entries (nwState net)) -> In e (applied_entries (nwState net')).
Theorem no_entries_past_current_term_nw_packets_unchanged : forall net ps' st', no_entries_past_current_term_nw net -> (forall p, In p ps' -> In p (nwPackets net) \/ False) -> no_entries_past_current_term_nw (mkNetwork ps' st').
Theorem no_entries_past_current_term_nw_only_new_packets_matter : forall net ps' l st', no_entries_past_current_term_nw net -> (forall p, In p ps' -> In p (nwPackets net) \/ In p l) -> no_entries_past_current_term_nw (mkNetwork l st') -> no_entries_past_current_term_nw (mkNetwork ps' st').
Theorem no_entries_past_current_term_nw_no_append_entries : forall net ps' h l st', no_entries_past_current_term_nw net -> (forall p, In p ps' -> In p (nwPackets net) \/ In p (send_packets h l)) -> (forall m, In m l -> ~ is_append_entries (snd m)) -> no_entries_past_current_term_nw (mkNetwork ps' st').
Theorem no_entries_past_current_term_nw_not_append_entries : forall net ps' p' st', no_entries_past_current_term_nw net -> (forall p, In p ps' -> In p (nwPackets net) \/ p = p') -> ~ is_append_entries (pBody p') -> no_entries_past_current_term_nw (mkNetwork ps' st').
Theorem no_entries_past_current_term_init : raft_net_invariant_init (no_entries_past_current_term).
Lemma doLeader_spec : forall h st os st' ps, doLeader st h = (os, st', ps) -> log st' = log st /\ currentTerm st' = currentTerm st.
Theorem no_entries_past_current_term_do_leader : raft_net_invariant_do_leader (no_entries_past_current_term).
Lemma doGenericServer_spec : forall h d os d' ms, doGenericServer h d = (os, d', ms) -> (log d' = log d /\ currentTerm d' = currentTerm d /\ (forall m, In m ms -> ~ is_append_entries (snd m))).
Lemma no_entries_past_current_term_do_generic_server : raft_net_invariant_do_generic_server no_entries_past_current_term.
Lemma handleClientRequest_messages : forall h d client id c os d' ms, handleClientRequest h d client id c = (os, d', ms) -> (forall m, In m ms -> ~ is_append_entries (snd m)).
Lemma no_entries_past_current_term_client_request : raft_net_invariant_client_request (no_entries_past_current_term).
Lemma handleTimeout_spec : forall h d os d' ms, handleTimeout h d = (os, d', ms) -> log d' = log d /\ currentTerm d <= currentTerm d' /\ ( forall m, In m ms -> ~ is_append_entries (snd m)).
Lemma no_entries_past_current_term_timeout : raft_net_invariant_timeout no_entries_past_current_term.
Lemma handleAppendEntries_spec : forall h st t n pli plt es ci st' m, handleAppendEntries h st t n pli plt es ci = (st', m) -> (currentTerm st <= currentTerm st' /\ (forall e, In e (log st') -> In e (log st) \/ In e es /\ currentTerm st' = t) /\ ~ is_append_entries m).
Lemma no_entries_past_current_term_append_entries : raft_net_invariant_append_entries no_entries_past_current_term.
Lemma no_entries_past_current_term_unaffected : forall net st' ps' xs p ys d ms, nwPackets net = xs ++ p :: ys -> no_entries_past_current_term net -> (forall h : Net.name, st' h = update name_eq_dec (nwState net) (pDst p) d h) -> (forall p' : packet, In p' ps' -> In p' (xs ++ ys) \/ In p' (send_packets (pDst p) ms)) -> currentTerm (nwState net (pDst p)) <= currentTerm d -> log d = log (nwState net (pDst p)) -> (forall m, In m ms -> ~ is_append_entries (snd m)) -> no_entries_past_current_term {| nwPackets := ps'; nwState := st' |}.
Lemma no_entries_past_current_term_unaffected_1 : forall net st' ps' xs p ys d m, nwPackets net = xs ++ p :: ys -> no_entries_past_current_term net -> (forall h : Net.name, st' h = update name_eq_dec (nwState net) (pDst p) d h) -> (forall p' : packet, In p' ps' -> In p' (xs ++ ys) \/ p' = m) -> currentTerm (nwState net (pDst p)) <= currentTerm d -> log d = log (nwState net (pDst p)) -> ~ is_append_entries (pBody m) -> no_entries_past_current_term {| nwPackets := ps'; nwState := st' |}.
Lemma no_entries_past_current_term_unaffected_0 : forall net st' ps' xs p ys d, nwPackets net = xs ++ p :: ys -> no_entries_past_current_term net -> (forall h : Net.name, st' h = update name_eq_dec (nwState net) (pDst p) d h) -> (forall p' : packet, In p' ps' -> In p' (xs ++ ys)) -> currentTerm (nwState net (pDst p)) <= currentTerm d -> log d = log (nwState net (pDst p)) -> no_entries_past_current_term {| nwPackets := ps'; nwState := st' |}.
Lemma handleAppendEntriesReply_spec : forall h st h' t es r st' ms, handleAppendEntriesReply h st h' t es r = (st', ms) -> (currentTerm st <= currentTerm st' /\ log st' = log st /\ (forall m, In m ms -> ~ is_append_entries (snd m))).
Lemma no_entries_past_current_term_append_entries_reply : raft_net_invariant_append_entries_reply no_entries_past_current_term.
Lemma handleRequestVote_spec : forall h st t h' pli plt st' m, handleRequestVote h st t h' pli plt = (st', m) -> (currentTerm st <= currentTerm st' /\ log st' = log st /\ ~ is_append_entries m).
Lemma no_entries_past_current_term_request_vote : raft_net_invariant_request_vote no_entries_past_current_term.
Lemma handleRequestVoteReply_spec : forall h st h' t v st', handleRequestVoteReply h st h' t v = st' -> (currentTerm st <= currentTerm st' /\ log st' = log st).
Lemma no_entries_past_current_term_request_vote_reply : raft_net_invariant_request_vote_reply no_entries_past_current_term.
Lemma no_entries_past_current_term_state_same_packet_subset : raft_net_invariant_state_same_packet_subset no_entries_past_current_term.
Lemma no_entries_past_current_term_reboot : raft_net_invariant_reboot no_entries_past_current_term.
Theorem no_entries_past_current_term_invariant : forall net, raft_intermediate_reachable net -> no_entries_past_current_term net.
Lemma append_entries_request_reply_correspondence_init : raft_net_invariant_init append_entries_request_reply_correspondence.
Lemma append_entries_request_reply_correspondence_timeout : raft_net_invariant_timeout append_entries_request_reply_correspondence.
Lemma append_entries_request_reply_correspondence_client_request : raft_net_invariant_client_request append_entries_request_reply_correspondence.
Lemma append_entries_request_reply_correspondence_do_leader : raft_net_invariant_do_leader append_entries_request_reply_correspondence.
Lemma append_entries_request_reply_correspondence_do_generic_server : raft_net_invariant_do_generic_server append_entries_request_reply_correspondence.
Lemma append_entries_request_reply_correspondence_reboot : raft_net_invariant_reboot append_entries_request_reply_correspondence.
Lemma subset_reachable : forall net net', nwState net' = nwState net -> (forall p, In p (nwPackets net') -> In p (nwPackets net)) -> raft_intermediate_reachable net -> raft_intermediate_reachable net'.
Lemma append_entries_request_reply_correspondence_state_same_packet_subset : raft_net_invariant_state_same_packet_subset append_entries_request_reply_correspondence.
Lemma handleAppendEntries_reply_spec: forall h st (d : raft_data) (t : term) (n : name) (pli : logIndex) (plt : term) (es : list entry) (ci : logIndex) (t0 : term) (es0 : list entry) t' es', handleAppendEntries h st t n pli plt es ci = (d, AppendEntriesReply t' es' true) -> t' = t /\ es' = es.
Lemma append_entries_request_reply_correspondence_append_entries : raft_net_invariant_append_entries append_entries_request_reply_correspondence.
Lemma append_entries_request_reply_correspondence_append_entries_reply : raft_net_invariant_append_entries_reply append_entries_request_reply_correspondence.
Lemma append_entries_request_reply_correspondence_request_vote : raft_net_invariant_request_vote append_entries_request_reply_correspondence.
Lemma append_entries_request_reply_correspondence_request_vote_reply : raft_net_invariant_request_vote_reply append_entries_request_reply_correspondence.
Lemma current_term_gt_zero_init : raft_net_invariant_init current_term_gt_zero.
Lemma current_term_gt_zero_client_request : raft_net_invariant_client_request current_term_gt_zero.
Lemma current_term_gt_zero_timeout : raft_net_invariant_timeout current_term_gt_zero.
Lemma current_term_gt_zero_append_entries : raft_net_invariant_append_entries current_term_gt_zero.
Lemma current_term_gt_zero_append_entries_reply : raft_net_invariant_append_entries_reply current_term_gt_zero.
Lemma current_term_gt_zero_request_vote : raft_net_invariant_request_vote current_term_gt_zero.
Lemma current_term_gt_zero_request_vote_reply : raft_net_invariant_request_vote_reply current_term_gt_zero.
Lemma current_term_gt_zero_do_leader : raft_net_invariant_do_leader current_term_gt_zero.
Lemma current_term_gt_zero_do_generic_server : raft_net_invariant_do_generic_server current_term_gt_zero.
Lemma current_term_gt_zero_state_same_packet_subset : raft_net_invariant_state_same_packet_subset current_term_gt_zero.
Lemma current_term_gt_zero_reboot : raft_net_invariant_reboot current_term_gt_zero.
Lemma current_term_gt_zero_invariant : forall net, raft_intermediate_reachable net -> current_term_gt_zero net.
Lemma in_output_changed : forall tr o, ~ key_in_output_trace client id tr -> key_in_output_trace client id (tr ++ o) -> key_in_output_trace client id o.
Lemma key_in_output_list_split : forall l l', key_in_output_list client id (l ++ l') -> key_in_output_list client id l \/ key_in_output_list client id l'.
Lemma doLeader_key_in_output_list : forall st h out st' m, doLeader st h = (out, st', m) -> ~ key_in_output_list client id out.
Lemma handleInput_key_in_output_list : forall st h i out st' m, handleInput h i st = (out, st', m) -> ~ key_in_output_list client id out.
Lemma applyEntries_In : forall l h st os st' o, applyEntries h st l = (os, st') -> In (ClientResponse client id o) os -> exists e : entry, eClient e = client /\ eId e = id /\ In e l.
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')).
Lemma output_implies_in_applied_entries : forall failed net failed' net' o, raft_intermediate_reachable net -> @step_failure _ _ failure_params (failed, net) (failed', net') o -> key_in_output_trace client id o -> in_applied_entries client id net'.
Lemma votes_update_elections_data_request_vote : forall h st t src lli llt st' m t' h', handleRequestVote h (snd st) t src lli llt = (st', m) -> In (t', h') (votes (update_elections_data_requestVote h src t src lli llt st)) -> In (t', h') (votes (fst st)) \/ t' = currentTerm st' /\ votedFor st' = Some h'.
Lemma votes_update_elections_data_request_vote_reply : forall h st src t r st' t' h', handleRequestVoteReply h (snd st) src t r = st' -> In (t', h') (votes (update_elections_data_requestVoteReply h src t r st)) -> In (t', h') (votes (fst st)).
Lemma votes_same_append_entries : forall h st t n pli plt es ci, votes (update_elections_data_appendEntries h st t n pli plt es ci) = votes (fst st).
Lemma votes_update_elections_data_timeout_votedFor : forall h st out st' ps t' h', handleTimeout h (snd st) = (out, st', ps) -> In (t', h') (votes (update_elections_data_timeout h st)) -> In (t', h') (votes (fst st)) \/ t' = currentTerm st' /\ t' = S (currentTerm (snd st)) /\ votedFor st' = Some h'.
Lemma handleTimeout_same_term_votedFor_preserved : forall h st out st' ps, handleTimeout h st = (out, st', ps) -> currentTerm st' = currentTerm st -> votedFor st' = votedFor st.
Lemma votes_update_elections_data_request_vote_reply_eq : forall h st src t r st', handleRequestVoteReply h (snd st) src t r = st' -> votes (update_elections_data_requestVoteReply h src t r st) = votes (fst st).
Lemma votes_update_elections_data_request_vote_intro : forall h st t src lli llt st' m h', handleRequestVote h (snd st) t src lli llt = (st', m) -> votedFor st' = Some h' -> currentTerm (snd st) < currentTerm st' \/ votedFor (snd st) = None -> In (currentTerm st', h') (votes (update_elections_data_requestVote h src t src lli llt st)).
Lemma votes_update_elections_data_request_vote_intro_old : forall h st t src lli llt st' m t' h', handleRequestVote h (snd st) t src lli llt = (st', m) -> In (t', h') (votes (fst st)) -> In (t', h') (votes (update_elections_data_requestVote h src t src lli llt st)).
Lemma update_elections_data_timeout_votes_intro_new : forall h st out st' ps t' h', handleTimeout h (snd st) = (out, st', ps) -> (forall t h, t = currentTerm (snd st) -> votedFor (snd st) = Some h -> In (t, h) (votes (fst st))) -> t' = currentTerm st' -> votedFor st' = Some h' -> In (t', h') (votes (update_elections_data_timeout h st)).
Lemma votes_update_elections_data_timeout : forall h st out st' ps t' h', handleTimeout h (snd st) = (out, st', ps) -> In (t', h') (votes (update_elections_data_timeout h st)) -> In (t', h') (votes (fst st)) \/ t' = currentTerm st'.
Lemma votes_update_elections_data_client_request : forall h st client id c, votes (update_elections_data_client_request h st client id c) = votes (fst st).
Lemma votesWithLog_same_client_request : forall h st client id c, votesWithLog (update_elections_data_client_request h st client id c) = votesWithLog (fst st).
Lemma votesWithLog_update_elections_data_client_request : forall h st client id c out st' ps t' h' l', handleClientRequest h (snd st) client id c = (out, st', ps) -> In (t', h', l') (votesWithLog (update_elections_data_client_request h st client id c)) -> In (t', h', l') (votesWithLog (fst st)).
Lemma votesWithLog_update_elections_data_timeout : forall h st out st' ps t' h' l', handleTimeout h (snd st) = (out, st', ps) -> In (t', h', l') (votesWithLog (update_elections_data_timeout h st)) -> In (t', h', l') (votesWithLog (fst st)) \/ (t' = currentTerm st' /\ l' = log st').
Lemma votesWithLog_same_append_entries : forall h st t n pli plt es ci, votesWithLog (update_elections_data_appendEntries h st t n pli plt es ci) = votesWithLog (fst st).
Lemma votesWithLog_update_elections_data_append_entries : forall h st t n pli plt es ci st' ps t' h' l', handleAppendEntries h (snd st) t n pli plt es ci = (st', ps) -> In (t', h', l') (votesWithLog (update_elections_data_appendEntries h st t n pli plt es ci)) -> In (t', h', l') (votesWithLog (fst st)).
Lemma votesWithLog_update_elections_data_request_vote : forall h st t src lli llt st' m t' h' l', handleRequestVote h (snd st) t src lli llt = (st', m) -> In (t', h', l') (votesWithLog (update_elections_data_requestVote h src t src lli llt st)) -> In (t', h', l') (votesWithLog (fst st)) \/ (t' = currentTerm st' /\ l' = log st').
Lemma votesWithLog_update_elections_data_request_vote_reply : forall h st src t r st' t' h' l', handleRequestVoteReply h (snd st) src t r = st' -> In (t', h', l') (votesWithLog (update_elections_data_requestVoteReply h src t r st)) -> In (t', h', l') (votesWithLog (fst st)).
Lemma update_elections_data_request_vote_reply_votesWithLog : forall (h : name) (st : electionsData * RaftState.raft_data term name entry logIndex serverType data clientId output) (src : name) (t : nat) (r : bool), votesWithLog (update_elections_data_requestVoteReply h src t r st) = votesWithLog (fst st).
Lemma update_elections_data_client_request_leaderLogs : forall h st client id c, leaderLogs (update_elections_data_client_request h st client id c) = leaderLogs (fst st).
Lemma update_elections_data_timeout_leaderLogs : forall h st, leaderLogs (update_elections_data_timeout h st) = leaderLogs (fst st).
Lemma update_elections_data_appendEntries_leaderLogs : forall h st t src pli plt es ci, leaderLogs (update_elections_data_appendEntries h st t src pli plt es ci) = leaderLogs (fst st).
Lemma leaderLogs_update_elections_data_requestVote : forall h src t ci lli llt st, leaderLogs (update_elections_data_requestVote h src t ci lli llt st) = leaderLogs (fst st).
Lemma leaderLogs_update_elections_data_RVR : forall h src t1 v st t2 ll st', handleRequestVoteReply h (snd st) src t1 v = st' -> In (t2, ll) (leaderLogs (update_elections_data_requestVoteReply h src t1 v st)) -> In (t2, ll) (leaderLogs (fst st)) \/ (type st' = Leader /\ type (snd st) = Candidate /\ t2 = currentTerm st' /\ ll = log st').
Lemma update_elections_data_requestVoteReply_old : forall h src t1 v st t2 ll, In (t2, ll) (leaderLogs (fst st)) -> In (t2, ll) (leaderLogs (update_elections_data_requestVoteReply h src t1 v st)).
Lemma update_elections_data_client_request_allEntries : forall h st client id c out st' ms, handleClientRequest h (snd st) client id c = (out, st', ms) -> allEntries (update_elections_data_client_request h st client id c) = allEntries (fst st) \/ (exists e : entry, eIndex e = S (maxIndex (log (snd st))) /\ eTerm e = currentTerm (snd st) /\ eClient e = client /\ eInput e = c /\ eId e = id /\ type (snd st) = Leader /\ allEntries (update_elections_data_client_request h st client id c) = (currentTerm st', e) :: allEntries (fst st)).
Lemma update_elections_data_client_request_log_allEntries : forall h st client id c out st' ms, handleClientRequest h (snd st) client id c = (out, st', ms) -> (allEntries (update_elections_data_client_request h st client id c) = allEntries (fst st) /\ log st' = log (snd st)) \/ (type (snd st) = Leader /\ exists e : entry, eIndex e = S (maxIndex (log (snd st))) /\ eTerm e = currentTerm (snd st) /\ eClient e = client /\ eInput e = c /\ eId e = id /\ type (snd st) = Leader /\ allEntries (update_elections_data_client_request h st client id c) = (currentTerm st', e) :: allEntries (fst st) /\ log st' = e :: log (snd st)).
Lemma update_elections_data_requestVoteReply_allEntries : forall h h' t st r, allEntries (update_elections_data_requestVoteReply h h' t r st) = allEntries (fst st).
Lemma handleAppendEntriesReply_entries : forall h st t h' pli plt es ci st' t' es', handleAppendEntries h st t h' pli plt es ci = (st', AppendEntriesReply t' es' true) -> t' = t /\ es' = es /\ (forall e, In e es -> In e (log st') \/ haveNewEntries st es = false /\ log st' = log st).
Lemma update_elections_data_appendEntries_allEntries : forall h st t h' pli plt es ci e, In e (map snd (allEntries (update_elections_data_appendEntries h st t h' pli plt es ci))) -> In e (map snd (allEntries (fst st))) \/ In e es.
Lemma update_elections_data_appendEntries_allEntries_term : forall h st t h' pli plt es ci te e, In (te, e) (allEntries (update_elections_data_appendEntries h st t h' pli plt es ci)) -> In (te, e) (allEntries (fst st)) \/ (In e es /\ te = t).
Lemma update_elections_data_appendEntries_allEntries_term' : forall h st t h' pli plt es ci te e d m, In (te, e) (allEntries (update_elections_data_appendEntries h st t h' pli plt es ci)) -> handleAppendEntries h (snd st) t h' pli plt es ci = (d, m) -> In (te, e) (allEntries (fst st)) \/ (In e es /\ te = currentTerm d).
Lemma update_elections_data_appendEntries_allEntries_detailed : forall h st t h' pli plt es ci st' m te e, handleAppendEntries h (snd st) t h' pli plt es ci = (st', m) -> In (te, e) (allEntries (update_elections_data_appendEntries h st t h' pli plt es ci)) -> In (te, e) (allEntries (fst st)) \/ In e (log st') \/ (In e es /\ haveNewEntries (snd st) es = false /\ log st' = log (snd st)).
Lemma update_elections_data_clientRequest_allEntries_new : forall h st client id c e, In e (map snd (allEntries (update_elections_data_client_request h st client id c))) -> In e (map snd (allEntries (fst st))) \/ (eIndex e = S (maxIndex (log (snd st))) /\ eTerm e = currentTerm (snd st) /\ type (snd st) = Leader).
Lemma update_elections_data_clientRequest_allEntries_old : forall h st client id c e, In e (map snd (allEntries (fst st))) -> In e (map snd (allEntries (update_elections_data_client_request h st client id c))).
Lemma update_elections_data_clientRequest_allEntries_old' : forall h st client id c x, In x (allEntries (fst st)) -> In x (allEntries (update_elections_data_client_request h st client id c)).
Lemma update_elections_data_timeout_allEntries : forall h st, allEntries (update_elections_data_timeout h st) = allEntries (fst st).
Lemma update_elections_data_requestVote_allEntries : forall h h' t lli llt st, allEntries (update_elections_data_requestVote h h' t h' lli llt st) = allEntries (fst st).
Lemma update_elections_data_client_request_cronies : forall h st client id c out st' ms, handleClientRequest h (snd st) client id c = (out, st', ms) -> cronies (update_elections_data_client_request h st client id c) = cronies (fst st).
Lemma update_elections_data_appendEntries_cronies : forall h st t h' pli plt es ci, cronies (update_elections_data_appendEntries h st t h' pli plt es ci) = cronies (fst st).
Lemma update_elections_data_clientRequest_cronies_new : forall h st client id c, cronies (update_elections_data_client_request h st client id c) = cronies (fst st).
Lemma update_elections_data_requestVote_cronies : forall h h' t lli llt st, cronies (update_elections_data_requestVote h h' t h' lli llt st) = cronies (fst st).
Lemma update_elections_data_appendEntries_preserves_allEntries : forall net h t n pli plt es ci x, In x (allEntries (fst (nwState net h))) -> In x (allEntries (update_elections_data_appendEntries h (nwState net h) t n pli plt es ci)).
Lemma update_elections_data_request_vote_votesWithLog_old : forall (h : name) (st : electionsData * RaftState.raft_data term name entry logIndex serverType data clientId output) (t : nat) (src : fin N) (lli llt : nat) (t' : term) (h' : name) (l' : list entry), In (t', h', l') (votesWithLog (fst st)) -> In (t', h', l') (votesWithLog (update_elections_data_requestVote h src t src lli llt st)).
Lemma update_elections_data_timeout_votesWithLog_old : forall h st t h' l, In (t, h', l) (votesWithLog (fst st)) -> In (t, h', l) (votesWithLog (update_elections_data_timeout h st)).
Lemma update_elections_data_timeout_votedFor : forall h cid st out st' m, handleTimeout h (snd st) = (out, st', m) -> votedFor st' = Some cid -> (votedFor (snd st) = Some cid /\ currentTerm st' = currentTerm (snd st) /\ type st' = type (snd st) /\ votesWithLog (update_elections_data_timeout h st) = votesWithLog (fst st)) \/ (cid = h /\ currentTerm st' = S (currentTerm (snd st)) /\ votesWithLog (update_elections_data_timeout h st) = (currentTerm st', cid, (log st')) :: votesWithLog (fst st)).
Lemma update_elections_data_request_vote_votedFor : forall h h' cid t lli llt st st' m, handleRequestVote h (snd st) t h' lli llt = (st', m) -> votedFor st' = Some cid -> (votedFor (snd st) = Some cid /\ currentTerm st' = currentTerm (snd st)) \/ (cid = h' /\ currentTerm st' = t /\ votesWithLog (update_elections_data_requestVote h h' t h' lli llt st) = (currentTerm st', cid, (log st')) :: votesWithLog (fst st) /\ moreUpToDate llt lli (maxTerm (log st')) (maxIndex (log st')) = true).
Lemma handleRequestVote_votedFor : forall pDst t cid lli llt d d' m, handleRequestVote pDst d t cid lli llt = (d', m) -> currentTerm d = currentTerm d' -> votedFor d = None \/ votedFor d = votedFor d'.
Lemma handleRequestVoteReply_term_votedFor_cases : forall me st src t v st', handleRequestVoteReply me st src t v = st' -> (currentTerm st' = currentTerm st /\ votedFor st' = votedFor st) \/ (currentTerm st < currentTerm st' /\ votedFor st' = None).
Lemma handleAppendEntries_same_term_votedFor_preserved : forall h st t n pli plt es ci st' ps, handleAppendEntries h st t n pli plt es ci = (st', ps) -> currentTerm st' = currentTerm st -> votedFor st' = votedFor st.
Lemma handleAppendEntriesReply_same_term_votedFor_preserved : forall h st h' t es r st' ms, handleAppendEntriesReply h st h' t es r = (st', ms) -> currentTerm st' = currentTerm st -> votedFor st' = votedFor st.
Lemma doGenericServer_currentTerm : forall h st os st' ms, doGenericServer h st = (os, st', ms) -> currentTerm st' = currentTerm st.
Lemma doLeader_currentTerm : forall st h os st' ms, doLeader st h = (os, st', ms) -> currentTerm st' = currentTerm st.
Lemma handleAppendEntriesReply_currentTerm : forall h st h' t es r st' ms, handleAppendEntriesReply h st h' t es r = (st', ms) -> currentTerm st <= currentTerm st'.
Lemma handleAppendEntries_currentTerm : forall h st t n pli plt es ci st' ps, handleAppendEntries h st t n pli plt es ci = (st', ps) -> currentTerm st <= currentTerm st'.
Lemma tryToBecomeLeader_currentTerm : forall h st out st' l, tryToBecomeLeader h st = (out, st', l) -> currentTerm st <= currentTerm st'.
Lemma handleTimeout_currentTerm : forall h st out st' l, handleTimeout h st = (out, st', l) -> currentTerm st <= currentTerm st'.
Lemma advanceCurrentTerm_log : forall st t, log (advanceCurrentTerm st t) = log st.
Theorem handleAppendEntries_log_ind : forall {h st t n pli plt es ci st' ps}, handleAppendEntries h st t n pli plt es ci = (st', ps) -> forall (P : list entry -> Prop), P (log st) -> (pli = 0 -> P es) -> (forall e, pli <> 0 -> In e (log st) -> eIndex e = pli -> eTerm e = plt -> P (es ++ (removeAfterIndex (log st) pli))) -> P (log st').
Lemma haveNewEntries_true : forall st es, haveNewEntries st es = true -> (es <> nil /\ (findAtIndex (log st) (maxIndex es) = None \/ exists e, findAtIndex (log st) (maxIndex es) = Some e /\ eTerm e <> maxTerm es)).
Lemma advanceCurrentTerm_commitIndex : forall st t, commitIndex (advanceCurrentTerm st t) = commitIndex st.
Lemma some_none : forall A (x : A), Some x = None -> False.
Lemma advanceCurrentTerm_term : forall st t, currentTerm st <= t -> currentTerm (advanceCurrentTerm st t) = t.
Theorem handleAppendEntries_log_detailed : forall h st t n pli plt es ci st' ps, handleAppendEntries h st t n pli plt es ci = (st', ps) -> (commitIndex st' = commitIndex st /\ log st' = log st) \/ (leaderId st' <> None /\ currentTerm st' = t /\ commitIndex st' = max (commitIndex st) (min ci (maxIndex es)) /\ es <> nil /\ pli = 0 /\ t >= currentTerm st /\ log st' = es /\ (findAtIndex (log st) (maxIndex es) = None \/ exists e, findAtIndex (log st) (maxIndex es) = Some e /\ eTerm e <> maxTerm es)) \/ (leaderId st' <> None /\ currentTerm st' = t /\ commitIndex st' = max (commitIndex st) (min ci (maxIndex (es ++ (removeAfterIndex (log st) pli)))) /\ es <> nil /\ exists e, In e (log st) /\ eIndex e = pli /\ eTerm e = plt) /\ t >= currentTerm st /\ log st' = es ++ (removeAfterIndex (log st) pli) /\ (findAtIndex (log st) (maxIndex es) = None \/ exists e, findAtIndex (log st) (maxIndex es) = Some e /\ eTerm e <> maxTerm es).
Lemma advanceCurrentTerm_currentTerm_leaderId : forall st t, currentTerm st < currentTerm (advanceCurrentTerm st t) \/ leaderId (advanceCurrentTerm st t) = leaderId st.
Lemma advanceCurrentTerm_currentTerm : forall st t, currentTerm st <= currentTerm (advanceCurrentTerm st t).
Lemma handleRequestVote_currentTerm_monotonic : forall pDst t cid lli llt d d' m, handleRequestVote pDst d t cid lli llt = (d', m) -> currentTerm d <= currentTerm d'.
Lemma handleRequestVote_currentTerm_votedFor : forall pDst t cid lli llt d d' m, handleRequestVote pDst d t cid lli llt = (d', m) -> (currentTerm d < currentTerm d' \/ (currentTerm d = currentTerm d' /\ votedFor d = None) \/ (currentTerm d = currentTerm d' /\ votedFor d = votedFor d')).
Lemma handleRequestVoteReply_currentTerm' : forall h st h' t r st', handleRequestVoteReply h st h' t r = st' -> currentTerm st <= currentTerm st'.
Lemma handleRequestVote_currentTerm : forall st h h' t lli llt st' m, handleRequestVote h st t h' lli llt = (st', m) -> currentTerm st <= currentTerm st'.
Theorem handleAppendEntries_currentTerm_leaderId : forall h st t n pli plt es ci st' ps, handleAppendEntries h st t n pli plt es ci = (st', ps) -> currentTerm st < currentTerm st' \/ (currentTerm st <= currentTerm st' /\ (leaderId st' = leaderId st \/ leaderId st' <> None)).
Lemma handleRequestVote_currentTerm_leaderId : forall h st t c li lt st' m, handleRequestVote h st t c li lt = (st', m) -> currentTerm st < currentTerm st' \/ (currentTerm st = currentTerm st' /\ leaderId st' = leaderId st).
Lemma handleRequestVoteReply_currentTerm_leaderId : forall h st h' t r st', handleRequestVoteReply h st h' t r = st' -> currentTerm st < currentTerm st' \/ currentTerm st' = currentTerm st /\ leaderId st' = leaderId st.
Lemma handleClientRequest_log_ind : forall {h st client id c out st' ps}, handleClientRequest h st client id c = (out, st', ps) -> forall (P : list entry -> Prop), P (log st) -> (forall e, eIndex e = S (maxIndex (log st)) -> eTerm e = currentTerm st -> eClient e = client -> eInput e = c -> eId e = id -> type st = Leader -> P (e :: log st)) -> P (log st').
Lemma handleRequestVote_log : forall h st t candidate lli llt st' m, handleRequestVote h st t candidate lli llt = (st', m) -> log st' = log st.
Lemma handleTimeout_log_same : forall h d out d' l, handleTimeout h d = (out, d', l) -> log d' = log d.
Lemma doGenericServer_log : forall h st os st' ps, doGenericServer h st = (os, st', ps) -> log st' = log st.
Lemma handleRequestVoteReply_spec : forall h st h' t r st', st' = handleRequestVoteReply h st h' t r -> log st' = log st /\ (forall v, In v (votesReceived st) -> In v (votesReceived st')) /\ ((currentTerm st' = currentTerm st /\ type st' = type st) \/ type st' <> Candidate) /\ (type st <> Leader /\ type st' = Leader -> (type st = Candidate /\ wonElection (dedup name_eq_dec (votesReceived st')) = true)).
Lemma handleRequestVoteReply_spec' : forall h st h' t r st', st' = handleRequestVoteReply h st h' t r -> log st' = log st /\ (forall v, In v (votesReceived st) -> In v (votesReceived st')) /\ (type st <> Leader /\ type st' = Leader -> (type st = Candidate /\ wonElection (dedup name_eq_dec (votesReceived st')) = true) /\ r = true /\ currentTerm st' = currentTerm st /\ currentTerm st = t /\ votesReceived st' = (h' :: (votesReceived st))).
Theorem handleTimeout_not_is_append_entries : forall h st st' ms m, handleTimeout h st = (st', ms) -> In m ms -> ~ is_append_entries (snd m).
Lemma handleAppendEntries_type : forall h st t n pli plt es ci st' ps, handleAppendEntries h st t n pli plt es ci = (st', ps) -> (type st' = type st /\ currentTerm st' = currentTerm st) \/ type st' = Follower.
Lemma handleAppendEntries_type_term : forall h st t n pli plt es ci st' ps, handleAppendEntries h st t n pli plt es ci = (st', ps) -> (type st' = type st /\ currentTerm st' = currentTerm st) \/ (type st' = Follower /\ currentTerm st' >= currentTerm st).
Lemma handleAppendEntriesReply_type : forall h st h' t es r st' ms, handleAppendEntriesReply h st h' t es r = (st', ms) -> (type st' = type st /\ currentTerm st' = currentTerm st) \/ type st' = Follower.
Lemma handleAppendEntriesReply_type_term : forall h st h' t es r st' ms, handleAppendEntriesReply h st h' t es r = (st', ms) -> (type st' = type st /\ currentTerm st' = currentTerm st) \/ (type st' = Follower /\ currentTerm st' >= currentTerm st).
Lemma handleRequestVote_type : forall st h h' t lli llt st' m, handleRequestVote h st t h' lli llt = (st', m) -> (type st' = type st /\ currentTerm st' = currentTerm st) \/ type st' = Follower.
Lemma handleRequestVote_type_term : forall st h h' t lli llt st' m, handleRequestVote h st t h' lli llt = (st', m) -> (type st' = type st /\ currentTerm st' = currentTerm st) \/ (type st' = Follower /\ currentTerm st' >= currentTerm st).
Lemma handleRequestVoteReply_type : forall h st h' t r st', handleRequestVoteReply h st h' t r = st' -> (type st' = type st /\ currentTerm st' = currentTerm st) \/ (type st' = Follower /\ currentTerm st' > currentTerm st) \/ (type st = Candidate /\ type st' = Leader /\ currentTerm st' = currentTerm st).
Lemma handleClientRequest_type : forall h st client id c out st' l, handleClientRequest h st client id c = (out, st', l) -> type st' = type st /\ currentTerm st' = currentTerm st.
Lemma handleClientRequest_currentTerm : forall h st client id c out st' l, handleClientRequest h st client id c = (out, st', l) -> currentTerm st' = currentTerm st.
Lemma handleTimeout_type : forall h st out st' l, handleTimeout h st = (out, st', l) -> (type st' = type st /\ currentTerm st' = currentTerm st) \/ type st' = Candidate.
Lemma handleTimeout_type_strong : forall h st out st' l, handleTimeout h st = (out, st', l) -> (type st' = type st /\ currentTerm st' = currentTerm st) \/ (type st' = Candidate /\ currentTerm st' = S (currentTerm st)).
Lemma doGenericServer_type : forall h st os st' ms, doGenericServer h st = (os, st', ms) -> type st' = type st /\ currentTerm st' = currentTerm st.
Lemma doLeader_type : forall st h os st' ms, doLeader st h = (os, st', ms) -> type st' = type st /\ currentTerm st' = currentTerm st.
Lemma doLeader_log : forall st h os st' ms, doLeader st h = (os, st', ms) -> log st' = log st.
Lemma handleAppendEntriesReply_log : forall h st h' t es r st' ms, handleAppendEntriesReply h st h' t es r = (st', ms) -> log st' = log st.
Lemma handleRequestVoteReply_log : forall h st h' t r st', handleRequestVoteReply h st h' t r = st' -> log st' = log st.
Lemma handleRequestVoteReply_log_rewrite : forall h st h' t r, log (handleRequestVoteReply h st h' t r) = log st.
Theorem handleAppendEntries_not_append_entries : forall h st t n pli plt es ci st' m, handleAppendEntries h st t n pli plt es ci = (st', m) -> ~ is_append_entries m.
Lemma handleAppendEntries_clientCache: forall h st (d : raft_data) (m : msg) (t : term) (n : name) (pli : logIndex) (plt : term) (es : list entry) (ci : logIndex), handleAppendEntries h st t n pli plt es ci = (d, m) -> clientCache d = clientCache st.
Lemma handleAppendEntriesReply_clientCache: forall h st (d : raft_data) (m : list (name * msg)) (t : nat) (es : list entry) (res : bool) h', handleAppendEntriesReply h st h' t es res = (d, m) -> clientCache d = clientCache st.
Lemma advanceCurrentTerm_clientCache : forall st t, clientCache (advanceCurrentTerm st t) = clientCache st.
Theorem handleTimeout_clientCache : forall h st out st' ps, handleTimeout h st = (out, st', ps) -> clientCache st' = clientCache st.
Theorem handleClientRequest_clientCache: forall h st client id c out st' ps, handleClientRequest h st client id c = (out, st', ps) -> clientCache st' = clientCache st.
Lemma tryToBecomeLeader_clientCache : forall n st out st' ms, tryToBecomeLeader n st = (out, st', ms) -> clientCache st' = clientCache st.
Lemma handleRequestVote_clientCache : forall n st t c li lt st' ms, handleRequestVote n st t c li lt = (st', ms) -> clientCache st' = clientCache st.
Lemma handleRequestVoteReply_clientCache : forall n st src t v, clientCache (handleRequestVoteReply n st src t v) = clientCache st.
Lemma doLeader_clientCache : forall st h os st' ms, doLeader st h = (os, st', ms) -> clientCache st' = clientCache st.
Lemma handleAppendEntries_stateMachine: forall h st (d : raft_data) (m : msg) (t : term) (n : name) (pli : logIndex) (plt : term) (es : list entry) (ci : logIndex), handleAppendEntries h st t n pli plt es ci = (d, m) -> stateMachine d = stateMachine st.
Lemma handleAppendEntriesReply_stateMachine: forall h st (d : raft_data) (m : list (name * msg)) (t : nat) (es : list entry) (res : bool) h', handleAppendEntriesReply h st h' t es res = (d, m) -> stateMachine d = stateMachine st.
Lemma advanceCurrentTerm_stateMachine : forall st t, stateMachine (advanceCurrentTerm st t) = stateMachine st.
Theorem handleTimeout_stateMachine : forall h st out st' ps, handleTimeout h st = (out, st', ps) -> stateMachine st' = stateMachine st.
Theorem handleClientRequest_stateMachine: forall h st client id c out st' ps, handleClientRequest h st client id c = (out, st', ps) -> stateMachine st' = stateMachine st.
Lemma tryToBecomeLeader_stateMachine : forall n st out st' ms, tryToBecomeLeader n st = (out, st', ms) -> stateMachine st' = stateMachine st.
Lemma handleRequestVote_stateMachine : forall n st t c li lt st' ms, handleRequestVote n st t c li lt = (st', ms) -> stateMachine st' = stateMachine st.
Lemma handleRequestVoteReply_stateMachine : forall n st src t v, stateMachine (handleRequestVoteReply n st src t v) = stateMachine st.
Lemma doLeader_stateMachine : forall st h os st' ms, doLeader st h = (os, st', ms) -> stateMachine st' = stateMachine st.
Lemma uniqueIndices_elim_eq : forall xs x y, uniqueIndices xs -> In x xs -> In y xs -> eIndex x = eIndex y -> x = y.
Lemma sorted_cons : forall xs a, sorted xs -> (forall a', In a' xs -> eIndex a > eIndex a' /\ eTerm a >= eTerm a') -> sorted (a :: xs).
Lemma sorted_subseq : forall ys xs, subseq xs ys -> sorted ys -> sorted xs.
Theorem maxTerm_is_max : forall l e, sorted l -> In e l -> maxTerm l >= eTerm e.
Theorem maxIndex_is_max : forall l e, sorted l -> In e l -> maxIndex l >= eIndex e.
Theorem S_maxIndex_not_in : forall l e, sorted l -> eIndex e = S (maxIndex l) -> ~ In e l.
Lemma maxIndex_non_empty : forall l, l <> nil -> exists e, In e l /\ maxIndex l = eIndex e /\ maxTerm l = eTerm e.
Lemma removeAfterIndex_subseq : forall l i, subseq (removeAfterIndex l i) l.
Lemma removeAfterIndex_sorted : forall l i, sorted l -> sorted (removeAfterIndex l i).
Lemma removeAfterIndex_in : forall l i a, In a (removeAfterIndex l i) -> In a l.
Lemma findAtIndex_not_in : forall l e, sorted l -> findAtIndex l (eIndex e) = None -> ~ In e l.
Lemma findAtIndex_in : forall l i e', findAtIndex l i = Some e' -> In e' l.
Lemma findAtIndex_index : forall l i e', findAtIndex l i = Some e' -> i = eIndex e'.
Lemma NoDup_removeAfterIndex : forall l i, NoDup l -> NoDup (removeAfterIndex l i).
Lemma candidateEntries_wonElection : forall (net : network (params := raft_refined_multi_params)) e h, one_vote_per_term net -> cronies_votes net -> votes_received_cronies net -> candidateEntries e (nwState net) -> currentTerm (snd (nwState net h)) = eTerm e -> wonElection (dedup name_eq_dec (votesReceived (snd (nwState net h)))) = true -> type (snd (nwState net h)) <> Candidate.
Lemma wonElection_candidateEntries_rvr : forall (net : network (params := raft_refined_multi_params)) p e, votes_correct net -> cronies_correct net -> candidateEntries e (nwState net) -> In p (nwPackets net) -> pBody p = RequestVoteReply (eTerm e) true -> currentTerm (snd (nwState net (pDst p))) = eTerm e -> wonElection (dedup name_eq_dec (pSrc p :: votesReceived (snd (nwState net (pDst p))))) = true -> type (snd (nwState net (pDst p))) <> Candidate.
Lemma candidateEntries_ext : forall e sigma sigma', (forall h, sigma' h = sigma h) -> candidateEntries e sigma -> candidateEntries e sigma'.
Lemma candidateEntries_same : forall (st st' : name -> _) e, candidateEntries e st -> (forall h, cronies (fst (st' h)) = cronies (fst (st h))) -> (forall h, currentTerm (snd (st' h)) = currentTerm (snd (st h))) -> (forall h, type (snd (st' h)) = type (snd (st h))) -> candidateEntries e st'.
Lemma won_election_cronies : forall net h, cronies_correct net -> type (snd (nwState net h)) = Leader -> wonElection (dedup name_eq_dec (cronies (fst (nwState net h)) (currentTerm (snd (nwState net h))))) = true.
Lemma handleRequestVoteReply_preserves_candidate_entries : forall net h h' t r st' e, st' = handleRequestVoteReply h (snd (nwState net h)) h' t r -> refined_raft_intermediate_reachable net -> candidateEntries e (nwState net) -> candidateEntries e (update name_eq_dec (nwState net) h (update_elections_data_requestVoteReply h h' t r (nwState net h), st')).
Lemma doLeader_st : forall st h os st' ms, doLeader st h = (os, st', ms) -> votesReceived st' = votesReceived st /\ currentTerm st' = currentTerm st /\ type st' = type st.
Lemma doLeader_preserves_candidateEntries : forall net gd d h os d' ms e, nwState net h = (gd, d) -> doLeader d h = (os, d', ms) -> candidateEntries e (nwState net) -> candidateEntries e (update name_eq_dec (nwState net) h (gd, d')).
Lemma ghost_packet : forall (net : network (params := raft_refined_multi_params)) p, In p (nwPackets net) -> In (deghost_packet p) (nwPackets (deghost net)).
Lemma pDst_deghost_packet : forall p : packet (params := raft_refined_multi_params), pDst (deghost_packet p) = pDst p.
Lemma input_serialize_deserialize_id : serialize_deserialize_id_spec serialize_input deserialize_input.