Proof using lmi rri.
intros.
find_apply_lem_hyp lifted_log_matching.
unfold log_matching, log_matching_hosts in *.
intuition; repeat rewrite <- deghost_spec with (net0 := net).
- auto.
- match goal with
| [ H : _ |- _ ] => solve [apply H; rewrite deghost_spec; auto]
end.
- match goal with
| [ H : _ |- _ ] => solve [eapply H; rewrite deghost_spec; eauto]
end.
Qed.

Lemma lifted_log_matching_nw :
forall net,
refined_raft_intermediate_reachable net ->
forall p t leaderId prevLogIndex prevLogTerm entries leaderCommit,
In p (nwPackets net) ->
pBody p = AppendEntries t leaderId prevLogIndex prevLogTerm entries leaderCommit ->
(forall h e1 e2,
In e1 entries ->
In e2 (log (snd (nwState net h))) ->
eIndex e1 = eIndex e2 ->
eTerm e1 = eTerm e2 ->
(forall e3,
eIndex e3 <= eIndex e1 ->
In e3 entries ->
In e3 (log (snd (nwState net h)))) /\
(prevLogIndex <> 0 ->
exists e4,
eIndex e4 = prevLogIndex /\
eTerm e4 = prevLogTerm /\
In e4 (log (snd (nwState net h))))) /\
(forall i,
prevLogIndex < i <= maxIndex entries ->
exists e,
eIndex e = i /\
In e entries) /\
(forall e,
In e entries ->
prevLogIndex < eIndex e).