Section NoAppendEntriesRepliesToSelf.
Context {orig_base_params : BaseParams}.
Context {one_node_params : OneNodeParams orig_base_params}.
Context {raft_params : RaftParams orig_base_params}.
Context {naetsi : no_append_entries_to_self_interface}.
Proof using.
intros.
unfold doLeader in *.
repeat break_match; try solve [find_inversion; simpl in *; congruence].
find_inversion.
do_in_map.
subst. simpl in *.
find_apply_lem_hyp filter_In.
intuition. subst.
break_match; congruence.
Qed.
Proof using.
red. red. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
do_in_map.
subst. simpl in *.
find_eapply_lem_hyp doLeader_no_messages_to_self; eauto.
Qed.
Proof using.
red. red. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
do_in_map.
subst. simpl in *.
find_eapply_lem_hyp doGenericServer_packets. subst. simpl in *. intuition.
Qed.
Proof using naetsi.
red. red. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
subst. simpl in *. subst.
find_eapply_lem_hyp no_append_entries_to_self_invariant; eauto.
Qed.
Proof using.
red. red. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
do_in_map. subst. simpl in *.
find_apply_lem_hyp handleAppendEntriesReply_packets.
subst. intuition.
Qed.
Proof using.
red. red. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
subst. simpl in *. subst.
unfold handleRequestVote in *. repeat break_match; repeat find_inversion; congruence.
Qed.
Proof using.
red. red. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
Qed.
Proof using.
red. red. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
do_in_map. subst. simpl in *.
unfold handleClientRequest in *; repeat break_match; find_inversion; simpl in *; intuition.
Qed.
Proof using.
red. red. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
do_in_map. subst. simpl in *.
match goal with
| H : fst _ = _ |- _ => clear H
end.
unfold handleTimeout, tryToBecomeLeader in *;
repeat break_match; repeat find_injection; simpl in *; intuition;
do_in_map; subst; simpl in *; congruence.
Qed.
Proof using.
red. red. intros. simpl in *.
find_apply_hyp_hyp. intuition eauto.
Qed.
Proof using.
red. red. intros. simpl in *.
find_reverse_rewrite. intuition eauto.
Qed.
Proof using.
red. red. intros. simpl in *. intuition.
Qed.

Theorem no_append_entries_replies_to_self_invariant :
forall net,
raft_intermediate_reachable net ->
no_append_entries_replies_to_self net.