Ltac prove_in :=
    match goal with
      | [ _ : nwPackets ?net = _,
              _ : In (?p : packet) _ |- _] =>
        assert (In p (nwPackets net)) by (repeat find_rewrite; do_in_app; intuition)
      | [ _ : nwPackets ?net = _,
              _ : pBody ?p = _ |- _] =>
        assert (In p (nwPackets net)) by (repeat find_rewrite; intuition)
    end.Notation is_append_entries m :=
    (exists t n prevT prevI entries c,
       m = AppendEntries t n prevT prevI entries c).

(* Specifications: *)
Lemma leader_sublog_invariant_same_state : forall net net', leader_sublog_host_invariant net -> (forall h, log (nwState net h) = log (nwState net' h)) -> (forall h, type (nwState net' h) = Leader -> type (nwState net h) = Leader /\ currentTerm (nwState net h) = currentTerm (nwState net' h)) -> leader_sublog_host_invariant net'.
Lemma leader_sublog_invariant_subset : forall net net', leader_sublog_invariant net -> (forall p, is_append_entries (pBody p) -> In p (nwPackets net') -> In p (nwPackets net)) -> (forall h, log (nwState net h) = log (nwState net' h)) -> (forall h, type (nwState net' h) = Leader -> type (nwState net h) = Leader /\ currentTerm (nwState net h) = currentTerm (nwState net' h)) -> leader_sublog_invariant net'.
Theorem leader_sublog_do_leader : raft_net_invariant_do_leader leader_sublog_invariant.
Lemma leader_sublog_client_request : raft_net_invariant_client_request leader_sublog_invariant.
Lemma leader_sublog_timeout : raft_net_invariant_timeout leader_sublog_invariant.
Lemma leader_sublog_append_entries : raft_net_invariant_append_entries leader_sublog_invariant.
Lemma leader_sublog_append_entries_reply : raft_net_invariant_append_entries_reply leader_sublog_invariant.
Lemma leader_sublog_request_vote : raft_net_invariant_request_vote leader_sublog_invariant.