Proof using.
unfold candidateEntriesTerm.
intros. break_exists_exists.
break_and.
update_destruct_simplify; auto.
split.
- match goal with
| [ H : nwState ?net ?h = (?x, _) |- _ ] =>
replace (x) with (fst (nwState net h)) in * by (rewrite H; auto)
end.
intuition.
- match goal with
| [ H : nwState ?net ?h = (_, ?x) |- _ ] =>
replace (x) with (snd (nwState net h)) in * by (rewrite H; auto); clear H
end.
find_apply_lem_hyp doLeader_type.
intuition. subst. repeat find_rewrite.
auto.
Qed.

Lemma getNextIndex_ext :
forall st st' h,
nextIndex st' = nextIndex st ->
log st' = log st ->
getNextIndex st' h = getNextIndex st h.