aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore18
-rw-r--r--INSTALL.md50
-rw-r--r--Makefile2
-rw-r--r--ci/manifest-sources-8.111
-rw-r--r--doc/sources.md32
-rw-r--r--examples/Example.v2
-rw-r--r--src/Array/PArray.v (renamed from src/versions/standard/Array/PArray_standard.v)2
-rw-r--r--src/BEST_PRACTICE.md8
-rw-r--r--src/Int63/Int63.v (renamed from src/versions/standard/Int63/Int63_standard.v)0
-rw-r--r--src/Int63/Int63Axioms.v (renamed from src/versions/standard/Int63/Int63Axioms_standard.v)0
-rw-r--r--src/Int63/Int63Native.v (renamed from src/versions/standard/Int63/Int63Native_standard.v)1
-rw-r--r--src/Int63/Int63Op.v (renamed from src/versions/standard/Int63/Int63Op_standard.v)0
-rw-r--r--src/Int63/Int63Properties.v (renamed from src/versions/standard/Int63/Int63Properties_standard.v)0
-rw-r--r--src/Makefile801
-rw-r--r--src/Makefile.local (renamed from src/versions/standard/Makefile.local)0
-rw-r--r--src/Misc.v82
-rw-r--r--src/PropToBool.v2
-rw-r--r--src/QInst.v4
-rw-r--r--src/SMT_terms.v18
-rw-r--r--src/Tactics.v (renamed from src/versions/standard/Tactics_standard.v)0
-rw-r--r--src/Trace.v133
-rw-r--r--src/_CoqProject (renamed from src/versions/standard/_CoqProject)28
-rw-r--r--src/array/FArray.v270
-rw-r--r--src/bva/BVList.v2
-rw-r--r--src/bva/Bva_checker.v28
-rw-r--r--src/classes/SMT_classes_instances.v3
-rwxr-xr-xsrc/configure.sh42
-rw-r--r--src/euf/Euf.v134
-rw-r--r--src/extraction/Makefile2
-rw-r--r--src/extraction/verit_checker.mli6
-rw-r--r--src/g_smtcoq.mlg (renamed from src/versions/standard/g_smtcoq_standard.ml4)74
-rw-r--r--src/lfsc/ast.ml4
-rw-r--r--src/lfsc/builtin.ml2
-rw-r--r--src/lfsc/lfsc.ml22
-rw-r--r--src/lfsc/shashcons.mli2
-rw-r--r--src/lia/Lia.v208
-rw-r--r--src/lia/lia.ml76
-rw-r--r--src/lia/lia.mli56
-rw-r--r--src/smtcoq_plugin.mlpack (renamed from src/versions/standard/smtcoq_plugin_standard.mlpack)4
-rw-r--r--src/smtlib2/smtlib2_genConstr.ml8
-rw-r--r--src/smtlib2/smtlib2_solver.ml6
-rw-r--r--src/spl/Arithmetic.v4
-rw-r--r--src/spl/Operators.v128
-rw-r--r--src/trace/coqInterface.ml (renamed from src/versions/standard/structures.ml)35
-rw-r--r--src/trace/coqInterface.mli (renamed from src/versions/standard/structures.mli)4
-rw-r--r--src/trace/coqTerms.ml135
-rw-r--r--src/trace/coqTerms.mli428
-rw-r--r--src/trace/satAtom.ml4
-rw-r--r--src/trace/satAtom.mli10
-rw-r--r--src/trace/smtAtom.ml50
-rw-r--r--src/trace/smtAtom.mli26
-rw-r--r--src/trace/smtBtype.ml42
-rw-r--r--src/trace/smtBtype.mli28
-rw-r--r--src/trace/smtCertif.ml4
-rw-r--r--src/trace/smtCertif.mli4
-rw-r--r--src/trace/smtCommands.ml432
-rw-r--r--src/trace/smtCommands.mli22
-rw-r--r--src/trace/smtForm.ml64
-rw-r--r--src/trace/smtForm.mli18
-rw-r--r--src/trace/smtMisc.ml12
-rw-r--r--src/trace/smtMisc.mli10
-rw-r--r--src/trace/smtTrace.ml22
-rw-r--r--src/trace/smtTrace.mli38
-rw-r--r--src/verit/verit.ml14
-rw-r--r--src/verit/verit.mli16
-rw-r--r--src/verit/veritSyntax.ml6
-rw-r--r--src/versions/native/Make171
-rw-r--r--src/versions/native/Makefile505
-rw-r--r--src/versions/native/Structures_native.v59
-rw-r--r--src/versions/native/Tactics_native.v55
-rw-r--r--src/versions/native/smtcoq_plugin_native.ml499
-rw-r--r--src/versions/native/structures.ml188
-rw-r--r--src/versions/native/structures.mli119
-rw-r--r--src/versions/standard/Structures_standard.v64
-rw-r--r--src/versions/standard/coq_micromega_full.ml2215
-rw-r--r--src/versions/standard/mutils_full.ml358
-rw-r--r--src/versions/standard/mutils_full.mli77
-rw-r--r--src/zchaff/zchaff.ml116
-rw-r--r--src/zchaff/zchaff.mli10
-rw-r--r--unit-tests/Makefile2
80 files changed, 2190 insertions, 5537 deletions
diff --git a/.gitignore b/.gitignore
index 9b065a2..0f92c0b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,23 +21,9 @@ setup.log
.lia.cache
.nia.cache
-# cp targets of src/configure.sh:
-src/_CoqProject
-src/Makefile
+# targets of coq_makefile:
src/Makefile.conf
-src/Makefile.local
-src/smtcoq_plugin.ml4
-src/versions/native/Structures.v
-src/g_smtcoq.ml4
-src/smtcoq_plugin.mlpack
-src/Tactics.v
-src/versions/standard/Int63/Int63.v
-src/versions/standard/Int63/Int63Native.v
-src/versions/standard/Int63/Int63Op.v
-src/versions/standard/Int63/Int63Axioms.v
-src/versions/standard/Int63/Int63Properties.v
-src/versions/standard/Array/PArray.v
-src/versions/standard/Structures.v
+src/g_smtcoq.ml
# generated by the Makefile
src/uninstall_me.sh
diff --git a/INSTALL.md b/INSTALL.md
index 8fc678c..940b2d5 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -74,18 +74,12 @@ Then follow the instructions of the previous section.
### Requirements
-You need to have OCaml version >= 4.09.0 and Coq version 8.9.*.
+You need to have OCaml version >= 4.08 and < 4.10 and Coq version 8.10.*.
> **Warning**: The version of Coq that you plan to use must have been compiled
> with the same version of OCaml that you are going to use to compile
> SMTCoq. In particular this means you want a version of Coq that was compiled
-> with OCaml version >= 4.09.0.
-
-If you want to use SMTCoq with high performance to check large proof
-certificates, you need to use the [version of Coq with native
-data-structures](https://github.com/smtcoq/native-coq) instead of
-Coq-8.9 (warning: this allows one to use the vernacular commands but not
-the tactics).
+> with OCaml version >= 4.08.
### Install opam
@@ -118,16 +112,16 @@ opam switch create ocaml-base-compiler.4.09.0
### Install Coq
-After OCaml is installed, you can install Coq-8.9.1 through opam.
+After OCaml is installed, you can install Coq-8.10.2 through opam.
```bash
-opam install coq.8.9.1
+opam install coq.8.10.2
```
If you also want to install CoqIDE at the same time you can do
```bash
-opam install coq.8.9.1 coqide.8.9.1
+opam install coq.8.10.2 coqide.8.10.2
```
but you might need to install some extra packages and libraries for your system
@@ -139,44 +133,10 @@ but you might need to install some extra packages and libraries for your system
Compile and install SMTCoq by using the following commands in the src directory.
```bash
-./configure.sh
-make
-make install
-```
-
-## Installation with native-coq (not recommended except for high performances)
-
-> **Warning**: this installation procedure is recommended only to use
-> the vernacular commands efficiently (in particular, to check very
-> large proof certificates). It does not allow one to use the tactics.
-
-1. Download the git version of Coq with native compilation:
-```bash
-git clone https://github.com/smtcoq/native-coq.git
-```
- and compile it by following the instructions available in the
- repository. We recommand that you do not install it, but only compile
- it in local:
-```bash
-./configure -local
-make
-```
-
-2. Set an environment variable COQBIN to the directory where Coq's
- binaries are; for instance:
-```bash
-export COQBIN=/home/jdoe/native-coq/bin/
-```
- (the final slash is mandatory).
-
-3. Compile and install SMTCoq by using the following commands in the src directory.
-```
-./configure.sh -native
make
make install
```
-
## Installation of the provers
To use SMTCoq, we recommend installing the following two SMT solvers:
diff --git a/Makefile b/Makefile
index 5e3b013..c31aa9b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
all:
- cd src && ./configure.sh && $(MAKE)
+ cd src && $(MAKE)
install: all
cd src && $(MAKE) install
diff --git a/ci/manifest-sources-8.11 b/ci/manifest-sources-8.11
index b93f959..043c626 100644
--- a/ci/manifest-sources-8.11
+++ b/ci/manifest-sources-8.11
@@ -27,7 +27,6 @@ tasks:
cd smtcoq
git checkout coq-8.11
cd src
- ./configure.sh
make
make install
cd ../..
diff --git a/doc/sources.md b/doc/sources.md
index 55d2cec..045150d 100644
--- a/doc/sources.md
+++ b/doc/sources.md
@@ -17,14 +17,6 @@ The rest of the document describes the organization of `src`.
SMTCoq sources are contained in this directory. A few Coq files can be found at
top-level.
-### [configure.sh](../src/configure.sh)
-
-This script is meant to be run when compiling SMTCoq for the first time. It
-should also be run every time the Makefile is modified. It takes as argument an
-optional flag `-native` which, when present, will set up the sources to use the
-*native Coq* libraries. Otherwise the standard version 8.5 of Coq is used. See
-section [versions](#versions).
-
### [SMTCoq.v](../src/SMTCoq.v)
This is the main SMTCoq entry point, it is meant to be imported by users that
@@ -142,30 +134,6 @@ This module contains miscellaneous general lemmas that are used in several
places throughout the development of SMTCoq.
-### [versions](../src/versions)
-
-This directory contains everything that is dependent on the version of Coq that
-one wants to use. `standard` contains libraries for the standard version of Coq
-and `native` contains everything related to native Coq. Note that some
-libraries are already present in the default libraries of native Coq, in this
-case they have a counterpart in `standard` that replicates the functionality
-(without using native integers or native arrays).
-
-A particular point of interest is the files
-[smtcoq_plugin_standard.ml4](../src/versions/standard/smtcoq_plugin_standard.ml4)
-and
-[smtcoq_plugin_native.ml4](../src/versions/native/smtcoq_plugin_native.ml4). They
-provide extension points for Coq by defining new vernacular commands and new
-tactics. For instance the tactic `verit` tells Coq to call the OCaml function
-`verit.tactic` (which in turns uses the Coq API to manipulate the goals and
-call the certified checkers).
-
-```ocaml
-TACTIC EXTEND Tactic_verit
-| [ "verit" ] -> [ Verit.tactic () ]
-END
-```
-
### [spl](../src/spl)
diff --git a/examples/Example.v b/examples/Example.v
index b32c254..06d5aba 100644
--- a/examples/Example.v
+++ b/examples/Example.v
@@ -11,7 +11,7 @@
(* [Require Import SMTCoq.SMTCoq.] loads the SMTCoq library.
- If you are using native-coq instead of Coq 8.9, replace it with:
+ If you are using native-coq instead of Coq 8.10, replace it with:
Require Import SMTCoq.
*)
diff --git a/src/versions/standard/Array/PArray_standard.v b/src/Array/PArray.v
index f3bf606..25da052 100644
--- a/src/versions/standard/Array/PArray_standard.v
+++ b/src/Array/PArray.v
@@ -14,6 +14,8 @@
trees *)
+Declare Scope array_scope.
+
Require Import Int31.
Require Export Int63.
Require FMapAVL.
diff --git a/src/BEST_PRACTICE.md b/src/BEST_PRACTICE.md
index bbfd381..f75c7aa 100644
--- a/src/BEST_PRACTICE.md
+++ b/src/BEST_PRACTICE.md
@@ -9,6 +9,14 @@ except:
implemented as dependent types).
+## Hints
+
+Every hint should be put in a hint database, whose name starts with
+"smtcoq_". There should be a different database for each part of SMTCoq
+(e.g., one for each theory). The general database that is used across
+the project is named `smtcoq_core`.
+
+
# Code organization
## Documentation
Every OCaml module comes with a documented interface.
diff --git a/src/versions/standard/Int63/Int63_standard.v b/src/Int63/Int63.v
index acee305..acee305 100644
--- a/src/versions/standard/Int63/Int63_standard.v
+++ b/src/Int63/Int63.v
diff --git a/src/versions/standard/Int63/Int63Axioms_standard.v b/src/Int63/Int63Axioms.v
index 9625bce..9625bce 100644
--- a/src/versions/standard/Int63/Int63Axioms_standard.v
+++ b/src/Int63/Int63Axioms.v
diff --git a/src/versions/standard/Int63/Int63Native_standard.v b/src/Int63/Int63Native.v
index 6600a27..0f9d6b7 100644
--- a/src/versions/standard/Int63/Int63Native_standard.v
+++ b/src/Int63/Int63Native.v
@@ -20,6 +20,7 @@ Definition size := size.
Notation int := int31.
+Declare Scope int63_scope.
Delimit Scope int63_scope with int.
Bind Scope int63_scope with int.
diff --git a/src/versions/standard/Int63/Int63Op_standard.v b/src/Int63/Int63Op.v
index bb7d9a1..bb7d9a1 100644
--- a/src/versions/standard/Int63/Int63Op_standard.v
+++ b/src/Int63/Int63Op.v
diff --git a/src/versions/standard/Int63/Int63Properties_standard.v b/src/Int63/Int63Properties.v
index feb19b8..feb19b8 100644
--- a/src/versions/standard/Int63/Int63Properties_standard.v
+++ b/src/Int63/Int63Properties.v
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..5d24b0c
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,801 @@
+###############################################################################
+## v # The Coq Proof Assistant ##
+## <O___,, # INRIA - CNRS - LIX - LRI - PPS ##
+## \VV/ # ##
+## // # ##
+###############################################################################
+## GNUMakefile for Coq 8.10.2
+
+# For debugging purposes (must stay here, don't move below)
+INITIAL_VARS := $(.VARIABLES)
+# To implement recursion we save the name of the main Makefile
+SELF := $(lastword $(MAKEFILE_LIST))
+PARENT := $(firstword $(MAKEFILE_LIST))
+
+# This file is generated by coq_makefile and contains many variable
+# definitions, like the list of .v files or the path to Coq
+include Makefile.conf
+
+# Put in place old names
+VFILES := $(COQMF_VFILES)
+MLIFILES := $(COQMF_MLIFILES)
+MLFILES := $(COQMF_MLFILES)
+MLGFILES := $(COQMF_MLGFILES)
+MLPACKFILES := $(COQMF_MLPACKFILES)
+MLLIBFILES := $(COQMF_MLLIBFILES)
+CMDLINE_VFILES := $(COQMF_CMDLINE_VFILES)
+INSTALLCOQDOCROOT := $(COQMF_INSTALLCOQDOCROOT)
+OTHERFLAGS := $(COQMF_OTHERFLAGS)
+COQ_SRC_SUBDIRS := $(COQMF_COQ_SRC_SUBDIRS)
+OCAMLLIBS := $(COQMF_OCAMLLIBS)
+SRC_SUBDIRS := $(COQMF_SRC_SUBDIRS)
+COQLIBS := $(COQMF_COQLIBS)
+COQLIBS_NOML := $(COQMF_COQLIBS_NOML)
+CMDLINE_COQLIBS := $(COQMF_CMDLINE_COQLIBS)
+LOCAL := $(COQMF_LOCAL)
+COQLIB := $(COQMF_COQLIB)
+DOCDIR := $(COQMF_DOCDIR)
+OCAMLFIND := $(COQMF_OCAMLFIND)
+CAMLFLAGS := $(COQMF_CAMLFLAGS)
+HASNATDYNLINK := $(COQMF_HASNATDYNLINK)
+OCAMLWARN := $(COQMF_WARN)
+
+Makefile.conf: _CoqProject
+ coq_makefile -f _CoqProject -o Makefile
+
+# This file can be created by the user to hook into double colon rules or
+# add any other Makefile code he may need
+-include Makefile.local
+
+# Parameters ##################################################################
+#
+# Parameters are make variable assignments.
+# They can be passed to (each call to) make on the command line.
+# They can also be put in Makefile.local once an for all.
+# For retro-compatibility reasons they can be put in the _CoqProject, but this
+# practice is discouraged since _CoqProject better not contain make specific
+# code (be nice to user interfaces).
+
+# Print shell commands (set to non empty)
+VERBOSE ?=
+
+# Time the Coq process (set to non empty), and how (see default value)
+TIMED?=
+TIMECMD?=
+# Use command time on linux, gtime on Mac OS
+TIMEFMT?="$* (real: %e, user: %U, sys: %S, mem: %M ko)"
+ifneq (,$(TIMED))
+ifeq (0,$(shell command time -f $(TIMEFMT) true >/dev/null 2>/dev/null; echo $$?))
+STDTIME?=command time -f $(TIMEFMT)
+else
+ifeq (0,$(shell gtime -f $(TIMEFMT) true >/dev/null 2>/dev/null; echo $$?))
+STDTIME?=gtime -f $(TIMEFMT)
+else
+STDTIME?=command time
+endif
+endif
+else
+STDTIME?=command time -f $(TIMEFMT)
+endif
+
+# Coq binaries
+COQC ?= "$(COQBIN)coqc"
+COQTOP ?= "$(COQBIN)coqtop"
+COQCHK ?= "$(COQBIN)coqchk"
+COQDEP ?= "$(COQBIN)coqdep"
+COQDOC ?= "$(COQBIN)coqdoc"
+COQPP ?= "$(COQBIN)coqpp"
+COQMKFILE ?= "$(COQBIN)coq_makefile"
+
+# Timing scripts
+COQMAKE_ONE_TIME_FILE ?= "$(COQLIB)/tools/make-one-time-file.py"
+COQMAKE_BOTH_TIME_FILES ?= "$(COQLIB)/tools/make-both-time-files.py"
+COQMAKE_BOTH_SINGLE_TIMING_FILES ?= "$(COQLIB)/tools/make-both-single-timing-files.py"
+BEFORE ?=
+AFTER ?=
+
+# FIXME this should be generated by Coq (modules already linked by Coq)
+CAMLDONTLINK=unix,str
+
+# OCaml binaries
+CAMLC ?= "$(OCAMLFIND)" ocamlc -c
+CAMLOPTC ?= "$(OCAMLFIND)" opt -c
+CAMLLINK ?= "$(OCAMLFIND)" ocamlc -linkpkg -dontlink $(CAMLDONTLINK)
+CAMLOPTLINK ?= "$(OCAMLFIND)" opt -linkpkg -dontlink $(CAMLDONTLINK)
+CAMLDOC ?= "$(OCAMLFIND)" ocamldoc
+CAMLDEP ?= "$(OCAMLFIND)" ocamldep -slash -ml-synonym .mlpack
+
+# DESTDIR is prepended to all installation paths
+DESTDIR ?=
+
+# Debug builds, typically -g to OCaml, -debug to Coq.
+CAMLDEBUG ?=
+COQDEBUG ?=
+
+# Extra packages to be linked in (as in findlib -package)
+CAMLPKGS ?=
+
+# Option for making timing files
+TIMING?=
+# Option for changing sorting of timing output file
+TIMING_SORT_BY ?= auto
+# Output file names for timed builds
+TIME_OF_BUILD_FILE ?= time-of-build.log
+TIME_OF_BUILD_BEFORE_FILE ?= time-of-build-before.log
+TIME_OF_BUILD_AFTER_FILE ?= time-of-build-after.log
+TIME_OF_PRETTY_BUILD_FILE ?= time-of-build-pretty.log
+TIME_OF_PRETTY_BOTH_BUILD_FILE ?= time-of-build-both.log
+TIME_OF_PRETTY_BUILD_EXTRA_FILES ?= - # also output to the command line
+
+TGTS ?=
+
+########## End of parameters ##################################################
+# What follows may be relevant to you only if you need to
+# extend this Makefile. If so, look for 'Extension point' here and
+# put in Makefile.local double colon rules accordingly.
+# E.g. to perform some work after the all target completes you can write
+#
+# post-all::
+# echo "All done!"
+#
+# in Makefile.local
+#
+###############################################################################
+
+
+
+
+# Flags #######################################################################
+#
+# We define a bunch of variables combining the parameters.
+# To add additional flags to coq, coqchk or coqdoc, set the
+# {COQ,COQCHK,COQDOC}EXTRAFLAGS variable to whatever you want to add.
+# To overwrite the default choice and set your own flags entirely, set the
+# {COQ,COQCHK,COQDOC}FLAGS variable.
+
+SHOW := $(if $(VERBOSE),@true "",@echo "")
+HIDE := $(if $(VERBOSE),,@)
+
+TIMER=$(if $(TIMED), $(STDTIME), $(TIMECMD))
+
+OPT?=
+
+# The DYNOBJ and DYNLIB variables are used by "coqdep -dyndep var" in .v.d
+ifeq '$(OPT)' '-byte'
+USEBYTE:=true
+DYNOBJ:=.cma
+DYNLIB:=.cma
+else
+USEBYTE:=
+DYNOBJ:=.cmxs
+DYNLIB:=.cmxs
+endif
+
+# these variables are meant to be overridden if you want to add *extra* flags
+COQEXTRAFLAGS?=
+COQCHKEXTRAFLAGS?=
+COQDOCEXTRAFLAGS?=
+
+# these flags do NOT contain the libraries, to make them easier to overwrite
+COQFLAGS?=-q $(OTHERFLAGS) $(COQEXTRAFLAGS)
+COQCHKFLAGS?=-silent -o $(COQCHKEXTRAFLAGS)
+COQDOCFLAGS?=-interpolate -utf8 $(COQDOCEXTRAFLAGS)
+
+COQDOCLIBS?=$(COQLIBS_NOML)
+
+# The version of Coq being run and the version of coq_makefile that
+# generated this makefile
+COQ_VERSION:=$(shell $(COQC) --print-version | cut -d " " -f 1)
+COQMAKEFILE_VERSION:=8.10.2
+
+COQSRCLIBS?= $(foreach d,$(COQ_SRC_SUBDIRS), -I "$(COQLIB)/$(d)")
+
+CAMLFLAGS+=$(OCAMLLIBS) $(COQSRCLIBS)
+# ocamldoc fails with unknown argument otherwise
+CAMLDOCFLAGS:=$(filter-out -annot, $(filter-out -bin-annot, $(CAMLFLAGS)))
+CAMLFLAGS+=$(OCAMLWARN)
+
+ifneq (,$(TIMING))
+TIMING_ARG=-time
+ifeq (after,$(TIMING))
+TIMING_EXT=after-timing
+else
+ifeq (before,$(TIMING))
+TIMING_EXT=before-timing
+else
+TIMING_EXT=timing
+endif
+endif
+else
+TIMING_ARG=
+endif
+
+# Retro compatibility (DESTDIR is standard on Unix, DSTROOT is not)
+ifdef DSTROOT
+DESTDIR := $(DSTROOT)
+endif
+
+concat_path = $(if $(1),$(1)/$(if $(COQMF_WINDRIVE),$(subst $(COQMF_WINDRIVE),/,$(2)),$(2)),$(2))
+
+COQLIBINSTALL = $(call concat_path,$(DESTDIR),$(COQLIB)/user-contrib)
+COQDOCINSTALL = $(call concat_path,$(DESTDIR),$(DOCDIR)/user-contrib)
+COQTOPINSTALL = $(call concat_path,$(DESTDIR),$(COQLIB)/toploop)
+
+# Files #######################################################################
+#
+# We here define a bunch of variables about the files being part of the
+# Coq project in order to ease the writing of build target and build rules
+
+VDFILE := .coqdeps
+
+ALLSRCFILES := \
+ $(MLGFILES) \
+ $(MLFILES) \
+ $(MLPACKFILES) \
+ $(MLLIBFILES) \
+ $(MLIFILES)
+
+# helpers
+vo_to_obj = $(addsuffix .o,\
+ $(filter-out Warning: Error:,\
+ $(shell $(COQTOP) -q -noinit -batch -quiet -print-mod-uid $(1))))
+strip_dotslash = $(patsubst ./%,%,$(1))
+
+# without this we get undefined variables in the expansion for the
+# targets of the [deprecated,use-mllib-or-mlpack] rule
+with_undef = $(if $(filter-out undefined, $(origin $(1))),$($(1)))
+
+VO = vo
+
+VOFILES = $(VFILES:.v=.$(VO))
+GLOBFILES = $(VFILES:.v=.glob)
+HTMLFILES = $(VFILES:.v=.html)
+GHTMLFILES = $(VFILES:.v=.g.html)
+BEAUTYFILES = $(addsuffix .beautified,$(VFILES))
+TEXFILES = $(VFILES:.v=.tex)
+GTEXFILES = $(VFILES:.v=.g.tex)
+CMOFILES = \
+ $(MLGFILES:.mlg=.cmo) \
+ $(MLFILES:.ml=.cmo) \
+ $(MLPACKFILES:.mlpack=.cmo)
+CMXFILES = $(CMOFILES:.cmo=.cmx)
+OFILES = $(CMXFILES:.cmx=.o)
+CMAFILES = $(MLLIBFILES:.mllib=.cma) $(MLPACKFILES:.mlpack=.cma)
+CMXAFILES = $(CMAFILES:.cma=.cmxa)
+CMIFILES = \
+ $(CMOFILES:.cmo=.cmi) \
+ $(MLIFILES:.mli=.cmi)
+# the /if/ is because old _CoqProject did not list a .ml(pack|lib) but just
+# a .ml4 file
+CMXSFILES = \
+ $(MLPACKFILES:.mlpack=.cmxs) \
+ $(CMXAFILES:.cmxa=.cmxs) \
+ $(if $(MLPACKFILES)$(CMXAFILES),,\
+ $(MLGFILES:.mlg=.cmxs) $(MLFILES:.ml=.cmxs))
+
+# files that are packed into a plugin (no extension)
+PACKEDFILES = \
+ $(call strip_dotslash, \
+ $(foreach lib, \
+ $(call strip_dotslash, \
+ $(MLPACKFILES:.mlpack=_MLPACK_DEPENDENCIES)),$(call with_undef,$(lib))))
+# files that are archived into a .cma (mllib)
+LIBEDFILES = \
+ $(call strip_dotslash, \
+ $(foreach lib, \
+ $(call strip_dotslash, \
+ $(MLLIBFILES:.mllib=_MLLIB_DEPENDENCIES)),$(call with_undef,$(lib))))
+CMIFILESTOINSTALL = $(filter-out $(addsuffix .cmi,$(PACKEDFILES)),$(CMIFILES))
+CMOFILESTOINSTALL = $(filter-out $(addsuffix .cmo,$(PACKEDFILES)),$(CMOFILES))
+OBJFILES = $(call vo_to_obj,$(VOFILES))
+ALLNATIVEFILES = \
+ $(OBJFILES:.o=.cmi) \
+ $(OBJFILES:.o=.cmx) \
+ $(OBJFILES:.o=.cmxs)
+# trick: wildcard filters out non-existing files, so that `install` doesn't show
+# warnings and `clean` doesn't pass to rm a list of files that is too long for
+# the shell.
+NATIVEFILES = $(wildcard $(ALLNATIVEFILES))
+FILESTOINSTALL = \
+ $(VOFILES) \
+ $(VFILES) \
+ $(GLOBFILES) \
+ $(NATIVEFILES) \
+ $(CMIFILESTOINSTALL)
+BYTEFILESTOINSTALL = \
+ $(CMOFILESTOINSTALL) \
+ $(CMAFILES)
+ifeq '$(HASNATDYNLINK)' 'true'
+DO_NATDYNLINK = yes
+FILESTOINSTALL += $(CMXSFILES) $(CMXAFILES) $(CMOFILESTOINSTALL:.cmo=.cmx)
+else
+DO_NATDYNLINK =
+endif
+
+ALLDFILES = $(addsuffix .d,$(ALLSRCFILES) $(VDFILE))
+
+# Compilation targets #########################################################
+
+all:
+ $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" pre-all
+ $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" real-all
+ $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" post-all
+.PHONY: all
+
+all.timing.diff:
+ $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" pre-all
+ $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" real-all.timing.diff TIME_OF_PRETTY_BUILD_EXTRA_FILES=""
+ $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" post-all
+.PHONY: all.timing.diff
+
+make-pretty-timed-before:: TIME_OF_BUILD_FILE=$(TIME_OF_BUILD_BEFORE_FILE)
+make-pretty-timed-after:: TIME_OF_BUILD_FILE=$(TIME_OF_BUILD_AFTER_FILE)
+make-pretty-timed make-pretty-timed-before make-pretty-timed-after::
+ $(HIDE)rm -f pretty-timed-success.ok
+ $(HIDE)($(MAKE) --no-print-directory -f "$(PARENT)" $(TGTS) TIMED=1 2>&1 && touch pretty-timed-success.ok) | tee -a $(TIME_OF_BUILD_FILE)
+ $(HIDE)rm pretty-timed-success.ok # must not be -f; must fail if the touch failed
+print-pretty-timed::
+ $(HIDE)$(COQMAKE_ONE_TIME_FILE) $(TIME_OF_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES)
+print-pretty-timed-diff::
+ $(HIDE)$(COQMAKE_BOTH_TIME_FILES) --sort-by=$(TIMING_SORT_BY) $(TIME_OF_BUILD_AFTER_FILE) $(TIME_OF_BUILD_BEFORE_FILE) $(TIME_OF_PRETTY_BOTH_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES)
+ifeq (,$(BEFORE))
+print-pretty-single-time-diff::
+ @echo 'Error: Usage: $(MAKE) print-pretty-single-time-diff AFTER=path/to/file.v.after-timing BEFORE=path/to/file.v.before-timing'
+ $(HIDE)false
+else
+ifeq (,$(AFTER))
+print-pretty-single-time-diff::
+ @echo 'Error: Usage: $(MAKE) print-pretty-single-time-diff AFTER=path/to/file.v.after-timing BEFORE=path/to/file.v.before-timing'
+ $(HIDE)false
+else
+print-pretty-single-time-diff::
+ $(HIDE)$(COQMAKE_BOTH_SINGLE_TIMING_FILES) --sort-by=$(TIMING_SORT_BY) $(AFTER) $(BEFORE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BUILD_EXTRA_FILES)
+endif
+endif
+pretty-timed:
+ $(HIDE)$(MAKE) --no-print-directory -f "$(PARENT)" make-pretty-timed
+ $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" print-pretty-timed
+.PHONY: pretty-timed make-pretty-timed make-pretty-timed-before make-pretty-timed-after print-pretty-timed print-pretty-timed-diff print-pretty-single-time-diff
+
+# Extension points for actions to be performed before/after the all target
+pre-all::
+ @# Extension point
+ $(HIDE)if [ "$(COQMAKEFILE_VERSION)" != "$(COQ_VERSION)" ]; then\
+ echo "W: This Makefile was generated by Coq $(COQMAKEFILE_VERSION)";\
+ echo "W: while the current Coq version is $(COQ_VERSION)";\
+ fi
+.PHONY: pre-all
+
+post-all::
+ @# Extension point
+.PHONY: post-all
+
+real-all: $(VOFILES) $(if $(USEBYTE),bytefiles,optfiles)
+.PHONY: real-all
+
+real-all.timing.diff: $(VOFILES:.vo=.v.timing.diff)
+.PHONY: real-all.timing.diff
+
+bytefiles: $(CMOFILES) $(CMAFILES)
+.PHONY: bytefiles
+
+optfiles: $(if $(DO_NATDYNLINK),$(CMXSFILES))
+.PHONY: optfiles
+
+# FIXME, see Ralf's bugreport
+quick: $(VOFILES:.vo=.vio)
+.PHONY: quick
+
+vio2vo:
+ $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) \
+ -schedule-vio2vo $(J) $(VOFILES:%.vo=%.vio)
+.PHONY: vio2vo
+
+quick2vo:
+ $(HIDE)make -j $(J) quick
+ $(HIDE)VIOFILES=$$(for vofile in $(VOFILES); do \
+ viofile="$$(echo "$$vofile" | sed "s/\.vo$$/.vio/")"; \
+ if [ "$$vofile" -ot "$$viofile" -o ! -e "$$vofile" ]; then printf "$$viofile "; fi; \
+ done); \
+ echo "VIO2VO: $$VIOFILES"; \
+ if [ -n "$$VIOFILES" ]; then \
+ $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) -schedule-vio2vo $(J) $$VIOFILES; \
+ fi
+.PHONY: quick2vo
+
+checkproofs:
+ $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) \
+ -schedule-vio-checking $(J) $(VOFILES:%.vo=%.vio)
+.PHONY: checkproofs
+
+validate: $(VOFILES)
+ $(TIMER) $(COQCHK) $(COQCHKFLAGS) $(COQLIBS) $^
+.PHONY: validate
+
+only: $(TGTS)
+.PHONY: only
+
+# Documentation targets #######################################################
+
+html: $(GLOBFILES) $(VFILES)
+ $(SHOW)'COQDOC -d html $(GAL)'
+ $(HIDE)mkdir -p html
+ $(HIDE)$(COQDOC) \
+ -toc $(COQDOCFLAGS) -html $(GAL) $(COQDOCLIBS) -d html $(VFILES)
+
+mlihtml: $(MLIFILES:.mli=.cmi)
+ $(SHOW)'CAMLDOC -d $@'
+ $(HIDE)mkdir $@ || rm -rf $@/*
+ $(HIDE)$(CAMLDOC) -html \
+ -d $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES)
+
+all-mli.tex: $(MLIFILES:.mli=.cmi)
+ $(SHOW)'CAMLDOC -latex $@'
+ $(HIDE)$(CAMLDOC) -latex \
+ -o $@ -m A $(CAMLDEBUG) $(CAMLDOCFLAGS) $(MLIFILES)
+
+all.ps: $(VFILES)
+ $(SHOW)'COQDOC -ps $(GAL)'
+ $(HIDE)$(COQDOC) \
+ -toc $(COQDOCFLAGS) -ps $(GAL) $(COQDOCLIBS) \
+ -o $@ `$(COQDEP) -sort -suffix .v $(VFILES)`
+
+all.pdf: $(VFILES)
+ $(SHOW)'COQDOC -pdf $(GAL)'
+ $(HIDE)$(COQDOC) \
+ -toc $(COQDOCFLAGS) -pdf $(GAL) $(COQDOCLIBS) \
+ -o $@ `$(COQDEP) -sort -suffix .v $(VFILES)`
+
+# FIXME: not quite right, since the output name is different
+gallinahtml: GAL=-g
+gallinahtml: html
+
+all-gal.ps: GAL=-g
+all-gal.ps: all.ps
+
+all-gal.pdf: GAL=-g
+all-gal.pdf: all.pdf
+
+# ?
+beautify: $(BEAUTYFILES)
+ for file in $^; do mv $${file%.beautified} $${file%beautified}old && mv $${file} $${file%.beautified}; done
+ @echo 'Do not do "make clean" until you are sure that everything went well!'
+ @echo 'If there were a problem, execute "for file in $$(find . -name \*.v.old -print); do mv $${file} $${file%.old}; done" in your shell/'
+.PHONY: beautify
+
+# Installation targets ########################################################
+#
+# There rules can be extended in Makefile.local
+# Extensions can't assume when they run.
+
+install:
+ $(HIDE)code=0; for f in $(FILESTOINSTALL); do\
+ if ! [ -f "$$f" ]; then >&2 echo $$f does not exist; code=1; fi \
+ done; exit $$code
+ $(HIDE)for f in $(FILESTOINSTALL); do\
+ df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`";\
+ if [ "$$?" != "0" -o -z "$$df" ]; then\
+ echo SKIP "$$f" since it has no logical path;\
+ else\
+ install -d "$(COQLIBINSTALL)/$$df" &&\
+ install -m 0644 "$$f" "$(COQLIBINSTALL)/$$df" &&\
+ echo INSTALL "$$f" "$(COQLIBINSTALL)/$$df";\
+ fi;\
+ done
+ $(HIDE)$(MAKE) install-extra -f "$(SELF)"
+install-extra::
+ @# Extension point
+.PHONY: install install-extra
+
+install-byte:
+ $(HIDE)for f in $(BYTEFILESTOINSTALL); do\
+ df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`";\
+ if [ "$$?" != "0" -o -z "$$df" ]; then\
+ echo SKIP "$$f" since it has no logical path;\
+ else\
+ install -d "$(COQLIBINSTALL)/$$df" &&\
+ install -m 0644 "$$f" "$(COQLIBINSTALL)/$$df" &&\
+ echo INSTALL "$$f" "$(COQLIBINSTALL)/$$df";\
+ fi;\
+ done
+
+install-doc:: html mlihtml
+ @# Extension point
+ $(HIDE)install -d "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/html"
+ $(HIDE)for i in html/*; do \
+ dest="$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/$$i";\
+ install -m 0644 "$$i" "$$dest";\
+ echo INSTALL "$$i" "$$dest";\
+ done
+ $(HIDE)install -d \
+ "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/mlihtml"
+ $(HIDE)for i in mlihtml/*; do \
+ dest="$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/$$i";\
+ install -m 0644 "$$i" "$$dest";\
+ echo INSTALL "$$i" "$$dest";\
+ done
+.PHONY: install-doc
+
+uninstall::
+ @# Extension point
+ $(HIDE)for f in $(FILESTOINSTALL); do \
+ df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`" &&\
+ instf="$(COQLIBINSTALL)/$$df/`basename $$f`" &&\
+ rm -f "$$instf" &&\
+ echo RM "$$instf" &&\
+ (rmdir "$(call concat_path,,$(COQLIBINSTALL)/$$df/)" 2>/dev/null || true); \
+ done
+.PHONY: uninstall
+
+uninstall-doc::
+ @# Extension point
+ $(SHOW)'RM $(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/html'
+ $(HIDE)rm -rf "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/html"
+ $(SHOW)'RM $(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/mlihtml'
+ $(HIDE)rm -rf "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/mlihtml"
+ $(HIDE) rmdir "$(COQDOCINSTALL)/$(INSTALLCOQDOCROOT)/" || true
+.PHONY: uninstall-doc
+
+# Cleaning ####################################################################
+#
+# There rules can be extended in Makefile.local
+# Extensions can't assume when they run.
+
+clean::
+ @# Extension point
+ $(SHOW)'CLEAN'
+ $(HIDE)rm -f $(CMOFILES)
+ $(HIDE)rm -f $(CMIFILES)
+ $(HIDE)rm -f $(CMAFILES)
+ $(HIDE)rm -f $(CMOFILES:.cmo=.cmx)
+ $(HIDE)rm -f $(CMXAFILES)
+ $(HIDE)rm -f $(CMXSFILES)
+ $(HIDE)rm -f $(CMOFILES:.cmo=.o)
+ $(HIDE)rm -f $(CMXAFILES:.cmxa=.a)
+ $(HIDE)rm -f $(MLGFILES:.mlg=.ml)
+ $(HIDE)rm -f $(ALLDFILES)
+ $(HIDE)rm -f $(NATIVEFILES)
+ $(HIDE)find . -name .coq-native -type d -empty -delete
+ $(HIDE)rm -f $(VOFILES)
+ $(HIDE)rm -f $(VOFILES:.vo=.vio)
+ $(HIDE)rm -f $(BEAUTYFILES) $(VFILES:=.old)
+ $(HIDE)rm -f all.ps all-gal.ps all.pdf all-gal.pdf all.glob all-mli.tex
+ $(HIDE)rm -f $(VFILES:.v=.glob)
+ $(HIDE)rm -f $(VFILES:.v=.tex)
+ $(HIDE)rm -f $(VFILES:.v=.g.tex)
+ $(HIDE)rm -f pretty-timed-success.ok
+ $(HIDE)rm -rf html mlihtml
+.PHONY: clean
+
+cleanall:: clean
+ @# Extension point
+ $(SHOW)'CLEAN *.aux *.timing'
+ $(HIDE)rm -f $(foreach f,$(VFILES:.v=),$(dir $(f)).$(notdir $(f)).aux)
+ $(HIDE)rm -f $(TIME_OF_BUILD_FILE) $(TIME_OF_BUILD_BEFORE_FILE) $(TIME_OF_BUILD_AFTER_FILE) $(TIME_OF_PRETTY_BUILD_FILE) $(TIME_OF_PRETTY_BOTH_BUILD_FILE)
+ $(HIDE)rm -f $(VOFILES:.vo=.v.timing)
+ $(HIDE)rm -f $(VOFILES:.vo=.v.before-timing)
+ $(HIDE)rm -f $(VOFILES:.vo=.v.after-timing)
+ $(HIDE)rm -f $(VOFILES:.vo=.v.timing.diff)
+.PHONY: cleanall
+
+archclean::
+ @# Extension point
+ $(SHOW)'CLEAN *.cmx *.o'
+ $(HIDE)rm -f $(NATIVEFILES)
+ $(HIDE)rm -f $(CMOFILES:%.cmo=%.cmx)
+.PHONY: archclean
+
+
+# Compilation rules ###########################################################
+
+$(MLIFILES:.mli=.cmi): %.cmi: %.mli
+ $(SHOW)'CAMLC -c $<'
+ $(HIDE)$(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) $<
+
+$(MLGFILES:.mlg=.ml): %.ml: %.mlg
+ $(SHOW)'COQPP $<'
+ $(HIDE)$(COQPP) $<
+
+# Stupid hack around a deficient syntax: we cannot concatenate two expansions
+$(filter %.cmo, $(MLFILES:.ml=.cmo) $(MLGFILES:.mlg=.cmo)): %.cmo: %.ml
+ $(SHOW)'CAMLC -c $<'
+ $(HIDE)$(CAMLC) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) $<
+
+# Same hack
+$(filter %.cmx, $(MLFILES:.ml=.cmx) $(MLGFILES:.mlg=.cmx)): %.cmx: %.ml
+ $(SHOW)'CAMLOPT -c $(FOR_PACK) $<'
+ $(HIDE)$(CAMLOPTC) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) $(FOR_PACK) $<
+
+
+$(MLLIBFILES:.mllib=.cmxs): %.cmxs: %.cmxa
+ $(SHOW)'CAMLOPT -shared -o $@'
+ $(HIDE)$(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) \
+ -linkall -shared -o $@ $<
+
+$(MLLIBFILES:.mllib=.cma): %.cma: | %.mllib
+ $(SHOW)'CAMLC -a -o $@'
+ $(HIDE)$(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) -a -o $@ $^
+
+$(MLLIBFILES:.mllib=.cmxa): %.cmxa: | %.mllib
+ $(SHOW)'CAMLOPT -a -o $@'
+ $(HIDE)$(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) -a -o $@ $^
+
+
+$(MLPACKFILES:.mlpack=.cmxs): %.cmxs: %.cmxa
+ $(SHOW)'CAMLOPT -shared -o $@'
+ $(HIDE)$(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) \
+ -shared -linkall -o $@ $<
+
+$(MLPACKFILES:.mlpack=.cmxa): %.cmxa: %.cmx
+ $(SHOW)'CAMLOPT -a -o $@'
+ $(HIDE)$(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) -a -o $@ $<
+
+$(MLPACKFILES:.mlpack=.cma): %.cma: %.cmo | %.mlpack
+ $(SHOW)'CAMLC -a -o $@'
+ $(HIDE)$(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) -a -o $@ $^
+
+$(MLPACKFILES:.mlpack=.cmo): %.cmo: | %.mlpack
+ $(SHOW)'CAMLC -pack -o $@'
+ $(HIDE)$(CAMLLINK) $(CAMLDEBUG) $(CAMLFLAGS) -pack -o $@ $^
+
+$(MLPACKFILES:.mlpack=.cmx): %.cmx: | %.mlpack
+ $(SHOW)'CAMLOPT -pack -o $@'
+ $(HIDE)$(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) -pack -o $@ $^
+
+# This rule is for _CoqProject with no .mllib nor .mlpack
+$(filter-out $(MLLIBFILES:.mllib=.cmxs) $(MLPACKFILES:.mlpack=.cmxs) $(addsuffix .cmxs,$(PACKEDFILES)) $(addsuffix .cmxs,$(LIBEDFILES)),$(MLFILES:.ml=.cmxs) $(MLGFILES:.mlg=.cmxs)): %.cmxs: %.cmx
+ $(SHOW)'[deprecated,use-mllib-or-mlpack] CAMLOPT -shared -o $@'
+ $(HIDE)$(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(CAMLPKGS) \
+ -shared -o $@ $<
+
+ifneq (,$(TIMING))
+TIMING_EXTRA = > $<.$(TIMING_EXT)
+else
+TIMING_EXTRA =
+endif
+
+$(VOFILES): %.vo: %.v
+ $(SHOW)COQC $<
+ $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) $< $(TIMING_EXTRA)
+
+# FIXME ?merge with .vo / .vio ?
+$(GLOBFILES): %.glob: %.v
+ $(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $<
+
+$(VFILES:.v=.vio): %.vio: %.v
+ $(SHOW)COQC -quick $<
+ $(HIDE)$(TIMER) $(COQC) -quick $(COQDEBUG) $(COQFLAGS) $(COQLIBS) $<
+
+$(addsuffix .timing.diff,$(VFILES)): %.timing.diff : %.before-timing %.after-timing
+ $(SHOW)PYTHON TIMING-DIFF $<
+ $(HIDE)$(MAKE) --no-print-directory -f "$(SELF)" print-pretty-single-time-diff BEFORE=$*.before-timing AFTER=$*.after-timing TIME_OF_PRETTY_BUILD_FILE="$@"
+
+$(BEAUTYFILES): %.v.beautified: %.v
+ $(SHOW)'BEAUTIFY $<'
+ $(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(COQFLAGS) $(COQLIBS) -beautify $<
+
+$(TEXFILES): %.tex: %.v
+ $(SHOW)'COQDOC -latex $<'
+ $(HIDE)$(COQDOC) $(COQDOCFLAGS) -latex $< -o $@
+
+$(GTEXFILES): %.g.tex: %.v
+ $(SHOW)'COQDOC -latex -g $<'
+ $(HIDE)$(COQDOC) $(COQDOCFLAGS) -latex -g $< -o $@
+
+$(HTMLFILES): %.html: %.v %.glob
+ $(SHOW)'COQDOC -html $<'
+ $(HIDE)$(COQDOC) $(COQDOCFLAGS) -html $< -o $@
+
+$(GHTMLFILES): %.g.html: %.v %.glob
+ $(SHOW)'COQDOC -html -g $<'
+ $(HIDE)$(COQDOC) $(COQDOCFLAGS) -html -g $< -o $@
+
+# Dependency files ############################################################
+
+ifndef MAKECMDGOALS
+ -include $(ALLDFILES)
+else
+ ifneq ($(filter-out archclean clean cleanall printenv make-pretty-timed make-pretty-timed-before make-pretty-timed-after print-pretty-timed print-pretty-timed-diff print-pretty-single-time-diff,$(MAKECMDGOALS)),)
+ -include $(ALLDFILES)
+ endif
+endif
+
+.SECONDARY: $(ALLDFILES)
+
+redir_if_ok = > "$@" || ( RV=$$?; rm -f "$@"; exit $$RV )
+
+GENMLFILES:=$(MLGFILES:.mlg=.ml)
+$(addsuffix .d,$(ALLSRCFILES)): $(GENMLFILES)
+
+$(addsuffix .d,$(MLIFILES)): %.mli.d: %.mli
+ $(SHOW)'CAMLDEP $<'
+ $(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok)
+
+$(addsuffix .d,$(MLGFILES)): %.mlg.d: %.ml
+ $(SHOW)'CAMLDEP $<'
+ $(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok)
+
+$(addsuffix .d,$(MLFILES)): %.ml.d: %.ml
+ $(SHOW)'CAMLDEP $<'
+ $(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok)
+
+$(addsuffix .d,$(MLLIBFILES)): %.mllib.d: %.mllib
+ $(SHOW)'COQDEP $<'
+ $(HIDE)$(COQDEP) $(OCAMLLIBS) -c "$<" $(redir_if_ok)
+
+$(addsuffix .d,$(MLPACKFILES)): %.mlpack.d: %.mlpack
+ $(SHOW)'COQDEP $<'
+ $(HIDE)$(COQDEP) $(OCAMLLIBS) -c "$<" $(redir_if_ok)
+
+# If this makefile is created using a _CoqProject we have coqdep get
+# options from it. This avoids argument length limits for pathological
+# projects. Note that extra options might be on the command line.
+VDFILE_FLAGS:=$(if _CoqProject,-f _CoqProject,) $(CMDLINE_COQLIBS) $(CMDLINE_VFILES)
+
+$(VDFILE).d: $(VFILES)
+ $(SHOW)'COQDEP VFILES'
+ $(HIDE)$(COQDEP) -dyndep var $(VDFILE_FLAGS) $(redir_if_ok)
+
+# Misc ########################################################################
+
+byte:
+ $(HIDE)$(MAKE) all "OPT:=-byte" -f "$(SELF)"
+.PHONY: byte
+
+opt:
+ $(HIDE)$(MAKE) all "OPT:=-opt" -f "$(SELF)"
+.PHONY: opt
+
+# This is deprecated. To extend this makefile use
+# extension points and Makefile.local
+printenv::
+ $(warning printenv is deprecated)
+ $(warning write extensions in Makefile.local or include Makefile.conf)
+ @echo 'LOCAL = $(LOCAL)'
+ @echo 'COQLIB = $(COQLIB)'
+ @echo 'DOCDIR = $(DOCDIR)'
+ @echo 'OCAMLFIND = $(OCAMLFIND)'
+ @echo 'HASNATDYNLINK = $(HASNATDYNLINK)'
+ @echo 'SRC_SUBDIRS = $(SRC_SUBDIRS)'
+ @echo 'COQ_SRC_SUBDIRS = $(COQ_SRC_SUBDIRS)'
+ @echo 'OCAMLFIND = $(OCAMLFIND)'
+ @echo 'PP = $(PP)'
+ @echo 'COQFLAGS = $(COQFLAGS)'
+ @echo 'COQLIB = $(COQLIBS)'
+ @echo 'COQLIBINSTALL = $(COQLIBINSTALL)'
+ @echo 'COQDOCINSTALL = $(COQDOCINSTALL)'
+.PHONY: printenv
+
+# Generate a .merlin file. If you need to append directives to this
+# file you can extend the merlin-hook target in Makefile.local
+.merlin:
+ $(SHOW)'FILL .merlin'
+ $(HIDE)echo 'FLG $(COQMF_CAMLFLAGS)' > .merlin
+ $(HIDE)echo 'B $(COQLIB)' >> .merlin
+ $(HIDE)echo 'S $(COQLIB)' >> .merlin
+ $(HIDE)$(foreach d,$(COQ_SRC_SUBDIRS), \
+ echo 'B $(COQLIB)$(d)' >> .merlin;)
+ $(HIDE)$(foreach d,$(COQ_SRC_SUBDIRS), \
+ echo 'S $(COQLIB)$(d)' >> .merlin;)
+ $(HIDE)$(foreach d,$(SRC_SUBDIRS), echo 'B $(d)' >> .merlin;)
+ $(HIDE)$(foreach d,$(SRC_SUBDIRS), echo 'S $(d)' >> .merlin;)
+ $(HIDE)$(MAKE) merlin-hook -f "$(SELF)"
+.PHONY: merlin
+
+merlin-hook::
+ @# Extension point
+.PHONY: merlin-hook
+
+# prints all variables
+debug:
+ $(foreach v,\
+ $(sort $(filter-out $(INITIAL_VARS) INITIAL_VARS,\
+ $(.VARIABLES))),\
+ $(info $(v) = $($(v))))
+.PHONY: debug
+
+.DEFAULT_GOAL := all
+
+# Local Variables:
+# mode: makefile-gmake
+# End:
diff --git a/src/versions/standard/Makefile.local b/src/Makefile.local
index 8abc72c..8abc72c 100644
--- a/src/versions/standard/Makefile.local
+++ b/src/Makefile.local
diff --git a/src/Misc.v b/src/Misc.v
index 14a55ea..520c41c 100644
--- a/src/Misc.v
+++ b/src/Misc.v
@@ -815,26 +815,26 @@ Section List2.
| In2_hd : forall l, In j l -> In2 i j (i::l)
| In2_tl : forall k l, In2 i j l -> In2 i j (k::l).
- Local Hint Constructors In2.
+ Local Hint Constructors In2 : smtcoq_in2.
Lemma In2_app : forall i j l m, In2 i j (l ++ m) <->
In2 i j l \/ (In i l /\ In j m) \/ In2 i j m.
Proof.
- intros i j; induction l as [ |t l IHl]; simpl; intro m; split; auto.
- intros [H|[[H _]|H]]; auto.
+ intros i j; induction l as [ |t l IHl]; simpl; intro m; split; auto with smtcoq_in2.
+ intros [H|[[H _]|H]]; auto with smtcoq_in2.
inversion H.
elim H.
intro H; inversion H; clear H.
- subst i l0; rewrite in_app_iff in H1; destruct H1 as [H1|H1]; auto.
- subst k l0; rewrite IHl in H1; destruct H1 as [H1|[[H1 H2]|H1]]; auto.
+ subst i l0; rewrite in_app_iff in H1; destruct H1 as [H1|H1]; auto with smtcoq_in2.
+ subst k l0; rewrite IHl in H1; destruct H1 as [H1|[[H1 H2]|H1]]; auto with smtcoq_in2.
intros [H|[[[H|H] H1]|H]].
inversion H; clear H.
- subst i l0; constructor 1; rewrite in_app_iff; auto.
- subst k l0; constructor 2; rewrite IHl; left; auto.
- subst t; constructor 1; rewrite in_app_iff; auto.
- constructor 2; rewrite IHl; right; left; auto.
- constructor 2; rewrite IHl; right; right; auto.
+ subst i l0; constructor 1; rewrite in_app_iff; auto with smtcoq_in2.
+ subst k l0; constructor 2; rewrite IHl; left; auto with smtcoq_in2.
+ subst t; constructor 1; rewrite in_app_iff; auto with smtcoq_in2.
+ constructor 2; rewrite IHl; right; left; auto with smtcoq_in2.
+ constructor 2; rewrite IHl; right; right; auto with smtcoq_in2.
Qed.
@@ -848,17 +848,17 @@ Section List2.
Lemma In2_rev_aux : forall i j l acc, In2 i j (rev_aux acc l) <->
In2 i j acc \/ (In i l /\ In j acc) \/ In2 j i l.
Proof.
- intros i j; induction l as [ |t q IHq]; simpl; intro acc; split; auto.
- intros [H|[[H _]|H]]; auto.
+ intros i j; induction l as [ |t q IHq]; simpl; intro acc; split; auto with smtcoq_in2.
+ intros [H|[[H _]|H]]; auto with smtcoq_in2.
elim H.
inversion H.
- rewrite IHq; clear IHq; intros [H|[[H1 H2]|H]]; auto.
- inversion H; auto.
- inversion H2; auto; clear H2; subst t; right; right; auto.
- intros [H|[[[H1|H1] H2]|H]]; rewrite IHq; clear IHq; auto.
- subst t; auto.
- right; left; split; auto; constructor 2; auto.
- inversion H; clear H; auto; subst j l; right; left; split; auto; constructor 1; auto.
+ rewrite IHq; clear IHq; intros [H|[[H1 H2]|H]]; auto with smtcoq_in2.
+ inversion H; auto with smtcoq_in2.
+ inversion H2; auto with smtcoq_in2; clear H2; subst t; right; right; auto with smtcoq_in2.
+ intros [H|[[[H1|H1] H2]|H]]; rewrite IHq; clear IHq; auto with smtcoq_in2.
+ subst t; auto with smtcoq_in2.
+ right; left; split; auto with smtcoq_in2; constructor 2; auto with smtcoq_in2.
+ inversion H; clear H; auto with smtcoq_in2; subst j l; right; left; split; auto with smtcoq_in2; constructor 1; auto with smtcoq_in2.
Qed.
@@ -867,7 +867,7 @@ Section List2.
Lemma In2_rev : forall i j l, In2 i j (rev l) <-> In2 j i l.
Proof.
- intros i j l; unfold rev; rewrite In2_rev_aux; split; auto; intros [H|[[_ H]|H]]; auto; inversion H.
+ intros i j l; unfold rev; rewrite In2_rev_aux; split; auto with smtcoq_in2; intros [H|[[_ H]|H]]; auto with smtcoq_in2; inversion H.
Qed.
@@ -877,15 +877,15 @@ Section List2.
intros [H1 H2]; generalize H1 H2; clear H1 H2; induction l as [ |t q IHq].
intro H1; inversion H1.
intros H1 H2; inversion H1; clear H1.
- subst t; inversion H2; auto; elim H; auto.
+ subst t; inversion H2; auto with smtcoq_in2; elim H; auto with smtcoq_in2.
inversion H2; clear H2.
- subst t; auto.
- destruct (IHq H0 H1) as [H2|H2]; auto.
+ subst t; auto with smtcoq_in2.
+ destruct (IHq H0 H1) as [H2|H2]; auto with smtcoq_in2.
intros [H1|H1]; induction H1 as [H1|t q H1 [IH1 IH2]].
- split; [constructor 1|constructor 2]; auto.
- split; constructor 2; auto.
- split; [constructor 2|constructor 1]; auto.
- split; constructor 2; auto.
+ split; [constructor 1|constructor 2]; auto with smtcoq_in2.
+ split; constructor 2; auto with smtcoq_in2.
+ split; [constructor 2|constructor 1]; auto with smtcoq_in2.
+ split; constructor 2; auto with smtcoq_in2.
Qed.
End List2.
@@ -944,32 +944,32 @@ Section Distinct.
distinct_aux acc' q
end.
- Local Hint Constructors In2.
+ Local Hint Constructors In2 : smtcoq_in2.
Lemma distinct_aux_spec : forall l acc, distinct_aux acc l = true <->
acc = true /\ (forall i j, In2 i j l -> eq i j = false).
Proof.
induction l as [ |t q IHq]; simpl.
intro acc; split.
- intro H; split; auto; intros i j H1; inversion H1.
- intros [H _]; auto.
+ intro H; split; auto with smtcoq_in2; intros i j H1; inversion H1.
+ intros [H _]; auto with smtcoq_in2.
intro acc; rewrite (IHq (distinct_aux2 acc t q)), distinct_aux2_spec; split.
- intros [[H1 H2] H3]; split; auto; intros i j H; inversion H; auto.
- intros [H1 H2]; repeat split; auto.
+ intros [[H1 H2] H3]; split; auto with smtcoq_in2; intros i j H; inversion H; auto with smtcoq_in2.
+ intros [H1 H2]; repeat split; auto with smtcoq_in2.
Qed.
Lemma distinct_aux_spec_neg : forall l acc, distinct_aux acc l = false <->
acc = false \/ (exists i j, In2 i j l /\ eq i j = true).
Proof.
induction l as [ |t q IHq]; simpl.
- intro acc; split; auto; intros [H|[i [j [H _]]]]; auto; inversion H.
+ intro acc; split; auto with smtcoq_in2; intros [H|[i [j [H _]]]]; auto with smtcoq_in2; inversion H.
intro acc; rewrite (IHq (distinct_aux2 acc t q)), distinct_aux2_spec_neg; split.
- intros [[H|[i [H1 H2]]]|[i [j [H1 H2]]]]; auto.
- right; exists t; exists i; auto.
- right; exists i; exists j; auto.
- intros [H|[i [j [H1 H2]]]]; auto; inversion H1; clear H1.
- subst i l; left; right; exists j; auto.
- subst k l; right; exists i; exists j; auto.
+ intros [[H|[i [H1 H2]]]|[i [j [H1 H2]]]]; auto with smtcoq_in2.
+ right; exists t; exists i; auto with smtcoq_in2.
+ right; exists i; exists j; auto with smtcoq_in2.
+ intros [H|[i [j [H1 H2]]]]; auto with smtcoq_in2; inversion H1; clear H1.
+ subst i l; left; right; exists j; auto with smtcoq_in2.
+ subst k l; right; exists i; exists j; auto with smtcoq_in2.
Qed.
Definition distinct := distinct_aux true.
@@ -977,13 +977,13 @@ Section Distinct.
Lemma distinct_spec : forall l, distinct l = true <->
(forall i j, In2 i j l -> eq i j = false).
Proof.
- unfold distinct; intro l; rewrite distinct_aux_spec; split; auto; intros [_ H]; auto.
+ unfold distinct; intro l; rewrite distinct_aux_spec; split; auto with smtcoq_in2; intros [_ H]; auto with smtcoq_in2.
Qed.
Lemma distinct_false_spec : forall l, distinct l = false <->
(exists i j, In2 i j l /\ eq i j = true).
Proof.
- unfold distinct; intro l; rewrite distinct_aux_spec_neg; split; auto; intros [H|H]; auto; discriminate.
+ unfold distinct; intro l; rewrite distinct_aux_spec_neg; split; auto with smtcoq_in2; intros [H|H]; auto with smtcoq_in2; discriminate.
Qed.
End Distinct.
diff --git a/src/PropToBool.v b/src/PropToBool.v
index ec3b64c..7286216 100644
--- a/src/PropToBool.v
+++ b/src/PropToBool.v
@@ -158,7 +158,7 @@ Ltac prop2bool_hyp H :=
| Prop => fail
| _ => intro
end
- | [ |- context[@eq ?A _ _] ] => instantiate (prop2bool_t_evar := A); instantiate (prop2bool_comp_evar := true)
+ | [ |- context[@Logic.eq ?A _ _] ] => instantiate (prop2bool_t_evar := A); instantiate (prop2bool_comp_evar := true)
| _ => instantiate (prop2bool_t_evar := nat); instantiate (prop2bool_comp_evar := false)
end;
destruct HFalse
diff --git a/src/QInst.v b/src/QInst.v
index 26430f1..b2dd836 100644
--- a/src/QInst.v
+++ b/src/QInst.v
@@ -27,7 +27,7 @@ Proof.
installed when we compile SMTCoq. *)
Qed.
-Hint Resolve impl_split.
+Hint Resolve impl_split : smtcoq_core.
(** verit silently transforms an <implb (a || b) c> into a <or (not a) c>
or into a <or (not b) c> when instantiating such a quantified theorem *)
@@ -208,7 +208,7 @@ Ltac vauto :=
end
]
);
- auto.
+ auto with smtcoq_core.
diff --git a/src/SMT_terms.v b/src/SMT_terms.v
index dc5063f..66936cf 100644
--- a/src/SMT_terms.v
+++ b/src/SMT_terms.v
@@ -18,7 +18,7 @@ Local Open Scope list_scope.
Local Open Scope array_scope.
Local Open Scope int63_scope.
-Hint Unfold is_true.
+Hint Unfold is_true : smtcoq_core.
(* Remark: I use Notation instead of Definition du eliminate conversion check during the type checking *)
@@ -125,11 +125,11 @@ Module Form.
destruct h;simpl;intros;trivial;
try (apply afold_left_eq;unfold is_true in H0;
rewrite PArray.forallb_spec in H0;intros;
- auto using Lit.interp_eq_compat).
+ auto using Lit.interp_eq_compat with smtcoq_core).
- f_equal;auto using Lit.interp_eq_compat.
- apply afold_right_eq;unfold is_true in H0;
rewrite PArray.forallb_spec in H0;intros;
- auto using Lit.interp_eq_compat.
+ auto using Lit.interp_eq_compat with smtcoq_core.
- unfold is_true in H0;rewrite !andb_true_iff in H0;decompose [and] H0;
rewrite !(Lit.interp_eq_compat f1 f2);auto.
- unfold is_true in H0;rewrite !andb_true_iff in H0;decompose [and] H0;
@@ -138,7 +138,7 @@ Module Form.
rewrite !(Lit.interp_eq_compat f1 f2);auto.
- replace (List.map (Lit.interp f2) l) with (List.map (Lit.interp f1) l); auto.
unfold is_true in H0. rewrite List.forallb_forall in H0.
- apply List_map_ext_in. intros x Hx. apply Lit.interp_eq_compat; auto.
+ apply List_map_ext_in. intros x Hx. apply Lit.interp_eq_compat; auto with smtcoq_core.
Qed.
Definition wf := PArray.forallbi lt_form t_form.
@@ -565,11 +565,11 @@ Module Typ.
(* TODO : Move this *)
Lemma not_false : ~ false.
Proof. intro;discriminate. Qed.
- Hint Resolve not_false.
+ Hint Resolve not_false : smtcoq_core.
Lemma is_true_true : true.
Proof. reflexivity. Qed.
- Hint Resolve is_true_true.
+ Hint Resolve is_true_true : smtcoq_core.
Lemma not_is_true_eq_false : forall b:bool, ~ b <-> b = false.
Proof. exact not_true_iff_false. Qed.
@@ -1202,8 +1202,8 @@ Qed.
intros [op|op h|op h1 h2|op ha i i0|f args | i e ]; simpl.
(* Constants *)
left; destruct op; simpl.
- exists Typ.Tpositive; auto.
- exists Typ.TZ; auto.
+ exists Typ.Tpositive; auto with smtcoq_core.
+ exists Typ.TZ; auto with smtcoq_core.
exists (Typ.TBV n); now rewrite N.eqb_refl.
(* Unary operators *)
destruct op; simpl;
@@ -1405,7 +1405,7 @@ Qed.
right. intros. rewrite andb_false_r. easy.
(* N-ary operators *)
destruct f as [ty]; simpl; case (List.forallb (fun t1 : int => Typ.eqb (get_type t1) ty) args).
- left; exists Typ.Tbool; auto.
+ left; exists Typ.Tbool; auto with smtcoq_core.
right; intro T; rewrite andb_false_r; auto.
(* Application *)
case (v_type Typ.ftype interp_ft (t_func .[ i])); intros; apply check_args_dec.
diff --git a/src/versions/standard/Tactics_standard.v b/src/Tactics.v
index f79b253..f79b253 100644
--- a/src/versions/standard/Tactics_standard.v
+++ b/src/Tactics.v
diff --git a/src/Trace.v b/src/Trace.v
index f56e254..b6715ab 100644
--- a/src/Trace.v
+++ b/src/Trace.v
@@ -11,7 +11,6 @@
Require Import Bool Int63 PArray.
-Require Structures.
Require Import Misc State SMT_terms.
Require Import Syntactic Arithmetic Operators Assumptions.
Require Import Cnf Euf Lia BVList Bva_checker Array_checker.
@@ -34,7 +33,7 @@ Section trace.
Variable rho : Valuation.t.
- Definition _trace_ := Structures.trace step.
+ Definition _trace_ := ((list step) * step)%type.
(* A checker for such a trace *)
@@ -42,7 +41,7 @@ Section trace.
Hypothesis is_false_correct : forall c, is_false c -> ~ C.interp rho c.
Definition _checker_ (s: S.t) (t: _trace_) (confl:clause_id) : bool :=
- let s' := Structures.trace_fold check_step s t in
+ let s' := List.fold_left check_step (fst t) s in
(* let s' := PArray.fold_left (fun s a => PArray.fold_left check_step s a) s t in *)
is_false (S.get s' confl).
(* Register _checker_ as PrimInline. *)
@@ -78,7 +77,11 @@ Section trace.
intros s t' cid Hf Hv.
apply (is_false_correct Hf).
apply S.valid_get.
- apply Structures.trace_fold_ind; auto.
+ clear Hf.
+ rewrite <- List.fold_left_rev_right in *.
+ induction (List.rev (fst t')); [ apply Hv | ].
+ apply valid_check_step.
+ apply IHl.
(* apply PArray.fold_left_ind; auto. *)
(* intros a i _ Ha;apply PArray.fold_left_ind;trivial. *)
(* intros a0 i0 _ H1;auto. *)
@@ -280,7 +283,7 @@ Module Cnf_Checker.
checker_b t_form l b c = true ->
Lit.interp (Form.interp_state_var (PArray.get t_var) (fun _ s => BITVECTOR_LIST.zeros s) t_form) l = b.
Proof.
- unfold checker_b; intros t_var t_form l b c; case b; case_eq (Lit.interp (Form.interp_state_var (get t_var) (fun _ s => BITVECTOR_LIST.zeros s) t_form) l); auto; intros H1 H2; elim (checker_correct H2 (rho:=get t_var) (rhobv:=fun _ s => BITVECTOR_LIST.zeros s)); auto; rewrite Lit.interp_neg, H1; auto.
+ unfold checker_b; intros t_var t_form l b c; case b; case_eq (Lit.interp (Form.interp_state_var (get t_var) (fun _ s => BITVECTOR_LIST.zeros s) t_form) l); auto with smtcoq_core; intros H1 H2; elim (checker_correct H2 (rho:=get t_var) (rhobv:=fun _ s => BITVECTOR_LIST.zeros s)); auto with smtcoq_core; rewrite Lit.interp_neg, H1; auto with smtcoq_core.
Qed.
Definition checker_eq t_form l1 l2 l (c:certif) :=
@@ -297,8 +300,8 @@ Module Cnf_Checker.
Lit.interp (Form.interp_state_var (PArray.get t_var) (fun _ s => BITVECTOR_LIST.zeros s) t_form) l2.
Proof.
unfold checker_eq; intros t_var t_form l1 l2 l c; rewrite !andb_true_iff; case_eq (t_form .[ Lit.blit l]); [intros _ _|intros _|intros _|intros _ _ _|intros _ _|intros _ _|intros _ _|intros _ _ _|intros l1' l2' Heq|intros _ _ _ _|intros a ls Heq]; intros [[H1 H2] H3]; try discriminate; rewrite andb_true_iff in H2; rewrite !Int63Properties.eqb_spec in H2; destruct H2 as [H2 H4]; subst l1' l2'; case_eq (Lit.is_pos l); intro Heq'; rewrite Heq' in H1; try discriminate; clear H1; assert (H:PArray.default t_form = Form.Ftrue /\ Form.wf t_form).
- unfold checker in H3; destruct c as (nclauses, t, confl); rewrite andb_true_iff in H3; destruct H3 as [H3 _]; destruct (Form.check_form_correct (get t_var) (fun _ s => BITVECTOR_LIST.zeros s) _ H3) as [[Ht1 Ht2] Ht3]; split; auto.
- destruct H as [H1 H2]; case_eq (Lit.interp (Form.interp_state_var (get t_var) (fun _ s => BITVECTOR_LIST.zeros s) t_form) l1); intro Heq1; case_eq (Lit.interp (Form.interp_state_var (get t_var) (fun _ s => BITVECTOR_LIST.zeros s) t_form) l2); intro Heq2; auto; elim (checker_correct H3 (rho:=get t_var) (rhobv:=fun _ s => BITVECTOR_LIST.zeros s)); unfold Lit.interp; rewrite Heq'; unfold Var.interp; rewrite Form.wf_interp_form; auto; rewrite Heq; simpl; rewrite Heq1, Heq2; auto.
+ unfold checker in H3; destruct c as (nclauses, t, confl); rewrite andb_true_iff in H3; destruct H3 as [H3 _]; destruct (Form.check_form_correct (get t_var) (fun _ s => BITVECTOR_LIST.zeros s) _ H3) as [[Ht1 Ht2] Ht3]; split; auto with smtcoq_core.
+ destruct H as [H1 H2]; case_eq (Lit.interp (Form.interp_state_var (get t_var) (fun _ s => BITVECTOR_LIST.zeros s) t_form) l1); intro Heq1; case_eq (Lit.interp (Form.interp_state_var (get t_var) (fun _ s => BITVECTOR_LIST.zeros s) t_form) l2); intro Heq2; auto with smtcoq_core; elim (checker_correct H3 (rho:=get t_var) (rhobv:=fun _ s => BITVECTOR_LIST.zeros s)); unfold Lit.interp; rewrite Heq'; unfold Var.interp; rewrite Form.wf_interp_form; auto with smtcoq_core; rewrite Heq; simpl; rewrite Heq1, Heq2; auto with smtcoq_core.
Qed.
End Cnf_Checker.
@@ -433,49 +436,49 @@ Inductive step :=
|pos orig1 orig2 res|pos orig1 orig2 res
|pos orig1 orig2 res|pos orig1 orig2 res|pos orig1 orig2 res|pos orig1 orig2 res
|pos cl |pos orig res |pos orig res |pos orig res | pos orig1 orig2 res | pos orig1 orig2 res |pos res|pos res
- |pos res |pos prem_id prem concl p|pos lemma plemma concl p]; simpl; try apply S.valid_set_clause; auto.
- - apply S.valid_set_resolve; auto.
- - apply S.valid_set_weaken; auto.
- - apply valid_check_flatten; auto; intros h1 h2 H.
- + rewrite (Syntactic.check_hatom_correct_bool _ _ _ Ha1 Ha2 _ _ H); auto.
- + rewrite (Syntactic.check_neg_hatom_correct_bool _ _ _ H10 Ha1 Ha2 _ _ H); auto.
- - apply valid_check_True; auto.
- - apply valid_check_False; auto.
- - apply valid_check_BuildDef; auto.
- - apply valid_check_BuildDef2; auto.
- - apply valid_check_BuildProj; auto.
- - apply valid_check_ImmBuildDef; auto.
- - apply valid_check_ImmBuildDef2; auto.
- - apply valid_check_ImmBuildProj; auto.
- - apply valid_check_trans; auto.
- - apply valid_check_congr; auto.
- - apply valid_check_congr_pred; auto.
- - apply valid_check_micromega; auto.
- - apply valid_check_diseq; auto.
- - apply valid_check_spl_arith; auto.
- - apply valid_check_distinct_elim; auto.
- - eapply valid_check_bbVar; eauto.
- - apply valid_check_bbConst; auto.
- - apply valid_check_bbOp; auto.
- - apply valid_check_bbNot; auto.
- - apply valid_check_bbNeg; auto.
- - apply valid_check_bbAdd; auto.
- - apply valid_check_bbConcat; auto.
- - apply valid_check_bbMult; auto.
- - apply valid_check_bbUlt; auto.
- - apply valid_check_bbSlt; auto.
- - apply valid_check_bbEq; auto.
- - apply valid_check_bbDiseq; auto.
- - apply valid_check_bbExtract; auto.
- - apply valid_check_bbZextend; auto.
- - apply valid_check_bbSextend; auto.
- - apply valid_check_bbShl; auto.
- - apply valid_check_bbShr; auto.
- - apply valid_check_roweq; auto.
- - apply valid_check_rowneq; auto.
- - apply valid_check_ext; auto.
- - apply valid_check_hole; auto.
- - apply valid_check_forall_inst with lemma; auto.
+ |pos res |pos prem_id prem concl p|pos lemma plemma concl p]; simpl; try apply S.valid_set_clause; auto with smtcoq_core.
+ - apply S.valid_set_resolve; auto with smtcoq_core.
+ - apply S.valid_set_weaken; auto with smtcoq_core.
+ - apply valid_check_flatten; auto with smtcoq_core; intros h1 h2 H.
+ + rewrite (Syntactic.check_hatom_correct_bool _ _ _ Ha1 Ha2 _ _ H); auto with smtcoq_core.
+ + rewrite (Syntactic.check_neg_hatom_correct_bool _ _ _ H10 Ha1 Ha2 _ _ H); auto with smtcoq_core.
+ - apply valid_check_True; auto with smtcoq_core.
+ - apply valid_check_False; auto with smtcoq_core.
+ - apply valid_check_BuildDef; auto with smtcoq_core.
+ - apply valid_check_BuildDef2; auto with smtcoq_core.
+ - apply valid_check_BuildProj; auto with smtcoq_core.
+ - apply valid_check_ImmBuildDef; auto with smtcoq_core.
+ - apply valid_check_ImmBuildDef2; auto with smtcoq_core.
+ - apply valid_check_ImmBuildProj; auto with smtcoq_core.
+ - apply valid_check_trans; auto with smtcoq_core.
+ - apply valid_check_congr; auto with smtcoq_core.
+ - apply valid_check_congr_pred; auto with smtcoq_core.
+ - apply valid_check_micromega; auto with smtcoq_core.
+ - apply valid_check_diseq; auto with smtcoq_core.
+ - apply valid_check_spl_arith; auto with smtcoq_core.
+ - apply valid_check_distinct_elim; auto with smtcoq_core.
+ - eapply valid_check_bbVar; eauto with smtcoq_core.
+ - apply valid_check_bbConst; auto with smtcoq_core.
+ - apply valid_check_bbOp; auto with smtcoq_core.
+ - apply valid_check_bbNot; auto with smtcoq_core.
+ - apply valid_check_bbNeg; auto with smtcoq_core.
+ - apply valid_check_bbAdd; auto with smtcoq_core.
+ - apply valid_check_bbConcat; auto with smtcoq_core.
+ - apply valid_check_bbMult; auto with smtcoq_core.
+ - apply valid_check_bbUlt; auto with smtcoq_core.
+ - apply valid_check_bbSlt; auto with smtcoq_core.
+ - apply valid_check_bbEq; auto with smtcoq_core.
+ - apply valid_check_bbDiseq; auto with smtcoq_core.
+ - apply valid_check_bbExtract; auto with smtcoq_core.
+ - apply valid_check_bbZextend; auto with smtcoq_core.
+ - apply valid_check_bbSextend; auto with smtcoq_core.
+ - apply valid_check_bbShl; auto with smtcoq_core.
+ - apply valid_check_bbShr; auto with smtcoq_core.
+ - apply valid_check_roweq; auto with smtcoq_core.
+ - apply valid_check_rowneq; auto with smtcoq_core.
+ - apply valid_check_ext; auto with smtcoq_core.
+ - apply valid_check_hole; auto with smtcoq_core.
+ - apply valid_check_forall_inst with lemma; auto with smtcoq_core.
Qed.
Definition euf_checker (* t_atom t_form *) s t :=
@@ -490,8 +493,8 @@ Inductive step :=
~ (S.valid rho s).
Proof.
unfold euf_checker; intros (* t_i t_func t_atom t_form *) rho H1 H2 H10; apply _checker__correct.
- intros c H; apply C.is_false_correct; auto.
- apply step_checker_correct; auto.
+ intros c H; apply C.is_false_correct; auto with smtcoq_core.
+ apply step_checker_correct; auto with smtcoq_core.
Qed.
Inductive certif :=
@@ -516,11 +519,11 @@ Inductive step :=
forall s d used_roots, S.valid rho s -> valid t_func t_atom t_form d ->
S.valid rho (add_roots s d used_roots).
Proof.
- intros (* t_i t_func t_atom t_form *) rho H1 H2 H10 s d used_roots H3; unfold valid; intro H4; pose (H5 := (afold_left_andb_true_inv _ _ _ H4)); unfold add_roots; assert (Valuation.wf rho) by (destruct (Form.check_form_correct (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) _ H1) as [_ H]; auto); case used_roots.
- intro ur; apply (foldi_right_Ind _ _ (fun _ a => S.valid rho a)); auto; intros a i H6 Ha; apply S.valid_set_clause; auto; case_eq (ur .[ i] < length d).
- intro; unfold C.valid; simpl; rewrite H5; auto.
- intros; apply C.interp_true; auto.
- apply (foldi_right_Ind _ _ (fun _ a => S.valid rho a)); auto; intros a i H6 Ha; apply S.valid_set_clause; auto; unfold C.valid; simpl; rewrite H5; auto.
+ intros (* t_i t_func t_atom t_form *) rho H1 H2 H10 s d used_roots H3; unfold valid; intro H4; pose (H5 := (afold_left_andb_true_inv _ _ _ H4)); unfold add_roots; assert (Valuation.wf rho) by (destruct (Form.check_form_correct (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) _ H1) as [_ H]; auto with smtcoq_core); case used_roots.
+ intro ur; apply (foldi_right_Ind _ _ (fun _ a => S.valid rho a)); auto with smtcoq_core; intros a i H6 Ha; apply S.valid_set_clause; auto with smtcoq_core; case_eq (ur .[ i] < length d).
+ intro; unfold C.valid; simpl; rewrite H5; auto with smtcoq_core.
+ intros; apply C.interp_true; auto with smtcoq_core.
+ apply (foldi_right_Ind _ _ (fun _ a => S.valid rho a)); auto with smtcoq_core; intros a i H6 Ha; apply S.valid_set_clause; auto with smtcoq_core; unfold C.valid; simpl; rewrite H5; auto with smtcoq_core.
Qed.
Definition checker (* t_i t_func t_atom t_form *) d used_roots (c:certif) :=
@@ -534,7 +537,7 @@ Inductive step :=
Definition setup_checker_step_debug d used_roots (c:certif) :=
let (nclauses, t, confl) := c in
let s := add_roots (S.make nclauses) d used_roots in
- (s, Structures.trace_to_list t).
+ (s, fst t).
Definition position_of_step (st:step) :=
@@ -686,7 +689,7 @@ Inductive step :=
let (nclauses, t, confl) := c in
let s := add_roots (S.make nclauses) d used_roots in
let '(_, nb, failure) :=
- Structures.trace_fold
+ List.fold_left
(fun acc step =>
match acc with
| (s, nb, None) =>
@@ -698,7 +701,7 @@ Inductive step :=
else (s, nb, None)
| _ => acc
end
- ) (s, O, None) t
+ ) (fst t) (s, O, None)
in
match failure with
| Some st => Some (nb, name_of_step st)
@@ -711,7 +714,7 @@ Inductive step :=
checker (* t_i t_func t_atom t_form *) d used_roots c = true ->
~ (valid t_func t_atom t_form d).
Proof.
- unfold checker; intros (* t_i t_func t_atom t_form *) d used_roots (nclauses, t, confl); rewrite !andb_true_iff; intros [[[H1 H2] H10] H3] H; eelim euf_checker_correct; try eassumption; apply add_roots_correct; try eassumption; apply S.valid_make; destruct (Form.check_form_correct (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) _ H1) as [_ H4]; auto.
+ unfold checker; intros (* t_i t_func t_atom t_form *) d used_roots (nclauses, t, confl); rewrite !andb_true_iff; intros [[[H1 H2] H10] H3] H; eelim euf_checker_correct; try eassumption; apply add_roots_correct; try eassumption; apply S.valid_make; destruct (Form.check_form_correct (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) _ H1) as [_ H4]; auto with smtcoq_core.
Qed.
Definition checker_b (* t_i t_func t_atom t_form *) l (b:bool) (c:certif) :=
@@ -723,7 +726,7 @@ Inductive step :=
checker_b (* t_func t_atom t_form *) l b c = true ->
Lit.interp (Form.interp_state_var (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) t_form) l = b.
Proof.
- unfold checker_b; intros (* t_i t_func t_atom t_form *) l b (nclauses, t, confl); case b; intros H2; case_eq (Lit.interp (Form.interp_state_var (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) t_form) l); auto; intros H1; elim (checker_correct H2); auto; unfold valid; apply afold_left_andb_true; intros i Hi; rewrite get_make; auto; rewrite Lit.interp_neg, H1; auto.
+ unfold checker_b; intros (* t_i t_func t_atom t_form *) l b (nclauses, t, confl); case b; intros H2; case_eq (Lit.interp (Form.interp_state_var (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) t_form) l); auto with smtcoq_core; intros H1; elim (checker_correct H2); auto with smtcoq_core; unfold valid; apply afold_left_andb_true; intros i Hi; rewrite get_make; auto with smtcoq_core; rewrite Lit.interp_neg, H1; auto with smtcoq_core.
Qed.
Definition checker_eq (* t_i t_func t_atom t_form *) l1 l2 l (c:certif) :=
@@ -741,8 +744,8 @@ Inductive step :=
Lit.interp (Form.interp_state_var (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) t_form) l2.
Proof.
unfold checker_eq; intros (* t_i t_func t_atom t_form *) l1 l2 l (nclauses, t, confl); rewrite !andb_true_iff; case_eq (t_form .[ Lit.blit l]); [intros _ _|intros _|intros _|intros _ _ _|intros _ _|intros _ _|intros _ _|intros _ _ _|intros l1' l2' Heq|intros _ _ _ _|intros a ls Heq]; intros [[H1 H2] H3]; try discriminate; rewrite andb_true_iff in H2; rewrite !Int63Properties.eqb_spec in H2; destruct H2 as [H2 H4]; subst l1' l2'; case_eq (Lit.is_pos l); intro Heq'; rewrite Heq' in H1; try discriminate; clear H1; assert (H:PArray.default t_form = Form.Ftrue /\ Form.wf t_form).
- unfold checker in H3; rewrite !andb_true_iff in H3; destruct H3 as [[[H3 _] _] _]; destruct (Form.check_form_correct (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) _ H3) as [[Ht1 Ht2] Ht3]; split; auto.
- destruct H as [H1 H2]; case_eq (Lit.interp (Form.interp_state_var (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) t_form) l1); intro Heq1; case_eq (Lit.interp (Form.interp_state_var (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) t_form) l2); intro Heq2; auto; elim (checker_correct H3); unfold valid; apply afold_left_andb_true; intros i Hi; rewrite get_make; unfold Lit.interp; rewrite Heq'; unfold Var.interp; rewrite Form.wf_interp_form; auto; rewrite Heq; simpl; rewrite Heq1, Heq2; auto.
+ unfold checker in H3; rewrite !andb_true_iff in H3; destruct H3 as [[[H3 _] _] _]; destruct (Form.check_form_correct (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) _ H3) as [[Ht1 Ht2] Ht3]; split; auto with smtcoq_core.
+ destruct H as [H1 H2]; case_eq (Lit.interp (Form.interp_state_var (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) t_form) l1); intro Heq1; case_eq (Lit.interp (Form.interp_state_var (Atom.interp_form_hatom t_i t_func t_atom) (Atom.interp_form_hatom_bv t_i t_func t_atom) t_form) l2); intro Heq2; auto with smtcoq_core; elim (checker_correct H3); unfold valid; apply afold_left_andb_true; intros i Hi; rewrite get_make; unfold Lit.interp; rewrite Heq'; unfold Var.interp; rewrite Form.wf_interp_form; auto with smtcoq_core; rewrite Heq; simpl; rewrite Heq1, Heq2; auto with smtcoq_core.
Qed.
@@ -762,7 +765,7 @@ Inductive step :=
forall t_i t_func, Atom.wt t_i t_func t_atom ->
~ valid t_func t_atom t_form d.
Proof.
- unfold checker_ext; intros t_atom t_form d used_roots (nclauses, t, confl); rewrite !andb_true_iff; intros [[H1 H2] H3]; intros t_i t_func H10 H; eelim euf_checker_correct; try eassumption; apply add_roots_correct; try eassumption; apply S.valid_make; destruct (Form.check_form_correct (Atom.interp_form_hatom t_i t_func t_atom) _ H1) as [_ H4]; auto.
+ unfold checker_ext; intros t_atom t_form d used_roots (nclauses, t, confl); rewrite !andb_true_iff; intros [[H1 H2] H3]; intros t_i t_func H10 H; eelim euf_checker_correct; try eassumption; apply add_roots_correct; try eassumption; apply S.valid_make; destruct (Form.check_form_correct (Atom.interp_form_hatom t_i t_func t_atom) _ H1) as [_ H4]; auto with smtcoq_core.
Qed.
*)
diff --git a/src/versions/standard/_CoqProject b/src/_CoqProject
index 86dd443..f7862e1 100644
--- a/src/versions/standard/_CoqProject
+++ b/src/_CoqProject
@@ -26,24 +26,16 @@
-I trace
-I verit
-I zchaff
--I versions/standard
--I versions/standard/Int63
--I versions/standard/Array
+-I Int63
+-I Array
-I ../3rdparty/alt-ergo
-versions/standard/Int63/Int63.v
-versions/standard/Int63/Int63Native.v
-versions/standard/Int63/Int63Op.v
-versions/standard/Int63/Int63Axioms.v
-versions/standard/Int63/Int63Properties.v
-versions/standard/Array/PArray.v
-
-versions/standard/mutils_full.ml
-versions/standard/mutils_full.mli
-versions/standard/coq_micromega_full.ml
-versions/standard/Structures.v
-versions/standard/structures.ml
-versions/standard/structures.mli
+Int63/Int63.v
+Int63/Int63Native.v
+Int63/Int63Op.v
+Int63/Int63Axioms.v
+Int63/Int63Properties.v
+Array/PArray.v
bva/BVList.v
bva/Bva_checker.v
@@ -76,6 +68,8 @@ trace/smtMisc.ml
trace/smtMisc.mli
trace/smtTrace.ml
trace/smtTrace.mli
+trace/coqInterface.ml
+trace/coqInterface.mli
../3rdparty/alt-ergo/smtlib2_parse.ml
../3rdparty/alt-ergo/smtlib2_parse.mli
@@ -155,5 +149,5 @@ SMT_terms.v
State.v
Trace.v
-g_smtcoq.ml4
+g_smtcoq.mlg
smtcoq_plugin.mlpack
diff --git a/src/array/FArray.v b/src/array/FArray.v
index 26617b8..69e56f9 100644
--- a/src/array/FArray.v
+++ b/src/array/FArray.v
@@ -44,7 +44,7 @@ Module Raw.
Lemma eqb_elt_eq x y : eqb_elt x y = true <-> x = y.
Proof. unfold eqb_elt. case (eq_dec x y); split; easy. Qed.
- Hint Immediate eqb_key_eq eqb_elt_eq.
+ Hint Immediate eqb_key_eq eqb_elt_eq : smtcoq_array.
Definition farray := list (key * elt).
@@ -54,8 +54,8 @@ Module Raw.
Definition ltk (a b : (key * elt)) := lt (fst a) (fst b).
- Hint Unfold ltk eqk eqke.
- Hint Extern 2 (eqke ?a ?b) => split.
+ Hint Unfold ltk eqk eqke : smtcoq_array.
+ Hint Extern 2 (eqke ?a ?b) => split : smtcoq_array.
Global Instance lt_key_strorder : StrictOrder (lt : key -> key -> Prop).
Proof. apply StrictOrder_OrdType. Qed.
@@ -90,7 +90,7 @@ Module Raw.
Lemma ltk_right_l : forall x k e e', ltk (k,e) x -> ltk (k,e') x.
Proof. auto. Qed.
- Hint Immediate ltk_right_r ltk_right_l.
+ Hint Immediate ltk_right_r ltk_right_l : smtcoq_array.
Notation Sort := (sort ltk).
Notation Inf := (lelistA (ltk)).
@@ -100,7 +100,7 @@ Module Raw.
Notation NoDupA := (NoDupA eqk).
- Hint Unfold MapsTo In.
+ Hint Unfold MapsTo In : smtcoq_array.
Lemma eqke_eqk : forall x x', eqke x x' -> eqk x x'.
Proof.
@@ -110,13 +110,13 @@ Module Raw.
(* eqk, eqke are equalities *)
Lemma eqk_refl : forall e, eqk e e.
- Proof. auto. Qed.
+ Proof. auto with smtcoq_array. Qed.
Lemma eqke_refl : forall e, eqke e e.
- Proof. auto. Qed.
+ Proof. auto with smtcoq_array. Qed.
Lemma eqk_sym : forall e e', eqk e e' -> eqk e' e.
- Proof. auto. Qed.
+ Proof. auto with smtcoq_array. Qed.
Lemma eqke_sym : forall e e', eqke e e' -> eqke e' e.
Proof. unfold eqke; intuition. Qed.
@@ -133,35 +133,35 @@ Module Raw.
Proof. unfold ltk; eauto. Qed.
Lemma ltk_not_eqk : forall e e', ltk e e' -> ~ eqk e e'.
- Proof. unfold ltk, eqk. intros. apply lt_not_eq; auto. Qed.
+ Proof. unfold ltk, eqk. intros. apply lt_not_eq; auto with smtcoq_array. Qed.
Lemma ltk_not_eqke : forall e e', ltk e e' -> ~eqke e e'.
Proof.
unfold eqke, ltk; intuition; simpl in *; subst.
- apply lt_not_eq in H. auto.
+ apply lt_not_eq in H. auto with smtcoq_array.
Qed.
- Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl.
- Hint Resolve ltk_trans ltk_not_eqk ltk_not_eqke.
- Hint Immediate eqk_sym eqke_sym.
+ Hint Resolve eqk_trans eqke_trans eqk_refl eqke_refl : smtcoq_array.
+ Hint Resolve ltk_trans ltk_not_eqk ltk_not_eqke : smtcoq_array.
+ Hint Immediate eqk_sym eqke_sym : smtcoq_array.
Global Instance eqk_equiv : Equivalence eqk.
- Proof. split; eauto. Qed.
+ Proof. split; eauto with smtcoq_array. Qed.
Global Instance eqke_equiv : Equivalence eqke.
- Proof. split; eauto. Qed.
+ Proof. split; eauto with smtcoq_array. Qed.
Global Instance ltk_strorder : StrictOrder ltk.
Proof.
split.
unfold Irreflexive, Reflexive, complement.
- intros. apply lt_not_eq in H; auto.
+ intros. apply lt_not_eq in H; auto with smtcoq_array.
unfold Transitive. intros x y z. apply lt_trans.
Qed.
Global Instance eq_equiv : @Equivalence (key * elt) eq.
Proof.
- split; auto.
+ split; auto with smtcoq_array.
unfold Transitive. apply eq_trans.
Qed.
@@ -173,13 +173,13 @@ Module Raw.
Global Instance ltk_compatk : Proper (eqk==>eqk==>iff) ltk.
Proof.
intros (x,e) (x',e') Hxx' (y,f) (y',f') Hyy'; compute.
- compute in Hxx'; compute in Hyy'. rewrite Hxx', Hyy'; auto.
+ compute in Hxx'; compute in Hyy'. rewrite Hxx', Hyy'; auto with smtcoq_array.
Qed.
Global Instance ltk_compat' : Proper (eqke==>eqke==>iff) ltk.
Proof.
intros (x,e) (x',e') (Hxx',_) (y,f) (y',f') (Hyy',_); compute.
- compute in Hxx'; compute in Hyy'. rewrite Hxx', Hyy'; auto.
+ compute in Hxx'; compute in Hyy'. rewrite Hxx', Hyy'; auto with smtcoq_array.
Qed.
Global Instance ltk_asym : Asymmetric ltk.
@@ -194,8 +194,8 @@ Module Raw.
destruct x, x'. simpl in *.
intro.
symmetry in H.
- apply lt_not_eq in H. auto.
- subst. auto.
+ apply lt_not_eq in H. auto with smtcoq_array.
+ subst. auto with smtcoq_array.
Qed.
Lemma ltk_eqk : forall e e' e'', ltk e e' -> eqk e' e'' -> ltk e e''.
@@ -208,8 +208,8 @@ Module Raw.
intros (k,e) (k',e') (k'',e'').
unfold ltk, eqk; simpl; intros; subst; trivial.
Qed.
- Hint Resolve eqk_not_ltk.
- Hint Immediate ltk_eqk eqk_ltk.
+ Hint Resolve eqk_not_ltk : smtcoq_array.
+ Hint Immediate ltk_eqk eqk_ltk : smtcoq_array.
Lemma InA_eqke_eqk :
forall x m, InA eqke x m -> InA eqk x m.
@@ -217,17 +217,17 @@ Module Raw.
unfold eqke; induction 1; intuition.
Qed.
- Hint Resolve InA_eqke_eqk.
+ Hint Resolve InA_eqke_eqk : smtcoq_array.
Lemma In_alt : forall k l, In k l <-> exists e, InA eqk (k,e) l.
Proof.
firstorder.
- exists x; auto.
+ exists x; auto with smtcoq_array.
induction H.
destruct y.
- exists e; auto.
+ exists e; auto with smtcoq_array.
destruct IHInA as [e H0].
- exists e; auto.
+ exists e; auto with smtcoq_array.
Qed.
Lemma MapsTo_eq : forall l x y e, eq x y -> MapsTo x e l -> MapsTo y e l.
@@ -237,7 +237,7 @@ Module Raw.
Lemma In_eq : forall l x y, eq x y -> In x l -> In y l.
Proof.
- destruct 2 as (e,E); exists e; eapply MapsTo_eq; eauto.
+ destruct 2 as (e,E); exists e; eapply MapsTo_eq; eauto with smtcoq_array.
Qed.
Lemma Inf_eq : forall l x x', eqk x x' -> Inf x' l -> Inf x l.
@@ -246,8 +246,8 @@ Module Raw.
Lemma Inf_lt : forall l x x', ltk x x' -> Inf x' l -> Inf x l.
Proof. exact (InfA_ltA ltk_strorder). Qed.
- Hint Immediate Inf_eq.
- Hint Resolve Inf_lt.
+ Hint Immediate Inf_eq : smtcoq_array.
+ Hint Resolve Inf_lt : smtcoq_array.
Lemma Sort_Inf_In :
forall l p q, Sort l -> Inf q l -> InA eqk p l -> ltk q p.
@@ -261,11 +261,11 @@ Module Raw.
intros; red; intros.
destruct H1 as [e' H2].
elim (@ltk_not_eqk (k,e) (k,e')).
- eapply Sort_Inf_In; eauto.
- red; simpl; auto.
+ eapply Sort_Inf_In; eauto with smtcoq_array.
+ red; simpl; auto with smtcoq_array.
Qed.
- Hint Resolve Sort_Inf_NotIn.
+ Hint Resolve Sort_Inf_NotIn : smtcoq_array.
Lemma Sort_NoDupA: forall l, Sort l -> NoDupA l.
Proof.
@@ -274,14 +274,14 @@ Module Raw.
Lemma Sort_In_cons_1 : forall e l e', Sort (e::l) -> InA eqk e' l -> ltk e e'.
Proof.
- inversion 1; intros; eapply Sort_Inf_In; eauto.
+ inversion 1; intros; eapply Sort_Inf_In; eauto with smtcoq_array.
Qed.
Lemma Sort_In_cons_2 : forall l e e', Sort (e::l) -> InA eqk e' (e::l) ->
ltk e e' \/ eqk e e'.
Proof.
- inversion_clear 2; auto.
- left; apply Sort_In_cons_1 with l; auto.
+ inversion_clear 2; auto with smtcoq_array.
+ left; apply Sort_In_cons_1 with l; auto with smtcoq_array.
Qed.
Lemma Sort_In_cons_3 :
@@ -294,7 +294,7 @@ Module Raw.
Lemma In_inv : forall k k' e l, In k ((k',e) :: l) -> eq k k' \/ In k l.
Proof.
inversion 1.
- inversion_clear H0; eauto.
+ inversion_clear H0; eauto with smtcoq_array.
destruct H1; simpl in *; intuition.
Qed.
@@ -310,7 +310,7 @@ Module Raw.
inversion_clear 1; compute in H0; intuition.
Qed.
- Hint Resolve In_inv_2 In_inv_3.
+ Hint Resolve In_inv_2 In_inv_3 : smtcoq_array.
(** * FMAPLIST interface implementaion *)
@@ -327,11 +327,11 @@ Module Raw.
intro abs.
inversion abs.
Qed.
- Hint Resolve empty_1.
+ Hint Resolve empty_1 : smtcoq_array.
Lemma empty_sorted : Sort empty.
Proof.
- unfold empty; auto.
+ unfold empty; auto with smtcoq_array.
Qed.
Lemma MapsTo_inj : forall x e e' l (Hl:Sort l),
@@ -363,7 +363,7 @@ Module Raw.
+ unfold eqk in H, H0. simpl in *. subst.
inversion_clear HH.
inversion_clear HH0.
- unfold eqke in *. simpl in *. destruct H, H1; subst; auto.
+ unfold eqke in *. simpl in *. destruct H, H1; subst; auto with smtcoq_array.
apply InA_eqke_eqk in H1.
inversion_clear Hl.
specialize (Sort_Inf_In H2 H3 H1).
@@ -382,15 +382,15 @@ Module Raw.
Proof.
unfold Empty, MapsTo.
intros m.
- case m;auto.
+ case m;auto with smtcoq_array.
intros (k,e) l inlist.
- absurd (InA eqke (k, e) ((k, e) :: l));auto.
+ absurd (InA eqke (k, e) ((k, e) :: l));auto with smtcoq_array.
Qed.
Lemma is_empty_2 : forall m, is_empty m = true -> Empty m.
Proof.
intros m.
- case m;auto.
+ case m;auto with smtcoq_array.
intros p l abs.
inversion abs.
Qed.
@@ -416,15 +416,15 @@ Module Raw.
- simpl. case_eq (compare x k'); trivial.
+ intros _x0 e0.
absurd (In x ((k', _x) :: l));try assumption.
- apply Sort_Inf_NotIn with _x;auto.
+ apply Sort_Inf_NotIn with _x;auto with smtcoq_array.
+ intros _x0 e0.
apply IHb.
- elim (sort_inv sorted);auto.
- elim (In_inv belong1);auto.
+ elim (sort_inv sorted);auto with smtcoq_array.
+ elim (In_inv belong1);auto with smtcoq_array.
intro abs.
- absurd (eq x k'); auto.
+ absurd (eq x k'); auto with smtcoq_array.
symmetry in abs.
- apply lt_not_eq in abs; auto.
+ apply lt_not_eq in abs; auto with smtcoq_array.
Qed.
Lemma mem_2 : forall m (Hm:Sort m) x, mem x m = true -> In x m.
@@ -432,10 +432,10 @@ Module Raw.
intros m Hm x; generalize Hm; clear Hm; unfold In,MapsTo.
induction m as [ |[k' _x] l IHb]; intros sorted hyp;try ((inversion hyp);fail).
revert hyp. simpl. case_eq (compare x k'); intros _x0 e0 hyp;try ((inversion hyp);fail).
- - exists _x; auto.
- - induction IHb; auto.
- + exists x0; auto.
- + inversion_clear sorted; auto.
+ - exists _x; auto with smtcoq_array.
+ - induction IHb; auto with smtcoq_array.
+ + exists x0; auto with smtcoq_array.
+ + inversion_clear sorted; auto with smtcoq_array.
Qed.
Lemma mem_3 : forall m (Hm:Sort m) x, mem x m = false -> ~ In x m.
@@ -461,8 +461,8 @@ Module Raw.
Lemma find_2 : forall m x e, find x m = Some e -> MapsTo x e m.
Proof.
intros m x. unfold MapsTo.
- induction m as [ |[k' _x] l IHb];simpl; intro e';try now (intro eqfind; inversion eqfind; auto).
- case_eq (compare x k'); intros _x0 e0 eqfind; inversion eqfind; auto.
+ induction m as [ |[k' _x] l IHb];simpl; intro e';try now (intro eqfind; inversion eqfind; auto with smtcoq_array).
+ case_eq (compare x k'); intros _x0 e0 eqfind; inversion eqfind; auto with smtcoq_array.
Qed.
Lemma find_1 : forall m (Hm:Sort m) x e, MapsTo x e m -> find x m = Some e.
@@ -473,11 +473,11 @@ Module Raw.
- case_eq (compare x k'); intros _x0 e1; subst.
+ inversion_clear 2.
* clear e1;compute in H0; destruct H0.
- apply lt_not_eq in H; auto. now contradict H.
+ apply lt_not_eq in H; auto with smtcoq_array. now contradict H.
* clear e1;generalize (Sort_In_cons_1 Hm (InA_eqke_eqk H0)); compute.
(* order. *)
intros.
- apply (lt_trans k') in _x0; auto.
+ apply (lt_trans k') in _x0; auto with smtcoq_array.
apply lt_not_eq in _x0.
now contradict _x0.
+ clear e1;inversion_clear 2.
@@ -486,7 +486,7 @@ Module Raw.
(* order. *)
intros.
apply lt_not_eq in H. now contradict H.
- + clear e1; do 2 inversion_clear 1; auto.
+ + clear e1; do 2 inversion_clear 1; auto with smtcoq_array.
compute in H2; destruct H2.
(* order. *)
subst. apply lt_not_eq in _x0. now contradict _x0.
@@ -509,7 +509,7 @@ Module Raw.
Proof.
intros m x y e; generalize y; clear y.
unfold MapsTo.
- induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e1]; simpl; auto.
+ induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e1]; simpl; auto with smtcoq_array.
Qed.
Lemma add_2 : forall m x y e e',
@@ -517,14 +517,14 @@ Module Raw.
Proof.
intros m x y e e'.
generalize y e; clear y e; unfold MapsTo.
- induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e0];simpl;auto; clear e0.
- subst;auto.
+ induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e0];simpl;auto with smtcoq_array; clear e0.
+ subst;auto with smtcoq_array.
intros y' e'' eqky'; inversion_clear 1; destruct H0; simpl in *.
(* order. *)
subst. now contradict eqky'.
- auto.
- auto.
+ auto with smtcoq_array.
+ auto with smtcoq_array.
intros y' e'' eqky'; inversion_clear 1; intuition.
Qed.
@@ -533,10 +533,10 @@ Module Raw.
Proof.
intros m x y e e'. generalize y e; clear y e; unfold MapsTo.
induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e1];simpl; intros.
- apply (In_inv_3 H0); compute; auto.
- apply (In_inv_3 H0); compute; auto.
- constructor 2; apply (In_inv_3 H0); compute; auto.
- inversion_clear H0; auto.
+ apply (In_inv_3 H0); compute; auto with smtcoq_array.
+ apply (In_inv_3 H0); compute; auto with smtcoq_array.
+ constructor 2; apply (In_inv_3 H0); compute; auto with smtcoq_array.
+ inversion_clear H0; auto with smtcoq_array.
Qed.
Lemma add_Inf : forall (m:farray)(x x':key)(e e':elt),
@@ -550,7 +550,7 @@ Module Raw.
compute in H0,H1.
simpl; case (compare x x''); intuition.
Qed.
- Hint Resolve add_Inf.
+ Hint Resolve add_Inf : smtcoq_array.
Lemma add_sorted : forall m (Hm:Sort m) x e, Sort (add x e m).
Proof.
@@ -558,9 +558,9 @@ Module Raw.
simpl; intuition.
intros.
destruct a as (x',e').
- simpl; case (compare x x'); intuition; inversion_clear Hm; auto.
- constructor; auto.
- apply Inf_eq with (x',e'); auto.
+ simpl; case (compare x x'); intuition; inversion_clear Hm; auto with smtcoq_array.
+ constructor; auto with smtcoq_array.
+ apply Inf_eq with (x',e'); auto with smtcoq_array.
Qed.
(** * [remove] *)
@@ -583,18 +583,18 @@ Module Raw.
red; inversion 1; inversion H0.
- apply Sort_Inf_NotIn with x0; auto.
+ apply Sort_Inf_NotIn with x0; auto with smtcoq_array.
clear e0. inversion Hm. subst.
- apply Sort_Inf_NotIn with x0; auto.
+ apply Sort_Inf_NotIn with x0; auto with smtcoq_array.
clear e0;inversion_clear Hm.
- assert (notin:~ In y (remove y l)) by auto.
+ assert (notin:~ In y (remove y l)) by auto with smtcoq_array.
intros (x1,abs).
inversion_clear abs.
compute in H1; destruct H1.
subst. apply lt_not_eq in _x; now contradict _x.
- apply notin; exists x1; auto.
+ apply notin; exists x1; auto with smtcoq_array.
Qed.
@@ -602,41 +602,41 @@ Module Raw.
~ eq x y -> MapsTo y e m -> MapsTo y e (remove x m).
Proof.
intros m Hm x y e; generalize Hm; clear Hm; unfold MapsTo.
- induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e1];subst;auto;
+ induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e1];subst;auto with smtcoq_array;
match goal with
| [H: compare _ _ = _ |- _ ] => clear H
| _ => idtac
end.
- inversion_clear 3; auto.
+ inversion_clear 3; auto with smtcoq_array.
compute in H1; destruct H1.
subst; now contradict H.
- inversion_clear 1; inversion_clear 2; auto.
+ inversion_clear 1; inversion_clear 2; auto with smtcoq_array.
Qed.
Lemma remove_3 : forall m (Hm:Sort m) x y e,
MapsTo y e (remove x m) -> MapsTo y e m.
Proof.
intros m Hm x y e; generalize Hm; clear Hm; unfold MapsTo.
- induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e1];subst;auto.
- inversion_clear 1; inversion_clear 1; auto.
+ induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e1];subst;auto with smtcoq_array.
+ inversion_clear 1; inversion_clear 1; auto with smtcoq_array.
Qed.
Lemma remove_4_aux : forall m (Hm:Sort m) x y,
~ eq x y -> In y m -> In y (remove x m).
Proof.
intros m Hm x y; generalize Hm; clear Hm.
- induction m as [ |[k' x0] l IHf]; simpl; [ |case_eq (compare x k'); intros _x e1];subst;auto;
+ induction m as [ |[k' x0] l IHf]; simpl; [ |case_eq (compare x k'); intros _x e1];subst;auto with smtcoq_array;
match goal with
| [H: compare _ _ = _ |- _ ] => clear H
| _ => idtac
end.
rewrite In_alt.
- inversion_clear 3; auto.
+ inversion_clear 3; auto with smtcoq_array.
inversion H2.
unfold eqk in H3. simpl in H3. subst. now contradict H0.
apply In_alt.
- exists x. auto.
+ exists x. auto with smtcoq_array.
apply lt_not_eq in _x.
intros.
inversion_clear Hm.
@@ -647,27 +647,27 @@ Module Raw.
destruct (eq_dec k' y).
exists x0.
apply InA_cons_hd.
- split; simpl; auto.
+ split; simpl; auto with smtcoq_array.
inversion H3.
unfold eqk in H4. simpl in H4; subst. now contradict n.
assert ((exists e : elt, MapsTo y e (remove x l)) -> (exists e : elt, MapsTo y e ((k', x0) :: remove x l))).
intros.
destruct H6. exists x2.
- apply InA_cons_tl. auto.
+ apply InA_cons_tl. auto with smtcoq_array.
apply H6.
- apply IHf; auto.
+ apply IHf; auto with smtcoq_array.
apply In_alt.
- exists x1. auto.
+ exists x1. auto with smtcoq_array.
Qed.
Lemma remove_4 : forall m (Hm:Sort m) x y,
~ eq x y -> In y m <-> In y (remove x m).
Proof.
split.
- apply remove_4_aux; auto.
+ apply remove_4_aux; auto with smtcoq_array.
revert H.
generalize Hm; clear Hm.
- induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e1];subst;auto;
+ induction m as [ |[k' _x] l IHb]; simpl; [ |case_eq (compare x k'); intros _x0 e1];subst;auto with smtcoq_array;
match goal with
| [H: compare _ _ = _ |- _ ] => clear H
| _ => idtac
@@ -675,18 +675,18 @@ Module Raw.
intros.
destruct H0 as (e, H0).
exists e.
- apply InA_cons_tl. auto.
+ apply InA_cons_tl. auto with smtcoq_array.
intros.
apply lt_not_eq in _x0.
inversion_clear Hm.
apply In_inv in H0.
destruct H0.
exists _x.
- apply InA_cons_hd. split; simpl; auto.
+ apply InA_cons_hd. split; simpl; auto with smtcoq_array.
specialize (IHb H1 H H0).
inversion IHb.
exists x0.
- apply InA_cons_tl. auto.
+ apply InA_cons_tl. auto with smtcoq_array.
Qed.
Lemma remove_Inf : forall (m:farray)(Hm : Sort m)(x x':key)(e':elt),
@@ -700,9 +700,9 @@ Module Raw.
compute in H0.
simpl; case (compare x x''); intuition.
inversion_clear Hm.
- apply Inf_lt with (x'',e''); auto.
+ apply Inf_lt with (x'',e''); auto with smtcoq_array.
Qed.
- Hint Resolve remove_Inf.
+ Hint Resolve remove_Inf : smtcoq_array.
Lemma remove_sorted : forall m (Hm:Sort m) x, Sort (remove x m).
Proof.
@@ -710,7 +710,7 @@ Module Raw.
simpl; intuition.
intros.
destruct a as (x',e').
- simpl; case (compare x x'); intuition; inversion_clear Hm; auto.
+ simpl; case (compare x x'); intuition; inversion_clear Hm; auto with smtcoq_array.
Qed.
(** * [elements] *)
@@ -720,25 +720,25 @@ Module Raw.
Lemma elements_1 : forall m x e,
MapsTo x e m -> InA eqke (x,e) (elements m).
Proof.
- auto.
+ auto with smtcoq_array.
Qed.
Lemma elements_2 : forall m x e,
InA eqke (x,e) (elements m) -> MapsTo x e m.
Proof.
- auto.
+ auto with smtcoq_array.
Qed.
Lemma elements_3 : forall m (Hm:Sort m), sort ltk (elements m).
Proof.
- auto.
+ auto with smtcoq_array.
Qed.
Lemma elements_3w : forall m (Hm:Sort m), NoDupA (elements m).
Proof.
intros.
apply Sort_NoDupA.
- apply elements_3; auto.
+ apply elements_3; auto with smtcoq_array.
Qed.
(** * [fold] *)
@@ -752,7 +752,7 @@ Module Raw.
Lemma fold_1 : forall m (A:Type)(i:A)(f:key->elt->A->A),
fold f m i = fold_left (fun a p => f (fst p) (snd p) a) (elements m) i.
Proof.
- intros; revert i; induction m as [ |[k e]]; simpl; auto.
+ intros; revert i; induction m as [ |[k e]]; simpl; auto with smtcoq_array.
Qed.
(** * [equal] *)
@@ -776,7 +776,7 @@ Module Raw.
Equivb cmp m m' -> equal cmp m m' = true.
Proof.
intros m Hm m' Hm' cmp; generalize Hm Hm'; clear Hm Hm'.
- revert m'; induction m as [ |[x e] l IHl]; intros [ |[x' e'] l']; simpl; auto; unfold Equivb; intuition; subst.
+ revert m'; induction m as [ |[x e] l IHl]; intros [ |[x' e'] l']; simpl; auto with smtcoq_array; unfold Equivb; intuition; subst.
- destruct (H0 x') as [_ H3].
assert (H2: In x' nil).
{
@@ -789,53 +789,53 @@ Module Raw.
apply H3. exists e. now constructor.
}
elim H2. intros x0 Hx0. inversion Hx0.
- - case_eq (compare x x'); simpl; subst;auto; unfold Equivb;
+ - case_eq (compare x x'); simpl; subst;auto with smtcoq_array; unfold Equivb;
intuition; subst.
+ destruct (H0 x).
assert (In x ((x',e')::l')).
- apply H2; auto.
- exists e; auto.
+ apply H2; auto with smtcoq_array.
+ exists e; auto with smtcoq_array.
destruct (In_inv H4).
(* order. *)
clear H. apply lt_not_eq in l0; now contradict l0.
inversion_clear Hm'.
assert (Inf (x,e) l').
- apply Inf_lt with (x',e'); auto.
+ apply Inf_lt with (x',e'); auto with smtcoq_array.
elim (Sort_Inf_NotIn H6 H8 H5).
+ match goal with H: compare _ _ = _ |- _ => clear H end.
assert (cmp_e_e':cmp e e' = true).
- apply H1 with x'; auto.
+ apply H1 with x'; auto with smtcoq_array.
rewrite cmp_e_e'; simpl.
- apply IHl; auto.
- inversion_clear Hm; auto.
- inversion_clear Hm'; auto.
+ apply IHl; auto with smtcoq_array.
+ inversion_clear Hm; auto with smtcoq_array.
+ inversion_clear Hm'; auto with smtcoq_array.
unfold Equivb; intuition.
destruct (H0 k).
assert (In k ((x',e) ::l)).
- destruct H as (e'', hyp); exists e''; auto.
- destruct (In_inv (H2 H4)); auto.
+ destruct H as (e'', hyp); exists e''; auto with smtcoq_array.
+ destruct (In_inv (H2 H4)); auto with smtcoq_array.
inversion_clear Hm.
elim (Sort_Inf_NotIn H6 H7).
- destruct H as (e'', hyp); exists e''; auto.
- apply MapsTo_eq with k; auto.
+ destruct H as (e'', hyp); exists e''; auto with smtcoq_array.
+ apply MapsTo_eq with k; auto with smtcoq_array.
destruct (H0 k).
assert (In k ((x',e') ::l')).
- destruct H as (e'', hyp); exists e''; auto.
- destruct (In_inv (H3 H4)); auto.
+ destruct H as (e'', hyp); exists e''; auto with smtcoq_array.
+ destruct (In_inv (H3 H4)); auto with smtcoq_array.
subst.
inversion_clear Hm'.
now elim (Sort_Inf_NotIn H5 H6).
- apply H1 with k; destruct (eq_dec x' k); auto.
+ apply H1 with k; destruct (eq_dec x' k); auto with smtcoq_array.
+ destruct (H0 x').
assert (In x' ((x,e)::l)).
- apply H3; auto.
- exists e'; auto.
+ apply H3; auto with smtcoq_array.
+ exists e'; auto with smtcoq_array.
destruct (In_inv H4).
(* order. *)
clear H; subst; apply lt_not_eq in l0; now contradict l0.
inversion_clear Hm.
assert (Inf (x',e') l).
- apply Inf_lt with (x,e); auto.
+ apply Inf_lt with (x,e); auto with smtcoq_array.
elim (Sort_Inf_NotIn H6 H8 H5).
Qed.
@@ -843,7 +843,7 @@ Module Raw.
equal cmp m m' = true -> Equivb cmp m m'.
Proof.
intros m Hm m' Hm' cmp; generalize Hm Hm'; clear Hm Hm'.
- revert m'; induction m as [ |[x e] l IHl]; intros [ |[x' e'] l']; simpl; subst;auto; unfold Equivb;
+ revert m'; induction m as [ |[x e] l IHl]; intros [ |[x' e'] l']; simpl; subst;auto with smtcoq_array; unfold Equivb;
intuition; try discriminate; subst;
try match goal with H: compare _ _ = _ |- _ => clear H end.
- inversion H0.
@@ -852,19 +852,19 @@ Module Raw.
destruct (andb_prop _ _ H); clear H.
destruct (IHl _ H1 H4 H7).
destruct (In_inv H0).
- exists e'; constructor; split; trivial; apply eq_trans with x; auto.
+ exists e'; constructor; split; trivial; apply eq_trans with x; auto with smtcoq_array.
destruct (H k).
destruct (H10 H9) as (e'',hyp).
- exists e''; auto.
+ exists e''; auto with smtcoq_array.
- revert H; case_eq (compare x x'); intros _x _ H; try inversion H.
inversion_clear Hm;inversion_clear Hm'.
destruct (andb_prop _ _ H); clear H.
destruct (IHl _ H1 H4 H7).
destruct (In_inv H0).
- exists e; constructor; split; trivial; apply eq_trans with x'; auto.
+ exists e; constructor; split; trivial; apply eq_trans with x'; auto with smtcoq_array.
destruct (H k).
destruct (H11 H9) as (e'',hyp).
- exists e''; auto.
+ exists e''; auto with smtcoq_array.
- revert H; case_eq (compare x x'); intros _x _ H; [inversion H| |inversion H].
inversion_clear Hm;inversion_clear Hm'.
destruct (andb_prop _ _ H); clear H.
@@ -872,16 +872,16 @@ Module Raw.
inversion_clear H0.
+ destruct H9; simpl in *; subst.
inversion_clear H1.
- * destruct H0; simpl in *; subst; auto.
+ * destruct H0; simpl in *; subst; auto with smtcoq_array.
* elim (Sort_Inf_NotIn H4 H5).
- exists e'0; apply MapsTo_eq with x'; auto.
+ exists e'0; apply MapsTo_eq with x'; auto with smtcoq_array.
(* order. *)
+ inversion_clear H1.
- * destruct H0; simpl in *; subst; auto.
+ * destruct H0; simpl in *; subst; auto with smtcoq_array.
elim (Sort_Inf_NotIn H2 H3).
- exists e0; apply MapsTo_eq with x'; auto.
+ exists e0; apply MapsTo_eq with x'; auto with smtcoq_array.
(* order. *)
- * apply H8 with k; auto.
+ * apply H8 with k; auto with smtcoq_array.
Qed.
(** This lemma isn't part of the spec of [Equivb], but is used in [FMapAVL] *)
@@ -895,18 +895,18 @@ Module Raw.
inversion H0; subst.
destruct x; destruct y; compute in H1, H2.
split; intros.
- apply equal_2; auto.
+ apply equal_2; auto with smtcoq_array.
simpl.
case (compare k k0);
subst; intro HH; try (apply lt_not_eq in HH; now contradict HH).
rewrite H2; simpl.
- apply equal_1; auto.
- apply equal_2; auto.
+ apply equal_1; auto with smtcoq_array.
+ apply equal_2; auto with smtcoq_array.
generalize (equal_1 H H0 H3).
simpl.
case (compare k k0);
subst; intro HH; try (apply lt_not_eq in HH; now contradict HH).
- rewrite H2; simpl; auto.
+ rewrite H2; simpl; auto with smtcoq_array.
Qed.
End Array.
@@ -1492,7 +1492,7 @@ Section FArray.
intros. rewrite eq_option_alt. intro e'. rewrite <- 2 find_mapsto_iff.
apply add_neq_mapsto_iff; auto.
Qed.
- Hint Resolve add_neq_o.
+ Hint Resolve add_neq_o : smtcoq_array.
Lemma MapsTo_fun : forall m x (e e':elt),
MapsTo x e m -> MapsTo x e' m -> e=e'.
@@ -1854,6 +1854,8 @@ Arguments extensionality2 {_} {_} {_} {_} {_} {_} {_} {_} {_} _.
Arguments select_at_diff {_} {_} {_} {_} {_} {_} {_} {_} {_} _ _ _.
+Declare Scope farray_scope.
+
Notation "a '[' i ']'" := (select a i) (at level 1, format "a [ i ]") : farray_scope.
Notation "a '[' i '<-' v ']'" := (store a i v)
(at level 1, format "a [ i <- v ]") : farray_scope.
diff --git a/src/bva/BVList.v b/src/bva/BVList.v
index c337302..91a110d 100644
--- a/src/bva/BVList.v
+++ b/src/bva/BVList.v
@@ -2526,6 +2526,8 @@ Qed.
End RAWBITVECTOR_LIST.
+Declare Scope bv_scope.
+
Module BITVECTOR_LIST <: BITVECTOR.
Include RAW2BITVECTOR(RAWBITVECTOR_LIST).
diff --git a/src/bva/Bva_checker.v b/src/bva/Bva_checker.v
index cab05b9..1487453 100644
--- a/src/bva/Bva_checker.v
+++ b/src/bva/Bva_checker.v
@@ -12,8 +12,6 @@
(** A small checker for bit-vectors bit-blasting *)
-Require Structures.
-
Require Import Int63 Int63Properties PArray SMT_classes ZArith.
Require Import Misc State SMT_terms BVList Psatz.
@@ -925,7 +923,7 @@ Definition shl_lit_be (a: list _lit) (b: list bool): list _lit :=
Definition check_shl (bs1: list _lit) (bs2: list bool) (bsres: list _lit) : bool :=
- if (Structures.nat_eqb (length bs1) (length bs2)) then
+ if (Nat.eqb (length bs1) (length bs2)) then
if (forallb2 eq_carry_lit (lit_to_carry (shl_lit_be bs1 bs2)) bsres)
then true else false
else false.
@@ -976,7 +974,7 @@ Definition shr_lit_be (a: list _lit) (b: list bool): list _lit :=
Definition check_shr (bs1: list _lit) (bs2: list bool) (bsres: list _lit) : bool :=
- if (Structures.nat_eqb (length bs1) (length bs2)) then
+ if (Nat.eqb (length bs1) (length bs2)) then
if (forallb2 eq_carry_lit (lit_to_carry (shr_lit_be bs1 bs2)) bsres)
then true else false
else false.
@@ -1555,7 +1553,7 @@ Proof. intros l a H.
rewrite H.
unfold RAWBITVECTOR_LIST.bv_eq, RAWBITVECTOR_LIST.size, RAWBITVECTOR_LIST.bits in *.
- rewrite RAWBITVECTOR_LIST.List_eq_refl; auto.
+ rewrite RAWBITVECTOR_LIST.List_eq_refl; auto with smtcoq_core.
apply inj_iff in wf0. now do 2 rewrite id' in wf0.
Qed.
@@ -7946,7 +7944,7 @@ Proof. intro bs1.
- simpl in *.
unfold check_shl in H. simpl in H.
case_eq bs2; simpl; intros; subst. simpl in H. now contradict H.
- simpl in *. inversion H0. rewrite H2, Structures.nat_eqb_refl in H.
+ simpl in *. inversion H0. rewrite H2, Nat.eqb_refl in H.
case_eq (forallb2 eq_carry_lit (lit_to_carry (shl_lit_be (a :: bs1) (b :: l))) bsres); intros.
+ apply prop_eq_carry_lit2 in H1.
rewrite prop_interp_carry3 in H1.
@@ -8016,8 +8014,8 @@ Proof. intro bs1.
induction bs1 as [ | xbs1 xsbs1 IHbs1 ].
- intros. simpl.
unfold check_shl, shl_lit_be in H.
- case_eq (Structures.nat_eqb (@length int []) (length bs2)); intros.
- rewrite Structures.nat_eqb_eq in H0.
+ case_eq (Nat.eqb (@length int []) (length bs2)); intros.
+ rewrite Nat.eqb_eq in H0.
rewrite <- H0 in H. simpl in H.
rewrite nshl_lit_empty in H.
case_eq bsres; intros. simpl.
@@ -8025,7 +8023,7 @@ Proof. intro bs1.
subst; now contradict H.
rewrite H0 in H; now contradict H.
- intros. unfold check_shl in H.
- case_eq (Structures.nat_eqb (Datatypes.length (xbs1 :: xsbs1)) (Datatypes.length bs2)); intros.
+ case_eq (Nat.eqb (Datatypes.length (xbs1 :: xsbs1)) (Datatypes.length bs2)); intros.
rewrite H0 in H.
case_eq (
forallb2 eq_carry_lit (lit_to_carry (shl_lit_be (xbs1 :: xsbs1) bs2)) bsres); intros.
@@ -8033,7 +8031,7 @@ Proof. intro bs1.
rewrite prop_interp_carry3 in H1.
unfold RAWBITVECTOR_LIST.bv_shl.
- rewrite Structures.nat_eqb_eq in H0.
+ rewrite Nat.eqb_eq in H0.
unfold RAWBITVECTOR_LIST.size.
rewrite !map_length. rewrite H0, N.eqb_refl.
now rewrite <- H1, shl_interp.
@@ -8287,7 +8285,7 @@ Proof. intro bs1.
- simpl in *.
unfold check_shr in H. simpl in H.
case_eq bs2; simpl; intros; subst. simpl in H. now contradict H.
- simpl in *. inversion H0. rewrite H2, Structures.nat_eqb_refl in H.
+ simpl in *. inversion H0. rewrite H2, Nat.eqb_refl in H.
case_eq (forallb2 eq_carry_lit (lit_to_carry (shr_lit_be (a :: bs1) (b :: l))) bsres); intros.
+ apply prop_eq_carry_lit2 in H1.
rewrite prop_interp_carry3 in H1.
@@ -8345,8 +8343,8 @@ Proof. intro bs1.
induction bs1 as [ | xbs1 xsbs1 IHbs1 ].
- intros. simpl.
unfold check_shr, shr_lit_be in H.
- case_eq (Structures.nat_eqb (@length int []) (length bs2)); intros.
- rewrite Structures.nat_eqb_eq in H0.
+ case_eq (Nat.eqb (@length int []) (length bs2)); intros.
+ rewrite Nat.eqb_eq in H0.
rewrite <- H0 in H. simpl in H.
rewrite nshr_lit_empty in H.
case_eq bsres; intros. simpl.
@@ -8354,7 +8352,7 @@ Proof. intro bs1.
subst; now contradict H.
rewrite H0 in H; now contradict H.
- intros. unfold check_shr in H.
- case_eq (Structures.nat_eqb (Datatypes.length (xbs1 :: xsbs1)) (Datatypes.length bs2)); intros.
+ case_eq (Nat.eqb (Datatypes.length (xbs1 :: xsbs1)) (Datatypes.length bs2)); intros.
rewrite H0 in H.
case_eq (
forallb2 eq_carry_lit (lit_to_carry (shr_lit_be (xbs1 :: xsbs1) bs2)) bsres); intros.
@@ -8362,7 +8360,7 @@ Proof. intro bs1.
rewrite prop_interp_carry3 in H1.
unfold RAWBITVECTOR_LIST.bv_shr.
- rewrite Structures.nat_eqb_eq in H0.
+ rewrite Nat.eqb_eq in H0.
unfold RAWBITVECTOR_LIST.size.
rewrite !map_length. rewrite H0, N.eqb_refl.
now rewrite <- H1, shr_interp.
diff --git a/src/classes/SMT_classes_instances.v b/src/classes/SMT_classes_instances.v
index aa2082e..a2831cf 100644
--- a/src/classes/SMT_classes_instances.v
+++ b/src/classes/SMT_classes_instances.v
@@ -13,7 +13,6 @@
Require Import Bool OrderedType BinPos ZArith OrderedTypeEx.
Require Import Int63.
Require Import State BVList FArray.
-Require Structures.
Require Export SMT_classes.
@@ -253,7 +252,7 @@ Section Nat.
Defined.
Global Instance Nat_eqbtype : EqbType nat :=
- {| eqb := Structures.nat_eqb; eqb_spec := Structures.nat_eqb_eq |}.
+ {| eqb := Nat.eqb; eqb_spec := Nat.eqb_eq |}.
Global Instance Nat_dec : DecType nat := EqbToDecType.
diff --git a/src/configure.sh b/src/configure.sh
deleted file mode 100755
index 21b7232..0000000
--- a/src/configure.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-
-pre=$(echo $0 | sed "s,\(\([^/]*/\)*\)[^/]*,\1,")
-
-rm -f ${pre}_CoqProject
-rm -f ${pre}Makefile
-rm -f ${pre}Makefile.conf
-rm -f ${pre}Makefile.local
-rm -f ${pre}smtcoq_plugin.ml4
-rm -f ${pre}versions/native/Structures.v
-rm -f ${pre}g_smtcoq.ml4
-rm -f ${pre}smtcoq_plugin.mlpack
-rm -f ${pre}Tactics.v
-rm -f ${pre}versions/standard/Int63/Int63.v
-rm -f ${pre}versions/standard/Int63/Int63Native.v
-rm -f ${pre}versions/standard/Int63/Int63Op.v
-rm -f ${pre}versions/standard/Int63/Int63Axioms.v
-rm -f ${pre}versions/standard/Int63/Int63Properties.v
-rm -f ${pre}versions/standard/Array/PArray.v
-rm -f ${pre}versions/standard/Structures.v
-
-set -e
-if [ $@ -a $@ = -native ]; then
- cp ${pre}versions/native/Makefile ${pre}Makefile
- cp ${pre}versions/native/smtcoq_plugin_native.ml4 ${pre}smtcoq_plugin.ml4
- cp ${pre}versions/native/Structures_native.v ${pre}versions/native/Structures.v
- cp ${pre}versions/native/Tactics_native.v ${pre}Tactics.v
-else
- cp ${pre}versions/standard/_CoqProject ${pre}_CoqProject
- cp ${pre}versions/standard/Makefile.local ${pre}Makefile.local
- cp ${pre}versions/standard/g_smtcoq_standard.ml4 ${pre}g_smtcoq.ml4
- cp ${pre}versions/standard/smtcoq_plugin_standard.mlpack ${pre}smtcoq_plugin.mlpack
- cp ${pre}versions/standard/Int63/Int63_standard.v ${pre}versions/standard/Int63/Int63.v
- cp ${pre}versions/standard/Int63/Int63Native_standard.v ${pre}versions/standard/Int63/Int63Native.v
- cp ${pre}versions/standard/Int63/Int63Op_standard.v ${pre}versions/standard/Int63/Int63Op.v
- cp ${pre}versions/standard/Int63/Int63Axioms_standard.v ${pre}versions/standard/Int63/Int63Axioms.v
- cp ${pre}versions/standard/Int63/Int63Properties_standard.v ${pre}versions/standard/Int63/Int63Properties.v
- cp ${pre}versions/standard/Array/PArray_standard.v ${pre}versions/standard/Array/PArray.v
- cp ${pre}versions/standard/Structures_standard.v ${pre}versions/standard/Structures.v
- cp ${pre}versions/standard/Tactics_standard.v ${pre}Tactics.v
- coq_makefile -f _CoqProject -o Makefile
-fi
diff --git a/src/euf/Euf.v b/src/euf/Euf.v
index c8de741..eb5ef28 100644
--- a/src/euf/Euf.v
+++ b/src/euf/Euf.v
@@ -180,7 +180,7 @@ Section certif.
apply C.interp_true.
destruct (Form.check_form_correct interp_form_hatom interp_form_hatom_bv _ ch_form);trivial.
Qed.
- Hint Resolve valid_C_true.
+ Hint Resolve valid_C_true : smtcoq_euf.
Local Notation interp := (Atom.interp t_i t_func t_atom).
@@ -210,9 +210,9 @@ Section certif.
C.interp rho (get_eq (Lit.blit l) f).
Proof.
intros l f Hf;unfold get_eq.
- case_eq (t_form.[Lit.blit l]);trivial;intros.
- case_eq (t_atom.[i]);trivial;intros.
- destruct b;trivial.
+ case_eq (t_form.[Lit.blit l]);trivial with smtcoq_euf;intros.
+ case_eq (t_atom.[i]);trivial with smtcoq_euf;intros.
+ destruct b;trivial with smtcoq_euf.
generalize wt_t_atom;unfold Atom.wt;unfold is_true;
rewrite PArray.forallbi_spec;intros.
assert (i < length t_atom).
@@ -279,48 +279,48 @@ Section certif.
C.interp rho (check_trans_aux t1 t2 eqs res c).
Proof.
induction eqs;simpl;intros.
- apply get_eq_interp;intros.
+ - apply get_eq_interp;intros.
match goal with |- context [if ?b then _ else _] => case_eq b end;
- intros;trivial.
+ intros;trivial with smtcoq_euf.
simpl;rewrite Lit.interp_lit;unfold Var.interp.
- destruct H1;[ | rewrite H1,orb_true_r;auto].
+ destruct H1;[ | rewrite H1,orb_true_r;auto with smtcoq_euf smtcoq_core].
rewrite orb_true_iff, !andb_true_iff in H7;destruct H7 as
[[H7 H8] | [H7 H8]].
rewrite eqb_spec in H7. rewrite eqb_spec in H8. subst.
- tunicity. subst t. rewrite H4, H1;auto.
+ tunicity. subst t. rewrite H4, H1;auto with smtcoq_euf smtcoq_core.
rewrite eqb_spec in H7. rewrite eqb_spec in H8. subst.
- tunicity. subst t;rewrite interp_binop_eqb_sym in H1;rewrite H4, H1;auto.
- apply get_eq_interp;intros.
+ tunicity. subst t;rewrite interp_binop_eqb_sym in H1;rewrite H4, H1;auto with smtcoq_euf smtcoq_core.
+ - apply get_eq_interp;intros.
destruct (Int63Properties.reflect_eqb t2 b);subst;tunicity; try subst t.
- apply (IHeqs u);trivial.
+ + apply (IHeqs u);trivial.
simpl;unfold is_true;rewrite orb_true_iff.
rewrite Lit.interp_nlit;unfold Var.interp.
- (* Attention ici on utilise la decidabilit'e de l'egalit'e sur u *)
+ (* Warning: here, we use decidability of equality over u *)
case_eq (rho (Lit.blit a));[rewrite H4; intros | simpl;auto].
destruct H1;[left | auto].
apply interp_binop_eqb_trans with (4:= H1);trivial.
rewrite interp_binop_eqb_sym;trivial.
- destruct (Int63Properties.reflect_eqb t2 a0); subst;tunicity; try subst t.
- apply (IHeqs u);trivial.
+ + destruct (Int63Properties.reflect_eqb t2 a0); subst;tunicity; try subst t.
+ * apply (IHeqs u);trivial.
simpl;unfold is_true;rewrite orb_true_iff.
rewrite Lit.interp_nlit;unfold Var.interp.
- (* Attention ici on utilise la decidabilit'e de l'egalit'e sur u *)
+ (* Warning: here, we use decidability of equality over u *)
case_eq (rho (Lit.blit a));[rewrite H4; intros | simpl;auto].
destruct H1;[left | auto].
apply interp_binop_eqb_trans with (4:= H1);trivial.
- destruct (Int63Properties.reflect_eqb t1 b);subst;tunicity; try subst t.
- apply (IHeqs u);trivial.
+ * destruct (Int63Properties.reflect_eqb t1 b);subst;tunicity; try subst t.
+ -- apply (IHeqs u);trivial.
simpl;unfold is_true;rewrite orb_true_iff.
rewrite Lit.interp_nlit;unfold Var.interp.
- (* Attention ici on utilise la decidabilit'e de l'egalit'e sur u *)
+ (* Warning: here, we use decidability of equality over u *)
case_eq (rho (Lit.blit a));[rewrite H4; intros | simpl;auto].
destruct H1;[left | auto].
apply interp_binop_eqb_trans with (5:= H1);trivial.
- destruct (Int63Properties.reflect_eqb t1 a0);[subst;tunicity;try subst t|auto].
+ -- destruct (Int63Properties.reflect_eqb t1 a0);[subst;tunicity;try subst t|auto with smtcoq_euf smtcoq_core].
apply (IHeqs u);trivial.
simpl;unfold is_true;rewrite orb_true_iff.
rewrite Lit.interp_nlit;unfold Var.interp.
- (* Attention ici on utilise la decidabilit'e de l'egalit'e sur u *)
+ (* Warning: here, we use decidability of equality over u *)
case_eq (rho (Lit.blit a));[rewrite H4; intros | simpl;auto].
destruct H1;[left | auto].
apply interp_binop_eqb_trans with (5:= H1);trivial.
@@ -332,9 +332,9 @@ Section certif.
C.interp rho (check_trans res eqs).
Proof.
unfold check_trans;intros res [ | leq eqs].
- apply get_eq_interp;intros.
+ - apply get_eq_interp;intros.
destruct (Int63Properties.reflect_eqb a b).
- unfold C.interp; simpl; rewrite orb_false_r.
+ + unfold C.interp; simpl; rewrite orb_false_r.
unfold Lit.interp; simpl; rewrite Lit.is_pos_lit.
unfold Var.interp; simpl; rewrite Lit.blit_lit.
rewrite H1.
@@ -344,12 +344,12 @@ Section certif.
unfold Atom.interp_hatom.
rewrite HHb;simpl;rewrite Typ.cast_refl;simpl.
apply Typ.i_eqb_refl.
- auto.
- apply get_eq_interp;intros.
+ + auto with smtcoq_euf.
+ - apply get_eq_interp;intros.
apply check_trans_aux_correct with t;trivial.
simpl;rewrite Lit.interp_nlit;unfold Var.interp. rewrite <- H1.
(* Attention ici on utilise la decidabilit'e de l'egalit'e sur t *)
- destruct (rho (Lit.blit leq));auto.
+ destruct (rho (Lit.blit leq));auto with smtcoq_core.
Qed.
Inductive Forall2 A B (P:A->B->Prop) : list A -> list B -> Prop :=
@@ -362,16 +362,16 @@ Section certif.
(Forall2 _ _ (fun a b => interp_hatom a = interp_hatom b) l r -> C.interp rho c) ->
C.interp rho (build_congr lp l r c).
Proof.
- induction lp;destruct l;destruct r;simpl;trivial;intros.
+ induction lp;destruct l;destruct r;simpl;trivial with smtcoq_euf smtcoq_core;intros.
apply H;constructor.
destruct a.
apply get_eq_interp;intros.
match goal with |- context [if ?x then _ else _] =>
- case_eq x;intros;auto end.
+ case_eq x;intros;auto with smtcoq_euf smtcoq_core end.
apply IHlp;simpl;intros.
rewrite Lit.interp_nlit;unfold Var.interp.
- case_eq (rho (Lit.blit i1));intros;simpl;[ | auto].
- apply H;constructor;trivial.
+ case_eq (rho (Lit.blit i1));intros;simpl;[ | auto with smtcoq_euf smtcoq_core].
+ apply H;constructor;trivial with smtcoq_euf smtcoq_core.
generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom a), (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom b). rewrite Typ.eqb_spec in H3. rewrite Typ.eqb_spec in H4. unfold Atom.get_type in H3, H4. rewrite H3,H4. intros [va HHa] [vb HHb].
revert H7;rewrite H2;unfold Atom.apply_binop; simpl.
unfold Atom.interp_hatom.
@@ -381,11 +381,11 @@ Section certif.
rewrite orb_true_iff, !andb_true_iff in H5;destruct H5 as
[ [H5 H7] | [H5 H7]].
rewrite eqb_spec in H5. rewrite eqb_spec in H7. subst.
- rewrite HHa, HHb;trivial.
+ rewrite HHa, HHb;trivial with smtcoq_euf smtcoq_core.
rewrite eqb_spec in H5. rewrite eqb_spec in H7. subst.
- rewrite HHa, HHb;trivial.
- destruct (Int63Properties.reflect_eqb i i0);[subst | auto].
- apply IHlp;intros;apply H;constructor;auto.
+ rewrite HHa, HHb;trivial with smtcoq_euf smtcoq_core.
+ destruct (Int63Properties.reflect_eqb i i0);[subst | auto with smtcoq_euf smtcoq_core].
+ apply IHlp;intros;apply H;constructor;auto with smtcoq_euf smtcoq_core.
Qed.
Lemma valid_check_congr :
@@ -393,71 +393,71 @@ Section certif.
C.interp rho (check_congr leq eqs).
Proof.
unfold check_congr;intros leq eqs;apply get_eq_interp;intros.
- case_eq (t_atom .[ a]);intros;auto;
- case_eq (t_atom .[ b]);intros;auto.
+ case_eq (t_atom .[ a]);intros;auto with smtcoq_euf smtcoq_core;
+ case_eq (t_atom .[ b]);intros;auto with smtcoq_euf smtcoq_core.
(* uop *)
- destruct (Atom.reflect_uop_eqb u u0);[subst | auto].
+ destruct (Atom.reflect_uop_eqb u u0);[subst | auto with smtcoq_euf smtcoq_core].
apply build_congr_correct;intros.
simpl;rewrite Lit.interp_lit, orb_false_r;unfold Var.interp.
rewrite H1.
generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom a), (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom b). rewrite Typ.eqb_spec in H2. rewrite Typ.eqb_spec in H3. unfold Atom.get_type in H2, H3. rewrite H2,H3. intros [va HHa] [vb HHb].
unfold Atom.apply_binop;unfold Atom.interp_hatom;simpl.
rewrite HHb, HHa. simpl.
- rewrite Atom.t_interp_wf in HHa; auto. rewrite H4 in HHa. simpl in HHa.
- rewrite Atom.t_interp_wf in HHb; auto. rewrite H5 in HHb. simpl in HHb.
+ rewrite Atom.t_interp_wf in HHa; auto with smtcoq_euf smtcoq_core. rewrite H4 in HHa. simpl in HHa.
+ rewrite Atom.t_interp_wf in HHb; auto with smtcoq_euf smtcoq_core. rewrite H5 in HHb. simpl in HHb.
rewrite Typ.cast_refl;simpl.
assert (Atom.Bval t_i t va = Atom.Bval t_i t vb).
inversion H6;subst.
unfold Atom.interp_hatom in H10.
- rewrite <- HHa; rewrite <- HHb, H10;trivial.
+ rewrite <- HHa; rewrite <- HHb, H10;trivial with smtcoq_euf smtcoq_core.
inversion H7.
- apply Eqdep_dec.inj_pair2_eq_dec in H9;trivial.
+ apply Eqdep_dec.inj_pair2_eq_dec in H9;trivial with smtcoq_euf smtcoq_core.
rewrite H9.
apply Typ.i_eqb_refl.
- intros x y;destruct (Typ.reflect_eqb x y);auto.
+ intros x y;destruct (Typ.reflect_eqb x y);auto with smtcoq_euf smtcoq_core.
(* bop *)
- destruct (Atom.reflect_bop_eqb b0 b1);[subst | auto].
+ destruct (Atom.reflect_bop_eqb b0 b1);[subst | auto with smtcoq_euf smtcoq_core].
apply build_congr_correct;intros.
simpl;rewrite Lit.interp_lit, orb_false_r;unfold Var.interp.
rewrite H1.
generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom a), (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom b). rewrite Typ.eqb_spec in H2. rewrite Typ.eqb_spec in H3. unfold Atom.get_type in H2, H3. rewrite H2,H3. intros [va HHa] [vb HHb].
unfold Atom.apply_binop. unfold Atom.interp_hatom;simpl.
rewrite HHb, HHa;simpl.
- rewrite Atom.t_interp_wf in HHa; auto. rewrite H4 in HHa. simpl in HHa.
- rewrite Atom.t_interp_wf in HHb; auto. rewrite H5 in HHb. simpl in HHb.
+ rewrite Atom.t_interp_wf in HHa; auto with smtcoq_euf smtcoq_core. rewrite H4 in HHa. simpl in HHa.
+ rewrite Atom.t_interp_wf in HHb; auto with smtcoq_euf smtcoq_core. rewrite H5 in HHb. simpl in HHb.
rewrite Typ.cast_refl;simpl.
assert (Atom.Bval t_i t va = Atom.Bval t_i t vb).
inversion H6;clear H6;subst.
inversion H12;clear H12;subst.
unfold Atom.interp_hatom in H10, H8.
- rewrite <- HHa. rewrite <- HHb, H10, H8;trivial.
+ rewrite <- HHa. rewrite <- HHb, H10, H8;trivial with smtcoq_euf smtcoq_core.
inversion H7.
- apply Eqdep_dec.inj_pair2_eq_dec in H9;trivial.
+ apply Eqdep_dec.inj_pair2_eq_dec in H9;trivial with smtcoq_euf smtcoq_core.
rewrite H9.
apply Typ.i_eqb_refl.
- intros x y;destruct (Typ.reflect_eqb x y);auto.
+ intros x y;destruct (Typ.reflect_eqb x y);auto with smtcoq_euf smtcoq_core.
(* op *)
- destruct (Int63Properties.reflect_eqb i i0);[subst | auto].
+ destruct (Int63Properties.reflect_eqb i i0);[subst | auto with smtcoq_euf smtcoq_core].
apply build_congr_correct;intros.
simpl;rewrite Lit.interp_lit, orb_false_r;unfold Var.interp.
rewrite H1.
generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom a), (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom b). rewrite Typ.eqb_spec in H2. rewrite Typ.eqb_spec in H3. unfold Atom.get_type in H2, H3. rewrite H2,H3. intros [va HHa] [vb HHb].
unfold Atom.apply_binop;unfold Atom.interp_hatom;simpl.
rewrite HHb, HHa;simpl.
- rewrite Atom.t_interp_wf in HHa; auto. rewrite H4 in HHa. simpl in HHa.
- rewrite Atom.t_interp_wf in HHb; auto. rewrite H5 in HHb. simpl in HHb.
+ rewrite Atom.t_interp_wf in HHa; auto with smtcoq_euf smtcoq_core. rewrite H4 in HHa. simpl in HHa.
+ rewrite Atom.t_interp_wf in HHb; auto with smtcoq_euf smtcoq_core. rewrite H5 in HHb. simpl in HHb.
rewrite Typ.cast_refl;simpl.
assert (Atom.Bval t_i t va = Atom.Bval t_i t vb).
rewrite <- HHa;rewrite <- HHb;destruct (t_func.[i0]).
apply f_equal;clear HHa HHb va vb H5 H4.
- induction H6;simpl;trivial.
+ induction H6;simpl;trivial with smtcoq_euf smtcoq_core.
unfold Atom.interp_hatom in H4.
- rewrite IHForall2, H4;trivial.
+ rewrite IHForall2, H4;trivial with smtcoq_euf smtcoq_core.
inversion H7.
- apply Eqdep_dec.inj_pair2_eq_dec in H9;trivial.
+ apply Eqdep_dec.inj_pair2_eq_dec in H9;trivial with smtcoq_euf smtcoq_core.
rewrite H9.
apply Typ.i_eqb_refl.
- intros x y;destruct (Typ.reflect_eqb x y);auto.
+ intros x y;destruct (Typ.reflect_eqb x y);auto with smtcoq_euf smtcoq_core.
Qed.
Lemma valid_check_congr_pred :
@@ -465,11 +465,11 @@ Section certif.
C.interp rho (check_congr_pred lpa lpb eqs).
Proof.
unfold check_congr_pred;intros.
- case_eq (t_form.[Lit.blit lpa]);auto.
- case_eq (t_form.[Lit.blit lpb]);auto;intros.
- case_eq (t_atom.[i0]);auto; case_eq (t_atom.[i]);auto;intros.
+ case_eq (t_form.[Lit.blit lpa]);auto with smtcoq_euf smtcoq_core.
+ case_eq (t_form.[Lit.blit lpb]);auto with smtcoq_euf smtcoq_core;intros.
+ case_eq (t_atom.[i0]);auto with smtcoq_euf smtcoq_core; case_eq (t_atom.[i]);auto with smtcoq_euf smtcoq_core;intros.
(* uop *)
- destruct (Atom.reflect_uop_eqb u0 u);[subst | auto].
+ destruct (Atom.reflect_uop_eqb u0 u);[subst | auto with smtcoq_euf smtcoq_core].
apply build_congr_correct;simpl;intros.
rewrite orb_false_r, Lit.interp_lit, Lit.interp_nlit;unfold Var.interp.
replace (rho (Lit.blit lpb)) with (rho (Lit.blit lpa)).
@@ -485,12 +485,12 @@ Section certif.
rewrite H2, def_t_atom;discriminate.
apply H4 in H5;apply H4 in H6;clear H4.
unfold Atom.interp_form_hatom, Atom.interp_hatom;simpl.
- rewrite !Atom.t_interp_wf, H1, H2;simpl;trivial.
+ rewrite !Atom.t_interp_wf, H1, H2;simpl;trivial with smtcoq_euf smtcoq_core.
apply f_equal;apply f_equal.
- inversion H3;clear H3;subst;trivial.
+ inversion H3;clear H3;subst;trivial with smtcoq_euf smtcoq_core.
(* bop *)
- destruct (Atom.reflect_bop_eqb b0 b);[subst | auto].
+ destruct (Atom.reflect_bop_eqb b0 b);[subst | auto with smtcoq_euf smtcoq_core].
apply build_congr_correct;simpl;intros.
rewrite orb_false_r, Lit.interp_lit, Lit.interp_nlit;unfold Var.interp.
replace (rho (Lit.blit lpb)) with (rho (Lit.blit lpa)).
@@ -506,13 +506,13 @@ Section certif.
rewrite H2, def_t_atom;discriminate.
apply H4 in H5;apply H4 in H6;clear H4.
unfold Atom.interp_form_hatom, Atom.interp_hatom;simpl.
- rewrite !Atom.t_interp_wf, H1, H2;simpl;trivial.
+ rewrite !Atom.t_interp_wf, H1, H2;simpl;trivial with smtcoq_euf smtcoq_core.
inversion H3;clear H3;subst.
inversion H11;clear H11;subst.
- apply f_equal; apply f_equal2;trivial.
+ apply f_equal; apply f_equal2;trivial with smtcoq_euf smtcoq_core.
(* op *)
- destruct (Int63Properties.reflect_eqb i2 i1);[subst | auto].
+ destruct (Int63Properties.reflect_eqb i2 i1);[subst | auto with smtcoq_euf smtcoq_core].
apply build_congr_correct;simpl;intros.
rewrite orb_false_r, Lit.interp_lit, Lit.interp_nlit;unfold Var.interp.
replace (rho (Lit.blit lpb)) with (rho (Lit.blit lpa)).
@@ -528,11 +528,11 @@ Section certif.
rewrite H2, def_t_atom;discriminate.
apply H4 in H5;apply H4 in H6;clear H4.
unfold Atom.interp_form_hatom, Atom.interp_hatom;simpl.
- rewrite !Atom.t_interp_wf, H1, H2;simpl;trivial.
+ rewrite !Atom.t_interp_wf, H1, H2;simpl;trivial with smtcoq_euf smtcoq_core.
apply f_equal;destruct (t_func.[i1]);apply f_equal.
clear H H0 H1 H2 H5 H6.
- induction H3;simpl;trivial.
- unfold Atom.interp_hatom in H;rewrite H, IHForall2;trivial.
+ induction H3;simpl;trivial with smtcoq_euf smtcoq_core.
+ unfold Atom.interp_hatom in H;rewrite H, IHForall2;trivial with smtcoq_euf smtcoq_core.
Qed.
End Proof.
diff --git a/src/extraction/Makefile b/src/extraction/Makefile
index 73b0ae4..354dd53 100644
--- a/src/extraction/Makefile
+++ b/src/extraction/Makefile
@@ -15,7 +15,7 @@ COQTOP=$(COQBIN)../
FLAGS=-rectypes
COMPILEFLAGS=-cclib -lunix
-SMTLIB=-I .. -I ../zchaff -I ../verit -I ../trace -I ../smtlib2 -I ../lia -I ../euf -I ../cnf -I ../versions/native/
+SMTLIB=-I .. -I ../zchaff -I ../verit -I ../trace -I ../smtlib2 -I ../lia -I ../euf -I ../cnf -I ../../3rdparty/alt-ergo
COQLIB=-I ${COQTOP}kernel -I ${COQTOP}lib -I ${COQTOP}library -I ${COQTOP}parsing -I ${COQTOP}pretyping -I ${COQTOP}interp -I ${COQTOP}proofs -I ${COQTOP}tactics -I ${COQTOP}toplevel -I ${COQTOP}plugins/btauto -I ${COQTOP}plugins/cc -I ${COQTOP}plugins/decl_mode -I ${COQTOP}plugins/extraction -I ${COQTOP}plugins/field -I ${COQTOP}plugins/firstorder -I ${COQTOP}plugins/fourier -I ${COQTOP}plugins/funind -I ${COQTOP}plugins/micromega -I ${COQTOP}plugins/nsatz -I ${COQTOP}plugins/omega -I ${COQTOP}plugins/quote -I ${COQTOP}plugins/ring -I ${COQTOP}plugins/romega -I ${COQTOP}plugins/rtauto -I ${COQTOP}plugins/setoid_ring -I ${COQTOP}plugins/syntax -I ${COQTOP}plugins/xml -I /usr/lib/ocaml/camlp5
CMXA=nums.cmxa str.cmxa unix.cmxa gramlib.cmxa dynlink.cmxa ${COQTOP}kernel/byterun/coq_fix_code.o ${COQTOP}kernel/byterun/coq_interp.o ${COQTOP}kernel/byterun/coq_memory.o ${COQTOP}kernel/byterun/coq_values.o clib.cmxa lib.cmxa kernel.cmxa library.cmxa pretyping.cmxa interp.cmxa proofs.cmxa parsing.cmxa tactics.cmxa toplevel.cmxa micromega_plugin.cmxa smtcoq.cmxa
diff --git a/src/extraction/verit_checker.mli b/src/extraction/verit_checker.mli
index 4491410..7b8b882 100644
--- a/src/extraction/verit_checker.mli
+++ b/src/extraction/verit_checker.mli
@@ -10,7 +10,7 @@
(**************************************************************************)
-module Mc = Structures.Micromega_plugin_Certificate.Mc
+module Mc = CoqInterface.Micromega_plugin_Certificate.Mc
val mkInt : int -> ExtrNative.uint
val mkArray : 'a array -> 'a ExtrNative.parray
val dump_nat : Mc.nat -> Smt_checker.nat
@@ -25,7 +25,7 @@ val to_coq :
'a SmtCertif.clause ->
Smt_checker.Euf_Checker.step ExtrNative.parray ExtrNative.parray *
'a SmtCertif.clause
-val btype_to_coq : SmtAtom.btype -> Smt_checker.Typ.coq_type
+val btype_to_coq : SmtBtype.btype -> Smt_checker.Typ.coq_type
val c_to_coq : SmtAtom.cop -> Smt_checker.Atom.cop
val u_to_coq : SmtAtom.uop -> Smt_checker.Atom.unop
val b_to_coq : SmtAtom.bop -> Smt_checker.Atom.binop
@@ -42,7 +42,7 @@ val form_interp_tbl :
SmtAtom.Form.reify -> Smt_checker.Form.form ExtrNative.parray
val count_btype : int ref
val count_op : int ref
-val declare_sort : Smtlib2_ast.symbol -> SmtAtom.btype
+val declare_sort : Smtlib2_ast.symbol -> SmtBtype.btype
val declare_fun :
Smtlib2_ast.symbol ->
Smtlib2_ast.sort list -> Smtlib2_ast.sort -> SmtAtom.indexed_op
diff --git a/src/versions/standard/g_smtcoq_standard.ml4 b/src/g_smtcoq.mlg
index ecb0cf5..c8d38db 100644
--- a/src/versions/standard/g_smtcoq_standard.ml4
+++ b/src/g_smtcoq.mlg
@@ -12,80 +12,82 @@
DECLARE PLUGIN "smtcoq_plugin"
-open Stdarg
+{
-(* This is requires since Coq 8.7 because the Ltac machinery became a
- plugin
- see: https://lists.gforge.inria.fr/pipermail/coq-commits/2017-February/021276.html *)
+open Stdarg
open Ltac_plugin
+}
+
VERNAC COMMAND EXTEND Vernac_zchaff CLASSIFIED AS QUERY
| [ "Parse_certif_zchaff"
ident(dimacs) ident(trace) string(fdimacs) string(fproof) ] ->
- [
+ {
Zchaff.parse_certif dimacs trace fdimacs fproof
- ]
+ }
| [ "Zchaff_Checker" string(fdimacs) string(fproof) ] ->
- [
+ {
Zchaff.checker fdimacs fproof
- ]
+ }
| [ "Zchaff_Theorem" ident(name) string(fdimacs) string(fproof) ] ->
- [
+ {
Zchaff.theorem name fdimacs fproof
- ]
+ }
END
VERNAC COMMAND EXTEND Vernac_verit CLASSIFIED AS QUERY
| [ "Parse_certif_verit"
ident(t_i) ident(t_func) ident(t_atom) ident(t_form) ident(root) ident(used_roots) ident(trace) string(fsmt) string(fproof) ] ->
- [
+ {
Verit.parse_certif t_i t_func t_atom t_form root used_roots trace fsmt fproof
- ]
+ }
| [ "Verit_Checker" string(fsmt) string(fproof) ] ->
- [
+ {
Verit.checker fsmt fproof
- ]
+ }
| [ "Verit_Checker_Debug" string(fsmt) string(fproof) ] ->
- [
+ {
Verit.checker_debug fsmt fproof
- ]
+ }
| [ "Verit_Theorem" ident(name) string(fsmt) string(fproof) ] ->
- [
+ {
Verit.theorem name fsmt fproof
- ]
+ }
END
VERNAC COMMAND EXTEND Vernac_lfsc CLASSIFIED AS QUERY
| [ "Parse_certif_lfsc"
ident(t_i) ident(t_func) ident(t_atom) ident(t_form) ident(root) ident(used_roots) ident(trace) string(fsmt) string(fproof) ] ->
- [
+ {
Lfsc.parse_certif t_i t_func t_atom t_form root used_roots trace fsmt fproof
- ]
+ }
| [ "Lfsc_Checker" string(fsmt) string(fproof) ] ->
- [
+ {
Lfsc.checker fsmt fproof
- ]
+ }
| [ "Lfsc_Checker_Debug" string(fsmt) string(fproof) ] ->
- [
+ {
Lfsc.checker_debug fsmt fproof
- ]
+ }
| [ "Lfsc_Theorem" ident(name) string(fsmt) string(fproof) ] ->
- [
+ {
Lfsc.theorem name fsmt fproof
- ]
+ }
END
TACTIC EXTEND Tactic_zchaff
-| [ "zchaff_bool" ] -> [ Zchaff.tactic () ]
-| [ "zchaff_bool_no_check" ] -> [ Zchaff.tactic_no_check () ]
+| [ "zchaff_bool" ] -> { Zchaff.tactic () }
+| [ "zchaff_bool_no_check" ] -> { Zchaff.tactic_no_check () }
END
+{
+
let lemmas_list = Summary.ref ~name:"Selected lemmas" []
let cache_lemmas (_, lems) =
lemmas_list := lems
-let declare_lemmas : Structures.constr_expr list -> Libobject.obj =
+let declare_lemmas : CoqInterface.constr_expr list -> Libobject.obj =
let open Libobject in
declare_object
{
@@ -102,18 +104,20 @@ let clear_lemmas () =
let get_lemmas () = !lemmas_list
+}
+
VERNAC COMMAND EXTEND Add_lemma CLASSIFIED AS SIDEFF
-| [ "Add_lemmas" constr_list(lems) ] -> [ add_lemmas lems ]
-| [ "Clear_lemmas" ] -> [ clear_lemmas () ]
+| [ "Add_lemmas" constr_list(lems) ] -> { add_lemmas lems }
+| [ "Clear_lemmas" ] -> { clear_lemmas () }
END
TACTIC EXTEND Tactic_verit
-| [ "verit_bool_base" constr(lpl) ] -> [ Verit.tactic lpl (get_lemmas ()) ]
-| [ "verit_bool_no_check_base" constr(lpl) ] -> [ Verit.tactic_no_check lpl (get_lemmas ()) ]
+| [ "verit_bool_base" constr(lpl) ] -> { Verit.tactic lpl (get_lemmas ()) }
+| [ "verit_bool_no_check_base" constr(lpl) ] -> { Verit.tactic_no_check lpl (get_lemmas ()) }
END
TACTIC EXTEND Tactic_cvc4
-| [ "cvc4_bool" ] -> [ Lfsc.tactic () ]
-| [ "cvc4_bool_no_check" ] -> [ Lfsc.tactic_no_check () ]
+| [ "cvc4_bool" ] -> { Lfsc.tactic () }
+| [ "cvc4_bool_no_check" ] -> { Lfsc.tactic_no_check () }
END
diff --git a/src/lfsc/ast.ml b/src/lfsc/ast.ml
index 73af5b2..36f7d85 100644
--- a/src/lfsc/ast.ml
+++ b/src/lfsc/ast.ml
@@ -198,7 +198,7 @@ let compare_symbol s1 s2 = match s1.sname, s2.sname with
| Name n1, Name n2 -> Hstring.compare n1 n2
| Name _, _ -> -1
| _, Name _ -> 1
- | S_Hole i1, S_Hole i2 -> Pervasives.compare i1 i2
+ | S_Hole i1, S_Hole i2 -> Stdlib.compare i1 i2
let rec compare_term ?(mod_eq=false) t1 t2 = match t1.value, t2.value with
@@ -250,7 +250,7 @@ let rec compare_term ?(mod_eq=false) t1 t2 = match t1.value, t2.value with
| SideCond (_, _, _, t), _ -> compare_term ~mod_eq t t2
| _, SideCond (_, _, _, t) -> compare_term ~mod_eq t1 t
- | Hole i1, Hole i2 -> Pervasives.compare i1 i2
+ | Hole i1, Hole i2 -> Stdlib.compare i1 i2
and compare_term_list ?(mod_eq=false) l1 l2 = match l1, l2 with
diff --git a/src/lfsc/builtin.ml b/src/lfsc/builtin.ml
index b01c414..4a7d0cb 100644
--- a/src/lfsc/builtin.ml
+++ b/src/lfsc/builtin.ml
@@ -616,7 +616,7 @@ let cong s1 s2 a1 b1 a2 b2 u1 u2 =
module MInt = Map.Make (struct
type t = int
- let compare = Pervasives.compare
+ let compare = Stdlib.compare
end)
module STerm = Set.Make (Term)
diff --git a/src/lfsc/lfsc.ml b/src/lfsc/lfsc.ml
index f17eb04..f2157a4 100644
--- a/src/lfsc/lfsc.ml
+++ b/src/lfsc/lfsc.ml
@@ -57,7 +57,7 @@ let process_signatures_once =
) signatures
with
| Ast.TypingError (t1, t2) ->
- Structures.error
+ CoqInterface.error
(asprintf "@[<hov>LFSC typing error: expected %a, got %a@]@."
Ast.print_term t1
Ast.print_term t2)
@@ -116,7 +116,7 @@ let import_trace first parse lexbuf =
with
| Ast.TypingError (t1, t2) ->
- Structures.error
+ CoqInterface.error
(asprintf "@[<hov>LFSC typing error: expected %a, got %a@]@."
Ast.print_term t1
Ast.print_term t2)
@@ -386,13 +386,13 @@ let call_cvc4 env rt ro ra rf root _ =
begin
try get_proof cvc4 (import_trace (Some root) lfsc_parse_one)
with
- | Ast.CVC4Sat -> Structures.error "CVC4 returned SAT"
- | No_proof -> Structures.error "CVC4 did not generate a proof"
- | Failure s -> Structures.error ("Importing of proof failed: " ^ s)
+ | Ast.CVC4Sat -> CoqInterface.error "CVC4 returned SAT"
+ | No_proof -> CoqInterface.error "CVC4 did not generate a proof"
+ | Failure s -> CoqInterface.error ("Importing of proof failed: " ^ s)
end
| Sat ->
let smodel = get_model cvc4 in
- Structures.error
+ CoqInterface.error
("CVC4 returned sat. Here is the model:\n\n" ^
SmtCommands.model_string env rt ro ra rf smodel)
(* (asprintf "CVC4 returned sat. Here is the model:\n%a" SExpr.print smodel) *)
@@ -435,7 +435,7 @@ let get_model_from_file filename =
let lexbuf = Lexing.from_channel chan in
match SExprParser.sexps SExprLexer.main lexbuf with
| [SExpr.Atom "sat"; m] -> m
- | _ -> Structures.error "CVC4 returned SAT but no model"
+ | _ -> CoqInterface.error "CVC4 returned SAT but no model"
let call_cvc4_file env rt ro ra rf root =
@@ -467,17 +467,17 @@ let call_cvc4_file env rt ro ra rf root =
eprintf "CVC4 = %.5f@." (t1-.t0);
if exit_code <> 0 then
- Structures.error ("CVC4 crashed: return code "^string_of_int exit_code);
+ CoqInterface.error ("CVC4 crashed: return code "^string_of_int exit_code);
(* ignore (Sys.command clean_cmd); *)
try import_trace_from_file (Some root) prooffilename
with
- | No_proof -> Structures.error "CVC4 did not generate a proof"
- | Failure s -> Structures.error ("Importing of proof failed: " ^ s)
+ | No_proof -> CoqInterface.error "CVC4 did not generate a proof"
+ | Failure s -> CoqInterface.error ("Importing of proof failed: " ^ s)
| Ast.CVC4Sat ->
let smodel = get_model_from_file prooffilename in
- Structures.error
+ CoqInterface.error
("CVC4 returned sat. Here is the model:\n\n" ^
SmtCommands.model_string env rt ro ra rf smodel)
diff --git a/src/lfsc/shashcons.mli b/src/lfsc/shashcons.mli
index 0cc51cf..1e49d26 100644
--- a/src/lfsc/shashcons.mli
+++ b/src/lfsc/shashcons.mli
@@ -47,6 +47,7 @@ module type S =
val iter : (t -> unit) -> unit
(** [iter f] iterates [f] over all elements of the table . *)
+
val stats : unit -> int * int * int * int * int * int
(** Return statistics on the table. The numbers are, in order:
table length, number of entries, sum of bucket lengths,
@@ -83,6 +84,7 @@ module type S_consed =
val iter : (key hash_consed -> unit) -> unit
(** [iter f] iterates [f] over all elements of the table . *)
+
val stats : unit -> int * int * int * int * int * int
(** Return statistics on the table. The numbers are, in order:
table length, number of entries, sum of bucket lengths,
diff --git a/src/lia/Lia.v b/src/lia/Lia.v
index 7d0c9e8..d3d622b 100644
--- a/src/lia/Lia.v
+++ b/src/lia/Lia.v
@@ -113,7 +113,7 @@ Section certif.
| Some z => (vm, PEc z)
| None =>
let (vm,p) := find_var vm h in
- (vm,PEX Z p)
+ (vm,PEX p)
end
end.
@@ -157,7 +157,7 @@ Section certif.
Section Build_form.
Definition build_not2 i f :=
- fold (fun f' => N (N (A:=Formula Z) f')) 1 i f.
+ fold (fun f' : BFormula (Formula Z) => N (N f')) 1 i f.
Variable build_var : vmap -> var -> option (vmap*BFormula (Formula Z)).
@@ -166,11 +166,11 @@ Section certif.
match f with
| Form.Fatom h =>
match build_formula vm h with
- | Some (vm,f) => Some (vm, A f)
+ | Some (vm,f) => Some (vm, A f tt)
| None => None
end
- | Form.Ftrue => Some (vm, TT (Formula Z))
- | Form.Ffalse => Some (vm, FF (Formula Z))
+ | Form.Ftrue => Some (vm, TT)
+ | Form.Ffalse => Some (vm, FF)
| Form.Fnot2 i l =>
match build_var vm (Lit.blit l) with
| Some (vm, f) =>
@@ -181,7 +181,7 @@ Section certif.
end
| Form.Fand args =>
let n := length args in
- if n == 0 then Some (vm,TT (Formula Z))
+ if n == 0 then Some (vm,TT)
else
foldi (fun i f1 => match f1 with | Some(vm',f1') => let l := (args.[i]) in match build_var vm' (Lit.blit l) with | Some(vm2,f2) => let f2' := if Lit.is_pos l then f2 else N f2 in Some(vm2,Cj f1' f2') | None => None end | None => None end) 1 (n-1) (let l := args.[0] in
match build_var vm (Lit.blit l) with
@@ -190,7 +190,7 @@ Section certif.
end)
| Form.For args =>
let n := length args in
- if n == 0 then Some (vm,FF (Formula Z))
+ if n == 0 then Some (vm,FF)
else
foldi (fun i f1 => match f1 with | Some(vm',f1') => let l := (args.[i]) in match build_var vm' (Lit.blit l) with | Some(vm2,f2) => let f2' := if Lit.is_pos l then f2 else N f2 in Some(vm2,D f1' f2') | None => None end | None => None end) 1 (n-1) (let l := args.[0] in
match build_var vm (Lit.blit l) with
@@ -211,7 +211,7 @@ Section certif.
end
| Form.Fimp args =>
let n := length args in
- if n == 0 then Some (vm,TT (Formula Z))
+ if n == 0 then Some (vm,TT)
else if n <= 1 then
let l := args.[0] in
match build_var vm (Lit.blit l) with
@@ -219,7 +219,7 @@ Section certif.
| None => None
end
else
- foldi_down (fun i f1 => match f1 with | Some(vm',f1') => let l := (args.[i]) in match build_var vm' (Lit.blit l) with | Some(vm2,f2) => let f2' := if Lit.is_pos l then f2 else N f2 in Some(vm2,I f2' f1') | None => None end | None => None end) (n-2) 0 (let l := args.[n-1] in
+ foldi_down (fun i f1 => match f1 with | Some(vm',f1') => let l := (args.[i]) in match build_var vm' (Lit.blit l) with | Some(vm2,f2) => let f2' := if Lit.is_pos l then f2 else N f2 in Some(vm2,I f2' None f1') | None => None end | None => None end) (n-2) 0 (let l := args.[n-1] in
match build_var vm (Lit.blit l) with
| Some (vm',f) => if Lit.is_pos l then Some (vm',f) else Some (vm',N f)
| None => None
@@ -295,7 +295,7 @@ Section certif.
Definition build_clause vm cl :=
match build_clause_aux vm cl with
- | Some (vm, bf) => Some (vm, I bf (FF _))
+ | Some (vm, bf) => Some (vm, I bf None FF)
| None => None
end.
@@ -479,11 +479,11 @@ Section certif.
Fixpoint bounded_bformula (p:positive) (bf:BFormula (Formula Z)) :=
match bf with
- | @TT _ | @FF _ | @X _ _ => true
- | A f => bounded_formula p f
+ | @TT _ | @FF _ | @X _ _ _ _ _ => true
+ | A f _ => bounded_formula p f
| Cj bf1 bf2
| D bf1 bf2
- | I bf1 bf2 => bounded_bformula p bf1 && bounded_bformula p bf2
+ | I bf1 _ bf2 => bounded_bformula p bf1 && bounded_bformula p bf2
| N bf => bounded_bformula p bf
end.
@@ -523,7 +523,7 @@ Section certif.
check_atom h Typ.TZ ->
match build_z_atom h with
| Some z => (vm, PEc z)
- | None => let (vm0, p) := find_var vm h in (vm0, PEX Z p)
+ | None => let (vm0, p) := find_var vm h in (vm0, PEX p)
end = (vm', pe) ->
wf_vmap vm ->
wf_vmap vm' /\
@@ -1020,13 +1020,15 @@ Transparent build_z_atom.
intros;apply build_formula_atom_correct with
(get_type t_i t_func t_atom h);trivial.
unfold wt, is_true in wt_t_atom;rewrite forallbi_spec in wt_t_atom.
- case_eq (h < length t_atom);intros Heq;unfold get_type;auto.
+ case_eq (h < length t_atom);intros Heq;unfold get_type;auto with smtcoq_core.
unfold get_type'.
rewrite !PArray.get_outofbound, default_t_interp, def_t_atom;trivial; try reflexivity.
rewrite length_t_interp;trivial.
Qed.
+ Local Notation eval_f := (eval_f (fun x => x)).
+
Lemma build_not2_pos_correct : forall vm f l i,
bounded_bformula (fst vm) f -> (rho (Lit.blit l) <-> eval_f (Zeval_formula (interp_vmap vm)) f) -> Lit.is_pos l -> bounded_bformula (fst vm) (build_not2 i f) /\ (Form.interp interp_form_hatom interp_form_hatom_bv t_form (Form.Fnot2 i l) <-> eval_f (Zeval_formula (interp_vmap vm)) (build_not2 i f)).
Proof.
@@ -1083,7 +1085,7 @@ Transparent build_z_atom.
Proof.
intros vm vm' Hnth.
unfold is_true;induction bf;simpl;try tauto.
- destruct a;unfold bounded_formula;simpl.
+ destruct t;unfold bounded_formula;simpl.
rewrite andb_true_iff;intros (H1, H2).
rewrite !(interp_pexpr_le _ _ Hnth);tauto.
rewrite andb_true_iff;intros (H1,H2);rewrite IHbf1, IHbf2;tauto.
@@ -1123,12 +1125,12 @@ Transparent build_z_atom.
(* Ftrue *)
intros H H1; inversion H; subst vm'; subst bf; split; auto; split; [omega| ]; do 4 split; auto.
(* Ffalse *)
- intros H H1; inversion H; subst vm'; subst bf; split; auto; split; [omega| ]; do 3 (split; auto); discriminate.
+ intros H H1; inversion H; subst vm'; subst bf; split; auto; split; [omega| ]; do 3 (split; auto with smtcoq_core); discriminate.
(* Fnot2 *)
case_eq (build_var vm (Lit.blit l)); try discriminate; intros [vm0 f] Heq H H1; inversion H; subst vm0; subst bf; destruct (Hbv _ _ _ _ Heq H1) as [H2 [H3 [H4 [H5 H6]]]]; do 3 (split; auto); case_eq (Lit.is_pos l); [apply build_not2_pos_correct|apply build_not2_neg_correct]; auto.
(* Fand *)
simpl; unfold afold_left; case (length l == 0).
- intro H; inversion H; subst vm'; subst bf; simpl; intro H1; split; auto; split; [omega| ]; do 3 (split; auto).
+ intro H; inversion H; subst vm'; subst bf; simpl; intro H1; split; auto with smtcoq_core; split; [omega| ]; do 3 (split; auto with smtcoq_core).
revert vm' bf; apply (foldi_ind2 _ _ (fun f1 b => forall vm' bf, f1 = Some (vm', bf) -> wf_vmap vm -> wf_vmap vm' /\ (Pos.to_nat (fst vm) <= Pos.to_nat (fst vm'))%nat /\ (forall p : positive, (Pos.to_nat p < Pos.to_nat (fst vm))%nat -> nth_error (snd vm) (Pos.to_nat (fst vm - p) - 1) = nth_error (snd vm') (Pos.to_nat (fst vm' - p) - 1)) /\ bounded_bformula (fst vm') bf /\ (b = true <-> eval_f (Zeval_formula (interp_vmap vm')) bf))).
intros vm' bf; case_eq (build_var vm (Lit.blit (l .[ 0]))); try discriminate; intros [vm0 f] Heq; case_eq (Lit.is_pos (l .[ 0])); intros Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq H2) as [H10 [H11 [H12 [H13 H14]]]]; do 4 (split; auto); unfold Lit.interp; rewrite Heq2; auto; simpl; split.
intros H3 H4; rewrite <- H14 in H4; rewrite H4 in H3; discriminate.
@@ -1136,104 +1138,76 @@ Transparent build_z_atom.
intros i a b _ H1; case a; try discriminate; intros [vm0 f0] IH vm' bf; case_eq (build_var vm0 (Lit.blit (l .[ i]))); try discriminate; intros [vm1 f1] Heq H2 H3; inversion H2; subst vm'; subst bf; destruct (IH _ _ (refl_equal (Some (vm0, f0))) H3) as [H5 [H6 [H7 [H8 H9]]]]; destruct (Hbv _ _ _ _ Heq H5) as [H10 [H11 [H12 [H13 H14]]]]; split; auto; split; [eauto with arith| ]; split.
intros p H15; rewrite H7; auto; apply H12; eauto with arith.
split.
- simpl; rewrite (bounded_bformula_le _ _ H11 _ H8); case (Lit.is_pos (l .[ i])); rewrite H13; auto.
- simpl; rewrite (interp_bformula_le _ _ H12 _ H8) in H9; rewrite <- H9; case_eq (Lit.is_pos (l .[ i])); intro Heq2; simpl; rewrite <- H14; unfold Lit.interp; rewrite Heq2; split; case (Var.interp rho (Lit.blit (l .[ i]))); try rewrite andb_true_r; try rewrite andb_false_r; try (intros; split; auto); try discriminate; intros [H20 H21]; auto.
+ simpl; rewrite (bounded_bformula_le _ _ H11 _ H8); case (Lit.is_pos (l .[ i])); rewrite H13; auto with smtcoq_core.
+ simpl; rewrite (interp_bformula_le _ _ H12 _ H8) in H9; rewrite <- H9; case_eq (Lit.is_pos (l .[ i])); intro Heq2; simpl; rewrite <- H14; unfold Lit.interp; rewrite Heq2; split; case (Var.interp rho (Lit.blit (l .[ i]))); try rewrite andb_true_r; try rewrite andb_false_r; try (intros; split; auto with smtcoq_core); try discriminate; intros [H20 H21]; auto with smtcoq_core.
(* For *)
simpl; unfold afold_left; case (length l == 0).
- intro H; inversion H; subst vm'; subst bf; simpl; intro H1; split; auto; split; [omega| ]; do 3 (split; auto); discriminate.
+ intro H; inversion H; subst vm'; subst bf; simpl; intro H1; split; auto with smtcoq_core; split; [omega| ]; do 3 (split; auto with smtcoq_core); discriminate.
revert vm' bf; apply (foldi_ind2 _ _ (fun f1 b => forall vm' bf, f1 = Some (vm', bf) -> wf_vmap vm -> wf_vmap vm' /\ (Pos.to_nat (fst vm) <= Pos.to_nat (fst vm'))%nat /\ (forall p : positive, (Pos.to_nat p < Pos.to_nat (fst vm))%nat -> nth_error (snd vm) (Pos.to_nat (fst vm - p) - 1) = nth_error (snd vm') (Pos.to_nat (fst vm' - p) - 1)) /\ bounded_bformula (fst vm') bf /\ (b = true <-> eval_f (Zeval_formula (interp_vmap vm')) bf))).
- intros vm' bf; case_eq (build_var vm (Lit.blit (l .[ 0]))); try discriminate; intros [vm0 f] Heq; case_eq (Lit.is_pos (l .[ 0])); intros Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq H2) as [H10 [H11 [H12 [H13 H14]]]]; do 4 (split; auto); unfold Lit.interp; rewrite Heq2; auto; simpl; split.
+ intros vm' bf; case_eq (build_var vm (Lit.blit (l .[ 0]))); try discriminate; intros [vm0 f] Heq; case_eq (Lit.is_pos (l .[ 0])); intros Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq H2) as [H10 [H11 [H12 [H13 H14]]]]; do 4 (split; auto with smtcoq_core); unfold Lit.interp; rewrite Heq2; auto with smtcoq_core; simpl; split.
intros H3 H4; rewrite <- H14 in H4; rewrite H4 in H3; discriminate.
- intro H3; case_eq (Var.interp rho (Lit.blit (l .[ 0]))); auto; intro H4; elim H3; rewrite <- H14; auto.
- intros i a b _ H1; case a; try discriminate; intros [vm0 f0] IH vm' bf; case_eq (build_var vm0 (Lit.blit (l .[ i]))); try discriminate; intros [vm1 f1] Heq H2 H3; inversion H2; subst vm'; subst bf; destruct (IH _ _ (refl_equal (Some (vm0, f0))) H3) as [H5 [H6 [H7 [H8 H9]]]]; destruct (Hbv _ _ _ _ Heq H5) as [H10 [H11 [H12 [H13 H14]]]]; split; auto; split; [eauto with arith| ]; split.
- intros p H15; rewrite H7; auto; apply H12; eauto with arith.
+ intro H3; case_eq (Var.interp rho (Lit.blit (l .[ 0]))); auto with smtcoq_core; intro H4; elim H3; rewrite <- H14; auto with smtcoq_core.
+ intros i a b _ H1; case a; try discriminate; intros [vm0 f0] IH vm' bf; case_eq (build_var vm0 (Lit.blit (l .[ i]))); try discriminate; intros [vm1 f1] Heq H2 H3; inversion H2; subst vm'; subst bf; destruct (IH _ _ (refl_equal (Some (vm0, f0))) H3) as [H5 [H6 [H7 [H8 H9]]]]; destruct (Hbv _ _ _ _ Heq H5) as [H10 [H11 [H12 [H13 H14]]]]; split; auto with smtcoq_core; split; [eauto with smtcoq_core arith| ]; split.
+ intros p H15; rewrite H7; auto with smtcoq_core; apply H12; eauto with smtcoq_core arith.
split.
- simpl; rewrite (bounded_bformula_le _ _ H11 _ H8); case (Lit.is_pos (l .[ i])); rewrite H13; auto.
- simpl; rewrite (interp_bformula_le _ _ H12 _ H8) in H9; rewrite <- H9; case_eq (Lit.is_pos (l .[ i])); intro Heq2; simpl; rewrite <- H14; unfold Lit.interp; rewrite Heq2; split; case (Var.interp rho (Lit.blit (l .[ i]))); try rewrite orb_false_r; try rewrite orb_true_r; auto; try (intros [H20|H20]; auto; discriminate); right; intro H20; discriminate.
+ simpl; rewrite (bounded_bformula_le _ _ H11 _ H8); case (Lit.is_pos (l .[ i])); rewrite H13; auto with smtcoq_core.
+ simpl; rewrite (interp_bformula_le _ _ H12 _ H8) in H9; rewrite <- H9; case_eq (Lit.is_pos (l .[ i])); intro Heq2; simpl; rewrite <- H14; unfold Lit.interp; rewrite Heq2; split; case (Var.interp rho (Lit.blit (l .[ i]))); try rewrite orb_false_r; try rewrite orb_true_r; auto with smtcoq_core; try (intros [H20|H20]; auto with smtcoq_core; discriminate); right; intro H20; discriminate.
(* Fimp *)
simpl; unfold afold_right; case (length l == 0).
- intro H; inversion H; subst vm'; subst bf; simpl; intro H1; split; auto; split; [omega| ]; do 3 (split; auto).
+ intro H; inversion H; subst vm'; subst bf; simpl; intro H1; split; auto with smtcoq_core; split; [omega| ]; do 3 (split; auto with smtcoq_core).
case (length l <= 1).
- case_eq (build_var vm (Lit.blit (l .[ 0]))); try discriminate; intros [vm0 f] Heq; case_eq (Lit.is_pos (l .[ 0])); intros Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq H2) as [H3 [H4 [H5 [H6 H7]]]]; do 4 (split; auto); unfold Lit.interp; rewrite Heq2; auto; simpl; split.
+ case_eq (build_var vm (Lit.blit (l .[ 0]))); try discriminate; intros [vm0 f] Heq; case_eq (Lit.is_pos (l .[ 0])); intros Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq H2) as [H3 [H4 [H5 [H6 H7]]]]; do 4 (split; auto with smtcoq_core); unfold Lit.interp; rewrite Heq2; auto with smtcoq_core; simpl; split.
intros H8 H9; rewrite <- H7 in H9; rewrite H9 in H8; discriminate.
- intro H8; case_eq (Var.interp rho (Lit.blit (l .[ 0]))); auto; intro H9; rewrite H7 in H9; elim H8; auto.
+ intro H8; case_eq (Var.interp rho (Lit.blit (l .[ 0]))); auto with smtcoq_core; intro H9; rewrite H7 in H9; elim H8; auto with smtcoq_core.
revert vm' bf; apply (foldi_down_ind2 _ _ (fun f1 b => forall vm' bf, f1 = Some (vm', bf) -> wf_vmap vm -> wf_vmap vm' /\ (Pos.to_nat (fst vm) <= Pos.to_nat (fst vm'))%nat /\ (forall p : positive, (Pos.to_nat p < Pos.to_nat (fst vm))%nat -> nth_error (snd vm) (Pos.to_nat (fst vm - p) - 1) = nth_error (snd vm') (Pos.to_nat (fst vm' - p) - 1)) /\ bounded_bformula (fst vm') bf /\ (b = true <-> eval_f (Zeval_formula (interp_vmap vm')) bf))).
- intros vm' bf; case_eq (build_var vm (Lit.blit (l .[ length l - 1]))); try discriminate; intros [vm0 f] Heq; case_eq (Lit.is_pos (l .[ length l - 1])); intros Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq H2) as [H10 [H11 [H12 [H13 H14]]]]; do 4 (split; auto); unfold Lit.interp; rewrite Heq2; auto; simpl; split.
+ intros vm' bf; case_eq (build_var vm (Lit.blit (l .[ length l - 1]))); try discriminate; intros [vm0 f] Heq; case_eq (Lit.is_pos (l .[ length l - 1])); intros Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq H2) as [H10 [H11 [H12 [H13 H14]]]]; do 4 (split; auto with smtcoq_core); unfold Lit.interp; rewrite Heq2; auto with smtcoq_core; simpl; split.
intros H3 H4; rewrite <- H14 in H4; rewrite H4 in H3; discriminate.
- intro H3; case_eq (Var.interp rho (Lit.blit (l .[ length l - 1]))); auto; intro H4; elim H3; rewrite <- H14; auto.
- intros i a b _ H1; case a; try discriminate; intros [vm0 f0] IH vm' bf; case_eq (build_var vm0 (Lit.blit (l .[ i]))); try discriminate; intros [vm1 f1] Heq H2 H3; inversion H2; subst vm'; subst bf; destruct (IH _ _ (refl_equal (Some (vm0, f0))) H3) as [H5 [H6 [H7 [H8 H9]]]]; destruct (Hbv _ _ _ _ Heq H5) as [H10 [H11 [H12 [H13 H14]]]]; split; auto; split; [eauto with arith| ]; split.
- intros p H15; rewrite H7; auto; apply H12; eauto with arith.
+ intro H3; case_eq (Var.interp rho (Lit.blit (l .[ length l - 1]))); auto with smtcoq_core; intro H4; elim H3; rewrite <- H14; auto with smtcoq_core.
+ intros i a b _ H1; case a; try discriminate; intros [vm0 f0] IH vm' bf; case_eq (build_var vm0 (Lit.blit (l .[ i]))); try discriminate; intros [vm1 f1] Heq H2 H3; inversion H2; subst vm'; subst bf; destruct (IH _ _ (refl_equal (Some (vm0, f0))) H3) as [H5 [H6 [H7 [H8 H9]]]]; destruct (Hbv _ _ _ _ Heq H5) as [H10 [H11 [H12 [H13 H14]]]]; split; auto with smtcoq_core; split; [eauto with smtcoq_core arith| ]; split.
+ intros p H15; rewrite H7; auto with smtcoq_core; apply H12; eauto with smtcoq_core arith.
split.
- simpl; rewrite (bounded_bformula_le _ _ H11 _ H8); case (Lit.is_pos (l .[ i])); rewrite H13; auto.
- simpl; rewrite (interp_bformula_le _ _ H12 _ H8) in H9; rewrite <- H9; case_eq (Lit.is_pos (l .[ i])); intro Heq2; simpl; rewrite <- H14; unfold Lit.interp; rewrite Heq2; split; case (Var.interp rho (Lit.blit (l .[ i]))); auto; try discriminate; simpl; intro H; apply H; discriminate.
+ simpl; rewrite (bounded_bformula_le _ _ H11 _ H8); case (Lit.is_pos (l .[ i])); rewrite H13; auto with smtcoq_core.
+ simpl; rewrite (interp_bformula_le _ _ H12 _ H8) in H9; rewrite <- H9; case_eq (Lit.is_pos (l .[ i])); intro Heq2; simpl; rewrite <- H14; unfold Lit.interp; rewrite Heq2; split; case (Var.interp rho (Lit.blit (l .[ i]))); auto with smtcoq_core; try discriminate; simpl; intro H; apply H; discriminate.
(* Fxor *)
- simpl; case_eq (build_var vm (Lit.blit a)); try discriminate; intros [vm1 f1] Heq1; case_eq (build_var vm1 (Lit.blit b)); try discriminate; intros [vm2 f2] Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq1 H2) as [H3 [H4 [H5 [H6 H7]]]]; destruct (Hbv _ _ _ _ Heq2 H3) as [H8 [H9 [H10 [H11 H12]]]]; split; auto; split; [eauto with arith| ]; split.
- intros p H18; rewrite H5; auto; rewrite H10; eauto with arith.
+ simpl; case_eq (build_var vm (Lit.blit a)); try discriminate; intros [vm1 f1] Heq1; case_eq (build_var vm1 (Lit.blit b)); try discriminate; intros [vm2 f2] Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq1 H2) as [H3 [H4 [H5 [H6 H7]]]]; destruct (Hbv _ _ _ _ Heq2 H3) as [H8 [H9 [H10 [H11 H12]]]]; split; auto with smtcoq_core; split; [eauto with smtcoq_core arith| ]; split.
+ intros p H18; rewrite H5; auto with smtcoq_core; rewrite H10; eauto with smtcoq_core arith.
split.
- case (Lit.is_pos a); case (Lit.is_pos b); simpl; rewrite H11; rewrite (bounded_bformula_le _ _ H9 _ H6); auto.
- simpl; rewrite (interp_bformula_le _ _ H10 _ H6) in H7; case_eq (Lit.is_pos a); intro Ha; case_eq (Lit.is_pos b); intro Hb; unfold Lit.interp; rewrite Ha, Hb; simpl; rewrite <- H12; rewrite <- H7; (case (Var.interp rho (Lit.blit a)); case (Var.interp rho (Lit.blit b))); split; auto; try discriminate; simpl.
- intros [_ [H20|H20]]; elim H20; reflexivity.
- intros _; split; [left; reflexivity|right; intro H20; discriminate].
- intros _; split; [right; reflexivity|left; intro H20; discriminate].
- intros [[H20|H20] _]; discriminate.
- intros [_ [H20|H20]]; elim H20; [reflexivity|discriminate].
- intros [[H20|H20] _]; [discriminate|elim H20; reflexivity].
- intros _; split; [right|left]; discriminate.
- intros [[H20|H20] _]; [elim H20; reflexivity|discriminate].
- intros [_ [H20|H20]]; elim H20; [discriminate|reflexivity].
- intros _; split; [left|right]; discriminate.
- intros [[H20|H20] _]; elim H20; reflexivity.
- intros _; split; [right; discriminate|left; intro H21; apply H21; reflexivity].
- intros _; split; [left; discriminate|right; intro H21; apply H21; reflexivity].
- intros [_ [H20|H20]]; elim H20; discriminate.
+ case (Lit.is_pos a); case (Lit.is_pos b); simpl; rewrite H11; rewrite (bounded_bformula_le _ _ H9 _ H6); auto with smtcoq_core.
+ simpl; rewrite (interp_bformula_le _ _ H10 _ H6) in H7; case_eq (Lit.is_pos a); intro Ha; case_eq (Lit.is_pos b); intro Hb; unfold Lit.interp; rewrite Ha, Hb; simpl; rewrite <- H12; rewrite <- H7; (case (Var.interp rho (Lit.blit a)); case (Var.interp rho (Lit.blit b))); split; auto with smtcoq_core; try discriminate; simpl; intuition.
(* Fiff *)
- simpl; case_eq (build_var vm (Lit.blit a)); try discriminate; intros [vm1 f1] Heq1; case_eq (build_var vm1 (Lit.blit b)); try discriminate; intros [vm2 f2] Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq1 H2) as [H3 [H4 [H5 [H6 H7]]]]; destruct (Hbv _ _ _ _ Heq2 H3) as [H8 [H9 [H10 [H11 H12]]]]; split; auto; split; [eauto with arith| ]; split.
- intros p H18; rewrite H5; auto; rewrite H10; eauto with arith.
+ simpl; case_eq (build_var vm (Lit.blit a)); try discriminate; intros [vm1 f1] Heq1; case_eq (build_var vm1 (Lit.blit b)); try discriminate; intros [vm2 f2] Heq2 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq1 H2) as [H3 [H4 [H5 [H6 H7]]]]; destruct (Hbv _ _ _ _ Heq2 H3) as [H8 [H9 [H10 [H11 H12]]]]; split; auto with smtcoq_core; split; [eauto with smtcoq_core arith| ]; split.
+ intros p H18; rewrite H5; auto with smtcoq_core; rewrite H10; eauto with smtcoq_core arith.
split.
- case (Lit.is_pos a); case (Lit.is_pos b); simpl; rewrite H11; rewrite (bounded_bformula_le _ _ H9 _ H6); auto.
- simpl; rewrite (interp_bformula_le _ _ H10 _ H6) in H7; case_eq (Lit.is_pos a); intro Ha; case_eq (Lit.is_pos b); intro Hb; unfold Lit.interp; rewrite Ha, Hb; simpl; rewrite <- H12; rewrite <- H7; (case (Var.interp rho (Lit.blit a)); case (Var.interp rho (Lit.blit b))); split; auto; try discriminate; simpl.
- intros [_ [H20|H20]]; [elim H20; reflexivity|discriminate].
- intros [[H20|H20] _]; [discriminate|elim H20; reflexivity].
- intros _; split; [right|left]; discriminate.
- intros [_ [H20|H20]]; elim H20; reflexivity.
- intros _; split; [left; reflexivity|right; discriminate].
- intros _; split; [right; intro H20; apply H20; reflexivity|left; discriminate].
- intros [[H20|H20] _]; [ |elim H20]; discriminate.
- intros [[H20|H20] _]; elim H20; reflexivity.
- intros _; split; [right; discriminate|left; intro H20; apply H20; reflexivity].
- intros _; split; [left; discriminate|right; reflexivity].
- intros [_ [H20|H20]]; [elim H20| ]; discriminate.
- intros [[H20|H20] _]; elim H20; [reflexivity|discriminate].
- intros [_ [H20|H20]]; elim H20; [discriminate|reflexivity].
- intros _; split; [left|right]; discriminate.
+ case (Lit.is_pos a); case (Lit.is_pos b); simpl; rewrite H11; rewrite (bounded_bformula_le _ _ H9 _ H6); auto with smtcoq_core.
+ simpl; rewrite (interp_bformula_le _ _ H10 _ H6) in H7; case_eq (Lit.is_pos a); intro Ha; case_eq (Lit.is_pos b); intro Hb; unfold Lit.interp; rewrite Ha, Hb; simpl; rewrite <- H12; rewrite <- H7; (case (Var.interp rho (Lit.blit a)); case (Var.interp rho (Lit.blit b))); split; auto with smtcoq_core; try discriminate; simpl; intuition.
(* Fite *)
- simpl; case_eq (build_var vm (Lit.blit a)); try discriminate; intros [vm1 f1] Heq1; case_eq (build_var vm1 (Lit.blit b)); try discriminate; intros [vm2 f2] Heq2; case_eq (build_var vm2 (Lit.blit c)); try discriminate; intros [vm3 f3] Heq3 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq1 H2) as [H3 [H4 [H5 [H6 H7]]]]; destruct (Hbv _ _ _ _ Heq2 H3) as [H8 [H9 [H10 [H11 H12]]]]; destruct (Hbv _ _ _ _ Heq3 H8) as [H13 [H14 [H15 [H16 H17]]]]; split; auto; split; [eauto with arith| ]; split.
- intros p H18; rewrite H5; auto; rewrite H10; eauto with arith.
- assert (H18: (Pos.to_nat (fst vm1) <= Pos.to_nat (fst vm3))%nat) by eauto with arith.
+ simpl; case_eq (build_var vm (Lit.blit a)); try discriminate; intros [vm1 f1] Heq1; case_eq (build_var vm1 (Lit.blit b)); try discriminate; intros [vm2 f2] Heq2; case_eq (build_var vm2 (Lit.blit c)); try discriminate; intros [vm3 f3] Heq3 H1 H2; inversion H1; subst vm'; subst bf; destruct (Hbv _ _ _ _ Heq1 H2) as [H3 [H4 [H5 [H6 H7]]]]; destruct (Hbv _ _ _ _ Heq2 H3) as [H8 [H9 [H10 [H11 H12]]]]; destruct (Hbv _ _ _ _ Heq3 H8) as [H13 [H14 [H15 [H16 H17]]]]; split; auto with smtcoq_core; split; [eauto with smtcoq_core arith| ]; split.
+ intros p H18; rewrite H5; auto with smtcoq_core; rewrite H10; eauto with smtcoq_core arith.
+ assert (H18: (Pos.to_nat (fst vm1) <= Pos.to_nat (fst vm3))%nat) by eauto with smtcoq_core arith.
split.
- case (Lit.is_pos a); case (Lit.is_pos b); case (Lit.is_pos c); simpl; rewrite H16; rewrite (bounded_bformula_le _ _ H14 _ H11); rewrite (bounded_bformula_le _ _ H18 _ H6); auto.
- simpl; rewrite (interp_bformula_le _ _ H15 _ H11) in H12; rewrite (interp_bformula_le _ vm3) in H7; [ |intros p Hp; rewrite H10; eauto with arith|auto]; case_eq (Lit.is_pos a); intro Ha; case_eq (Lit.is_pos b); intro Hb; case_eq (Lit.is_pos c); intro Hc; unfold Lit.interp; rewrite Ha, Hb, Hc; simpl; rewrite <- H17; rewrite <- H12; rewrite <- H7; (case (Var.interp rho (Lit.blit a)); [case (Var.interp rho (Lit.blit b))|case (Var.interp rho (Lit.blit c))]); split; auto; try discriminate; try (intros [[H20 H21]|[H20 H21]]; auto); try (intros _; left; split; auto; discriminate); try (intros _; right; split; auto; discriminate); try (elim H20; discriminate); try (elim H21; discriminate); try (simpl; intro H; left; split; auto; discriminate); try (revert H; case (Var.interp rho (Lit.blit c)); discriminate); try (revert H; case (Var.interp rho (Lit.blit b)); discriminate); try (intro H20; rewrite H20 in H; discriminate); simpl.
- intro H; right; split; auto.
- intro H; right; split; auto.
- intro H; right; split; auto.
+ case (Lit.is_pos a); case (Lit.is_pos b); case (Lit.is_pos c); simpl; rewrite H16; rewrite (bounded_bformula_le _ _ H14 _ H11); rewrite (bounded_bformula_le _ _ H18 _ H6); auto with smtcoq_core.
+ simpl; rewrite (interp_bformula_le _ _ H15 _ H11) in H12; rewrite (interp_bformula_le _ vm3) in H7; [ |intros p Hp; rewrite H10; eauto with smtcoq_core arith|auto with smtcoq_core]; case_eq (Lit.is_pos a); intro Ha; case_eq (Lit.is_pos b); intro Hb; case_eq (Lit.is_pos c); intro Hc; unfold Lit.interp; rewrite Ha, Hb, Hc; simpl; rewrite <- H17; rewrite <- H12; rewrite <- H7; (case (Var.interp rho (Lit.blit a)); [case (Var.interp rho (Lit.blit b))|case (Var.interp rho (Lit.blit c))]); split; auto with smtcoq_core; try discriminate; try (intros [[H20 H21]|[H20 H21]]; auto with smtcoq_core); try (intros _; left; split; auto with smtcoq_core; discriminate); try (intros _; right; split; auto with smtcoq_core; discriminate); try (elim H20; discriminate); try (elim H21; discriminate); try (simpl; intro H; left; split; auto with smtcoq_core; discriminate); try (revert H; case (Var.interp rho (Lit.blit c)); discriminate); try (revert H; case (Var.interp rho (Lit.blit b)); discriminate); try (intro H20; rewrite H20 in H; discriminate); simpl.
+ intro H; right; split; auto with smtcoq_core.
+ intro H; right; split; auto with smtcoq_core.
+ intro H; right; split; auto with smtcoq_core.
intro H20; rewrite H20 in H; discriminate.
- revert H21; case (Var.interp rho (Lit.blit c)); auto.
- right; split; auto; intro H20; rewrite H20 in H; discriminate.
- revert H21; case (Var.interp rho (Lit.blit c)); auto.
- intro H; right; split; auto.
- intro H; right; split; auto.
+ revert H21; case (Var.interp rho (Lit.blit c)); auto with smtcoq_core.
+ right; split; auto with smtcoq_core; intro H20; rewrite H20 in H; discriminate.
+ revert H21; case (Var.interp rho (Lit.blit c)); auto with smtcoq_core.
+ intro H; right; split; auto with smtcoq_core.
+ intro H; right; split; auto with smtcoq_core.
intro H; left; split; try discriminate; revert H; case (Var.interp rho (Lit.blit b)); discriminate.
- revert H21; case (Var.interp rho (Lit.blit b)); auto.
+ revert H21; case (Var.interp rho (Lit.blit b)); auto with smtcoq_core.
intro H; left; split; try discriminate; revert H; case (Var.interp rho (Lit.blit b)); discriminate.
- revert H21; case (Var.interp rho (Lit.blit b)); auto.
- intro H; right; split; auto; revert H; case (Var.interp rho (Lit.blit c)); discriminate.
- revert H21; case (Var.interp rho (Lit.blit c)); auto.
- intro H; right; split; auto; revert H; case (Var.interp rho (Lit.blit c)); discriminate.
- revert H21; case (Var.interp rho (Lit.blit c)); auto.
- intro H; left; split; auto; revert H; case (Var.interp rho (Lit.blit b)); discriminate.
- revert H21; case (Var.interp rho (Lit.blit b)); auto.
- intro H; left; split; auto; revert H; case (Var.interp rho (Lit.blit b)); discriminate.
- revert H21; case (Var.interp rho (Lit.blit b)); auto.
+ revert H21; case (Var.interp rho (Lit.blit b)); auto with smtcoq_core.
+ intro H; right; split; auto with smtcoq_core; revert H; case (Var.interp rho (Lit.blit c)); discriminate.
+ revert H21; case (Var.interp rho (Lit.blit c)); auto with smtcoq_core.
+ intro H; right; split; auto with smtcoq_core; revert H; case (Var.interp rho (Lit.blit c)); discriminate.
+ revert H21; case (Var.interp rho (Lit.blit c)); auto with smtcoq_core.
+ intro H; left; split; auto with smtcoq_core; revert H; case (Var.interp rho (Lit.blit b)); discriminate.
+ revert H21; case (Var.interp rho (Lit.blit b)); auto with smtcoq_core.
+ intro H; left; split; auto with smtcoq_core; revert H; case (Var.interp rho (Lit.blit b)); discriminate.
+ revert H21; case (Var.interp rho (Lit.blit b)); auto with smtcoq_core.
Qed.
@@ -1251,8 +1225,8 @@ Transparent build_z_atom.
Proof.
unfold build_var; apply foldi_down_cont_ind; try discriminate.
intros i cont _ Hlen Hrec v vm vm' bf; unfold is_true; intros H1 H2; replace (Var.interp rho v) with (Form.interp interp_form_hatom interp_form_hatom_bv t_form (t_form.[v])).
- apply (build_hform_correct cont); auto.
- unfold Var.interp; rewrite <- wf_interp_form; auto.
+ apply (build_hform_correct cont); auto with smtcoq_core.
+ unfold Var.interp; rewrite <- wf_interp_form; auto with smtcoq_core.
Qed.
@@ -1285,17 +1259,17 @@ Transparent build_z_atom.
unfold build_nlit; intros l vm vm' bf; case_eq (build_form vm (t_form .[ Lit.blit (Lit.neg l)])); try discriminate.
intros [vm1 f] Heq H1 H2; inversion H1; subst vm1; subst bf; case_eq (Lit.is_pos (Lit.neg l)); intro Heq2.
replace (negb (Lit.interp rho l)) with (Form.interp interp_form_hatom interp_form_hatom_bv t_form (t_form .[ Lit.blit (Lit.neg l)])).
- apply build_form_correct; auto.
+ apply build_form_correct; auto with smtcoq_core.
unfold Lit.interp; replace (Lit.is_pos l) with false.
- rewrite negb_involutive; unfold Var.interp; rewrite <- wf_interp_form; auto; rewrite Lit.blit_neg; auto.
- rewrite Lit.is_pos_neg in Heq2; case_eq (Lit.is_pos l); auto; intro H; rewrite H in Heq2; discriminate.
- simpl; destruct (build_form_correct (t_form .[ Lit.blit (Lit.neg l)]) vm vm' f Heq H2) as [H3 [H4 [H5 [H6 [H7 H8]]]]]; do 4 (split; auto); split.
+ rewrite negb_involutive; unfold Var.interp; rewrite <- wf_interp_form; auto with smtcoq_core; rewrite Lit.blit_neg; auto with smtcoq_core.
+ rewrite Lit.is_pos_neg in Heq2; case_eq (Lit.is_pos l); auto with smtcoq_core; intro H; rewrite H in Heq2; discriminate.
+ simpl; destruct (build_form_correct (t_form .[ Lit.blit (Lit.neg l)]) vm vm' f Heq H2) as [H3 [H4 [H5 [H6 [H7 H8]]]]]; do 4 (split; auto with smtcoq_core); split.
intros H9 H10; pose (H11 := H8 H10); unfold Lit.interp in H9; replace (Lit.is_pos l) with true in H9.
- unfold Var.interp in H9; rewrite <- wf_interp_form in H11; auto; rewrite Lit.blit_neg in H11; rewrite H11 in H9; discriminate.
- rewrite Lit.is_pos_neg in Heq2; case_eq (Lit.is_pos l); auto; intro H; rewrite H in Heq2; discriminate.
- intro H9; case_eq (Lit.interp rho l); intro Heq3; auto; elim H9; apply H7; unfold Lit.interp in Heq3; replace (Lit.is_pos l) with true in Heq3.
- unfold Var.interp in Heq3; rewrite <- wf_interp_form; auto; rewrite Lit.blit_neg; auto.
- rewrite Lit.is_pos_neg in Heq2; case_eq (Lit.is_pos l); auto; intro H; rewrite H in Heq2; discriminate.
+ unfold Var.interp in H9; rewrite <- wf_interp_form in H11; auto with smtcoq_core; rewrite Lit.blit_neg in H11; rewrite H11 in H9; discriminate.
+ rewrite Lit.is_pos_neg in Heq2; case_eq (Lit.is_pos l); auto with smtcoq_core; intro H; rewrite H in Heq2; discriminate.
+ intro H9; case_eq (Lit.interp rho l); intro Heq3; auto with smtcoq_core; elim H9; apply H7; unfold Lit.interp in Heq3; replace (Lit.is_pos l) with true in Heq3.
+ unfold Var.interp in Heq3; rewrite <- wf_interp_form; auto with smtcoq_core; rewrite Lit.blit_neg; auto with smtcoq_core.
+ rewrite Lit.is_pos_neg in Heq2; case_eq (Lit.is_pos l); auto with smtcoq_core; intro H; rewrite H in Heq2; discriminate.
Qed.
@@ -1403,7 +1377,7 @@ Transparent build_z_atom.
rewrite H0, def_t_atom;discriminate.
apply H1 in H2;clear H1;rewrite H0 in H2;simpl in H2.
rewrite !andb_true_iff in H2;decompose [and] H2;clear H2.
- apply Hf with (2:= H0);trivial. auto.
+ apply Hf with (2:= H0);trivial. auto with smtcoq_core.
rewrite wf_interp_form, H;simpl.
unfold Atom.interp_form_hatom, Atom.interp_hatom at 1;simpl.
rewrite Atom.t_interp_wf, H0;simpl;trivial.
@@ -1434,7 +1408,7 @@ Transparent build_z_atom.
rewrite H0, def_t_atom;discriminate.
apply H1 in H2;clear H1;rewrite H0 in H2;simpl in H2.
rewrite !andb_true_iff in H2;decompose [and] H2;clear H2.
- simpl; apply Hf with (2:= H0);trivial. auto.
+ simpl; apply Hf with (2:= H0);trivial. auto with smtcoq_core.
rewrite wf_interp_form, H;simpl.
unfold Atom.interp_form_hatom, Atom.interp_hatom at 1;simpl.
rewrite Atom.t_interp_wf, H0;simpl;trivial.
@@ -1480,7 +1454,7 @@ Transparent build_z_atom.
case_eq (build_clause empty_vmap cl).
intros (vm1, bf) Heq.
destruct (build_clause_correct _ _ _ _ Heq).
- red;simpl;auto.
+ red;simpl;auto with smtcoq_core.
decompose [and] H0.
case_eq (ZTautoChecker bf c);intros Heq2.
unfold C.valid;rewrite H5.
@@ -1512,11 +1486,11 @@ Transparent build_z_atom.
rewrite wf_interp_form, H;simpl.
case_eq (Lit.interp rho (a.[0]) || Lit.interp rho (a.[1]) || Lit.interp rho (a.[2])).
intros;repeat (rewrite orb_true_iff in H19);destruct H19. destruct H19.
- apply (afold_left_orb_true int 0); subst; auto.
+ apply (afold_left_orb_true int 0); subst; auto with smtcoq_core.
apply ltb_spec;rewrite H0;compute;trivial.
- apply (afold_left_orb_true int 1); auto.
+ apply (afold_left_orb_true int 1); auto with smtcoq_core.
apply ltb_spec;rewrite H0;compute;trivial.
- apply (afold_left_orb_true int 2); auto.
+ apply (afold_left_orb_true int 2); auto with smtcoq_core.
apply ltb_spec;rewrite H0;compute;trivial.
intros; repeat (rewrite orb_false_iff in H19);destruct H19. destruct H19.
unfold Lit.interp in H19.
@@ -1534,7 +1508,7 @@ Transparent build_z_atom.
destruct (Typ.reflect_eqb (get_type t_i t_func t_atom b0) Typ.TZ) as [H12|H12]; [intros _|discriminate].
generalize H6. clear H6.
destruct (Typ.reflect_eqb (get_type t_i t_func t_atom b0) t) as [H6|H6]; [intros _|discriminate].
- rewrite <- H6. auto.
+ rewrite <- H6. auto with smtcoq_core.
rewrite H26 in H19.
case_eq (interp_atom (t_atom .[ b1])); intros t1 v1 Heq1.
assert (H50: t1 = Typ.TZ).
@@ -1560,11 +1534,11 @@ Transparent build_z_atom.
rewrite wf_interp_form, H;simpl.
case_eq (Lit.interp rho (a.[0]) || Lit.interp rho (a.[1]) || Lit.interp rho (a.[2])).
intros;repeat (rewrite orb_true_iff in H19);destruct H19. destruct H19.
- apply (afold_left_orb_true int 0); auto.
+ apply (afold_left_orb_true int 0); auto with smtcoq_core.
apply ltb_spec;rewrite H0;compute;trivial.
- apply (afold_left_orb_true int 1); auto.
+ apply (afold_left_orb_true int 1); auto with smtcoq_core.
apply ltb_spec;rewrite H0;compute;trivial.
- apply (afold_left_orb_true int 2); auto.
+ apply (afold_left_orb_true int 2); auto with smtcoq_core.
apply ltb_spec;rewrite H0;compute;trivial.
intros; repeat (rewrite orb_false_iff in H19);destruct H19. destruct H19.
unfold Lit.interp in H19.
@@ -1581,7 +1555,7 @@ Transparent build_z_atom.
unfold Var.interp in H23; rewrite H10 in H23.
rewrite <-H22, <- H20 in H21.
assert (t = Typ.TZ).
- rewrite Typ.eqb_spec in H6; rewrite Typ.eqb_spec in H18; subst; auto.
+ rewrite Typ.eqb_spec in H6; rewrite Typ.eqb_spec in H18; subst; auto with smtcoq_core.
rewrite H26 in H19.
case_eq (interp_atom (t_atom .[ b0])); intros t1 v1 Heq1.
assert (H50: t1 = Typ.TZ).
diff --git a/src/lia/lia.ml b/src/lia/lia.ml
index 2bb88f3..e00092e 100644
--- a/src/lia/lia.ml
+++ b/src/lia/lia.ml
@@ -12,10 +12,8 @@
(*** Linking SMT Terms to Micromega Terms ***)
open Util
-open Structures.Micromega_plugin_Micromega
-open Structures.Micromega_plugin_Coq_micromega
+open CoqInterface.Micromega_plugin_Micromega
-open SmtMisc
open SmtForm
open SmtAtom
@@ -29,14 +27,6 @@ let rec pos_of_int i =
then XO(pos_of_int (i lsr 1))
else XI(pos_of_int (i lsr 1))
-let z_of_int i =
- if i = 0
- then Z0
- else
- if i > 0
- then Zpos (pos_of_int i)
- else Zneg (pos_of_int (-i))
-
type my_tbl =
{tbl:(hatom,int) Hashtbl.t; mutable count:int}
@@ -102,7 +92,7 @@ let smt_binop_to_micromega_formula tbl op ha hb =
| BO_Zge -> OpGe
| BO_Zgt -> OpGt
| BO_eq _ -> OpEq
- | _ -> Structures.error
+ | _ -> CoqInterface.error
"lia.ml: smt_binop_to_micromega_formula expecting a formula"
in
let lhs = smt_Atom_to_micromega_pExpr tbl ha in
@@ -112,13 +102,11 @@ let smt_binop_to_micromega_formula tbl op ha hb =
let smt_Atom_to_micromega_formula tbl ha =
match Atom.atom ha with
| Abop (op,ha,hb) -> smt_binop_to_micromega_formula tbl op ha hb
- | _ -> Structures.error
+ | _ -> CoqInterface.error
"lia.ml: smt_Atom_to_micromega_formula was expecting an LIA formula"
(* specialized fold *)
-let default_constr = lazy (Structures.econstr_of_constr (mkInt 0))
-let default_tag = Structures.Micromega_plugin_Mutils.Tag.from 0
(* morphism for general formulas *)
let binop_array g tbl op def t =
@@ -135,12 +123,10 @@ let binop_array g tbl op def t =
let rec smt_Form_to_coq_micromega_formula tbl l =
let v =
match Form.pform l with
- | Fatom ha ->
- A (smt_Atom_to_micromega_formula tbl ha,
- default_tag, Lazy.force default_constr)
+ | Fatom ha -> A (smt_Atom_to_micromega_formula tbl ha, Tt)
| Fapp (Ftrue, _) -> TT
| Fapp (Ffalse, _) -> FF
- | Fapp (Fand, l) -> binop_array smt_Form_to_coq_micromega_formula tbl (fun x y -> C (x,y)) TT l
+ | Fapp (Fand, l) -> binop_array smt_Form_to_coq_micromega_formula tbl (fun x y -> Cj (x,y)) TT l
| Fapp (For, l) -> binop_array smt_Form_to_coq_micromega_formula tbl (fun x y -> D (x,y)) FF l
| Fapp (Fxor, l) -> failwith "todo:Fxor"
| Fapp (Fimp, l) -> binop_array smt_Form_to_coq_micromega_formula tbl (fun x y -> I (x,None,y)) TT l
@@ -162,49 +148,25 @@ let binop_list tbl op def l =
| [] -> def
| f::l -> List.fold_left (fun x y -> op x (smt_Form_to_coq_micromega_formula tbl y)) (smt_Form_to_coq_micromega_formula tbl f) l
-
-(* let rec binop_list tbl op def l = *)
-(* match l with *)
-(* | [] -> def *)
-(* | [f] -> smt_Form_to_coq_micromega_formula tbl f *)
-(* | f::l -> *)
-(* op (smt_Form_to_coq_micromega_formula tbl f) (binop_list tbl op def l) *)
-
-(* and smt_Form_to_coq_micromega_formula tbl l = *)
-(* let v = *)
-(* match Form.pform l with *)
-(* | Fatom ha -> *)
-(* A (smt_Atom_to_micromega_formula tbl ha, *)
-(* default_tag,default_constr) *)
-(* | Fapp (Ftrue, _) -> TT *)
-(* | Fapp (Ffalse, _) -> FF *)
-(* | Fapp (Fand, l) -> binop_list tbl (fun x y -> C (x,y)) TT l *)
-(* | Fapp (For, l) -> binop_list tbl (fun x y -> D (x,y)) FF l *)
-(* | Fapp (Fxor, l) -> failwith "todo:Fxor" *)
-(* | Fapp (Fimp, l) -> binop_list tbl (fun x y -> I (x,None,y)) TT l *)
-(* | Fapp (Fiff, l) -> failwith "todo:Fiff" *)
-(* | Fapp (Fite, l) -> failwith "todo:Fite" *)
-(* | Fapp (Fnot2 _, l) -> smt_Form_to_coq_micromega_formula tbl l *)
-(* in *)
-(* if Form.is_pos l then v *)
-(* else N(v) *)
-
-
let smt_clause_to_coq_micromega_formula tbl cl =
- binop_list tbl (fun x y -> C(x,y)) TT (List.map Form.neg cl)
+ binop_list tbl (fun x y -> Cj (x,y)) TT (List.map Form.neg cl)
-(* backported from Coq-8.8.2 *)
-(* val tauto_lia : Mc.z formula -> Certificate.Mc.zArithProof list option *)
let tauto_lia ff =
- let prover = linear_Z in
- let cnf_ff,_ = Structures.Micromega_plugin_Coq_micromega.cnf Mc.negate Mc.normalise Mc.zunsat Mc.zdeduce ff in
- match witness_list_tags [prover] cnf_ff with
- | None -> None
- | Some l -> Some (List.map fst l)
+ let cnf_ff,_ = CoqInterface.Micromega_plugin_Micromega.cnfZ ff in
+ let rec xwitness_list l =
+ match l with
+ | [] -> Some []
+ | e :: l ->
+ match xwitness_list l with
+ | None -> None
+ | Some l ->
+ match CoqInterface.Micromega_plugin_Certificate.lia true max_int (List.map (fun ((e, o), _) -> CoqInterface.Micromega_plugin_Micromega.denorm e, o) e) with
+ | CoqInterface.Micromega_plugin_Certificate.Prf w -> Some (w::l)
+ | _ -> None in
+ xwitness_list cnf_ff
(* call to micromega solver *)
let build_lia_certif cl =
let tbl = create_tbl 13 in
let f = I(smt_clause_to_coq_micromega_formula tbl cl, None, FF) in
- tbl, f, tauto_lia f
-
+ tauto_lia f
diff --git a/src/lia/lia.mli b/src/lia/lia.mli
index bdd187c..f996ac0 100644
--- a/src/lia/lia.mli
+++ b/src/lia/lia.mli
@@ -10,60 +10,6 @@
(**************************************************************************)
-val pos_of_int : int -> Structures.Micromega_plugin_Micromega.positive
-val z_of_int : int -> Structures.Micromega_plugin_Micromega.z
-type my_tbl
-val get_atom_var : my_tbl -> SmtAtom.hatom -> int
-val create_tbl : int -> my_tbl
-val smt_Atom_to_micromega_pos :
- SmtAtom.hatom -> Structures.Micromega_plugin_Micromega.positive
-val smt_Atom_to_micromega_Z :
- SmtAtom.hatom -> Structures.Micromega_plugin_Micromega.z
-val smt_Atom_to_micromega_pExpr :
- my_tbl ->
- SmtAtom.hatom ->
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Micromega.pExpr
-val smt_binop_to_micromega_formula :
- my_tbl ->
- SmtAtom.bop ->
- SmtAtom.hatom ->
- SmtAtom.hatom ->
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Micromega.formula
-val smt_Atom_to_micromega_formula :
- my_tbl ->
- SmtAtom.hatom ->
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Micromega.formula
-val binop_array :
- ('a -> 'b -> 'c) -> 'a -> ('c -> 'c -> 'c) -> 'c -> 'b array -> 'c
-val smt_Form_to_coq_micromega_formula :
- my_tbl ->
- SmtAtom.Form.t ->
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Coq_micromega.formula
-val binop_list :
- my_tbl ->
- (Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Coq_micromega.formula ->
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Coq_micromega.formula ->
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Coq_micromega.formula) ->
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Coq_micromega.formula ->
- SmtAtom.Form.t list ->
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Coq_micromega.formula
-val smt_clause_to_coq_micromega_formula :
- my_tbl ->
- SmtAtom.Form.t list ->
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Coq_micromega.formula
val build_lia_certif :
SmtAtom.Form.t list ->
- my_tbl *
- Structures.Micromega_plugin_Micromega.z
- Structures.Micromega_plugin_Coq_micromega.formula *
- Structures.Micromega_plugin_Certificate.Mc.zArithProof list option
+ CoqInterface.Micromega_plugin_Certificate.Mc.zArithProof list option
diff --git a/src/versions/standard/smtcoq_plugin_standard.mlpack b/src/smtcoq_plugin.mlpack
index 81ac24b..0907551 100644
--- a/src/versions/standard/smtcoq_plugin_standard.mlpack
+++ b/src/smtcoq_plugin.mlpack
@@ -1,6 +1,4 @@
-Mutils_full
-Coq_micromega_full
-Structures
+CoqInterface
SmtMisc
CoqTerms
diff --git a/src/smtlib2/smtlib2_genConstr.ml b/src/smtlib2/smtlib2_genConstr.ml
index 1c590d7..0c6e2ac 100644
--- a/src/smtlib2/smtlib2_genConstr.ml
+++ b/src/smtlib2/smtlib2_genConstr.ml
@@ -97,10 +97,10 @@ let rec sort_of_sort = function
let declare_sort_from_name rt s =
- let cons_t = Structures.declare_new_type (Structures.mkId ("Smt_sort_"^s)) in
+ let cons_t = CoqInterface.declare_new_type (CoqInterface.mkId ("Smt_sort_"^s)) in
let compdec_type = mklApp cCompDec [| cons_t |] in
let compdec_var =
- Structures.declare_new_variable (Structures.mkId ("CompDec_"^s)) compdec_type in
+ CoqInterface.declare_new_variable (CoqInterface.mkId ("CompDec_"^s)) compdec_type in
let res = SmtBtype.of_coq_compdec rt cons_t compdec_var in
SmtMaps.add_btype s res;
res
@@ -110,9 +110,9 @@ let declare_sort rt sym = declare_sort_from_name rt (string_of_symbol sym)
let declare_fun_from_name rt ro s tyl ty =
let coqTy = List.fold_right (fun typ c ->
- Term.mkArrow (interp_to_coq rt typ) c)
+ CoqInterface.mkArrow (interp_to_coq rt typ) c)
tyl (interp_to_coq rt ty) in
- let cons_v = Structures.declare_new_variable (Structures.mkId ("Smt_var_"^s)) coqTy in
+ let cons_v = CoqInterface.declare_new_variable (CoqInterface.mkId ("Smt_var_"^s)) coqTy in
let op = Op.declare ro cons_v (Array.of_list tyl) ty None in
SmtMaps.add_fun s op;
op
diff --git a/src/smtlib2/smtlib2_solver.ml b/src/smtlib2/smtlib2_solver.ml
index 99538ce..efab1c1 100644
--- a/src/smtlib2/smtlib2_solver.ml
+++ b/src/smtlib2/smtlib2_solver.ml
@@ -73,7 +73,7 @@ let read_response { lexbuf } =
let error s sexp =
kill s;
- Structures.error (asprintf "Solver error: %a." SExpr.print sexp)
+ CoqInterface.error (asprintf "Solver error: %a." SExpr.print sexp)
let read_success s =
@@ -89,7 +89,7 @@ let read_check_result s =
match SExprParser.sexp SExprLexer.main s.lexbuf with
| SExpr.Atom "sat" -> Sat
| SExpr.Atom "unsat" -> Unsat
- | SExpr.Atom "unknown" -> Structures.error ("Solver returned uknown.")
+ | SExpr.Atom "unknown" -> CoqInterface.error ("Solver returned uknown.")
| r -> error s r
@@ -111,7 +111,7 @@ let send_command s cmd read =
* let buf = Bytes.create err_p2 in
* Unix.read s.stderr buf 0 err_p2 |> ignore;
* let err_msg = Bytes.sub_string buf err_p1 len in
- * Structures.error ("Solver error: "^err_msg);
+ * CoqInterface.error ("Solver error: "^err_msg);
* end
* else (kill s; raise e) *)
kill s; raise e
diff --git a/src/spl/Arithmetic.v b/src/spl/Arithmetic.v
index 8a12679..deb1420 100644
--- a/src/spl/Arithmetic.v
+++ b/src/spl/Arithmetic.v
@@ -63,8 +63,6 @@ Section Arith.
Let wf_rho : Valuation.wf rho.
Proof. destruct (Form.check_form_correct interp_form_hatom interp_form_hatom_bv _ ch_form); auto. Qed.
- Hint Immediate wf_rho.
-
Lemma valid_check_spl_arith :
forall orig, C.valid rho orig ->
@@ -76,7 +74,7 @@ Section Arith.
(* List with one element *)
intros H res l; case_eq (build_clause Lia.empty_vmap (Lit.neg li :: res :: nil)); [ |intros; apply C.interp_true; auto].
intros (vm1, bf) Heq; destruct (Lia.build_clause_correct _ _ _ t_func ch_atom ch_form wt_t_atom _ _ _ _ Heq) as [H1 H0].
- red; simpl; auto.
+ red; simpl; auto with smtcoq_core.
decompose [and] H0; case_eq (ZTautoChecker bf l); [intros Heq3|intros; apply C.interp_true; auto].
unfold C.valid; replace (C.interp rho (res :: nil)) with (C.interp rho (Lit.neg li :: res :: nil)).
rewrite H6; apply ZTautoChecker_sound with l;trivial.
diff --git a/src/spl/Operators.v b/src/spl/Operators.v
index 63a1f8b..966cbcb 100644
--- a/src/spl/Operators.v
+++ b/src/spl/Operators.v
@@ -279,28 +279,28 @@ intros. destruct H0; now contradict H0.
Lemma wf_t_form : wf t_form.
Proof. destruct (Form.check_form_correct interp_form_hatom interp_form_hatom_bv _ ch_form) as [[_ H] _]; auto. Qed.
- Local Hint Immediate wf_t_atom default_t_atom default_t_form wf_t_form.
+ Local Hint Immediate wf_t_atom default_t_atom default_t_form wf_t_form : smtcoq_spl_op.
Lemma interp_check_distinct : forall ha diseq,
check_distinct ha diseq = true ->
interp_form_hatom ha = afold_left bool int true andb (Lit.interp rho) diseq.
Proof.
- intros ha diseq; rewrite check_distinct_spec; intros [A [dist [H1 H2]]]; rewrite check_diseqs_spec in H2; destruct H2 as [H2 H3]; unfold Atom.interp_form_hatom, Atom.interp_bool, Atom.interp_hatom; rewrite Atom.t_interp_wf; auto; rewrite H1; simpl; generalize (Atom.compute_interp_spec_rev t_i (get (Atom.t_interp t_i t_func t_atom)) A dist); case (Atom.compute_interp t_i (get (Atom.t_interp t_i t_func t_atom)) A nil); simpl.
+ intros ha diseq; rewrite check_distinct_spec; intros [A [dist [H1 H2]]]; rewrite check_diseqs_spec in H2; destruct H2 as [H2 H3]; unfold Atom.interp_form_hatom, Atom.interp_bool, Atom.interp_hatom; rewrite Atom.t_interp_wf; auto with smtcoq_spl_op; rewrite H1; simpl; generalize (Atom.compute_interp_spec_rev t_i (get (Atom.t_interp t_i t_func t_atom)) A dist); case (Atom.compute_interp t_i (get (Atom.t_interp t_i t_func t_atom)) A nil); simpl.
intros l H4; case_eq (distinct (Typ.i_eqb t_i A) (rev l)).
- rewrite distinct_spec; intro H5; symmetry; apply afold_left_andb_true; intros i Hi; destruct (H2 _ Hi) as [H9 [a [H10 [h1 [h2 [H6 [H7 H8]]]]]]]; unfold Lit.interp; replace (Lit.is_pos (diseq .[ i])) with false by (case_eq (Lit.is_pos (diseq .[ i])); auto); unfold Var.interp; rewrite Form.wf_interp_form; auto; rewrite H10; simpl; rewrite Atom.t_interp_wf; auto; rewrite H6; simpl; unfold Atom.apply_binop; unfold Atom.wt in wt_t_atom; unfold is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; assert (H11: a < length t_atom).
- case_eq (a < length t_atom); auto; intro H11; rewrite (get_outofbound _ _ _ H11) in H6; rewrite default_t_atom in H6; inversion H6.
- generalize (wt_t_atom _ H11); rewrite H6; simpl; rewrite !andb_true_iff; change (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) h1) A = true) with (is_true (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) h1) A)); change (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) h2) A = true) with (is_true (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) h2) A)); rewrite !Typ.eqb_spec; intros [[_ H13] H12]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom h1); rewrite H13; intros [v1 HH1]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom h2); rewrite H12; intros [v2 HH2]; rewrite HH1, HH2; simpl; rewrite Typ.cast_refl; simpl; destruct H8 as [H8|H8]; [ |rewrite Typ.i_eqb_sym]; rewrite H5; auto; rewrite H4; [exists h2; exists h1|exists h1; exists h2]; auto.
- rewrite distinct_false_spec; intros [v2 [v1 [H5 H6]]]; rewrite H4 in H5; destruct H5 as [a [b [H5 [H7 H8]]]]; clear H4; change (Typ.i_eqb t_i A v2 v1 = true) with (is_true (Typ.i_eqb t_i A v2 v1)) in H6; rewrite Typ.i_eqb_spec in H6; subst v2; clear H2; destruct (H3 _ _ H5) as [i [H2 [H4 [hb [H6 [H9 H10]]]]]]; clear H3; symmetry; apply (afold_left_andb_false _ i); auto; unfold Lit.interp; replace (Lit.is_pos (diseq .[ i])) with false by (case_eq (Lit.is_pos (diseq .[ i])); auto); unfold Var.interp; rewrite Form.wf_interp_form; auto; rewrite H6; simpl; rewrite Atom.t_interp_wf; auto; destruct H10 as [H10|H10]; rewrite H10; simpl; rewrite H7, H8; simpl; rewrite Typ.cast_refl; simpl; replace (Typ.i_eqb t_i A v1 v1) with true; auto; symmetry; change (is_true (Typ.i_eqb t_i A v1 v1)); rewrite Typ.i_eqb_spec; auto.
+ rewrite distinct_spec; intro H5; symmetry; apply afold_left_andb_true; intros i Hi; destruct (H2 _ Hi) as [H9 [a [H10 [h1 [h2 [H6 [H7 H8]]]]]]]; unfold Lit.interp; replace (Lit.is_pos (diseq .[ i])) with false by (case_eq (Lit.is_pos (diseq .[ i])); auto with smtcoq_spl_op smtcoq_core); unfold Var.interp; rewrite Form.wf_interp_form; auto with smtcoq_spl_op smtcoq_core; rewrite H10; simpl; rewrite Atom.t_interp_wf; auto with smtcoq_spl_op smtcoq_core; rewrite H6; simpl; unfold Atom.apply_binop; unfold Atom.wt in wt_t_atom; unfold is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; assert (H11: a < length t_atom).
+ case_eq (a < length t_atom); auto with smtcoq_spl_op smtcoq_core; intro H11; rewrite (get_outofbound _ _ _ H11) in H6; rewrite default_t_atom in H6; inversion H6.
+ generalize (wt_t_atom _ H11); rewrite H6; simpl; rewrite !andb_true_iff; change (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) h1) A = true) with (is_true (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) h1) A)); change (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) h2) A = true) with (is_true (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) h2) A)); rewrite !Typ.eqb_spec; intros [[_ H13] H12]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom h1); rewrite H13; intros [v1 HH1]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom h2); rewrite H12; intros [v2 HH2]; rewrite HH1, HH2; simpl; rewrite Typ.cast_refl; simpl; destruct H8 as [H8|H8]; [ |rewrite Typ.i_eqb_sym]; rewrite H5; auto with smtcoq_spl_op smtcoq_core; rewrite H4; [exists h2; exists h1|exists h1; exists h2]; auto with smtcoq_spl_op smtcoq_core.
+ rewrite distinct_false_spec; intros [v2 [v1 [H5 H6]]]; rewrite H4 in H5; destruct H5 as [a [b [H5 [H7 H8]]]]; clear H4; change (Typ.i_eqb t_i A v2 v1 = true) with (is_true (Typ.i_eqb t_i A v2 v1)) in H6; rewrite Typ.i_eqb_spec in H6; subst v2; clear H2; destruct (H3 _ _ H5) as [i [H2 [H4 [hb [H6 [H9 H10]]]]]]; clear H3; symmetry; apply (afold_left_andb_false _ i); auto with smtcoq_spl_op smtcoq_core; unfold Lit.interp; replace (Lit.is_pos (diseq .[ i])) with false by (case_eq (Lit.is_pos (diseq .[ i])); auto with smtcoq_spl_op smtcoq_core); unfold Var.interp; rewrite Form.wf_interp_form; auto with smtcoq_spl_op smtcoq_core; rewrite H6; simpl; rewrite Atom.t_interp_wf; auto with smtcoq_spl_op smtcoq_core; destruct H10 as [H10|H10]; rewrite H10; simpl; rewrite H7, H8; simpl; rewrite Typ.cast_refl; simpl; replace (Typ.i_eqb t_i A v1 v1) with true; auto with smtcoq_spl_op smtcoq_core; symmetry; change (is_true (Typ.i_eqb t_i A v1 v1)); rewrite Typ.i_eqb_spec; auto with smtcoq_spl_op smtcoq_core.
intros [a [H20 H21]]; assert (H4: ha < length t_atom).
- case_eq (ha < length t_atom); auto; intro Heq; generalize H1; rewrite get_outofbound; auto; rewrite default_t_atom; discriminate.
- unfold Atom.wt in wt_t_atom; unfold is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; generalize (wt_t_atom _ H4); rewrite H1; simpl; rewrite andb_true_iff, forallb_forall; intros [_ H5]; assert (H6 := H5 _ H20); generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom a); intros [va Ha]; rewrite Ha in H21; simpl in H21; elim H21; apply Typ.eqb_spec; auto.
+ case_eq (ha < length t_atom); auto with smtcoq_spl_op smtcoq_core; intro Heq; generalize H1; rewrite get_outofbound; auto with smtcoq_spl_op smtcoq_core; rewrite default_t_atom; discriminate.
+ unfold Atom.wt in wt_t_atom; unfold is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; generalize (wt_t_atom _ H4); rewrite H1; simpl; rewrite andb_true_iff, forallb_forall; intros [_ H5]; assert (H6 := H5 _ H20); generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom a); intros [va Ha]; rewrite Ha in H21; simpl in H21; elim H21; apply Typ.eqb_spec; auto with smtcoq_spl_op smtcoq_core.
Qed.
Lemma interp_check_distinct_two_args : forall f1 f2,
check_distinct_two_args f1 f2 = true ->
rho f1 = negb (rho f2).
Proof.
- intros f1 f2; rewrite check_distinct_two_args_spec; intros [ha [hb [A [x [y [H1 [H2 [H3 [H4|H4]]]]]]]]]; unfold Form.interp_state_var; assert (H5: f1 < length t_form) by (case_eq (f1 < length t_form); auto; intro Heq; generalize H1; rewrite get_outofbound; auto; rewrite default_t_form; discriminate); assert (H6: f2 < length t_form) by (case_eq (f2 < length t_form); auto; intro Heq; generalize H2; rewrite get_outofbound; auto; rewrite default_t_form; discriminate); rewrite !Form.t_interp_wf; auto; rewrite H1, H2; simpl; unfold Atom.interp_form_hatom, Atom.interp_hatom; rewrite !Atom.t_interp_wf; auto; rewrite H3, H4; simpl; unfold Atom.wt,is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; assert (H7: hb < length t_atom) by (case_eq (hb < length t_atom); auto; intro Heq; generalize H4; rewrite get_outofbound; auto; rewrite default_t_atom; discriminate); generalize (wt_t_atom _ H7); rewrite H4; simpl; case (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) hb); try discriminate; simpl; rewrite andb_true_iff; change (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) x) A = true) with (is_true (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) x) A)); change (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) y) A = true) with (is_true (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) y) A)); rewrite !Typ.eqb_spec; intros [H8 H9]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom x), (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom y); rewrite H8, H9; intros [v1 HH1] [v2 HH2]; rewrite HH1, HH2; simpl; rewrite Typ.cast_refl; auto; rewrite Typ.i_eqb_sym; auto.
+ intros f1 f2; rewrite check_distinct_two_args_spec; intros [ha [hb [A [x [y [H1 [H2 [H3 [H4|H4]]]]]]]]]; unfold Form.interp_state_var; assert (H5: f1 < length t_form) by (case_eq (f1 < length t_form); auto with smtcoq_spl_op smtcoq_core; intro Heq; generalize H1; rewrite get_outofbound; auto with smtcoq_spl_op smtcoq_core; rewrite default_t_form; discriminate); assert (H6: f2 < length t_form) by (case_eq (f2 < length t_form); auto with smtcoq_spl_op smtcoq_core; intro Heq; generalize H2; rewrite get_outofbound; auto with smtcoq_spl_op smtcoq_core; rewrite default_t_form; discriminate); rewrite !Form.t_interp_wf; auto with smtcoq_spl_op smtcoq_core; rewrite H1, H2; simpl; unfold Atom.interp_form_hatom, Atom.interp_hatom; rewrite !Atom.t_interp_wf; auto with smtcoq_spl_op smtcoq_core; rewrite H3, H4; simpl; unfold Atom.wt,is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; assert (H7: hb < length t_atom) by (case_eq (hb < length t_atom); auto with smtcoq_spl_op smtcoq_core; intro Heq; generalize H4; rewrite get_outofbound; auto with smtcoq_spl_op smtcoq_core; rewrite default_t_atom; discriminate); generalize (wt_t_atom _ H7); rewrite H4; simpl; case (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) hb); try discriminate; simpl; rewrite andb_true_iff; change (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) x) A = true) with (is_true (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) x) A)); change (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) y) A = true) with (is_true (Typ.eqb (Atom.get_type' t_i (Atom.t_interp t_i t_func t_atom) y) A)); rewrite !Typ.eqb_spec; intros [H8 H9]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom x), (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom y); rewrite H8, H9; intros [v1 HH1] [v2 HH2]; rewrite HH1, HH2; simpl; rewrite Typ.cast_refl; auto with smtcoq_spl_op smtcoq_core; rewrite Typ.i_eqb_sym; auto with smtcoq_spl_op smtcoq_core.
Qed.
@@ -308,13 +308,13 @@ intros. destruct H0; now contradict H0.
(* check_distinct ha diseq -> *)
(* interp_form_hatom ha -> afold_left bool int true andb (Lit.interp rho) diseq. *)
(* Proof. *)
- (* intros ha diseq; rewrite check_distinct_spec; intros [A [dist [H1 H]]]; rewrite check_diseqs_spec in H; unfold Atom.interp_form_hatom, Atom.interp_bool, Atom.interp_hatom; rewrite Atom.t_interp_wf; auto; rewrite H1; simpl; generalize (Atom.compute_interp_spec_rev t_i (get (Atom.t_interp t_i t_func t_atom)) A dist); case (Atom.compute_interp t_i (get (Atom.t_interp t_i t_func t_atom)) A nil); simpl. *)
- (* intros l H2; unfold is_true; rewrite distinct_spec; intro H3; apply afold_left_andb_true; intros i Hi; destruct (H _ Hi) as [H4 [a [H5 [h1 [h2 [H6 [H7 H8]]]]]]]; unfold Lit.interp; replace (Lit.is_pos (diseq .[ i])) with false by (case_eq (Lit.is_pos (diseq .[ i])); auto); unfold Var.interp; rewrite Form.wf_interp_form; auto; rewrite H5; simpl; rewrite Atom.t_interp_wf; auto; rewrite H6; simpl; unfold Atom.apply_binop; unfold Atom.wt in wt_t_atom; unfold is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; assert (H10: a < length t_atom). *)
- (* case_eq (a < length t_atom); auto; intro H10; rewrite (get_outofbound _ _ _ H10) in H6; rewrite default_t_atom in H6; inversion H6. *)
- (* generalize (wt_t_atom _ H10); rewrite H6; simpl; rewrite !andb_true_iff. change (Typ.eqb (Atom.get_type t_i t_func t_atom h1) A = true) with (is_true (Typ.eqb (Atom.get_type t_i t_func t_atom h1) A)); change (Typ.eqb (Atom.get_type t_i t_func t_atom h2) A = true) with (is_true (Typ.eqb (Atom.get_type t_i t_func t_atom h2) A)); rewrite !Typ.eqb_spec; intros [[_ H11] H12]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom h1); rewrite H11; intros [v1 HH1]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom h2); rewrite H12; intros [v2 HH2]; rewrite HH1, HH2; simpl; rewrite Typ.cast_refl; simpl; destruct H8 as [H8|H8]; [ |rewrite Typ.i_eqb_sym]; rewrite H3; auto; rewrite H2; [exists h2; exists h1|exists h1; exists h2]; auto. *)
+ (* intros ha diseq; rewrite check_distinct_spec; intros [A [dist [H1 H]]]; rewrite check_diseqs_spec in H; unfold Atom.interp_form_hatom, Atom.interp_bool, Atom.interp_hatom; rewrite Atom.t_interp_wf; auto with smtcoq_spl_op smtcoq_core; rewrite H1; simpl; generalize (Atom.compute_interp_spec_rev t_i (get (Atom.t_interp t_i t_func t_atom)) A dist); case (Atom.compute_interp t_i (get (Atom.t_interp t_i t_func t_atom)) A nil); simpl. *)
+ (* intros l H2; unfold is_true; rewrite distinct_spec; intro H3; apply afold_left_andb_true; intros i Hi; destruct (H _ Hi) as [H4 [a [H5 [h1 [h2 [H6 [H7 H8]]]]]]]; unfold Lit.interp; replace (Lit.is_pos (diseq .[ i])) with false by (case_eq (Lit.is_pos (diseq .[ i])); auto with smtcoq_spl_op smtcoq_core); unfold Var.interp; rewrite Form.wf_interp_form; auto with smtcoq_spl_op smtcoq_core; rewrite H5; simpl; rewrite Atom.t_interp_wf; auto with smtcoq_spl_op smtcoq_core; rewrite H6; simpl; unfold Atom.apply_binop; unfold Atom.wt in wt_t_atom; unfold is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; assert (H10: a < length t_atom). *)
+ (* case_eq (a < length t_atom); auto with smtcoq_spl_op smtcoq_core; intro H10; rewrite (get_outofbound _ _ _ H10) in H6; rewrite default_t_atom in H6; inversion H6. *)
+ (* generalize (wt_t_atom _ H10); rewrite H6; simpl; rewrite !andb_true_iff. change (Typ.eqb (Atom.get_type t_i t_func t_atom h1) A = true) with (is_true (Typ.eqb (Atom.get_type t_i t_func t_atom h1) A)); change (Typ.eqb (Atom.get_type t_i t_func t_atom h2) A = true) with (is_true (Typ.eqb (Atom.get_type t_i t_func t_atom h2) A)); rewrite !Typ.eqb_spec; intros [[_ H11] H12]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom h1); rewrite H11; intros [v1 HH1]; generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom h2); rewrite H12; intros [v2 HH2]; rewrite HH1, HH2; simpl; rewrite Typ.cast_refl; simpl; destruct H8 as [H8|H8]; [ |rewrite Typ.i_eqb_sym]; rewrite H3; auto with smtcoq_spl_op smtcoq_core; rewrite H2; [exists h2; exists h1|exists h1; exists h2]; auto with smtcoq_spl_op smtcoq_core. *)
(* intros [a [H2 H3]] _; assert (H4: ha < length t_atom). *)
- (* case_eq (ha < length t_atom); auto; intro Heq; generalize H1; rewrite get_outofbound; auto; rewrite default_t_atom; discriminate. *)
- (* unfold Atom.wt in wt_t_atom; unfold is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; generalize (wt_t_atom _ H4); rewrite H1; simpl; rewrite andb_true_iff, forallb_forall; intros [_ H5]; assert (H6 := H5 _ H2); generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom a); intros [va Ha]; rewrite Ha in H3; simpl in H3; elim H3; apply Typ.eqb_spec; auto. *)
+ (* case_eq (ha < length t_atom); auto with smtcoq_spl_op smtcoq_core; intro Heq; generalize H1; rewrite get_outofbound; auto with smtcoq_spl_op smtcoq_core; rewrite default_t_atom; discriminate. *)
+ (* unfold Atom.wt in wt_t_atom; unfold is_true in wt_t_atom; rewrite forallbi_spec in wt_t_atom; generalize (wt_t_atom _ H4); rewrite H1; simpl; rewrite andb_true_iff, forallb_forall; intros [_ H5]; assert (H6 := H5 _ H2); generalize (Atom.check_aux_interp_hatom _ t_func _ wf_t_atom a); intros [va Ha]; rewrite Ha in H3; simpl in H3; elim H3; apply Typ.eqb_spec; auto with smtcoq_spl_op smtcoq_core. *)
(* Qed. *)
End Valid1.
@@ -382,18 +382,18 @@ intros. destruct H0; now contradict H0.
check_lit l1 l2 -> Lit.interp rho l1 = Lit.interp rho l2.
Proof.
unfold check_lit; intros l1 l2; unfold is_true; rewrite !orb_true_iff, !andb_true_iff; intros [[H1|[H1 H2]]|[H1 H2]].
- rewrite eqb_spec in H1; rewrite H1; auto.
- rewrite Bool.eqb_true_iff in H1; unfold Lit.interp; rewrite H1, (interp_check_var _ _ H2); auto.
- generalize H1; unfold Lit.interp; case (Lit.is_pos l1); case (Lit.is_pos l2); try discriminate; intros _; unfold Var.interp; rewrite (interp_check_distinct_two_args _ t_func ch_atom ch_form wt_t_atom _ _ H2); auto; case (rho (Lit.blit l2)); auto.
+ rewrite eqb_spec in H1; rewrite H1; auto with smtcoq_core.
+ rewrite Bool.eqb_true_iff in H1; unfold Lit.interp; rewrite H1, (interp_check_var _ _ H2); auto with smtcoq_core.
+ generalize H1; unfold Lit.interp; case (Lit.is_pos l1); case (Lit.is_pos l2); try discriminate; intros _; unfold Var.interp; rewrite (interp_check_distinct_two_args _ t_func ch_atom ch_form wt_t_atom _ _ H2); auto with smtcoq_core; case (rho (Lit.blit l2)); auto with smtcoq_core.
Qed.
(* Lemma interp_check_lit : forall l1 l2, *)
(* check_lit l1 l2 -> Lit.interp rho l1 -> Lit.interp rho l2 = true. *)
(* Proof. *)
(* unfold check_lit; intros l1 l2; unfold is_true; rewrite !orb_true_iff, !andb_true_iff; intros [[H1|[[H1 H2] H3]]|[[H1 H2] H3]]. *)
- (* rewrite Int63Properties.eqb_spec in H1; subst l1; auto. *)
- (* unfold Lit.interp; rewrite H1, H2; apply interp_check_var; auto. *)
- (* unfold Lit.interp; case_eq (Lit.is_pos l1); intro Heq; rewrite Heq in H1; try discriminate; clear Heq H1; case_eq (Lit.is_pos l2); intro Heq; rewrite Heq in H2; try discriminate; clear Heq H2; case_eq (Var.interp rho (Lit.blit l1)); try discriminate; intros H4 _; case_eq (Var.interp rho (Lit.blit l2)); auto; intro H5; rewrite (interp_check_var _ _ H3 H5) in H4; discriminate. *)
+ (* rewrite Int63Properties.eqb_spec in H1; subst l1; auto with smtcoq_core. *)
+ (* unfold Lit.interp; rewrite H1, H2; apply interp_check_var; auto with smtcoq_core. *)
+ (* unfold Lit.interp; case_eq (Lit.is_pos l1); intro Heq; rewrite Heq in H1; try discriminate; clear Heq H1; case_eq (Lit.is_pos l2); intro Heq; rewrite Heq in H2; try discriminate; clear Heq H2; case_eq (Var.interp rho (Lit.blit l1)); try discriminate; intros H4 _; case_eq (Var.interp rho (Lit.blit l2)); auto with smtcoq_core; intro H5; rewrite (interp_check_var _ _ H3 H5) in H4; discriminate. *)
(* Qed. *)
(* Local Hint Resolve interp_check_lit. *)
@@ -402,72 +402,72 @@ intros. destruct H0; now contradict H0.
check_form_aux a b ->
Form.interp interp_form_hatom interp_form_hatom_bv t_form a = Form.interp interp_form_hatom interp_form_hatom_bv t_form b.
Proof.
- intros [a| | |i1 l1|a1|a1|a1|l1 l2|l1 l2|l1 l2 l3|a l1] [b| | |j1 m1|a2|a2|a2|j1 j2|j1 j2|j1 j2 j3|b m1]; simpl; try discriminate;auto.
+ intros [a| | |i1 l1|a1|a1|a1|l1 l2|l1 l2|l1 l2 l3|a l1] [b| | |j1 m1|a2|a2|a2|j1 j2|j1 j2|j1 j2 j3|b m1]; simpl; try discriminate;auto with smtcoq_core.
(* Atom *)
- unfold is_true; rewrite Int63Properties.eqb_spec; intro; subst a; auto.
+ unfold is_true; rewrite Int63Properties.eqb_spec; intro; subst a; auto with smtcoq_core.
(* Interesting case *)
- apply interp_check_distinct; auto.
+ apply interp_check_distinct; auto with smtcoq_core.
(* Double negation *)
- unfold is_true; rewrite andb_true_iff, Int63Properties.eqb_spec; intros [H1 H2]; subst j1. rewrite (interp_check_lit _ _ H2). auto.
+ unfold is_true; rewrite andb_true_iff, Int63Properties.eqb_spec; intros [H1 H2]; subst j1. rewrite (interp_check_lit _ _ H2). auto with smtcoq_core.
(* Conjunction *)
- unfold is_true; rewrite andb_true_iff, eqb_spec, forallbi_spec; intros [H1 H2]; apply afold_left_eq; auto; intros i Hi; apply interp_check_lit; auto.
+ unfold is_true; rewrite andb_true_iff, eqb_spec, forallbi_spec; intros [H1 H2]; apply afold_left_eq; auto with smtcoq_core; intros i Hi; apply interp_check_lit; auto with smtcoq_core.
(* Disjunction *)
- unfold is_true; rewrite andb_true_iff, eqb_spec, forallbi_spec; intros [H1 H2]; apply afold_left_eq; auto; intros i Hi; apply interp_check_lit; auto.
+ unfold is_true; rewrite andb_true_iff, eqb_spec, forallbi_spec; intros [H1 H2]; apply afold_left_eq; auto with smtcoq_core; intros i Hi; apply interp_check_lit; auto with smtcoq_core.
(* Implication *)
- unfold is_true; rewrite andb_true_iff, eqb_spec, forallbi_spec; intros [H1 H2]; apply afold_right_eq; auto; intros i Hi; apply interp_check_lit; auto.
+ unfold is_true; rewrite andb_true_iff, eqb_spec, forallbi_spec; intros [H1 H2]; apply afold_right_eq; auto with smtcoq_core; intros i Hi; apply interp_check_lit; auto with smtcoq_core.
(* Xor *)
- unfold is_true; rewrite andb_true_iff; intros [H1 H2]; rewrite (interp_check_lit _ _ H1), (interp_check_lit _ _ H2); auto.
+ unfold is_true; rewrite andb_true_iff; intros [H1 H2]; rewrite (interp_check_lit _ _ H1), (interp_check_lit _ _ H2); auto with smtcoq_core.
(* Iff *)
- unfold is_true; rewrite andb_true_iff; intros [H1 H2]; rewrite (interp_check_lit _ _ H1), (interp_check_lit _ _ H2); auto.
+ unfold is_true; rewrite andb_true_iff; intros [H1 H2]; rewrite (interp_check_lit _ _ H1), (interp_check_lit _ _ H2); auto with smtcoq_core.
(* Ite *)
- unfold is_true; rewrite !andb_true_iff; intros [[H1 H2] H3]; rewrite (interp_check_lit _ _ H1), (interp_check_lit _ _ H2), (interp_check_lit _ _ H3); auto.
+ unfold is_true; rewrite !andb_true_iff; intros [[H1 H2] H3]; rewrite (interp_check_lit _ _ H1), (interp_check_lit _ _ H2), (interp_check_lit _ _ H3); auto with smtcoq_core.
Qed.
(* Lemma interp_check_lit_equiv : forall l1 l2, *)
(* check_lit l1 l2 -> check_lit l2 l1 -> *)
(* Lit.interp rho l1 = Lit.interp rho l2. *)
(* Proof. *)
- (* intros l1 l2 H1 H2; generalize (interp_check_lit _ _ H1) (interp_check_lit _ _ H2); case (Lit.interp rho l1); case (Lit.interp rho l2); auto; symmetry; auto. *)
+ (* intros l1 l2 H1 H2; generalize (interp_check_lit _ _ H1) (interp_check_lit _ _ H2); case (Lit.interp rho l1); case (Lit.interp rho l2); auto with smtcoq_core; symmetry; auto with smtcoq_core. *)
(* Qed. *)
(* Lemma interp_check_form_aux : forall a b, *)
(* check_form_aux a b -> *)
(* Form.interp interp_form_hatom t_form a -> Form.interp interp_form_hatom t_form b. *)
(* Proof. *)
- (* intros [a| | |i1 l1|a1|a1|a1|l1 l2|l1 l2|l1 l2 l3] [b| | |j1 m1|a2|a2|a2|j1 j2|j1 j2|j1 j2 j3]; simpl; try discriminate;auto. *)
+ (* intros [a| | |i1 l1|a1|a1|a1|l1 l2|l1 l2|l1 l2 l3] [b| | |j1 m1|a2|a2|a2|j1 j2|j1 j2|j1 j2 j3]; simpl; try discriminate;auto with smtcoq_core. *)
(* (* Atom *) *)
- (* unfold is_true; rewrite Int63Properties.eqb_spec; intro; subst a; auto. *)
+ (* unfold is_true; rewrite Int63Properties.eqb_spec; intro; subst a; auto with smtcoq_core. *)
(* (* Interesting case *) *)
- (* apply interp_check_distinct; auto. *)
+ (* apply interp_check_distinct; auto with smtcoq_core. *)
(* (* Double negation *) *)
(* unfold is_true; rewrite andb_true_iff, Int63Properties.eqb_spec; intros [H1 H2]; subst j1; apply (fold_ind2 _ _ (fun x y => x = true -> y = true)). *)
- (* apply interp_check_lit; auto. *)
- (* intros a b; case a; try discriminate; intros H _; rewrite H; auto. *)
+ (* apply interp_check_lit; auto with smtcoq_core. *)
+ (* intros a b; case a; try discriminate; intros H _; rewrite H; auto with smtcoq_core. *)
(* (* Conjunction *) *)
- (* unfold is_true; rewrite andb_true_iff, Int63Properties.eqb_spec; intros [H1 H2]; rewrite forallbi_spec in H2; intro H3; assert (H4 := afold_left_andb_true_inv _ _ _ H3); clear H3; apply afold_left_andb_true; rewrite <- H1; intros i Hi; eapply interp_check_lit; eauto. *)
+ (* unfold is_true; rewrite andb_true_iff, Int63Properties.eqb_spec; intros [H1 H2]; rewrite forallbi_spec in H2; intro H3; assert (H4 := afold_left_andb_true_inv _ _ _ H3); clear H3; apply afold_left_andb_true; rewrite <- H1; intros i Hi; eapply interp_check_lit; eauto with smtcoq_core. *)
(* (* Disjunction *) *)
(* unfold is_true; rewrite andb_true_iff, Int63Properties.eqb_spec; intros [H1 H2]; rewrite forallbi_spec in H2; intro H3; assert (H4 := afold_left_orb_true_inv _ _ _ H3); clear H3; destruct H4 as [i [H3 H4]]; eapply afold_left_orb_true. *)
- (* rewrite <- H1; eauto. *)
- (* eapply interp_check_lit; eauto. *)
+ (* rewrite <- H1; eauto with smtcoq_core. *)
+ (* eapply interp_check_lit; eauto with smtcoq_core. *)
(* (* Implication *) *)
(* unfold is_true; rewrite andb_true_iff, Int63Properties.eqb_spec; intros [H1 H2]; rewrite forallbi_spec in H2; intro H3; apply afold_right_implb_true; case_eq (length a1 == 0); intro Heq. *)
- (* left; rewrite eqb_spec in Heq; rewrite <- H1; auto. *)
+ (* left; rewrite eqb_spec in Heq; rewrite <- H1; auto with smtcoq_core. *)
(* destruct (afold_right_implb_true_inv _ _ _ H3) as [H4|[[i [H4 H5]]|H4]]. *)
(* rewrite H4 in Heq; discriminate. *)
- (* right; left; exists i; rewrite <- H1; split; auto; case_eq (Lit.interp rho (a2 .[ i])); auto; intro H6; assert (H7: i < length a1 = true). *)
- (* rewrite ltb_spec in *; rewrite eqb_false_spec in Heq; rewrite to_Z_sub_1_diff in H4; auto; omega. *)
- (* generalize (H2 _ H7); rewrite H4; intro H8; rewrite (interp_check_lit _ _ H8 H6) in H5; auto. *)
+ (* right; left; exists i; rewrite <- H1; split; auto with smtcoq_core; case_eq (Lit.interp rho (a2 .[ i])); auto with smtcoq_core; intro H6; assert (H7: i < length a1 = true). *)
+ (* rewrite ltb_spec in *; rewrite eqb_false_spec in Heq; rewrite to_Z_sub_1_diff in H4; auto with smtcoq_core; omega. *)
+ (* generalize (H2 _ H7); rewrite H4; intro H8; rewrite (interp_check_lit _ _ H8 H6) in H5; auto with smtcoq_core. *)
(* right; case_eq (existsbi (fun i l => (i < length a2 - 1) && (negb (Lit.interp rho l))) a2). *)
- (* rewrite existsbi_spec; intros [i [_ H5]]; rewrite andb_true_iff in H5; destruct H5 as [H5 H6]; left; exists i; split; auto; generalize H6; case (Lit.interp rho (a2 .[ i])); auto; discriminate. *)
+ (* rewrite existsbi_spec; intros [i [_ H5]]; rewrite andb_true_iff in H5; destruct H5 as [H5 H6]; left; exists i; split; auto with smtcoq_core; generalize H6; case (Lit.interp rho (a2 .[ i])); auto with smtcoq_core; discriminate. *)
(* rewrite existsbi_false_spec; intro H; right; intros i Hi; assert (Hi' := Hi); rewrite <- H1 in Hi'; generalize (H2 _ Hi') (H _ Hi); rewrite <- H1; case (i < length a1 - 1); simpl. *)
- (* intros _; case (Lit.interp rho (a2 .[ i])); auto; discriminate. *)
- (* intros H5 _; apply (interp_check_lit _ _ H5); apply H4; auto. *)
+ (* intros _; case (Lit.interp rho (a2 .[ i])); auto with smtcoq_core; discriminate. *)
+ (* intros H5 _; apply (interp_check_lit _ _ H5); apply H4; auto with smtcoq_core. *)
(* (* Xor *) *)
- (* unfold is_true; rewrite !andb_true_iff; intros [[[H1 H2] H3] H4]; rewrite (interp_check_lit_equiv _ _ H1 H2), (interp_check_lit_equiv _ _ H3 H4); auto. *)
+ (* unfold is_true; rewrite !andb_true_iff; intros [[[H1 H2] H3] H4]; rewrite (interp_check_lit_equiv _ _ H1 H2), (interp_check_lit_equiv _ _ H3 H4); auto with smtcoq_core. *)
(* (* Iff *) *)
- (* unfold is_true; rewrite !andb_true_iff; intros [[[H1 H2] H3] H4]; rewrite (interp_check_lit_equiv _ _ H1 H2), (interp_check_lit_equiv _ _ H3 H4); auto. *)
+ (* unfold is_true; rewrite !andb_true_iff; intros [[[H1 H2] H3] H4]; rewrite (interp_check_lit_equiv _ _ H1 H2), (interp_check_lit_equiv _ _ H3 H4); auto with smtcoq_core. *)
(* (* Ite *) *)
- (* unfold is_true; rewrite !andb_true_iff; intros [[[H1 H2] H3] H4]; rewrite (interp_check_lit_equiv _ _ H1 H2); case (Lit.interp rho j1); apply interp_check_lit; auto. *)
+ (* unfold is_true; rewrite !andb_true_iff; intros [[[H1 H2] H3] H4]; rewrite (interp_check_lit_equiv _ _ H1 H2); case (Lit.interp rho j1); apply interp_check_lit; auto with smtcoq_core. *)
(* Qed. *)
End AUX.
@@ -505,50 +505,46 @@ intros. destruct H0; now contradict H0.
Let wf_rho : Valuation.wf rho.
- Proof. destruct (Form.check_form_correct interp_form_hatom interp_form_hatom_bv _ ch_form); auto. Qed.
+ Proof. destruct (Form.check_form_correct interp_form_hatom interp_form_hatom_bv _ ch_form); auto with smtcoq_core. Qed.
Let default_t_form : default t_form = Ftrue.
- Proof. destruct (Form.check_form_correct interp_form_hatom interp_form_hatom_bv _ ch_form) as [[H _] _]; auto. Qed.
+ Proof. destruct (Form.check_form_correct interp_form_hatom interp_form_hatom_bv _ ch_form) as [[H _] _]; auto with smtcoq_core. Qed.
Let wf_t_form : wf t_form.
- Proof. destruct (Form.check_form_correct interp_form_hatom interp_form_hatom_bv _ ch_form) as [[_ H] _]; auto. Qed.
-
- Local Hint Immediate wf_rho default_t_form wf_t_form.
+ Proof. destruct (Form.check_form_correct interp_form_hatom interp_form_hatom_bv _ ch_form) as [[_ H] _]; auto with smtcoq_core. Qed.
Lemma interp_check_hform : forall h1 h2,
check_hform h1 h2 -> Var.interp rho h1 = Var.interp rho h2.
Proof.
unfold check_hform; apply foldi_down_cont_ind; try discriminate. intros i cont _ _ Hrec h1 h2. unfold is_true; rewrite orb_true_iff; intros [H|H].
- rewrite Int63Properties.eqb_spec in H; rewrite H; auto.
- unfold Var.interp; rewrite !wf_interp_form; auto; eapply interp_check_form_aux; eauto.
+ rewrite Int63Properties.eqb_spec in H; rewrite H; auto with smtcoq_core.
+ unfold Var.interp; rewrite !wf_interp_form; auto with smtcoq_core; eapply interp_check_form_aux; eauto with smtcoq_core.
Qed.
- Local Hint Resolve interp_check_hform.
-
Lemma interp_check_form : forall a b,
check_form a b ->
Form.interp interp_form_hatom interp_form_hatom_bv t_form a = Form.interp interp_form_hatom interp_form_hatom_bv t_form b.
- Proof. apply interp_check_form_aux, interp_check_hform; auto. Qed.
+ Proof. apply interp_check_form_aux, interp_check_hform; auto with smtcoq_core. Qed.
Lemma interp_check_lit' : forall l res,
check_lit' l res -> Lit.interp rho l = Lit.interp rho res.
- Proof. apply interp_check_lit, interp_check_hform; auto. Qed.
+ Proof. apply interp_check_lit, interp_check_hform; auto with smtcoq_core. Qed.
Lemma valid_check_distinct_elim :
forall input, C.valid rho input ->
forall res, C.valid rho (check_distinct_elim input res).
Proof.
- induction input as [ |l c IHc]; auto; simpl; unfold C.valid; simpl; rewrite orb_true_iff; intros [H|H] res.
+ induction input as [ |l c IHc]; auto with smtcoq_core; simpl; unfold C.valid; simpl; rewrite orb_true_iff; intros [H|H] res.
case_eq (check_lit' l res); intro Heq; simpl.
- rewrite <- (interp_check_lit' _ _ Heq), H; auto.
- rewrite H; auto.
+ rewrite <- (interp_check_lit' _ _ Heq), H; auto with smtcoq_core.
+ rewrite H; auto with smtcoq_core.
case (check_lit' l res).
- simpl; rewrite H, orb_true_r; auto.
- simpl; rewrite (IHc H), orb_true_r; auto.
+ simpl; rewrite H, orb_true_r; auto with smtcoq_core.
+ simpl; rewrite (IHc H), orb_true_r; auto with smtcoq_core.
Qed.
End Valid.
diff --git a/src/versions/standard/structures.ml b/src/trace/coqInterface.ml
index b64cb89..36f4337 100644
--- a/src/versions/standard/structures.ml
+++ b/src/trace/coqInterface.ml
@@ -41,9 +41,10 @@ let destRel = Constr.destRel
let lift = Vars.lift
let mkApp = Constr.mkApp
let decompose_app = Constr.decompose_app
-let mkLambda = Constr.mkLambda
-let mkProd = Constr.mkProd
-let mkLetIn = Constr.mkLetIn
+let mkLambda (n, t, c) = Constr.mkLambda (Context.make_annot n Sorts.Relevant, t, c)
+let mkProd (n, t, c) = Constr.mkProd (Context.make_annot n Sorts.Relevant, t, c)
+let mkLetIn (n, c1, t, c2) = Constr.mkLetIn (Context.make_annot n Sorts.Relevant, c1, t, c2)
+let mkArrow a b = Term.mkArrow a Sorts.Relevant b
let pr_constr_env env = Printer.pr_constr_env env Evd.empty
let pr_constr = pr_constr_env Environ.empty_env
@@ -58,7 +59,7 @@ let mkUConst : Constr.t -> Safe_typing.private_constants Entries.definition_entr
const_entry_secctx = None;
const_entry_feedback = None;
const_entry_type = Some (EConstr.Unsafe.to_constr ty); (* Cannot contain evars since it comes from a Constr.t *)
- const_entry_universes = Evd.const_univ_entry ~poly:false evd;
+ const_entry_universes = Evd.univ_entry ~poly:false evd;
const_entry_opaque = false;
const_entry_inline_code = false }
@@ -71,20 +72,20 @@ let mkTConst c noc ty =
const_entry_secctx = None;
const_entry_feedback = None;
const_entry_type = Some ty;
- const_entry_universes = Evd.const_univ_entry ~poly:false evd;
+ const_entry_universes = Evd.univ_entry ~poly:false evd;
const_entry_opaque = false;
const_entry_inline_code = false }
(* TODO : Set -> Type *)
let declare_new_type t =
- let _ = ComAssumption.declare_assumption false (Decl_kinds.Discharge, false, Decl_kinds.Definitional) (Constr.mkSet, Entries.Monomorphic_const_entry Univ.ContextSet.empty) UnivNames.empty_binders [] false Declaremods.NoInline (CAst.make t) in
+ let _ = ComAssumption.declare_assumption ~pstate:None false (Decl_kinds.Discharge, false, Decl_kinds.Definitional) (Constr.mkSet, Entries.Monomorphic_entry Univ.ContextSet.empty) UnivNames.empty_binders [] false Declaremods.NoInline (CAst.make t) in
Constr.mkVar t
let declare_new_variable v constr_t =
let env = Global.env () in
let evd = Evd.from_env env in
let evd, _ = Typing.type_of env evd (EConstr.of_constr constr_t) in
- let _ = ComAssumption.declare_assumption false (Decl_kinds.Discharge, false, Decl_kinds.Definitional) (constr_t, Evd.const_univ_entry ~poly:false evd) UnivNames.empty_binders [] false Declaremods.NoInline (CAst.make v) in
+ let _ = ComAssumption.declare_assumption ~pstate:None false (Decl_kinds.Discharge, false, Decl_kinds.Definitional) (constr_t, Evd.univ_entry ~poly:false evd) UnivNames.empty_binders [] false Declaremods.NoInline (CAst.make v) in
Constr.mkVar v
let declare_constant n c =
@@ -103,12 +104,15 @@ let econstr_of_constr = EConstr.of_constr
(* Modules *)
-let gen_constant_in_modules s m n = UnivGen.constr_of_global @@ Coqlib.gen_reference_in_modules s m n
+let gen_constant_in_modules s m n =
+ (* UnivGen.constr_of_monomorphic_global will crash on universe polymorphic constants *)
+ UnivGen.constr_of_monomorphic_global @@ Coqlib.gen_reference_in_modules s m n
let gen_constant modules constant = lazy (gen_constant_in_modules "SMT" modules constant)
+let init_modules = Coqlib.init_modules
(* Int63 *)
-let int63_modules = [["SMTCoq";"versions";"standard";"Int63";"Int63Native"]]
+let int63_modules = [["SMTCoq";"Int63";"Int63Native"]]
(* 31-bits integers are "called" 63 bits (this is sound) *)
let int31_module = [["Coq";"Numbers";"Cyclic";"Int31";"Int31"]]
@@ -131,7 +135,7 @@ let cint = gen_constant int31_module "int31"
(* PArray *)
-let parray_modules = [["SMTCoq";"versions";"standard";"Array";"PArray"]]
+let parray_modules = [["SMTCoq";"Array";"PArray"]]
let cmake = gen_constant parray_modules "make"
let cset = gen_constant parray_modules "set"
@@ -166,17 +170,15 @@ let mkTrace step_to_coq next _ clist cnil ccons cpair size step def_step r =
(* Micromega *)
module Micromega_plugin_Micromega = Micromega_plugin.Micromega
-module Micromega_plugin_Mutils = Mutils_full
module Micromega_plugin_Certificate = Micromega_plugin.Certificate
-module Micromega_plugin_Coq_micromega = Coq_micromega_full
let micromega_coq_proofTerm =
(* Cannot contain evars *)
- lazy (EConstr.Unsafe.to_constr (Lazy.force (Micromega_plugin_Coq_micromega.M.coq_proofTerm)))
+ lazy (gen_constant_in_modules "ZMicromega" [["Coq"; "micromega";"ZMicromega"]] "ZArithProof")
let micromega_dump_proof_term p =
(* Cannot contain evars *)
- EConstr.Unsafe.to_constr (Micromega_plugin_Coq_micromega.dump_proof_term p)
+ EConstr.Unsafe.to_constr (Micromega_plugin.Coq_micromega.dump_proof_term p)
(* Tactics *)
@@ -188,7 +190,7 @@ let assert_before n c = Tactics.assert_before n (EConstr.of_constr c)
let vm_cast_no_check c = Tactics.vm_cast_no_check (EConstr.of_constr c)
let mk_tactic tac =
- Proofview.Goal.nf_enter (fun gl ->
+ Proofview.Goal.enter (fun gl ->
let env = Proofview.Goal.env gl in
let sigma = Tacmach.New.project gl in
let t = Proofview.Goal.concl gl in
@@ -222,7 +224,8 @@ let constrextern_extern_constr c =
Constrextern.extern_constr false env (Evd.from_env env) (EConstr.of_constr c)
let get_rel_dec_name = function
- | Context.Rel.Declaration.LocalAssum (n, _) | Context.Rel.Declaration.LocalDef (n, _, _) -> n
+ | Context.Rel.Declaration.LocalAssum (n, _) | Context.Rel.Declaration.LocalDef (n, _, _) ->
+ Context.binder_name n
let retyping_get_type_of env sigma c =
(* Cannot contain evars since it comes from a Constr.t *)
diff --git a/src/versions/standard/structures.mli b/src/trace/coqInterface.mli
index 8989c9c..104f3f9 100644
--- a/src/versions/standard/structures.mli
+++ b/src/trace/coqInterface.mli
@@ -38,6 +38,7 @@ val decompose_app : constr -> constr * constr list
val mkLambda : name * types * constr -> constr
val mkProd : name * types * types -> types
val mkLetIn : name * constr * types * constr -> constr
+val mkArrow : types -> types -> constr
val pr_constr_env : Environ.env -> constr -> Pp.t
val pr_constr : constr -> Pp.t
@@ -60,6 +61,7 @@ val econstr_of_constr : constr -> econstr
(* Modules *)
val gen_constant : string list list -> string -> constr lazy_t
+val init_modules : string list list
(* Int63 *)
@@ -88,9 +90,7 @@ val mkTrace :
(* Micromega *)
module Micromega_plugin_Micromega = Micromega_plugin.Micromega
-module Micromega_plugin_Mutils = Mutils_full
module Micromega_plugin_Certificate = Micromega_plugin.Certificate
-module Micromega_plugin_Coq_micromega = Coq_micromega_full
val micromega_coq_proofTerm : constr lazy_t
val micromega_dump_proof_term : Micromega_plugin_Micromega.zArithProof -> constr
diff --git a/src/trace/coqTerms.ml b/src/trace/coqTerms.ml
index 65995b5..1c4ee81 100644
--- a/src/trace/coqTerms.ml
+++ b/src/trace/coqTerms.ml
@@ -10,27 +10,26 @@
(**************************************************************************)
-open Coqlib
open SmtMisc
-let gen_constant = Structures.gen_constant
+let gen_constant = CoqInterface.gen_constant
(* Int63 *)
-let cint = Structures.cint
-let ceq63 = gen_constant Structures.int63_modules "eqb"
+let cint = CoqInterface.cint
+let ceq63 = gen_constant CoqInterface.int63_modules "eqb"
(* PArray *)
-let carray = gen_constant Structures.parray_modules "array"
+let carray = gen_constant CoqInterface.parray_modules "array"
(* is_true *)
-let cis_true = gen_constant init_modules "is_true"
+let cis_true = gen_constant CoqInterface.init_modules "is_true"
(* nat *)
-let cnat = gen_constant init_modules "nat"
-let cO = gen_constant init_modules "O"
-let cS = gen_constant init_modules "S"
+let cnat = gen_constant CoqInterface.init_modules "nat"
+let cO = gen_constant CoqInterface.init_modules "O"
+let cS = gen_constant CoqInterface.init_modules "S"
(* Positive *)
let positive_modules = [["Coq";"Numbers";"BinNums"];
@@ -75,49 +74,49 @@ let ceqbZ = gen_constant z_modules "eqb"
(* Booleans *)
let bool_modules = [["Coq";"Bool";"Bool"]]
-let cbool = gen_constant init_modules "bool"
-let ctrue = gen_constant init_modules "true"
-let cfalse = gen_constant init_modules "false"
-let candb = gen_constant init_modules "andb"
-let corb = gen_constant init_modules "orb"
-let cxorb = gen_constant init_modules "xorb"
-let cnegb = gen_constant init_modules "negb"
-let cimplb = gen_constant init_modules "implb"
+let cbool = gen_constant CoqInterface.init_modules "bool"
+let ctrue = gen_constant CoqInterface.init_modules "true"
+let cfalse = gen_constant CoqInterface.init_modules "false"
+let candb = gen_constant CoqInterface.init_modules "andb"
+let corb = gen_constant CoqInterface.init_modules "orb"
+let cxorb = gen_constant CoqInterface.init_modules "xorb"
+let cnegb = gen_constant CoqInterface.init_modules "negb"
+let cimplb = gen_constant CoqInterface.init_modules "implb"
let ceqb = gen_constant bool_modules "eqb"
let cifb = gen_constant bool_modules "ifb"
-let ciff = gen_constant init_modules "iff"
+let ciff = gen_constant CoqInterface.init_modules "iff"
let creflect = gen_constant bool_modules "reflect"
(* Lists *)
-let clist = gen_constant init_modules "list"
-let cnil = gen_constant init_modules "nil"
-let ccons = gen_constant init_modules "cons"
-let clength = gen_constant init_modules "length"
+let clist = gen_constant CoqInterface.init_modules "list"
+let cnil = gen_constant CoqInterface.init_modules "nil"
+let ccons = gen_constant CoqInterface.init_modules "cons"
+let clength = gen_constant CoqInterface.init_modules "length"
(* Option *)
-let coption = gen_constant init_modules "option"
-let cSome = gen_constant init_modules "Some"
-let cNone = gen_constant init_modules "None"
+let coption = gen_constant CoqInterface.init_modules "option"
+let cSome = gen_constant CoqInterface.init_modules "Some"
+let cNone = gen_constant CoqInterface.init_modules "None"
(* Pairs *)
-let cpair = gen_constant init_modules "pair"
-let cprod = gen_constant init_modules "prod"
+let cpair = gen_constant CoqInterface.init_modules "pair"
+let cprod = gen_constant CoqInterface.init_modules "prod"
(* Dependent pairs *)
-let csigT = gen_constant init_modules "sigT"
-(* let cprojT1 = gen_constant init_modules "projT1" *)
-(* let cprojT2 = gen_constant init_modules "projT2" *)
-(* let cprojT3 = gen_constant init_modules "projT3" *)
+let csigT = gen_constant CoqInterface.init_modules "sigT"
+(* let cprojT1 = gen_constant CoqInterface.init_modules "projT1" *)
+(* let cprojT2 = gen_constant CoqInterface.init_modules "projT2" *)
+(* let cprojT3 = gen_constant CoqInterface.init_modules "projT3" *)
-(* let csigT2 = gen_constant init_modules "sigT2" *)
-(* let csigT_of_sigT2 = gen_constant init_modules "sigT_of_sigT2" *)
+(* let csigT2 = gen_constant CoqInterface.init_modules "sigT2" *)
+(* let csigT_of_sigT2 = gen_constant CoqInterface.init_modules "sigT_of_sigT2" *)
(* Logical Operators *)
-let cnot = gen_constant init_modules "not"
-let ceq = gen_constant init_modules "eq"
-let crefl_equal = gen_constant init_modules "eq_refl"
-let cconj = gen_constant init_modules "conj"
-let cand = gen_constant init_modules "and"
+let cnot = gen_constant CoqInterface.init_modules "not"
+let ceq = gen_constant CoqInterface.init_modules "eq"
+let crefl_equal = gen_constant CoqInterface.init_modules "eq_refl"
+let cconj = gen_constant CoqInterface.init_modules "conj"
+let cand = gen_constant CoqInterface.init_modules "and"
(* Bit vectors *)
let bv_modules = [["SMTCoq";"bva";"BVList";"BITVECTOR_LIST"]]
@@ -307,8 +306,8 @@ let ceq_refl_true =
let eq_refl_true () = Lazy.force ceq_refl_true
let vm_cast_true_no_check t =
- Structures.mkCast(eq_refl_true (),
- Structures.vmcast,
+ CoqInterface.mkCast(eq_refl_true (),
+ CoqInterface.vmcast,
mklApp ceq [|Lazy.force cbool; t; Lazy.force ctrue|])
(* This version checks convertibility right away instead of delaying it at
@@ -316,13 +315,13 @@ let vm_cast_true_no_check t =
SMTCoq's tactics. *)
let vm_cast_true env t =
try
- Structures.vm_conv Reduction.CUMUL env
+ CoqInterface.vm_conv Reduction.CUMUL env
(mklApp ceq
[|Lazy.force cbool; Lazy.force ctrue; Lazy.force ctrue|])
(mklApp ceq [|Lazy.force cbool; t; Lazy.force ctrue|]);
vm_cast_true_no_check t
with Reduction.NotConvertible ->
- Structures.error ("SMTCoq was not able to check the proof certificate.")
+ CoqInterface.error ("SMTCoq was not able to check the proof certificate.")
(* Compute a nat *)
@@ -356,39 +355,39 @@ let rec mk_bv_list = function
(* Reification *)
let mk_bool b =
- let c, args = Structures.decompose_app b in
- if Structures.eq_constr c (Lazy.force ctrue) then true
- else if Structures.eq_constr c (Lazy.force cfalse) then false
+ let c, args = CoqInterface.decompose_app b in
+ if CoqInterface.eq_constr c (Lazy.force ctrue) then true
+ else if CoqInterface.eq_constr c (Lazy.force cfalse) then false
else assert false
let rec mk_bool_list bs =
- let c, args = Structures.decompose_app bs in
- if Structures.eq_constr c (Lazy.force cnil) then []
- else if Structures.eq_constr c (Lazy.force ccons) then
+ let c, args = CoqInterface.decompose_app bs in
+ if CoqInterface.eq_constr c (Lazy.force cnil) then []
+ else if CoqInterface.eq_constr c (Lazy.force ccons) then
match args with
| [_; b; bs] -> mk_bool b :: mk_bool_list bs
| _ -> assert false
else assert false
let rec mk_nat n =
- let c, args = Structures.decompose_app n in
- if Structures.eq_constr c (Lazy.force cO) then
+ let c, args = CoqInterface.decompose_app n in
+ if CoqInterface.eq_constr c (Lazy.force cO) then
0
- else if Structures.eq_constr c (Lazy.force cS) then
+ else if CoqInterface.eq_constr c (Lazy.force cS) then
match args with
| [n] -> (mk_nat n) + 1
| _ -> assert false
else assert false
let rec mk_positive n =
- let c, args = Structures.decompose_app n in
- if Structures.eq_constr c (Lazy.force cxH) then
+ let c, args = CoqInterface.decompose_app n in
+ if CoqInterface.eq_constr c (Lazy.force cxH) then
1
- else if Structures.eq_constr c (Lazy.force cxO) then
+ else if CoqInterface.eq_constr c (Lazy.force cxO) then
match args with
| [n] -> 2 * (mk_positive n)
| _ -> assert false
- else if Structures.eq_constr c (Lazy.force cxI) then
+ else if CoqInterface.eq_constr c (Lazy.force cxI) then
match args with
| [n] -> 2 * (mk_positive n) + 1
| _ -> assert false
@@ -396,10 +395,10 @@ let rec mk_positive n =
let mk_N n =
- let c, args = Structures.decompose_app n in
- if Structures.eq_constr c (Lazy.force cN0) then
+ let c, args = CoqInterface.decompose_app n in
+ if CoqInterface.eq_constr c (Lazy.force cN0) then
0
- else if Structures.eq_constr c (Lazy.force cNpos) then
+ else if CoqInterface.eq_constr c (Lazy.force cNpos) then
match args with
| [n] -> mk_positive n
| _ -> assert false
@@ -407,13 +406,13 @@ let mk_N n =
let mk_Z n =
- let c, args = Structures.decompose_app n in
- if Structures.eq_constr c (Lazy.force cZ0) then 0
- else if Structures.eq_constr c (Lazy.force cZpos) then
+ let c, args = CoqInterface.decompose_app n in
+ if CoqInterface.eq_constr c (Lazy.force cZ0) then 0
+ else if CoqInterface.eq_constr c (Lazy.force cZpos) then
match args with
| [n] -> mk_positive n
| _ -> assert false
- else if Structures.eq_constr c (Lazy.force cZneg) then
+ else if CoqInterface.eq_constr c (Lazy.force cZneg) then
match args with
| [n] -> - mk_positive n
| _ -> assert false
@@ -422,12 +421,12 @@ let mk_Z n =
(* size of bivectors are either N.of_nat (length l) or an N *)
let mk_bvsize n =
- let c, args = Structures.decompose_app n in
- if Structures.eq_constr c (Lazy.force cof_nat) then
+ let c, args = CoqInterface.decompose_app n in
+ if CoqInterface.eq_constr c (Lazy.force cof_nat) then
match args with
| [nl] ->
- let c, args = Structures.decompose_app nl in
- if Structures.eq_constr c (Lazy.force clength) then
+ let c, args = CoqInterface.decompose_app nl in
+ if CoqInterface.eq_constr c (Lazy.force clength) then
match args with
| [_; l] -> List.length (mk_bool_list l)
| _ -> assert false
@@ -438,7 +437,7 @@ let mk_bvsize n =
(** Switches between constr and OCaml *)
(* Transform a option constr into a constr option *)
let option_of_constr_option co =
- let c, args = Structures.decompose_app co in
+ let c, args = CoqInterface.decompose_app co in
if c = Lazy.force cSome then
match args with
| [_;c] -> Some c
@@ -449,7 +448,7 @@ let option_of_constr_option co =
(* Transform a tuple of constr into a (reversed) list of constr *)
let list_of_constr_tuple =
let rec list_of_constr_tuple acc t =
- let c, args = Structures.decompose_app t in
+ let c, args = CoqInterface.decompose_app t in
if c = Lazy.force cpair then
match args with
| [_;_;t1;t2] ->
diff --git a/src/trace/coqTerms.mli b/src/trace/coqTerms.mli
index 282f8f6..92acbb6 100644
--- a/src/trace/coqTerms.mli
+++ b/src/trace/coqTerms.mli
@@ -10,258 +10,258 @@
(**************************************************************************)
-val gen_constant : string list list -> string -> Structures.constr lazy_t
+val gen_constant : string list list -> string -> CoqInterface.constr lazy_t
(* Int63 *)
-val cint : Structures.constr lazy_t
-val ceq63 : Structures.constr lazy_t
+val cint : CoqInterface.constr lazy_t
+val ceq63 : CoqInterface.constr lazy_t
(* PArray *)
-val carray : Structures.constr lazy_t
+val carray : CoqInterface.constr lazy_t
(* nat *)
-val cnat : Structures.constr lazy_t
-val cO : Structures.constr lazy_t
-val cS : Structures.constr lazy_t
+val cnat : CoqInterface.constr lazy_t
+val cO : CoqInterface.constr lazy_t
+val cS : CoqInterface.constr lazy_t
(* Positive *)
-val cpositive : Structures.constr lazy_t
-val cxI : Structures.constr lazy_t
-val cxO : Structures.constr lazy_t
-val cxH : Structures.constr lazy_t
-val ceqbP : Structures.constr lazy_t
+val cpositive : CoqInterface.constr lazy_t
+val cxI : CoqInterface.constr lazy_t
+val cxO : CoqInterface.constr lazy_t
+val cxH : CoqInterface.constr lazy_t
+val ceqbP : CoqInterface.constr lazy_t
(* N *)
-val cN : Structures.constr lazy_t
-val cN0 : Structures.constr lazy_t
-val cNpos : Structures.constr lazy_t
-val cof_nat : Structures.constr lazy_t
+val cN : CoqInterface.constr lazy_t
+val cN0 : CoqInterface.constr lazy_t
+val cNpos : CoqInterface.constr lazy_t
+val cof_nat : CoqInterface.constr lazy_t
(* Z *)
-val cZ : Structures.constr lazy_t
-val cZ0 : Structures.constr lazy_t
-val cZpos : Structures.constr lazy_t
-val cZneg : Structures.constr lazy_t
-val copp : Structures.constr lazy_t
-val cadd : Structures.constr lazy_t
-val csub : Structures.constr lazy_t
-val cmul : Structures.constr lazy_t
-val cltb : Structures.constr lazy_t
-val cleb : Structures.constr lazy_t
-val cgeb : Structures.constr lazy_t
-val cgtb : Structures.constr lazy_t
-val ceqbZ : Structures.constr lazy_t
+val cZ : CoqInterface.constr lazy_t
+val cZ0 : CoqInterface.constr lazy_t
+val cZpos : CoqInterface.constr lazy_t
+val cZneg : CoqInterface.constr lazy_t
+val copp : CoqInterface.constr lazy_t
+val cadd : CoqInterface.constr lazy_t
+val csub : CoqInterface.constr lazy_t
+val cmul : CoqInterface.constr lazy_t
+val cltb : CoqInterface.constr lazy_t
+val cleb : CoqInterface.constr lazy_t
+val cgeb : CoqInterface.constr lazy_t
+val cgtb : CoqInterface.constr lazy_t
+val ceqbZ : CoqInterface.constr lazy_t
(* Booleans *)
-val cbool : Structures.constr lazy_t
-val ctrue : Structures.constr lazy_t
-val cfalse : Structures.constr lazy_t
-val candb : Structures.constr lazy_t
-val corb : Structures.constr lazy_t
-val cxorb : Structures.constr lazy_t
-val cnegb : Structures.constr lazy_t
-val cimplb : Structures.constr lazy_t
-val ceqb : Structures.constr lazy_t
-val cifb : Structures.constr lazy_t
-val ciff : Structures.constr lazy_t
-val creflect : Structures.constr lazy_t
+val cbool : CoqInterface.constr lazy_t
+val ctrue : CoqInterface.constr lazy_t
+val cfalse : CoqInterface.constr lazy_t
+val candb : CoqInterface.constr lazy_t
+val corb : CoqInterface.constr lazy_t
+val cxorb : CoqInterface.constr lazy_t
+val cnegb : CoqInterface.constr lazy_t
+val cimplb : CoqInterface.constr lazy_t
+val ceqb : CoqInterface.constr lazy_t
+val cifb : CoqInterface.constr lazy_t
+val ciff : CoqInterface.constr lazy_t
+val creflect : CoqInterface.constr lazy_t
(* Lists *)
-val clist : Structures.constr lazy_t
-val cnil : Structures.constr lazy_t
-val ccons : Structures.constr lazy_t
-val clength : Structures.constr lazy_t
+val clist : CoqInterface.constr lazy_t
+val cnil : CoqInterface.constr lazy_t
+val ccons : CoqInterface.constr lazy_t
+val clength : CoqInterface.constr lazy_t
(* Option *)
-val coption : Structures.constr lazy_t
-val cSome : Structures.constr lazy_t
-val cNone : Structures.constr lazy_t
+val coption : CoqInterface.constr lazy_t
+val cSome : CoqInterface.constr lazy_t
+val cNone : CoqInterface.constr lazy_t
(* Pairs *)
-val cpair : Structures.constr lazy_t
-val cprod : Structures.constr lazy_t
+val cpair : CoqInterface.constr lazy_t
+val cprod : CoqInterface.constr lazy_t
(* Dependent pairs *)
-val csigT : Structures.constr lazy_t
+val csigT : CoqInterface.constr lazy_t
(* Logical Operators *)
-val cnot : Structures.constr lazy_t
-val ceq : Structures.constr lazy_t
-val crefl_equal : Structures.constr lazy_t
-val cconj : Structures.constr lazy_t
-val cand : Structures.constr lazy_t
+val cnot : CoqInterface.constr lazy_t
+val ceq : CoqInterface.constr lazy_t
+val crefl_equal : CoqInterface.constr lazy_t
+val cconj : CoqInterface.constr lazy_t
+val cand : CoqInterface.constr lazy_t
(* Bit vectors *)
-val cbitvector : Structures.constr lazy_t
-val cof_bits : Structures.constr lazy_t
-val cbitOf : Structures.constr lazy_t
-val cbv_eq : Structures.constr lazy_t
-val cbv_not : Structures.constr lazy_t
-val cbv_neg : Structures.constr lazy_t
-val cbv_and : Structures.constr lazy_t
-val cbv_or : Structures.constr lazy_t
-val cbv_xor : Structures.constr lazy_t
-val cbv_add : Structures.constr lazy_t
-val cbv_mult : Structures.constr lazy_t
-val cbv_ult : Structures.constr lazy_t
-val cbv_slt : Structures.constr lazy_t
-val cbv_concat : Structures.constr lazy_t
-val cbv_extr : Structures.constr lazy_t
-val cbv_zextn : Structures.constr lazy_t
-val cbv_sextn : Structures.constr lazy_t
-val cbv_shl : Structures.constr lazy_t
-val cbv_shr : Structures.constr lazy_t
+val cbitvector : CoqInterface.constr lazy_t
+val cof_bits : CoqInterface.constr lazy_t
+val cbitOf : CoqInterface.constr lazy_t
+val cbv_eq : CoqInterface.constr lazy_t
+val cbv_not : CoqInterface.constr lazy_t
+val cbv_neg : CoqInterface.constr lazy_t
+val cbv_and : CoqInterface.constr lazy_t
+val cbv_or : CoqInterface.constr lazy_t
+val cbv_xor : CoqInterface.constr lazy_t
+val cbv_add : CoqInterface.constr lazy_t
+val cbv_mult : CoqInterface.constr lazy_t
+val cbv_ult : CoqInterface.constr lazy_t
+val cbv_slt : CoqInterface.constr lazy_t
+val cbv_concat : CoqInterface.constr lazy_t
+val cbv_extr : CoqInterface.constr lazy_t
+val cbv_zextn : CoqInterface.constr lazy_t
+val cbv_sextn : CoqInterface.constr lazy_t
+val cbv_shl : CoqInterface.constr lazy_t
+val cbv_shr : CoqInterface.constr lazy_t
(* Arrays *)
-val cfarray : Structures.constr lazy_t
-val cselect : Structures.constr lazy_t
-val cstore : Structures.constr lazy_t
-val cdiff : Structures.constr lazy_t
-val cequalarray : Structures.constr lazy_t
+val cfarray : CoqInterface.constr lazy_t
+val cselect : CoqInterface.constr lazy_t
+val cstore : CoqInterface.constr lazy_t
+val cdiff : CoqInterface.constr lazy_t
+val cequalarray : CoqInterface.constr lazy_t
(* OrderedType *)
(* SMT_terms *)
-val cState_C_t : Structures.constr lazy_t
-val cState_S_t : Structures.constr lazy_t
-
-val cdistinct : Structures.constr lazy_t
-
-val ctype : Structures.constr lazy_t
-val cTZ : Structures.constr lazy_t
-val cTbool : Structures.constr lazy_t
-val cTpositive : Structures.constr lazy_t
-val cTBV : Structures.constr lazy_t
-val cTFArray : Structures.constr lazy_t
-val cTindex : Structures.constr lazy_t
-
-val cinterp_t : Structures.constr lazy_t
-val cdec_interp : Structures.constr lazy_t
-val cord_interp : Structures.constr lazy_t
-val ccomp_interp : Structures.constr lazy_t
-val cinh_interp : Structures.constr lazy_t
-
-val cinterp_eqb : Structures.constr lazy_t
-
-val ctyp_compdec : Structures.constr lazy_t
-val cTyp_compdec : Structures.constr lazy_t
-val cunit_typ_compdec : Structures.constr lazy_t
-val cte_carrier : Structures.constr lazy_t
-val cte_compdec : Structures.constr lazy_t
-val ceqb_of_compdec : Structures.constr lazy_t
-val cCompDec : Structures.constr lazy_t
-
-val cbool_compdec : Structures.constr lazy_t
-val cZ_compdec : Structures.constr lazy_t
-val cPositive_compdec : Structures.constr lazy_t
-val cBV_compdec : Structures.constr lazy_t
-val cFArray_compdec : Structures.constr lazy_t
-
-val ctval : Structures.constr lazy_t
-val cTval : Structures.constr lazy_t
-
-val cCO_xH : Structures.constr lazy_t
-val cCO_Z0 : Structures.constr lazy_t
-val cCO_BV : Structures.constr lazy_t
-
-val cUO_xO : Structures.constr lazy_t
-val cUO_xI : Structures.constr lazy_t
-val cUO_Zpos : Structures.constr lazy_t
-val cUO_Zneg : Structures.constr lazy_t
-val cUO_Zopp : Structures.constr lazy_t
-val cUO_BVbitOf : Structures.constr lazy_t
-val cUO_BVnot : Structures.constr lazy_t
-val cUO_BVneg : Structures.constr lazy_t
-val cUO_BVextr : Structures.constr lazy_t
-val cUO_BVzextn : Structures.constr lazy_t
-val cUO_BVsextn : Structures.constr lazy_t
-
-val cBO_Zplus : Structures.constr lazy_t
-val cBO_Zminus : Structures.constr lazy_t
-val cBO_Zmult : Structures.constr lazy_t
-val cBO_Zlt : Structures.constr lazy_t
-val cBO_Zle : Structures.constr lazy_t
-val cBO_Zge : Structures.constr lazy_t
-val cBO_Zgt : Structures.constr lazy_t
-val cBO_eq : Structures.constr lazy_t
-val cBO_BVand : Structures.constr lazy_t
-val cBO_BVor : Structures.constr lazy_t
-val cBO_BVxor : Structures.constr lazy_t
-val cBO_BVadd : Structures.constr lazy_t
-val cBO_BVmult : Structures.constr lazy_t
-val cBO_BVult : Structures.constr lazy_t
-val cBO_BVslt : Structures.constr lazy_t
-val cBO_BVconcat : Structures.constr lazy_t
-val cBO_BVshl : Structures.constr lazy_t
-val cBO_BVshr : Structures.constr lazy_t
-val cBO_select : Structures.constr lazy_t
-val cBO_diffarray : Structures.constr lazy_t
-
-val cTO_store : Structures.constr lazy_t
-
-val cNO_distinct : Structures.constr lazy_t
-
-val catom : Structures.constr lazy_t
-val cAcop : Structures.constr lazy_t
-val cAuop : Structures.constr lazy_t
-val cAbop : Structures.constr lazy_t
-val cAtop : Structures.constr lazy_t
-val cAnop : Structures.constr lazy_t
-val cAapp : Structures.constr lazy_t
-
-val cform : Structures.constr lazy_t
-val cFatom : Structures.constr lazy_t
-val cFtrue : Structures.constr lazy_t
-val cFfalse : Structures.constr lazy_t
-val cFnot2 : Structures.constr lazy_t
-val cFand : Structures.constr lazy_t
-val cFor : Structures.constr lazy_t
-val cFxor : Structures.constr lazy_t
-val cFimp : Structures.constr lazy_t
-val cFiff : Structures.constr lazy_t
-val cFite : Structures.constr lazy_t
-val cFbbT : Structures.constr lazy_t
-
-val cis_true : Structures.constr lazy_t
-
-val cvalid_sat_checker : Structures.constr lazy_t
-val cinterp_var_sat_checker : Structures.constr lazy_t
+val cState_C_t : CoqInterface.constr lazy_t
+val cState_S_t : CoqInterface.constr lazy_t
+
+val cdistinct : CoqInterface.constr lazy_t
+
+val ctype : CoqInterface.constr lazy_t
+val cTZ : CoqInterface.constr lazy_t
+val cTbool : CoqInterface.constr lazy_t
+val cTpositive : CoqInterface.constr lazy_t
+val cTBV : CoqInterface.constr lazy_t
+val cTFArray : CoqInterface.constr lazy_t
+val cTindex : CoqInterface.constr lazy_t
+
+val cinterp_t : CoqInterface.constr lazy_t
+val cdec_interp : CoqInterface.constr lazy_t
+val cord_interp : CoqInterface.constr lazy_t
+val ccomp_interp : CoqInterface.constr lazy_t
+val cinh_interp : CoqInterface.constr lazy_t
+
+val cinterp_eqb : CoqInterface.constr lazy_t
+
+val ctyp_compdec : CoqInterface.constr lazy_t
+val cTyp_compdec : CoqInterface.constr lazy_t
+val cunit_typ_compdec : CoqInterface.constr lazy_t
+val cte_carrier : CoqInterface.constr lazy_t
+val cte_compdec : CoqInterface.constr lazy_t
+val ceqb_of_compdec : CoqInterface.constr lazy_t
+val cCompDec : CoqInterface.constr lazy_t
+
+val cbool_compdec : CoqInterface.constr lazy_t
+val cZ_compdec : CoqInterface.constr lazy_t
+val cPositive_compdec : CoqInterface.constr lazy_t
+val cBV_compdec : CoqInterface.constr lazy_t
+val cFArray_compdec : CoqInterface.constr lazy_t
+
+val ctval : CoqInterface.constr lazy_t
+val cTval : CoqInterface.constr lazy_t
+
+val cCO_xH : CoqInterface.constr lazy_t
+val cCO_Z0 : CoqInterface.constr lazy_t
+val cCO_BV : CoqInterface.constr lazy_t
+
+val cUO_xO : CoqInterface.constr lazy_t
+val cUO_xI : CoqInterface.constr lazy_t
+val cUO_Zpos : CoqInterface.constr lazy_t
+val cUO_Zneg : CoqInterface.constr lazy_t
+val cUO_Zopp : CoqInterface.constr lazy_t
+val cUO_BVbitOf : CoqInterface.constr lazy_t
+val cUO_BVnot : CoqInterface.constr lazy_t
+val cUO_BVneg : CoqInterface.constr lazy_t
+val cUO_BVextr : CoqInterface.constr lazy_t
+val cUO_BVzextn : CoqInterface.constr lazy_t
+val cUO_BVsextn : CoqInterface.constr lazy_t
+
+val cBO_Zplus : CoqInterface.constr lazy_t
+val cBO_Zminus : CoqInterface.constr lazy_t
+val cBO_Zmult : CoqInterface.constr lazy_t
+val cBO_Zlt : CoqInterface.constr lazy_t
+val cBO_Zle : CoqInterface.constr lazy_t
+val cBO_Zge : CoqInterface.constr lazy_t
+val cBO_Zgt : CoqInterface.constr lazy_t
+val cBO_eq : CoqInterface.constr lazy_t
+val cBO_BVand : CoqInterface.constr lazy_t
+val cBO_BVor : CoqInterface.constr lazy_t
+val cBO_BVxor : CoqInterface.constr lazy_t
+val cBO_BVadd : CoqInterface.constr lazy_t
+val cBO_BVmult : CoqInterface.constr lazy_t
+val cBO_BVult : CoqInterface.constr lazy_t
+val cBO_BVslt : CoqInterface.constr lazy_t
+val cBO_BVconcat : CoqInterface.constr lazy_t
+val cBO_BVshl : CoqInterface.constr lazy_t
+val cBO_BVshr : CoqInterface.constr lazy_t
+val cBO_select : CoqInterface.constr lazy_t
+val cBO_diffarray : CoqInterface.constr lazy_t
+
+val cTO_store : CoqInterface.constr lazy_t
+
+val cNO_distinct : CoqInterface.constr lazy_t
+
+val catom : CoqInterface.constr lazy_t
+val cAcop : CoqInterface.constr lazy_t
+val cAuop : CoqInterface.constr lazy_t
+val cAbop : CoqInterface.constr lazy_t
+val cAtop : CoqInterface.constr lazy_t
+val cAnop : CoqInterface.constr lazy_t
+val cAapp : CoqInterface.constr lazy_t
+
+val cform : CoqInterface.constr lazy_t
+val cFatom : CoqInterface.constr lazy_t
+val cFtrue : CoqInterface.constr lazy_t
+val cFfalse : CoqInterface.constr lazy_t
+val cFnot2 : CoqInterface.constr lazy_t
+val cFand : CoqInterface.constr lazy_t
+val cFor : CoqInterface.constr lazy_t
+val cFxor : CoqInterface.constr lazy_t
+val cFimp : CoqInterface.constr lazy_t
+val cFiff : CoqInterface.constr lazy_t
+val cFite : CoqInterface.constr lazy_t
+val cFbbT : CoqInterface.constr lazy_t
+
+val cis_true : CoqInterface.constr lazy_t
+
+val cvalid_sat_checker : CoqInterface.constr lazy_t
+val cinterp_var_sat_checker : CoqInterface.constr lazy_t
val make_certif_ops :
string list list ->
- Structures.constr array option ->
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t * Structures.constr lazy_t *
- Structures.constr lazy_t * Structures.constr lazy_t
+ CoqInterface.constr array option ->
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t * CoqInterface.constr lazy_t *
+ CoqInterface.constr lazy_t * CoqInterface.constr lazy_t
(* Some constructions *)
-val ceq_refl_true : Structures.constr lazy_t
-val eq_refl_true : unit -> Structures.constr
-val vm_cast_true_no_check : Structures.constr -> Structures.constr
-val vm_cast_true : Environ.env -> Structures.constr -> Structures.constr
-val mkNat : int -> Structures.constr
-val mkN : int -> Structures.constr
-val mk_bv_list : bool list -> Structures.constr
+val ceq_refl_true : CoqInterface.constr lazy_t
+val eq_refl_true : unit -> CoqInterface.constr
+val vm_cast_true_no_check : CoqInterface.constr -> CoqInterface.constr
+val vm_cast_true : Environ.env -> CoqInterface.constr -> CoqInterface.constr
+val mkNat : int -> CoqInterface.constr
+val mkN : int -> CoqInterface.constr
+val mk_bv_list : bool list -> CoqInterface.constr
(* Reification *)
-val mk_bool : Structures.constr -> bool
-val mk_bool_list : Structures.constr -> bool list
-val mk_nat : Structures.constr -> int
-val mk_N : Structures.constr -> int
-val mk_Z : Structures.constr -> int
-val mk_bvsize : Structures.constr -> int
+val mk_bool : CoqInterface.constr -> bool
+val mk_bool_list : CoqInterface.constr -> bool list
+val mk_nat : CoqInterface.constr -> int
+val mk_N : CoqInterface.constr -> int
+val mk_Z : CoqInterface.constr -> int
+val mk_bvsize : CoqInterface.constr -> int
(* Switches between constr and OCaml *)
-val option_of_constr_option : Structures.constr -> Structures.constr option
-val list_of_constr_tuple : Structures.constr -> Structures.constr list
+val option_of_constr_option : CoqInterface.constr -> CoqInterface.constr option
+val list_of_constr_tuple : CoqInterface.constr -> CoqInterface.constr list
diff --git a/src/trace/satAtom.ml b/src/trace/satAtom.ml
index 6ffd752..0296c88 100644
--- a/src/trace/satAtom.ml
+++ b/src/trace/satAtom.ml
@@ -27,7 +27,7 @@ module Atom =
type reify_tbl =
{ mutable count : int;
- tbl : (Structures.constr, int) Hashtbl.t
+ tbl : (CoqInterface.constr, int) Hashtbl.t
}
let create () =
@@ -51,7 +51,7 @@ module Atom =
t
let interp_tbl reify =
- Structures.mkArray (Lazy.force cbool, atom_tbl reify)
+ CoqInterface.mkArray (Lazy.force cbool, atom_tbl reify)
let logic _ = SL.empty
diff --git a/src/trace/satAtom.mli b/src/trace/satAtom.mli
index b6a8dea..311b147 100644
--- a/src/trace/satAtom.mli
+++ b/src/trace/satAtom.mli
@@ -23,13 +23,13 @@ module Atom : sig
type reify_tbl = {
mutable count : int;
- tbl : (Structures.constr, t) Hashtbl.t;
+ tbl : (CoqInterface.constr, t) Hashtbl.t;
}
val create : unit -> reify_tbl
- val declare : reify_tbl -> Structures.constr -> t
- val get : reify_tbl -> Structures.constr -> t
- val atom_tbl : reify_tbl -> Structures.constr array
- val interp_tbl : reify_tbl -> Structures.constr
+ val declare : reify_tbl -> CoqInterface.constr -> t
+ val get : reify_tbl -> CoqInterface.constr -> t
+ val atom_tbl : reify_tbl -> CoqInterface.constr array
+ val interp_tbl : reify_tbl -> CoqInterface.constr
end
diff --git a/src/trace/smtAtom.ml b/src/trace/smtAtom.ml
index 2710eb2..78f2eee 100644
--- a/src/trace/smtAtom.ml
+++ b/src/trace/smtAtom.ml
@@ -85,7 +85,7 @@ type nop =
type op_def = {
tparams : SmtBtype.btype array;
tres : SmtBtype.btype;
- op_val : Structures.constr }
+ op_val : CoqInterface.constr }
type index = Index of int
| Rel_name of string
@@ -97,14 +97,14 @@ let destruct s (i, hval) = match i with
| Rel_name _ -> failwith s
let dummy_indexed_op i dom codom =
- (i, {tparams = dom; tres = codom; op_val = Structures.mkProp})
+ (i, {tparams = dom; tres = codom; op_val = CoqInterface.mkProp})
let indexed_op_index i =
let index, _ = destruct "destruct on a Rel: called by indexed_op_index" i in
index
let debruijn_indexed_op i ty =
- (Index i, {tparams = [||]; tres = ty; op_val = Structures.mkRel i})
+ (Index i, {tparams = [||]; tres = ty; op_val = CoqInterface.mkRel i})
module Op =
struct
@@ -357,7 +357,7 @@ module Op =
(* reify table *)
type reify_tbl =
{ mutable count : int;
- tbl : (Structures.constr, indexed_op) Hashtbl.t
+ tbl : (CoqInterface.constr, indexed_op) Hashtbl.t
}
let create () =
@@ -385,7 +385,7 @@ module Op =
let index, hval = destruct "destruct on a Rel: called by set in interp_tbl" op in
t.(index) <- mk_Tval hval.tparams hval.tres hval.op_val in
Hashtbl.iter set reify.tbl;
- Structures.mkArray (tval, t)
+ CoqInterface.mkArray (tval, t)
let to_list reify =
let set _ op acc =
@@ -713,7 +713,7 @@ module Atom =
to_smt_atom (atom h)
and to_smt_atom = function
- | Acop (CO_BV bv) -> if List.length bv = 0 then Structures.error "Empty bit-vectors are not valid in SMT" else Format.fprintf fmt "#b%a" bv_to_smt bv
+ | Acop (CO_BV bv) -> if List.length bv = 0 then CoqInterface.error "Empty bit-vectors are not valid in SMT" else Format.fprintf fmt "#b%a" bv_to_smt bv
| Acop _ as a -> to_smt_int fmt (compute_int a)
| Auop (op,h) -> to_smt_uop op h
| Abop (op,h1,h2) -> to_smt_bop op h1 h2
@@ -740,7 +740,7 @@ module Atom =
Array.iter (fun bt -> SmtBtype.to_smt fmt bt; Format.fprintf fmt " ") bta;
Format.fprintf fmt ") ( ";
SmtBtype.to_smt fmt bt;
- Format.fprintf fmt " ) ( %s )]" (Pp.string_of_ppcmds (Structures.pr_constr t))
+ Format.fprintf fmt " ) ( %s )]" (Pp.string_of_ppcmds (CoqInterface.pr_constr t))
and to_smt_uop op h =
match op with
@@ -1107,8 +1107,8 @@ module Atom =
else CCunknown_deps (gobble_of_coq_cst cc)
with Not_found -> CCunknown
in
- let rec mk_hatom (h : Structures.constr) =
- let c, args = Structures.decompose_app h in
+ let rec mk_hatom (h : CoqInterface.constr) =
+ let c, args = CoqInterface.decompose_app h in
match get_cst c with
| CCxH -> mk_cop CCxH args
| CCZ0 -> mk_cop CCZ0 args
@@ -1150,9 +1150,9 @@ module Atom =
| CCselect -> mk_bop_select args
| CCdiff -> mk_bop_diff args
| CCstore -> mk_top_store args
- | CCunknown -> mk_unknown c args (Structures.retyping_get_type_of env sigma h)
+ | CCunknown -> mk_unknown c args (CoqInterface.retyping_get_type_of env sigma h)
| CCunknown_deps gobble ->
- mk_unknown_deps c args (Structures.retyping_get_type_of env sigma h) gobble
+ mk_unknown_deps c args (CoqInterface.retyping_get_type_of env sigma h) gobble
and mk_cop op args = match op, args with
@@ -1343,10 +1343,10 @@ module Atom =
let rec collect_types = function
| [] -> ([],[])
| x::xs as l ->
- let ty = Structures.retyping_get_type_of env sigma x in
+ let ty = CoqInterface.retyping_get_type_of env sigma x in
if Constr.iskind ty ||
- let c, _ = Structures.decompose_app ty in
- Structures.eq_constr c (Lazy.force cCompDec)
+ let c, _ = CoqInterface.decompose_app ty in
+ CoqInterface.eq_constr c (Lazy.force cCompDec)
then
let (l1, l2) = collect_types xs in
(x::l1, l2)
@@ -1365,10 +1365,10 @@ module Atom =
with | Not_found ->
let targs = Array.map type_of hargs in
let tres = SmtBtype.of_coq rt known_logic ty in
- let os = if Structures.isRel c then
- let i = Structures.destRel c in
- let n, _ = Structures.destruct_rel_decl (Environ.lookup_rel i env) in
- Some (Structures.string_of_name n)
+ let os = if CoqInterface.isRel c then
+ let i = CoqInterface.destRel c in
+ let n, _ = CoqInterface.destruct_rel_decl (Environ.lookup_rel i env) in
+ Some (CoqInterface.string_of_name n)
else if Vars.closed0 c then
None
else
@@ -1391,7 +1391,7 @@ module Atom =
[gobble] *)
and mk_unknown_deps c args ty gobble =
let deps, args = split_list_at gobble args in
- let c = Structures.mkApp (c, Array.of_list deps) in
+ let c = CoqInterface.mkApp (c, Array.of_list deps) in
mk_unknown c args ty
in
@@ -1432,7 +1432,7 @@ module Atom =
let interp_tbl reify =
let t = to_array reify (Lazy.force dft_atom) a_to_coq in
- Structures.mkArray (Lazy.force catom, t)
+ CoqInterface.mkArray (Lazy.force catom, t)
(** Producing a Coq term corresponding to the interpretation of an atom *)
@@ -1444,12 +1444,12 @@ module Atom =
let pc =
match atom a with
| Acop c -> Op.interp_cop c
- | Auop (op,h) -> Structures.mkApp (Op.interp_uop op, [|interp_atom h|])
+ | Auop (op,h) -> CoqInterface.mkApp (Op.interp_uop op, [|interp_atom h|])
| Abop (op,h1,h2) ->
- Structures.mkApp (Op.interp_bop t_i op,
+ CoqInterface.mkApp (Op.interp_bop t_i op,
[|interp_atom h1; interp_atom h2|])
| Atop (op,h1,h2,h3) ->
- Structures.mkApp (Op.interp_top t_i op,
+ CoqInterface.mkApp (Op.interp_top t_i op,
[|interp_atom h1; interp_atom h2; interp_atom h3|])
| Anop (NO_distinct ty as op,ha) ->
let cop = Op.interp_nop t_i op in
@@ -1457,9 +1457,9 @@ module Atom =
let cargs = Array.fold_right (fun h l ->
mklApp ccons [|typ; interp_atom h; l|])
ha (mklApp cnil [|typ|]) in
- Structures.mkApp (cop,[|cargs|])
+ CoqInterface.mkApp (cop,[|cargs|])
| Aapp (op,t) ->
- Structures.mkApp ((snd op).op_val, Array.map interp_atom t) in
+ CoqInterface.mkApp ((snd op).op_val, Array.map interp_atom t) in
Hashtbl.add atom_tbl l pc;
pc in
interp_atom a
diff --git a/src/trace/smtAtom.mli b/src/trace/smtAtom.mli
index 645a638..27737ff 100644
--- a/src/trace/smtAtom.mli
+++ b/src/trace/smtAtom.mli
@@ -76,14 +76,14 @@ module Op :
val create : unit -> reify_tbl
- val declare : reify_tbl -> Structures.constr -> btype array ->
+ val declare : reify_tbl -> CoqInterface.constr -> btype array ->
btype -> string option -> indexed_op
- val of_coq : reify_tbl -> Structures.constr -> indexed_op
+ val of_coq : reify_tbl -> CoqInterface.constr -> indexed_op
- val interp_tbl : Structures.constr ->
- (btype array -> btype -> Structures.constr -> Structures.constr) ->
- reify_tbl -> Structures.constr
+ val interp_tbl : CoqInterface.constr ->
+ (btype array -> btype -> CoqInterface.constr -> CoqInterface.constr) ->
+ reify_tbl -> CoqInterface.constr
val to_list : reify_tbl -> (int * (btype array) * btype * indexed_op) list
@@ -142,18 +142,18 @@ module Atom :
(** Given a coq term, build the corresponding atom *)
exception UnknownUnderForall
val of_coq : ?eqsym:bool -> SmtBtype.reify_tbl -> Op.reify_tbl ->
- reify_tbl -> SmtMisc.logic -> Environ.env -> Evd.evar_map -> Structures.constr -> t
+ reify_tbl -> SmtMisc.logic -> Environ.env -> Evd.evar_map -> CoqInterface.constr -> t
- val get_coq_term_op : int -> Structures.constr
+ val get_coq_term_op : int -> CoqInterface.constr
- val to_coq : t -> Structures.constr
+ val to_coq : t -> CoqInterface.constr
val to_array : reify_tbl -> 'a -> (atom -> 'a) -> 'a array
- val interp_tbl : reify_tbl -> Structures.constr
+ val interp_tbl : reify_tbl -> CoqInterface.constr
- val interp_to_coq : Structures.constr -> (int, Structures.constr) Hashtbl.t ->
- t -> Structures.constr
+ val interp_to_coq : CoqInterface.constr -> (int, CoqInterface.constr) Hashtbl.t ->
+ t -> CoqInterface.constr
val logic : t -> SmtMisc.logic
@@ -201,5 +201,5 @@ module Trace : sig
end
-val make_t_i : SmtBtype.reify_tbl -> Structures.constr
-val make_t_func : Op.reify_tbl -> Structures.constr -> Structures.constr
+val make_t_i : SmtBtype.reify_tbl -> CoqInterface.constr
+val make_t_func : Op.reify_tbl -> CoqInterface.constr -> CoqInterface.constr
diff --git a/src/trace/smtBtype.ml b/src/trace/smtBtype.ml
index 3b6d107..c9aad70 100644
--- a/src/trace/smtBtype.ml
+++ b/src/trace/smtBtype.ml
@@ -19,7 +19,7 @@ type uninterpreted_type =
(* Uninterpreted type for which a CompDec is already known
The constr is of type typ_compdec
*)
- | CompDec of Structures.constr
+ | CompDec of CoqInterface.constr
(* Uninterpreted type for which the knowledge of a CompDec is delayed
until either:
- one is used
@@ -27,11 +27,11 @@ type uninterpreted_type =
via a cut
The constr is of type Type
*)
- | Delayed of Structures.constr
+ | Delayed of CoqInterface.constr
type indexed_type = uninterpreted_type gen_hashed
-let dummy_indexed_type i = {index = i; hval = Delayed (Structures.mkProp)}
+let dummy_indexed_type i = {index = i; hval = Delayed (CoqInterface.mkProp)}
let indexed_type_index i = i.index
let indexed_type_compdec i =
match i.hval with
@@ -105,8 +105,8 @@ let rec logic = function
(* reify table *)
type reify_tbl =
{ mutable count : int;
- tbl : (Structures.constr, btype) Hashtbl.t;
- mutable cuts : (Structures.id * Structures.types) list;
+ tbl : (CoqInterface.constr, btype) Hashtbl.t;
+ mutable cuts : (CoqInterface.id * CoqInterface.types) list;
unsup_tbl : (btype, btype) Hashtbl.t;
}
@@ -145,8 +145,8 @@ let interp_tbl reify =
| CompDec compdec -> t.(it.index) <- compdec; Some bt
| Delayed ty ->
let n = string_of_int (List.length reify.cuts) in
- let compdec_name = Structures.mkId ("CompDec"^n) in
- let compdec_var = Structures.mkVar compdec_name in
+ let compdec_name = CoqInterface.mkId ("CompDec"^n) in
+ let compdec_var = CoqInterface.mkVar compdec_name in
let compdec_type = mklApp cCompDec [| ty |] in
reify.cuts <- (compdec_name, compdec_type) :: reify.cuts;
let ce = mklApp cTyp_compdec [|ty; compdec_var|] in
@@ -156,7 +156,7 @@ let interp_tbl reify =
| _ -> Some bt
in
Hashtbl.filter_map_inplace set reify.tbl;
- Structures.mkArray (Lazy.force ctyp_compdec, t)
+ CoqInterface.mkArray (Lazy.force ctyp_compdec, t)
let to_list reify =
@@ -241,8 +241,8 @@ let rec compdec_btype reify = function
| Tindex i ->
(match i.hval with
| CompDec compdec ->
- let c, args = Structures.decompose_app compdec in
- if Structures.eq_constr c (Lazy.force cTyp_compdec) then
+ let c, args = CoqInterface.decompose_app compdec in
+ if CoqInterface.eq_constr c (Lazy.force cTyp_compdec) then
match args with
| [_; tic] -> tic
| _ -> assert false
@@ -264,22 +264,22 @@ let declare_and_compdec reify t ty =
let rec of_coq reify known_logic t =
try
- let c, args = Structures.decompose_app t in
- if Structures.eq_constr c (Lazy.force cbool) ||
- Structures.eq_constr c (Lazy.force cTbool) then Tbool
- else if Structures.eq_constr c (Lazy.force cZ) ||
- Structures.eq_constr c (Lazy.force cTZ) then
+ let c, args = CoqInterface.decompose_app t in
+ if CoqInterface.eq_constr c (Lazy.force cbool) ||
+ CoqInterface.eq_constr c (Lazy.force cTbool) then Tbool
+ else if CoqInterface.eq_constr c (Lazy.force cZ) ||
+ CoqInterface.eq_constr c (Lazy.force cTZ) then
check_known TZ known_logic
- else if Structures.eq_constr c (Lazy.force cpositive) ||
- Structures.eq_constr c (Lazy.force cTpositive) then
+ else if CoqInterface.eq_constr c (Lazy.force cpositive) ||
+ CoqInterface.eq_constr c (Lazy.force cTpositive) then
check_known Tpositive known_logic
- else if Structures.eq_constr c (Lazy.force cbitvector) ||
- Structures.eq_constr c (Lazy.force cTBV) then
+ else if CoqInterface.eq_constr c (Lazy.force cbitvector) ||
+ CoqInterface.eq_constr c (Lazy.force cTBV) then
match args with
| [s] -> check_known (TBV (mk_bvsize s)) known_logic
| _ -> assert false
- else if Structures.eq_constr c (Lazy.force cfarray) ||
- Structures.eq_constr c (Lazy.force cTFArray) then
+ else if CoqInterface.eq_constr c (Lazy.force cfarray) ||
+ CoqInterface.eq_constr c (Lazy.force cTFArray) then
match args with
| ti :: te :: _ ->
let ty = TFArray (of_coq reify known_logic ti,
diff --git a/src/trace/smtBtype.mli b/src/trace/smtBtype.mli
index ec73d21..7060ab6 100644
--- a/src/trace/smtBtype.mli
+++ b/src/trace/smtBtype.mli
@@ -17,7 +17,7 @@ type indexed_type
val dummy_indexed_type: int -> indexed_type
val indexed_type_index : indexed_type -> int
-val indexed_type_compdec : indexed_type -> Structures.constr
+val indexed_type_compdec : indexed_type -> CoqInterface.constr
type btype =
| TZ
@@ -31,7 +31,7 @@ val indexed_type_of_int : int -> indexed_type
module HashedBtype : Hashtbl.HashedType with type t = btype
-val to_coq : btype -> Structures.constr
+val to_coq : btype -> CoqInterface.constr
val to_smt : Format.formatter -> btype -> unit
@@ -40,25 +40,25 @@ type reify_tbl
val create : unit -> reify_tbl
val copy : reify_tbl -> reify_tbl
-val of_coq : reify_tbl -> logic -> Structures.constr -> btype
-val of_coq_compdec : reify_tbl -> Structures.constr -> Structures.constr -> btype
+val of_coq : reify_tbl -> logic -> CoqInterface.constr -> btype
+val of_coq_compdec : reify_tbl -> CoqInterface.constr -> CoqInterface.constr -> btype
-val get_coq_type_op : int -> Structures.constr
+val get_coq_type_op : int -> CoqInterface.constr
-val interp_tbl : reify_tbl -> Structures.constr
+val interp_tbl : reify_tbl -> CoqInterface.constr
val to_list : reify_tbl -> (int * indexed_type) list
-val make_t_i : reify_tbl -> Structures.constr
+val make_t_i : reify_tbl -> CoqInterface.constr
-val dec_interp : Structures.constr -> btype -> Structures.constr
-val ord_interp : Structures.constr -> btype -> Structures.constr
-val comp_interp : Structures.constr -> btype -> Structures.constr
-val inh_interp : Structures.constr -> btype -> Structures.constr
-val interp : Structures.constr -> btype -> Structures.constr
+val dec_interp : CoqInterface.constr -> btype -> CoqInterface.constr
+val ord_interp : CoqInterface.constr -> btype -> CoqInterface.constr
+val comp_interp : CoqInterface.constr -> btype -> CoqInterface.constr
+val inh_interp : CoqInterface.constr -> btype -> CoqInterface.constr
+val interp : CoqInterface.constr -> btype -> CoqInterface.constr
-val interp_to_coq : reify_tbl -> btype -> Structures.constr
+val interp_to_coq : reify_tbl -> btype -> CoqInterface.constr
-val get_cuts : reify_tbl -> (Structures.id * Structures.types) list
+val get_cuts : reify_tbl -> (CoqInterface.id * CoqInterface.types) list
val logic : btype -> logic
diff --git a/src/trace/smtCertif.ml b/src/trace/smtCertif.ml
index 2ea4ca8..24cdf78 100644
--- a/src/trace/smtCertif.ml
+++ b/src/trace/smtCertif.ml
@@ -98,11 +98,11 @@ type 'hform rule =
*)
(* Linear arithmetic *)
- | LiaMicromega of 'hform list * Structures.Micromega_plugin_Certificate.Mc.zArithProof list
+ | LiaMicromega of 'hform list * CoqInterface.Micromega_plugin_Certificate.Mc.zArithProof list
| LiaDiseq of 'hform
(* Arithmetic simplifications *)
- | SplArith of 'hform clause * 'hform * Structures.Micromega_plugin_Certificate.Mc.zArithProof list
+ | SplArith of 'hform clause * 'hform * CoqInterface.Micromega_plugin_Certificate.Mc.zArithProof list
(* Elimination of operators *)
| SplDistinctElim of 'hform clause * 'hform
diff --git a/src/trace/smtCertif.mli b/src/trace/smtCertif.mli
index 7da3097..bc2da38 100644
--- a/src/trace/smtCertif.mli
+++ b/src/trace/smtCertif.mli
@@ -96,11 +96,11 @@ type 'hform rule =
*)
(* Linear arithmetic *)
- | LiaMicromega of 'hform list * Structures.Micromega_plugin_Certificate.Mc.zArithProof list
+ | LiaMicromega of 'hform list * CoqInterface.Micromega_plugin_Certificate.Mc.zArithProof list
| LiaDiseq of 'hform
(* Arithmetic simplifications *)
- | SplArith of 'hform clause * 'hform * Structures.Micromega_plugin_Certificate.Mc.zArithProof list
+ | SplArith of 'hform clause * 'hform * CoqInterface.Micromega_plugin_Certificate.Mc.zArithProof list
(* Elimination of operators *)
| SplDistinctElim of 'hform clause * 'hform
diff --git a/src/trace/smtCommands.ml b/src/trace/smtCommands.ml
index 9cfc7c4..e655a9d 100644
--- a/src/trace/smtCommands.ml
+++ b/src/trace/smtCommands.ml
@@ -115,7 +115,7 @@ let interp_conseq_uf t_i (prem, concl) =
let tf = Hashtbl.create 17 in
let rec interp = function
| [] -> mklApp cis_true [|interp_uf t_i ta tf concl|]
- | c::prem -> Term.mkArrow (mklApp cis_true [|interp_uf t_i ta tf c|]) (interp prem) in
+ | c::prem -> CoqInterface.mkArrow (mklApp cis_true [|interp_uf t_i ta tf c|]) (interp prem) in
interp prem
@@ -127,26 +127,26 @@ let print_assm ty =
let parse_certif t_i t_func t_atom t_form root used_root trace (rt, ro, ra, rf, roots, max_id, confl) =
let t_i' = make_t_i rt in
- let ce5 = Structures.mkUConst t_i' in
- let ct_i = Structures.mkConst (Structures.declare_constant t_i ce5) in
+ let ce5 = CoqInterface.mkUConst t_i' in
+ let ct_i = CoqInterface.mkConst (CoqInterface.declare_constant t_i ce5) in
let t_func' = make_t_func ro ct_i in
- let ce6 = Structures.mkUConst t_func' in
- let ct_func = Structures.mkConst (Structures.declare_constant t_func ce6) in
+ let ce6 = CoqInterface.mkUConst t_func' in
+ let ct_func = CoqInterface.mkConst (CoqInterface.declare_constant t_func ce6) in
let t_atom' = Atom.interp_tbl ra in
- let ce1 = Structures.mkUConst t_atom' in
- let ct_atom = Structures.mkConst (Structures.declare_constant t_atom ce1) in
+ let ce1 = CoqInterface.mkUConst t_atom' in
+ let ct_atom = CoqInterface.mkConst (CoqInterface.declare_constant t_atom ce1) in
let t_form' = snd (Form.interp_tbl rf) in
- let ce2 = Structures.mkUConst t_form' in
- let ct_form = Structures.mkConst (Structures.declare_constant t_form ce2) in
+ let ce2 = CoqInterface.mkUConst t_form' in
+ let ct_form = CoqInterface.mkConst (CoqInterface.declare_constant t_form ce2) in
(* EMPTY LEMMA LIST *)
let (tres, last_root, cuts) = SmtTrace.to_coq (fun i -> mkInt (Form.to_lit i))
(interp_conseq_uf ct_i) (certif_ops (Some [|ct_i; ct_func; ct_atom; ct_form|])) confl None in
List.iter (fun (v,ty) ->
- let _ = Structures.declare_new_variable v ty in
+ let _ = CoqInterface.declare_new_variable v ty in
print_assm ty
) cuts;
@@ -155,22 +155,22 @@ let parse_certif t_i t_func t_atom t_form root used_root trace (rt, ro, ra, rf,
let res = Array.make (List.length roots + 1) (mkInt 0) in
let i = ref 0 in
List.iter (fun j -> res.(!i) <- mkInt (Form.to_lit j); incr i) roots;
- Structures.mkArray (Lazy.force cint, res) in
+ CoqInterface.mkArray (Lazy.force cint, res) in
let used_roots =
let l = List.length used_roots in
let res = Array.make (l + 1) (mkInt 0) in
let i = ref (l-1) in
List.iter (fun j -> res.(!i) <- mkInt j; decr i) used_roots;
- mklApp cSome [|mklApp carray [|Lazy.force cint|]; Structures.mkArray (Lazy.force cint, res)|] in
- let ce3 = Structures.mkUConst roots in
- let _ = Structures.declare_constant root ce3 in
- let ce3' = Structures.mkUConst used_roots in
- let _ = Structures.declare_constant used_root ce3' in
+ mklApp cSome [|mklApp carray [|Lazy.force cint|]; CoqInterface.mkArray (Lazy.force cint, res)|] in
+ let ce3 = CoqInterface.mkUConst roots in
+ let _ = CoqInterface.declare_constant root ce3 in
+ let ce3' = CoqInterface.mkUConst used_roots in
+ let _ = CoqInterface.declare_constant used_root ce3' in
let certif =
mklApp cCertif [|ct_i; ct_func; ct_atom; ct_form; mkInt (max_id + 1); tres;mkInt (get_pos confl)|] in
- let ce4 = Structures.mkUConst certif in
- let _ = Structures.declare_constant trace ce4 in
+ let ce4 = CoqInterface.mkUConst certif in
+ let _ = CoqInterface.declare_constant trace ce4 in
()
@@ -184,15 +184,15 @@ let interp_roots t_i roots =
| f::roots -> List.fold_left (fun acc f -> mklApp candb [|acc; interp f|]) (interp f) roots
let theorem name (rt, ro, ra, rf, roots, max_id, confl) =
- let nti = Structures.mkName "t_i" in
- let ntfunc = Structures.mkName "t_func" in
- let ntatom = Structures.mkName "t_atom" in
- let ntform = Structures.mkName "t_form" in
- let nc = Structures.mkName "c" in
- let nused_roots = Structures.mkName "used_roots" in
- let nd = Structures.mkName "d" in
+ let nti = CoqInterface.mkName "t_i" in
+ let ntfunc = CoqInterface.mkName "t_func" in
+ let ntatom = CoqInterface.mkName "t_atom" in
+ let ntform = CoqInterface.mkName "t_form" in
+ let nc = CoqInterface.mkName "c" in
+ let nused_roots = CoqInterface.mkName "used_roots" in
+ let nd = CoqInterface.mkName "d" in
- let v = Structures.mkRel in
+ let v = CoqInterface.mkRel in
let t_i = make_t_i rt in
let t_func = make_t_func ro (v 1 (*t_i*)) in
@@ -204,7 +204,7 @@ let theorem name (rt, ro, ra, rf, roots, max_id, confl) =
(interp_conseq_uf t_i)
(certif_ops (Some [|v 4(*t_i*); v 3(*t_func*); v 2(*t_atom*); v 1(* t_form *)|])) confl None in
List.iter (fun (v,ty) ->
- let _ = Structures.declare_new_variable v ty in
+ let _ = CoqInterface.declare_new_variable v ty in
print_assm ty
) cuts;
@@ -217,59 +217,59 @@ let theorem name (rt, ro, ra, rf, roots, max_id, confl) =
let res = Array.make (l + 1) (mkInt 0) in
let i = ref (l-1) in
List.iter (fun j -> res.(!i) <- mkInt j; decr i) used_roots;
- mklApp cSome [|mklApp carray [|Lazy.force cint|]; Structures.mkArray (Lazy.force cint, res)|] in
+ mklApp cSome [|mklApp carray [|Lazy.force cint|]; CoqInterface.mkArray (Lazy.force cint, res)|] in
let rootsCstr =
let res = Array.make (List.length roots + 1) (mkInt 0) in
let i = ref 0 in
List.iter (fun j -> res.(!i) <- mkInt (Form.to_lit j); incr i) roots;
- Structures.mkArray (Lazy.force cint, res) in
+ CoqInterface.mkArray (Lazy.force cint, res) in
let theorem_concl = mklApp cnot [|mklApp cis_true [|interp_roots t_i roots|]|] in
let theorem_proof_cast =
- Structures.mkCast (
- Structures.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
- Structures.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(* t_i *)|]|],
- Structures.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
- Structures.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
- Structures.mkLetIn (nc, certif, mklApp ccertif [|v 4 (*t_i*); v 3 (*t_func*); v 2 (*t_atom*); v 1 (*t_form*)|],
- Structures.mkLetIn (nused_roots, used_rootsCstr, mklApp coption [|mklApp carray [|Lazy.force cint|]|],
- Structures.mkLetIn (nd, rootsCstr, mklApp carray [|Lazy.force cint|],
+ CoqInterface.mkCast (
+ CoqInterface.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
+ CoqInterface.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(* t_i *)|]|],
+ CoqInterface.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
+ CoqInterface.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
+ CoqInterface.mkLetIn (nc, certif, mklApp ccertif [|v 4 (*t_i*); v 3 (*t_func*); v 2 (*t_atom*); v 1 (*t_form*)|],
+ CoqInterface.mkLetIn (nused_roots, used_rootsCstr, mklApp coption [|mklApp carray [|Lazy.force cint|]|],
+ CoqInterface.mkLetIn (nd, rootsCstr, mklApp carray [|Lazy.force cint|],
mklApp cchecker_correct
[|v 7 (*t_i*); v 6 (*t_func*); v 5 (*t_atom*); v 4 (*t_form*); v 1 (*d*); v 2 (*used_roots*); v 3 (*c*);
vm_cast_true_no_check
(mklApp cchecker [|v 7 (*t_i*); v 6 (*t_func*); v 5 (*t_atom*); v 4 (*t_form*); v 1 (*d*); v 2 (*used_roots*); v 3 (*c*)|])|]))))))),
- Structures.vmcast,
+ CoqInterface.vmcast,
theorem_concl)
in
let theorem_proof_nocast =
- Structures.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
- Structures.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(* t_i *)|]|],
- Structures.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
- Structures.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
- Structures.mkLetIn (nc, certif, mklApp ccertif [|v 4 (*t_i*); v 3 (*t_func*); v 2 (*t_atom*); v 1 (*t_form*)|],
- Structures.mkLetIn (nused_roots, used_rootsCstr, mklApp coption [|mklApp carray [|Lazy.force cint|]|],
- Structures.mkLetIn (nd, rootsCstr, mklApp carray [|Lazy.force cint|],
+ CoqInterface.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
+ CoqInterface.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(* t_i *)|]|],
+ CoqInterface.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
+ CoqInterface.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
+ CoqInterface.mkLetIn (nc, certif, mklApp ccertif [|v 4 (*t_i*); v 3 (*t_func*); v 2 (*t_atom*); v 1 (*t_form*)|],
+ CoqInterface.mkLetIn (nused_roots, used_rootsCstr, mklApp coption [|mklApp carray [|Lazy.force cint|]|],
+ CoqInterface.mkLetIn (nd, rootsCstr, mklApp carray [|Lazy.force cint|],
mklApp cchecker_correct
[|v 7 (*t_i*); v 6 (*t_func*); v 5 (*t_atom*); v 4 (*t_form*); v 1 (*d*); v 2 (*used_roots*); v 3 (*c*)|])))))))
in
- let ce = Structures.mkTConst theorem_proof_cast theorem_proof_nocast theorem_concl in
- let _ = Structures.declare_constant name ce in
+ let ce = CoqInterface.mkTConst theorem_proof_cast theorem_proof_nocast theorem_concl in
+ let _ = CoqInterface.declare_constant name ce in
()
(* Given an SMT-LIB2 file and a certif, call the checker *)
let checker (rt, ro, ra, rf, roots, max_id, confl) =
- let nti = Structures.mkName "t_i" in
- let ntfunc = Structures.mkName "t_func" in
- let ntatom = Structures.mkName "t_atom" in
- let ntform = Structures.mkName "t_form" in
- let nc = Structures.mkName "c" in
- let nused_roots = Structures.mkName "used_roots" in
- let nd = Structures.mkName "d" in
+ let nti = CoqInterface.mkName "t_i" in
+ let ntfunc = CoqInterface.mkName "t_func" in
+ let ntatom = CoqInterface.mkName "t_atom" in
+ let ntform = CoqInterface.mkName "t_form" in
+ let nc = CoqInterface.mkName "c" in
+ let nused_roots = CoqInterface.mkName "used_roots" in
+ let nd = CoqInterface.mkName "d" in
- let v = Structures.mkRel in
+ let v = CoqInterface.mkRel in
let t_i = make_t_i rt in
let t_func = make_t_func ro (v 1 (*t_i*)) in
@@ -281,7 +281,7 @@ let checker (rt, ro, ra, rf, roots, max_id, confl) =
(interp_conseq_uf t_i)
(certif_ops (Some [|v 4(*t_i*); v 3(*t_func*); v 2(*t_atom*); v 1(* t_form *)|])) confl None in
List.iter (fun (v,ty) ->
- let _ = Structures.declare_new_variable v ty in
+ let _ = CoqInterface.declare_new_variable v ty in
print_assm ty
) cuts;
@@ -294,26 +294,26 @@ let checker (rt, ro, ra, rf, roots, max_id, confl) =
let res = Array.make (l + 1) (mkInt 0) in
let i = ref (l-1) in
List.iter (fun j -> res.(!i) <- mkInt j; decr i) used_roots;
- mklApp cSome [|mklApp carray [|Lazy.force cint|]; Structures.mkArray (Lazy.force cint, res)|] in
+ mklApp cSome [|mklApp carray [|Lazy.force cint|]; CoqInterface.mkArray (Lazy.force cint, res)|] in
let rootsCstr =
let res = Array.make (List.length roots + 1) (mkInt 0) in
let i = ref 0 in
List.iter (fun j -> res.(!i) <- mkInt (Form.to_lit j); incr i) roots;
- Structures.mkArray (Lazy.force cint, res) in
+ CoqInterface.mkArray (Lazy.force cint, res) in
let tm =
- Structures.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
- Structures.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(* t_i *)|]|],
- Structures.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
- Structures.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
- Structures.mkLetIn (nc, certif, mklApp ccertif [|v 4 (*t_i*); v 3 (*t_func*); v 2 (*t_atom*); v 1 (*t_form*)|],
- Structures.mkLetIn (nused_roots, used_rootsCstr, mklApp coption [|mklApp carray [|Lazy.force cint|]|],
- Structures.mkLetIn (nd, rootsCstr, mklApp carray [|Lazy.force cint|],
+ CoqInterface.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
+ CoqInterface.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(* t_i *)|]|],
+ CoqInterface.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
+ CoqInterface.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
+ CoqInterface.mkLetIn (nc, certif, mklApp ccertif [|v 4 (*t_i*); v 3 (*t_func*); v 2 (*t_atom*); v 1 (*t_form*)|],
+ CoqInterface.mkLetIn (nused_roots, used_rootsCstr, mklApp coption [|mklApp carray [|Lazy.force cint|]|],
+ CoqInterface.mkLetIn (nd, rootsCstr, mklApp carray [|Lazy.force cint|],
mklApp cchecker [|v 7 (*t_i*); v 6 (*t_func*); v 5 (*t_atom*); v 4 (*t_form*); v 1 (*d*); v 2 (*used_roots*); v 3 (*c*)|]))))))) in
- let res = Structures.cbv_vm (Global.env ()) tm (Lazy.force CoqTerms.cbool) in
+ let res = CoqInterface.cbv_vm (Global.env ()) tm (Lazy.force CoqTerms.cbool) in
Format.eprintf " = %s\n : bool@."
- (if Structures.eq_constr res (Lazy.force CoqTerms.ctrue) then
+ (if CoqInterface.eq_constr res (Lazy.force CoqTerms.ctrue) then
"true" else "false")
let count_used confl =
@@ -329,15 +329,15 @@ let count_used confl =
let checker_debug (rt, ro, ra, rf, roots, max_id, confl) =
- let nti = Structures.mkName "t_i" in
- let ntfunc = Structures.mkName "t_func" in
- let ntatom = Structures.mkName "t_atom" in
- let ntform = Structures.mkName "t_form" in
- let nc = Structures.mkName "c" in
- let nused_roots = Structures.mkName "used_roots" in
- let nd = Structures.mkName "d" in
+ let nti = CoqInterface.mkName "t_i" in
+ let ntfunc = CoqInterface.mkName "t_func" in
+ let ntatom = CoqInterface.mkName "t_atom" in
+ let ntform = CoqInterface.mkName "t_form" in
+ let nc = CoqInterface.mkName "c" in
+ let nused_roots = CoqInterface.mkName "used_roots" in
+ let nd = CoqInterface.mkName "d" in
- let v = Structures.mkRel in
+ let v = CoqInterface.mkRel in
let t_i = make_t_i rt in
let t_func = make_t_func ro (v 1 (*t_i*)) in
@@ -349,7 +349,7 @@ let checker_debug (rt, ro, ra, rf, roots, max_id, confl) =
(certif_ops (Some [|v 4(*t_i*); v 3(*t_func*);
v 2(*t_atom*); v 1(* t_form *)|])) confl None in
List.iter (fun (v,ty) ->
- let _ = Structures.declare_new_variable v ty in
+ let _ = CoqInterface.declare_new_variable v ty in
print_assm ty
) cuts;
@@ -364,84 +364,84 @@ let checker_debug (rt, ro, ra, rf, roots, max_id, confl) =
let i = ref (l-1) in
List.iter (fun j -> res.(!i) <- mkInt j; decr i) used_roots;
mklApp cSome [|mklApp carray [|Lazy.force cint|];
- Structures.mkArray (Lazy.force cint, res)|] in
+ CoqInterface.mkArray (Lazy.force cint, res)|] in
let rootsCstr =
let res = Array.make (List.length roots + 1) (mkInt 0) in
let i = ref 0 in
List.iter (fun j -> res.(!i) <- mkInt (Form.to_lit j); incr i) roots;
- Structures.mkArray (Lazy.force cint, res) in
+ CoqInterface.mkArray (Lazy.force cint, res) in
let tm =
- Structures.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
- Structures.mkLetIn (ntfunc, t_func,
+ CoqInterface.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
+ CoqInterface.mkLetIn (ntfunc, t_func,
mklApp carray [|mklApp ctval [|v 1(* t_i *)|]|],
- Structures.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
- Structures.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
- Structures.mkLetIn (nc, certif, mklApp ccertif [|v 4 (*t_i*); v 3 (*t_func*);
+ CoqInterface.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
+ CoqInterface.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
+ CoqInterface.mkLetIn (nc, certif, mklApp ccertif [|v 4 (*t_i*); v 3 (*t_func*);
v 2 (*t_atom*); v 1 (*t_form*)|],
- Structures.mkLetIn (nused_roots, used_rootsCstr,
+ CoqInterface.mkLetIn (nused_roots, used_rootsCstr,
mklApp coption [|mklApp carray [|Lazy.force cint|]|],
- Structures.mkLetIn (nd, rootsCstr, mklApp carray [|Lazy.force cint|],
+ CoqInterface.mkLetIn (nd, rootsCstr, mklApp carray [|Lazy.force cint|],
mklApp cchecker_debug [|v 7 (*t_i*); v 6 (*t_func*); v 5 (*t_atom*);
v 4 (*t_form*); v 1 (*d*); v 2 (*used_roots*); v 3 (*c*)|]))))))) in
- let res = Structures.cbv_vm (Global.env ()) tm
+ let res = CoqInterface.cbv_vm (Global.env ()) tm
(mklApp coption
[|mklApp cprod
[|Lazy.force cnat; Lazy.force cname_step|]|]) in
- match Structures.decompose_app res with
- | c, _ when Structures.eq_constr c (Lazy.force cNone) ->
- Structures.error ("Debug checker is only meant to be used for certificates \
+ match CoqInterface.decompose_app res with
+ | c, _ when CoqInterface.eq_constr c (Lazy.force cNone) ->
+ CoqInterface.error ("Debug checker is only meant to be used for certificates \
that fail to be checked by SMTCoq.")
- | c, [_; n] when Structures.eq_constr c (Lazy.force cSome) ->
- (match Structures.decompose_app n with
- | c, [_; _; cnb; cn] when Structures.eq_constr c (Lazy.force cpair) ->
- let n = fst (Structures.decompose_app cn) in
+ | c, [_; n] when CoqInterface.eq_constr c (Lazy.force cSome) ->
+ (match CoqInterface.decompose_app n with
+ | c, [_; _; cnb; cn] when CoqInterface.eq_constr c (Lazy.force cpair) ->
+ let n = fst (CoqInterface.decompose_app cn) in
let name =
- if Structures.eq_constr n (Lazy.force cName_Res ) then "Res"
- else if Structures.eq_constr n (Lazy.force cName_Weaken) then "Weaken"
- else if Structures.eq_constr n (Lazy.force cName_ImmFlatten) then "ImmFlatten"
- else if Structures.eq_constr n (Lazy.force cName_CTrue) then "CTrue"
- else if Structures.eq_constr n (Lazy.force cName_CFalse ) then "CFalse"
- else if Structures.eq_constr n (Lazy.force cName_BuildDef) then "BuildDef"
- else if Structures.eq_constr n (Lazy.force cName_BuildDef2) then "BuildDef2"
- else if Structures.eq_constr n (Lazy.force cName_BuildProj ) then "BuildProj"
- else if Structures.eq_constr n (Lazy.force cName_ImmBuildDef) then "ImmBuildDef"
- else if Structures.eq_constr n (Lazy.force cName_ImmBuildDef2) then "ImmBuildDef2"
- else if Structures.eq_constr n (Lazy.force cName_ImmBuildProj ) then "ImmBuildProj"
- else if Structures.eq_constr n (Lazy.force cName_EqTr ) then "EqTr"
- else if Structures.eq_constr n (Lazy.force cName_EqCgr ) then "EqCgr"
- else if Structures.eq_constr n (Lazy.force cName_EqCgrP) then "EqCgrP"
- else if Structures.eq_constr n (Lazy.force cName_LiaMicromega ) then "LiaMicromega"
- else if Structures.eq_constr n (Lazy.force cName_LiaDiseq) then "LiaDiseq"
- else if Structures.eq_constr n (Lazy.force cName_SplArith) then "SplArith"
- else if Structures.eq_constr n (Lazy.force cName_SplDistinctElim ) then "SplDistinctElim"
- else if Structures.eq_constr n (Lazy.force cName_BBVar) then "BBVar"
- else if Structures.eq_constr n (Lazy.force cName_BBConst) then "BBConst"
- else if Structures.eq_constr n (Lazy.force cName_BBOp) then "BBOp"
- else if Structures.eq_constr n (Lazy.force cName_BBNot) then "BBNot"
- else if Structures.eq_constr n (Lazy.force cName_BBNeg) then "BBNeg"
- else if Structures.eq_constr n (Lazy.force cName_BBAdd) then "BBAdd"
- else if Structures.eq_constr n (Lazy.force cName_BBConcat) then "BBConcat"
- else if Structures.eq_constr n (Lazy.force cName_BBMul) then "BBMul"
- else if Structures.eq_constr n (Lazy.force cName_BBUlt) then "BBUlt"
- else if Structures.eq_constr n (Lazy.force cName_BBSlt) then "BBSlt"
- else if Structures.eq_constr n (Lazy.force cName_BBEq) then "BBEq"
- else if Structures.eq_constr n (Lazy.force cName_BBDiseq) then "BBDiseq"
- else if Structures.eq_constr n (Lazy.force cName_BBExtract) then "BBExtract"
- else if Structures.eq_constr n (Lazy.force cName_BBZextend) then "BBZextend"
- else if Structures.eq_constr n (Lazy.force cName_BBSextend) then "BBSextend"
- else if Structures.eq_constr n (Lazy.force cName_BBShl) then "BBShl"
- else if Structures.eq_constr n (Lazy.force cName_BBShr) then "BBShr"
- else if Structures.eq_constr n (Lazy.force cName_RowEq) then "RowEq"
- else if Structures.eq_constr n (Lazy.force cName_RowNeq) then "RowNeq"
- else if Structures.eq_constr n (Lazy.force cName_Ext) then "Ext"
- else if Structures.eq_constr n (Lazy.force cName_Hole) then "Hole"
+ if CoqInterface.eq_constr n (Lazy.force cName_Res ) then "Res"
+ else if CoqInterface.eq_constr n (Lazy.force cName_Weaken) then "Weaken"
+ else if CoqInterface.eq_constr n (Lazy.force cName_ImmFlatten) then "ImmFlatten"
+ else if CoqInterface.eq_constr n (Lazy.force cName_CTrue) then "CTrue"
+ else if CoqInterface.eq_constr n (Lazy.force cName_CFalse ) then "CFalse"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BuildDef) then "BuildDef"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BuildDef2) then "BuildDef2"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BuildProj ) then "BuildProj"
+ else if CoqInterface.eq_constr n (Lazy.force cName_ImmBuildDef) then "ImmBuildDef"
+ else if CoqInterface.eq_constr n (Lazy.force cName_ImmBuildDef2) then "ImmBuildDef2"
+ else if CoqInterface.eq_constr n (Lazy.force cName_ImmBuildProj ) then "ImmBuildProj"
+ else if CoqInterface.eq_constr n (Lazy.force cName_EqTr ) then "EqTr"
+ else if CoqInterface.eq_constr n (Lazy.force cName_EqCgr ) then "EqCgr"
+ else if CoqInterface.eq_constr n (Lazy.force cName_EqCgrP) then "EqCgrP"
+ else if CoqInterface.eq_constr n (Lazy.force cName_LiaMicromega ) then "LiaMicromega"
+ else if CoqInterface.eq_constr n (Lazy.force cName_LiaDiseq) then "LiaDiseq"
+ else if CoqInterface.eq_constr n (Lazy.force cName_SplArith) then "SplArith"
+ else if CoqInterface.eq_constr n (Lazy.force cName_SplDistinctElim ) then "SplDistinctElim"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBVar) then "BBVar"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBConst) then "BBConst"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBOp) then "BBOp"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBNot) then "BBNot"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBNeg) then "BBNeg"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBAdd) then "BBAdd"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBConcat) then "BBConcat"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBMul) then "BBMul"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBUlt) then "BBUlt"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBSlt) then "BBSlt"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBEq) then "BBEq"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBDiseq) then "BBDiseq"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBExtract) then "BBExtract"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBZextend) then "BBZextend"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBSextend) then "BBSextend"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBShl) then "BBShl"
+ else if CoqInterface.eq_constr n (Lazy.force cName_BBShr) then "BBShr"
+ else if CoqInterface.eq_constr n (Lazy.force cName_RowEq) then "RowEq"
+ else if CoqInterface.eq_constr n (Lazy.force cName_RowNeq) then "RowNeq"
+ else if CoqInterface.eq_constr n (Lazy.force cName_Ext) then "Ext"
+ else if CoqInterface.eq_constr n (Lazy.force cName_Hole) then "Hole"
else string_coq_constr n
in
let nb = mk_nat cnb + List.length roots + (confl.id + 1 - count_used confl) in
- Structures.error ("Step number " ^ string_of_int nb ^
+ CoqInterface.error ("Step number " ^ string_of_int nb ^
" (" ^ name ^ ") of the certificate likely failed.")
| _ -> assert false
)
@@ -450,9 +450,9 @@ let checker_debug (rt, ro, ra, rf, roots, max_id, confl) =
(* let rec of_coq_list cl =
- * match Structures.decompose_app cl with
- * | c, _ when Structures.eq_constr c (Lazy.force cnil) -> []
- * | c, [_; x; cr] when Structures.eq_constr c (Lazy.force ccons) ->
+ * match CoqInterface.decompose_app cl with
+ * | c, _ when CoqInterface.eq_constr c (Lazy.force cnil) -> []
+ * | c, [_; x; cr] when CoqInterface.eq_constr c (Lazy.force ccons) ->
* x :: of_coq_list cr
* | _ -> assert false *)
@@ -461,29 +461,29 @@ let checker_debug (rt, ro, ra, rf, roots, max_id, confl) =
* (rt, ro, ra, rf, roots, max_id, confl) =
*
* let t_i' = make_t_i rt in
- * let ce5 = Structures.mkUConst t_i' in
- * let ct_i = Structures.mkConst (Structures.declare_constant t_i ce5) in
+ * let ce5 = CoqInterface.mkUConst t_i' in
+ * let ct_i = CoqInterface.mkConst (CoqInterface.declare_constant t_i ce5) in
*
* let t_func' = make_t_func ro ct_i in
- * let ce6 = Structures.mkUConst t_func' in
+ * let ce6 = CoqInterface.mkUConst t_func' in
* let ct_func =
- * Structures.mkConst (Structures.declare_constant t_func ce6) in
+ * CoqInterface.mkConst (CoqInterface.declare_constant t_func ce6) in
*
* let t_atom' = Atom.interp_tbl ra in
- * let ce1 = Structures.mkUConst t_atom' in
+ * let ce1 = CoqInterface.mkUConst t_atom' in
* let ct_atom =
- * Structures.mkConst (Structures.declare_constant t_atom ce1) in
+ * CoqInterface.mkConst (CoqInterface.declare_constant t_atom ce1) in
*
* let t_form' = snd (Form.interp_tbl rf) in
- * let ce2 = Structures.mkUConst t_form' in
+ * let ce2 = CoqInterface.mkUConst t_form' in
* let ct_form =
- * Structures.mkConst (Structures.declare_constant t_form ce2) in
+ * CoqInterface.mkConst (CoqInterface.declare_constant t_form ce2) in
*
* let (tres, last_root, cuts) = SmtTrace.to_coq (fun i -> mkInt (Form.to_lit i))
* (interp_conseq_uf ct_i)
* (certif_ops (Some [|ct_i; ct_func; ct_atom; ct_form|])) confl None in
* List.iter (fun (v,ty) ->
- * let _ = Structures.declare_new_variable v ty in
+ * let _ = CoqInterface.declare_new_variable v ty in
* print_assm ty
* ) cuts;
*
@@ -492,37 +492,37 @@ let checker_debug (rt, ro, ra, rf, roots, max_id, confl) =
* let res = Array.make (List.length roots + 1) (mkInt 0) in
* let i = ref 0 in
* List.iter (fun j -> res.(!i) <- mkInt (Form.to_lit j); incr i) roots;
- * Structures.mkArray (Lazy.force cint, res) in
+ * CoqInterface.mkArray (Lazy.force cint, res) in
* let cused_roots =
* let l = List.length used_roots in
* let res = Array.make (l + 1) (mkInt 0) in
* let i = ref (l-1) in
* List.iter (fun j -> res.(!i) <- mkInt j; decr i) used_roots;
* mklApp cSome [|mklApp carray [|Lazy.force cint|];
- * Structures.mkArray (Lazy.force cint, res)|] in
- * let ce3 = Structures.mkUConst croots in
- * let _ = Structures.declare_constant root ce3 in
- * let ce3' = Structures.mkUConst cused_roots in
- * let _ = Structures.declare_constant used_root ce3' in
+ * CoqInterface.mkArray (Lazy.force cint, res)|] in
+ * let ce3 = CoqInterface.mkUConst croots in
+ * let _ = CoqInterface.declare_constant root ce3 in
+ * let ce3' = CoqInterface.mkUConst cused_roots in
+ * let _ = CoqInterface.declare_constant used_root ce3' in
*
* let certif =
* mklApp cCertif [|ct_i; ct_func; ct_atom; ct_form; mkInt (max_id + 1);
* tres;mkInt (get_pos confl)|] in
- * let ce4 = Structures.mkUConst certif in
- * let _ = Structures.declare_constant trace ce4 in
+ * let ce4 = CoqInterface.mkUConst certif in
+ * let _ = CoqInterface.declare_constant trace ce4 in
*
* let setup =
* mklApp csetup_checker_step_debug
* [| ct_i; ct_func; ct_atom; ct_form; croots; cused_roots; certif |] in
*
- * let setup = Structures.cbv_vm (Global.env ()) setup
+ * let setup = CoqInterface.cbv_vm (Global.env ()) setup
* (mklApp cprod
* [|Lazy.force cState_S_t;
* mklApp clist [|mklApp cstep
* [|ct_i; ct_func; ct_atom; ct_form|]|]|]) in
*
- * let s, steps = match Structures.decompose_app setup with
- * | c, [_; _; s; csteps] when Structures.eq_constr c (Lazy.force cpair) ->
+ * let s, steps = match CoqInterface.decompose_app setup with
+ * | c, [_; _; s; csteps] when CoqInterface.eq_constr c (Lazy.force cpair) ->
* s, of_coq_list csteps
* | _ -> assert false
* in
@@ -536,22 +536,22 @@ let checker_debug (rt, ro, ra, rf, roots, max_id, confl) =
* [| ct_i; ct_func; ct_atom; ct_form; s; step |] in
*
* let res =
- * Structures.cbv_vm (Global.env ()) tm
+ * CoqInterface.cbv_vm (Global.env ()) tm
* (mklApp cprod [|Lazy.force cState_S_t; Lazy.force cbool|]) in
*
- * match Structures.decompose_app res with
- * | c, [_; _; s; cbad] when Structures.eq_constr c (Lazy.force cpair) ->
+ * match CoqInterface.decompose_app res with
+ * | c, [_; _; s; cbad] when CoqInterface.eq_constr c (Lazy.force cpair) ->
* if not (mk_bool cbad) then s
- * else Structures.error ("Step number " ^ string_of_int !cpt ^
+ * else CoqInterface.error ("Step number " ^ string_of_int !cpt ^
* " (" ^ string_coq_constr
- * (fst (Structures.decompose_app step)) ^ ")" ^
+ * (fst (CoqInterface.decompose_app step)) ^ ")" ^
* " of the certificate likely failed." )
* | _ -> assert false
* in
*
* List.fold_left debug_step s steps |> ignore;
*
- * Structures.error ("Debug checker is only meant to be used for certificates \
+ * CoqInterface.error ("Debug checker is only meant to be used for certificates \
* that fail to be checked by SMTCoq.") *)
@@ -559,16 +559,16 @@ let checker_debug (rt, ro, ra, rf, roots, max_id, confl) =
(* Tactic *)
let build_body rt ro ra rf l b (max_id, confl) vm_cast find =
- let nti = Structures.mkName "t_i" in
- let ntfunc = Structures.mkName "t_func" in
- let ntatom = Structures.mkName "t_atom" in
- let ntform = Structures.mkName "t_form" in
- let nc = Structures.mkName "c" in
+ let nti = CoqInterface.mkName "t_i" in
+ let ntfunc = CoqInterface.mkName "t_func" in
+ let ntatom = CoqInterface.mkName "t_atom" in
+ let ntform = CoqInterface.mkName "t_form" in
+ let nc = CoqInterface.mkName "c" in
- let v = Structures.mkRel in
+ let v = CoqInterface.mkRel in
let t_i = make_t_i rt in
- let t_func = Structures.lift 1 (make_t_func ro (v 0 (*t_i - 1*))) in
+ let t_func = CoqInterface.lift 1 (make_t_func ro (v 0 (*t_i - 1*))) in
let t_atom = Atom.interp_tbl ra in
let t_form = snd (Form.interp_tbl rf) in
let (tres,_,cuts) = SmtTrace.to_coq Form.to_coq
@@ -583,11 +583,11 @@ let build_body rt ro ra rf l b (max_id, confl) vm_cast find =
mkInt (max_id + 1); tres;mkInt (get_pos confl)|] in
let add_lets t =
- Structures.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
- Structures.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(*t_i*)|]|],
- Structures.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
- Structures.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
- Structures.mkLetIn (nc, certif, mklApp ccertif
+ CoqInterface.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
+ CoqInterface.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(*t_i*)|]|],
+ CoqInterface.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
+ CoqInterface.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
+ CoqInterface.mkLetIn (nc, certif, mklApp ccertif
[|v 4 (*t_i*); v 3 (*t_func*); v 2 (*t_atom*); v 1 (*t_form*)|],
t))))) in
@@ -614,16 +614,16 @@ let build_body rt ro ra rf l b (max_id, confl) vm_cast find =
let build_body_eq rt ro ra rf l1 l2 l (max_id, confl) vm_cast find =
- let nti = Structures.mkName "t_i" in
- let ntfunc = Structures.mkName "t_func" in
- let ntatom = Structures.mkName "t_atom" in
- let ntform = Structures.mkName "t_form" in
- let nc = Structures.mkName "c" in
+ let nti = CoqInterface.mkName "t_i" in
+ let ntfunc = CoqInterface.mkName "t_func" in
+ let ntatom = CoqInterface.mkName "t_atom" in
+ let ntform = CoqInterface.mkName "t_form" in
+ let nc = CoqInterface.mkName "c" in
- let v = Structures.mkRel in
+ let v = CoqInterface.mkRel in
let t_i = make_t_i rt in
- let t_func = Structures.lift 1 (make_t_func ro (v 0 (*t_i*))) in
+ let t_func = CoqInterface.lift 1 (make_t_func ro (v 0 (*t_i*))) in
let t_atom = Atom.interp_tbl ra in
let t_form = snd (Form.interp_tbl rf) in
let (tres,_,cuts) = SmtTrace.to_coq Form.to_coq
@@ -633,11 +633,11 @@ let build_body_eq rt ro ra rf l1 l2 l (max_id, confl) vm_cast find =
mklApp cCertif [|v 4 (*t_i*); v 3 (*t_func*); v 2 (*t_atom*); v 1 (*t_form*); mkInt (max_id + 1); tres;mkInt (get_pos confl)|] in
let add_lets t =
- Structures.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
- Structures.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(*t_i*)|]|],
- Structures.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
- Structures.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
- Structures.mkLetIn (nc, certif, mklApp ccertif
+ CoqInterface.mkLetIn (nti, t_i, mklApp carray [|Lazy.force ctyp_compdec|],
+ CoqInterface.mkLetIn (ntfunc, t_func, mklApp carray [|mklApp ctval [|v 1(*t_i*)|]|],
+ CoqInterface.mkLetIn (ntatom, t_atom, mklApp carray [|Lazy.force catom|],
+ CoqInterface.mkLetIn (ntform, t_form, mklApp carray [|Lazy.force cform|],
+ CoqInterface.mkLetIn (nc, certif, mklApp ccertif
[|v 4 (*t_i*); v 3 (*t_func*); v 2 (*t_atom*); v 1 (*t_form*)|],
t))))) in
@@ -665,10 +665,10 @@ let build_body_eq rt ro ra rf l1 l2 l (max_id, confl) vm_cast find =
let get_arguments concl =
- let f, args = Structures.decompose_app concl in
+ let f, args = CoqInterface.decompose_app concl in
match args with
- | [ty;a;b] when (Structures.eq_constr f (Lazy.force ceq)) && (Structures.eq_constr ty (Lazy.force cbool)) -> a, b
- | [a] when (Structures.eq_constr f (Lazy.force cis_true)) -> a, Lazy.force ctrue
+ | [ty;a;b] when (CoqInterface.eq_constr f (Lazy.force ceq)) && (CoqInterface.eq_constr ty (Lazy.force cbool)) -> a, b
+ | [a] when (CoqInterface.eq_constr f (Lazy.force cis_true)) -> a, Lazy.force ctrue
| _ -> failwith ("Verit.tactic: can only deal with equality over bool")
@@ -689,7 +689,7 @@ let gen_rel_name =
let of_coq_lemma rt ro ra_quant rf_quant env sigma solver_logic clemma =
let warn () =
- Structures.warning "Lemma" ("Discarding the following lemma (unsupported): "^(Pp.string_of_ppcmds (Ppconstr.pr_constr_expr (Structures.extern_constr clemma))));
+ CoqInterface.warning "Lemma" ("Discarding the following lemma (unsupported): "^(Pp.string_of_ppcmds (Ppconstr.pr_constr_expr Environ.empty_env Evd.empty (CoqInterface.extern_constr clemma))));
None
in
@@ -698,16 +698,16 @@ let of_coq_lemma rt ro ra_quant rf_quant env sigma solver_logic clemma =
let rel_context = List.map (fun rel -> Context.Rel.Declaration.set_name (Names.Name.mk_name (Names.Id.of_string (gen_rel_name ()))) rel) rel_context in
let env_lemma = Environ.push_rel_context rel_context env in
- let f, args = Structures.decompose_app qf_lemma in
+ let f, args = CoqInterface.decompose_app qf_lemma in
let core_f =
- if Structures.eq_constr f (Lazy.force cis_true) then
+ if CoqInterface.eq_constr f (Lazy.force cis_true) then
match args with
| [a] -> Some a
| _ -> warn ()
- else if Structures.eq_constr f (Lazy.force ceq) then
+ else if CoqInterface.eq_constr f (Lazy.force ceq) then
match args with
- | [ty; arg1; arg2] when Structures.eq_constr ty (Lazy.force cbool) &&
- Structures.eq_constr arg2 (Lazy.force ctrue) ->
+ | [ty; arg1; arg2] when CoqInterface.eq_constr ty (Lazy.force cbool) &&
+ CoqInterface.eq_constr arg2 (Lazy.force ctrue) ->
Some arg1
| _ -> warn ()
else warn () in
@@ -722,8 +722,8 @@ let of_coq_lemma rt ro ra_quant rf_quant env sigma solver_logic clemma =
| None -> None
in
let forall_args =
- let fmap r = let n, t = Structures.destruct_rel_decl r in
- Structures.string_of_name n, SmtBtype.of_coq rt solver_logic t in
+ let fmap r = let n, t = CoqInterface.destruct_rel_decl r in
+ CoqInterface.string_of_name n, SmtBtype.of_coq rt solver_logic t in
List.map fmap rel_context
in
match forall_args with
@@ -736,11 +736,11 @@ let of_coq_lemma rt ro ra_quant rf_quant env sigma solver_logic clemma =
let core_tactic call_solver solver_logic rt ro ra rf ra_quant rf_quant vm_cast lcpl lcepl env sigma concl =
let a, b = get_arguments concl in
- let tlcepl = List.map (Structures.interp_constr env sigma) lcepl in
+ let tlcepl = List.map (CoqInterface.interp_constr env sigma) lcepl in
let lcpl = lcpl @ tlcepl in
let create_lemma l =
- let cl = Structures.retyping_get_type_of env sigma l in
+ let cl = CoqInterface.retyping_get_type_of env sigma l in
match of_coq_lemma rt ro ra_quant rf_quant env sigma solver_logic cl with
| Some smt -> Some ((cl, l), smt)
| None -> None
@@ -748,7 +748,7 @@ let core_tactic call_solver solver_logic rt ro ra rf ra_quant rf_quant vm_cast l
let l_pl_ls = SmtMisc.filter_map create_lemma lcpl in
let lsmt = List.map snd l_pl_ls in
- let lem_tbl : (int, Structures.constr * Structures.constr) Hashtbl.t =
+ let lem_tbl : (int, CoqInterface.constr * CoqInterface.constr) Hashtbl.t =
Hashtbl.create 100 in
let new_ref ((l, pl), ls) =
Hashtbl.add lem_tbl (Form.index ls) (l, pl) in
@@ -770,11 +770,11 @@ let core_tactic call_solver solver_logic rt ro ra rf ra_quant rf_quant vm_cast l
| _ -> failwith "unexpected form of root" in
let (body_cast, body_nocast, cuts) =
- if ((Structures.eq_constr b (Lazy.force ctrue)) ||
- (Structures.eq_constr b (Lazy.force cfalse))) then (
+ if ((CoqInterface.eq_constr b (Lazy.force ctrue)) ||
+ (CoqInterface.eq_constr b (Lazy.force cfalse))) then (
let l = Form.of_coq (Atom.of_coq rt ro ra solver_logic env sigma) rf a in
let _ = Form.of_coq (Atom.of_coq ~eqsym:true rt ro ra_quant solver_logic env sigma) rf_quant a in
- let nl = if (Structures.eq_constr b (Lazy.force ctrue)) then Form.neg l else l in
+ let nl = if (CoqInterface.eq_constr b (Lazy.force ctrue)) then Form.neg l else l in
let lsmt = Form.flatten rf nl :: lsmt in
let max_id_confl = make_proof call_solver env rt ro ra_quant rf_quant nl lsmt in
build_body rt ro ra rf (Form.to_coq l) b max_id_confl (vm_cast env) (Some find_lemma)
@@ -793,19 +793,19 @@ let core_tactic call_solver solver_logic rt ro ra rf ra_quant rf_quant vm_cast l
let cuts = (SmtBtype.get_cuts rt) @ cuts in
List.fold_right (fun (eqn, eqt) tac ->
- Structures.tclTHENLAST
- (Structures.assert_before (Structures.name_of_id eqn) eqt)
+ CoqInterface.tclTHENLAST
+ (CoqInterface.assert_before (CoqInterface.name_of_id eqn) eqt)
tac
) cuts
- (Structures.tclTHEN
- (Structures.set_evars_tac body_nocast)
- (Structures.vm_cast_no_check body_cast))
+ (CoqInterface.tclTHEN
+ (CoqInterface.set_evars_tac body_nocast)
+ (CoqInterface.vm_cast_no_check body_cast))
let tactic call_solver solver_logic rt ro ra rf ra_quant rf_quant vm_cast lcpl lcepl =
- Structures.tclTHEN
+ CoqInterface.tclTHEN
Tactics.intros
- (Structures.mk_tactic (core_tactic call_solver solver_logic rt ro ra rf ra_quant rf_quant vm_cast lcpl lcepl))
+ (CoqInterface.mk_tactic (core_tactic call_solver solver_logic rt ro ra rf ra_quant rf_quant vm_cast lcpl lcepl))
(**********************************************)
@@ -822,7 +822,7 @@ let string_index_of_constr env i cf =
try
let s = string_coq_constr cf in
let nc = Environ.named_context env in
- let nd = Environ.lookup_named (Structures.mkId s) env in
+ let nd = Environ.lookup_named (CoqInterface.mkId s) env in
let cpt = ref 0 in
(try List.iter (fun n -> incr cpt; if n == nd then raise Exit) nc
with Exit -> ());
@@ -832,11 +832,11 @@ let string_index_of_constr env i cf =
let vstring_i env i =
let cf = SmtAtom.Atom.get_coq_term_op i in
- if Structures.isRel cf then
- let dbi = Structures.destRel cf in
+ if CoqInterface.isRel cf then
+ let dbi = CoqInterface.destRel cf in
let s =
Environ.lookup_rel dbi env
- |> Structures.get_rel_dec_name
+ |> CoqInterface.get_rel_dec_name
|> SmtMisc.string_of_name_def "?"
in
s, dbi
@@ -977,14 +977,14 @@ let model_item env rt ro ra rf =
* let outf = Format.formatter_of_out_channel out in
* SExpr.print outf l; pp_print_flush outf ();
* close_out out; *)
- Structures.error ("Could not reconstruct model")
+ CoqInterface.error ("Could not reconstruct model")
let model env rt ro ra rf = function
| List (Atom "model" :: l) ->
List.fold_left (fun acc m -> match model_item env rt ro ra rf m with Fun m -> m::acc | Sort -> acc) [] l
|> List.sort (fun ((_ ,i1), _) ((_, i2), _) -> i2 - i1)
- | _ -> Structures.error ("No model")
+ | _ -> CoqInterface.error ("No model")
let model_string env rt ro ra rf s =
diff --git a/src/trace/smtCommands.mli b/src/trace/smtCommands.mli
index b643594..e885028 100644
--- a/src/trace/smtCommands.mli
+++ b/src/trace/smtCommands.mli
@@ -11,13 +11,13 @@
val parse_certif :
- Structures.id ->
- Structures.id ->
- Structures.id ->
- Structures.id ->
- Structures.id ->
- Structures.id ->
- Structures.id ->
+ CoqInterface.id ->
+ CoqInterface.id ->
+ CoqInterface.id ->
+ CoqInterface.id ->
+ CoqInterface.id ->
+ CoqInterface.id ->
+ CoqInterface.id ->
SmtBtype.reify_tbl * SmtAtom.Op.reify_tbl *
SmtAtom.Atom.reify_tbl * SmtAtom.Form.reify *
SmtAtom.Form.t list * int * SmtAtom.Form.t SmtCertif.clause ->
@@ -29,7 +29,7 @@ val checker_debug :
SmtAtom.Form.t list * int * SmtAtom.Form.t SmtCertif.clause -> 'a
val theorem :
- Structures.id ->
+ CoqInterface.id ->
SmtBtype.reify_tbl * SmtAtom.Op.reify_tbl *
SmtAtom.Atom.reify_tbl * SmtAtom.Form.reify *
SmtAtom.Form.t list * int * SmtAtom.Form.t SmtCertif.clause ->
@@ -56,8 +56,8 @@ val tactic :
SmtAtom.Form.reify ->
SmtAtom.Atom.reify_tbl ->
SmtAtom.Form.reify ->
- (Environ.env -> Structures.constr -> Structures.constr) ->
- Structures.constr list ->
- Structures.constr_expr list -> Structures.tactic
+ (Environ.env -> CoqInterface.constr -> CoqInterface.constr) ->
+ CoqInterface.constr list ->
+ CoqInterface.constr_expr list -> CoqInterface.tactic
val model_string : Environ.env -> SmtBtype.reify_tbl -> 'a -> 'b -> 'c -> SExpr.t -> string
diff --git a/src/trace/smtForm.ml b/src/trace/smtForm.ml
index a86fe8a..0a7d859 100644
--- a/src/trace/smtForm.ml
+++ b/src/trace/smtForm.ml
@@ -80,11 +80,11 @@ module type FORM =
val clear : reify -> unit
val get : ?declare:bool -> reify -> pform -> t
- (** Give a coq term, build the corresponding formula *)
- val of_coq : (Structures.constr -> hatom) -> reify -> Structures.constr -> t
+ (** Given a coq term, build the corresponding formula *)
+ val of_coq : (CoqInterface.constr -> hatom) -> reify -> CoqInterface.constr -> t
val hash_hform : (hatom -> hatom) -> reify -> t -> t
- (** Flattening of [Fand] and [For], removing of [Fnot2] *)
+ (* Flattening of [Fand] and [For], removing of [Fnot2] *)
val flatten : reify -> t -> t
(** Turn n-ary [Fand] and [For] into their right-associative
@@ -93,20 +93,20 @@ module type FORM =
(** Producing Coq terms *)
- val to_coq : t -> Structures.constr
+ val to_coq : t -> CoqInterface.constr
val pform_tbl : reify -> pform array
val to_array : reify -> 'a -> (pform -> 'a) -> int * 'a array
- val interp_tbl : reify -> Structures.constr * Structures.constr
+ val interp_tbl : reify -> CoqInterface.constr * CoqInterface.constr
val nvars : reify -> int
- (** Producing a Coq term corresponding to the interpretation
- of a formula *)
- (** [interp_atom] map [hatom] to coq term, it is better if it produce
- shared terms. *)
+ (* Producing a Coq term corresponding to the interpretation
+ of a formula *)
+ (* [interp_atom] map [hatom] to coq term, it is better if it produce
+ shared terms. *)
val interp_to_coq :
- (hatom -> Structures.constr) -> (int, Structures.constr) Hashtbl.t ->
- t -> Structures.constr
+ (hatom -> CoqInterface.constr) -> (int, CoqInterface.constr) Hashtbl.t ->
+ t -> CoqInterface.constr
(* Unstratified terms *)
type atom_form_lit =
@@ -368,9 +368,9 @@ module Make (Atom:ATOM) =
| CCunknown
module ConstrHash = struct
- type t = Structures.constr
- let equal = Structures.eq_constr
- let hash = Structures.hash_constr
+ type t = CoqInterface.constr
+ let equal = CoqInterface.eq_constr
+ let hash = CoqInterface.hash_constr
end
module ConstrHashtbl = Hashtbl.Make(ConstrHash)
@@ -393,7 +393,7 @@ module Make (Atom:ATOM) =
let get_cst c =
try ConstrHashtbl.find op_tbl c with Not_found -> CCunknown in
let rec mk_hform h =
- let c, args = Structures.decompose_app h in
+ let c, args = CoqInterface.decompose_app h in
match get_cst c with
| CCtrue -> get reify (Fapp(Ftrue,empty_args))
| CCfalse -> get reify (Fapp(Ffalse,empty_args))
@@ -408,7 +408,7 @@ module Make (Atom:ATOM) =
let l1 = mk_hform b1 in
let l2 = mk_hform b2 in
get reify (Fapp (Fimp, [|l1;l2|]))
- | _ -> Structures.error "SmtForm.Form.of_coq: wrong number of arguments for implb")
+ | _ -> CoqInterface.error "SmtForm.Form.of_coq: wrong number of arguments for implb")
| CCifb ->
(* We should also be able to reify if then else *)
begin match args with
@@ -417,7 +417,7 @@ module Make (Atom:ATOM) =
let l2 = mk_hform b2 in
let l3 = mk_hform b3 in
get reify (Fapp (Fite, [|l1;l2;l3|]))
- | _ -> Structures.error "SmtForm.Form.of_coq: wrong number of arguments for ifb"
+ | _ -> CoqInterface.error "SmtForm.Form.of_coq: wrong number of arguments for ifb"
end
| _ ->
let a = atom_of_coq h in
@@ -429,13 +429,13 @@ module Make (Atom:ATOM) =
let l1 = mk_hform b1 in
let l2 = mk_hform b2 in
get reify (f [|l1; l2|])
- | _ -> Structures.error "SmtForm.Form.of_coq: wrong number of arguments"
+ | _ -> CoqInterface.error "SmtForm.Form.of_coq: wrong number of arguments"
and mk_fnot i args =
match args with
| [t] ->
- let c,args = Structures.decompose_app t in
- if Structures.eq_constr c (Lazy.force cnegb) then
+ let c,args = CoqInterface.decompose_app t in
+ if CoqInterface.eq_constr c (Lazy.force cnegb) then
mk_fnot (i+1) args
else
let q,r = i lsr 1 , i land 1 in
@@ -443,31 +443,31 @@ module Make (Atom:ATOM) =
let l = if r = 0 then l else neg l in
if q = 0 then l
else get reify (Fapp(Fnot2 q, [|l|]))
- | _ -> Structures.error "SmtForm.Form.mk_hform: wrong number of arguments for negb"
+ | _ -> CoqInterface.error "SmtForm.Form.mk_hform: wrong number of arguments for negb"
and mk_fand acc args =
match args with
| [t1;t2] ->
let l2 = mk_hform t2 in
- let c, args = Structures.decompose_app t1 in
- if Structures.eq_constr c (Lazy.force candb) then
+ let c, args = CoqInterface.decompose_app t1 in
+ if CoqInterface.eq_constr c (Lazy.force candb) then
mk_fand (l2::acc) args
else
let l1 = mk_hform t1 in
get reify (Fapp(Fand, Array.of_list (l1::l2::acc)))
- | _ -> Structures.error "SmtForm.Form.mk_hform: wrong number of arguments for andb"
+ | _ -> CoqInterface.error "SmtForm.Form.mk_hform: wrong number of arguments for andb"
and mk_for acc args =
match args with
| [t1;t2] ->
let l2 = mk_hform t2 in
- let c, args = Structures.decompose_app t1 in
- if Structures.eq_constr c (Lazy.force corb) then
+ let c, args = CoqInterface.decompose_app t1 in
+ if CoqInterface.eq_constr c (Lazy.force corb) then
mk_for (l2::acc) args
else
let l1 = mk_hform t1 in
get reify (Fapp(For, Array.of_list (l1::l2::acc)))
- | _ -> Structures.error "SmtForm.Form.mk_hform: wrong number of arguments for orb" in
+ | _ -> CoqInterface.error "SmtForm.Form.mk_hform: wrong number of arguments for orb" in
mk_hform c
@@ -546,7 +546,7 @@ module Make (Atom:ATOM) =
let args_to_coq args =
let cargs = Array.make (Array.length args + 1) (mkInt 0) in
Array.iteri (fun i hf -> cargs.(i) <- to_coq hf) args;
- Structures.mkArray (Lazy.force cint, cargs)
+ CoqInterface.mkArray (Lazy.force cint, cargs)
let pf_to_coq = function
| Fatom a -> mklApp cFatom [|mkInt (Atom.index a)|]
@@ -586,12 +586,12 @@ module Make (Atom:ATOM) =
let interp_tbl reify =
let (i,t) = to_array reify (Lazy.force cFtrue) pf_to_coq in
- (mkInt i, Structures.mkArray (Lazy.force cform, t))
+ (mkInt i, CoqInterface.mkArray (Lazy.force cform, t))
let nvars reify = reify.count
- (** Producing a Coq term corresponding to the interpretation of a formula *)
- (** [interp_atom] map [Atom.t] to coq term, it is better if it produce
- shared terms. *)
+ (* Producing a Coq term corresponding to the interpretation of a formula *)
+ (* [interp_atom] map [Atom.t] to coq term, it is better if it produce
+ shared terms. *)
let interp_to_coq interp_atom form_tbl f =
let rec interp_form f =
let l = to_lit f in
diff --git a/src/trace/smtForm.mli b/src/trace/smtForm.mli
index e3c3859..47b4123 100644
--- a/src/trace/smtForm.mli
+++ b/src/trace/smtForm.mli
@@ -77,7 +77,7 @@ module type FORM =
val get : ?declare:bool -> reify -> pform -> t
(** Given a coq term, build the corresponding formula *)
- val of_coq : (Structures.constr -> hatom) -> reify -> Structures.constr -> t
+ val of_coq : (CoqInterface.constr -> hatom) -> reify -> CoqInterface.constr -> t
val hash_hform : (hatom -> hatom) -> reify -> t -> t
@@ -90,20 +90,20 @@ module type FORM =
(** Producing Coq terms *)
- val to_coq : t -> Structures.constr
+ val to_coq : t -> CoqInterface.constr
val pform_tbl : reify -> pform array
val to_array : reify -> 'a -> (pform -> 'a) -> int * 'a array
- val interp_tbl : reify -> Structures.constr * Structures.constr
+ val interp_tbl : reify -> CoqInterface.constr * CoqInterface.constr
val nvars : reify -> int
- (** Producing a Coq term corresponding to the interpretation
- of a formula *)
- (** [interp_atom] map [hatom] to coq term, it is better if it produce
- shared terms. *)
+ (* Producing a Coq term corresponding to the interpretation
+ of a formula *)
+ (* [interp_atom] map [hatom] to coq term, it is better if it produce
+ shared terms. *)
val interp_to_coq :
- (hatom -> Structures.constr) -> (int, Structures.constr) Hashtbl.t ->
- t -> Structures.constr
+ (hatom -> CoqInterface.constr) -> (int, CoqInterface.constr) Hashtbl.t ->
+ t -> CoqInterface.constr
(* Unstratified terms *)
type atom_form_lit =
diff --git a/src/trace/smtMisc.ml b/src/trace/smtMisc.ml
index 2080a64..165814b 100644
--- a/src/trace/smtMisc.ml
+++ b/src/trace/smtMisc.ml
@@ -16,7 +16,7 @@ let cInt_tbl = Hashtbl.create 17
let mkInt i =
try Hashtbl.find cInt_tbl i
with Not_found ->
- let ci = Structures.mkInt i in
+ let ci = CoqInterface.mkInt i in
Hashtbl.add cInt_tbl i ci;
ci
@@ -25,15 +25,15 @@ type 'a gen_hashed = { index : int; hval : 'a }
(** Functions over constr *)
-let mklApp f args = Structures.mkApp (Lazy.force f, args)
+let mklApp f args = CoqInterface.mkApp (Lazy.force f, args)
-let string_of_name_def d n = try Structures.string_of_name n with | _ -> d
+let string_of_name_def d n = try CoqInterface.string_of_name n with | _ -> d
let string_coq_constr t =
let rec fix rf x = rf (fix rf) x in
let pr = fix
- Ppconstr.modular_constr_pr Pp.mt Structures.ppconstr_lsimpleconstr in
- Pp.string_of_ppcmds (pr (Structures.constrextern_extern_constr t))
+ Ppconstr.modular_constr_pr Pp.mt CoqInterface.ppconstr_lsimpleconstr in
+ Pp.string_of_ppcmds (pr (CoqInterface.constrextern_extern_constr t))
(** Logics *)
@@ -46,7 +46,7 @@ type logic_item =
module SL = Set.Make (struct
type t = logic_item
- let compare = Pervasives.compare
+ let compare = Stdlib.compare
end)
type logic = SL.t
diff --git a/src/trace/smtMisc.mli b/src/trace/smtMisc.mli
index a6f5db8..5359c15 100644
--- a/src/trace/smtMisc.mli
+++ b/src/trace/smtMisc.mli
@@ -10,12 +10,12 @@
(**************************************************************************)
-val cInt_tbl : (int, Structures.constr) Hashtbl.t
-val mkInt : int -> Structures.constr
+val cInt_tbl : (int, CoqInterface.constr) Hashtbl.t
+val mkInt : int -> CoqInterface.constr
type 'a gen_hashed = { index : int; hval : 'a; }
-val mklApp : Structures.constr Lazy.t -> Structures.constr array -> Structures.constr
-val string_of_name_def : string -> Structures.name -> string
-val string_coq_constr : Structures.constr -> string
+val mklApp : CoqInterface.constr Lazy.t -> CoqInterface.constr array -> CoqInterface.constr
+val string_of_name_def : string -> CoqInterface.name -> string
+val string_coq_constr : CoqInterface.constr -> string
type logic_item = LUF | LLia | LBitvectors | LArrays
module SL : Set.S with type elt = logic_item
type logic = SL.t
diff --git a/src/trace/smtTrace.ml b/src/trace/smtTrace.ml
index 876e420..7b68a26 100644
--- a/src/trace/smtTrace.ml
+++ b/src/trace/smtTrace.ml
@@ -159,7 +159,7 @@ let order_roots init_index first =
r := n
| _ -> failwith "root value has unexpected form" end
done;
- let _, lr = List.sort (fun (i1, _) (i2, _) -> Pervasives.compare i1 i2) !acc
+ let _, lr = List.sort (fun (i1, _) (i2, _) -> Stdlib.compare i1 i2) !acc
|> List.split in
let link_to c1 c2 =
let curr_id = c2.id -1 in
@@ -383,7 +383,7 @@ let to_coq to_lit interp (cstep,
l := tl
| _ -> assert false
done;
- mklApp cRes [|mkInt (get_pos c); Structures.mkArray (Lazy.force cint, args)|]
+ mklApp cRes [|mkInt (get_pos c); CoqInterface.mkArray (Lazy.force cint, args)|]
| Other other ->
begin match other with
| Weaken (c',l') ->
@@ -412,12 +412,12 @@ let to_coq to_lit interp (cstep,
mklApp cEqCgrP [|out_c c; out_f f1; out_f f2; res|]
| LiaMicromega (cl,d) ->
let cl' = List.fold_right (fun f l -> mklApp ccons [|Lazy.force cint; out_f f; l|]) cl (mklApp cnil [|Lazy.force cint|]) in
- let c' = List.fold_right (fun f l -> mklApp ccons [|Lazy.force Structures.micromega_coq_proofTerm; Structures.micromega_dump_proof_term f; l|]) d (mklApp cnil [|Lazy.force Structures.micromega_coq_proofTerm|]) in
+ let c' = List.fold_right (fun f l -> mklApp ccons [|Lazy.force CoqInterface.micromega_coq_proofTerm; CoqInterface.micromega_dump_proof_term f; l|]) d (mklApp cnil [|Lazy.force CoqInterface.micromega_coq_proofTerm|]) in
mklApp cLiaMicromega [|out_c c; cl'; c'|]
| LiaDiseq l -> mklApp cLiaDiseq [|out_c c; out_f l|]
| SplArith (orig,res,l) ->
let res' = out_f res in
- let l' = List.fold_right (fun f l -> mklApp ccons [|Lazy.force Structures.micromega_coq_proofTerm; Structures.micromega_dump_proof_term f; l|]) l (mklApp cnil [|Lazy.force Structures.micromega_coq_proofTerm|]) in
+ let l' = List.fold_right (fun f l -> mklApp ccons [|Lazy.force CoqInterface.micromega_coq_proofTerm; CoqInterface.micromega_dump_proof_term f; l|]) l (mklApp cnil [|Lazy.force CoqInterface.micromega_coq_proofTerm|]) in
mklApp cSplArith [|out_c c; out_c orig; res'; l'|]
| SplDistinctElim (c',f) -> mklApp cSplDistinctElim [|out_c c;out_c c'; out_f f|]
| BBVar res -> mklApp cBBVar [|out_c c; out_f res|]
@@ -461,10 +461,10 @@ let to_coq to_lit interp (cstep,
| Ext (res) -> mklApp cExt [|out_c c; out_f res|]
| Hole (prem_id, concl) ->
let prem = List.map (fun cl -> match cl.value with Some l -> l | None -> assert false) prem_id in
- let ass_name = Structures.mkId ("ass"^(string_of_int (Hashtbl.hash concl))) in
+ let ass_name = CoqInterface.mkId ("ass"^(string_of_int (Hashtbl.hash concl))) in
let ass_ty = interp (prem, concl) in
cuts := (ass_name, ass_ty)::!cuts;
- let ass_var = Structures.mkVar ass_name in
+ let ass_var = CoqInterface.mkVar ass_name in
let prem_id' = List.fold_right (fun c l -> mklApp ccons [|Lazy.force cint; out_c c; l|]) prem_id (mklApp cnil [|Lazy.force cint|]) in
let prem' = List.fold_right (fun cl l -> mklApp ccons [|Lazy.force cState_C_t; out_cl cl; l|]) prem (mklApp cnil [|Lazy.force cState_C_t|]) in
let concl' = out_cl concl in
@@ -474,23 +474,23 @@ let to_coq to_lit interp (cstep,
| Some find -> find cl
| None -> assert false in
let concl' = out_cl [concl] in
- let app_name = Structures.mkId ("app" ^ (string_of_int (Hashtbl.hash concl))) in
- let app_var = Structures.mkVar app_name in
- let app_ty = Term.mkArrow clemma (interp ([], [concl])) in
+ let app_name = CoqInterface.mkId ("app" ^ (string_of_int (Hashtbl.hash concl))) in
+ let app_var = CoqInterface.mkVar app_name in
+ let app_ty = CoqInterface.mkArrow clemma (interp ([], [concl])) in
cuts := (app_name, app_ty)::!cuts;
mklApp cForallInst [|out_c c; clemma; cplemma; concl'; app_var|]
end
| _ -> assert false in
let step = Lazy.force cstep in
let def_step =
- mklApp cRes [|mkInt 0; Structures.mkArray (Lazy.force cint, [|mkInt 0|]) |] in
+ mklApp cRes [|mkInt 0; CoqInterface.mkArray (Lazy.force cint, [|mkInt 0|]) |] in
let r = ref confl in
let nc = ref 0 in
while not (isRoot !r.kind) do r := prev !r; incr nc done;
let last_root = !r in
(* Be careful, step_to_coq makes a side effect on cuts so it needs to be called first *)
let res =
- Structures.mkTrace step_to_coq next carray clist cnil ccons cpair !nc step def_step r
+ CoqInterface.mkTrace step_to_coq next carray clist cnil ccons cpair !nc step def_step r
in
(res, last_root, !cuts)
diff --git a/src/trace/smtTrace.mli b/src/trace/smtTrace.mli
index 2c70bbc..e79ce20 100644
--- a/src/trace/smtTrace.mli
+++ b/src/trace/smtTrace.mli
@@ -48,26 +48,26 @@ val alloc : 'a SmtCertif.clause -> int
val naive_alloc : 'a SmtCertif.clause -> int
val build_certif : 'a SmtCertif.clause -> 'b SmtCertif.clause -> int
val to_coq :
- ('a -> Structures.constr) ->
- ('a list list * 'a list -> Structures.types) ->
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t * Structures.constr Lazy.t *
- Structures.constr Lazy.t * Structures.constr Lazy.t ->
+ ('a -> CoqInterface.constr) ->
+ ('a list list * 'a list -> CoqInterface.types) ->
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t *
+ CoqInterface.constr Lazy.t * CoqInterface.constr Lazy.t ->
'a SmtCertif.clause ->
- ('a SmtCertif.clause -> Structures.types * Structures.constr) option ->
- Structures.constr * 'a SmtCertif.clause *
- (Structures.id * Structures.types) list
+ ('a SmtCertif.clause -> CoqInterface.types * CoqInterface.constr) option ->
+ CoqInterface.constr * 'a SmtCertif.clause *
+ (CoqInterface.id * CoqInterface.types) list
module MakeOpt :
diff --git a/src/verit/verit.ml b/src/verit/verit.ml
index eed1dca..7f89943 100644
--- a/src/verit/verit.ml
+++ b/src/verit/verit.ml
@@ -193,25 +193,25 @@ let call_verit _ rt ro ra_quant rf_quant first lsmt =
if l = "warning : proof_done: status is still open" then
raise Unknown
else if l = "Invalid memory reference" then
- Structures.warning "verit-warning" ("veriT outputted the warning: " ^ l)
+ CoqInterface.warning "verit-warning" ("veriT outputted the warning: " ^ l)
else if n >= 7 && String.sub l 0 7 = "warning" then
- Structures.warning "verit-warning" ("veriT outputted the warning: " ^ (String.sub l 7 (n-7)))
+ CoqInterface.warning "verit-warning" ("veriT outputted the warning: " ^ (String.sub l 7 (n-7)))
else if n >= 8 && String.sub l 0 8 = "error : " then
- Structures.error ("veriT failed with the error: " ^ (String.sub l 8 (n-8)))
+ CoqInterface.error ("veriT failed with the error: " ^ (String.sub l 8 (n-8)))
else
- Structures.error ("veriT failed with the error: " ^ l)
+ CoqInterface.error ("veriT failed with the error: " ^ l)
done
with End_of_file -> () in
try
- if exit_code <> 0 then Structures.warning "verit-non-zero-exit-code" ("Verit.call_verit: command " ^ command ^ " exited with code " ^ string_of_int exit_code);
+ if exit_code <> 0 then CoqInterface.warning "verit-non-zero-exit-code" ("Verit.call_verit: command " ^ command ^ " exited with code " ^ string_of_int exit_code);
raise_warnings_errors ();
let res = import_trace ra_quant rf_quant logfilename (Some first) lsmt in
close_in win; Sys.remove wname; res
with x -> close_in win; Sys.remove wname;
match x with
- | Unknown -> Structures.error "veriT returns 'unknown'"
- | VeritSyntax.Sat -> Structures.error "veriT found a counter-example"
+ | Unknown -> CoqInterface.error "veriT returns 'unknown'"
+ | VeritSyntax.Sat -> CoqInterface.error "veriT found a counter-example"
| _ -> raise x
let verit_logic =
diff --git a/src/verit/verit.mli b/src/verit/verit.mli
index 0560d77..f0acd0c 100644
--- a/src/verit/verit.mli
+++ b/src/verit/verit.mli
@@ -11,13 +11,13 @@
val parse_certif :
- Structures.id ->
- Structures.id ->
- Structures.id ->
- Structures.id ->
- Structures.id -> Structures.id -> Structures.id -> string -> string -> unit
+ CoqInterface.id ->
+ CoqInterface.id ->
+ CoqInterface.id ->
+ CoqInterface.id ->
+ CoqInterface.id -> CoqInterface.id -> CoqInterface.id -> string -> string -> unit
val checker : string -> string -> unit
val checker_debug : string -> string -> unit
-val theorem : Structures.id -> string -> string -> unit
-val tactic : EConstr.t -> Structures.constr_expr list -> Structures.tactic
-val tactic_no_check : EConstr.t -> Structures.constr_expr list -> Structures.tactic
+val theorem : CoqInterface.id -> string -> string -> unit
+val tactic : EConstr.t -> CoqInterface.constr_expr list -> CoqInterface.tactic
+val tactic_no_check : EConstr.t -> CoqInterface.constr_expr list -> CoqInterface.tactic
diff --git a/src/verit/veritSyntax.ml b/src/verit/veritSyntax.ml
index e0f0fcc..c5db594 100644
--- a/src/verit/veritSyntax.ml
+++ b/src/verit/veritSyntax.ml
@@ -150,7 +150,7 @@ let mkCongrPred p =
(* Linear arithmetic *)
let mkMicromega cl =
- let _tbl, _f, cert = Lia.build_lia_certif cl in
+ let cert = Lia.build_lia_certif cl in
let c =
match cert with
| None -> failwith "VeritSyntax.mkMicromega: micromega can't solve this"
@@ -168,7 +168,7 @@ let mkSplArith orig cl =
match orig.value with
| Some [orig'] -> orig'
| _ -> failwith "VeritSyntax.mkSplArith: wrong number of literals in the premise clause" in
- let _tbl, _f, cert = Lia.build_lia_certif [Form.neg orig';res] in
+ let cert = Lia.build_lia_certif [Form.neg orig';res] in
let c =
match cert with
| None -> failwith "VeritSyntax.mkSplArith: micromega can't solve this"
@@ -493,7 +493,7 @@ let mk_clause (id,typ,value,ids_params) =
let mk_clause cl =
try mk_clause cl
with Failure f ->
- Structures.error ("SMTCoq was not able to check the certificate \
+ CoqInterface.error ("SMTCoq was not able to check the certificate \
for the following reason.\n"^f)
let apply_dec f (decl, a) = decl, f a
diff --git a/src/versions/native/Make b/src/versions/native/Make
deleted file mode 100644
index e278c82..0000000
--- a/src/versions/native/Make
+++ /dev/null
@@ -1,171 +0,0 @@
-########################################################################
-## This file is intended to developers, please do not use it to ##
-## generate a Makefile, rather use the provided Makefile. ##
-########################################################################
-
-
-
-
-########################################################################
-## To generate the Makefile: ##
-## coq_makefile -f Make -o Makefile ##
-## In the Makefile : ##
-## 1) Suppress the "Makefile" target ##
-## 2) Change the "all" target into: ##
-## all: ml $(CMXFILES) $(CMXA) $(CMXS) $(VOFILES) ##
-## 3) Change the "install-natdynlink" target: ##
-## change CMXSFILES into CMXS and add the same block for CMXA and VCMXS. ##
-## 4) Change the "install" target: change CMOFILES into CMXFILES. ##
-## 5) Add to the "clean" target: ##
-## - rm -f NSMTCoq* cnf/NSMTCoq* euf/NSMTCoq* lia/NSMTCoq* spl/NSMTCoq* ../unit-tests/NSMTCoq* ../unit-tests/*.vo ../unit-tests/*.zlog ../unit-tests/*.vtlog verit/veritParser.mli verit/veritParser.ml verit/veritLexer.ml ../3rdparty/alt-ergo/smtlib2_parse.mli ../3rdparty/alt-ergo/smtlib2_parse.ml ../3rdparty/alt-ergo/smtlib2_lex.ml smtlib2/sExprParser.mli smtlib2/sExprParser.ml smtlib2/sExprLexer.ml lfsc/lfscLexer.ml lfsc/lfscParser.ml lfsc/lfscParser.mli trace/smtcoq.a ##
-########################################################################
-
-
--R . SMTCoq
-
--I bva
--I classes
--I array
--I cnf
--I euf
--I lfsc
--I lia
--I smtlib2
--I trace
--I verit
--I zchaff
--I versions/native
--I ../3rdparty/alt-ergo
-
-
--custom "cd ../unit-tests; make vernac" "" "test"
--custom "cd ../unit-tests; make zchaffv" "" "ztest"
--custom "cd ../unit-tests; make veritv" "" "vtest"
-
--custom "$(CAMLLEX) $<" "%.mll" "%.ml"
--custom "$(CAMLYACC) $<" "%.mly" "%.ml %.mli"
--custom "" "verit/veritParser.ml verit/veritLexer.ml ../3rdparty/alt-ergo/smtlib2_parse.ml ../3rdparty/alt-ergo/smtlib2_lex.ml smtlib2/sExprParser.ml smtlib2/sExprLexer.ml lfsc/lfscParser.ml lfsc/lfscLexer.ml" "ml"
-
--custom "$(CAMLOPTLINK) $(ZFLAGS) -a -o $@ $^" "versions/native/structures.cmx trace/smtMisc.cmx trace/coqTerms.cmx trace/smtBtype.cmx trace/smtForm.cmx trace/smtCertif.cmx trace/smtTrace.cmx trace/smtCnf.cmx trace/satAtom.cmx trace/smtAtom.cmx trace/smtMaps.cmx zchaff/satParser.cmx zchaff/zchaffParser.cmx zchaff/cnfParser.cmx zchaff/zchaff.cmx ../3rdparty/alt-ergo/smtlib2_util.cmx ../3rdparty/alt-ergo/smtlib2_ast.cmx ../3rdparty/alt-ergo/smtlib2_parse.cmx ../3rdparty/alt-ergo/smtlib2_lex.cmx smtlib2/sExpr.cmx smtlib2/sExprParser.cmx smtlib2/sExprLexer.cmx smtlib2/smtlib2_solver.cmx lia/lia.cmx verit/veritSyntax.cmx verit/veritParser.cmx verit/veritLexer.cmx lfsc/shashcons.cmx lfsc/hstring.cmx lfsc/type.cmx lfsc/ast.cmx lfsc/builtin.cmx lfsc/tosmtcoq.cmx lfsc/converter.cmx lfsc/lfscParser.cmx lfsc/lfscLexer.cmx smtlib2/smtlib2_genConstr.cmx trace/smtCommands.cmx verit/verit.cmx lfsc/lfsc.cmx smtcoq_plugin.cmx" "$(CMXA)"
--custom "$(CAMLOPTLINK) $(ZFLAGS) -o $@ -linkall -shared $^" "$(CMXA)" "$(CMXS)"
-
-CMXA = smtcoq.cmxa
-CMXS = smtcoq_plugin.cmxs
-VCMXS = "versions/native/NSMTCoq_versions_native_Structures.cmxs NSMTCoq_State.cmxs NSMTCoq_Misc.cmxs classes/NSMTCoq_SMT_classes.cmxs classes/NSMTCoq_SMT_classes_instances.cmxs NSMTCoq_SMT_terms.cmxs cnf/NSMTCoq_cnf_Cnf.cmxs euf/NSMTCoq_euf_Euf.cmxs lia/NSMTCoq_lia_Lia.cmxs spl/NSMTCoq_spl_Syntactic.cmxs spl/NSMTCoq_spl_Assumptions.cmxs spl/NSMTCoq_spl_Arithmetic.cmxs spl/NSMTCoq_spl_Operators.cmxs NSMTCoq_Trace.cmxs NSMTCoq_Tactics.cmxs NSMTCoq_Conversion_tactics.cmxs NSMTCoq_PropToBool.cmxs NSMTCoq_BoolToProp.cmxs NSMTCoq_SMTCoq.cmxs NSMTCoq_State.cmi NSMTCoq_Misc.cmi classes/NSMTCoq_SMT_classes.cmi classes/NSMTCoq_SMT_classes_instances.cmi NSMTCoq_SMT_terms.cmi cnf/NSMTCoq_cnf_Cnf.cmi euf/NSMTCoq_euf_Euf.cmi lia/NSMTCoq_lia_Lia.cmi spl/NSMTCoq_spl_Syntactic.cmi spl/NSMTCoq_spl_Assumptions.cmi spl/NSMTCoq_spl_Arithmetic.cmi spl/NSMTCoq_spl_Operators.cmi NSMTCoq_Trace.cmi NSMTCoq_Trace.cmi NSMTCoq_Tactics.cmi NSMTCoq_Conversion_tactics.cmi NSMTCoq_PropToBool.cmi NSMTCoq_BoolToProp.cmi NSMTCoq_SMTCoq.cmi"
-CAMLLEX = $(CAMLBIN)ocamllex
-CAMLYACC = $(CAMLBIN)ocamlyacc
-
-bva/BVList.v
-bva/Bva_checker.v
-
-classes/SMT_classes.v
-classes/SMT_classes_instances.v
-
-array/FArray.v
-array/Array_checker.v
-
-versions/native/Structures.v
-versions/native/structures.ml
-versions/native/structures.mli
-
-trace/coqTerms.ml
-trace/coqTerms.mli
-trace/satAtom.ml
-trace/satAtom.mli
-trace/smtAtom.ml
-trace/smtAtom.mli
-trace/smtBtype.ml
-trace/smtBtype.mli
-trace/smtCertif.ml
-trace/smtCertif.mli
-trace/smtCnf.ml
-trace/smtCnf.mli
-trace/smtCommands.ml
-trace/smtCommands.mli
-trace/smtForm.ml
-trace/smtForm.mli
-trace/smtMaps.ml
-trace/smtMaps.mli
-trace/smtMisc.ml
-trace/smtMisc.mli
-trace/smtTrace.ml
-trace/smtTrace.mli
-
-../3rdparty/alt-ergo/smtlib2_parse.ml
-../3rdparty/alt-ergo/smtlib2_parse.mli
-../3rdparty/alt-ergo/smtlib2_lex.ml
-../3rdparty/alt-ergo/smtlib2_lex.mli
-../3rdparty/alt-ergo/smtlib2_ast.ml
-../3rdparty/alt-ergo/smtlib2_ast.mli
-../3rdparty/alt-ergo/smtlib2_util.ml
-../3rdparty/alt-ergo/smtlib2_util.mli
-
-smtlib2/smtlib2_genConstr.ml
-smtlib2/smtlib2_genConstr.mli
-smtlib2/sExprParser.ml
-smtlib2/sExprParser.mli
-smtlib2/sExprLexer.ml
-smtlib2/sExpr.ml
-smtlib2/sExpr.mli
-smtlib2/smtlib2_solver.ml
-smtlib2/smtlib2_solver.mli
-
-verit/veritParser.ml
-verit/veritParser.mli
-verit/veritLexer.ml
-verit/veritLexer.mli
-verit/verit.ml
-verit/verit.mli
-verit/veritSyntax.ml
-verit/veritSyntax.mli
-
-lfsc/shashcons.mli
-lfsc/shashcons.ml
-lfsc/hstring.mli
-lfsc/hstring.ml
-lfsc/lfscParser.ml
-lfsc/lfscLexer.ml
-lfsc/type.ml
-lfsc/ast.ml
-lfsc/ast.mli
-lfsc/translator_sig.mli
-lfsc/builtin.ml
-lfsc/tosmtcoq.ml
-lfsc/tosmtcoq.mli
-lfsc/converter.ml
-lfsc/lfsc.ml
-
-zchaff/cnfParser.ml
-zchaff/cnfParser.mli
-zchaff/satParser.ml
-zchaff/satParser.mli
-zchaff/zchaff.ml
-zchaff/zchaff.mli
-zchaff/zchaffParser.ml
-zchaff/zchaffParser.mli
-
-cnf/Cnf.v
-
-euf/Euf.v
-
-lia/lia.ml
-lia/lia.mli
-lia/Lia.v
-
-spl/Assumptions.v
-spl/Syntactic.v
-spl/Arithmetic.v
-spl/Operators.v
-
-Conversion_tactics.v
-Misc.v
-SMTCoq.v
-ReflectFacts.v
-PropToBool.v
-BoolToProp.v
-Tactics.v
-SMT_terms.v
-State.v
-Trace.v
-
-smtcoq_plugin.ml4
diff --git a/src/versions/native/Makefile b/src/versions/native/Makefile
deleted file mode 100644
index aaaab9e..0000000
--- a/src/versions/native/Makefile
+++ /dev/null
@@ -1,505 +0,0 @@
-#############################################################################
-## v # The Coq Proof Assistant ##
-## <O___,, # INRIA - CNRS - LIX - LRI - PPS ##
-## \VV/ # ##
-## // # Makefile automagically generated by coq_makefile Vtrunk ##
-#############################################################################
-
-# WARNING
-#
-# This Makefile has been automagically generated
-# Edit at your own risks !
-#
-# END OF WARNING
-
-#
-# This Makefile was generated by the command line :
-# coq_makefile -f Make -o Makefile
-#
-
-.DEFAULT_GOAL := all
-
-#
-# This Makefile may take arguments passed as environment variables:
-# COQBIN to specify the directory where Coq binaries resides;
-# ZDEBUG/COQDEBUG to specify debug flags for ocamlc&ocamlopt/coqc;
-# DSTROOT to specify a prefix to install path.
-
-# Here is a hack to make $(eval $(shell works:
-define donewline
-
-
-endef
-includecmdwithout@ = $(eval $(subst @,$(donewline),$(shell { $(1) | tr '\n' '@'; })))
-$(call includecmdwithout@,$(COQBIN)coqtop -config)
-
-##########################
-# #
-# Libraries definitions. #
-# #
-##########################
-
-OCAMLLIBS?=-I ../3rdparty/alt-ergo\
- -I versions/native\
- -I zchaff\
- -I verit\
- -I trace\
- -I smtlib2\
- -I lia\
- -I lfsc\
- -I euf\
- -I cnf\
- -I array\
- -I classes\
- -I bva
-COQLIBS?=-I ../3rdparty/alt-ergo\
- -I versions/native\
- -I zchaff\
- -I verit\
- -I trace\
- -I smtlib2\
- -I lia\
- -I lfsc\
- -I euf\
- -I cnf\
- -I array\
- -I classes\
- -I bva -R . SMTCoq
-COQDOCLIBS?=-R . SMTCoq
-
-##########################
-# #
-# Variables definitions. #
-# #
-##########################
-
-CAMLYACC=$(CAMLBIN)ocamlyacc
-CAMLLEX=$(CAMLBIN)ocamllex
-VCMXS=versions/native/NSMTCoq_versions_native_Structures.cmxs NSMTCoq_State.cmxs NSMTCoq_Misc.cmxs classes/NSMTCoq_SMT_classes.cmxs classes/NSMTCoq_SMT_classes_instances.cmxs NSMTCoq_SMT_terms.cmxs cnf/NSMTCoq_cnf_Cnf.cmxs euf/NSMTCoq_euf_Euf.cmxs lia/NSMTCoq_lia_Lia.cmxs spl/NSMTCoq_spl_Syntactic.cmxs spl/NSMTCoq_spl_Assumptions.cmxs spl/NSMTCoq_spl_Arithmetic.cmxs spl/NSMTCoq_spl_Operators.cmxs NSMTCoq_Trace.cmxs NSMTCoq_Tactics.cmxs NSMTCoq_Conversion_tactics.cmxs NSMTCoq_PropToBool.cmxs NSMTCoq_BoolToProp.cmxs NSMTCoq_SMTCoq.cmxs NSMTCoq_State.cmi NSMTCoq_Misc.cmi classes/NSMTCoq_SMT_classes.cmi classes/NSMTCoq_SMT_classes_instances.cmi NSMTCoq_SMT_terms.cmi cnf/NSMTCoq_cnf_Cnf.cmi euf/NSMTCoq_euf_Euf.cmi lia/NSMTCoq_lia_Lia.cmi spl/NSMTCoq_spl_Syntactic.cmi spl/NSMTCoq_spl_Assumptions.cmi spl/NSMTCoq_spl_Arithmetic.cmi spl/NSMTCoq_spl_Operators.cmi NSMTCoq_Trace.cmi NSMTCoq_Trace.cmi NSMTCoq_Tactics.cmi NSMTCoq_Conversion_tactics.cmi NSMTCoq_PropToBool.cmi NSMTCoq_BoolToProp.cmi NSMTCoq_SMTCoq.cmi
-CMXS=smtcoq_plugin.cmxs
-CMXA=smtcoq.cmxa
-
-OPT?=
-COQDEP?=$(COQBIN)coqdep -c
-COQFLAGS?=-q $(OPT) $(COQLIBS) $(OTHERFLAGS) $(COQ_XML)
-COQCHKFLAGS?=-silent -o
-COQDOCFLAGS?=-interpolate -utf8
-COQC?=$(COQBIN)coqc
-GALLINA?=$(COQBIN)gallina
-COQDOC?=$(COQBIN)coqdoc
-COQCHK?=$(COQBIN)coqchk
-
-COQSRCLIBS?=-I $(COQLIB)kernel -I $(COQLIB)lib \
- -I $(COQLIB)library -I $(COQLIB)parsing \
- -I $(COQLIB)pretyping -I $(COQLIB)interp \
- -I $(COQLIB)proofs -I $(COQLIB)tactics \
- -I $(COQLIB)toplevel \
- -I $(COQLIB)plugins/btauto \
- -I $(COQLIB)plugins/cc \
- -I $(COQLIB)plugins/decl_mode \
- -I $(COQLIB)plugins/extraction \
- -I $(COQLIB)plugins/field \
- -I $(COQLIB)plugins/firstorder \
- -I $(COQLIB)plugins/fourier \
- -I $(COQLIB)plugins/funind \
- -I $(COQLIB)plugins/micromega \
- -I $(COQLIB)plugins/nsatz \
- -I $(COQLIB)plugins/omega \
- -I $(COQLIB)plugins/quote \
- -I $(COQLIB)plugins/ring \
- -I $(COQLIB)plugins/romega \
- -I $(COQLIB)plugins/rtauto \
- -I $(COQLIB)plugins/setoid_ring \
- -I $(COQLIB)plugins/syntax \
- -I $(COQLIB)plugins/xml
-ZFLAGS=$(OCAMLLIBS) $(COQSRCLIBS) -I $(CAMLP4LIB)
-
-CAMLC?=$(OCAMLC) -c -rectypes
-CAMLOPTC?=$(OCAMLOPT) -c -rectypes
-CAMLLINK?=$(OCAMLC) -rectypes
-CAMLOPTLINK?=$(OCAMLOPT) -rectypes
-GRAMMARS?=grammar.cma
-CAMLP4EXTEND?=pa_extend.cmo pa_macro.cmo q_MLast.cmo
-CAMLP4OPTIONS?=-loc loc
-PP?=-pp "$(CAMLP4BIN)$(CAMLP4)o -I $(CAMLLIB) -I . $(COQSRCLIBS) $(CAMLP4EXTEND) $(GRAMMARS) $(CAMLP4OPTIONS) -impl"
-
-##################
-# #
-# Install Paths. #
-# #
-##################
-
-ifdef USERINSTALL
-XDG_DATA_HOME?=$(HOME)/.local/share
-COQLIBINSTALL=$(XDG_DATA_HOME)/coq
-COQDOCINSTALL=$(XDG_DATA_HOME)/doc/coq
-else
-COQLIBINSTALL=${COQLIB}user-contrib
-COQDOCINSTALL=${DOCDIR}user-contrib
-endif
-
-######################
-# #
-# Files dispatching. #
-# #
-######################
-
-VFILES:=Trace.v\
- State.v\
- SMT_terms.v\
- Tactics.v\
- BoolToProp.v\
- PropToBool.v\
- ReflectFacts.v\
- SMTCoq.v\
- Misc.v\
- Conversion_tactics.v\
- spl/Operators.v\
- spl/Arithmetic.v\
- spl/Syntactic.v\
- spl/Assumptions.v\
- lia/Lia.v\
- euf/Euf.v\
- cnf/Cnf.v\
- versions/native/Structures.v\
- array/Array_checker.v\
- array/FArray.v\
- classes/SMT_classes_instances.v\
- classes/SMT_classes.v\
- bva/Bva_checker.v\
- bva/BVList.v
-
--include $(addsuffix .d,$(VFILES))
-.SECONDARY: $(addsuffix .d,$(VFILES))
-
-vo_to_obj = $(addsuffix .o,$(foreach vo,$(1),$(addprefix $(dir $(vo)),$(filter-out Warning: Error:,$(firstword $(shell $(COQBIN)coqtop -batch -quiet -print-mod-uid $(vo:.vo=)))))))
-VOFILES:=$(foreach vo,$(VFILES:.v=.vo),$(dir $(vo))$(notdir $(vo)))
-GLOBFILES:=$(VFILES:.v=.glob)
-VIFILES:=$(VFILES:.v=.vi)
-GFILES:=$(VFILES:.v=.g)
-HTMLFILES:=$(VFILES:.v=.html)
-GHTMLFILES:=$(VFILES:.v=.g.html)
-OBJFILES:=$(call vo_to_obj,$(VOFILES))
-ML4FILES:=smtcoq_plugin.ml4
-
--include $(addsuffix .d,$(ML4FILES))
-.SECONDARY: $(addsuffix .d,$(ML4FILES))
-
-MLFILES:=lia/lia.ml\
- zchaff/zchaffParser.ml\
- zchaff/zchaff.ml\
- zchaff/satParser.ml\
- zchaff/cnfParser.ml\
- lfsc/lfsc.ml\
- lfsc/converter.ml\
- lfsc/tosmtcoq.ml\
- lfsc/builtin.ml\
- lfsc/ast.ml\
- lfsc/type.ml\
- lfsc/lfscLexer.ml\
- lfsc/lfscParser.ml\
- lfsc/hstring.ml\
- lfsc/shashcons.ml\
- verit/veritSyntax.ml\
- verit/verit.ml\
- verit/veritLexer.ml\
- verit/veritParser.ml\
- smtlib2/smtlib2_solver.ml\
- smtlib2/sExpr.ml\
- smtlib2/sExprLexer.ml\
- smtlib2/sExprParser.ml\
- smtlib2/smtlib2_genConstr.ml\
- ../3rdparty/alt-ergo/smtlib2_util.ml\
- ../3rdparty/alt-ergo/smtlib2_ast.ml\
- ../3rdparty/alt-ergo/smtlib2_lex.ml\
- ../3rdparty/alt-ergo/smtlib2_parse.ml\
- trace/smtTrace.ml\
- trace/smtMisc.ml\
- trace/smtMaps.ml\
- trace/smtForm.ml\
- trace/smtCommands.ml\
- trace/smtCnf.ml\
- trace/smtCertif.ml\
- trace/smtBtype.ml\
- trace/smtAtom.ml\
- trace/satAtom.ml\
- trace/coqTerms.ml\
- versions/native/structures.ml
-
--include $(addsuffix .d,$(MLFILES))
-.SECONDARY: $(addsuffix .d,$(MLFILES))
-
-MLIFILES:=lia/lia.mli\
- zchaff/zchaffParser.mli\
- zchaff/zchaff.mli\
- zchaff/satParser.mli\
- zchaff/cnfParser.mli\
- lfsc/tosmtcoq.mli\
- lfsc/translator_sig.mli\
- lfsc/ast.mli\
- lfsc/hstring.mli\
- lfsc/shashcons.mli\
- verit/veritSyntax.mli\
- verit/verit.mli\
- verit/veritLexer.mli\
- verit/veritParser.mli\
- smtlib2/smtlib2_solver.mli\
- smtlib2/sExpr.mli\
- smtlib2/sExprParser.mli\
- smtlib2/smtlib2_genConstr.mli\
- ../3rdparty/alt-ergo/smtlib2_util.mli\
- ../3rdparty/alt-ergo/smtlib2_ast.mli\
- ../3rdparty/alt-ergo/smtlib2_lex.mli\
- ../3rdparty/alt-ergo/smtlib2_parse.mli\
- trace/smtTrace.mli\
- trace/smtMisc.mli\
- trace/smtMaps.mli\
- trace/smtForm.mli\
- trace/smtCommands.mli\
- trace/smtCnf.mli\
- trace/smtCertif.mli\
- trace/smtBtype.mli\
- trace/smtAtom.mli\
- trace/satAtom.mli\
- trace/coqTerms.mli\
- versions/native/structures.mli
-
--include $(addsuffix .d,$(MLIFILES))
-.SECONDARY: $(addsuffix .d,$(MLIFILES))
-
-ALLCMOFILES:=$(ML4FILES:.ml4=.cmo) $(MLFILES:.ml=.cmo)
-CMOFILES=$(filter-out $(addsuffix .cmo,$(foreach lib,$(MLLIBFILES:.mllib=_MLLIB_DEPENDENCIES) $(MLPACKFILES:.mlpack=_MLPACK_DEPENDENCIES),$($(lib)))),$(ALLCMOFILES))
-CMXFILES=$(CMOFILES:.cmo=.cmx)
-CMIFILES=$(sort $(ALLCMOFILES:.cmo=.cmi) $(MLIFILES:.mli=.cmi))
-CMXSFILES=$(CMXFILES:.cmx=.cmxs)
-
-#######################################
-# #
-# Definition of the toplevel targets. #
-# #
-#######################################
-
-all: ml $(CMXFILES) $(CMXA) $(CMXS) $(VOFILES)
-
-mlihtml: $(MLIFILES:.mli=.cmi)
- mkdir $@ || rm -rf $@/*
- $(OCAMLDOC) -html -rectypes -d $@ -m A $(ZDEBUG) $(ZFLAGS) $(^:.cmi=.mli)
-
-all-mli.tex: $(MLIFILES:.mli=.cmi)
- $(OCAMLDOC) -latex -rectypes -o $@ -m A $(ZDEBUG) $(ZFLAGS) $(^:.cmi=.mli)
-
-spec: $(VIFILES)
-
-gallina: $(GFILES)
-
-html: $(GLOBFILES) $(VFILES)
- - mkdir -p html
- $(COQDOC) -toc $(COQDOCFLAGS) -html $(COQDOCLIBS) -d html $(VFILES)
-
-gallinahtml: $(GLOBFILES) $(VFILES)
- - mkdir -p html
- $(COQDOC) -toc $(COQDOCFLAGS) -html -g $(COQDOCLIBS) -d html $(VFILES)
-
-all.ps: $(VFILES)
- $(COQDOC) -toc $(COQDOCFLAGS) -ps $(COQDOCLIBS) -o $@ `$(COQDEP) -sort -suffix .v $^`
-
-all-gal.ps: $(VFILES)
- $(COQDOC) -toc $(COQDOCFLAGS) -ps -g $(COQDOCLIBS) -o $@ `$(COQDEP) -sort -suffix .v $^`
-
-all.pdf: $(VFILES)
- $(COQDOC) -toc $(COQDOCFLAGS) -pdf $(COQDOCLIBS) -o $@ `$(COQDEP) -sort -suffix .v $^`
-
-all-gal.pdf: $(VFILES)
- $(COQDOC) -toc $(COQDOCFLAGS) -pdf -g $(COQDOCLIBS) -o $@ `$(COQDEP) -sort -suffix .v $^`
-
-validate: $(VOFILES)
- $(COQCHK) $(COQCHKFLAGS) $(COQLIBS) $(notdir $(^:.vo=))
-
-beautify: $(VFILES:=.beautified)
- for file in $^; do mv $${file%.beautified} $${file%beautified}old && mv $${file} $${file%.beautified}; done
- @echo 'Do not do "make clean" until you are sure that everything went well!'
- @echo 'If there were a problem, execute "for file in $$(find . -name \*.v.old -print); do mv $${file} $${file%.old}; done" in your shell/'
-
-.PHONY: all opt byte archclean clean install userinstall depend html validate
-
-###################
-# #
-# Custom targets. #
-# #
-###################
-
-$(CMXS): $(CMXA)
- $(CAMLOPTLINK) $(ZFLAGS) -o $@ -linkall -shared $^
-
-$(CMXA): versions/native/structures.cmx trace/smtMisc.cmx trace/coqTerms.cmx trace/smtBtype.cmx trace/smtForm.cmx trace/smtCertif.cmx trace/smtTrace.cmx trace/smtCnf.cmx trace/satAtom.cmx trace/smtAtom.cmx trace/smtMaps.cmx zchaff/satParser.cmx zchaff/zchaffParser.cmx zchaff/cnfParser.cmx zchaff/zchaff.cmx ../3rdparty/alt-ergo/smtlib2_util.cmx ../3rdparty/alt-ergo/smtlib2_ast.cmx ../3rdparty/alt-ergo/smtlib2_parse.cmx ../3rdparty/alt-ergo/smtlib2_lex.cmx smtlib2/sExpr.cmx smtlib2/sExprParser.cmx smtlib2/sExprLexer.cmx smtlib2/smtlib2_solver.cmx lia/lia.cmx verit/veritSyntax.cmx verit/veritParser.cmx verit/veritLexer.cmx lfsc/shashcons.cmx lfsc/hstring.cmx lfsc/type.cmx lfsc/ast.cmx lfsc/builtin.cmx lfsc/tosmtcoq.cmx lfsc/converter.cmx lfsc/lfscParser.cmx lfsc/lfscLexer.cmx smtlib2/smtlib2_genConstr.cmx trace/smtCommands.cmx verit/verit.cmx lfsc/lfsc.cmx smtcoq_plugin.cmx
- $(CAMLOPTLINK) $(ZFLAGS) -a -o $@ $^
-
-ml: verit/veritParser.ml verit/veritLexer.ml ../3rdparty/alt-ergo/smtlib2_parse.ml ../3rdparty/alt-ergo/smtlib2_lex.ml smtlib2/sExprParser.ml smtlib2/sExprLexer.ml lfsc/lfscParser.ml lfsc/lfscLexer.ml
-
-
-%.ml %.mli: %.mly
- $(CAMLYACC) $<
-
-%.ml: %.mll
- $(CAMLLEX) $<
-
-vtest:
- cd ../unit-tests; make veritv
-
-ztest:
- cd ../unit-tests; make zchaffv
-
-test:
- cd ../unit-tests; make vernac
-
-####################
-# #
-# Special targets. #
-# #
-####################
-
-byte:
- $(MAKE) all "OPT:=-byte"
-
-opt:
- $(MAKE) all "OPT:=-opt"
-
-userinstall:
- +$(MAKE) USERINSTALL=true install
-
-install-natdynlink:
- for i in $(CMXS); do \
- install -d `dirname $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i`; \
- install -m 0644 $$i $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i; \
- done
- for i in $(CMXA); do \
- install -d `dirname $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i`; \
- install -m 0644 $$i $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i; \
- done
- for i in $(VCMXS); do \
- install -d `dirname $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i`; \
- install -m 0644 $$i $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i; \
- done
-
-install:$(if ifeq '$(HASNATDYNLINK)' 'true',install-natdynlink)
- for i in $(VOFILES) $(OBJFILES) $(OBJFILES:.o=.cm*); do \
- install -d `dirname $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i`; \
- install -m 0644 $$i $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i; \
- done
- for i in $(CMXFILES); do \
- install -d `dirname $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i`; \
- install -m 0644 $$i $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i; \
- done
- for i in $(CMIFILES); do \
- install -d `dirname $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i`; \
- install -m 0644 $$i $(DSTROOT)$(COQLIBINSTALL)/SMTCoq/$$i; \
- done
-
-install-doc:
- install -d $(DSTROOT)$(COQDOCINSTALL)/SMTCoq/html
- for i in html/*; do \
- install -m 0644 $$i $(DSTROOT)$(COQDOCINSTALL)/SMTCoq/$$i;\
- done
- install -d $(DSTROOT)$(COQDOCINSTALL)/SMTCoq/mlihtml
- for i in mlihtml/*; do \
- install -m 0644 $$i $(DSTROOT)$(COQDOCINSTALL)/SMTCoq/$$i;\
- done
-
-clean:
- rm -f $(ALLCMOFILES) $(CMIFILES) $(CMAFILES)
- rm -f $(ALLCMOFILES:.cmo=.cmx) $(CMXAFILES) $(CMXSFILES) $(ALLCMOFILES:.cmo=.o) $(CMXAFILES:.cmxa=.a)
- rm -f $(addsuffix .d,$(MLFILES) $(MLIFILES) $(ML4FILES) $(MLLIBFILES) $(MLPACKFILES))
- rm -f $(OBJFILES) $(OBJFILES:.o=.native)
- rm -f $(OBJFILES:.o=.cmi) $(OBJFILES:.o=.cmo)
- rm -f $(OBJFILES:.o=.cmx) $(OBJFILES:.o=.cmxs)
- rm -f $(VOFILES) $(VIFILES) $(GFILES) $(VFILES:.v=.v.d) $(VFILES:=.beautified) $(VFILES:=.old)
- rm -f all.ps all-gal.ps all.pdf all-gal.pdf all.glob $(VFILES:.v=.glob) $(VFILES:.v=.tex) $(VFILES:.v=.g.tex) all-mli.tex
- - rm -rf html mlihtml
- - rm -rf $(CMXS)
- - rm -rf $(CMXA)
- - rm -rf ml
- - rm -rf vtest
- - rm -rf ztest
- - rm -rf test
- - rm -f NSMTCoq* cnf/NSMTCoq* euf/NSMTCoq* lia/NSMTCoq* spl/NSMTCoq* ../unit-tests/NSMTCoq* ../unit-tests/*.vo ../unit-tests/*.zlog ../unit-tests/*.vtlog verit/veritParser.mli verit/veritParser.ml verit/veritLexer.ml ../3rdparty/alt-ergo/smtlib2_parse.mli ../3rdparty/alt-ergo/smtlib2_parse.ml ../3rdparty/alt-ergo/smtlib2_lex.ml smtlib2/sExprParser.mli smtlib2/sExprParser.ml smtlib2/sExprLexer.ml lfsc/lfscLexer.ml lfsc/lfscParser.ml lfsc/lfscParser.mli trace/smtcoq.a
-
-archclean:
- rm -f *.cmx *.o
-
-printenv:
- @$(COQBIN)coqtop -config
- @echo CAMLC = $(CAMLC)
- @echo CAMLOPTC = $(CAMLOPTC)
- @echo PP = $(PP)
- @echo COQFLAGS = $(COQFLAGS)
- @echo COQLIBINSTALL = $(COQLIBINSTALL)
- @echo COQDOCINSTALL = $(COQDOCINSTALL)
-
-
-###################
-# #
-# Implicit rules. #
-# #
-###################
-
-%.cmi: %.mli
- $(CAMLC) $(ZDEBUG) $(ZFLAGS) $<
-
-%.mli.d: %.mli
- $(OCAMLDEP) -slash $(OCAMLLIBS) "$<" > "$@" || ( RV=$$?; rm -f "$@"; exit $${RV} )
-
-%.cmo: %.ml4
- $(CAMLC) $(ZDEBUG) $(ZFLAGS) $(PP) -impl $<
-
-%.cmx: %.ml4
- $(CAMLOPTC) $(ZDEBUG) $(ZFLAGS) $(PP) -impl $<
-
-%.ml4.d: %.ml4
- $(OCAMLDEP) -slash $(OCAMLLIBS) $(PP) -impl "$<" > "$@" || ( RV=$$?; rm -f "$@"; exit $${RV} )
-
-%.cmo: %.ml
- $(CAMLC) $(ZDEBUG) $(ZFLAGS) $<
-
-%.cmx: %.ml
- $(CAMLOPTC) $(ZDEBUG) $(ZFLAGS) $<
-
-%.ml.d: %.ml
- $(OCAMLDEP) -slash $(OCAMLLIBS) "$<" > "$@" || ( RV=$$?; rm -f "$@"; exit $${RV} )
-
-%.cmxs: %.cmx
- $(CAMLOPTLINK) $(ZDEBUG) $(ZFLAGS) -shared -o $@ $<
-
-%.vo %.glob: %.v
- $(COQC) $(COQDEBUG) $(COQFLAGS) $*
-
-%.vi: %.v
- $(COQC) -i $(COQDEBUG) $(COQFLAGS) $*
-
-%.g: %.v
- $(GALLINA) $<
-
-%.tex: %.v
- $(COQDOC) $(COQDOCFLAGS) -latex $< -o $@
-
-%.html: %.v %.glob
- $(COQDOC) $(COQDOCFLAGS) -html $< -o $@
-
-%.g.tex: %.v
- $(COQDOC) $(COQDOCFLAGS) -latex -g $< -o $@
-
-%.g.html: %.v %.glob
- $(COQDOC)$(COQDOCFLAGS) -html -g $< -o $@
-
-%.v.d: %.v
- $(COQDEP) -slash $(COQLIBS) "$<" > "$@" || ( RV=$$?; rm -f "$@"; exit $${RV} )
-
-%.v.beautified:
- $(COQC) $(COQDEBUG) $(COQFLAGS) -beautify $*
-
-# WARNING
-#
-# This Makefile has been automagically generated
-# Edit at your own risks !
-#
-# END OF WARNING
-
diff --git a/src/versions/native/Structures_native.v b/src/versions/native/Structures_native.v
deleted file mode 100644
index 47ae21f..0000000
--- a/src/versions/native/Structures_native.v
+++ /dev/null
@@ -1,59 +0,0 @@
-(**************************************************************************)
-(* *)
-(* SMTCoq *)
-(* Copyright (C) 2011 - 2021 *)
-(* *)
-(* See file "AUTHORS" for the list of authors *)
-(* *)
-(* This file is distributed under the terms of the CeCILL-C licence *)
-(* *)
-(**************************************************************************)
-
-
-Require Import PArray.
-
-
-Section Trace.
-
- (* We use [array array step] to allow bigger trace *)
- Definition trace (step:Type) := array (array step).
-
- Definition trace_to_list {step:Type} (t:trace step) : list step :=
- PArray.fold_left (fun res a => List.app res (PArray.to_list a)) nil t.
-
- Definition trace_length {step:Type} (t:trace step) : int :=
- PArray.fold_left (fun l a => (l + (length a))%int63) 0%int63 t.
-
- Definition trace_get {step:Type} (t:trace step) (i:int) : step :=
- snd (PArray.fold_left (fun (jres:(option int) * step) a =>
- let (j,res) := jres in
- match j with
- | Some j' =>
- let l := length a in
- if (j' < l)%int63 then
- (None, get a j')
- else
- ((Some ((j' - l)%int63)),res)
- | None => (None,res)
- end
- ) (Some i, (get (get t 0) 0)) t).
-
- Definition trace_fold {state step:Type} (transition: state -> step -> state) (s0:state) (t:trace step) :=
- PArray.fold_left (PArray.fold_left transition) s0 t.
-
- Lemma trace_fold_ind (state step : Type) (P : state -> Prop) (transition : state -> step -> state) (t : trace step)
- (IH: forall (s0 : state) (i : int), (i < trace_length t)%int63 = true -> P s0 -> P (transition s0 (trace_get t i))) :
- forall s0 : state, P s0 -> P (trace_fold transition s0 t).
- Proof.
- apply PArray.fold_left_ind.
- intros a i Hi Ha.
- apply PArray.fold_left_ind;trivial.
- intros a0 i0 Hi0 Ha0. (* IH applied to a0 and (sum of the lengths of the first i arrays + i0) *)
- Admitted.
-
-End Trace.
-
-
-Definition nat_eqb := beq_nat.
-Definition nat_eqb_eq := beq_nat_true_iff.
-Definition nat_eqb_refl := NPeano.Nat.eqb_refl.
diff --git a/src/versions/native/Tactics_native.v b/src/versions/native/Tactics_native.v
deleted file mode 100644
index 45d3603..0000000
--- a/src/versions/native/Tactics_native.v
+++ /dev/null
@@ -1,55 +0,0 @@
-(**************************************************************************)
-(* *)
-(* SMTCoq *)
-(* Copyright (C) 2011 - 2021 *)
-(* *)
-(* See file "AUTHORS" for the list of authors *)
-(* *)
-(* This file is distributed under the terms of the CeCILL-C licence *)
-(* *)
-(**************************************************************************)
-
-
-Require Import Psatz.
-
-Declare ML Module "smtcoq_plugin".
-
-
-
-Tactic Notation "verit_bool" constr_list(h) :=
- fail "Tactics are not supported with native-coq".
-
-Tactic Notation "verit_bool_no_check" constr_list(h) :=
- fail "Tactics are not supported with native-coq".
-
-
-(** Tactics in Prop **)
-
-Ltac zchaff :=
- fail "Tactics are not supported with native-coq".
-Ltac zchaff_no_check :=
- fail "Tactics are not supported with native-coq".
-
-Tactic Notation "verit" constr_list(h) :=
- fail "Tactics are not supported with native-coq".
-Tactic Notation "verit_no_check" constr_list(h) :=
- fail "Tactics are not supported with native-coq".
-
-Ltac cvc4 :=
- fail "Tactics are not supported with native-coq".
-Ltac cvc4_no_check :=
- fail "Tactics are not supported with native-coq".
-
-
-Tactic Notation "smt" constr_list(h) :=
- fail "Tactics are not supported with native-coq".
-Tactic Notation "smt_no_check" constr_list(h) :=
- fail "Tactics are not supported with native-coq".
-
-
-
-(*
- Local Variables:
- coq-load-path: ((rec "../.." "SMTCoq"))
- End:
-*)
diff --git a/src/versions/native/smtcoq_plugin_native.ml4 b/src/versions/native/smtcoq_plugin_native.ml4
deleted file mode 100644
index ebf8511..0000000
--- a/src/versions/native/smtcoq_plugin_native.ml4
+++ /dev/null
@@ -1,99 +0,0 @@
-(**************************************************************************)
-(* *)
-(* SMTCoq *)
-(* Copyright (C) 2011 - 2021 *)
-(* *)
-(* See file "AUTHORS" for the list of authors *)
-(* *)
-(* This file is distributed under the terms of the CeCILL-C licence *)
-(* *)
-(**************************************************************************)
-
-
-VERNAC COMMAND EXTEND Vernac_zchaff
-| [ "Parse_certif_zchaff"
- ident(dimacs) ident(trace) string(fdimacs) string(fproof) ] ->
- [
- Zchaff.parse_certif dimacs trace fdimacs fproof
- ]
-| [ "Zchaff_Checker" string(fdimacs) string(fproof) ] ->
- [
- Zchaff.checker fdimacs fproof
- ]
-| [ "Zchaff_Theorem" ident(name) string(fdimacs) string(fproof) ] ->
- [
- Zchaff.theorem name fdimacs fproof
- ]
-END
-
-VERNAC COMMAND EXTEND Vernac_zchaff_abs
-| [ "Zchaff_Theorem_Abs" ident(name) string(fdimacs) string(fproof) ] ->
- [
- Zchaff.theorem_abs name fdimacs fproof
- ]
-END
-
-VERNAC COMMAND EXTEND Vernac_verit
-| [ "Parse_certif_verit"
- ident(t_i) ident(t_func) ident(t_atom) ident(t_form) ident(root) ident(used_roots) ident(trace) string(fsmt) string(fproof) ] ->
- [
- Verit.parse_certif t_i t_func t_atom t_form root used_roots trace fsmt fproof
- ]
-| [ "Verit_Checker" string(fsmt) string(fproof) ] ->
- [
- Verit.checker fsmt fproof
- ]
-| [ "Verit_Checker_Debug" string(fsmt) string(fproof) ] ->
- [
- Verit.checker_debug fsmt fproof
- ]
-| [ "Verit_Theorem" ident(name) string(fsmt) string(fproof) ] ->
- [
- Verit.theorem name fsmt fproof
- ]
-END
-
-VERNAC COMMAND EXTEND Vernac_lfsc
-| [ "Parse_certif_lfsc"
- ident(t_i) ident(t_func) ident(t_atom) ident(t_form) ident(root) ident(used_roots) ident(trace) string(fsmt) string(fproof) ] ->
- [
- Lfsc.parse_certif t_i t_func t_atom t_form root used_roots trace fsmt fproof
- ]
-| [ "Lfsc_Checker" string(fsmt) string(fproof) ] ->
- [
- Lfsc.checker fsmt fproof
- ]
-| [ "Lfsc_Checker_Debug" string(fsmt) string(fproof) ] ->
- [
- Lfsc.checker_debug fsmt fproof
- ]
-| [ "Lfsc_Theorem" ident(name) string(fsmt) string(fproof) ] ->
- [
- Lfsc.theorem name fsmt fproof
- ]
-END
-
-TACTIC EXTEND Tactic_zchaff
-| [ "zchaff_bool" ] -> [ Zchaff.tactic () ]
-| [ "zchaff_bool_no_check" ] -> [ Zchaff.tactic_no_check () ]
-END
-
-let lemmas_list = ref []
-
-VERNAC COMMAND EXTEND Add_lemma
-| [ "Add_lemmas" constr_list(lems) ] -> [ lemmas_list := lems @ !lemmas_list ]
-| [ "Clear_lemmas" ] -> [ lemmas_list := [] ]
-END
-
-
-let error () = Structures.error "Tactics are not supported with native-coq"
-
-TACTIC EXTEND Tactic_verit
-| [ "verit_bool_base" constr_list(lpl) ] -> [ error () ]
-| [ "verit_bool_no_check_base" constr_list(lpl) ] -> [ error () ]
-END
-
-TACTIC EXTEND Tactic_cvc4
-| [ "cvc4_bool" ] -> [ error () ]
-| [ "cvc4_bool_no_check" ] -> [ error () ]
-END
diff --git a/src/versions/native/structures.ml b/src/versions/native/structures.ml
deleted file mode 100644
index 0738801..0000000
--- a/src/versions/native/structures.ml
+++ /dev/null
@@ -1,188 +0,0 @@
-(**************************************************************************)
-(* *)
-(* SMTCoq *)
-(* Copyright (C) 2011 - 2021 *)
-(* *)
-(* See file "AUTHORS" for the list of authors *)
-(* *)
-(* This file is distributed under the terms of the CeCILL-C licence *)
-(* *)
-(**************************************************************************)
-
-
-open Entries
-open Coqlib
-
-
-(* Constr generation and manipulation *)
-type id = Names.identifier
-let mkId = Names.id_of_string
-
-
-type name = Names.name
-let name_of_id i = Names.Name i
-let mkName s =
- let id = mkId s in
- name_of_id id
-let string_of_name = function
- Names.Name id -> Names.string_of_id id
- | _ -> failwith "unnamed rel"
-
-
-type constr = Term.constr
-type types = Term.types
-let eq_constr = Term.eq_constr
-let hash_constr = Term.hash_constr
-let mkProp = Term.mkProp
-let mkConst = Term.mkConst
-let mkVar = Term.mkVar
-let mkRel = Term.mkRel
-let isRel = Term.isRel
-let destRel = Term.destRel
-let lift = Term.lift
-let mkApp = Term.mkApp
-let decompose_app = Term.decompose_app
-let mkLambda = Term.mkLambda
-let mkProd = Term.mkProd
-let mkLetIn = Term.mkLetIn
-
-let pr_constr_env = Printer.pr_constr_env
-let pr_constr = Printer.pr_constr
-
-
-let dummy_loc = Pp.dummy_loc
-
-let mkUConst c =
- { const_entry_body = c;
- const_entry_type = None;
- const_entry_secctx = None;
- const_entry_opaque = false;
- const_entry_inline_code = false}
-
-let mkTConst c _ ty =
- { const_entry_body = c;
- const_entry_type = Some ty;
- const_entry_secctx = None;
- const_entry_opaque = false;
- const_entry_inline_code = false}
-
-(* TODO : Set -> Type *)
-let declare_new_type t =
- Command.declare_assumption false (Decl_kinds.Local,Decl_kinds.Definitional) Term.mkSet [] false None (dummy_loc, t);
- Term.mkVar t
-
-let declare_new_variable v constr_t =
- Command.declare_assumption false (Decl_kinds.Local,Decl_kinds.Definitional) constr_t [] false None (dummy_loc, v);
- Term.mkVar v
-
-let declare_constant n c =
- Declare.declare_constant n (DefinitionEntry c, Decl_kinds.IsDefinition Decl_kinds.Definition)
-
-
-type cast_kind = Term.cast_kind
-let vmcast = Term.VMcast
-let mkCast = Term.mkCast
-
-
-(* EConstr *)
-type econstr = Term.constr
-let econstr_of_constr e = e
-
-
-(* Modules *)
-let gen_constant modules constant = lazy (gen_constant_in_modules "SMT" modules constant)
-
-
-(* Int63 *)
-let int63_modules = [["Coq";"Numbers";"Cyclic";"Int63";"Int63Native"]]
-
-let mkInt : int -> Term.constr =
- fun i -> Term.mkInt (Uint63.of_int i)
-
-let cint = gen_constant int63_modules "int"
-
-
-(* PArray *)
-let parray_modules = [["Coq";"Array";"PArray"]]
-
-let max_array_size : int =
- Parray.trunc_size (Uint63.of_int 4194303)
-let mkArray : Term.types * Term.constr array -> Term.constr =
- Term.mkArray
-
-
-(* Traces *)
-(* WARNING: side effect on r! *)
-let mkTrace step_to_coq next carray _ _ _ _ size step def_step r =
- let max = max_array_size - 1 in
- let q,r1 = size / max, size mod max in
- let trace =
- let len = if r1 = 0 then q + 1 else q + 2 in
- Array.make len (mkArray (step, [|def_step|])) in
- for j = 0 to q - 1 do
- let tracej = Array.make max_array_size def_step in
- for i = 0 to max - 1 do
- r := next !r;
- tracej.(i) <- step_to_coq !r;
- done;
- trace.(j) <- mkArray (step, tracej)
- done;
- if r1 <> 0 then (
- let traceq = Array.make (r1 + 1) def_step in
- for i = 0 to r1-1 do
- r := next !r;
- traceq.(i) <- step_to_coq !r;
- done;
- trace.(q) <- mkArray (step, traceq)
- );
- mkArray (Term.mkApp (Lazy.force carray, [|step|]), trace)
-
-
-(* Micromega *)
-module Micromega_plugin_Micromega = Micromega
-module Micromega_plugin_Mutils = Mutils
-module Micromega_plugin_Certificate = Certificate
-module Micromega_plugin_Coq_micromega = Coq_micromega
-
-let micromega_coq_proofTerm =
- Coq_micromega.M.coq_proofTerm
-
-let micromega_dump_proof_term p =
- Coq_micromega.dump_proof_term p
-
-
-(* Tactics *)
-type tactic = Proof_type.tactic
-let tclTHEN = Tacticals.tclTHEN
-let tclTHENLAST = Tacticals.tclTHENLAST
-let assert_before = Tactics.assert_tac
-let vm_cast_no_check = Tactics.vm_cast_no_check
-let mk_tactic tac gl =
- let env = Tacmach.pf_env gl in
- let sigma = Tacmach.project gl in
- let t = Tacmach.pf_concl gl in
- tac env sigma t gl
-let set_evars_tac _ = Tacticals.tclIDTAC
-
-
-(* Other differences between the two versions of Coq *)
-type constr_expr = Topconstr.constr_expr
-let error = Errors.error
-let warning _ s = Pp.warning s
-let extern_constr = Constrextern.extern_constr true Environ.empty_env
-let destruct_rel_decl (n, _, t) = n, t
-let interp_constr env sigma = Constrintern.interp_constr sigma env
-let ppconstr_lsimpleconstr = Ppconstr.lsimple
-let constrextern_extern_constr =
- let env = Global.env () in
- Constrextern.extern_constr false env
-
-let get_rel_dec_name = fun _ -> Names.Anonymous
-
-(* Eta-expanded to get rid of optional arguments *)
-let retyping_get_type_of env = Retyping.get_type_of env
-
-let vm_conv = Reduction.vm_conv
-let cbv_vm = Vnorm.cbv_vm
-
-
diff --git a/src/versions/native/structures.mli b/src/versions/native/structures.mli
deleted file mode 100644
index d8071d9..0000000
--- a/src/versions/native/structures.mli
+++ /dev/null
@@ -1,119 +0,0 @@
-(**************************************************************************)
-(* *)
-(* SMTCoq *)
-(* Copyright (C) 2011 - 2021 *)
-(* *)
-(* See file "AUTHORS" for the list of authors *)
-(* *)
-(* This file is distributed under the terms of the CeCILL-C licence *)
-(* *)
-(**************************************************************************)
-
-
-(* Constr generation and manipulation *)
-type id = Names.variable
-val mkId : string -> id
-
-type name
-val name_of_id : id -> name
-val mkName : string -> name
-val string_of_name : name -> string
-
-type constr = Term.constr
-type types = constr
-val eq_constr : constr -> constr -> bool
-val hash_constr : constr -> int
-val mkProp : types
-val mkConst : Names.constant -> constr
-val mkVar : id -> constr
-val mkRel : int -> constr
-val isRel : constr -> bool
-val destRel : constr -> int
-val lift : int -> constr -> constr
-val mkApp : constr * constr array -> constr
-val decompose_app : constr -> constr * constr list
-val mkLambda : name * types * constr -> constr
-val mkProd : name * types * types -> types
-val mkLetIn : name * constr * types * constr -> constr
-
-val pr_constr_env : Environ.env -> constr -> Pp.std_ppcmds
-val pr_constr : constr -> Pp.std_ppcmds
-
-val mkUConst : constr -> Entries.definition_entry
-val mkTConst : constr -> 'a -> types -> Entries.definition_entry
-val declare_new_type : id -> types
-val declare_new_variable : id -> types -> constr
-val declare_constant : id -> Entries.definition_entry -> Names.constant
-
-type cast_kind
-val vmcast : cast_kind
-val mkCast : constr * cast_kind * constr -> constr
-
-
-(* EConstr *)
-type econstr = constr
-val econstr_of_constr : constr -> econstr
-
-
-(* Modules *)
-val gen_constant : string list list -> string -> constr lazy_t
-
-
-(* Int63 *)
-val int63_modules : string list list
-val mkInt : int -> constr
-val cint : constr lazy_t
-
-
-(* PArray *)
-val parray_modules : string list list
-val max_array_size : int
-val mkArray : types * constr array -> constr
-
-
-(* Traces *)
-val mkTrace :
- ('a -> constr) ->
- ('a -> 'a) ->
- constr Lazy.t ->
- 'b ->
- 'c -> 'd -> 'e -> int -> types -> constr -> 'a ref -> constr
-
-
-(* Micromega *)
-module Micromega_plugin_Micromega = Micromega
-module Micromega_plugin_Mutils = Mutils
-module Micromega_plugin_Certificate = Certificate
-module Micromega_plugin_Coq_micromega = Coq_micromega
-
-val micromega_coq_proofTerm : constr lazy_t
-val micromega_dump_proof_term : Micromega_plugin_Certificate.Mc.zArithProof -> constr
-
-
-(* Tactics *)
-type tactic = Proof_type.tactic
-val tclTHEN : Proof_type.tactic -> Proof_type.tactic -> Proof_type.tactic
-val tclTHENLAST : Proof_type.tactic -> Proof_type.tactic -> Proof_type.tactic
-val assert_before : name -> types -> Proof_type.tactic
-val vm_cast_no_check : constr -> Proof_type.tactic
-val mk_tactic :
- (Environ.env ->
- Evd.evar_map -> types -> Proof_type.goal Tacmach.sigma -> 'a) ->
- Proof_type.goal Tacmach.sigma -> 'a
-val set_evars_tac : 'a -> Proof_type.tactic
-
-
-(* Other differences between the two versions of Coq *)
-type constr_expr = Topconstr.constr_expr
-val error : string -> 'a
-val warning : string -> string -> unit
-val extern_constr : constr -> Topconstr.constr_expr
-val destruct_rel_decl : Term.rel_declaration -> name * types
-val interp_constr : Environ.env -> Evd.evar_map -> Topconstr.constr_expr -> constr
-val ppconstr_lsimpleconstr : Ppconstr.precedence
-val constrextern_extern_constr : constr -> Topconstr.constr_expr
-val get_rel_dec_name : 'a -> name
-val retyping_get_type_of : Environ.env -> Evd.evar_map -> constr -> constr
-
-val vm_conv : Reduction.conv_pb -> types Reduction.conversion_function
-val cbv_vm : Environ.env -> constr -> types -> constr
diff --git a/src/versions/standard/Structures_standard.v b/src/versions/standard/Structures_standard.v
deleted file mode 100644
index 1a0abf5..0000000
--- a/src/versions/standard/Structures_standard.v
+++ /dev/null
@@ -1,64 +0,0 @@
-(**************************************************************************)
-(* *)
-(* SMTCoq *)
-(* Copyright (C) 2011 - 2021 *)
-(* *)
-(* See file "AUTHORS" for the list of authors *)
-(* *)
-(* This file is distributed under the terms of the CeCILL-C licence *)
-(* *)
-(**************************************************************************)
-
-
-Require Import Int63.
-
-Require Import List.
-
-
-Section Trace.
-
- Definition trace (step:Type) := ((list step) * step)%type.
-
- Definition trace_to_list {step:Type} (t:trace step) : list step :=
- let (t, _) := t in t.
-
- Definition trace_length {step:Type} (t:trace step) : int :=
- let (t,_) := t in
- List.fold_left (fun i _ => (i+1)%int) t 0%int.
-
- Fixpoint trace_get_aux {step:Type} (t:list step) (def:step) (i:int) : step :=
- match t with
- | nil => def
- | s::ss =>
- if (i == 0)%int then
- s
- else
- trace_get_aux ss def (i-1)
- end.
- Definition trace_get {step:Type} (t:trace step) : int -> step :=
- let (t,def) := t in trace_get_aux t def.
-
- Definition trace_fold {state step:Type} (transition: state -> step -> state) (s0:state) (t:trace step) :=
- let (t,_) := t in
- List.fold_left transition t s0.
-
- Lemma trace_fold_ind (state step : Type) (P : state -> Prop) (transition : state -> step -> state) (t : trace step)
- (IH: forall (s0 : state) (i : int), (i < trace_length t)%int = true -> P s0 -> P (transition s0 (trace_get t i))) :
- forall s0 : state, P s0 -> P (trace_fold transition s0 t).
- Admitted.
-
-End Trace.
-
-
-Require Import PeanoNat.
-
-Definition nat_eqb := Nat.eqb.
-Definition nat_eqb_eq := Nat.eqb_eq.
-Definition nat_eqb_refl := Nat.eqb_refl.
-
-
-(*
- Local Variables:
- coq-load-path: ((rec "../.." "SMTCoq"))
- End:
-*)
diff --git a/src/versions/standard/coq_micromega_full.ml b/src/versions/standard/coq_micromega_full.ml
deleted file mode 100644
index d957110..0000000
--- a/src/versions/standard/coq_micromega_full.ml
+++ /dev/null
@@ -1,2215 +0,0 @@
-(*** This file is taken from Coq-8.9.0 to expose more functions than
- coq_micromega.mli does.
- See https://github.com/coq/coq/issues/9749 . ***)
-
-
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-(* *)
-(* Micromega: A reflexive tactic using the Positivstellensatz *)
-(* *)
-(* ** Toplevel definition of tactics ** *)
-(* *)
-(* - Modules ISet, M, Mc, Env, Cache, CacheZ *)
-(* *)
-(* Frédéric Besson (Irisa/Inria) 2006-20011 *)
-(* *)
-(************************************************************************)
-
-open Pp
-open Names
-open Goptions
-open Mutils_full
-open Constr
-open Tactypes
-
-module Micromega = Micromega_plugin.Micromega
-module Certificate = Micromega_plugin.Certificate
-module Sos_types = Micromega_plugin.Sos_types
-module Mfourier = Micromega_plugin.Mfourier
-
-(**
- * Debug flag
- *)
-
-let debug = false
-
-(* Limit the proof search *)
-
-let max_depth = max_int
-
-(* Search limit for provers over Q R *)
-let lra_proof_depth = ref max_depth
-
-
-(* Search limit for provers over Z *)
-let lia_enum = ref true
-let lia_proof_depth = ref max_depth
-
-let get_lia_option () =
- (!lia_enum,!lia_proof_depth)
-
-let get_lra_option () =
- !lra_proof_depth
-
-
-
-let _ =
-
- let int_opt l vref =
- {
- optdepr = false;
- optname = List.fold_right (^) l "";
- optkey = l ;
- optread = (fun () -> Some !vref);
- optwrite = (fun x -> vref := (match x with None -> max_depth | Some v -> v))
- } in
-
- let lia_enum_opt =
- {
- optdepr = false;
- optname = "Lia Enum";
- optkey = ["Lia2";"Enum"];
- optread = (fun () -> !lia_enum);
- optwrite = (fun x -> lia_enum := x)
- } in
- let _ = declare_int_option (int_opt ["Lra2"; "Depth"] lra_proof_depth) in
- let _ = declare_int_option (int_opt ["Lia2"; "Depth"] lia_proof_depth) in
- let _ = declare_bool_option lia_enum_opt in
- ()
-
-(**
- * Initialize a tag type to the Tag module declaration (see Mutils).
- *)
-
-type tag = Tag.t
-
-(**
- * An atom is of the form:
- * pExpr1 \{<,>,=,<>,<=,>=\} pExpr2
- * where pExpr1, pExpr2 are polynomial expressions (see Micromega). pExprs are
- * parametrized by 'cst, which is used as the type of constants.
- *)
-
-type 'cst atom = 'cst Micromega.formula
-
-(**
- * Micromega's encoding of formulas.
- * By order of appearance: boolean constants, variables, atoms, conjunctions,
- * disjunctions, negation, implication.
-*)
-
-type 'cst formula =
- | TT
- | FF
- | X of EConstr.constr
- | A of 'cst atom * tag * EConstr.constr
- | C of 'cst formula * 'cst formula
- | D of 'cst formula * 'cst formula
- | N of 'cst formula
- | I of 'cst formula * Names.Id.t option * 'cst formula
-
-(**
- * Formula pretty-printer.
- *)
-
-let rec pp_formula o f =
- match f with
- | TT -> output_string o "tt"
- | FF -> output_string o "ff"
- | X c -> output_string o "X "
- | A(_,t,_) -> Printf.fprintf o "A(%a)" Tag.pp t
- | C(f1,f2) -> Printf.fprintf o "C(%a,%a)" pp_formula f1 pp_formula f2
- | D(f1,f2) -> Printf.fprintf o "D(%a,%a)" pp_formula f1 pp_formula f2
- | I(f1,n,f2) -> Printf.fprintf o "I(%a%s,%a)"
- pp_formula f1
- (match n with
- | Some id -> Names.Id.to_string id
- | None -> "") pp_formula f2
- | N(f) -> Printf.fprintf o "N(%a)" pp_formula f
-
-
-let rec map_atoms fct f =
- match f with
- | TT -> TT
- | FF -> FF
- | X x -> X x
- | A (at,tg,cstr) -> A(fct at,tg,cstr)
- | C (f1,f2) -> C(map_atoms fct f1, map_atoms fct f2)
- | D (f1,f2) -> D(map_atoms fct f1, map_atoms fct f2)
- | N f -> N(map_atoms fct f)
- | I(f1,o,f2) -> I(map_atoms fct f1, o , map_atoms fct f2)
-
-let rec map_prop fct f =
- match f with
- | TT -> TT
- | FF -> FF
- | X x -> X (fct x)
- | A (at,tg,cstr) -> A(at,tg,cstr)
- | C (f1,f2) -> C(map_prop fct f1, map_prop fct f2)
- | D (f1,f2) -> D(map_prop fct f1, map_prop fct f2)
- | N f -> N(map_prop fct f)
- | I(f1,o,f2) -> I(map_prop fct f1, o , map_prop fct f2)
-
-(**
- * Collect the identifiers of a (string of) implications. Implication labels
- * are inherited from Coq/CoC's higher order dependent type constructor (Pi).
- *)
-
-let rec ids_of_formula f =
- match f with
- | I(f1,Some id,f2) -> id::(ids_of_formula f2)
- | _ -> []
-
-(**
- * A clause is a list of (tagged) nFormulas.
- * nFormulas are normalized formulas, i.e., of the form:
- * cPol \{=,<>,>,>=\} 0
- * with cPol compact polynomials (see the Pol inductive type in EnvRing.v).
- *)
-
-type 'cst clause = ('cst Micromega.nFormula * tag) list
-
-(**
- * A CNF is a list of clauses.
- *)
-
-type 'cst cnf = ('cst clause) list
-
-(**
- * True and False are empty cnfs and clauses.
- *)
-
-let tt : 'cst cnf = []
-
-let ff : 'cst cnf = [ [] ]
-
-(**
- * A refinement of cnf with tags left out. This is an intermediary form
- * between the cnf tagged list representation ('cst cnf) used to solve psatz,
- * and the freeform formulas ('cst formula) that is retrieved from Coq.
- *)
-
-module Mc = Micromega
-
-type 'cst mc_cnf = ('cst Mc.nFormula) list list
-
-(**
- * From a freeform formula, build a cnf.
- * The parametric functions negate and normalize are theory-dependent, and
- * originate in micromega.ml (extracted, e.g. for rnegate, from RMicromega.v
- * and RingMicromega.v).
- *)
-
-type 'a tagged_option = T of tag list | S of 'a
-
-let cnf
- (negate: 'cst atom -> 'cst mc_cnf) (normalise:'cst atom -> 'cst mc_cnf)
- (unsat : 'cst Mc.nFormula -> bool) (deduce : 'cst Mc.nFormula -> 'cst Mc.nFormula -> 'cst Mc.nFormula option) (f:'cst formula) =
-
- let negate a t =
- List.map (fun cl -> List.map (fun x -> (x,t)) cl) (negate a) in
-
- let normalise a t =
- List.map (fun cl -> List.map (fun x -> (x,t)) cl) (normalise a) in
-
- let and_cnf x y = x @ y in
-
-let rec add_term t0 = function
- | [] ->
- (match deduce (fst t0) (fst t0) with
- | Some u -> if unsat u then T [snd t0] else S (t0::[])
- | None -> S (t0::[]))
- | t'::cl0 ->
- (match deduce (fst t0) (fst t') with
- | Some u ->
- if unsat u
- then T [snd t0 ; snd t']
- else (match add_term t0 cl0 with
- | S cl' -> S (t'::cl')
- | T l -> T l)
- | None ->
- (match add_term t0 cl0 with
- | S cl' -> S (t'::cl')
- | T l -> T l)) in
-
-
- let rec or_clause cl1 cl2 =
- match cl1 with
- | [] -> S cl2
- | t0::cl ->
- (match add_term t0 cl2 with
- | S cl' -> or_clause cl cl'
- | T l -> T l) in
-
-
-
- let or_clause_cnf t f =
- List.fold_right (fun e (acc,tg) ->
- match or_clause t e with
- | S cl -> (cl :: acc,tg)
- | T l -> (acc,tg@l)) f ([],[]) in
-
-
- let rec or_cnf f f' =
- match f with
- | [] -> tt,[]
- | e :: rst ->
- let (rst_f',t) = or_cnf rst f' in
- let (e_f', t') = or_clause_cnf e f' in
- (rst_f' @ e_f', t @ t') in
-
-
- let rec xcnf (polarity : bool) f =
- match f with
- | TT -> if polarity then (tt,[]) else (ff,[])
- | FF -> if polarity then (ff,[]) else (tt,[])
- | X p -> if polarity then (ff,[]) else (ff,[])
- | A(x,t,_) -> ((if polarity then normalise x t else negate x t),[])
- | N(e) -> xcnf (not polarity) e
- | C(e1,e2) ->
- let e1,t1 = xcnf polarity e1 in
- let e2,t2 = xcnf polarity e2 in
- if polarity
- then and_cnf e1 e2, t1 @ t2
- else let f',t' = or_cnf e1 e2 in
- (f', t1 @ t2 @ t')
- | D(e1,e2) ->
- let e1,t1 = xcnf polarity e1 in
- let e2,t2 = xcnf polarity e2 in
- if polarity
- then let f',t' = or_cnf e1 e2 in
- (f', t1 @ t2 @ t')
- else and_cnf e1 e2, t1 @ t2
- | I(e1,_,e2) ->
- let e1 , t1 = (xcnf (not polarity) e1) in
- let e2 , t2 = (xcnf polarity e2) in
- if polarity
- then let f',t' = or_cnf e1 e2 in
- (f', t1 @ t2 @ t')
- else and_cnf e1 e2, t1 @ t2 in
-
- xcnf true f
-
-(**
- * MODULE: Ordered set of integers.
- *)
-
-module ISet = Set.Make(Int)
-
-(**
- * Given a set of integers s=\{i0,...,iN\} and a list m, return the list of
- * elements of m that are at position i0,...,iN.
- *)
-
-let selecti s m =
- let rec xselecti i m =
- match m with
- | [] -> []
- | e::m -> if ISet.mem i s then e::(xselecti (i+1) m) else xselecti (i+1) m in
- xselecti 0 m
-
-(**
- * MODULE: Mapping of the Coq data-strustures into Caml and Caml extracted
- * code. This includes initializing Caml variables based on Coq terms, parsing
- * various Coq expressions into Caml, and dumping Caml expressions into Coq.
- *
- * Opened here and in csdpcert.ml.
- *)
-
-module M =
-struct
-
- (**
- * Location of the Coq libraries.
- *)
-
- let logic_dir = ["Coq";"Logic";"Decidable"]
-
- let mic_modules =
- [
- ["Coq";"Lists";"List"];
- ["ZMicromega"];
- ["Tauto"];
- ["RingMicromega"];
- ["EnvRing"];
- ["Coq"; "micromega"; "ZMicromega"];
- ["Coq"; "micromega"; "RMicromega"];
- ["Coq" ; "micromega" ; "Tauto"];
- ["Coq" ; "micromega" ; "RingMicromega"];
- ["Coq" ; "micromega" ; "EnvRing"];
- ["Coq";"QArith"; "QArith_base"];
- ["Coq";"Reals" ; "Rdefinitions"];
- ["Coq";"Reals" ; "Rpow_def"];
- ["LRing_normalise"]]
-
- let coq_modules =
- Coqlib.(init_modules @
- [logic_dir] @ arith_modules @ zarith_base_modules @ mic_modules)
-
- let bin_module = [["Coq";"Numbers";"BinNums"]]
-
- let r_modules =
- [["Coq";"Reals" ; "Rdefinitions"];
- ["Coq";"Reals" ; "Rpow_def"] ;
- ["Coq";"Reals" ; "Raxioms"] ;
- ["Coq";"QArith"; "Qreals"] ;
- ]
-
- let z_modules = [["Coq";"ZArith";"BinInt"]]
-
- (**
- * Initialization : a large amount of Caml symbols are derived from
- * ZMicromega.v
- *)
-
- let gen_constant_in_modules s m n = EConstr.of_constr (UnivGen.constr_of_global @@ Coqlib.gen_reference_in_modules s m n)
- let init_constant = gen_constant_in_modules "ZMicromega" Coqlib.init_modules
- let constant = gen_constant_in_modules "ZMicromega" coq_modules
- let bin_constant = gen_constant_in_modules "ZMicromega" bin_module
- let r_constant = gen_constant_in_modules "ZMicromega" r_modules
- let z_constant = gen_constant_in_modules "ZMicromega" z_modules
- let m_constant = gen_constant_in_modules "ZMicromega" mic_modules
-
- let coq_and = lazy (init_constant "and")
- let coq_or = lazy (init_constant "or")
- let coq_not = lazy (init_constant "not")
-
- let coq_iff = lazy (init_constant "iff")
- let coq_True = lazy (init_constant "True")
- let coq_False = lazy (init_constant "False")
-
- let coq_cons = lazy (constant "cons")
- let coq_nil = lazy (constant "nil")
- let coq_list = lazy (constant "list")
-
- let coq_O = lazy (init_constant "O")
- let coq_S = lazy (init_constant "S")
-
- let coq_N0 = lazy (bin_constant "N0")
- let coq_Npos = lazy (bin_constant "Npos")
-
- let coq_xH = lazy (bin_constant "xH")
- let coq_xO = lazy (bin_constant "xO")
- let coq_xI = lazy (bin_constant "xI")
-
- let coq_Z = lazy (bin_constant "Z")
- let coq_ZERO = lazy (bin_constant "Z0")
- let coq_POS = lazy (bin_constant "Zpos")
- let coq_NEG = lazy (bin_constant "Zneg")
-
- let coq_Q = lazy (constant "Q")
- let coq_R = lazy (constant "R")
-
- let coq_Qmake = lazy (constant "Qmake")
-
- let coq_Rcst = lazy (constant "Rcst")
-
- let coq_C0 = lazy (m_constant "C0")
- let coq_C1 = lazy (m_constant "C1")
- let coq_CQ = lazy (m_constant "CQ")
- let coq_CZ = lazy (m_constant "CZ")
- let coq_CPlus = lazy (m_constant "CPlus")
- let coq_CMinus = lazy (m_constant "CMinus")
- let coq_CMult = lazy (m_constant "CMult")
- let coq_CInv = lazy (m_constant "CInv")
- let coq_COpp = lazy (m_constant "COpp")
-
-
- let coq_R0 = lazy (constant "R0")
- let coq_R1 = lazy (constant "R1")
-
- let coq_proofTerm = lazy (constant "ZArithProof")
- let coq_doneProof = lazy (constant "DoneProof")
- let coq_ratProof = lazy (constant "RatProof")
- let coq_cutProof = lazy (constant "CutProof")
- let coq_enumProof = lazy (constant "EnumProof")
-
- let coq_Zgt = lazy (z_constant "Z.gt")
- let coq_Zge = lazy (z_constant "Z.ge")
- let coq_Zle = lazy (z_constant "Z.le")
- let coq_Zlt = lazy (z_constant "Z.lt")
- let coq_Eq = lazy (init_constant "eq")
-
- let coq_Zplus = lazy (z_constant "Z.add")
- let coq_Zminus = lazy (z_constant "Z.sub")
- let coq_Zopp = lazy (z_constant "Z.opp")
- let coq_Zmult = lazy (z_constant "Z.mul")
- let coq_Zpower = lazy (z_constant "Z.pow")
-
- let coq_Qle = lazy (constant "Qle")
- let coq_Qlt = lazy (constant "Qlt")
- let coq_Qeq = lazy (constant "Qeq")
-
- let coq_Qplus = lazy (constant "Qplus")
- let coq_Qminus = lazy (constant "Qminus")
- let coq_Qopp = lazy (constant "Qopp")
- let coq_Qmult = lazy (constant "Qmult")
- let coq_Qpower = lazy (constant "Qpower")
-
- let coq_Rgt = lazy (r_constant "Rgt")
- let coq_Rge = lazy (r_constant "Rge")
- let coq_Rle = lazy (r_constant "Rle")
- let coq_Rlt = lazy (r_constant "Rlt")
-
- let coq_Rplus = lazy (r_constant "Rplus")
- let coq_Rminus = lazy (r_constant "Rminus")
- let coq_Ropp = lazy (r_constant "Ropp")
- let coq_Rmult = lazy (r_constant "Rmult")
- let coq_Rinv = lazy (r_constant "Rinv")
- let coq_Rpower = lazy (r_constant "pow")
- let coq_IZR = lazy (r_constant "IZR")
- let coq_IQR = lazy (r_constant "Q2R")
-
-
- let coq_PEX = lazy (constant "PEX" )
- let coq_PEc = lazy (constant"PEc")
- let coq_PEadd = lazy (constant "PEadd")
- let coq_PEopp = lazy (constant "PEopp")
- let coq_PEmul = lazy (constant "PEmul")
- let coq_PEsub = lazy (constant "PEsub")
- let coq_PEpow = lazy (constant "PEpow")
-
- let coq_PX = lazy (constant "PX" )
- let coq_Pc = lazy (constant"Pc")
- let coq_Pinj = lazy (constant "Pinj")
-
- let coq_OpEq = lazy (constant "OpEq")
- let coq_OpNEq = lazy (constant "OpNEq")
- let coq_OpLe = lazy (constant "OpLe")
- let coq_OpLt = lazy (constant "OpLt")
- let coq_OpGe = lazy (constant "OpGe")
- let coq_OpGt = lazy (constant "OpGt")
-
- let coq_PsatzIn = lazy (constant "PsatzIn")
- let coq_PsatzSquare = lazy (constant "PsatzSquare")
- let coq_PsatzMulE = lazy (constant "PsatzMulE")
- let coq_PsatzMultC = lazy (constant "PsatzMulC")
- let coq_PsatzAdd = lazy (constant "PsatzAdd")
- let coq_PsatzC = lazy (constant "PsatzC")
- let coq_PsatzZ = lazy (constant "PsatzZ")
-
- let coq_TT = lazy
- (gen_constant_in_modules "ZMicromega"
- [["Coq" ; "micromega" ; "Tauto"];["Tauto"]] "TT")
- let coq_FF = lazy
- (gen_constant_in_modules "ZMicromega"
- [["Coq" ; "micromega" ; "Tauto"];["Tauto"]] "FF")
- let coq_And = lazy
- (gen_constant_in_modules "ZMicromega"
- [["Coq" ; "micromega" ; "Tauto"];["Tauto"]] "Cj")
- let coq_Or = lazy
- (gen_constant_in_modules "ZMicromega"
- [["Coq" ; "micromega" ; "Tauto"];["Tauto"]] "D")
- let coq_Neg = lazy
- (gen_constant_in_modules "ZMicromega"
- [["Coq" ; "micromega" ; "Tauto"];["Tauto"]] "N")
- let coq_Atom = lazy
- (gen_constant_in_modules "ZMicromega"
- [["Coq" ; "micromega" ; "Tauto"];["Tauto"]] "A")
- let coq_X = lazy
- (gen_constant_in_modules "ZMicromega"
- [["Coq" ; "micromega" ; "Tauto"];["Tauto"]] "X")
- let coq_Impl = lazy
- (gen_constant_in_modules "ZMicromega"
- [["Coq" ; "micromega" ; "Tauto"];["Tauto"]] "I")
- let coq_Formula = lazy
- (gen_constant_in_modules "ZMicromega"
- [["Coq" ; "micromega" ; "Tauto"];["Tauto"]] "BFormula")
-
- (**
- * Initialization : a few Caml symbols are derived from other libraries;
- * QMicromega, ZArithRing, RingMicromega.
- *)
-
- let coq_QWitness = lazy
- (gen_constant_in_modules "QMicromega"
- [["Coq"; "micromega"; "QMicromega"]] "QWitness")
-
- let coq_Build = lazy
- (gen_constant_in_modules "RingMicromega"
- [["Coq" ; "micromega" ; "RingMicromega"] ; ["RingMicromega"] ]
- "Build_Formula")
- let coq_Cstr = lazy
- (gen_constant_in_modules "RingMicromega"
- [["Coq" ; "micromega" ; "RingMicromega"] ; ["RingMicromega"] ] "Formula")
-
- (**
- * Parsing and dumping : transformation functions between Caml and Coq
- * data-structures.
- *
- * dump_* functions go from Micromega to Coq terms
- * parse_* functions go from Coq to Micromega terms
- * pp_* functions pretty-print Coq terms.
- *)
-
- exception ParseError
-
- (* A simple but useful getter function *)
-
- let get_left_construct sigma term =
- match EConstr.kind sigma term with
- | Construct((_,i),_) -> (i,[| |])
- | App(l,rst) ->
- (match EConstr.kind sigma l with
- | Construct((_,i),_) -> (i,rst)
- | _ -> raise ParseError
- )
- | _ -> raise ParseError
-
- (* Access the Micromega module *)
-
- (* parse/dump/print from numbers up to expressions and formulas *)
-
- let rec parse_nat sigma term =
- let (i,c) = get_left_construct sigma term in
- match i with
- | 1 -> Mc.O
- | 2 -> Mc.S (parse_nat sigma (c.(0)))
- | i -> raise ParseError
-
- let pp_nat o n = Printf.fprintf o "%i" (CoqToCaml.nat n)
-
- let rec dump_nat x =
- match x with
- | Mc.O -> Lazy.force coq_O
- | Mc.S p -> EConstr.mkApp(Lazy.force coq_S,[| dump_nat p |])
-
- let rec parse_positive sigma term =
- let (i,c) = get_left_construct sigma term in
- match i with
- | 1 -> Mc.XI (parse_positive sigma c.(0))
- | 2 -> Mc.XO (parse_positive sigma c.(0))
- | 3 -> Mc.XH
- | i -> raise ParseError
-
- let rec dump_positive x =
- match x with
- | Mc.XH -> Lazy.force coq_xH
- | Mc.XO p -> EConstr.mkApp(Lazy.force coq_xO,[| dump_positive p |])
- | Mc.XI p -> EConstr.mkApp(Lazy.force coq_xI,[| dump_positive p |])
-
- let pp_positive o x = Printf.fprintf o "%i" (CoqToCaml.positive x)
-
- let dump_n x =
- match x with
- | Mc.N0 -> Lazy.force coq_N0
- | Mc.Npos p -> EConstr.mkApp(Lazy.force coq_Npos,[| dump_positive p|])
-
- let parse_z sigma term =
- let (i,c) = get_left_construct sigma term in
- match i with
- | 1 -> Mc.Z0
- | 2 -> Mc.Zpos (parse_positive sigma c.(0))
- | 3 -> Mc.Zneg (parse_positive sigma c.(0))
- | i -> raise ParseError
-
- let dump_z x =
- match x with
- | Mc.Z0 ->Lazy.force coq_ZERO
- | Mc.Zpos p -> EConstr.mkApp(Lazy.force coq_POS,[| dump_positive p|])
- | Mc.Zneg p -> EConstr.mkApp(Lazy.force coq_NEG,[| dump_positive p|])
-
- let pp_z o x = Printf.fprintf o "%s" (Big_int.string_of_big_int (CoqToCaml.z_big_int x))
-
- let dump_q q =
- EConstr.mkApp(Lazy.force coq_Qmake,
- [| dump_z q.Micromega.qnum ; dump_positive q.Micromega.qden|])
-
- let parse_q sigma term =
- match EConstr.kind sigma term with
- | App(c, args) -> if EConstr.eq_constr sigma c (Lazy.force coq_Qmake) then
- {Mc.qnum = parse_z sigma args.(0) ; Mc.qden = parse_positive sigma args.(1) }
- else raise ParseError
- | _ -> raise ParseError
-
-
- let rec pp_Rcst o cst =
- match cst with
- | Mc.C0 -> output_string o "C0"
- | Mc.C1 -> output_string o "C1"
- | Mc.CQ q -> output_string o "CQ _"
- | Mc.CZ z -> pp_z o z
- | Mc.CPlus(x,y) -> Printf.fprintf o "(%a + %a)" pp_Rcst x pp_Rcst y
- | Mc.CMinus(x,y) -> Printf.fprintf o "(%a - %a)" pp_Rcst x pp_Rcst y
- | Mc.CMult(x,y) -> Printf.fprintf o "(%a * %a)" pp_Rcst x pp_Rcst y
- | Mc.CInv t -> Printf.fprintf o "(/ %a)" pp_Rcst t
- | Mc.COpp t -> Printf.fprintf o "(- %a)" pp_Rcst t
-
-
- let rec dump_Rcst cst =
- match cst with
- | Mc.C0 -> Lazy.force coq_C0
- | Mc.C1 -> Lazy.force coq_C1
- | Mc.CQ q -> EConstr.mkApp(Lazy.force coq_CQ, [| dump_q q |])
- | Mc.CZ z -> EConstr.mkApp(Lazy.force coq_CZ, [| dump_z z |])
- | Mc.CPlus(x,y) -> EConstr.mkApp(Lazy.force coq_CPlus, [| dump_Rcst x ; dump_Rcst y |])
- | Mc.CMinus(x,y) -> EConstr.mkApp(Lazy.force coq_CMinus, [| dump_Rcst x ; dump_Rcst y |])
- | Mc.CMult(x,y) -> EConstr.mkApp(Lazy.force coq_CMult, [| dump_Rcst x ; dump_Rcst y |])
- | Mc.CInv t -> EConstr.mkApp(Lazy.force coq_CInv, [| dump_Rcst t |])
- | Mc.COpp t -> EConstr.mkApp(Lazy.force coq_COpp, [| dump_Rcst t |])
-
- let rec dump_list typ dump_elt l =
- match l with
- | [] -> EConstr.mkApp(Lazy.force coq_nil,[| typ |])
- | e :: l -> EConstr.mkApp(Lazy.force coq_cons,
- [| typ; dump_elt e;dump_list typ dump_elt l|])
-
- let pp_list op cl elt o l =
- let rec _pp o l =
- match l with
- | [] -> ()
- | [e] -> Printf.fprintf o "%a" elt e
- | e::l -> Printf.fprintf o "%a ,%a" elt e _pp l in
- Printf.fprintf o "%s%a%s" op _pp l cl
-
- let dump_var = dump_positive
-
- let dump_expr typ dump_z e =
- let rec dump_expr e =
- match e with
- | Mc.PEX n -> EConstr.mkApp(Lazy.force coq_PEX,[| typ; dump_var n |])
- | Mc.PEc z -> EConstr.mkApp(Lazy.force coq_PEc,[| typ ; dump_z z |])
- | Mc.PEadd(e1,e2) -> EConstr.mkApp(Lazy.force coq_PEadd,
- [| typ; dump_expr e1;dump_expr e2|])
- | Mc.PEsub(e1,e2) -> EConstr.mkApp(Lazy.force coq_PEsub,
- [| typ; dump_expr e1;dump_expr e2|])
- | Mc.PEopp e -> EConstr.mkApp(Lazy.force coq_PEopp,
- [| typ; dump_expr e|])
- | Mc.PEmul(e1,e2) -> EConstr.mkApp(Lazy.force coq_PEmul,
- [| typ; dump_expr e1;dump_expr e2|])
- | Mc.PEpow(e,n) -> EConstr.mkApp(Lazy.force coq_PEpow,
- [| typ; dump_expr e; dump_n n|])
- in
- dump_expr e
-
- let dump_pol typ dump_c e =
- let rec dump_pol e =
- match e with
- | Mc.Pc n -> EConstr.mkApp(Lazy.force coq_Pc, [|typ ; dump_c n|])
- | Mc.Pinj(p,pol) -> EConstr.mkApp(Lazy.force coq_Pinj , [| typ ; dump_positive p ; dump_pol pol|])
- | Mc.PX(pol1,p,pol2) -> EConstr.mkApp(Lazy.force coq_PX, [| typ ; dump_pol pol1 ; dump_positive p ; dump_pol pol2|]) in
- dump_pol e
-
- let pp_pol pp_c o e =
- let rec pp_pol o e =
- match e with
- | Mc.Pc n -> Printf.fprintf o "Pc %a" pp_c n
- | Mc.Pinj(p,pol) -> Printf.fprintf o "Pinj(%a,%a)" pp_positive p pp_pol pol
- | Mc.PX(pol1,p,pol2) -> Printf.fprintf o "PX(%a,%a,%a)" pp_pol pol1 pp_positive p pp_pol pol2 in
- pp_pol o e
-
- let pp_cnf pp_c o f =
- let pp_clause o l = List.iter (fun ((p,_),t) -> Printf.fprintf o "(%a @%a)" (pp_pol pp_c) p Tag.pp t) l in
- List.iter (fun l -> Printf.fprintf o "[%a]" pp_clause l) f
-
- let dump_psatz typ dump_z e =
- let z = Lazy.force typ in
- let rec dump_cone e =
- match e with
- | Mc.PsatzIn n -> EConstr.mkApp(Lazy.force coq_PsatzIn,[| z; dump_nat n |])
- | Mc.PsatzMulC(e,c) -> EConstr.mkApp(Lazy.force coq_PsatzMultC,
- [| z; dump_pol z dump_z e ; dump_cone c |])
- | Mc.PsatzSquare e -> EConstr.mkApp(Lazy.force coq_PsatzSquare,
- [| z;dump_pol z dump_z e|])
- | Mc.PsatzAdd(e1,e2) -> EConstr.mkApp(Lazy.force coq_PsatzAdd,
- [| z; dump_cone e1; dump_cone e2|])
- | Mc.PsatzMulE(e1,e2) -> EConstr.mkApp(Lazy.force coq_PsatzMulE,
- [| z; dump_cone e1; dump_cone e2|])
- | Mc.PsatzC p -> EConstr.mkApp(Lazy.force coq_PsatzC,[| z; dump_z p|])
- | Mc.PsatzZ -> EConstr.mkApp(Lazy.force coq_PsatzZ,[| z|]) in
- dump_cone e
-
- let pp_psatz pp_z o e =
- let rec pp_cone o e =
- match e with
- | Mc.PsatzIn n ->
- Printf.fprintf o "(In %a)%%nat" pp_nat n
- | Mc.PsatzMulC(e,c) ->
- Printf.fprintf o "( %a [*] %a)" (pp_pol pp_z) e pp_cone c
- | Mc.PsatzSquare e ->
- Printf.fprintf o "(%a^2)" (pp_pol pp_z) e
- | Mc.PsatzAdd(e1,e2) ->
- Printf.fprintf o "(%a [+] %a)" pp_cone e1 pp_cone e2
- | Mc.PsatzMulE(e1,e2) ->
- Printf.fprintf o "(%a [*] %a)" pp_cone e1 pp_cone e2
- | Mc.PsatzC p ->
- Printf.fprintf o "(%a)%%positive" pp_z p
- | Mc.PsatzZ ->
- Printf.fprintf o "0" in
- pp_cone o e
-
- let dump_op = function
- | Mc.OpEq-> Lazy.force coq_OpEq
- | Mc.OpNEq-> Lazy.force coq_OpNEq
- | Mc.OpLe -> Lazy.force coq_OpLe
- | Mc.OpGe -> Lazy.force coq_OpGe
- | Mc.OpGt-> Lazy.force coq_OpGt
- | Mc.OpLt-> Lazy.force coq_OpLt
-
- let dump_cstr typ dump_constant {Mc.flhs = e1 ; Mc.fop = o ; Mc.frhs = e2} =
- EConstr.mkApp(Lazy.force coq_Build,
- [| typ; dump_expr typ dump_constant e1 ;
- dump_op o ;
- dump_expr typ dump_constant e2|])
-
- let assoc_const sigma x l =
- try
- snd (List.find (fun (x',y) -> EConstr.eq_constr sigma x (Lazy.force x')) l)
- with
- Not_found -> raise ParseError
-
- let zop_table = [
- coq_Zgt, Mc.OpGt ;
- coq_Zge, Mc.OpGe ;
- coq_Zlt, Mc.OpLt ;
- coq_Zle, Mc.OpLe ]
-
- let rop_table = [
- coq_Rgt, Mc.OpGt ;
- coq_Rge, Mc.OpGe ;
- coq_Rlt, Mc.OpLt ;
- coq_Rle, Mc.OpLe ]
-
- let qop_table = [
- coq_Qlt, Mc.OpLt ;
- coq_Qle, Mc.OpLe ;
- coq_Qeq, Mc.OpEq
- ]
-
- type gl = { env : Environ.env; sigma : Evd.evar_map }
-
- let is_convertible gl t1 t2 =
- Reductionops.is_conv gl.env gl.sigma t1 t2
-
- let parse_zop gl (op,args) =
- let sigma = gl.sigma in
- match EConstr.kind sigma op with
- | Const (x,_) -> (assoc_const sigma op zop_table, args.(0) , args.(1))
- | Ind((n,0),_) ->
- if EConstr.eq_constr sigma op (Lazy.force coq_Eq) && is_convertible gl args.(0) (Lazy.force coq_Z)
- then (Mc.OpEq, args.(1), args.(2))
- else raise ParseError
- | _ -> failwith "parse_zop"
-
- let parse_rop gl (op,args) =
- let sigma = gl.sigma in
- match EConstr.kind sigma op with
- | Const (x,_) -> (assoc_const sigma op rop_table, args.(0) , args.(1))
- | Ind((n,0),_) ->
- if EConstr.eq_constr sigma op (Lazy.force coq_Eq) && is_convertible gl args.(0) (Lazy.force coq_R)
- then (Mc.OpEq, args.(1), args.(2))
- else raise ParseError
- | _ -> failwith "parse_zop"
-
- let parse_qop gl (op,args) =
- (assoc_const gl.sigma op qop_table, args.(0) , args.(1))
-
- type 'a op =
- | Binop of ('a Mc.pExpr -> 'a Mc.pExpr -> 'a Mc.pExpr)
- | Opp
- | Power
- | Ukn of string
-
- let assoc_ops sigma x l =
- try
- snd (List.find (fun (x',y) -> EConstr.eq_constr sigma x (Lazy.force x')) l)
- with
- Not_found -> Ukn "Oups"
-
- (**
- * MODULE: Env is for environment.
- *)
-
- module Env =
- struct
- let compute_rank_add env sigma v =
- let rec _add env n v =
- match env with
- | [] -> ([v],n)
- | e::l ->
- if EConstr.eq_constr sigma e v
- then (env,n)
- else
- let (env,n) = _add l ( n+1) v in
- (e::env,n) in
- let (env, n) = _add env 1 v in
- (env, CamlToCoq.positive n)
-
- let get_rank env sigma v =
-
- let rec _get_rank env n =
- match env with
- | [] -> raise (Invalid_argument "get_rank")
- | e::l ->
- if EConstr.eq_constr sigma e v
- then n
- else _get_rank l (n+1) in
- _get_rank env 1
-
-
- let empty = []
-
- let elements env = env
-
- end (* MODULE END: Env *)
-
- (**
- * This is the big generic function for expression parsers.
- *)
-
- let parse_expr sigma parse_constant parse_exp ops_spec env term =
- if debug
- then (
- let _, env = Pfedit.get_current_context () in
- Feedback.msg_debug (Pp.str "parse_expr: " ++ Printer.pr_leconstr_env env sigma term));
-
-(*
- let constant_or_variable env term =
- try
- ( Mc.PEc (parse_constant term) , env)
- with ParseError ->
- let (env,n) = Env.compute_rank_add env term in
- (Mc.PEX n , env) in
-*)
- let parse_variable env term =
- let (env,n) = Env.compute_rank_add env sigma term in
- (Mc.PEX n , env) in
-
- let rec parse_expr env term =
- let combine env op (t1,t2) =
- let (expr1,env) = parse_expr env t1 in
- let (expr2,env) = parse_expr env t2 in
- (op expr1 expr2,env) in
-
- try (Mc.PEc (parse_constant term) , env)
- with ParseError ->
- match EConstr.kind sigma term with
- | App(t,args) ->
- (
- match EConstr.kind sigma t with
- | Const c ->
- ( match assoc_ops sigma t ops_spec with
- | Binop f -> combine env f (args.(0),args.(1))
- | Opp -> let (expr,env) = parse_expr env args.(0) in
- (Mc.PEopp expr, env)
- | Power ->
- begin
- try
- let (expr,env) = parse_expr env args.(0) in
- let power = (parse_exp expr args.(1)) in
- (power , env)
- with e when CErrors.noncritical e ->
- (* if the exponent is a variable *)
- let (env,n) = Env.compute_rank_add env sigma term in (Mc.PEX n, env)
- end
- | Ukn s ->
- if debug
- then (Printf.printf "unknown op: %s\n" s; flush stdout;);
- let (env,n) = Env.compute_rank_add env sigma term in (Mc.PEX n, env)
- )
- | _ -> parse_variable env term
- )
- | _ -> parse_variable env term in
- parse_expr env term
-
- let zop_spec =
- [
- coq_Zplus , Binop (fun x y -> Mc.PEadd(x,y)) ;
- coq_Zminus , Binop (fun x y -> Mc.PEsub(x,y)) ;
- coq_Zmult , Binop (fun x y -> Mc.PEmul (x,y)) ;
- coq_Zopp , Opp ;
- coq_Zpower , Power]
-
- let qop_spec =
- [
- coq_Qplus , Binop (fun x y -> Mc.PEadd(x,y)) ;
- coq_Qminus , Binop (fun x y -> Mc.PEsub(x,y)) ;
- coq_Qmult , Binop (fun x y -> Mc.PEmul (x,y)) ;
- coq_Qopp , Opp ;
- coq_Qpower , Power]
-
- let rop_spec =
- [
- coq_Rplus , Binop (fun x y -> Mc.PEadd(x,y)) ;
- coq_Rminus , Binop (fun x y -> Mc.PEsub(x,y)) ;
- coq_Rmult , Binop (fun x y -> Mc.PEmul (x,y)) ;
- coq_Ropp , Opp ;
- coq_Rpower , Power]
-
- let zconstant = parse_z
- let qconstant = parse_q
-
-
- let rconst_assoc =
- [
- coq_Rplus , (fun x y -> Mc.CPlus(x,y)) ;
- coq_Rminus , (fun x y -> Mc.CMinus(x,y)) ;
- coq_Rmult , (fun x y -> Mc.CMult(x,y)) ;
- (* coq_Rdiv , (fun x y -> Mc.CMult(x,Mc.CInv y)) ;*)
- ]
-
- let rec rconstant sigma term =
- match EConstr.kind sigma term with
- | Const x ->
- if EConstr.eq_constr sigma term (Lazy.force coq_R0)
- then Mc.C0
- else if EConstr.eq_constr sigma term (Lazy.force coq_R1)
- then Mc.C1
- else raise ParseError
- | App(op,args) ->
- begin
- try
- (* the evaluation order is important in the following *)
- let f = assoc_const sigma op rconst_assoc in
- let a = rconstant sigma args.(0) in
- let b = rconstant sigma args.(1) in
- f a b
- with
- ParseError ->
- match op with
- | op when EConstr.eq_constr sigma op (Lazy.force coq_Rinv) ->
- let arg = rconstant sigma args.(0) in
- if Mc.qeq_bool (Mc.q_of_Rcst arg) {Mc.qnum = Mc.Z0 ; Mc.qden = Mc.XH}
- then raise ParseError (* This is a division by zero -- no semantics *)
- else Mc.CInv(arg)
- | op when EConstr.eq_constr sigma op (Lazy.force coq_IQR) -> Mc.CQ (parse_q sigma args.(0))
- | op when EConstr.eq_constr sigma op (Lazy.force coq_IZR) -> Mc.CZ (parse_z sigma args.(0))
- | _ -> raise ParseError
- end
-
- | _ -> raise ParseError
-
-
- let rconstant sigma term =
- let _, env = Pfedit.get_current_context () in
- if debug
- then Feedback.msg_debug (Pp.str "rconstant: " ++ Printer.pr_leconstr_env env sigma term ++ fnl ());
- let res = rconstant sigma term in
- if debug then
- (Printf.printf "rconstant -> %a\n" pp_Rcst res ; flush stdout) ;
- res
-
-
- let parse_zexpr sigma = parse_expr sigma
- (zconstant sigma)
- (fun expr x ->
- let exp = (parse_z sigma x) in
- match exp with
- | Mc.Zneg _ -> Mc.PEc Mc.Z0
- | _ -> Mc.PEpow(expr, Mc.Z.to_N exp))
- zop_spec
-
- let parse_qexpr sigma = parse_expr sigma
- (qconstant sigma)
- (fun expr x ->
- let exp = parse_z sigma x in
- match exp with
- | Mc.Zneg _ ->
- begin
- match expr with
- | Mc.PEc q -> Mc.PEc (Mc.qpower q exp)
- | _ -> print_string "parse_qexpr parse error" ; flush stdout ; raise ParseError
- end
- | _ -> let exp = Mc.Z.to_N exp in
- Mc.PEpow(expr,exp))
- qop_spec
-
- let parse_rexpr sigma = parse_expr sigma
- (rconstant sigma)
- (fun expr x ->
- let exp = Mc.N.of_nat (parse_nat sigma x) in
- Mc.PEpow(expr,exp))
- rop_spec
-
- let parse_arith parse_op parse_expr env cstr gl =
- let sigma = gl.sigma in
- if debug
- then Feedback.msg_debug (Pp.str "parse_arith: " ++ Printer.pr_leconstr_env gl.env sigma cstr ++ fnl ());
- match EConstr.kind sigma cstr with
- | App(op,args) ->
- let (op,lhs,rhs) = parse_op gl (op,args) in
- let (e1,env) = parse_expr sigma env lhs in
- let (e2,env) = parse_expr sigma env rhs in
- ({Mc.flhs = e1; Mc.fop = op;Mc.frhs = e2},env)
- | _ -> failwith "error : parse_arith(2)"
-
- let parse_zarith = parse_arith parse_zop parse_zexpr
-
- let parse_qarith = parse_arith parse_qop parse_qexpr
-
- let parse_rarith = parse_arith parse_rop parse_rexpr
-
- (* generic parsing of arithmetic expressions *)
-
- let mkC f1 f2 = C(f1,f2)
- let mkD f1 f2 = D(f1,f2)
- let mkIff f1 f2 = C(I(f1,None,f2),I(f2,None,f1))
- let mkI f1 f2 = I(f1,None,f2)
-
- let mkformula_binary g term f1 f2 =
- match f1 , f2 with
- | X _ , X _ -> X(term)
- | _ -> g f1 f2
-
- (**
- * This is the big generic function for formula parsers.
- *)
-
- let parse_formula gl parse_atom env tg term =
- let sigma = gl.sigma in
-
- let parse_atom env tg t =
- try
- let (at,env) = parse_atom env t gl in
- (A(at,tg,t), env,Tag.next tg)
- with e when CErrors.noncritical e -> (X(t),env,tg) in
-
- let is_prop term =
- let sort = Retyping.get_sort_of gl.env gl.sigma term in
- Sorts.is_prop sort in
-
- let rec xparse_formula env tg term =
- match EConstr.kind sigma term with
- | App(l,rst) ->
- (match rst with
- | [|a;b|] when EConstr.eq_constr sigma l (Lazy.force coq_and) ->
- let f,env,tg = xparse_formula env tg a in
- let g,env, tg = xparse_formula env tg b in
- mkformula_binary mkC term f g,env,tg
- | [|a;b|] when EConstr.eq_constr sigma l (Lazy.force coq_or) ->
- let f,env,tg = xparse_formula env tg a in
- let g,env,tg = xparse_formula env tg b in
- mkformula_binary mkD term f g,env,tg
- | [|a|] when EConstr.eq_constr sigma l (Lazy.force coq_not) ->
- let (f,env,tg) = xparse_formula env tg a in (N(f), env,tg)
- | [|a;b|] when EConstr.eq_constr sigma l (Lazy.force coq_iff) ->
- let f,env,tg = xparse_formula env tg a in
- let g,env,tg = xparse_formula env tg b in
- mkformula_binary mkIff term f g,env,tg
- | _ -> parse_atom env tg term)
- | Prod(typ,a,b) when EConstr.Vars.noccurn sigma 1 b ->
- let f,env,tg = xparse_formula env tg a in
- let g,env,tg = xparse_formula env tg b in
- mkformula_binary mkI term f g,env,tg
- | _ when EConstr.eq_constr sigma term (Lazy.force coq_True) -> (TT,env,tg)
- | _ when EConstr.eq_constr sigma term (Lazy.force coq_False) -> (FF,env,tg)
- | _ when is_prop term -> X(term),env,tg
- | _ -> raise ParseError
- in
- xparse_formula env tg ((*Reductionops.whd_zeta*) term)
-
- let dump_formula typ dump_atom f =
- let rec xdump f =
- match f with
- | TT -> EConstr.mkApp(Lazy.force coq_TT,[|typ|])
- | FF -> EConstr.mkApp(Lazy.force coq_FF,[|typ|])
- | C(x,y) -> EConstr.mkApp(Lazy.force coq_And,[|typ ; xdump x ; xdump y|])
- | D(x,y) -> EConstr.mkApp(Lazy.force coq_Or,[|typ ; xdump x ; xdump y|])
- | I(x,_,y) -> EConstr.mkApp(Lazy.force coq_Impl,[|typ ; xdump x ; xdump y|])
- | N(x) -> EConstr.mkApp(Lazy.force coq_Neg,[|typ ; xdump x|])
- | A(x,_,_) -> EConstr.mkApp(Lazy.force coq_Atom,[|typ ; dump_atom x|])
- | X(t) -> EConstr.mkApp(Lazy.force coq_X,[|typ ; t|]) in
- xdump f
-
-
- let prop_env_of_formula sigma form =
- let rec doit env = function
- | TT | FF | A(_,_,_) -> env
- | X t -> fst (Env.compute_rank_add env sigma t)
- | C(f1,f2) | D(f1,f2) | I(f1,_,f2) ->
- doit (doit env f1) f2
- | N f -> doit env f in
-
- doit [] form
-
- let var_env_of_formula form =
-
- let rec vars_of_expr = function
- | Mc.PEX n -> ISet.singleton (CoqToCaml.positive n)
- | Mc.PEc z -> ISet.empty
- | Mc.PEadd(e1,e2) | Mc.PEmul(e1,e2) | Mc.PEsub(e1,e2) ->
- ISet.union (vars_of_expr e1) (vars_of_expr e2)
- | Mc.PEopp e | Mc.PEpow(e,_)-> vars_of_expr e
- in
-
- let vars_of_atom {Mc.flhs ; Mc.fop; Mc.frhs} =
- ISet.union (vars_of_expr flhs) (vars_of_expr frhs) in
-
- let rec doit = function
- | TT | FF | X _ -> ISet.empty
- | A (a,t,c) -> vars_of_atom a
- | C(f1,f2) | D(f1,f2) |I (f1,_,f2) -> ISet.union (doit f1) (doit f2)
- | N f -> doit f in
-
- doit form
-
-
-
-
- type 'cst dump_expr = (* 'cst is the type of the syntactic constants *)
- {
- interp_typ : EConstr.constr;
- dump_cst : 'cst -> EConstr.constr;
- dump_add : EConstr.constr;
- dump_sub : EConstr.constr;
- dump_opp : EConstr.constr;
- dump_mul : EConstr.constr;
- dump_pow : EConstr.constr;
- dump_pow_arg : Mc.n -> EConstr.constr;
- dump_op : (Mc.op2 * EConstr.constr) list
- }
-
-let dump_zexpr = lazy
- {
- interp_typ = Lazy.force coq_Z;
- dump_cst = dump_z;
- dump_add = Lazy.force coq_Zplus;
- dump_sub = Lazy.force coq_Zminus;
- dump_opp = Lazy.force coq_Zopp;
- dump_mul = Lazy.force coq_Zmult;
- dump_pow = Lazy.force coq_Zpower;
- dump_pow_arg = (fun n -> dump_z (CamlToCoq.z (CoqToCaml.n n)));
- dump_op = List.map (fun (x,y) -> (y,Lazy.force x)) zop_table
- }
-
-let dump_qexpr = lazy
- {
- interp_typ = Lazy.force coq_Q;
- dump_cst = dump_q;
- dump_add = Lazy.force coq_Qplus;
- dump_sub = Lazy.force coq_Qminus;
- dump_opp = Lazy.force coq_Qopp;
- dump_mul = Lazy.force coq_Qmult;
- dump_pow = Lazy.force coq_Qpower;
- dump_pow_arg = (fun n -> dump_z (CamlToCoq.z (CoqToCaml.n n)));
- dump_op = List.map (fun (x,y) -> (y,Lazy.force x)) qop_table
- }
-
-let rec dump_Rcst_as_R cst =
- match cst with
- | Mc.C0 -> Lazy.force coq_R0
- | Mc.C1 -> Lazy.force coq_R1
- | Mc.CQ q -> EConstr.mkApp(Lazy.force coq_IQR, [| dump_q q |])
- | Mc.CZ z -> EConstr.mkApp(Lazy.force coq_IZR, [| dump_z z |])
- | Mc.CPlus(x,y) -> EConstr.mkApp(Lazy.force coq_Rplus, [| dump_Rcst_as_R x ; dump_Rcst_as_R y |])
- | Mc.CMinus(x,y) -> EConstr.mkApp(Lazy.force coq_Rminus, [| dump_Rcst_as_R x ; dump_Rcst_as_R y |])
- | Mc.CMult(x,y) -> EConstr.mkApp(Lazy.force coq_Rmult, [| dump_Rcst_as_R x ; dump_Rcst_as_R y |])
- | Mc.CInv t -> EConstr.mkApp(Lazy.force coq_Rinv, [| dump_Rcst_as_R t |])
- | Mc.COpp t -> EConstr.mkApp(Lazy.force coq_Ropp, [| dump_Rcst_as_R t |])
-
-
-let dump_rexpr = lazy
- {
- interp_typ = Lazy.force coq_R;
- dump_cst = dump_Rcst_as_R;
- dump_add = Lazy.force coq_Rplus;
- dump_sub = Lazy.force coq_Rminus;
- dump_opp = Lazy.force coq_Ropp;
- dump_mul = Lazy.force coq_Rmult;
- dump_pow = Lazy.force coq_Rpower;
- dump_pow_arg = (fun n -> dump_nat (CamlToCoq.nat (CoqToCaml.n n)));
- dump_op = List.map (fun (x,y) -> (y,Lazy.force x)) rop_table
- }
-
-
-
-
-(** [make_goal_of_formula depxr vars props form] where
- - vars is an environment for the arithmetic variables occuring in form
- - props is an environment for the propositions occuring in form
- @return a goal where all the variables and propositions of the formula are quantified
-
-*)
-
-let prodn n env b =
- let rec prodrec = function
- | (0, env, b) -> b
- | (n, ((v,t)::l), b) -> prodrec (n-1, l, EConstr.mkProd (v,t,b))
- | _ -> assert false
- in
- prodrec (n,env,b)
-
-let make_goal_of_formula sigma dexpr form =
-
- let vars_idx =
- List.mapi (fun i v -> (v, i+1)) (ISet.elements (var_env_of_formula form)) in
-
- (* List.iter (fun (v,i) -> Printf.fprintf stdout "var %i has index %i\n" v i) vars_idx ;*)
-
- let props = prop_env_of_formula sigma form in
-
- let vars_n = List.map (fun (_,i) -> (Names.Id.of_string (Printf.sprintf "__x%i" i)) , dexpr.interp_typ) vars_idx in
- let props_n = List.mapi (fun i _ -> (Names.Id.of_string (Printf.sprintf "__p%i" (i+1))) , EConstr.mkProp) props in
-
- let var_name_pos = List.map2 (fun (idx,_) (id,_) -> id,idx) vars_idx vars_n in
-
- let dump_expr i e =
- let rec dump_expr = function
- | Mc.PEX n -> EConstr.mkRel (i+(List.assoc (CoqToCaml.positive n) vars_idx))
- | Mc.PEc z -> dexpr.dump_cst z
- | Mc.PEadd(e1,e2) -> EConstr.mkApp(dexpr.dump_add,
- [| dump_expr e1;dump_expr e2|])
- | Mc.PEsub(e1,e2) -> EConstr.mkApp(dexpr.dump_sub,
- [| dump_expr e1;dump_expr e2|])
- | Mc.PEopp e -> EConstr.mkApp(dexpr.dump_opp,
- [| dump_expr e|])
- | Mc.PEmul(e1,e2) -> EConstr.mkApp(dexpr.dump_mul,
- [| dump_expr e1;dump_expr e2|])
- | Mc.PEpow(e,n) -> EConstr.mkApp(dexpr.dump_pow,
- [| dump_expr e; dexpr.dump_pow_arg n|])
- in dump_expr e in
-
- let mkop op e1 e2 =
- try
- EConstr.mkApp(List.assoc op dexpr.dump_op, [| e1; e2|])
- with Not_found ->
- EConstr.mkApp(Lazy.force coq_Eq,[|dexpr.interp_typ ; e1 ;e2|]) in
-
- let dump_cstr i { Mc.flhs ; Mc.fop ; Mc.frhs } =
- mkop fop (dump_expr i flhs) (dump_expr i frhs) in
-
- let rec xdump pi xi f =
- match f with
- | TT -> Lazy.force coq_True
- | FF -> Lazy.force coq_False
- | C(x,y) -> EConstr.mkApp(Lazy.force coq_and,[|xdump pi xi x ; xdump pi xi y|])
- | D(x,y) -> EConstr.mkApp(Lazy.force coq_or,[| xdump pi xi x ; xdump pi xi y|])
- | I(x,_,y) -> EConstr.mkArrow (xdump pi xi x) (xdump (pi+1) (xi+1) y)
- | N(x) -> EConstr.mkArrow (xdump pi xi x) (Lazy.force coq_False)
- | A(x,_,_) -> dump_cstr xi x
- | X(t) -> let idx = Env.get_rank props sigma t in
- EConstr.mkRel (pi+idx) in
-
- let nb_vars = List.length vars_n in
- let nb_props = List.length props_n in
-
- (* Printf.fprintf stdout "NBProps : %i\n" nb_props ;*)
-
- let subst_prop p =
- let idx = Env.get_rank props sigma p in
- EConstr.mkVar (Names.Id.of_string (Printf.sprintf "__p%i" idx)) in
-
- let form' = map_prop subst_prop form in
-
- (prodn nb_props (List.map (fun (x,y) -> Name.Name x,y) props_n)
- (prodn nb_vars (List.map (fun (x,y) -> Name.Name x,y) vars_n)
- (xdump (List.length vars_n) 0 form)),
- List.rev props_n, List.rev var_name_pos,form')
-
- (**
- * Given a conclusion and a list of affectations, rebuild a term prefixed by
- * the appropriate letins.
- * TODO: reverse the list of bindings!
- *)
-
- let set l concl =
- let rec xset acc = function
- | [] -> acc
- | (e::l) ->
- let (name,expr,typ) = e in
- xset (EConstr.mkNamedLetIn
- (Names.Id.of_string name)
- expr typ acc) l in
- xset concl l
-
-end (**
- * MODULE END: M
- *)
-
-open M
-
-let coq_Node =
- lazy (gen_constant_in_modules "VarMap"
- [["Coq" ; "micromega" ; "VarMap"];["VarMap"]] "Node")
-let coq_Leaf =
- lazy (gen_constant_in_modules "VarMap"
- [["Coq" ; "micromega" ; "VarMap"];["VarMap"]] "Leaf")
-let coq_Empty =
- lazy (gen_constant_in_modules "VarMap"
- [["Coq" ; "micromega" ;"VarMap"];["VarMap"]] "Empty")
-
-let coq_VarMap =
- lazy (gen_constant_in_modules "VarMap"
- [["Coq" ; "micromega" ; "VarMap"] ; ["VarMap"]] "t")
-
-
-let rec dump_varmap typ m =
- match m with
- | Mc.Empty -> EConstr.mkApp(Lazy.force coq_Empty,[| typ |])
- | Mc.Leaf v -> EConstr.mkApp(Lazy.force coq_Leaf,[| typ; v|])
- | Mc.Node(l,o,r) ->
- EConstr.mkApp (Lazy.force coq_Node, [| typ; dump_varmap typ l; o ; dump_varmap typ r |])
-
-
-let vm_of_list env =
- match env with
- | [] -> Mc.Empty
- | (d,_)::_ ->
- List.fold_left (fun vm (c,i) ->
- Mc.vm_add d (CamlToCoq.positive i) c vm) Mc.Empty env
-
-let rec dump_proof_term = function
- | Micromega.DoneProof -> Lazy.force coq_doneProof
- | Micromega.RatProof(cone,rst) ->
- EConstr.mkApp(Lazy.force coq_ratProof, [| dump_psatz coq_Z dump_z cone; dump_proof_term rst|])
- | Micromega.CutProof(cone,prf) ->
- EConstr.mkApp(Lazy.force coq_cutProof,
- [| dump_psatz coq_Z dump_z cone ;
- dump_proof_term prf|])
- | Micromega.EnumProof(c1,c2,prfs) ->
- EConstr.mkApp (Lazy.force coq_enumProof,
- [| dump_psatz coq_Z dump_z c1 ; dump_psatz coq_Z dump_z c2 ;
- dump_list (Lazy.force coq_proofTerm) dump_proof_term prfs |])
-
-
-let rec size_of_psatz = function
- | Micromega.PsatzIn _ -> 1
- | Micromega.PsatzSquare _ -> 1
- | Micromega.PsatzMulC(_,p) -> 1 + (size_of_psatz p)
- | Micromega.PsatzMulE(p1,p2) | Micromega.PsatzAdd(p1,p2) -> size_of_psatz p1 + size_of_psatz p2
- | Micromega.PsatzC _ -> 1
- | Micromega.PsatzZ -> 1
-
-let rec size_of_pf = function
- | Micromega.DoneProof -> 1
- | Micromega.RatProof(p,a) -> (size_of_pf a) + (size_of_psatz p)
- | Micromega.CutProof(p,a) -> (size_of_pf a) + (size_of_psatz p)
- | Micromega.EnumProof(p1,p2,l) -> (size_of_psatz p1) + (size_of_psatz p2) + (List.fold_left (fun acc p -> size_of_pf p + acc) 0 l)
-
-let dump_proof_term t =
- if debug then Printf.printf "dump_proof_term %i\n" (size_of_pf t) ;
- dump_proof_term t
-
-
-
-let pp_q o q = Printf.fprintf o "%a/%a" pp_z q.Micromega.qnum pp_positive q.Micromega.qden
-
-
-let rec pp_proof_term o = function
- | Micromega.DoneProof -> Printf.fprintf o "D"
- | Micromega.RatProof(cone,rst) -> Printf.fprintf o "R[%a,%a]" (pp_psatz pp_z) cone pp_proof_term rst
- | Micromega.CutProof(cone,rst) -> Printf.fprintf o "C[%a,%a]" (pp_psatz pp_z) cone pp_proof_term rst
- | Micromega.EnumProof(c1,c2,rst) ->
- Printf.fprintf o "EP[%a,%a,%a]"
- (pp_psatz pp_z) c1 (pp_psatz pp_z) c2
- (pp_list "[" "]" pp_proof_term) rst
-
-let rec parse_hyps gl parse_arith env tg hyps =
- match hyps with
- | [] -> ([],env,tg)
- | (i,t)::l ->
- let (lhyps,env,tg) = parse_hyps gl parse_arith env tg l in
- try
- let (c,env,tg) = parse_formula gl parse_arith env tg t in
- ((i,c)::lhyps, env,tg)
- with e when CErrors.noncritical e -> (lhyps,env,tg)
- (*(if debug then Printf.printf "parse_arith : %s\n" x);*)
-
-
-(*exception ParseError*)
-
-let parse_goal gl parse_arith env hyps term =
- (* try*)
- let (f,env,tg) = parse_formula gl parse_arith env (Tag.from 0) term in
- let (lhyps,env,tg) = parse_hyps gl parse_arith env tg hyps in
- (lhyps,f,env)
- (* with Failure x -> raise ParseError*)
-
-(**
- * The datastructures that aggregate theory-dependent proof values.
- *)
-type ('synt_c, 'prf) domain_spec = {
- typ : EConstr.constr; (* is the type of the interpretation domain - Z, Q, R*)
- coeff : EConstr.constr ; (* is the type of the syntactic coeffs - Z , Q , Rcst *)
- dump_coeff : 'synt_c -> EConstr.constr ;
- proof_typ : EConstr.constr ;
- dump_proof : 'prf -> EConstr.constr
-}
-
-let zz_domain_spec = lazy {
- typ = Lazy.force coq_Z;
- coeff = Lazy.force coq_Z;
- dump_coeff = dump_z ;
- proof_typ = Lazy.force coq_proofTerm ;
- dump_proof = dump_proof_term
-}
-
-let qq_domain_spec = lazy {
- typ = Lazy.force coq_Q;
- coeff = Lazy.force coq_Q;
- dump_coeff = dump_q ;
- proof_typ = Lazy.force coq_QWitness ;
- dump_proof = dump_psatz coq_Q dump_q
-}
-
-(** Naive topological sort of constr according to the subterm-ordering *)
-
-(* An element is minimal x is minimal w.r.t y if
- x <= y or (x and y are incomparable) *)
-
-(**
- * Instanciate the current Coq goal with a Micromega formula, a varmap, and a
- * witness.
- *)
-
-let micromega_order_change spec cert cert_typ env ff (*: unit Proofview.tactic*) =
- (* let ids = Util.List.map_i (fun i _ -> (Names.Id.of_string ("__v"^(string_of_int i)))) 0 env in *)
- let formula_typ = (EConstr.mkApp (Lazy.force coq_Cstr,[|spec.coeff|])) in
- let ff = dump_formula formula_typ (dump_cstr spec.coeff spec.dump_coeff) ff in
- let vm = dump_varmap (spec.typ) (vm_of_list env) in
- (* todo : directly generate the proof term - or generalize before conversion? *)
- Proofview.Goal.nf_enter begin fun gl ->
- Tacticals.New.tclTHENLIST
- [
- Tactics.change_concl
- (set
- [
- ("__ff", ff, EConstr.mkApp(Lazy.force coq_Formula, [|formula_typ |]));
- ("__varmap", vm, EConstr.mkApp(Lazy.force coq_VarMap, [|spec.typ|]));
- ("__wit", cert, cert_typ)
- ]
- (Tacmach.New.pf_concl gl))
- ]
- end
-
-
-(**
- * The datastructures that aggregate prover attributes.
- *)
-
-type ('option,'a,'prf) prover = {
- name : string ; (* name of the prover *)
- get_option : unit ->'option ; (* find the options of the prover *)
- prover : 'option * 'a list -> 'prf option ; (* the prover itself *)
- hyps : 'prf -> ISet.t ; (* extract the indexes of the hypotheses really used in the proof *)
- compact : 'prf -> (int -> int) -> 'prf ; (* remap the hyp indexes according to function *)
- pp_prf : out_channel -> 'prf -> unit ;(* pretting printing of proof *)
- pp_f : out_channel -> 'a -> unit (* pretty printing of the formulas (polynomials)*)
-}
-
-
-
-(**
- * Given a list of provers and a disjunction of atoms, find a proof of any of
- * the atoms. Returns an (optional) pair of a proof and a prover
- * datastructure.
- *)
-
-let find_witness provers polys1 =
- let provers = List.map (fun p ->
- (fun l ->
- match p.prover (p.get_option (),l) with
- | None -> None
- | Some prf -> Some(prf,p)) , p.name) provers in
- try_any provers (List.map fst polys1)
-
-(**
- * Given a list of provers and a CNF, find a proof for each of the clauses.
- * Return the proofs as a list.
- *)
-
-let witness_list prover l =
- let rec xwitness_list l =
- match l with
- | [] -> Some []
- | e :: l ->
- match find_witness prover e with
- | None -> None
- | Some w ->
- (match xwitness_list l with
- | None -> None
- | Some l -> Some (w :: l)
- ) in
- xwitness_list l
-
-let witness_list_tags = witness_list
-
-(**
- * Prune the proof object, according to the 'diff' between two cnf formulas.
- *)
-
-let compact_proofs (cnf_ff: 'cst cnf) res (cnf_ff': 'cst cnf) =
-
- let compact_proof (old_cl:'cst clause) (prf,prover) (new_cl:'cst clause) =
- let new_cl = List.mapi (fun i (f,_) -> (f,i)) new_cl in
- let remap i =
- let formula = try fst (List.nth old_cl i) with Failure _ -> failwith "bad old index" in
- List.assoc formula new_cl in
-(* if debug then
- begin
- Printf.printf "\ncompact_proof : %a %a %a"
- (pp_ml_list prover.pp_f) (List.map fst old_cl)
- prover.pp_prf prf
- (pp_ml_list prover.pp_f) (List.map fst new_cl) ;
- flush stdout
- end ; *)
- let res = try prover.compact prf remap with x when CErrors.noncritical x ->
- if debug then Printf.fprintf stdout "Proof compaction %s" (Printexc.to_string x) ;
- (* This should not happen -- this is the recovery plan... *)
- match prover.prover (prover.get_option () ,List.map fst new_cl) with
- | None -> failwith "proof compaction error"
- | Some p -> p
- in
- if debug then
- begin
- Printf.printf " -> %a\n"
- prover.pp_prf res ;
- flush stdout
- end ;
- res in
-
- let is_proof_compatible (old_cl:'cst clause) (prf,prover) (new_cl:'cst clause) =
- let hyps_idx = prover.hyps prf in
- let hyps = selecti hyps_idx old_cl in
- is_sublist Pervasives.(=) hyps new_cl in
-
- let cnf_res = List.combine cnf_ff res in (* we get pairs clause * proof *)
-
- List.map (fun x ->
- let (o,p) = List.find (fun (l,p) -> is_proof_compatible l p x) cnf_res
- in compact_proof o p x) cnf_ff'
-
-
-(**
- * "Hide out" tagged atoms of a formula by transforming them into generic
- * variables. See the Tag module in mutils.ml for more.
- *)
-
-let abstract_formula hyps f =
- let rec xabs f =
- match f with
- | X c -> X c
- | A(a,t,term) -> if TagSet.mem t hyps then A(a,t,term) else X(term)
- | C(f1,f2) ->
- (match xabs f1 , xabs f2 with
- | X a1 , X a2 -> X (EConstr.mkApp(Lazy.force coq_and, [|a1;a2|]))
- | f1 , f2 -> C(f1,f2) )
- | D(f1,f2) ->
- (match xabs f1 , xabs f2 with
- | X a1 , X a2 -> X (EConstr.mkApp(Lazy.force coq_or, [|a1;a2|]))
- | f1 , f2 -> D(f1,f2) )
- | N(f) ->
- (match xabs f with
- | X a -> X (EConstr.mkApp(Lazy.force coq_not, [|a|]))
- | f -> N f)
- | I(f1,hyp,f2) ->
- (match xabs f1 , hyp, xabs f2 with
- | X a1 , Some _ , af2 -> af2
- | X a1 , None , X a2 -> X (EConstr.mkArrow a1 a2)
- | af1 , _ , af2 -> I(af1,hyp,af2)
- )
- | FF -> FF
- | TT -> TT
- in xabs f
-
-
-(* [abstract_wrt_formula] is used in contexts whre f1 is already an abstraction of f2 *)
-let rec abstract_wrt_formula f1 f2 =
- match f1 , f2 with
- | X c , _ -> X c
- | A _ , A _ -> f2
- | C(a,b) , C(a',b') -> C(abstract_wrt_formula a a', abstract_wrt_formula b b')
- | D(a,b) , D(a',b') -> D(abstract_wrt_formula a a', abstract_wrt_formula b b')
- | I(a,_,b) , I(a',x,b') -> I(abstract_wrt_formula a a',x, abstract_wrt_formula b b')
- | FF , FF -> FF
- | TT , TT -> TT
- | N x , N y -> N(abstract_wrt_formula x y)
- | _ -> failwith "abstract_wrt_formula"
-
-(**
- * This exception is raised by really_call_csdpcert if Coq's configure didn't
- * find a CSDP executable.
- *)
-
-exception CsdpNotFound
-
-
-(**
- * This is the core of Micromega: apply the prover, analyze the result and
- * prune unused fomulas, and finally modify the proof state.
- *)
-
-let formula_hyps_concl hyps concl =
- List.fold_right
- (fun (id,f) (cc,ids) ->
- match f with
- X _ -> (cc,ids)
- | _ -> (I(f,Some id,cc), id::ids))
- hyps (concl,[])
-
-
-let micromega_tauto negate normalise unsat deduce spec prover env polys1 polys2 gl =
-
- (* Express the goal as one big implication *)
- let (ff,ids) = formula_hyps_concl polys1 polys2 in
-
- (* Convert the aplpication into a (mc_)cnf (a list of lists of formulas) *)
- let cnf_ff,cnf_ff_tags = cnf negate normalise unsat deduce ff in
-
- if debug then
- begin
- Feedback.msg_notice (Pp.str "Formula....\n") ;
- let formula_typ = (EConstr.mkApp(Lazy.force coq_Cstr, [|spec.coeff|])) in
- let ff = dump_formula formula_typ
- (dump_cstr spec.typ spec.dump_coeff) ff in
- Feedback.msg_notice (Printer.pr_leconstr_env gl.env gl.sigma ff);
- Printf.fprintf stdout "cnf : %a\n" (pp_cnf (fun o _ -> ())) cnf_ff
- end;
-
- match witness_list_tags prover cnf_ff with
- | None -> None
- | Some res -> (*Printf.printf "\nList %i" (List.length `res); *)
- let hyps = List.fold_left (fun s (cl,(prf,p)) ->
- let tags = ISet.fold (fun i s -> let t = snd (List.nth cl i) in
- if debug then (Printf.fprintf stdout "T : %i -> %a" i Tag.pp t) ;
- (*try*) TagSet.add t s (* with Invalid_argument _ -> s*)) (p.hyps prf) TagSet.empty in
- TagSet.union s tags) (List.fold_left (fun s i -> TagSet.add i s) TagSet.empty cnf_ff_tags) (List.combine cnf_ff res) in
-
- if debug then (Printf.printf "TForm : %a\n" pp_formula ff ; flush stdout;
- Printf.printf "Hyps : %a\n" (fun o s -> TagSet.fold (fun i _ -> Printf.fprintf o "%a " Tag.pp i) s ()) hyps) ;
-
- let ff' = abstract_formula hyps ff in
- let cnf_ff',_ = cnf negate normalise unsat deduce ff' in
-
- if debug then
- begin
- Feedback.msg_notice (Pp.str "\nAFormula\n") ;
- let formula_typ = (EConstr.mkApp( Lazy.force coq_Cstr,[| spec.coeff|])) in
- let ff' = dump_formula formula_typ
- (dump_cstr spec.typ spec.dump_coeff) ff' in
- Feedback.msg_notice (Printer.pr_leconstr_env gl.env gl.sigma ff');
- Printf.fprintf stdout "cnf : %a\n" (pp_cnf (fun o _ -> ())) cnf_ff'
- end;
-
- (* Even if it does not work, this does not mean it is not provable
- -- the prover is REALLY incomplete *)
- (* if debug then
- begin
- (* recompute the proofs *)
- match witness_list_tags prover cnf_ff' with
- | None -> failwith "abstraction is wrong"
- | Some res -> ()
- end ; *)
- let res' = compact_proofs cnf_ff res cnf_ff' in
-
- let (ff',res',ids) = (ff',res', ids_of_formula ff') in
-
- let res' = dump_list (spec.proof_typ) spec.dump_proof res' in
- Some (ids,ff',res')
-
-
-(**
- * Parse the proof environment, and call micromega_tauto
- *)
-
-let fresh_id avoid id gl =
- Tactics.fresh_id_in_env avoid id (Proofview.Goal.env gl)
-
-let micromega_gen
- parse_arith
- (negate:'cst atom -> 'cst mc_cnf)
- (normalise:'cst atom -> 'cst mc_cnf)
- unsat deduce
- spec dumpexpr prover tac =
- Proofview.Goal.nf_enter begin fun gl ->
- let sigma = Tacmach.New.project gl in
- let concl = Tacmach.New.pf_concl gl in
- let hyps = Tacmach.New.pf_hyps_types gl in
- try
- let gl0 = { env = Tacmach.New.pf_env gl; sigma } in
- let (hyps,concl,env) = parse_goal gl0 parse_arith Env.empty hyps concl in
- let env = Env.elements env in
- let spec = Lazy.force spec in
- let dumpexpr = Lazy.force dumpexpr in
-
- match micromega_tauto negate normalise unsat deduce spec prover env hyps concl gl0 with
- | None -> Tacticals.New.tclFAIL 0 (Pp.str " Cannot find witness")
- | Some (ids,ff',res') ->
- let (arith_goal,props,vars,ff_arith) = make_goal_of_formula sigma dumpexpr ff' in
- let intro (id,_) = Tactics.introduction id in
-
- let intro_vars = Tacticals.New.tclTHENLIST (List.map intro vars) in
- let intro_props = Tacticals.New.tclTHENLIST (List.map intro props) in
- let ipat_of_name id = Some (CAst.make @@ IntroNaming (Namegen.IntroIdentifier id)) in
- let goal_name = fresh_id Id.Set.empty (Names.Id.of_string "__arith") gl in
- let env' = List.map (fun (id,i) -> EConstr.mkVar id,i) vars in
-
- let tac_arith = Tacticals.New.tclTHENLIST [ intro_props ; intro_vars ;
- micromega_order_change spec res'
- (EConstr.mkApp(Lazy.force coq_list, [|spec.proof_typ|])) env' ff_arith ] in
-
- let goal_props = List.rev (prop_env_of_formula sigma ff') in
-
- let goal_vars = List.map (fun (_,i) -> List.nth env (i-1)) vars in
-
- let arith_args = goal_props @ goal_vars in
-
- let kill_arith =
- Tacticals.New.tclTHEN
- (Tactics.keep [])
- ((*Tactics.tclABSTRACT None*)
- (Tacticals.New.tclTHEN tac_arith tac)) in
-
- Tacticals.New.tclTHENS
- (Tactics.forward true (Some None) (ipat_of_name goal_name) arith_goal)
- [
- kill_arith;
- (Tacticals.New.tclTHENLIST
- [(Tactics.generalize (List.map EConstr.mkVar ids));
- Tactics.exact_check (EConstr.applist (EConstr.mkVar goal_name, arith_args))
- ] )
- ]
- with
- | ParseError -> Tacticals.New.tclFAIL 0 (Pp.str "Bad logical fragment")
- | Mfourier.TimeOut -> Tacticals.New.tclFAIL 0 (Pp.str "Timeout")
- | CsdpNotFound -> flush stdout ;
- Tacticals.New.tclFAIL 0 (Pp.str
- (" Skipping what remains of this tactic: the complexity of the goal requires "
- ^ "the use of a specialized external tool called csdp. \n\n"
- ^ "Unfortunately Coq isn't aware of the presence of any \"csdp\" executable in the path. \n\n"
- ^ "Csdp packages are provided by some OS distributions; binaries and source code can be downloaded from https://projects.coin-or.org/Csdp"))
- end
-
-let micromega_gen parse_arith
- (negate:'cst atom -> 'cst mc_cnf)
- (normalise:'cst atom -> 'cst mc_cnf)
- unsat deduce
- spec prover =
- (micromega_gen parse_arith negate normalise unsat deduce spec prover)
-
-
-
-let micromega_order_changer cert env ff =
- (*let ids = Util.List.map_i (fun i _ -> (Names.Id.of_string ("__v"^(string_of_int i)))) 0 env in *)
- let coeff = Lazy.force coq_Rcst in
- let dump_coeff = dump_Rcst in
- let typ = Lazy.force coq_R in
- let cert_typ = (EConstr.mkApp(Lazy.force coq_list, [|Lazy.force coq_QWitness |])) in
-
- let formula_typ = (EConstr.mkApp (Lazy.force coq_Cstr,[| coeff|])) in
- let ff = dump_formula formula_typ (dump_cstr coeff dump_coeff) ff in
- let vm = dump_varmap (typ) (vm_of_list env) in
- Proofview.Goal.nf_enter begin fun gl ->
- Tacticals.New.tclTHENLIST
- [
- (Tactics.change_concl
- (set
- [
- ("__ff", ff, EConstr.mkApp(Lazy.force coq_Formula, [|formula_typ |]));
- ("__varmap", vm, EConstr.mkApp
- (gen_constant_in_modules "VarMap"
- [["Coq" ; "micromega" ; "VarMap"] ; ["VarMap"]] "t", [|typ|]));
- ("__wit", cert, cert_typ)
- ]
- (Tacmach.New.pf_concl gl)));
- (* Tacticals.New.tclTHENLIST (List.map (fun id -> (Tactics.introduction id)) ids)*)
- ]
- end
-
-let micromega_genr prover tac =
- let parse_arith = parse_rarith in
- let negate = Mc.rnegate in
- let normalise = Mc.rnormalise in
- let unsat = Mc.runsat in
- let deduce = Mc.rdeduce in
- let spec = lazy {
- typ = Lazy.force coq_R;
- coeff = Lazy.force coq_Rcst;
- dump_coeff = dump_q;
- proof_typ = Lazy.force coq_QWitness ;
- dump_proof = dump_psatz coq_Q dump_q
- } in
- Proofview.Goal.nf_enter begin fun gl ->
- let sigma = Tacmach.New.project gl in
- let concl = Tacmach.New.pf_concl gl in
- let hyps = Tacmach.New.pf_hyps_types gl in
-
- try
- let gl0 = { env = Tacmach.New.pf_env gl; sigma } in
- let (hyps,concl,env) = parse_goal gl0 parse_arith Env.empty hyps concl in
- let env = Env.elements env in
- let spec = Lazy.force spec in
-
- let hyps' = List.map (fun (n,f) -> (n, map_atoms (Micromega.map_Formula Micromega.q_of_Rcst) f)) hyps in
- let concl' = map_atoms (Micromega.map_Formula Micromega.q_of_Rcst) concl in
-
- match micromega_tauto negate normalise unsat deduce spec prover env hyps' concl' gl0 with
- | None -> Tacticals.New.tclFAIL 0 (Pp.str " Cannot find witness")
- | Some (ids,ff',res') ->
- let (ff,ids) = formula_hyps_concl
- (List.filter (fun (n,_) -> List.mem n ids) hyps) concl in
- let ff' = abstract_wrt_formula ff' ff in
-
- let (arith_goal,props,vars,ff_arith) = make_goal_of_formula sigma (Lazy.force dump_rexpr) ff' in
- let intro (id,_) = Tactics.introduction id in
-
- let intro_vars = Tacticals.New.tclTHENLIST (List.map intro vars) in
- let intro_props = Tacticals.New.tclTHENLIST (List.map intro props) in
- let ipat_of_name id = Some (CAst.make @@ IntroNaming (Namegen.IntroIdentifier id)) in
- let goal_name = fresh_id Id.Set.empty (Names.Id.of_string "__arith") gl in
- let env' = List.map (fun (id,i) -> EConstr.mkVar id,i) vars in
-
- let tac_arith = Tacticals.New.tclTHENLIST [ intro_props ; intro_vars ;
- micromega_order_changer res' env' ff_arith ] in
-
- let goal_props = List.rev (prop_env_of_formula sigma ff') in
-
- let goal_vars = List.map (fun (_,i) -> List.nth env (i-1)) vars in
-
- let arith_args = goal_props @ goal_vars in
-
- let kill_arith =
- Tacticals.New.tclTHEN
- (Tactics.keep [])
- ((*Tactics.tclABSTRACT None*)
- (Tacticals.New.tclTHEN tac_arith tac)) in
-
- Tacticals.New.tclTHENS
- (Tactics.forward true (Some None) (ipat_of_name goal_name) arith_goal)
- [
- kill_arith;
- (Tacticals.New.tclTHENLIST
- [(Tactics.generalize (List.map EConstr.mkVar ids));
- Tactics.exact_check (EConstr.applist (EConstr.mkVar goal_name, arith_args))
- ] )
- ]
-
- with
- | ParseError -> Tacticals.New.tclFAIL 0 (Pp.str "Bad logical fragment")
- | Mfourier.TimeOut -> Tacticals.New.tclFAIL 0 (Pp.str "Timeout")
- | CsdpNotFound -> flush stdout ;
- Tacticals.New.tclFAIL 0 (Pp.str
- (" Skipping what remains of this tactic: the complexity of the goal requires "
- ^ "the use of a specialized external tool called csdp. \n\n"
- ^ "Unfortunately Coq isn't aware of the presence of any \"csdp\" executable in the path. \n\n"
- ^ "Csdp packages are provided by some OS distributions; binaries and source code can be downloaded from https://projects.coin-or.org/Csdp"))
- end
-
-
-
-
-let micromega_genr prover = (micromega_genr prover)
-
-
-let lift_ratproof prover l =
- match prover l with
- | None -> None
- | Some c -> Some (Mc.RatProof( c,Mc.DoneProof))
-
-type micromega_polys = (Micromega.q Mc.pol * Mc.op1) list
-
-[@@@ocaml.warning "-37"]
-type csdp_certificate = S of Sos_types.positivstellensatz option | F of string
-(* Used to read the result of the execution of csdpcert *)
-
-type provername = string * int option
-
-(**
- * The caching mechanism.
- *)
-
-open Micromega_plugin.Persistent_cache
-
-module Cache = PHashtable(struct
- type t = (provername * micromega_polys)
- let equal = Pervasives.(=)
- let hash = Hashtbl.hash
-end)
-
-let csdp_cache = ".csdp.cache"
-
-(**
- * Build the command to call csdpcert, and launch it. This in turn will call
- * the sos driver to the csdp executable.
- * Throw CsdpNotFound if Coq isn't aware of any csdp executable.
- *)
-
-let require_csdp =
- if System.is_in_system_path "csdp"
- then lazy ()
- else lazy (raise CsdpNotFound)
-
-let really_call_csdpcert : provername -> micromega_polys -> Sos_types.positivstellensatz option =
- fun provername poly ->
-
- Lazy.force require_csdp;
-
- let cmdname =
- List.fold_left Filename.concat (Envars.coqlib ())
- ["plugins"; "micromega"; "csdpcert" ^ Coq_config.exec_extension] in
-
- match ((command cmdname [|cmdname|] (provername,poly)) : csdp_certificate) with
- | F str -> failwith str
- | S res -> res
-
-(**
- * Check the cache before calling the prover.
- *)
-
-let xcall_csdpcert =
- Cache.memo csdp_cache (fun (prover,pb) -> really_call_csdpcert prover pb)
-
-(**
- * Prover callback functions.
- *)
-
-let call_csdpcert prover pb = xcall_csdpcert (prover,pb)
-
-let rec z_to_q_pol e =
- match e with
- | Mc.Pc z -> Mc.Pc {Mc.qnum = z ; Mc.qden = Mc.XH}
- | Mc.Pinj(p,pol) -> Mc.Pinj(p,z_to_q_pol pol)
- | Mc.PX(pol1,p,pol2) -> Mc.PX(z_to_q_pol pol1, p, z_to_q_pol pol2)
-
-let call_csdpcert_q provername poly =
- match call_csdpcert provername poly with
- | None -> None
- | Some cert ->
- let cert = Certificate.q_cert_of_pos cert in
- if Mc.qWeakChecker poly cert
- then Some cert
- else ((print_string "buggy certificate") ;None)
-
-let call_csdpcert_z provername poly =
- let l = List.map (fun (e,o) -> (z_to_q_pol e,o)) poly in
- match call_csdpcert provername l with
- | None -> None
- | Some cert ->
- let cert = Certificate.z_cert_of_pos cert in
- if Mc.zWeakChecker poly cert
- then Some cert
- else ((print_string "buggy certificate" ; flush stdout) ;None)
-
-let xhyps_of_cone base acc prf =
- let rec xtract e acc =
- match e with
- | Mc.PsatzC _ | Mc.PsatzZ | Mc.PsatzSquare _ -> acc
- | Mc.PsatzIn n -> let n = (CoqToCaml.nat n) in
- if n >= base
- then ISet.add (n-base) acc
- else acc
- | Mc.PsatzMulC(_,c) -> xtract c acc
- | Mc.PsatzAdd(e1,e2) | Mc.PsatzMulE(e1,e2) -> xtract e1 (xtract e2 acc) in
-
- xtract prf acc
-
-let hyps_of_cone prf = xhyps_of_cone 0 ISet.empty prf
-
-let compact_cone prf f =
- let np n = CamlToCoq.nat (f (CoqToCaml.nat n)) in
-
- let rec xinterp prf =
- match prf with
- | Mc.PsatzC _ | Mc.PsatzZ | Mc.PsatzSquare _ -> prf
- | Mc.PsatzIn n -> Mc.PsatzIn (np n)
- | Mc.PsatzMulC(e,c) -> Mc.PsatzMulC(e,xinterp c)
- | Mc.PsatzAdd(e1,e2) -> Mc.PsatzAdd(xinterp e1,xinterp e2)
- | Mc.PsatzMulE(e1,e2) -> Mc.PsatzMulE(xinterp e1,xinterp e2) in
-
- xinterp prf
-
-let hyps_of_pt pt =
-
- let rec xhyps base pt acc =
- match pt with
- | Mc.DoneProof -> acc
- | Mc.RatProof(c,pt) -> xhyps (base+1) pt (xhyps_of_cone base acc c)
- | Mc.CutProof(c,pt) -> xhyps (base+1) pt (xhyps_of_cone base acc c)
- | Mc.EnumProof(c1,c2,l) ->
- let s = xhyps_of_cone base (xhyps_of_cone base acc c2) c1 in
- List.fold_left (fun s x -> xhyps (base + 1) x s) s l in
-
- xhyps 0 pt ISet.empty
-
-let hyps_of_pt pt =
- let res = hyps_of_pt pt in
- if debug
- then (Printf.fprintf stdout "\nhyps_of_pt : %a -> " pp_proof_term pt ; ISet.iter (fun i -> Printf.printf "%i " i) res);
- res
-
-let compact_pt pt f =
- let translate ofset x =
- if x < ofset then x
- else (f (x-ofset) + ofset) in
-
- let rec compact_pt ofset pt =
- match pt with
- | Mc.DoneProof -> Mc.DoneProof
- | Mc.RatProof(c,pt) -> Mc.RatProof(compact_cone c (translate (ofset)), compact_pt (ofset+1) pt )
- | Mc.CutProof(c,pt) -> Mc.CutProof(compact_cone c (translate (ofset)), compact_pt (ofset+1) pt )
- | Mc.EnumProof(c1,c2,l) -> Mc.EnumProof(compact_cone c1 (translate (ofset)), compact_cone c2 (translate (ofset)),
- Mc.map (fun x -> compact_pt (ofset+1) x) l) in
- compact_pt 0 pt
-
-(**
- * Definition of provers.
- * Instantiates the type ('a,'prf) prover defined above.
- *)
-
-let lift_pexpr_prover p l = p (List.map (fun (e,o) -> Mc.denorm e , o) l)
-
-module CacheZ = PHashtable(struct
- type prover_option = bool * int
-
- type t = prover_option * ((Mc.z Mc.pol * Mc.op1) list)
- let equal = (=)
- let hash = Hashtbl.hash
-end)
-
-module CacheQ = PHashtable(struct
- type t = int * ((Mc.q Mc.pol * Mc.op1) list)
- let equal = (=)
- let hash = Hashtbl.hash
-end)
-
-let memo_zlinear_prover = CacheZ.memo ".lia.cache" (fun ((ce,b),s) -> lift_pexpr_prover (Certificate.lia ce b) s)
-let memo_nlia = CacheZ.memo ".nia.cache" (fun ((ce,b),s) -> lift_pexpr_prover (Certificate.nlia ce b) s)
-let memo_nra = CacheQ.memo ".nra.cache" (fun (o,s) -> lift_pexpr_prover (Certificate.nlinear_prover o) s)
-
-
-
-let linear_prover_Q = {
- name = "linear prover";
- get_option = get_lra_option ;
- prover = (fun (o,l) -> lift_pexpr_prover (Certificate.linear_prover_with_cert o Certificate.q_spec) l) ;
- hyps = hyps_of_cone ;
- compact = compact_cone ;
- pp_prf = pp_psatz pp_q ;
- pp_f = fun o x -> pp_pol pp_q o (fst x)
-}
-
-
-let linear_prover_R = {
- name = "linear prover";
- get_option = get_lra_option ;
- prover = (fun (o,l) -> lift_pexpr_prover (Certificate.linear_prover_with_cert o Certificate.q_spec) l) ;
- hyps = hyps_of_cone ;
- compact = compact_cone ;
- pp_prf = pp_psatz pp_q ;
- pp_f = fun o x -> pp_pol pp_q o (fst x)
-}
-
-let nlinear_prover_R = {
- name = "nra";
- get_option = get_lra_option;
- prover = memo_nra ;
- hyps = hyps_of_cone ;
- compact = compact_cone ;
- pp_prf = pp_psatz pp_q ;
- pp_f = fun o x -> pp_pol pp_q o (fst x)
-}
-
-let non_linear_prover_Q str o = {
- name = "real nonlinear prover";
- get_option = (fun () -> (str,o));
- prover = (fun (o,l) -> call_csdpcert_q o l);
- hyps = hyps_of_cone;
- compact = compact_cone ;
- pp_prf = pp_psatz pp_q ;
- pp_f = fun o x -> pp_pol pp_q o (fst x)
-}
-
-let non_linear_prover_R str o = {
- name = "real nonlinear prover";
- get_option = (fun () -> (str,o));
- prover = (fun (o,l) -> call_csdpcert_q o l);
- hyps = hyps_of_cone;
- compact = compact_cone;
- pp_prf = pp_psatz pp_q;
- pp_f = fun o x -> pp_pol pp_q o (fst x)
-}
-
-let non_linear_prover_Z str o = {
- name = "real nonlinear prover";
- get_option = (fun () -> (str,o));
- prover = (fun (o,l) -> lift_ratproof (call_csdpcert_z o) l);
- hyps = hyps_of_pt;
- compact = compact_pt;
- pp_prf = pp_proof_term;
- pp_f = fun o x -> pp_pol pp_z o (fst x)
-}
-
-let linear_Z = {
- name = "lia";
- get_option = get_lia_option;
- prover = memo_zlinear_prover ;
- hyps = hyps_of_pt;
- compact = compact_pt;
- pp_prf = pp_proof_term;
- pp_f = fun o x -> pp_pol pp_z o (fst x)
-}
-
-let nlinear_Z = {
- name = "nlia";
- get_option = get_lia_option;
- prover = memo_nlia ;
- hyps = hyps_of_pt;
- compact = compact_pt;
- pp_prf = pp_proof_term;
- pp_f = fun o x -> pp_pol pp_z o (fst x)
-}
-
-(**
- * Functions instantiating micromega_gen with the appropriate theories and
- * solvers
- *)
-
-let lra_Q =
- micromega_gen parse_qarith Mc.qnegate Mc.qnormalise Mc.qunsat Mc.qdeduce qq_domain_spec dump_qexpr
- [ linear_prover_Q ]
-
-let psatz_Q i =
- micromega_gen parse_qarith Mc.qnegate Mc.qnormalise Mc.qunsat Mc.qdeduce qq_domain_spec dump_qexpr
- [ non_linear_prover_Q "real_nonlinear_prover" (Some i) ]
-
-let lra_R =
- micromega_genr [ linear_prover_R ]
-
-let psatz_R i =
- micromega_genr [ non_linear_prover_R "real_nonlinear_prover" (Some i) ]
-
-
-let psatz_Z i =
- micromega_gen parse_zarith Mc.negate Mc.normalise Mc.zunsat Mc.zdeduce zz_domain_spec dump_zexpr
- [ non_linear_prover_Z "real_nonlinear_prover" (Some i) ]
-
-let sos_Z =
- micromega_gen parse_zarith Mc.negate Mc.normalise Mc.zunsat Mc.zdeduce zz_domain_spec dump_zexpr
- [ non_linear_prover_Z "pure_sos" None ]
-
-let sos_Q =
- micromega_gen parse_qarith Mc.qnegate Mc.qnormalise Mc.qunsat Mc.qdeduce qq_domain_spec dump_qexpr
- [ non_linear_prover_Q "pure_sos" None ]
-
-
-let sos_R =
- micromega_genr [ non_linear_prover_R "pure_sos" None ]
-
-
-let xlia = micromega_gen parse_zarith Mc.negate Mc.normalise Mc.zunsat Mc.zdeduce zz_domain_spec dump_zexpr
- [ linear_Z ]
-
-let xnlia =
- micromega_gen parse_zarith Mc.negate Mc.normalise Mc.zunsat Mc.zdeduce zz_domain_spec dump_zexpr
- [ nlinear_Z ]
-
-let nra =
- micromega_genr [ nlinear_prover_R ]
-
-let nqa =
- micromega_gen parse_qarith Mc.qnegate Mc.qnormalise Mc.qunsat Mc.qdeduce qq_domain_spec dump_qexpr
- [ nlinear_prover_R ]
-
-
-
-(* Local Variables: *)
-(* coding: utf-8 *)
-(* End: *)
diff --git a/src/versions/standard/mutils_full.ml b/src/versions/standard/mutils_full.ml
deleted file mode 100644
index efa2e4d..0000000
--- a/src/versions/standard/mutils_full.ml
+++ /dev/null
@@ -1,358 +0,0 @@
-(*** This file is taken from Coq-8.9.0 to solve a compilation issue due
- to a wrong order in dependencies.
- See https://github.com/coq/coq/issues/9768 . ***)
-
-
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-(* *)
-(* Micromega: A reflexive tactic using the Positivstellensatz *)
-(* *)
-(* ** Utility functions ** *)
-(* *)
-(* - Modules CoqToCaml, CamlToCoq *)
-(* - Modules Cmp, Tag, TagSet *)
-(* *)
-(* Frédéric Besson (Irisa/Inria) 2006-2008 *)
-(* *)
-(************************************************************************)
-
-module Micromega = Micromega_plugin.Micromega
-
-let rec pp_list f o l =
- match l with
- | [] -> ()
- | e::l -> f o e ; output_string o ";" ; pp_list f o l
-
-
-let finally f rst =
- try
- let res = f () in
- rst () ; res
- with reraise ->
- (try rst ()
- with any -> raise reraise
- ); raise reraise
-
-let rec try_any l x =
- match l with
- | [] -> None
- | (f,s)::l -> match f x with
- | None -> try_any l x
- | x -> x
-
-let all_sym_pairs f l =
- let pair_with acc e l = List.fold_left (fun acc x -> (f e x) ::acc) acc l in
-
- let rec xpairs acc l =
- match l with
- | [] -> acc
- | e::l -> xpairs (pair_with acc e l) l in
- xpairs [] l
-
-let all_pairs f l =
- let pair_with acc e l = List.fold_left (fun acc x -> (f e x) ::acc) acc l in
-
- let rec xpairs acc l =
- match l with
- | [] -> acc
- | e::lx -> xpairs (pair_with acc e l) lx in
- xpairs [] l
-
-let rec is_sublist f l1 l2 =
- match l1 ,l2 with
- | [] ,_ -> true
- | e::l1', [] -> false
- | e::l1' , e'::l2' ->
- if f e e' then is_sublist f l1' l2'
- else is_sublist f l1 l2'
-
-let extract pred l =
- List.fold_left (fun (fd,sys) e ->
- match fd with
- | None ->
- begin
- match pred e with
- | None -> fd, e::sys
- | Some v -> Some(v,e) , sys
- end
- | _ -> (fd, e::sys)
- ) (None,[]) l
-
-open Num
-open Big_int
-
-let ppcm x y =
- let g = gcd_big_int x y in
- let x' = div_big_int x g in
- let y' = div_big_int y g in
- mult_big_int g (mult_big_int x' y')
-
-let denominator = function
- | Int _ | Big_int _ -> unit_big_int
- | Ratio r -> Ratio.denominator_ratio r
-
-let numerator = function
- | Ratio r -> Ratio.numerator_ratio r
- | Int i -> Big_int.big_int_of_int i
- | Big_int i -> i
-
-let rec ppcm_list c l =
- match l with
- | [] -> c
- | e::l -> ppcm_list (ppcm c (denominator e)) l
-
-let rec rec_gcd_list c l =
- match l with
- | [] -> c
- | e::l -> rec_gcd_list (gcd_big_int c (numerator e)) l
-
-let gcd_list l =
- let res = rec_gcd_list zero_big_int l in
- if Int.equal (compare_big_int res zero_big_int) 0
- then unit_big_int else res
-
-let rats_to_ints l =
- let c = ppcm_list unit_big_int l in
- List.map (fun x -> (div_big_int (mult_big_int (numerator x) c)
- (denominator x))) l
-
-(* assoc_pos j [a0...an] = [j,a0....an,j+n],j+n+1 *)
-(**
- * MODULE: Coq to Caml data-structure mappings
- *)
-
-module CoqToCaml =
-struct
- open Micromega
-
- let rec nat = function
- | O -> 0
- | S n -> (nat n) + 1
-
-
- let rec positive p =
- match p with
- | XH -> 1
- | XI p -> 1+ 2*(positive p)
- | XO p -> 2*(positive p)
-
- let n nt =
- match nt with
- | N0 -> 0
- | Npos p -> positive p
-
- let rec index i = (* Swap left-right ? *)
- match i with
- | XH -> 1
- | XI i -> 1+(2*(index i))
- | XO i -> 2*(index i)
-
- open Big_int
-
- let rec positive_big_int p =
- match p with
- | XH -> unit_big_int
- | XI p -> add_int_big_int 1 (mult_int_big_int 2 (positive_big_int p))
- | XO p -> (mult_int_big_int 2 (positive_big_int p))
-
- let z_big_int x =
- match x with
- | Z0 -> zero_big_int
- | Zpos p -> (positive_big_int p)
- | Zneg p -> minus_big_int (positive_big_int p)
-
- let q_to_num {qnum = x ; qden = y} =
- Big_int (z_big_int x) // (Big_int (z_big_int (Zpos y)))
-
-end
-
-
-(**
- * MODULE: Caml to Coq data-structure mappings
- *)
-
-module CamlToCoq =
-struct
- open Micromega
-
- let rec nat = function
- | 0 -> O
- | n -> S (nat (n-1))
-
-
- let rec positive n =
- if Int.equal n 1 then XH
- else if Int.equal (n land 1) 1 then XI (positive (n lsr 1))
- else XO (positive (n lsr 1))
-
- let n nt =
- if nt < 0
- then assert false
- else if Int.equal nt 0 then N0
- else Npos (positive nt)
-
- let rec index n =
- if Int.equal n 1 then XH
- else if Int.equal (n land 1) 1 then XI (index (n lsr 1))
- else XO (index (n lsr 1))
-
-
- let z x =
- match compare x 0 with
- | 0 -> Z0
- | 1 -> Zpos (positive x)
- | _ -> (* this should be -1 *)
- Zneg (positive (-x))
-
- open Big_int
-
- let positive_big_int n =
- let two = big_int_of_int 2 in
- let rec _pos n =
- if eq_big_int n unit_big_int then XH
- else
- let (q,m) = quomod_big_int n two in
- if eq_big_int unit_big_int m
- then XI (_pos q)
- else XO (_pos q) in
- _pos n
-
- let bigint x =
- match sign_big_int x with
- | 0 -> Z0
- | 1 -> Zpos (positive_big_int x)
- | _ -> Zneg (positive_big_int (minus_big_int x))
-
- let q n =
- {Micromega.qnum = bigint (numerator n) ;
- Micromega.qden = positive_big_int (denominator n)}
-
-end
-
-(**
- * MODULE: Comparisons on lists: by evaluating the elements in a single list,
- * between two lists given an ordering, and using a hash computation
- *)
-
-module Cmp =
-struct
-
- let rec compare_lexical l =
- match l with
- | [] -> 0 (* Equal *)
- | f::l ->
- let cmp = f () in
- if Int.equal cmp 0 then compare_lexical l else cmp
-
- let rec compare_list cmp l1 l2 =
- match l1 , l2 with
- | [] , [] -> 0
- | [] , _ -> -1
- | _ , [] -> 1
- | e1::l1 , e2::l2 ->
- let c = cmp e1 e2 in
- if Int.equal c 0 then compare_list cmp l1 l2 else c
-
-end
-
-(**
- * MODULE: Labels for atoms in propositional formulas.
- * Tags are used to identify unused atoms in CNFs, and propagate them back to
- * the original formula. The translation back to Coq then ignores these
- * superfluous items, which speeds the translation up a bit.
- *)
-
-module type Tag =
-sig
-
- type t
-
- val from : int -> t
- val next : t -> t
- val pp : out_channel -> t -> unit
- val compare : t -> t -> int
-
-end
-
-module Tag : Tag =
-struct
-
- type t = int
-
- let from i = i
- let next i = i + 1
- let pp o i = output_string o (string_of_int i)
- let compare : int -> int -> int = Int.compare
-
-end
-
-(**
- * MODULE: Ordered sets of tags.
- *)
-
-module TagSet = Set.Make(Tag)
-
-(** As for Unix.close_process, our Unix.waipid will ignore all EINTR *)
-
-let rec waitpid_non_intr pid =
- try snd (Unix.waitpid [] pid)
- with Unix.Unix_error (Unix.EINTR, _, _) -> waitpid_non_intr pid
-
-(**
- * Forking routine, plumbing the appropriate pipes where needed.
- *)
-
-let command exe_path args vl =
- (* creating pipes for stdin, stdout, stderr *)
- let (stdin_read,stdin_write) = Unix.pipe ()
- and (stdout_read,stdout_write) = Unix.pipe ()
- and (stderr_read,stderr_write) = Unix.pipe () in
-
- (* Create the process *)
- let pid = Unix.create_process exe_path args stdin_read stdout_write stderr_write in
-
- (* Write the data on the stdin of the created process *)
- let outch = Unix.out_channel_of_descr stdin_write in
- output_value outch vl ;
- flush outch ;
-
- (* Wait for its completion *)
- let status = waitpid_non_intr pid in
-
- finally
- (* Recover the result *)
- (fun () ->
- match status with
- | Unix.WEXITED 0 ->
- let inch = Unix.in_channel_of_descr stdout_read in
- begin
- try Marshal.from_channel inch
- with any ->
- failwith
- (Printf.sprintf "command \"%s\" exited %s" exe_path
- (Printexc.to_string any))
- end
- | Unix.WEXITED i ->
- failwith (Printf.sprintf "command \"%s\" exited %i" exe_path i)
- | Unix.WSIGNALED i ->
- failwith (Printf.sprintf "command \"%s\" killed %i" exe_path i)
- | Unix.WSTOPPED i ->
- failwith (Printf.sprintf "command \"%s\" stopped %i" exe_path i))
- (* Cleanup *)
- (fun () ->
- List.iter (fun x -> try Unix.close x with any -> ())
- [stdin_read; stdin_write;
- stdout_read; stdout_write;
- stderr_read; stderr_write])
-
-(* Local Variables: *)
-(* coding: utf-8 *)
-(* End: *)
diff --git a/src/versions/standard/mutils_full.mli b/src/versions/standard/mutils_full.mli
deleted file mode 100644
index d506485..0000000
--- a/src/versions/standard/mutils_full.mli
+++ /dev/null
@@ -1,77 +0,0 @@
-(*** This file is taken from Coq-8.9.0 to solve a compilation issue due
- to a wrong order in dependencies.
- See https://github.com/coq/coq/issues/9768 . ***)
-
-
-(************************************************************************)
-(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(* * (see LICENSE file for the text of the license) *)
-(************************************************************************)
-
-module Micromega = Micromega_plugin.Micromega
-
-val numerator : Num.num -> Big_int.big_int
-val denominator : Num.num -> Big_int.big_int
-
-module Cmp : sig
-
- val compare_list : ('a -> 'b -> int) -> 'a list -> 'b list -> int
- val compare_lexical : (unit -> int) list -> int
-
-end
-
-module Tag : sig
-
- type t
-
- val pp : out_channel -> t -> unit
- val next : t -> t
- val from : int -> t
-
-end
-
-module TagSet : CSig.SetS with type elt = Tag.t
-
-val pp_list : (out_channel -> 'a -> unit) -> out_channel -> 'a list -> unit
-
-module CamlToCoq : sig
-
- val positive : int -> Micromega.positive
- val bigint : Big_int.big_int -> Micromega.z
- val n : int -> Micromega.n
- val nat : int -> Micromega.nat
- val q : Num.num -> Micromega.q
- val index : int -> Micromega.positive
- val z : int -> Micromega.z
- val positive_big_int : Big_int.big_int -> Micromega.positive
-
-end
-
-module CoqToCaml : sig
-
- val z_big_int : Micromega.z -> Big_int.big_int
- val q_to_num : Micromega.q -> Num.num
- val positive : Micromega.positive -> int
- val n : Micromega.n -> int
- val nat : Micromega.nat -> int
- val index : Micromega.positive -> int
-
-end
-
-val rats_to_ints : Num.num list -> Big_int.big_int list
-
-val all_pairs : ('a -> 'a -> 'b) -> 'a list -> 'b list
-val all_sym_pairs : ('a -> 'a -> 'b) -> 'a list -> 'b list
-val try_any : (('a -> 'b option) * 'c) list -> 'a -> 'b option
-val is_sublist : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
-
-val gcd_list : Num.num list -> Big_int.big_int
-
-val extract : ('a -> 'b option) -> 'a list -> ('b * 'a) option * 'a list
-
-val command : string -> string array -> 'a -> 'b
diff --git a/src/zchaff/zchaff.ml b/src/zchaff/zchaff.ml
index 963c8e4..1f5110b 100644
--- a/src/zchaff/zchaff.ml
+++ b/src/zchaff/zchaff.ml
@@ -133,7 +133,7 @@ let import_cnf_trace reloc filename first last =
let make_roots first last =
let cint = Lazy.force cint in
- let roots = Array.make (last.id + 2) (Structures.mkArray (cint, Array.make 1 (mkInt 0))) in
+ let roots = Array.make (last.id + 2) (CoqInterface.mkArray (cint, Array.make 1 (mkInt 0))) in
let mk_elem l =
let x = match Form.pform l with
| Fatom x -> x + 2
@@ -144,15 +144,15 @@ let make_roots first last =
let root = Array.of_list (get_val !r) in
let croot = Array.make (Array.length root + 1) (mkInt 0) in
Array.iteri (fun i l -> croot.(i) <- mk_elem l) root;
- roots.(!r.id) <- Structures.mkArray (cint, croot);
+ roots.(!r.id) <- CoqInterface.mkArray (cint, croot);
r := next !r
done;
let root = Array.of_list (get_val !r) in
let croot = Array.make (Array.length root + 1) (mkInt 0) in
Array.iteri (fun i l -> croot.(i) <- mk_elem l) root;
- roots.(!r.id) <- Structures.mkArray (cint, croot);
+ roots.(!r.id) <- CoqInterface.mkArray (cint, croot);
- Structures.mkArray (mklApp carray [|cint|], roots)
+ CoqInterface.mkArray (mklApp carray [|cint|], roots)
let interp_roots first last =
let tbl = Hashtbl.create 17 in
@@ -164,7 +164,7 @@ let interp_roots first last =
let h = if Form.is_pos l then ph else ph lxor 1 in
try Hashtbl.find tbl h
with Not_found ->
- let p = Structures.mkApp (Structures.mkRel 1, [|mkInt (x+1)|]) in
+ let p = CoqInterface.mkApp (CoqInterface.mkRel 1, [|mkInt (x+1)|]) in
let np = mklApp cnegb [|p|] in
Hashtbl.add tbl ph p;
Hashtbl.add tbl (ph lxor 1) np;
@@ -194,15 +194,15 @@ let parse_certif dimacs trace fdimacs ftrace =
SmtTrace.clear ();
let _,first,last,reloc = import_cnf fdimacs in
let d = make_roots first last in
- let ce1 = Structures.mkUConst d in
- let _ = Structures.declare_constant dimacs ce1 in
+ let ce1 = CoqInterface.mkUConst d in
+ let _ = CoqInterface.declare_constant dimacs ce1 in
let max_id, confl = import_cnf_trace reloc ftrace first last in
let (tres,_,_) = SmtTrace.to_coq (fun _ -> assert false) (fun _ -> assert false) certif_ops confl None in
let certif =
mklApp cCertif [|mkInt (max_id + 1); tres;mkInt (get_pos confl)|] in
- let ce2 = Structures.mkUConst certif in
- let _ = Structures.declare_constant trace ce2 in
+ let ce2 = CoqInterface.mkUConst certif in
+ let _ = CoqInterface.declare_constant trace ce2 in
()
let cdimacs = gen_constant sat_checker_modules "dimacs"
@@ -222,36 +222,36 @@ let theorems interp name fdimacs ftrace =
mklApp cCertif [|mkInt (max_id + 1);tres;mkInt (get_pos confl)|] in
let theorem_concl = mklApp cnot [|mklApp cis_true [|interp d first last|] |] in
- let vtype = Term.mkArrow (Lazy.force cint) (Lazy.force cbool) in
+ let vtype = CoqInterface.mkArrow (Lazy.force cint) (Lazy.force cbool) in
let theorem_type =
- Structures.mkProd (Structures.mkName "v", vtype, theorem_concl) in
+ CoqInterface.mkProd (CoqInterface.mkName "v", vtype, theorem_concl) in
let theorem_proof_cast =
- Structures.mkCast (
- Structures.mkLetIn (Structures.mkName "d", d, Lazy.force cdimacs,
- Structures.mkLetIn (Structures.mkName "c", certif, Lazy.force ccertif,
- Structures.mkLambda (Structures.mkName "v", vtype,
+ CoqInterface.mkCast (
+ CoqInterface.mkLetIn (CoqInterface.mkName "d", d, Lazy.force cdimacs,
+ CoqInterface.mkLetIn (CoqInterface.mkName "c", certif, Lazy.force ccertif,
+ CoqInterface.mkLambda (CoqInterface.mkName "v", vtype,
mklApp ctheorem_checker
- [| Structures.mkRel 3(*d*); Structures.mkRel 2(*c*);
+ [| CoqInterface.mkRel 3(*d*); CoqInterface.mkRel 2(*c*);
vm_cast_true_no_check
- (mklApp cchecker [|Structures.mkRel 3(*d*); Structures.mkRel 2(*c*)|]);
- Structures.mkRel 1(*v*)|]))),
- Structures.vmcast,
+ (mklApp cchecker [|CoqInterface.mkRel 3(*d*); CoqInterface.mkRel 2(*c*)|]);
+ CoqInterface.mkRel 1(*v*)|]))),
+ CoqInterface.vmcast,
theorem_type)
in
let theorem_proof_nocast =
- Structures.mkLetIn (Structures.mkName "d", d, Lazy.force cdimacs,
- Structures.mkLetIn (Structures.mkName "c", certif, Lazy.force ccertif,
- Structures.mkLambda (Structures.mkName "v", vtype,
+ CoqInterface.mkLetIn (CoqInterface.mkName "d", d, Lazy.force cdimacs,
+ CoqInterface.mkLetIn (CoqInterface.mkName "c", certif, Lazy.force ccertif,
+ CoqInterface.mkLambda (CoqInterface.mkName "v", vtype,
mklApp ctheorem_checker
- [| Structures.mkRel 3(*d*); Structures.mkRel 2(*c*)|])))
+ [| CoqInterface.mkRel 3(*d*); CoqInterface.mkRel 2(*c*)|])))
in
- let ce = Structures.mkTConst theorem_proof_cast theorem_proof_nocast theorem_type in
- let _ = Structures.declare_constant name ce in
+ let ce = CoqInterface.mkTConst theorem_proof_cast theorem_proof_nocast theorem_type in
+ let _ = CoqInterface.declare_constant name ce in
()
let theorem = theorems (fun _ -> interp_roots)
let theorem_abs =
- theorems (fun d _ _ -> mklApp cvalid_sat_checker [|mklApp cinterp_var_sat_checker [|Structures.mkRel 1(*v*)|]; d|])
+ theorems (fun d _ _ -> mklApp cvalid_sat_checker [|mklApp cinterp_var_sat_checker [|CoqInterface.mkRel 1(*v*)|]; d|])
let checker fdimacs ftrace =
@@ -267,9 +267,9 @@ let checker fdimacs ftrace =
let tm = mklApp cchecker [|d; certif|] in
- let res = Structures.cbv_vm (Global.env ()) tm (Lazy.force CoqTerms.cbool) in
+ let res = CoqInterface.cbv_vm (Global.env ()) tm (Lazy.force CoqTerms.cbool) in
Format.eprintf " = %s\n : bool@."
- (if Structures.eq_constr res (Lazy.force CoqTerms.ctrue) then
+ (if CoqInterface.eq_constr res (Lazy.force CoqTerms.ctrue) then
"true" else "false")
@@ -358,22 +358,22 @@ let cchecker_eq_correct =
let cchecker_eq = gen_constant cnf_checker_modules "checker_eq"
let build_body reify_atom reify_form l b (max_id, confl) vm_cast =
- let ntvar = Structures.mkName "t_var" in
- let ntform = Structures.mkName "t_form" in
- let nc = Structures.mkName "c" in
+ let ntvar = CoqInterface.mkName "t_var" in
+ let ntform = CoqInterface.mkName "t_form" in
+ let nc = CoqInterface.mkName "c" in
let tvar = Atom.interp_tbl reify_atom in
let _, tform = Form.interp_tbl reify_form in
let (tres,_,_) =
SmtTrace.to_coq Form.to_coq (fun _ -> assert false) certif_ops confl None in
let certif =
mklApp cCertif [|mkInt (max_id + 1);tres;mkInt (get_pos confl)|] in
- let vtvar = Structures.mkRel 3 in
- let vtform = Structures.mkRel 2 in
- let vc = Structures.mkRel 1 in
+ let vtvar = CoqInterface.mkRel 3 in
+ let vtform = CoqInterface.mkRel 2 in
+ let vc = CoqInterface.mkRel 1 in
let add_lets t =
- Structures.mkLetIn (ntvar, tvar, mklApp carray [|Lazy.force cbool|],
- Structures.mkLetIn (ntform, tform, mklApp carray [|Lazy.force cform|],
- Structures.mkLetIn (nc, certif, Lazy.force ccertif,
+ CoqInterface.mkLetIn (ntvar, tvar, mklApp carray [|Lazy.force cbool|],
+ CoqInterface.mkLetIn (ntform, tform, mklApp carray [|Lazy.force cform|],
+ CoqInterface.mkLetIn (nc, certif, Lazy.force ccertif,
t)))
in
let cbc =
@@ -391,22 +391,22 @@ let build_body reify_atom reify_form l b (max_id, confl) vm_cast =
let build_body_eq reify_atom reify_form l1 l2 l (max_id, confl) vm_cast =
- let ntvar = Structures.mkName "t_var" in
- let ntform = Structures.mkName "t_form" in
- let nc = Structures.mkName "c" in
+ let ntvar = CoqInterface.mkName "t_var" in
+ let ntform = CoqInterface.mkName "t_form" in
+ let nc = CoqInterface.mkName "c" in
let tvar = Atom.interp_tbl reify_atom in
let _, tform = Form.interp_tbl reify_form in
let (tres,_,_) =
SmtTrace.to_coq Form.to_coq (fun _ -> assert false) certif_ops confl None in
let certif =
mklApp cCertif [|mkInt (max_id + 1);tres;mkInt (get_pos confl)|] in
- let vtvar = Structures.mkRel 3 in
- let vtform = Structures.mkRel 2 in
- let vc = Structures.mkRel 1 in
+ let vtvar = CoqInterface.mkRel 3 in
+ let vtform = CoqInterface.mkRel 2 in
+ let vc = CoqInterface.mkRel 1 in
let add_lets t =
- Structures.mkLetIn (ntvar, tvar, mklApp carray [|Lazy.force cbool|],
- Structures.mkLetIn (ntform, tform, mklApp carray [|Lazy.force cform|],
- Structures.mkLetIn (nc, certif, Lazy.force ccertif,
+ CoqInterface.mkLetIn (ntvar, tvar, mklApp carray [|Lazy.force cbool|],
+ CoqInterface.mkLetIn (ntform, tform, mklApp carray [|Lazy.force cform|],
+ CoqInterface.mkLetIn (nc, certif, Lazy.force ccertif,
t)))
in
let ceqc = add_lets (mklApp cchecker_eq [|vtform;l1;l2;l;vc|])
@@ -421,10 +421,10 @@ let build_body_eq reify_atom reify_form l1 l2 l (max_id, confl) vm_cast =
(proof_cast, proof_nocast)
let get_arguments concl =
- let f, args = Structures.decompose_app concl in
+ let f, args = CoqInterface.decompose_app concl in
match args with
- | [ty;a;b] when (Structures.eq_constr f (Lazy.force ceq)) && (Structures.eq_constr ty (Lazy.force cbool)) -> a, b
- | [a] when (Structures.eq_constr f (Lazy.force cis_true)) -> a, Lazy.force ctrue
+ | [ty;a;b] when (CoqInterface.eq_constr f (Lazy.force ceq)) && (CoqInterface.eq_constr ty (Lazy.force cbool)) -> a, b
+ | [a] when (CoqInterface.eq_constr f (Lazy.force cis_true)) -> a, Lazy.force ctrue
| _ -> failwith ("Zchaff.get_arguments :can only deal with equality over bool")
@@ -499,7 +499,7 @@ let make_proof pform_tbl atom_tbl env reify_form l =
let (reloc, resfilename, logfilename, last) =
call_zchaff (Form.nvars reify_form) root in
(try check_unsat resfilename with
- | Sat model -> Structures.error (List.fold_left (fun acc i ->
+ | Sat model -> CoqInterface.error (List.fold_left (fun acc i ->
let index = if i > 0 then i-1 else -i-1 in
let ispos = i > 0 in
try (
@@ -508,7 +508,7 @@ let make_proof pform_tbl atom_tbl env reify_form l =
| Fatom a ->
let t = atom_tbl.(a) in
let value = if ispos then " = true" else " = false" in
- acc^" "^(Pp.string_of_ppcmds (Structures.pr_constr_env env t))^value
+ acc^" "^(Pp.string_of_ppcmds (CoqInterface.pr_constr_env env t))^value
| Fapp _ -> acc
(* Nothing to do with ZChaff *)
| FbbT _ -> assert false
@@ -528,9 +528,9 @@ let core_tactic vm_cast env sigma concl =
let reify_atom = Atom.create () in
let reify_form = Form.create () in
let (body_cast, body_nocast) =
- if ((Structures.eq_constr b (Lazy.force ctrue)) || (Structures.eq_constr b (Lazy.force cfalse))) then
+ if ((CoqInterface.eq_constr b (Lazy.force ctrue)) || (CoqInterface.eq_constr b (Lazy.force cfalse))) then
let l = Form.of_coq (Atom.get reify_atom) reify_form a in
- let l' = if (Structures.eq_constr b (Lazy.force ctrue)) then Form.neg l else l in
+ let l' = if (CoqInterface.eq_constr b (Lazy.force ctrue)) then Form.neg l else l in
let atom_tbl = Atom.atom_tbl reify_atom in
let pform_tbl = Form.pform_tbl reify_form in
let max_id_confl = make_proof pform_tbl atom_tbl (Environ.push_rel_context forall_let env) reify_form l' in
@@ -551,10 +551,10 @@ let core_tactic vm_cast env sigma concl =
let res_cast = compose_lam_assum forall_let body_cast in
let res_nocast = compose_lam_assum forall_let body_nocast in
- (Structures.tclTHEN
- (Structures.set_evars_tac res_nocast)
- (Structures.vm_cast_no_check res_cast))
+ (CoqInterface.tclTHEN
+ (CoqInterface.set_evars_tac res_nocast)
+ (CoqInterface.vm_cast_no_check res_cast))
-let tactic () = Structures.tclTHEN Tactics.intros (Structures.mk_tactic (core_tactic vm_cast_true))
-let tactic_no_check () = Structures.tclTHEN Tactics.intros (Structures.mk_tactic (core_tactic (fun _ -> vm_cast_true_no_check)))
+let tactic () = CoqInterface.tclTHEN Tactics.intros (CoqInterface.mk_tactic (core_tactic vm_cast_true))
+let tactic_no_check () = CoqInterface.tclTHEN Tactics.intros (CoqInterface.mk_tactic (core_tactic (fun _ -> vm_cast_true_no_check)))
diff --git a/src/zchaff/zchaff.mli b/src/zchaff/zchaff.mli
index 3f458d3..1e472fc 100644
--- a/src/zchaff/zchaff.mli
+++ b/src/zchaff/zchaff.mli
@@ -11,9 +11,9 @@
val pp_trace : Format.formatter -> SatAtom.Form.t SmtCertif.clause -> unit
-val parse_certif : Structures.id -> Structures.id -> string -> string -> unit
+val parse_certif : CoqInterface.id -> CoqInterface.id -> string -> string -> unit
val checker : string -> string -> unit
-val theorem : Structures.id -> string -> string -> unit
-val theorem_abs : Structures.id -> string -> string -> unit
-val tactic : unit -> Structures.tactic
-val tactic_no_check : unit -> Structures.tactic
+val theorem : CoqInterface.id -> string -> string -> unit
+val theorem_abs : CoqInterface.id -> string -> string -> unit
+val tactic : unit -> CoqInterface.tactic
+val tactic_no_check : unit -> CoqInterface.tactic
diff --git a/unit-tests/Makefile b/unit-tests/Makefile
index 4820887..db28f4a 100644
--- a/unit-tests/Makefile
+++ b/unit-tests/Makefile
@@ -45,7 +45,7 @@ logs: $(OBJ)
parallel: Tests_zchaff_tactics.vio Tests_verit_tactics.vio Tests_lfsc_tactics.vio
- coqtop -schedule-vio-checking 3 Tests_zchaff_tactics Tests_verit_tactics Tests_lfsc_tactics
+ coqc -schedule-vio-checking 3 Tests_zchaff_tactics Tests_verit_tactics Tests_lfsc_tactics
clean: cleanvo