1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889openBlsmoduleIdentities:sig(** The type for prover identities: functions from a (string) map of
polynomials in FFT evaluations form to a (string) map of evaluated
identities (also polynomials in FFT evaluations form). *)typeprover_identities=Evaluations.tSMap.t->Evaluations.tSMap.t(** The type for verifier identities: functions which map an evaluation point
ξ an a [PC.answer] into a (string) map of evaluated identities. *)typeverifier_identities=Scalar.t->Scalar.tSMap.tSMap.t->Scalar.tSMap.t(** The type for evaluation points. Either [X], [GX], or a custom point,
which must be specified by an evaluation point name paired with a
scalar that will multiply ξ. For example:
- [X] could be implemented as [Custom ("x", Scalar.one)]
- [GX] could be implemented as
[Custom ("gx", generator)]. *)typeeval_point=X|GX|Customofstring*Scalar.t[@@derivingrepr]valstring_of_eval_point:eval_point->string(** [convert_eval_points gen x points] maps the polynomial protocol
[points : eval_point list] into scalars, by evaluating the underlying
"composition" polynomial at [x].
The generator [gen] is used in case the [eval_point] equals [GX], in
which case the resulting scalar is [x * gen]. *)valconvert_eval_points:generator:Scalar.t->x:Scalar.t->eval_pointlist->Scalar.tSMap.t(** [get_answer answers p name] extracts the evaluation of polynomial [name]
at point [p] from the given [answers]. *)valget_answer:Scalar.tSMap.tSMap.t->eval_point->string->Scalar.t(** A function to merge a list of prover identities into one. *)valmerge_prover_identities:prover_identitieslist->prover_identities(** A function to merge a list of verifier identities into one. *)valmerge_verifier_identities:verifier_identitieslist->verifier_identitiesend=structtypeprover_identities=Evaluations.tSMap.t->Evaluations.tSMap.ttypeverifier_identities=Scalar.t->Scalar.tSMap.tSMap.t->Scalar.tSMap.ttypeeval_point=X|GX|Customofstring*Scalar.t[@@derivingrepr]letstring_of_eval_point=function|X->"x"|GX->"gx"|Custom(s,_)->sletconvert_eval_points~generator~xl=leteval=function|X->x|GX->Scalar.mulgeneratorx|Custom(_,f)->Scalar.mulfxinSMap.of_list@@List.map(funp->(string_of_eval_pointp,evalp))lletget_answeranswersxn=letx_map=SMap.find(string_of_eval_pointx)answersinmatchSMap.find_optnx_mapwith|Somex->x|None->raise(Invalid_argument(Printf.sprintf"Identities.get_answers : name '%s' not found in answers."n))letmerge_prover_identitiesidentities_list:prover_identities=funevaluations->List.fold_left(funacc_mapids->SMap.union_disjointacc_map(idsevaluations))SMap.emptyidentities_listletmerge_verifier_identitiesidentities_list:verifier_identities=funxanswers->List.fold_left(funacc_mapids->SMap.union_disjointacc_map(idsxanswers))SMap.emptyidentities_listendincludeIdentities