(**************************************************************************)
(*                                BELENIOS                                *)
(*                                                                        *)
(*  Copyright © 2012-2020 Inria                                           *)
(*                                                                        *)
(*  This program is free software: you can redistribute it and/or modify  *)
(*  it under the terms of the GNU Affero General Public License as        *)
(*  published by the Free Software Foundation, either version 3 of the    *)
(*  License, or (at your option) any later version, with the additional   *)
(*  exemption that compiling, linking, and/or using OpenSSL is allowed.   *)
(*                                                                        *)
(*  This program is distributed in the hope that it will be useful, but   *)
(*  WITHOUT ANY WARRANTY; without even the implied warranty of            *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *)
(*  Affero General Public License for more details.                       *)
(*                                                                        *)
(*  You should have received a copy of the GNU Affero General Public      *)
(*  License along with this program.  If not, see                         *)
(*  <http://www.gnu.org/licenses/>.                                       *)
(**************************************************************************)

<doc text="Serializable datatypes for homomorphic questions">

(** {2 Predefined types} *)

type 'a ciphertext <ocaml predef from="Serializable_core"> = abstract
type disjunctive_proof <ocaml predef from="Serializable_core"> = abstract

(** {2 Questions and answers} *)

type question = {
  answers : string list <ocaml repr="array">;
  ?blank : bool option;
  min : int;
  max : int;
  question : string;
} <ocaml field_prefix="q_">

type 'a answer = {
  choices : 'a ciphertext list <ocaml repr="array">;
  individual_proofs : disjunctive_proof list <ocaml repr="array">;
  overall_proof : disjunctive_proof;
  ?blank_proof : disjunctive_proof option;
}
<doc text="An answer to a question. It consists of a weight for each
choice, a proof that each of these weights is 0 or 1, and an overall
proof that the total weight is within bounds.">
