Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Redefinition of extracted parameter

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Redefinition of extracted parameter


Chronological Thread 
  • From: "King, Oscar" <oscar.king.16 AT ucl.ac.uk>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Redefinition of extracted parameter
  • Date: Wed, 26 Sep 2018 15:59:06 +0000
  • Accept-language: en-US
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=oscar.king.16 AT ucl.ac.uk; spf=None smtp.mailfrom=oscar.king.16 AT ucl.ac.uk; spf=Pass smtp.helo=postmaster AT EUR01-VE1-obe.outbound.protection.outlook.com
  • Ironport-phdr: 9a23:TnFjpB/y3Mj6Cf9uRHKM819IXTAuvvDOBiVQ1KB31uscTK2v8tzYMVDF4r011RmVBdqds6oMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+55/ebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMMvrRr42RDui9b9mRh/2hikaKz43/mLZis1sg61Uux+uvQBzz5LObY2JKPZzfqXQds4aS2pbWcZRUjRMDo25YYsOCeoBMv5UpJTkqVsVsRSxHxOsCO3ywTJPgX/2xrE13P47EQ3c3wwgHtQOsHvOoNnoNaofSv21w7XMzTnZdfxZxS3x6JXLch04p/yHQLF+cdLJxEUyCw/IgU+cpIPnMj+Py+gBqXWX4/R9We63lmIqpA58riKsy8sykIXEhZgZxk3Z+Sh22Io1K8O3RU1nbdOhFZZdtyKXOopoTc4nTGxluDg1x7IDtJO6fSUF048oyhvdZvGJbYeH+RTuX/uLLzhinnJqYre/ig6y8Ue+zu38UdG53llEoSRZjtXAq2kB2BPc5MSaU/d9+Vyu1iiV2wDU9+FEPVs7la3GK54n37E8jIITsV7EHi/qhkr5kLOWdkQj+uiu8ejnZajmpoOYN49zjQH+Mb4ildC4AeQ9KgQOXm6b9vqg1LD74EH1XLpHguc5n6TbqpzWON4XqrOnDwNIyooj7gywDzai0NQWh3kHK1dFdQqAj4jyJ17BOur4Ae28g1StljdryOrKMqDgD5jWM3jMjLPhcaxn5EFA0gYz0NNf64pOCr4dOPLzRlPxtNvAAxAlNAy02v/rB8l51oMDQm2CGbSZMaPXsV+Q/O0jOeiMZIkPuDb8Mfcp/fDujWVq0WMaKOOi2oJSY3SlFNxnJV+YaDzimJ1JRWwNp081SPHgoFyESz9aIXioCfES/DY+XciFDIHMAsiKm7eIxm3zSppNbWlcTFONF3iuLtusRvwILiuZZNJixG9XHYO9QpMsgEn9/DTxzKBqe7KNq38o8Kn73d0w3NX90BQ79Dh6FcOYijjfUmpw2GoDASI1jvgm/R5Nj2yb2K09uMR2UMRJ7qoQABoxMdjVxKpnCIKqA1+TTpKyUF+jB+6eL3QxQ9Y2n4BcTntHQ4znsD2ami2gDvkSiqCBA4Ey/uTExX/tKs1hynHAkq48k10hRcgJPmqj1Pdy
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

Hi again,


Sorry I should have been a little more specific. If I have the following code. In file 2 I then try to mask the definition of foo in file 1. This is not going to work because file1 still uses the definition of foo in file 1. It will compile but will fail when you try to run it. Say I have other files and use foo elsewhere. It may occur that I use file2.foo whilst it expects file1.foo or vice versa, which can be an issue. 


In my case I want to declare a hashing function as a parameter call it "hash_x" and defer implementation to OCaml. It will extract as foo does.


Is there a way of doing this or do I need to define everything in coq?


Thanks,


Oscar


Parameter foo: nat -> nat -> nat.
Definition bar x y:= foo x y.
Require Extraction.
Recursive Extraction bar.

(* Extracted Code *)
type nat =
| O
| S of nat

(** val foo : nat -> nat -> nat **)

let foo =
  failwith "AXIOM TO BE REALIZED"

(** val bar : nat -> nat -> nat **)

let bar =
  foo

(* File 2 *)

let foo = x + y




From: King, Oscar
Sent: Friday, September 21, 2018 3:44:59 PM
To: coq-club AT inria.fr
Subject: Redefinition of extracted parameter
 
Hi,

I’m trying to extract some code with parameters that I want to define in OCaml however when I extract and try to redefine by defining function or type with the same name I get type conflicts between files. I have constructed an example below:

How would I redefine foo in the extracted code properly?

Thanks in advance,

Oscar

Parameter foo: nat -> nat -> nat.

Definition bar x := foo x.

Require Extraction.

Recursive Extraction bar.

(* Extracted Code *)
type nat =
| O
| S of nat

(** val foo : nat -> nat -> nat **)

let foo =
  failwith "AXIOM TO BE REALIZED"

(** val bar : nat -> nat -> nat **)

let bar =
  foo





Archive powered by MHonArc 2.6.18.

Top of Page