rewrite G1_eq_Gi_q.
rewrite G2_eq_Gi_0.
rewrite ratDistance_comm.
specialize (distance_le_prod_f (fun i => Pr[Gi i])); intuition.
Qed.
End OracleHybrid.
(* A specialization that uses OracleHybrid to produce a hybrid argument on non-adaptive oracle interactions *)
(* oracleMap is defined in PRF.  We should probably find a better place for it. *)
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.

(* Specifications: *)
Theorem OMH_G_oc_wf : forall p,
well_formed_oc (OMH_G_oc p).