(* 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.		*)
(* indistinguishability-based security definitions for encryption schemes. *)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export FCF.Hybrid.
Local Open Scope type_scope.
Local Open Scope comp_scope.
Local Open Scope nat_scope.
Local Open Scope list_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.
Section Encryption_SecretKey_concrete.
Variable Plaintext Ciphertext Key : Set.
Variable KeyGen : Comp Key.
Variable Encrypt : Key -> Plaintext -> Comp Ciphertext.
Variable Decrypt : Key -> Ciphertext -> Plaintext.
Section IND_CPA_SecretKey_concrete.
Variable State : Set.
Variable A1 : OracleComp Plaintext Ciphertext (Plaintext * Plaintext * State).
Variable A2 : State -> Ciphertext -> OracleComp Plaintext Ciphertext bool.
Hypothesis Ciphertext_EqDec : EqDec Ciphertext.
Hypothesis Plaintext_EqDec : EqDec Plaintext.
Definition EncryptOracle(k : Key)(x : unit)(p : Plaintext) :=
c <-$ Encrypt k p;
ret (c, tt).
Hypothesis Encrypt_wf :
forall k p,
well_formed_comp (Encrypt k p).

Theorem EncryptOracle_wf :
forall k x p,
well_formed_comp (EncryptOracle k x p).