Proof using misi.
intros. symmetry.
unfold handleInput in *. break_match; repeat break_let; repeat find_inversion.
- apply applied_entries_log_lastApplied_update_same;
eauto using handleTimeout_log_same, handleTimeout_lastApplied.
- apply applied_entries_safe_update; eauto using handleClientRequest_lastApplied.
destruct (log st') using (handleClientRequest_log_ind ltac:(eauto)); auto.
simpl in *. break_if; auto.
exfalso.
do_bool.
find_apply_lem_hyp max_index_sanity_invariant.
unfold maxIndex_sanity, maxIndex_lastApplied in *.
intuition.
match goal with
| H : forall _, _ |- _ => specialize (H h)
end. omega.
Qed.

(* Specifications: *)
Lemma handleInput_log :
forall net h inp os st' ms h' e,
raft_intermediate_reachable net ->
handleInput h inp (nwState net h) = (os, st', ms) ->
In e (log (update name_eq_dec (nwState net) h st' h')) ->
(applied_implies_input_state (eClient e) (eId e) (eInput e) net \/
inp = ClientRequest (eClient e) (eId e) (eInput e)).