Proof using.
intros.
destruct (fold_left_maximum_cases l x).
- find_rewrite. auto.
- break_exists. break_and. find_rewrite. eauto.
Qed.

(* Specifications: *)
Lemma doLeader_same_commitIndex :
forall st n os st' ms,
doLeader st n = (os, st', ms) ->
sorted (log st) ->
commitIndex st <= maxIndex (log st) ->
commitIndex st' <= maxIndex (log st').