(* Copyright 2012-2015 by Adam Petcher.				* * Use of this source code is governed by the license described	* * in the LICENSE file at the root of the source tree.		*)
Set Implicit Arguments.
Local Open Scope list_scope.
Notation "'query' v" := (OC_Query  _ v) (at level 79) : comp_scope.
Fixpoint oc_compMap(A B C D : Set)(eqdb : EqDec B)(c : A -> OracleComp C D B)(ls : list A) : OracleComp C D (list B) :=
match ls with
| nil => $ (ret nil)
| a :: ls' =>
b <--$ c a;
lsb' <--$ oc_compMap _ c ls';
$ (ret (b :: lsb'))
end.
induction ls1; inversion 1; subst; intuition; simpl in *.
comp_simp.
eapply comp_spec_ret; simpl; econstructor.
simpl.
comp_skip.
comp_simp.
comp_skip.
comp_simp.
eapply comp_spec_ret; intuition.
simpl.
econstructor; eauto.
Qed.

Theorem oc_compMap_eq :
forall (A B C D : Set){eqd : EqDec D}(f1 f2 : A -> OracleComp B C D)(ls : list A) (S : Set){eqds : EqDec S} o (s : S),
(forall s a, comp_spec
eq
((f1 a) _ _ o s)
((f2 a) _ _ o s)) ->
comp_spec
eq
((oc_compMap _ f1 ls) _ _ o s)
((oc_compMap _ f2 ls) _ _ o s).