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.

Lemma handleMessage_aais :
forall client id i net p d' ms e,
~ applied_implies_input_state client id i net ->
In p (nwPackets net) ->
handleMessage (pSrc p) (pDst p) (pBody p) (nwState net (pDst p)) = (d', ms) ->
correct_entry client id i e ->
In e (log d') ->
False.