Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Extracting Coq function into OCaml function

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Extracting Coq function into OCaml function


Chronological Thread 
  • 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: Fri, 31 May 2019 11:12: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-f196.google.com
  • Ironport-phdr: 9a23:JFqSjxOvtZomMsU9aA4l6mtUPXoX/o7sNwtQ0KIMzox0Ivz/rarrMEGX3/hxlliBBdydt6sdzbON6+u8AiQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTagfL9+Ngi6oAvNusUZjoZvJLs6xwfUrHdPZ+lY335jK0iJnxb76Mew/Zpj/DpVtvk86cNOUrj0crohQ7BAAzsoL2465MvwtRneVgSP/WcTUn8XkhVTHQfI6gzxU4rrvSv7sup93zSaPdHzQLspVzmu87tnRRn1gyoBKjU38nzYitZoga1UrhKupRxxzYDXbo+IKvRxYrjQfc8GSWdbQspdSzBND4G6YoASD+QBJ+FYr4zlqlsLsBu+BhejBPjvyjRVmn/23KM73P47EQHHwQctGNcOsGnXrNrrL6cSUfy1zKjGzDrZdfNW2C3x6InJchAgvfGMWKl9ccXUyUY1FgPFik+cppDiPzOQz+kAtXWQ4eRnVeKqkWEnqgdxryCgxsctlonJhp8VxUve+Splx4Y1INu1Q1N4b968CJZcqT2WOo9sTs4hQ2xkojs2x7wHtJKhYSQHzJUqyhjCYPKdaYeI+AjsVOOJLDd4mn1lfLW/ig638Ue6y+38UtC40FdWriZYi9XMuG0B2hjS58SdRft9+UCh2TmL1w/N8O1LPUc0la/DJ54gxL4/iIYTvFzdEiPqnEj6lqybe0U+9uS16unqY6/qqoKYOoJ1kg3+N74hms27AeQ2KAgOWG2b9Py51L3+/k32Xq5Kjv0qkqnYvpHVP94bpq+jDw9U04Yj6gq/DzK93dQXmHkINlNFeBadg4f1PFHOJej0De2jjFS0jDdr2/fGM6X9DZXKN3jPiavufbJg60FH0wcz1tBe55dMCr4bOv7zW0nxtMbZDhAjKQC0zfznW51B0dY6WCeeC6jRAKLb+QuM9/k/IuCka4ocuTK7IP8gsa3Al3g8zFoAfqSy3dMLaW+xBPUud0CEYnf3gssADm4Qv0w/Te32jXWNVDdSYzC5WKdqtWJzM56vEYqWHtPlu7eGxiruRsQHNFADMUiFFDLTT6vBXv4NbCyIJco4y24LULGgT8kq0hT87VammYoiFfLd/2gjjbymzMJ8vrSBmhQ79DgyBMOYgTnUEjNE21gQTjpz55hR5ExwzlDZj/p9iv1cUN1PvrZHC1Zkc5HbyON+Bpb5XQeTJto=

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
> >



Archive powered by MHonArc 2.6.18.

Top of Page