Section OWP_impl_HCP.
Variable n : nat.
(* f is a one-way permutation *)
Variable f : Bvector n -> Bvector n.
Variable f_inv : Bvector n -> Bvector n.
Hypothesis f_inv1 : forall v, f (f_inv v) = v.
Hypothesis f_inv2 : forall v, f_inv (f v) = v.
Variable A : Bvector (n + n) -> bool -> Comp bool.
Definition dotProduct(n : nat)(v1 v2 : Bvector n) :=
Vector.fold_left2 (fun acc b1 b2 => (xorb acc (andb b1 b2))) false v1 v2.
(* f' is a one-way function for vectors of length n + n *)
Definition f'(v : Bvector (n + n)) :=
Vector.append (f (firstPart n n v)) (secondPart n n v).
Definition b(v : Bvector (n + n)) := (dotProduct (firstPart n n v) (secondPart n n v)).
Definition OWP_HCP_B(v : Bvector n) : Comp (Bvector n) :=
ret v.

Theorem OWP_HCP :
HCP_Advantage f' b A <= (OWP_Advantage f OWP_HCP_B).