Proof using.
intros.
unfold update_elections_data_appendEntries in *.
repeat break_match; subst; simpl in *; auto.
find_apply_lem_hyp handleAppendEntriesReply_entries.
intuition. subst.
do_in_app. intuition.
do_in_map. repeat find_inversion. subst. simpl in *. auto.
Qed.

(* Specifications: *)
Lemma update_elections_data_appendEntries_allEntries_term' :
forall h st t h' pli plt es ci te e d m,
In (te, e) (allEntries (update_elections_data_appendEntries h st t h' pli plt es ci)) ->
handleAppendEntries h (snd st) t h' pli plt es
ci = (d, m) ->
In (te, e) (allEntries (fst st)) \/ (In e es /\ te = currentTerm d).