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 list_pred_app : forall (A B : Set)(P : A -> B -> Prop)(lsa1 lsa2 : list A)(lsb : list B), list_pred P (lsa1 ++ lsa2) lsb -> list_pred P lsa1 (firstn (length lsa1) lsb) * list_pred P lsa2 (skipn (length lsa1) lsb).