Proof using olpti rri.
unfold refined_raft_net_invariant_do_leader, appendEntries_leader.
simpl.
intros.
find_apply_hyp_hyp.
intuition.
- repeat find_higher_order_rewrite.
update_destruct_simplify.
+ eapply appendEntries_leader_predicate_TTLM_preserved; eauto using doLeader_TTLM.
match goal with
| [ H : nwState ?net ?h = (?gd, ?d) |- _ ] =>
replace d with (snd (nwState net h)) in * by (rewrite H; auto)
end.
eauto.
+ eauto.
- do_in_map. subst. simpl in *.
repeat find_higher_order_rewrite.
find_copy_eapply_lem_hyp (doLeader_message_entries d);
match goal with
| [ H : nwState ?net ?h = (?gd, ?d) |- _ ] =>
replace d with (snd (nwState net h)) in * by (rewrite H; auto)
end; eauto; break_and.
update_destruct_simplify.
+ erewrite doLeader_same_log; eauto.
+ exfalso. eauto using lifted_one_leader_per_term.
Qed.

Lemma doGenericServer_TTLM :
forall h st os st' ps,
doGenericServer h st = (os, st', ps) ->
type_term_log_monotonic st st'.