Section OracleMapHybrid.
Variable A B C State S_A : Set.
Variable b : B.
Hypothesis eqdA : EqDec A.
Hypothesis eqdB : EqDec B.
Hypothesis eqdState : EqDec State.
Hypothesis eqdS_A : EqDec S_A.
Variable A1 : Comp (State * (list A * S_A)).
Variable A2 : S_A -> list B -> Comp bool.
Hypothesis A1_wf : well_formed_comp A1.
Hypothesis A2_wf :
forall s_A lsb, well_formed_comp (A2 s_A lsb).
Variable q : nat.
Variable k : Rat.
Hypothesis max_queries :
forall ls s s_A,
In (s, (ls, s_A)) (getSupport A1) ->
(length ls <= q)%nat.
Variable O1 O2 : State -> A -> Comp (B * State).
Hypothesis O1_wf :
forall s a,
well_formed_comp (O1 s a).
Hypothesis O2_wf :
forall s a,
well_formed_comp (O2 s a).
Definition OMH_G O :=
[s, p] <-$2 A1;
[lsa, s_A] <-2 p;
[lsb, _] <-$2 oracleMap _ _ O s lsa;
A2 s_A lsb.
Definition OMH_G_i i :=
[s, p] <-$2 A1;
[lsa, s_A] <-2 p;
[lsb1, s'] <-$2 oracleMap _ _ O1 s (firstn i lsa);
[lsb2, _] <-$2 oracleMap _ _ O2 s' (skipn i lsa);
A2 s_A (lsb1 ++ lsb2).
Hypothesis adjacent_close :
forall i,
| Pr[OMH_G_i i] - Pr[OMH_G_i (S i)] | <= k.
Definition OMH_G_oc (p : list A * S_A) :=
[lsa, s_A] <-2 p;
lsb <--$ oc_compMap _ (fun a => OC_Query _ a) lsa;
$ A2 s_A lsb.
intuition.
econstructor.
apply oc_compMap_wf.
intuition.
econstructor.
intuition.
econstructor.
auto.
Qed.

Theorem OMH_G_oc_equiv :
forall O,
Pr[OMH_G O] ==
Pr[
[s, s_A] <-$2 A1;
[b, _] <-$2 (OMH_G_oc s_A) _ _ O s;
ret b
].