Definition lifted_no_entries_past_current_term_host net :=
    forall (h : name) e,
      In e (log (snd (nwState net h))) ->
      eTerm e <= currentTerm (snd (nwState net h)).

(* Specifications: *)
Lemma lifted_no_entries_past_current_term_host_invariant : forall (net : @network _ raft_msg_refined_multi_params), msg_refined_raft_intermediate_reachable net -> lifted_no_entries_past_current_term_host net.
Lemma all_the_way_deghost_spec : forall (net : ghost_log_network) h, snd (nwState net h) = nwState (deghost (mgv_deghost net)) h.
Lemma all_the_way_simulation_1 : forall (net : ghost_log_network), msg_refined_raft_intermediate_reachable net -> raft_intermediate_reachable (deghost (mgv_deghost net)).
Lemma lifted_maxIndex_sanity_client_request : msg_refined_raft_net_invariant_client_request lifted_maxIndex_sanity.
Lemma lifted_maxIndex_sanity_timeout : msg_refined_raft_net_invariant_timeout lifted_maxIndex_sanity.
Lemma handleAppendEntries_lastApplied : forall h st t n pli plt es ci st' m, handleAppendEntries h st t n pli plt es ci = (st', m) -> lastApplied st' = lastApplied st.
Lemma sorted_maxIndex_app : forall l1 l2, sorted (l1 ++ l2) -> maxIndex l2 <= maxIndex (l1 ++ l2).
Lemma max_min_thing: forall a b c, a <= c -> max a (min b c) <= c.
Lemma in_ghost_packet : forall (net : network (params := raft_refined_multi_params)) p, In p (nwPackets net) -> In (deghost_packet p) (nwPackets (deghost net)).
Lemma in_mgv_ghost_packet : forall (net : ghost_log_network) p, In p (nwPackets net) -> In (mgv_deghost_packet p) (nwPackets (mgv_deghost net)).
Lemma pBody_deghost_packet : forall (p : packet (params := raft_refined_multi_params)), pBody (deghost_packet p) = pBody p.
Lemma pDst_deghost_packet : forall (p : packet (params := raft_refined_multi_params)), pDst (deghost_packet p) = pDst p.
Lemma pDst_mgv_deghost_packet : forall (p : ghost_log_packet), pDst (mgv_deghost_packet p) = pDst p.
Lemma pBody_mgv_deghost_packet : forall (p : ghost_log_packet), pBody (mgv_deghost_packet p) = snd (pBody p).
Lemma lifted_handleAppendEntries_logs_sorted : forall (net : ghost_log_network) (p : ghost_log_packet) t n pli plt es ci st' m, msg_refined_raft_intermediate_reachable net -> handleAppendEntries (pDst p) (snd (nwState net (pDst p))) t n pli plt es ci = (st', m) -> snd (pBody p) = AppendEntries t n pli plt es ci -> In p (nwPackets net) -> sorted (log st').
Lemma contiguous_range_exact_lo_elim_exists : forall es lo i, contiguous_range_exact_lo es lo -> lo < i <= maxIndex es -> exists e, eIndex e = i /\ In e es.
Lemma contiguous_range_exact_lo_elim_lt : forall es lo e, contiguous_range_exact_lo es lo -> In e es -> lo < eIndex e.
Lemma lifted_sms_nw : forall (net : network (params := raft_refined_multi_params)) h p t leaderId prevLogIndex prevLogTerm entries leaderCommit e, state_machine_safety (deghost net) -> In p (nwPackets net) -> pBody p = AppendEntries t leaderId prevLogIndex prevLogTerm entries leaderCommit -> t >= currentTerm (snd (nwState net h)) -> commit_recorded (deghost net) h e -> (prevLogIndex > eIndex e \/ (prevLogIndex = eIndex e /\ prevLogTerm = eTerm e) \/ eIndex e > maxIndex entries \/ In e entries).
Lemma msg_lifted_sms_nw : forall (net : ghost_log_network) h p t leaderId prevLogIndex prevLogTerm entries leaderCommit e, state_machine_safety (deghost (mgv_deghost net)) -> In p (nwPackets net) -> snd (pBody p) = AppendEntries t leaderId prevLogIndex prevLogTerm entries leaderCommit -> t >= currentTerm (snd (nwState net h)) -> commit_recorded (deghost (mgv_deghost net)) h e -> (prevLogIndex > eIndex e \/ (prevLogIndex = eIndex e /\ prevLogTerm = eTerm e) \/ eIndex e > maxIndex entries \/ In e entries).
Lemma commit_recorded_lift_intro : forall (net : network (params := raft_refined_multi_params)) h e, In e (log (snd (nwState net h))) -> (eIndex e <= lastApplied (snd (nwState net h)) \/ eIndex e <= commitIndex (snd (nwState net h))) -> commit_recorded (deghost net) h e.
Lemma msg_commit_recorded_lift_intro : forall (net : ghost_log_network) h e, In e (log (snd (nwState net h))) -> (eIndex e <= lastApplied (snd (nwState net h)) \/ eIndex e <= commitIndex (snd (nwState net h))) -> commit_recorded (deghost (mgv_deghost net)) h e.
Lemma lifted_no_entries_past_current_term_host_invariant : forall (net : @network _ raft_msg_refined_multi_params), msg_refined_raft_intermediate_reachable net -> lifted_no_entries_past_current_term_host net.
Lemma ghost_log_sorted : forall net p, msg_refined_raft_intermediate_reachable net -> In p (nwPackets net) -> sorted (fst (pBody p)).
Lemma ghost_log_contiguous : forall net p, msg_refined_raft_intermediate_reachable net -> In p (nwPackets net) -> contiguous_range_exact_lo (fst (pBody p)) 0.