Ltac start :=
    repeat match goal with
             | [ H : _ |- _ ] =>
               rewrite update_fun_comm with (f := fst) in H
             | [ H : _ |- _ ] =>
               rewrite update_fun_comm with (f := snd) in H
             | [ H : _ |- _ ] =>
               rewrite update_fun_comm with (f := leaderLogs) in H
           end;
  rewrite update_fun_comm with (f := snd);
  simpl in *;
  match goal with
    | [ H : context [ type ] |- _ ] =>
      rewrite update_fun_comm in H;
        rewrite update_nop_ext' in H by auto
  end;
  match goal with
    | [ H : context [ currentTerm ] |- _ ] =>
      rewrite update_fun_comm in H;
        rewrite update_nop_ext' in H by auto
  end.

(* Specifications: *)
Theorem leaderLogs_sublog_client_request : refined_raft_net_invariant_client_request leaderLogs_sublog.
Theorem leaderLogs_sublog_timeout : refined_raft_net_invariant_timeout leaderLogs_sublog.
Lemma handleAppendEntries_leader : forall h st t n pli plt es ci st' m, handleAppendEntries h st t n pli plt es ci = (st', m) -> type st' = Leader -> log st' = log st.
Theorem leaderLogs_sublog_append_entries : refined_raft_net_invariant_append_entries leaderLogs_sublog.
Theorem leaderLogs_sublog_append_entries_reply : refined_raft_net_invariant_append_entries_reply leaderLogs_sublog.
Theorem leaderLogs_sublog_request_vote : refined_raft_net_invariant_request_vote leaderLogs_sublog.
Lemma lifted_leader_sublog_host : forall net leader h e, refined_raft_intermediate_reachable net -> type (snd (nwState net leader)) = Leader -> In e (log (snd (nwState net h))) -> eTerm e = currentTerm (snd (nwState net leader)) -> In e (log (snd (nwState net leader))).
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 contradict_leaderLogs_term_sanity : forall net h t ll e, refined_raft_intermediate_reachable net -> In (t, ll) (leaderLogs (fst (nwState net h))) -> In e ll -> eTerm e = currentTerm (snd (nwState net h)) -> False.
Lemma leaderLogs_candidate_entries_rvr : forall net, leaderLogs_candidateEntries net -> votes_correct net -> cronies_correct net -> forall p h t ll e, In (t, ll) (leaderLogs (fst (nwState net h))) -> In e ll -> 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.
Theorem leaderLogs_sublog_request_vote_reply : refined_raft_net_invariant_request_vote_reply leaderLogs_sublog.
Theorem leaderLogs_sublog_do_leader : refined_raft_net_invariant_do_leader leaderLogs_sublog.
Theorem leaderLogs_sublog_do_generic_server : refined_raft_net_invariant_do_generic_server leaderLogs_sublog.
Theorem leaderLogs_sublog_state_same_packet_subset : refined_raft_net_invariant_state_same_packet_subset leaderLogs_sublog.
Theorem leaderLogs_sublog_reboot : refined_raft_net_invariant_reboot leaderLogs_sublog.
Theorem leaderLogs_sublog_invariant : forall net, refined_raft_intermediate_reachable net -> leaderLogs_sublog net.