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).

Lemma repeatMax_fold_in_support_false : forall (A B : Set)(ls : list B)(eqd : EqDec A)(c : B -> Comp A)(P : A -> bool)(a : A), (forall b, In b ls -> In a (getSupport (c b))) -> P a = false -> In a (getSupport (compFold eqd (fun (a' : A) b => if P a' then ret a' else (c b)) a ls)).