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.

Lemma lift_max_index_sanity : forall (net : ghost_log_network) h, msg_refined_raft_intermediate_reachable net -> maxIndex_sanity (deghost (mgv_deghost net)) -> lastApplied (snd (nwState net h)) <= maxIndex (log (snd (nwState net h))) /\ commitIndex (snd (nwState net h)) <= maxIndex (log (snd (nwState net h))).