Proof using.
unfold msg_refined_raft_net_invariant_reboot,
lifted_maxIndex_sanity, maxIndex_lastApplied, maxIndex_commitIndex.
unfold reboot.
intuition; find_higher_order_rewrite; update_destruct_simplify; auto with *;
repeat match goal with
| [ H : forall _ , _ |- _ ] => specialize (H h0)
end;
unfold mgv_refined_base_params, raft_refined_base_params, refined_base_params in *;
simpl in *;
repeat find_rewrite; simpl in *;
auto.
Qed.
Definition lifted_directly_committed (net : ghost_log_network) (e : entry) : Prop :=
exists quorum,
NoDup quorum /\
length quorum > div2 (length nodes) /\
(forall h, In h quorum -> In (eTerm e, e) (allEntries (fst (nwState net h)))).
Definition lifted_committed (net : ghost_log_network) (e : entry) (t : term) : Prop :=
exists h e',
eTerm e' <= t /\
lifted_directly_committed net e' /\
eIndex e <= eIndex e' /\
In e (log (snd (nwState net h))) /\ In e' (log (snd (nwState net h))).
Definition commit_invariant_host (net : ghost_log_network) : Prop :=
forall h e,
In e (log (snd (nwState net h))) ->
eIndex e <= commitIndex (snd (nwState net h)) ->
lifted_committed net e (currentTerm (snd (nwState net h))).
Definition commit_invariant_nw (net : ghost_log_network) : Prop :=
forall p t lid pli plt es lci e,
In p (nwPackets net) ->
snd (pBody p) = AppendEntries t lid pli plt es lci ->
In e (fst (pBody p)) ->
eIndex e <= lci ->
lifted_committed net e t.
Definition commit_invariant (net : ghost_log_network) : Prop :=
commit_invariant_host net /\
commit_invariant_nw net.

(* Specifications: *)
Lemma commit_invariant_init :
msg_refined_raft_net_invariant_init commit_invariant.