Proof using.
intros.
unfold handleMessage in *. break_match; repeat break_let; repeat find_inversion.
- find_apply_lem_hyp handleRequestVote_same_log.
update_destruct; subst; rewrite_update; repeat find_rewrite;
unfold applied_implies_input_state, correct_entry; eexists; intuition; eauto.
- update_destruct; subst; rewrite_update; repeat find_rewrite;
try find_rewrite_lem handleRequestVoteReply_same_log;
unfold applied_implies_input_state, correct_entry; eexists; intuition; eauto.
- update_destruct; subst; rewrite_update; repeat find_rewrite;
try solve [unfold applied_implies_input_state, correct_entry; eexists; intuition; eauto].
find_apply_lem_hyp handleAppendEntries_log. intuition.
+ repeat find_rewrite. unfold applied_implies_input_state, correct_entry; eexists; intuition; eauto.
+ subst.
unfold applied_implies_input_state, correct_entry; eexists; intuition; eauto.
right. repeat eexists; eauto. reflexivity.
+ repeat find_rewrite. do_in_app. intuition.
* unfold applied_implies_input_state, correct_entry; eexists; intuition; eauto.
right. repeat eexists; eauto. reflexivity.
* find_apply_lem_hyp removeAfterIndex_in.
unfold applied_implies_input_state, correct_entry; eexists; intuition; eauto.
- find_apply_lem_hyp handleAppendEntriesReply_log.
update_destruct; subst; rewrite_update; repeat find_rewrite;
unfold applied_implies_input_state, correct_entry; eexists; intuition; eauto.
Qed.

Lemma handleInput_applied_entries :
forall net h inp os st' ms,
raft_intermediate_reachable net ->
handleInput h inp (nwState net h) = (os, st', ms) ->
applied_entries (nwState net) = applied_entries (update name_eq_dec (nwState net) h st').