Section TermSanityProof.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Proof using.
unfold no_entries_past_current_term_nw in *. intros.
simpl in *. find_apply_hyp_hyp. intuition eauto.
Qed.
Proof using.
unfold no_entries_past_current_term_nw. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
Qed.
Proof using.
intros. eapply no_entries_past_current_term_nw_only_new_packets_matter; eauto.
unfold no_entries_past_current_term_nw. intros. simpl in *.
do_in_map. subst. simpl in *.
find_apply_hyp_hyp.
exfalso. match goal with H : _ |- _ => apply H end.
repeat eexists; eauto.
Qed.
Proof using.
intros.
unfold no_entries_past_current_term_nw. intros. simpl in *. find_apply_hyp_hyp.
intuition.
- unfold no_entries_past_current_term_nw in *. eauto.
- subst. exfalso. match goal with H : _ |- _ => apply H end.
repeat eexists; eauto.
Qed.
Proof using.
unfold raft_net_invariant_init, no_entries_past_current_term.
intuition.
- unfold no_entries_past_current_term_host.
intros. simpl in *. intuition.
- unfold no_entries_past_current_term_nw.
intros. simpl in *. intuition.
Qed.
Proof using.
intros. unfold doLeader in *.
repeat break_match; find_inversion; subst; auto.
Qed.
Proof using.
unfold raft_net_invariant_do_leader, no_entries_past_current_term.
intuition.
- unfold no_entries_past_current_term_host in *.
intros. simpl in *.
find_apply_lem_hyp doLeader_spec.
find_higher_order_rewrite.
break_if;
subst; intuition;
repeat find_rewrite;
eauto.
- unfold no_entries_past_current_term_nw in *. intros; simpl in *.
find_apply_hyp_hyp. intuition eauto.
unfold doLeader in *.
repeat break_match; repeat find_inversion; try solve_by_inversion.
repeat do_in_map; subst; simpl in *; find_inversion.
find_apply_lem_hyp findGtIndex_in. eauto.
Qed.
Proof using.
intros. unfold doGenericServer in *.
repeat break_match; find_inversion; subst; intuition;
use_applyEntries_spec; subst; simpl in *; auto.
Qed.
Proof using.
unfold raft_net_invariant_do_generic_server, no_entries_past_current_term. intros.
find_apply_lem_hyp doGenericServer_spec. intuition.
- unfold no_entries_past_current_term_host in *.
intros. simpl in *.
find_higher_order_rewrite; break_match; eauto.
subst; repeat find_rewrite; eauto.
- eauto using no_entries_past_current_term_nw_no_append_entries.
Qed.

Lemma handleClientRequest_messages :
forall h d client id c os d' ms,
handleClientRequest h d client id c = (os, d', ms) ->
(forall m, In m ms -> ~ is_append_entries (snd m)).