Ltac prog_assoc_r :=
    eapply comp_spec_eq_trans_r; [ idtac | eapply comp_spec_assoc].(* A bounded repeat based on fold. *)
Definition repeatMax(A : Set)(eqd : EqDec A)(c : Comp A)(P : A -> bool) def (n : nat):=
  compFold _ (fun a' i => if (P a') then (ret a') else c) def (allNatsLt n).

Theorem compMap_fold_equiv : forall (A B : Set)(eqd : EqDec B)(c : A -> Comp B)(ls : list A), comp_spec eq (compMap eqd c ls) (compMap_fold eqd c ls).