coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: mukesh tiwari <mukeshtiwari.iiitm AT gmail.com>
- To: Li-yao Xia <lysxia AT gmail.com>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Extracting Coq function into OCaml function
- Date: Sat, 1 Jun 2019 14:40:50 +1000
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mukeshtiwari.iiitm AT gmail.com; spf=Pass smtp.mailfrom=mukeshtiwari.iiitm AT gmail.com; spf=None smtp.helo=postmaster AT mail-it1-f195.google.com
- Ironport-phdr: 9a23:PKBVsxFPRNdoVg9og/NSap1GYnF86YWxBRYc798ds5kLTJ7zo8ywAkXT6L1XgUPTWs2DsrQY0rOQ6vu6EjxQqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5vIBmssAncuNcajYRhJ6sy1xDEvmZGd+NKyG1yOFmdhQz85sC+/J5i9yRfpfcs/NNeXKv5Yqo1U6VWACwpPG4p6sLrswLDTRaU6XsHTmoWiBtIDBPb4xz8Q5z8rzH1tut52CmdIM32UbU5Uims4qt3VBPljjoMOjgk+2/Vl8NwlrpWrx2vpxN9w4DaboKbOudgcKzBZt4aWXZNU9xNWyBdHo+xbY0CBPcBM+ZCqIn9okMDrR6jBQmvGuzv0T9IjWLq3a073eUuCxvG3A09FN8JtXTUsdb1O7kJUeC10KnIzDvCYOlM2Tf88oTIcxEhofCQXbJ1asfRxkwvGBnEjlWUs4DqIzSV1uEUvmWd8uFuW+Wvi2s9pAFwpDii3sgsiojVhoIV11DL7j91z5oyJd29UEJ7esKkH4FMuCGZMIt2XN0tQ3tmuCY+zb0Ht4S3czQNyJQiwRPUdv+Jc5CQ7x79SOqcJS10iXFldb6lmhq/8EmtxvfhWsSw0FtHqDdOnMPWuXAXzRPT79CKSvtj8Uel3jaCzwXT5ftFIUAwjKbbKoIhzqMpmpodrEjOGi/7lF/5jK+RcUUk9eyo5Pr9brr6oZ+cMpd4igD4MqswhsyyGfo0PhQKUmSB+umx1Kfv8VD4TbhLlPE6j63UvZDCKcQevKG5AgtV0og56xa4CjeryNEYnWQELF1bYxKHj5TpO1DAIf/iF/e/gk6gkDZqx/DHIr3hB47ALnfGkLj7fLZ971RQxxY0zdBa/55UEK0OIOrvWk/ts9zVFgM2Mwutw+r+FNp90p4eVnmUD6+CMKLStEeI6fg1L+mNYo8Vojf9JOI/6/7gl39q0WMaKI2omIoebziIH/0ud0GIemrti/8OFG4Lukw1S+m823OYVjsGYmuxUrk8ri06F4u8DM+XQ52ujaeBwCakF4dXIGFHC0yJOXjtfoSAHfwLbXTBcYdajjUYWO35GMca3ha0uVqikuY1Hq/v4iQd8Knb+p1t/eSKzEM98DV1C4KW1GTfFzgpzFNNfCc/2eVEmWI4ylqH1vIm0flRFNgW5u8QFwljZMOawOt9BNT/HAnGe4XREQf0cpCdGTg0C+kJ7ZoLakd5Fc+li0majSWvCr4R0beMAc5t/w==
Hi Li-yao, and everyone,
I managed to extract OCaml code from Coq code, but I believe
extracting Coq type to OCaml polymorphic types [1] in my case is
causing compiler error
File "Top.ml", line 79, characters 20-31:
Error: Unbound type parameter 'ciphertext
A quick Google search led me to [2], but I am not sure how to simulate
Andreas Rossberg's solution in my extraction. Any hint or suggestion
would be appreciated.
Best,
Mukesh
[1]
https://github.com/mukeshtiwari/Encschulze_module/blob/master/Instance.v#L64
[2]
https://stackoverflow.com/questions/8869678/polymorphic-type-inside-a-module-ocaml
On Fri, May 31, 2019 at 11:12 AM mukesh tiwari
<mukeshtiwari.iiitm AT gmail.com>
wrote:
>
> Thanks Li-yao. I will try it and see how it goes.
>
> Best,
> Mukesh
>
> On Thu, May 30, 2019 at 8:33 PM Li-yao Xia
> <lysxia AT gmail.com>
> wrote:
> >
> > Hi Mukesh,
> >
> > Extraction has commands to explicitly define how a given identifier gets
> > extracted. For example, you can define a module of axioms for extraction
> > looking like this:
> >
> >
> > Module KeyInstance <: Keys.
> > Parameter Prime : Type.
> > Parameter prime : Prime.
> >
> > Extract Constant prime => "(* OCaml code here *)".
> > (* etc. *)
> > (* Might need to extract types too, I don't remember offhand. *)
> > End KeyInstance.
> >
> >
> > Cheers,
> > Li-yao
> >
> > On 5/30/19 3:50 AM, mukesh tiwari wrote:
> > > Hi Everyone,
> > > I am trying to extract a Coq function [1] into OCaml function. I
> > > understand that I need to pass a instance of Cand, Keys and
> > > CryptoAxioms to Encschulze module to extract this function. Something
> > > like this ? [2]
> > >
> > > Module CandInstance <: Cand.
> > > (* Definition and proof obligation *)
> > > End CandInstance.
> > >
> > > Module KeyInstance <: Keys.
> > > (* Crypto Parameters *)
> > > End KeyInstance.
> > >
> > > Module CryptoAxiomInstance <: CryptoAxioms CandInstance KeyInstance.
> > > (* Definition and proofs *)
> > > End CryptoAxiomInstance.
> > >
> > > Module E := Encschulze CandInstance KeyInstance CryptoAxiomInstance.
> > >
> > > Extraction Language Ocaml.
> > > Extraction "lib.ml" E.pschulze_winners.
> > >
> > > My problem is, I can not produce instance of Keys and CryptoAxioms,
> > > because we have taken them as axioms. The values and functions inside
> > > these modules will be instantiated by external OCaml code [3] which is
> > > a wrapper of cryptographic library unicrypt [4].
> > >
> > > My question is, how can I extract the pshulze_winners function without
> > > giving the instance of Keys and CryptoAxoims ? One potential solution
> > > I can think of is giving some dummy values and admitting all the
> > > proofs in Keys and CryptoAxioms module to create a instance to
> > > facilitate the extraction. After extraction change all the values in
> > > extracted code, but I am wondering if there is any better solution
> > > than this.
> > >
> > > (* Feel free to skip the paragraph *)
> > > I have a working repo of this project [5], but it's very messy. The
> > > reason this repo is working is that the whole development is in single
> > > file, and all the cryptographic values and functions are lambda
> > > abstracted [6] during the extraction.
> > >
> > > Best regards,
> > > Mukesh Tiwari
> > >
> > > [1]
> > > https://github.com/mukeshtiwari/Encschulze_module/blob/master/Encryptionschulze.v#L492
> > > [2]
> > > https://github.com/mukeshtiwari/Encschulze_module/blob/master/Instance.v#L37
> > > 3]
> > > https://github.com/mukeshtiwari/Encschulze_module/blob/master/cryptobinding.ml
> > > [4] https://github.com/bfh-evg/unicrypt/
> > > [5]
> > > https://github.com/mukeshtiwari/EncryptionSchulze/tree/master/code/Workingcode
> > > [6]
> > > https://github.com/mukeshtiwari/EncryptionSchulze/blob/master/code/Workingcode/main.ml#L45
> > >
- Re: [Coq-Club] Extracting Coq function into OCaml function, mukesh tiwari, 06/01/2019
Archive powered by MHonArc 2.6.18.