Ltac start_unchanged :=
    red; intros; eapply one_leaderLog_per_term_unchanged; eauto; subst.(* solve invariant by lemma which shows leader logs do not change *)
  Ltac unchanged lem :=
    start_unchanged; apply lem.

(* Specifications: *)
Lemma one_leaderLog_per_term_client_request : refined_raft_net_invariant_client_request one_leaderLog_per_term.
Lemma one_leaderLog_per_term_timeout : refined_raft_net_invariant_timeout one_leaderLog_per_term.
Lemma one_leaderLog_per_term_append_entries : refined_raft_net_invariant_append_entries one_leaderLog_per_term.
Lemma one_leaderLog_per_term_append_entries_reply : refined_raft_net_invariant_append_entries_reply one_leaderLog_per_term.
Lemma one_leaderLog_per_term_request_vote : refined_raft_net_invariant_request_vote one_leaderLog_per_term.
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 wonElection_length : forall votes, wonElection votes = true -> length votes > div2 (length nodes).
Lemma pigeon_nodes : forall (q1 q2 : list name), NoDup q1 -> NoDup q2 -> length q1 > div2 (length nodes) -> length q2 > div2 (length nodes) -> exists v, In v q1 /\ In v q2.
Lemma contradiction_case : forall (net : network ) t ll ll' (h h' : name) (p : packet (params := refined_multi_params (multi_params := multi_params))) t0 v xs ys, refined_raft_intermediate_reachable net -> pBody p = RequestVoteReply (raft_params := raft_params) t0 v -> nwPackets net = xs ++ p :: ys -> In (t, ll) (leaderLogs (fst (nwState net h))) -> In (t, ll') (leaderLogs (update_elections_data_requestVoteReply (pDst p) (pSrc p) t0 v (nwState net (pDst p)))) -> pDst p = h' -> pDst p <> h -> False.
Lemma one_leaderLog_per_term_request_vote_reply : refined_raft_net_invariant_request_vote_reply one_leaderLog_per_term.
Lemma one_leaderLog_per_term_do_leader : refined_raft_net_invariant_do_leader one_leaderLog_per_term.
Lemma one_leaderLog_per_term_do_generic_server : refined_raft_net_invariant_do_generic_server one_leaderLog_per_term.
Lemma one_leaderLog_per_term_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset one_leaderLog_per_term.
Lemma one_leaderLog_per_term_reboot : refined_raft_net_invariant_reboot one_leaderLog_per_term.
Lemma one_leaderLog_per_term_invariant : forall net, refined_raft_intermediate_reachable net -> one_leaderLog_per_term net.