The extraction mechanism allows users to derive ocaml, haskell or scheme code from their coq development. This corresponds to a compilation phase.
Questions tagged [coq-extraction]
28 questions
2
votes
1 answer
Convert nat to big_int in extraction of Coq to Ocaml
I am doing extraction convert nat to big_int
When I used the library: ExtrOcamlNatBigInt, it does not return the correct type for big_int in Ocaml
So I modify it (the file ExtrOcamlNatBigInt), but I cannot find the way to define function nat_case…

Quyen
- 1,363
- 1
- 11
- 21
1
vote
1 answer
Forcing evaluation of terms before extraction, or other ways to test extracted functions?
In many parts of the standard library, there are a bunch of OCaml-native functions with no Coq counterpart. I implemented a Coq version of some of them (with added proofs to show that the Coq versions behave as I think they ought to), but now how…

nobody
- 4,074
- 1
- 23
- 33
1
vote
1 answer
Error message: Not the right number of missing arguments (expected 1)
I faced error message when running the following code.
Require Import Coq.Lists.List.
Import ListNotations.
Theorem con_not_com :
exists A (l1 l2 : list A), l1 ++ l2 <> l2 ++ l1.
Proof.
exists bool [true] [false].
I'm wondering how I can…

Serene M
- 17
- 1
1
vote
1 answer
How to extract Coq's Z into Haskell's Integer
I'm trying to extract to Haskell a program in Coq that uses Z numbers. I want to map Coq's Z to Haskell's Integer.
I found some libraries for doing that aiming OCaml, but not aiming Haskell.
There is no library for that?
I need the extractions…

Rafael Castro
- 579
- 5
- 14
1
vote
1 answer
What are background goals, shelved goals, and abandoned goals in Coq?
I am using Coq's ideslave (a.k.a. XML protocol). By calling , a typical feedback looks like
1
vote
1 answer
Coq XML Protocol: a likely PrintAST malfunction
I am using the XML Protocol from Coq 8.6.1. When I tried the PrintAst call, I failed to get an AST, but got an "todo" instead. Is this a malfunction or did I do something wrong? How should I get an AST from a print AST call?
Here is my case:
I used…

Jian Wang
- 103
- 5
1
vote
1 answer
Can I extract Positive, Nat to int32, Z to int?
Hi I am writing an extraction from Coq to Ocaml, I would like to convert type:
positive --> int32
N -> int32
but I want to keep type Z is int
Here is the code I am doing to extract these conditions:
Require Import ZArith NArith.
Require Import…

Quyen
- 1,363
- 1
- 11
- 21
0
votes
2 answers
How does one produce types (or theorems) from proof terms (programs or objects) in Coq?
I was curious to learn about type inference in Coq. I wanted a concrete way in Coq to generate types (theorems) given a proof term/object/program. So given a proof term (perhaps with a hole, perhaps with not holes or perhaps a proof sub term) can I…

Charlie Parker
- 5,884
- 57
- 198
- 323
0
votes
1 answer
What is the EvalOp in Coq CompCert
The definition of EvalOp is in compcert.backend.SplitLongproof:
Ltac EvalOp :=
eauto;
match goal with
| [ |- eval_exprlist _ _ _ _ _ Enil _ ] => constructor
| [ |- eval_exprlist _ _ _ _ _ (_:::_) _ ] => econstructor; EvalOp
| [ |-…

Jian Wang
- 103
- 5
0
votes
1 answer
Coq Extraction: Permission Denied
When I execute the following commands within the CoqIDE:
Extraction Language Haskell.
Extraction "Code.hs" my_function.
I get the following error:
System error: "Code.hs: Permission denied"
If I try instead:
Extraction Language Haskell.
Extraction…

Bruno
- 854
- 7
- 21
0
votes
1 answer
Extract to an OCaml file by using "Recursive Extraction" in Coq
I want to extract a function foo in Coq to an OCaml file. Because my real function have to use the Recursive Extraction, when I run a program it output the extracted OCaml code on the cmd. But I would like to output it to a file, for example:…

Quyen
- 1,363
- 1
- 11
- 21
0
votes
1 answer
Extraction mechanism of Coq generate "failwith "AXIOM TO BE REALIZE""
I have a module structure inside this module I declare a variable use for some function inside module A.
Module A.
Variable a : nat.
End A.
Then I use extraction mechanism.
Extraction Language Ocaml.
Set Extraction Optimize.
Set…

Quyen
- 1,363
- 1
- 11
- 21
-2
votes
2 answers
How to prove list concatenation is not commutative using coq?
Sorry I am new to coq. I'm wondering how to prove list concatenation is not commutative using coq?

Serene M
- 17
- 1