Proof using.
red. unfold prefix_within_term_inductive. intros. subst.
match goal with
| H : nwState ?net ?h = (?gd, ?d) |- _ =>
replace gd with (fst (nwState net h)) in * by (rewrite H; reflexivity);
replace d with (snd (nwState net h)) in * by (rewrite H; reflexivity);
clear H
end.
find_copy_apply_lem_hyp doGenericServer_log.
find_apply_lem_hyp doGenericServer_packets.
subst. simpl in *.
intuition.
- unfold allEntries_leaderLogs_prefix_within_term in *.
intros. simpl in *.
repeat find_higher_order_rewrite.
destruct_update; simpl in *; eauto.
- unfold log_leaderLogs_prefix_within_term in *.
intros. simpl in *.
repeat find_higher_order_rewrite.
destruct_update; simpl in *; repeat find_rewrite; eauto.
- unfold allEntries_log_prefix_within_term in *.
intros. simpl in *.
repeat find_higher_order_rewrite.
destruct_update; simpl in *; repeat find_rewrite; eauto.
- unfold allEntries_append_entries_prefix_within_term_nw in *.
intros. simpl in *.
find_apply_hyp_hyp.
intuition;
match goal with
| H : forall _, _ _ = update _ _ _ _ _ |- _ =>
rewrite H in *
end;
destruct_update; simpl in *; eauto.
- unfold append_entries_leaderLogs_prefix_within_term in *.
intros. simpl in *.
find_apply_hyp_hyp.
intuition;
match goal with
| H : forall _, _ _ = update _ _ _ _ _ |- _ =>
rewrite H in *
end;
destruct_update; simpl in *; eauto.
- unfold append_entries_log_prefix_within_term in *.
intros. simpl in *.
find_apply_hyp_hyp.
intuition;
match goal with
| H : forall _, _ _ = update _ _ _ _ _ |- _ =>
rewrite H in *
end;
destruct_update; simpl in *; repeat find_rewrite; eauto.
Qed.

Lemma prefix_within_term_inductive_init :
refined_raft_net_invariant_init prefix_within_term_inductive.