Skip to content

Commit

Permalink
Adding the example referenced in issue ocaml#3437.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mbodin committed Apr 30, 2020
1 parent 4348e72 commit 1d5ca26
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/blackbox-tests/test-cases/coq-extraction/Bug_Coq.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Coq files"
depends: [
"dune" {>= "2.5"}
]
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
20 changes: 20 additions & 0 deletions test/blackbox-tests/test-cases/coq-extraction/Bug_OCaml.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "OCaml files"
depends: [
"dune" {>= "2.5"}
]
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
5 changes: 5 additions & 0 deletions test/blackbox-tests/test-cases/coq-extraction/_CoqProject
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

-arg -w -arg -notation-overridden
-arg -w -arg -abstract-large-number

-R _build/default/theories Bug_Coq
14 changes: 14 additions & 0 deletions test/blackbox-tests/test-cases/coq-extraction/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(lang dune 2.5)
(using coq 0.2)
(name Bug_Coq)

(generate_opam_files true)

(package
(name Bug_Coq)
(synopsis "Coq files"))

(package
(name Bug_OCaml)
(synopsis "OCaml files"))

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

let _ =
ignore Extract.v ;
print_endline "OK"

14 changes: 14 additions & 0 deletions test/blackbox-tests/test-cases/coq-extraction/src/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(executable
(name Bug_OCaml)
(modes (best exe)))

; (install
; (package Bug_OCaml)
; (section bin)
; (files (bug.exe as bug)))

(coq.extraction
(theories Bug_Coq)
(prelude extraction)
(extracted_modules Extract))

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

Require Import Extraction.
From Bug_Coq Require Import value common.

Extraction Language OCaml.

Extraction "Extract" v.

15 changes: 15 additions & 0 deletions test/blackbox-tests/test-cases/coq-extraction/theories/common.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Require Import Ascii.

Axiom axiom : Prop.
Axiom axiom_valid : axiom.

Lemma test : forall a b, eqb a b = eqb b a.
Proof.
intros. destruct (eqb a b) eqn: E.
- rewrite eqb_eq in E. symmetry. now rewrite eqb_eq.
- rewrite eqb_neq in E. symmetry. rewrite eqb_neq. now auto.
Qed.

Definition v2 := 18.

4 changes: 4 additions & 0 deletions test/blackbox-tests/test-cases/coq-extraction/theories/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(coq.theory
(name Bug_Coq)
(package Bug_Coq))

15 changes: 15 additions & 0 deletions test/blackbox-tests/test-cases/coq-extraction/theories/value.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Set Implicit Arguments.
Require Export common.

Definition k (A B : Type) (_ : A) (b : B) := b.

Definition v3 := k axiom_valid v2.

Definition v : nat.
Proof.
eapply k.
- exact test.
- exact v3.
Defined.

0 comments on commit 1d5ca26

Please sign in to comment.