Commit 2c78bda7 authored by Guillaume Melquiond's avatar Guillaume Melquiond

Adapt plugin to Coq 8.6.

parent df9875a9
......@@ -760,7 +760,7 @@ COQPDEP = $(addsuffix .dep, $(COQPMODULES))
COQPCMO = $(addsuffix .cmo, $(COQPMODULES))
COQPCMX = $(addsuffix .cmx, $(COQPMODULES))
COQPTREES = kernel interp intf lib library parsing pretyping proofs printing tactics toplevel
COQPTREES = engine interp intf kernel lib library ltac parsing pretyping printing proofs tactics toplevel
COQPINCLUDES = -I src/coq-tactic -I $(COQCAMLPLIB) $(addprefix -I @COQLIB@/, $(COQPTREES)) @ZIPINCLUDE@
$(COQPDEP): DEPFLAGS += -I src/coq-tactic
......@@ -786,14 +786,20 @@ src/coq-tactic/why3tac.ml: src/coq-tactic/why3tac.ml4
$(SHOW) 'Camlp $<'
$(HIDE)$(COQCAMLP) pr_dump.cmo @COQPPLIBS@ pa_macro.cmo -D@coq_compat_version@ -impl $^ -o $@
COQRTAC = -R lib/coq-tactic Why3 -R lib/coq Why3
ifeq (@coq_compat_version@,COQ86)
COQRTAC += -I lib/coq-tactic
endif
src/coq-tactic/.why3-vo-byte: lib/coq-tactic/Why3.v lib/coq/BuiltIn.vo lib/coq-tactic/why3tac.cma
$(SHOW) 'Coqc $<'
$(HIDE)WHY3CONFIG="" $(COQC) -byte -R lib/coq-tactic Why3 -R lib/coq Why3 $< && \
$(HIDE)WHY3CONFIG="" $(COQC) -byte $(COQRTAC) $< && \
touch src/coq-tactic/.why3-vo-byte
src/coq-tactic/.why3-vo-opt: lib/coq-tactic/Why3.v lib/coq/BuiltIn.vo lib/coq-tactic/why3tac.cmxs
$(SHOW) 'Coqc $<'
$(HIDE)WHY3CONFIG="" $(COQC) -opt -R lib/coq-tactic Why3 -R lib/coq Why3 $< && \
$(HIDE)WHY3CONFIG="" $(COQC) -opt $(COQRTAC) $< && \
touch src/coq-tactic/.why3-vo-opt
# depend and clean targets
......@@ -1570,10 +1576,10 @@ test-session.opt: examples/use_api/create_session.ml lib/why3/why3.cmxa
@rm -f test-session.opt why3session.xml why3shapes why3shapes.gz
test-coq-tactic.byte: src/coq-tactic/.why3-vo-byte
$(COQC) -byte -R lib/coq-tactic Why3 -R lib/coq Why3 bench/coq-tactic/test.v
$(COQC) -byte $(COQRTAC) bench/coq-tactic/test.v
test-coq-tactic.opt: src/coq-tactic/.why3-vo-opt
$(COQC) -opt -R lib/coq-tactic Why3 -R lib/coq Why3 bench/coq-tactic/test.v
$(COQC) -opt $(COQRTAC) bench/coq-tactic/test.v
#only test the compilation of runstrat
test-runstrat.byte: lib/why3/why3.cma lib/why3/META
......
......@@ -525,11 +525,16 @@ if test "$enable_coq_support" = yes; then
COQPPLIBS="$COQLIB/parsing/grammar.cma"
AC_MSG_RESULT($COQVERSION)
;;
8.5*|trunk)
8.5*)
coq_compat_version="COQ85"
COQPPLIBS="$OCAMLLIB/unix.cma $OCAMLLIB/threads/threads.cma $COQLIB/grammar/grammar.cma"
AC_MSG_RESULT($COQVERSION)
;;
8.6*|trunk)
coq_compat_version="COQ86"
COQPPLIBS="$OCAMLLIB/unix.cma $OCAMLLIB/threads/threads.cma $COQLIB/grammar/grammar.cma"
AC_MSG_RESULT($COQVERSION)
;;
*)
enable_coq_support=no
AC_MSG_WARN(You need Coq 8.4 or later; Coq discarded)
......
This diff is collapsed.
......@@ -57,7 +57,7 @@ Proof.
intros a a_WT v m l u h1.
assert (u - l <= 0)%Z as h1' by omega.
unfold occ.
destruct (u - l)%Z ; try easy.
destruct (u - l)%Z ; try reflexivity.
now elim h1'.
Qed.
......
......@@ -491,6 +491,18 @@ version_ok = "7.0"
command = "%l/why3-cpulimit %t %m -s %e -noprompt"
driver = "drivers/mathematica.drv"
# Coq 8.6: do not limit memory
[ITP coq]
name = "Coq"
compile_time_support = true
exec = "coqtop -batch"
version_switch = "-v"
version_regexp = "The Coq Proof Assistant, version \\([^ \n]+\\)"
version_ok = "8.6"
command = "%e -I %l/coq-tactic -R %l/coq-tactic Why3 -R %l/coq Why3 -l %f"
driver = "drivers/coq.drv"
editor = "coqide"
# Coq 8.5: do not limit memory
[ITP coq]
name = "Coq"
......@@ -498,6 +510,8 @@ compile_time_support = true
exec = "coqtop -batch"
version_switch = "-v"
version_regexp = "The Coq Proof Assistant, version \\([^ \n]+\\)"
version_ok = "8.5pl3"
version_ok = "8.5pl2"
version_ok = "8.5pl1"
version_ok = "8.5"
command = "%e -R %l/coq-tactic Why3 -R %l/coq Why3 -l %f"
......
......@@ -58,12 +58,24 @@ let is_global c t =
| VarRef id, Var id' -> id = id'
| _ -> false
let push_named = Environ.push_named
let betadeltaiota = Closure.betadeltaiota
module RedFlags = Closure.RedFlags
ELSE
open Universes
open Globnames
open Vars
IFDEF COQ85 THEN
open Errors
ELSE
open CErrors
open Stdarg
END
let declare_summary name freeze unfreeze init =
Summary.declare_summary name
......@@ -112,6 +124,34 @@ let find_reference t1 t2 =
let is_global c t = is_global (Lazy.force c) t
IFDEF COQ85 THEN
let push_named = Environ.push_named
let betadeltaiota = Closure.betadeltaiota
module RedFlags = Closure.RedFlags
ELSE
let push_named (id, c, t) env =
Environ.push_named
(match c with
| None -> Context.Named.Declaration.LocalAssum (id, t)
| Some b -> Context.Named.Declaration.LocalDef (id, b, t))
env
let pf_hyps gl =
List.map (function
| Context.Named.Declaration.LocalAssum (id, t) -> (id, None, t)
| Context.Named.Declaration.LocalDef (id, b, t) -> (id, Some b, t))
(pf_hyps gl)
let betadeltaiota = CClosure.all
module RedFlags = CClosure.RedFlags
END
DECLARE PLUGIN "why3tac"
END
......@@ -260,7 +300,7 @@ let coq_rename_vars env vars =
let coq_rename_var env na t =
let avoid = ids_of_named_context (Environ.named_context env) in
let id = next_name_away na avoid in
id, Environ.push_named (id, None, t) env
id, push_named (id, None, t) env
let preid_of_id id = Ident.id_fresh (string_of_id id)
......@@ -524,8 +564,8 @@ let rec tr_arith_constant dep t = match kind_of_term t with
let rec tr_type dep tvm env evd t =
let t = Reductionops.clos_norm_flags
(Closure.RedFlags.red_add_transparent
Closure.betadeltaiota (get_transp_state env))
(RedFlags.red_add_transparent
betadeltaiota (get_transp_state env))
env evd t in
if is_global coq_Z t then
Ty.ty_int
......@@ -1358,7 +1398,9 @@ let why3tac ?(timelimit=timelimit) s gl =
| StepLimitExceeded -> error "Step Limit Exceeded"
| HighFailure -> error ("Prover failure\n" ^ res.pr_output ^ "\n")
IFDEF COQ85 THEN
IFDEF COQ84 THEN
ELSE
let why3tac ?timelimit s = Proofview.V82.tactic (why3tac ?timelimit s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment