Proof using ctgli rri.
intros. eapply lift_prop; eauto using candidate_term_gt_log_invariant.
Qed.
Ltac term_sanity_start :=
red; unfold leaderLogs_term_sanity; simpl; intros.
Ltac term_sanity_start_update :=
term_sanity_start;
repeat find_higher_order_rewrite; update_destruct; rewrite_update; [|eauto].

Lemma leaderLogs_term_sanity_unchanged :
forall net st' h gd d ps',
leaderLogs_term_sanity net ->
(forall h' : Net.name, st' h' = update name_eq_dec (nwState net) h (gd, d) h') ->
leaderLogs gd = leaderLogs (fst (nwState net h)) ->
leaderLogs_term_sanity {| nwPackets := ps'; nwState := st' |}.