Skip to content
Snippets Groups Projects
Commit d07cc305 authored by Patrick Baudin's avatar Patrick Baudin
Browse files

[WP/share] removing wp/share/src

parent a500119f
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 9392 deletions
/local_why3.conf
/why3.conf
/alt_ergo-realize.drv
/coq-realize.drv
/coq.drv
/why3.drv
/plugins
/aux/
/stamp/
/*.coqdep
/*.v.bak
/*.vo
/*.glob
/*.why_theory
/.*.aux
PKG why3
\ No newline at end of file
(* This file is generated by Why3's Coq-realize driver *)
(* Beware! Only edit allowed sections below *)
Require Import BuiltIn.
Require Reals.R_sqrt.
Require Reals.Rbasic_fun.
Require Reals.Rtrigo_def.
Require Reals.Rtrigo1.
Require Reals.Ratan.
Require BuiltIn.
Require real.Real.
Require real.RealInfix.
Require real.Abs.
Require real.Square.
Require real.Trigonometry.
(* Why3 goal *)
Definition asin: R -> R.
Admitted.
(* Why3 goal *)
Definition acos: R -> R.
Admitted.
(* Why3 goal *)
Lemma Sin_asin : forall (x:R), (((-1%R)%R <= x)%R /\ (x <= 1%R)%R) ->
((Reals.Rtrigo_def.sin (asin x)) = x).
Admitted.
(* Why3 goal *)
Lemma Cos_acos : forall (x:R), (((-1%R)%R <= x)%R /\ (x <= 1%R)%R) ->
((Reals.Rtrigo_def.cos (acos x)) = x).
Admitted.
This diff is collapsed.
(**************************************************************************)
(* *)
(* This file is part of WP plug-in of Frama-C. *)
(* *)
(* Copyright (C) 2007-2019 *)
(* CEA (Commissariat a l'energie atomique et aux energies *)
(* alternatives) *)
(* *)
(* you can redistribute it and/or modify it under the terms of the GNU *)
(* Lesser General Public License as published by the Free Software *)
(* Foundation, version 2.1. *)
(* *)
(* It is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU Lesser General Public License for more details. *)
(* *)
(* See the GNU Lesser General Public License version 2.1 *)
(* for more details (enclosed in the file licenses/LGPLv2.1). *)
(* *)
(**************************************************************************)
logic match_bool : bool, 'a, 'a -> 'a
axiom match_bool_True :
(forall z:'a. forall z1:'a. (match_bool(true, z, z1) = z))
axiom match_bool_False :
(forall z:'a. forall z1:'a. (match_bool(false, z, z1) = z1))
This diff is collapsed.
(* This file is generated by Why3's Coq-realize driver *)
(* Beware! Only edit allowed sections below *)
Require Import BuiltIn.
Require Reals.Rbasic_fun.
Require Reals.R_sqrt.
Require BuiltIn.
Require bool.Bool.
Require int.Int.
Require real.Real.
Require real.RealInfix.
Require real.Abs.
Require real.FromInt.
Require real.Square.
(* Why3 goal *)
Definition f32 : Type.
Admitted.
(* Why3 goal *)
Definition f64 : Type.
Admitted.
(* Why3 goal *)
Definition to_f32: R -> f32.
Admitted.
(* Why3 goal *)
Definition of_f32: f32 -> R.
Admitted.
(* Why3 goal *)
Definition to_f64: R -> f64.
Admitted.
(* Why3 goal *)
Definition of_f64: f64 -> R.
Admitted.
(* Why3 goal *)
Lemma to_f32_zero : ((of_f32 (to_f32 0%R)) = 0%R).
Admitted.
(* Why3 goal *)
Lemma to_f32_one : ((of_f32 (to_f32 1%R)) = 1%R).
Admitted.
(* Why3 goal *)
Lemma to_f64_zero : ((of_f64 (to_f64 0%R)) = 0%R).
Admitted.
(* Why3 goal *)
Lemma to_f64_one : ((of_f64 (to_f64 1%R)) = 1%R).
Admitted.
(* Why3 assumption *)
Inductive rounding_mode :=
| Up : rounding_mode
| Down : rounding_mode
| ToZero : rounding_mode
| NearestTiesToAway : rounding_mode
| NearestTiesToEven : rounding_mode.
Axiom rounding_mode_WhyType : WhyType rounding_mode.
Existing Instance rounding_mode_WhyType.
(* Why3 goal *)
Definition round_float: rounding_mode -> R -> f32.
Admitted.
(* Why3 goal *)
Definition round_double: rounding_mode -> R -> f64.
Admitted.
(* Why3 goal *)
Lemma float_32 : forall (x:R), ((to_f32 x) = (round_float NearestTiesToEven
x)).
Admitted.
(* Why3 goal *)
Lemma float_64 : forall (x:R), ((to_f64 x) = (round_double NearestTiesToEven
x)).
Admitted.
(* Why3 assumption *)
Inductive float_kind :=
| Finite : float_kind
| NaN : float_kind
| Inf_pos : float_kind
| Inf_neg : float_kind.
Axiom float_kind_WhyType : WhyType float_kind.
Existing Instance float_kind_WhyType.
(* Why3 goal *)
Definition classify_f32: f32 -> float_kind.
Admitted.
(* Why3 goal *)
Definition classify_f64: f64 -> float_kind.
Admitted.
(* Why3 assumption *)
Definition is_finite_f32 (f:f32): Prop := ((classify_f32 f) = Finite).
(* Why3 assumption *)
Definition is_finite_f64 (d:f64): Prop := ((classify_f64 d) = Finite).
(* Why3 assumption *)
Definition is_NaN_f32 (f:f32): Prop := ((classify_f32 f) = NaN).
(* Why3 assumption *)
Definition is_NaN_f64 (d:f64): Prop := ((classify_f64 d) = NaN).
(* Why3 assumption *)
Definition is_infinite_f32 (f:f32): Prop := ((classify_f32 f) = Inf_pos) \/
((classify_f32 f) = Inf_neg).
(* Why3 assumption *)
Definition is_infinite_f64 (d:f64): Prop := ((classify_f64 d) = Inf_pos) \/
((classify_f64 d) = Inf_neg).
(* Why3 assumption *)
Definition is_positive_infinite_f32 (f:f32): Prop :=
((classify_f32 f) = Inf_pos).
(* Why3 assumption *)
Definition is_positive_infinite_f64 (d:f64): Prop :=
((classify_f64 d) = Inf_pos).
(* Why3 assumption *)
Definition is_negative_infinite_f32 (f:f32): Prop :=
((classify_f32 f) = Inf_neg).
(* Why3 assumption *)
Definition is_negative_infinite_f64 (d:f64): Prop :=
((classify_f64 d) = Inf_neg).
(* Why3 goal *)
Lemma is_finite_to_float_32 : forall (x:R), (is_finite_f32 (to_f32 x)).
Admitted.
(* Why3 goal *)
Lemma is_finite_to_float_64 : forall (x:R), (is_finite_f64 (to_f64 x)).
Admitted.
(* Why3 goal *)
Lemma to_float_is_finite_32 : forall (f:f32), (is_finite_f32 f) ->
((to_f32 (of_f32 f)) = f).
Admitted.
(* Why3 goal *)
Lemma to_float_is_finite_64 : forall (d:f64), (is_finite_f64 d) ->
((to_f64 (of_f64 d)) = d).
Admitted.
(* Why3 assumption *)
Definition finite (x:R): Prop := (is_finite_f32 (to_f32 x)) /\ (is_finite_f64
(to_f64 x)).
(* Why3 goal *)
Lemma finite_small_f32 : forall (x:R),
(((-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368%R)%R <= x)%R /\
(x <= 340282346600000016151267322115014000640%R)%R) -> (is_finite_f32
(to_f32 x)).
Admitted.
(* Why3 goal *)
Lemma finite_small_f64 : forall (x:R),
(((-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368%R)%R <= x)%R /\
(x <= 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368%R)%R) ->
(is_finite_f64 (to_f64 x)).
Admitted.
(* Why3 goal *)
Lemma finite_range_f32 : forall (f:f32), (is_finite_f32 f) <->
(((-340282346600000016151267322115014000640%R)%R <= (of_f32 f))%R /\
((of_f32 f) <= 340282346600000016151267322115014000640%R)%R).
Admitted.
(* Why3 goal *)
Lemma finite_range_f64 : forall (d:f64), (is_finite_f64 d) <->
(((-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368%R)%R <= (of_f64 d))%R /\
((of_f64 d) <= 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368%R)%R).
Admitted.
(* Why3 goal *)
Definition eq_f32b: f32 -> f32 -> bool.
Admitted.
(* Why3 goal *)
Definition eq_f64b: f64 -> f64 -> bool.
Admitted.
(* Why3 assumption *)
Definition eq_f32 (x:f32) (y:f32): Prop := ((eq_f32b x y) = true).
(* Why3 assumption *)
Definition eq_f64 (x:f64) (y:f64): Prop := ((eq_f64b x y) = true).
(* Why3 goal *)
Lemma eq_finite_f32 : forall (x:f32) (y:f32), (is_finite_f32 x) ->
((is_finite_f32 y) -> ((eq_f32 x y) <-> ((of_f32 x) = (of_f32 y)))).
Admitted.
(* Why3 goal *)
Lemma eq_finite_f64 : forall (x:f64) (y:f64), (is_finite_f64 x) ->
((is_finite_f64 y) -> ((eq_f64 x y) <-> ((of_f64 x) = (of_f64 y)))).
Admitted.
(* Why3 goal *)
Definition ne_f32b: f32 -> f32 -> bool.
Admitted.
(* Why3 goal *)
Definition ne_f64b: f64 -> f64 -> bool.
Admitted.
(* Why3 assumption *)
Definition ne_f32 (x:f32) (y:f32): Prop := ((ne_f32b x y) = true).
(* Why3 assumption *)
Definition ne_f64 (x:f64) (y:f64): Prop := ((ne_f64b x y) = true).
(* Why3 goal *)
Lemma ne_finite_f32 : forall (x:f32) (y:f32), (is_finite_f32 x) ->
((is_finite_f32 y) -> ((ne_f32 x y) <-> ~ ((of_f32 x) = (of_f32 y)))).
Admitted.
(* Why3 goal *)
Lemma ne_finite_f64 : forall (x:f64) (y:f64), (is_finite_f64 x) ->
((is_finite_f64 y) -> ((ne_f64 x y) <-> ~ ((of_f64 x) = (of_f64 y)))).
Admitted.
(* Why3 goal *)
Definition le_f32b: f32 -> f32 -> bool.
Admitted.
(* Why3 goal *)
Definition le_f64b: f64 -> f64 -> bool.
Admitted.
(* Why3 assumption *)
Definition le_f32 (x:f32) (y:f32): Prop := ((le_f32b x y) = true).
(* Why3 assumption *)
Definition le_f64 (x:f64) (y:f64): Prop := ((le_f64b x y) = true).
(* Why3 goal *)
Lemma le_finite_f32 : forall (x:f32) (y:f32), (is_finite_f32 x) ->
((is_finite_f32 y) -> ((le_f32 x y) <-> ((of_f32 x) <= (of_f32 y))%R)).
Admitted.
(* Why3 goal *)
Lemma le_finite_f64 : forall (x:f64) (y:f64), (is_finite_f64 x) ->
((is_finite_f64 y) -> ((le_f64 x y) <-> ((of_f64 x) <= (of_f64 y))%R)).
Admitted.
(* Why3 goal *)
Definition lt_f32b: f32 -> f32 -> bool.
Admitted.
(* Why3 goal *)
Definition lt_f64b: f64 -> f64 -> bool.
Admitted.
(* Why3 assumption *)
Definition lt_f32 (x:f32) (y:f32): Prop := ((lt_f32b x y) = true).
(* Why3 assumption *)
Definition lt_f64 (x:f64) (y:f64): Prop := ((lt_f64b x y) = true).
(* Why3 goal *)
Lemma lt_finite_f32 : forall (x:f32) (y:f32), (is_finite_f32 x) ->
((is_finite_f32 y) -> ((lt_f32 x y) <-> ((of_f32 x) < (of_f32 y))%R)).
Admitted.
(* Why3 goal *)
Lemma lt_finite_f64 : forall (x:f64) (y:f64), (is_finite_f64 x) ->
((is_finite_f64 y) -> ((lt_f64 x y) <-> ((of_f64 x) < (of_f64 y))%R)).
Admitted.
(* Why3 goal *)
Definition neg_f32: f32 -> f32.
Admitted.
(* Why3 goal *)
Definition neg_f64: f64 -> f64.
Admitted.
(* Why3 goal *)
Lemma neg_finite_f32 : forall (x:f32), (is_finite_f32 x) ->
((of_f32 (neg_f32 x)) = (-(of_f32 x))%R).
Admitted.
(* Why3 goal *)
Lemma neg_finite_f64 : forall (x:f64), (is_finite_f64 x) ->
((of_f64 (neg_f64 x)) = (-(of_f64 x))%R).
Admitted.
(* Why3 goal *)
Definition add_f32: f32 -> f32 -> f32.
Admitted.
(* Why3 goal *)
Definition add_f64: f64 -> f64 -> f64.
Admitted.
(* Why3 goal *)
Lemma add_finite_f32 : forall (x:f32) (y:f32), (is_finite_f32 x) ->
((is_finite_f32 y) -> ((add_f32 x
y) = (to_f32 ((of_f32 x) + (of_f32 y))%R))).
Admitted.
(* Why3 goal *)
Lemma add_finite_f64 : forall (x:f64) (y:f64), (is_finite_f64 x) ->
((is_finite_f64 y) -> ((add_f64 x
y) = (to_f64 ((of_f64 x) + (of_f64 y))%R))).
Admitted.
(* Why3 goal *)
Definition mul_f32: f32 -> f32 -> f32.
Admitted.
(* Why3 goal *)
Definition mul_f64: f64 -> f64 -> f64.
Admitted.
(* Why3 goal *)
Lemma mul_finite_f32 : forall (x:f32) (y:f32), (is_finite_f32 x) ->
((is_finite_f32 y) -> ((mul_f32 x
y) = (to_f32 ((of_f32 x) * (of_f32 y))%R))).
Admitted.
(* Why3 goal *)
Lemma mul_finite_f64 : forall (x:f64) (y:f64), (is_finite_f64 x) ->
((is_finite_f64 y) -> ((mul_f64 x
y) = (to_f64 ((of_f64 x) * (of_f64 y))%R))).
Admitted.
(* Why3 goal *)
Definition div_f32: f32 -> f32 -> f32.
Admitted.
(* Why3 goal *)
Definition div_f64: f64 -> f64 -> f64.
Admitted.
(* Why3 goal *)
Lemma div_finite_f32 : forall (x:f32) (y:f32), (is_finite_f32 x) ->
((is_finite_f32 y) -> ((div_f32 x
y) = (to_f32 ((of_f32 x) / (of_f32 y))%R))).
Admitted.
(* Why3 goal *)
Lemma div_finite_f64 : forall (x:f64) (y:f64), (is_finite_f64 x) ->
((is_finite_f64 y) -> ((div_f64 x
y) = (to_f64 ((of_f64 x) / (of_f64 y))%R))).
Admitted.
(* Why3 goal *)
Definition sqrt_f32: f32 -> f32.
Admitted.
(* Why3 goal *)
Definition sqrt_f64: f64 -> f64.
Admitted.
(* Why3 goal *)
Lemma sqrt_finite_f32 : forall (x:f32), (is_finite_f32 x) ->
((sqrt_f32 x) = (to_f32 (Reals.R_sqrt.sqrt (of_f32 x)))).
Admitted.
(* Why3 goal *)
Lemma sqrt_finite_f64 : forall (x:f64), (is_finite_f64 x) ->
((sqrt_f64 x) = (to_f64 (Reals.R_sqrt.sqrt (of_f64 x)))).
Admitted.
(* Why3 goal *)
Definition model_f32: f32 -> R.
Admitted.
(* Why3 assumption *)
Definition delta_f32 (f:f32): R :=
(Reals.Rbasic_fun.Rabs ((of_f32 f) - (model_f32 f))%R).
(* Why3 assumption *)
Definition error_f32 (f:f32): R :=
((delta_f32 f) / (Reals.Rbasic_fun.Rabs (model_f32 f)))%R.
(* Why3 goal *)
Definition model_f64: f64 -> R.
Admitted.
(* Why3 assumption *)
Definition delta_f64 (f:f64): R :=
(Reals.Rbasic_fun.Rabs ((of_f64 f) - (model_f64 f))%R).
(* Why3 assumption *)
Definition error_f64 (f:f64): R :=
((delta_f64 f) / (Reals.Rbasic_fun.Rabs (model_f64 f)))%R.
This diff is collapsed.
(* This file is generated by Why3's Coq-realize driver *)
(* Beware! Only edit allowed sections below *)
Require Import BuiltIn.
Require BuiltIn.
Require int.Int.
Require int.Abs.
Require real.Real.
Require real.RealInfix.
Require Import RIneq.
(* Why3 goal *)
Lemma abs_def : forall (x:Z), ((0%Z <= x)%Z ->
((ZArith.BinInt.Z.abs x) = x)) /\ ((~ (0%Z <= x)%Z) ->
((ZArith.BinInt.Z.abs x) = (-x)%Z)).
Proof.
exact int.Abs.abs_def.
Qed.
(* This file is generated by Why3's Coq-realize driver *)
(* Beware! Only edit allowed sections below *)
Require Import BuiltIn.
Require Reals.Rtrigo_def.
Require Reals.Rpower.
Require BuiltIn.
Require real.Real.
Require real.RealInfix.
Require real.ExpLog.
(* Why3 goal *)
Lemma exp_pos : forall (x:R), (0%R < (Reals.Rtrigo_def.exp x))%R.
Admitted.
##########################################################################
# #
# This file is part of WP plug-in of Frama-C. #
# #
# Copyright (C) 2007-2019 #
# CEA (Commissariat a l'energie atomique et aux energies #
# alternatives) #
# #
# you can redistribute it and/or modify it under the terms of the GNU #
# Lesser General Public License as published by the Free Software #
# Foundation, version 2.1. #
# #
# It is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU Lesser General Public License for more details. #
# #
# See the GNU Lesser General Public License version 2.1 #
# for more details (enclosed in the file licenses/LGPLv2.1). #
# #
##########################################################################
# --------------------------------------------------------------------------
# --- Generation of Coq and Alt-ergo files from Why3 one
# --- Developer only
# --------------------------------------------------------------------------
REALIZATION_DIR=..
.PHONY: all realize headers
all: realize
stamp:
mkdir -p stamp
aux:
mkdir -p aux
# performs realization and adds headers
realize: stamp/headers.stamp
# To add headers without doing more...
headers:
@echo "Apply headers (on all wp/share directory)"
@$(MAKE) -f ../Makefile.headers -C .. headers > /dev/null
@touch stamp/headers.stamp
# Dependency needed to allow make -j
stamp/headers.stamp: stamp/realizationtools.stamp stamp/coqrealization.stamp \
stamp/altergorealization.stamp stamp/why3realization.stamp stamp/coqlib.stamp
@echo "Apply headers (on some files of wp/share directory)"
@$(MAKE) -f Makefile.headers -C .. headers.wp_share_src > /dev/null
@touch $@
WHY3_SHARE:=$(shell why3 --print-datadir)
WHY3_LIB:=$(shell why3 --print-libdir)/coq
WHY3_VERSION:=$(shell opam info -f version why3-base)
WHY3_SRC:="why3-base".$(WHY3_VERSION)
# When installing why3, "make install-lib" is required to be able to find the package
.PHONY: info help
help info:
@echo "Info about targets:"
@echo "- headers -> adds headers to all necessary files"
@echo "- realize -> updates all share/prover directories from source files of share/src"
@echo "- compile -> compiles Coq files"
@echo "- plugins -> builds Why3 plugins used for the realizations"
@echo "- File.coqide -> runs CoqIde on File.v"
@echo "- import_why3_coq > import resources from why3 source"
@echo "- tests -> runs tests"
@echo "- clean -> cleaning the directory"
@echo "- all (default) -> idem realize"
@echo "About why3 configuration:"
@echo " WHY3_PACKAGE= $(shell ocamlfind query why3)"
@echo " WHY3_SHARE= $(WHY3_SHARE)"
@echo " WHY3_LIB= $(WHY3_LIB)"
#-- The little plugin that define the meta and transformation keep_it and the
#-- printer that do the realization for altergo
PLUGINS=filter_axioms alt_ergo_realize why3printer_realize
PLUGINS_FILE= $(addsuffix .cmxs, $(PLUGINS)) $(addsuffix .cmo, $(PLUGINS))
plugins: $(PLUGINS_FILE)
touch plugins
%.cmxs: %.ml
ocamlfind ocamlopt -package why3 -shared -o $*.cmxs $*.ml
%.cmo: %.ml
ocamlfind ocamlc -package why3 -c -o $*.cmo $*.ml
#-- Library realization (Coq and Alt-ergo) --
#Realized libraries
WHY3_FILE= qed cmath cint cbits memory vset cfloat vlist
WHY3_COQ_REALIZE_DRIVER=$(WHY3_SHARE)/drivers/coq-realize.drv
WHY3_ALTERGO_DRIVER=$(WHY3_SHARE)/drivers/alt_ergo
WHY3_REALIZE=why3 realize --extra-config realization.conf
stamp/realizationtools.stamp: plugins coq-realize.drv alt_ergo-realize.drv realization.conf stamp/REALIZATION_DIR.stamp
@touch $@
stamp/coqrealization.stamp: import_why3_coq $(addprefix stamp/, $(addsuffix .coq.stamp, $(WHY3_FILE)))
@touch $@
#file written directly in coq
WPCOQLIB=Bits.v Zbits.v Qedlib.v
stamp/coqlib.stamp: $(WPCOQLIB) stamp/REALIZATION_DIR.stamp
@echo "Installing Coq Libraries"
@$(foreach file, $(WPCOQLIB),\
install -m 444 $(file) $(REALIZATION_DIR)/coqwp;\
install -m 444 $(file) $(REALIZATION_DIR)/why3;)
@touch $@
stamp/REALIZATION_DIR.stamp: stamp
@echo "Create share sub-directories"
@mkdir -p $(REALIZATION_DIR)/ergo
@mkdir -p $(REALIZATION_DIR)/why3
@mkdir -p $(REALIZATION_DIR)/coqwp
@touch $@
stamp/%.coq.stamp: %.why %.why_theory Makefile $(WHY3_LIB) stamp/realizationtools.stamp
@echo "Realizing Coq Library for $*"
@for theory in $$(cat $*.why_theory); do\
$(WHY3_REALIZE) -D coq-realize.drv -T $*.$$theory -o . 2> logs/$$theory.coq.err.tmp;\
sed -e 's:^File ".*/wp/share/:File "WP-SHARE/:' logs/$$theory.coq.err.tmp > logs/$$theory.coq.err;\
rm -f logs/$$theory.coq.err.tmp;\
install -m 444 $$theory.v $(REALIZATION_DIR)/coqwp;\
install -m 444 $$theory.v $(REALIZATION_DIR)/why3;\
done;
@touch $@
coq.drv: $(addprefix aux/, $(addsuffix .coq.aux, $(WHY3_FILE)))
@echo "Making Coq driver"
@echo "(* generated automatically at developer compilation time *)" | cat - $^ > $@
coq-why3.drv: $(addprefix aux/, $(addsuffix .coq-why3.aux, $(WHY3_FILE)))
@echo "Making Coq-Why3 driver"
@echo "(* generated automatically at developer compilation time *)" | cat - $^ > $@
install -m 444 $@ $(REALIZATION_DIR)/why3/coq.drv
coq-realize.drv: $(WHY3_COQ_REALIZE_DRIVER) coq.drv coq-why3.drv
@echo "Making Coq realization driver"
@echo "(* generated automatically at compilation time *)" > $@
@echo "import \"coq.drv\"" >> $@
@echo "import \"$(WHY3_COQ_REALIZE_DRIVER)\"" >> $@
@echo "import \"coq-own-realization.drv\"" >> $@
aux/%.coq.aux: %.why %.why_theory Makefile aux
@echo "Auxiliary Coq files for $*"
@rm -f $@.tmp;
@for theory in $$(cat $*.why_theory); do\
echo 'theory $*.'"$$theory"' meta "realized_theory" "$*.'"$$theory"'", "'"$$theory"'" end' >> $@.tmp;\
done;
@mv $@.tmp $@
aux/%.coq-why3.aux: %.why %.why_theory Makefile aux
@echo "Auxiliary Coq-Why3 files for $*"
@rm -f $@.tmp;
@for theory in $$(cat $*.why_theory); do\
NAMELOWER=`ocaml lower.ml "$$theory"`; \
echo 'theory '"$$NAMELOWER"'.'"$$theory"' meta "realized_theory" "'"$$NAMELOWER"'.'"$$theory"'", "'"$$theory"'" end' >> $@.tmp;\
done;
@mv $@.tmp $@
#-- Why3 Import
WHY3_STDLIB_REALIZED= \
bool.Bool \
map.Map map.Const \
int.Int int.Abs int.MinMax int.ComputerDivision \
real.FromInt real.Real real.RealInfix real.Abs real.MinMax \
real.Square real.ExpLog real.PowerReal \
real.Trigonometry
WHY3_STDLIB_USED= \
$(WHY3_STDLIB_REALIZED) \
real.Truncate real.Hyperbolic real.Polar
.PHONY: import_why3_coq
import_why3_coq: stamp/why3.$(WHY3_VERSION).stamp
@echo "Why-3 Coq Sources up-to-date"
stamp/why3.$(WHY3_VERSION).stamp: stamp/REALIZATION_DIR.stamp Makefile
@echo "Importing Why-3 Coq Sources"
@rm -fr $(WHY3_SRC)
@opam source $(WHY3_SRC)
@install -m 444 $(WHY3_SRC)/lib/coq/BuiltIn.v $(REALIZATION_DIR)/coqwp/BuiltIn.v
@$(foreach file, $(subst .,/,$(WHY3_STDLIB_REALIZED)), \
install -m 444 $(WHY3_SRC)/lib/coq/$(file).v $(REALIZATION_DIR)/coqwp/$(file).v;)
@rm -fr $(WHY3_SRC)
@touch $@
# --------------------------------------------------------------------------
# --- Alt-Ergo Realization
# --------------------------------------------------------------------------
stamp/altergorealization.stamp:\
$(addprefix stamp/, \
$(addsuffix .altergo.stamp, $(WHY3_FILE)) \
$(addsuffix .altergo.stdlib.stamp, $(WHY3_STDLIB_USED)))
@touch $@
stamp/%.altergo.stamp: %.why %.why_theory Makefile $(WHY3_LIB) stamp/realizationtools.stamp
@echo "Realizing Alt-Ergo Library for $*"
@$(foreach theory, $(shell cat $*.why_theory),\
$(WHY3_REALIZE) -D alt_ergo-realize.drv -T $*.$(theory) -o $(REALIZATION_DIR)/ergo 2> logs/$(theory).altergo.err.tmp;\
sed -e 's:^File ".*/wp/share/:File "WP-SHARE/:' logs/$(theory).altergo.err.tmp > logs/$(theory).altergo.err;\
rm -f logs/$(theory).altergo.err.tmp;)
@touch $@
stamp/%.altergo.stdlib.stamp: Makefile $(WHY3_LIB) stamp/realizationtools.stamp
@echo "Realizing Alt-Ergo Std-Library for $*"
@mkdir -p tmp; rm -rf tmp/$*; mkdir tmp/$*
@$(WHY3_REALIZE) -D alt_ergo-realize.drv -T $* -o tmp/$* 2> logs/$*.altergo.stdlib.err.tmp
@sed -e 's:^File ".*/wp/share/:File "WP-SHARE/:' logs/$*.altergo.stdlib.err.tmp > logs/$*.altergo.stdlib.err
@rm -f logs/$*altergo.stdlib.err.tmp
@mv tmp/$*/$(subst .,,$(suffix $*)).mlw $(REALIZATION_DIR)/ergo/$*.mlw
@rm -rf tmp/$*
@touch $@
alt_ergo-realize.drv: $(addprefix aux/, $(addsuffix .altergo.aux, $(WHY3_FILE)) $(addsuffix .altergo.stdlib.aux, $(WHY3_STDLIB_USED)))
@echo "Generating Alt-Ergo driver"
@echo "(* generated automatically at compilation time *)" > $@
@echo 'theory BuiltIn meta "realized_theory" "BuiltIn", "BuiltIn_" end' >> $@
@echo 'theory BuiltIn meta "realized_theory" "Bool", "Bool_" end' >> $@
@cat $^ >> $@
@echo "printer \"alt-ergo-realize\"" >> $@
@echo "filename \"%t.mlw\"" >> $@
@echo "transformation \"remove_for_altergo\"" >> $@
@echo "transformation \"inline_in\"" >> $@
@echo "transformation \"def_into_axiom\"" >> $@
@echo >> $@
@echo "import \"alt_ergo_why3_stdlib.drv\"" >> $@
@echo >> $@
@echo "(* From why3 alt_ergo.drv except import *)" >> $@
@cat $(WHY3_ALTERGO_DRIVER).drv | grep -v -e "^import" >> $@
@echo "(* From why3 alt_ergo_common.drv except printer *)" >> $@
@cat $(WHY3_ALTERGO_DRIVER)_common.drv | grep -v -e "^printer" -e "^filename" >> $@
#We put the realized theory meta un BuiltIn so that it always appears
aux/%.altergo.aux: %.why %.why_theory Makefile $(WHY3_LIB) aux
@echo "Auxiliary Alt-Ergo files for $*"
@rm -f $@.tmp
@$(foreach theory, $(shell cat $*.why_theory),\
echo 'theory $*.$(theory) meta "realized_theory" "$*.$(theory)", "$(subst .,_,$(theory))_" end' >> $@.tmp;)
@mv $@.tmp $@
aux/%.altergo.stdlib.aux: Makefile $(WHY3_LIB) aux
@echo "Auxiliary Alt-Ergo stdlib for $*"
@echo 'theory $* meta "realized_theory" "$*", "$(subst .,_,$*)_" end' > $@;
%.why_theory: %.why
@echo "Why Theory $<"
@grep -e "^theory" $< | sed -e "s/^theory[ ]*//" > $@
#why3 realization
why3.drv: $(addprefix aux/, $(addsuffix .why3.aux, $(WHY3_FILE)))
@echo "Generating Why-3 driver"
@echo "(* generated automatically at compilation time *)" | cat - $^ > $@
aux/%.why3.aux: %.why %.why_theory Makefile aux
@echo "Auxiliary Why-3 files for $*"
@rm -f $@.tmp;
@for theory in $$(cat $*.why_theory); do \
NAMEUPPER=`ocaml upper.ml "$*"`; \
echo 'theory $*.'"$$theory"' meta "realized_theory" "$*.'"$$theory"'", "'"$$NAMEUPPER"'.'"$$theory"'" end' >> $@.tmp;\
done;
@mv $@.tmp $@
stamp/why3realization.stamp:\
$(addprefix stamp/, $(addsuffix .why3.stamp, $(WHY3_FILE)))
@touch $@
stamp/%.why3.stamp: %.why %.why_theory Makefile $(WHY3_LIB) stamp/realizationtools.stamp why3-realize.drv why3.drv
@echo "Realizing Why-3 Theory $*"
@for theory in $$(cat $*.why_theory); do \
$(WHY3_REALIZE) -D why3-realize.drv -T $*.$$theory -o $(REALIZATION_DIR)/why3 2> logs/$$theory.why3.err.tmp;\
why3 prove --type-only -L $(REALIZATION_DIR)/why3 $(REALIZATION_DIR)/why3/$$theory.why 2> logs/$$theory.why3.check.err.tmp;\
sed -e 's:^File ".*/wp/share/:File "WP-SHARE/:' logs/$$theory.why3.err.tmp > logs/$$theory.why3.err;\
sed -e 's:^File ".*/wp/share/:File "WP-SHARE/:' logs/$$theory.why3.check.err.tmp > logs/$$theory.why3.check.err;\
rm -f logs/$$theory.why3.err.tmp logs/$$theory.why3.check.err.tmp;\
done;
@touch $@
COQLIBS:= Qed Qedlib Bits Zbits Cint Cbits Memory Cmath Cfloat Vlist ArcTrigo ExpLog
COQDEP:= $(addsuffix .coqdep, $(COQLIBS))
COQDEP_STAMPS:= $(addprefix stamp/, $(COQDEP))
COQVO:= $(addsuffix .vo, $(COQLIBS))
COQINCLUDE= -R $(WHY3_LIB) Why3
%.vo: %.v
coqc -w none $(COQINCLUDE) $<
stamp/%.coqdep: %.v stamp
@coqdep $(COQINCLUDE) $< > $@ 2>/dev/null
@(cmp $@ $(subst stamp/,,$@) 2>/dev/null) \
|| (cp $@ $(subst stamp/,,$@) \
&& echo "Updating $(subst stamp/,,$@)")
stamp/coqdep.stamp: Makefile $(COQDEP_STAMPS)
@echo "Coq dependencies updated"
@touch $@
# a non-empty rule is needed for the first make
%.coqdep: stamp/%.coqdep
@true
sinclude $(COQDEP)
stamp/%.coqdep: stamp
stamp/compile.stamp: Makefile stamp/coqdep.stamp $(COQVO)
@echo "Coq compilation done"
@touch $@
.PHONY: compile
compile: stamp/compile.stamp
.PHONY: clean
clean:
@echo "Cleaning"
@rm -f $(COQVO)
@rm -f filter_axioms.cm* filter_axioms.o
@rm -f alt_ergo_realize.cm* alt_ergo_realize.o
@rm -f why3printer_realize.cm* why3printer_realize.o
@rm -f *.stamp stamp/*
@rm -f *.aux aux/*
@rm -f *.glob *.coqdep
.PHONY: %.coqide
%.coqide: %.v
coqide $(COQINCLUDE) $<
# --------------------------------------------------------------------------
# --- Coq Documentation ---
# --------------------------------------------------------------------------
COQDOC=../doc
COQHTML=../html
COQSRC= $(addsuffix .v,$(COQLIBS))
COQGLOB= $(addsuffix .glob,$(COQLIBS))
html: compile $(COQDOC)/coq2html
@mkdir -p $(COQHTML)
@rm -fr $(COQHTML)/*
@cp $(COQDOC)/frama-c.png $(COQHTML)/
@cp $(COQDOC)/coq2html.css $(COQDOC)/coq2html.js $(COQDOC)/index.png $(COQHTML)/
@cat $(COQDOC)/head.html >> $(COQHTML)/index.html
@for a in $(COQLIBS) ; \
do echo " <li> Module <a href=\"$$a.html\">$$a</a></li>" >> $(COQHTML)/index.html ; \
done ;
@cat $(COQDOC)/foot.html >> $(COQHTML)/index.html
$(COQDOC)/coq2html -o $(COQHTML)/%.html $(COQGLOB) $(COQSRC)
zip ../wpcoqdoc.zip $(COQHTML)/*
latex: $(COQDOC)/coq2latex
@mkdir -p latex
@rm -fr latex/*
coqdoc --latex -d latex --body-only -l $(COQSRC)
$(COQDOC)/coq2html: $(COQDOC)/coq2html.ml
ocamlfind ocamlopt -o $@ str.cmxa $<
$(COQDOC)/coq2html.ml: $(COQDOC)/coq2html.mll
ocamllex $<
$(COQDOC)/coq2latex: $(COQDOC)/coq2latex.ml
ocamlfind ocamlopt -o $@ str.cmxa $<
$(COQDOC)/coq2latex.ml: $(COQDOC)/coq2latex.mll
ocamllex $<
##### Generation of configuration file for why3 #####
local_why3.conf: Makefile
@echo Generation of a local extra-conf for why3
@printf "[prover_modifiers]\n" > $@
@printf "name=\"Coq\"\n" >> $@
@printf "option=\"-R $(PWD)/WP FramaCwp\"\n" >> $@
@printf "driver=\"$(PWD)/coq.drv\"\n" >> $@
@printf "\n" >> $@
@printf "[editor_modifiers coqide]\n" >> $@
@printf "option=\"-R $(PWD)/WP FramaCwp\"\n" >> $@
@printf "\n" >> $@
@printf "[editor_modifiers proofgeneral-coq]\n" >> $@
@printf "option=\"--eval \\\\\"(setq coq-load-path (cons '(\\\\\\\\\\\\\"$(PWD)\\\\\\\\\\\\\" \\\\\\\\\\\\\"FramaCwp\\\\\\\\\\\\\") coq-load-path))\\\\\"\"\n" >> $@
##### Test local configuration #####
TEST=import
TEST_TARGET:=$(addprefix tests/, $(addsuffix .run, $(TEST)))
tests: $(TEST_TARGET)
tests/%.run: tests/%.why local_why3.conf Makefile
why3 replay --extra-config local_why3.conf --extra-config realization.conf $<
tests/%.why3ide: tests/%.why local_why3.conf
why3 ide --extra-config local_why3.conf --extra-config realization.conf $<
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
(* This file is generated by Why3's Coq-realize driver *)
(* Beware! Only edit allowed sections below *)
Require Import BuiltIn.
Require Reals.R_sqrt.
Require BuiltIn.
Require real.Real.
Require real.RealInfix.
Require real.Square.
(* Why3 goal *)
Lemma sqrt_lin1 : forall (x:R), (1%R < x)%R -> ((Reals.R_sqrt.sqrt x) < x)%R.
Proof.
intros x h1.
refine (Reals.R_sqrt.sqrt_less _ _ h1).
apply (Rle_trans 0 1 x Rle_0_1)%R.
exact (Rlt_le _ _ h1).
Qed.
(* Why3 goal *)
Lemma sqrt_lin0 : forall (x:R), ((0%R < x)%R /\ (x < 1%R)%R) ->
(x < (Reals.R_sqrt.sqrt x))%R.
Proof.
intros x (h1,h2).
exact (Reals.R_sqrt.sqrt_more x h1 h2).
Qed.
(* Why3 goal *)
Lemma sqrt_0 : ((Reals.R_sqrt.sqrt 0%R) = 0%R).
Proof.
exact Reals.R_sqrt.sqrt_0.
Qed.
(* Why3 goal *)
Lemma sqrt_1 : ((Reals.R_sqrt.sqrt 1%R) = 1%R).
Proof.
exact Reals.R_sqrt.sqrt_1.
Qed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment