(* 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.
Section PRF_Convert.
Variable K D R : Set.
Variable K' D' R' : Set.
Hypothesis D'_EqDec : EqDec D'.
Hypothesis R'_EqDec : EqDec R'.
Hypothesis D_EqDec : EqDec D.
Hypothesis R_EqDec : EqDec R.
Hypothesis K_EqDec : EqDec K.
Variable RndK' : Comp K'.
Variable RndR : Comp R.
Variable f : K -> D -> R.
Variable k_f : K' -> K.
Variable d_f : D' -> D.
Hypothesis d_f_1_1 :
forall x y,
x <> y ->
d_f x <> d_f y.
Variable r_f : R -> R'.
Definition f' (k : K')(d : D') : R' :=
r_f (f (k_f k) (d_f d)).
Definition RndR' :=
r <-$ RndR;
ret (r_f r).
Definition RndK :=
k <-$ RndK';
ret (k_f k).
Variable A : OracleComp D' R' bool.
Definition f'_o (x : unit)(d : D') : OracleComp D R (R' * unit) :=
r <--$ OC_Query _ (d_f d);
$ ret (r_f r, tt).
Definition A_f : OracleComp D R bool :=
[b, _] <--$2 OC_Run _ _ _ A f'_o tt;
$ ret b.

Theorem PRF_Convert_Adv :
PRF_Advantage RndK' RndR' f' _ _ A ==
PRF_Advantage RndK RndR f _ _ A_f.