Commit 093df864 authored by Tuyen Nguyen's avatar Tuyen Nguyen
parents 199df4f4 1a5a0226
......@@ -131,7 +131,7 @@ LIB_TRANSFORM = simplify_recursive_definition simplify_formula \
encoding_explicit encoding_guard encoding_sort \
encoding_instantiate simplify_array filter_trigger \
introduction abstraction close_epsilon lift_epsilon \
eval_match instantiate_predicate
eval_match instantiate_predicate smoke_detector
LIB_PRINTER = print_number alt_ergo why3printer smtv1 smtv2 \
coq tptp simplify gappa cvc3 yices
......
......@@ -487,9 +487,12 @@ not and you have to use the IDE to update it.
\begin{itemize}
\item The exit code is 0 if no difference was detected, 1 if there
was. Other exit codes mean some failure in running the replay.
\item option \texttt{-s}: suppresses the output of the final tree view
\item option \texttt{-I \textsl{<path>}}: add \textsl{<path>} to the loadpath
\item option \texttt{-force}: force writing a new session file even if some proofs did not replay correctly.
\item option \texttt{-s}: suppresses the output of the final tree view.
\item option \texttt{-I \textsl{<path>}}: add \textsl{<path>} to the loadpath.
\item option \texttt{-force}: force writing a new session file even if
some proofs did not replay correctly.
\item option \texttt{-smoke-detector \{none|top|deep\}} try to detect
if the context is self-contradicting.
\item option \texttt{-latex \textsl{<dir>}}: produce a summary of
the replay under the form of a tabular environment in LaTeX, one
tabular for each theory, one per file, in directory \texttt{\textsl{<dir>}}.
......@@ -499,6 +502,46 @@ not and you have to use the IDE to update it.
% the replay in HTML syntax.
\end{itemize}
\paragraph{Smoke Detector}
The smoke detector try to detect if the context is self-contradicting
and, thus, that anything can be proved in this context. The smoke
detector can't be run on outdated session and doesn't modify the session.
It has three possible configurations :
\begin{itemize}
\item \texttt{none} : don't run the smoke detector
\item \texttt{top} : The negation of each proved goals
tries to be proved with the same timeout and the same prover which
prove the goal.
\begin{verbatim}
[ ... ]
Goal G : forall x:int. q x -> (p1 x \/ p2 x)
\end{verbatim}
becomes
\begin{verbatim}
[ ... ]
Goal G : ~ (forall x:int. q x -> (p1 x \/ p2 x))
\end{verbatim}
\item \texttt{deep} : The same technique as \texttt{top} but the
negation is pushed under the universal quantification (without
changing them) and under the implication. The previous example becomes
\begin{verbatim}
[ ... ]
Goal G : forall x:int. q x /\ ~ (p1 x \/ p2 x)
\end{verbatim}
\end{itemize}
The name of the goals which triggered the smoke detector are printed :
\begin{verbatim}
goal 'G', prover 'Alt-Ergo 0.93.1': Smoke detected!!!
\end{verbatim}
Moreover \texttt{Smoke detected} (exit code 1) is printed at the end if the smoke
detector has been trigged, or \texttt{No smoke detected} (exit code 0)
otherwise.
\paragraph{Customizing LaTeX output}
The generated LaTeX files contain some macros that must be defined
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE why3session SYSTEM "why3session.dtd">
<why3session
name="programs/fact/why3session.xml">
name="examples/programs/fact/why3session.xml">
<prover
id="alt-ergo"
name="Alt-Ergo"
......@@ -9,43 +9,19 @@
<prover
id="coq"
name="Coq"
version="8.3pl2"/>
version="8.2pl2"/>
<prover
id="cvc3"
name="CVC3"
version="2.2"/>
<prover
id="eprover"
name="Eprover"
version="1.4 Namring"/>
<prover
id="gappa"
name="Gappa"
version="0.15.1"/>
<prover
id="simplify"
name="Simplify"
version="1.5.4"/>
<prover
id="spass"
name="Spass"
version="3.7"/>
<prover
id="vampire"
name="Vampire"
version="0.6"/>
<prover
id="verit"
name="veriT"
version="dev"/>
<prover
id="yices"
name="Yices"
version="1.0.25"/>
<prover
id="z3"
name="Z3"
version="2.19"/>
name="Z3 smtv1"
version="2.2"/>
<file
name="../fact.mlw"
verified="true"
......
......@@ -123,12 +123,41 @@ version_regexp = "Version: \\([^ \n\r]+\\)"
command = "@LOCALBIN@why3-cpulimit %t %m -s %e %f"
driver = "drivers/verit.drv"
[ATP z3]
name = "Z3"
exec = "z3"
version_switch = "-version"
version_regexp = "Z3 version \\([^ \n\r]+\\)"
version_ok = "3.2"
version_old = "3.1"
version_old = "3.0"
version_bad = "2.19"
version_bad = "2.18"
version_bad = "2.17"
version_bad = "2.16"
version_bad = "2.2"
version_bad = "2.1"
version_bad = "1.3"
driver = "drivers/z3.drv"
command = "@LOCALBIN@why3-cpulimit %t %m -s %e -smtc \
-rs:42 \
PHASE_SELECTION=0 \
RESTART_STRATEGY=0 \
RESTART_FACTOR=1.5 \
QI_EAGER_THRESHOLD=100 \
ARITH_RANDOM_INITIAL_VALUE=true \
CASE_SPLIT=3 \
DELAY_UNITS=true \
DELAY_UNITS_THRESHOLD=16 \
%f"
[ATP z3]
name = "Z3"
exec = "z3"
version_switch = "-version"
version_regexp = "Z3 version \\([^ \n\r]+\\)"
version_ok = "2.19"
version_old = "2.19"
version_old = "2.18"
version_old = "2.17"
version_old = "2.16"
......
......@@ -155,14 +155,6 @@ let load_config config =
env = env
}
let read_config () =
try
let config = Whyconf.read_config None in
load_config config
with e when not (Debug.test_flag Debug.stack_trace) ->
eprintf "@.%a@." Exn_printer.exn_printer e;
exit 1
let save_config t =
let _save_prover _ pr acc =
Mstr.add pr.Session.prover_id
......@@ -200,15 +192,29 @@ let save_config t =
*)
save_config config
let config =
eprintf "[Info] reading IDE config file...@?";
let c = read_config () in
eprintf " done.@.";
c
let read_config conf_file =
try
let config = Whyconf.read_config conf_file in
load_config config
with e when not (Debug.test_flag Debug.stack_trace) ->
eprintf "@.%a@." Exn_printer.exn_printer e;
exit 1
let config,read_config =
let config = ref None in
(fun () ->
match !config with
| None -> invalid_arg "configuration not yet loaded"
| Some conf -> conf),
(fun conf_file ->
eprintf "[Info] reading IDE config file...@?";
let c = read_config conf_file in
eprintf " done.@.";
config := Some c)
let save_config () = save_config config
let save_config () = save_config (config ())
let get_main () = (get_main config.config)
let get_main () = (get_main (config ()).config)
(*
......@@ -254,7 +260,7 @@ let iconname_reload = "movefile32"
let iconname_remove = "deletefile32"
let iconname_cleaning = "trashb32"
let image_default = ref (image ~size:20 iconname_default)
let image_default = ref (GdkPixbuf.create ~width:1 ~height:1 ()) (** dumb pixbuf *)
let image_undone = ref !image_default
let image_scheduled = ref !image_default
let image_running = ref !image_default
......@@ -312,7 +318,7 @@ let resize_images size =
image_cleaning := image ~size iconname_cleaning;
()
let () =
let init () =
eprintf "[Info] reading icons...@?";
why_icon := image "logo-why";
resize_images 20;
......@@ -563,12 +569,15 @@ let run_auto_detection gconfig =
gconfig.config <- config;
let _provers = get_provers config in
(* TODO: store the result differently
gconfig.provers <- Mstr.fold (Session.get_prover_data gconfig.env) provers Mstr.empty
gconfig.provers <- Mstr.fold (Session.get_prover_data gconfig.env) provers
Mstr.empty
*)
()
*)
let () = eprintf "[Info] end of configuration initialization@."
(* let () = eprintf "[Info] end of configuration initialization@." *)
let read_config conf_file = read_config conf_file; init ()
(*
Local Variables:
......
......@@ -40,9 +40,14 @@ type t =
mutable config : Whyconf.config;
}
val read_config : string option -> unit
(** None use the default config *)
val save_config : unit -> unit
val config : t
val config : unit -> t
(** [config ()] raise [invalid_arg "configuration not yet loaded"]
if load_config is not called *)
val get_main : unit -> Whyconf.main
......
......@@ -37,11 +37,22 @@ open Gconfig
let includes = ref []
let file = ref None
let opt_version = ref false
let opt_config = ref None
let spec = Arg.align [
("-I",
("-L",
Arg.String (fun s -> includes := s :: !includes),
"<s> add s to loadpath") ;
("--library",
Arg.String (fun s -> includes := s :: !includes),
" same as -L") ;
("-I",
Arg.String (fun s -> includes := s :: !includes),
" same as -L (obsolete)") ;
"-C", Arg.String (fun s -> opt_config := Some s),
"<file> Read configuration from <file>";
"--config", Arg.String (fun s -> opt_config := Some s),
" same as -C";
(*
("-f",
Arg.String (fun s -> input_files := s :: !input_files),
......@@ -73,6 +84,8 @@ let () =
exit 0
end
let () = Gconfig.read_config !opt_config
let fname = match !file with
| None ->
Arg.usage spec usage_str;
......@@ -114,7 +127,7 @@ let source_text fname =
(********************************)
let gconfig =
let c = Gconfig.config in
let c = Gconfig.config () in
let loadpath = (Whyconf.loadpath (get_main ())) @ List.rev !includes in
c.env <- Env.create_env loadpath;
(*
......@@ -825,7 +838,7 @@ let exit_function ?(destroy=false) () =
let ret = Sys.command "xmllint --noout --dtdvalid share/why3session.dtd essai.xml" in
if ret = 0 then eprintf "DTD validation succeeded, good!@.";
*)
match config.saving_policy with
match (Gconfig.config ()).saving_policy with
| 0 -> save_session (); GMain.quit ()
| 1 -> GMain.quit ()
| 2 ->
......@@ -1530,7 +1543,7 @@ let select_row r =
let a = get_any_from_row_reference r in
match a with
| M.Goal g ->
if config.intro_premises then
if (Gconfig.config ()).intro_premises then
let callback = function
| [t] -> display_task g t
| _ -> assert false
......
This diff is collapsed.
This diff is collapsed.
......@@ -64,6 +64,14 @@ type proof_attempt_status = private
| InternalFailure of exn (** external proof aborted by internal error *)
| Unedited (** interactive prover yet no proof script *)
(** {2 Smoke detector} *)
type smoke_detector =
| SD_None (** No smoke detector *)
| SD_Top (** Negation added at the top of the goals *)
| SD_Deep
(** Negation added under implication and universal quantification *)
(** {2 Observers signature} *)
module type OBSERVER = sig
......@@ -304,6 +312,9 @@ module Make(O: OBSERVER) : sig
(** [clean a] removes failed attempts below [a] where
there at least one successful attempt or transformation *)
val smoke_detector : smoke_detector ref
(** Define if the smoke detector is used *)
end
......
(**************************************************************************)
(* *)
(* Copyright (C) 2010-2011 *)
(* François Bobot *)
(* Jean-Christophe Filliâtre *)
(* Claude Marché *)
(* Andrei Paskevich *)
(* *)
(* This software is free software; you can redistribute it and/or *)
(* modify it under the terms of the GNU Library General Public *)
(* License version 2.1, with the special exception on linking *)
(* described in file LICENSE. *)
(* *)
(* This software 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. *)
(* *)
(**************************************************************************)
(* Smoke detector try to find if the axiomatisation is self-contradicting.
The second smoke detector add the negation under the implication and
universal quantification (replace implication by conjunction).
*)
open Ident
open Term
open Decl
open Task
let create app =
Trans.goal (fun pr t -> [create_prop_decl Pgoal pr (app t)])
let top = create t_not
let rec neg f = match f.t_node with
| Tbinop (Timplies,f1,f2) -> t_and f1 (neg f2)
| Tquant (Tforall,fq) ->
let vsl,_trl,f = t_open_quant fq in
t_forall_close vsl _trl (neg f)
| Tlet (t,fb) ->
let vs,f = t_open_bound fb in
t_let_close vs t (neg f)
| _ -> t_not f
let deep = create neg
let () = List.iter (fun (name,trans) -> Trans.register_transform name trans)
["smoke_detector_top",top;
"smoke_detector_deep",deep]
(*
Local Variables:
compile-command: "unset LANG; make -C ../.. byte"
End:
*)
(**************************************************************************)
(* *)
(* Copyright (C) 2010-2011 *)
(* François Bobot *)
(* Jean-Christophe Filliâtre *)
(* Claude Marché *)
(* Andrei Paskevich *)
(* *)
(* This software is free software; you can redistribute it and/or *)
(* modify it under the terms of the GNU Library General Public *)
(* License version 2.1, with the special exception on linking *)
(* described in file LICENSE. *)
(* *)
(* This software 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. *)
(* *)
(**************************************************************************)
val top : Task.task Trans.trans
val deep : Task.task Trans.trans
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