Proof using nisi lmi si rri.
intros.
find_copy_apply_lem_hyp lift_log_matching.
find_copy_apply_lem_hyp lift_nextIndex_safety.
assert (pred (getNextIndex (snd (nwState net h)) h') > 0) by omega.
unfold log_matching, log_matching_hosts in *.
unfold nextIndex_safety in *.
match goal with
| H : forall _ _, type _ = _ -> _ |- _ => specialize (H h h')
end.
intuition.
match goal with
| H : forall _ _, _ <= _ <= _ -> _ |- _ =>
specialize (H h (pred (getNextIndex (snd (nwState net h)) h')))
end.
unfold raft_refined_base_params in *.
repeat find_rewrite_lem deghost_spec. intuition.
break_exists_exists. intuition.
apply findAtIndex_intro; eauto using lift_logs_sorted, sorted_uniqueIndices.
Qed.

Lemma sorted_findGtIndex_0 :
forall l,
(forall e, In e l -> eIndex e > 0) ->
sorted l ->
findGtIndex l 0 = l.