Section PrefixWithinTerm.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Context {rri : raft_refinement_interface}.
Context {llli : logs_leaderLogs_interface}.
Context {rlmli : refined_log_matching_lemmas_interface}.
Context {ollpti : one_leaderLog_per_term_interface}.
Context {llsi : leaderLogs_sorted_interface}.
Context {llsli : leaderLogs_sublog_interface}.
Context {lsli : leader_sublog_interface}.
Context {nisi : nextIndex_safety_interface}.
Context {llci : leaderLogs_contiguous_interface}.
Context {aelmi : allEntries_log_matching_interface}.
Context {aertsi : append_entries_request_term_sanity_interface}.
Context {aelsi : allEntries_leader_sublog_interface}.
Definition lift_leader_sublog :
forall net leader e h,
refined_raft_intermediate_reachable net ->
type (snd (nwState net leader)) = Leader ->
In e (log (snd (nwState net h))) ->
eTerm e = currentTerm (snd (nwState net leader)) ->
In e (log (snd (nwState net leader))).
Proof using lsli rri.
intros. pose proof lift_prop leader_sublog_host_invariant.
conclude_using ltac:(apply leader_sublog_invariant_invariant).
find_apply_hyp_hyp.
match goal with
| H : leader_sublog_host_invariant _ |- _ =>
specialize (H leader e h)
end.
repeat find_rewrite_lem deghost_spec. intuition.
Qed.

Lemma exists_deghosted_packet :
forall net (p : packet (params := raft_refined_multi_params (raft_params := raft_params))),
In p (nwPackets net) ->
exists q,
In q (nwPackets (deghost net)) /\ q = deghost_packet p.