Section inner.
Variable client : clientId.
Variable id : nat.
Variable i : input.
Proof using.
unfold applied_implies_input_state.
intros.
break_exists_exists.
intuition.
break_exists.
simpl in *.
destruct (name_eq_dec h x0); rewrite_update; eauto.
Qed.
Proof using.
unfold applied_implies_input_state.
eauto 10.
Qed.
Proof using.
unfold applied_implies_input_state.
eauto 10.
Qed.
Proof using.
intros. unfold doGenericServer in *.
repeat break_match; find_inversion;
use_applyEntries_spec; simpl in *;
subst; auto.
Qed.
Proof using.
intros. unfold handleTimeout, tryToBecomeLeader in *.
break_match; find_inversion; subst; auto.
Qed.
Proof using.
unfold handleClientRequest.
intros.
break_match; find_inversion; simpl in *; intuition.
Qed.
Proof using.
unfold mEntries.
intros.
break_match; try discriminate.
find_inversion.
eauto 10.
Qed.
Proof using.
intros. unfold doGenericServer in *.
repeat break_match; find_inversion; subst; auto.
Qed.
Proof using.
unfold doLeader.
intros.
repeat break_match; repeat find_inversion; simpl in *; intuition.
do_in_map. subst. simpl in *. find_inversion.
eauto using findGtIndex_in.
Qed.
Proof using.
intros.
destruct inp; simpl in *.
- find_erewrite_lem handleTimeout_log.
exfalso. eauto using aiis_intro_state.
- destruct (log d') using (handleClientRequest_log_ind ltac:(eauto)).
+ exfalso. eauto using aiis_intro_state.
+ simpl in *.
break_or_hyp.
* subst. unfold in_input_trace. unfold correct_entry in *.
break_and. subst. simpl. eauto.
* exfalso. eauto using aiis_intro_state.
Qed.
Proof using.
unfold mEntries. intros. subst. auto.
Qed.
Proof using.
intros.
destruct (pBody p) eqn:?; simpl in *; repeat break_let; repeat find_inversion.
- find_erewrite_lem handleRequestVote_same_log. eauto using aiis_intro_state.
- find_erewrite_lem handleRequestVoteReply_same_log. eauto using aiis_intro_state.
- find_apply_lem_hyp handleAppendEntries_log. intuition; find_rewrite.
+ eauto using aiis_intro_state.
+ subst. eauto using mEntries_intro, aiis_intro_packet.
+ do_in_app. intuition.
* eauto using mEntries_intro, aiis_intro_packet.
* find_apply_lem_hyp removeAfterIndex_in.
eauto using aiis_intro_state.
- find_erewrite_lem handleAppendEntriesReply_same_log. eauto using aiis_intro_state.
Qed.
Proof using.
intros.
unfold handleRequestVote in *.
repeat (break_match; repeat (find_inversion; simpl in *));
intro; break_exists; discriminate.
Qed.
Proof using.
intros.
unfold handleAppendEntriesReply in *.
repeat (break_match; repeat (find_inversion; simpl in *)); intuition.
Qed.
Proof using.
unfold handleAppendEntries.
intros.
repeat break_match; find_inversion; intro; break_exists; discriminate.
Qed.
Proof using.
intros.
destruct (pBody p) eqn:?; simpl in *; repeat break_let; repeat find_inversion;
simpl in *; intuition; subst; simpl in *.
- exfalso. eapply handleRequestVote_doesn't_send_AE; eauto using mEntries_some_is_applied_entries.
- exfalso. eapply handleAppendEntries_doesn't_send_AE; eauto using mEntries_some_is_applied_entries.
- exfalso.
eapply handleAppendEntriesReply_doesn't_send_AE;
eauto using mEntries_some_is_applied_entries.
Qed.
Proof using.
intros.
match goal with
| [ H : context [step_failure _ _ _ ] |- _ ] => invcs H
end.
- unfold RaftNetHandler in *. repeat break_let. subst. find_inversion.
find_apply_lem_hyp applied_implies_input_update_split.
break_exists. intuition; break_exists.
+ find_erewrite_lem doGenericServer_log.
find_erewrite_lem doLeader_same_log.
exfalso. eauto using aiis_intro_state, handleMessage_aais.
+ exfalso. eauto using aiis_intro_state.
+ intuition. do_in_app. intuition.
* do_in_map. subst. simpl in *.
{ repeat (do_in_app; intuition).
- exfalso. eauto using aiis_intro_state, handleMessage_sends_log.
- find_eapply_lem_hyp doLeader_messages; eauto.
exfalso. eauto using aiis_intro_state, handleMessage_aais.
- exfalso. eauto using doGenericServer_packets.
}
* exfalso. eauto using aiis_intro_packet.
- unfold RaftInputHandler in *. repeat break_let. subst. find_inversion.
find_apply_lem_hyp applied_implies_input_update_split.
break_exists. intuition; break_exists.
+ find_erewrite_lem doGenericServer_log.
find_erewrite_lem doLeader_same_log.
eauto using handleInputs_aais.
+ exfalso. eauto using aiis_intro_state.
+ intuition. do_in_app. intuition.
* do_in_map. subst. simpl in *.
{ repeat (do_in_app; intuition).
- destruct inp; simpl in *.
+ exfalso. eapply handleTimeout_not_is_append_entries; eauto.
eauto using mEntries_some_is_applied_entries.
+ exfalso. eauto using handleClientRequest_no_messages.
- find_eapply_lem_hyp doLeader_messages; eauto.
eauto using handleInputs_aais.
- exfalso. eauto using doGenericServer_packets.
}
* exfalso. eauto using aiis_intro_packet.
- unfold applied_implies_input_state in H2.
break_exists. intuition; break_exists; simpl in *.
+ exfalso; eauto  using aiis_intro_state.
+ break_and. simpl in *.
exfalso. eauto using aiis_intro_packet.
- unfold applied_implies_input_state in H2.
break_exists. intuition; break_exists; simpl in *.
+ exfalso; eauto  using aiis_intro_state.
+ intuition.
* subst. exfalso. eauto using aiis_intro_packet.
* exfalso. apply H1. eapply aiis_intro_packet; eauto.
congruence.
- congruence.
- unfold applied_implies_input_state in H2.
break_exists. intuition; break_exists; simpl in *.
+ update_destruct_max_simplify; exfalso; eauto using aiis_intro_state.
+ intuition.
exfalso. eauto using aiis_intro_packet.
Qed.
Definition aiis_host (net : network) : Prop :=
exists h e,
correct_entry client id i e /\
In e (log (nwState net h)).

Lemma name_dec :
forall (P : name -> Prop)
(P_dec : forall x, {P x} + {~P x}),
{exists x, P x} + {~ exists x, P x}.