Commit dd57b9de authored by Guillaume Melquiond's avatar Guillaume Melquiond

Merge branch 'new_ide'

parents b89ed0ef 25acc03a
module Soundness
use import int.Int
use HighOrd
function f0 (x y z:int) : int = x * y + z
predicate p (f:int -> int) =
f (-1) = 0 && forall n:int. f n = f 0 + (f 1 - f 0) * n
lemma A : forall y z:int. p (fun x -> f0 x y z) <-> y = z
meta rewrite lemma A
(* compute_specified should not solve this goal.
0 = 0 was added so that compute_specified progress on this goal even when
not unsound.
*)
lemma Fail : 0 = 0 /\ p (fun x -> f0 x x x)
lemma Absurd : false
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE why3session PUBLIC "-//Why3//proof session v5//EN"
"http://why3.lri.fr/why3session.dtd">
<why3session shape_version="4">
<prover id="0" name="CVC4" version="1.5" timelimit="5" steplimit="0" memlimit="1000"/>
<file name="../79_compute_unsound.mlw">
<theory name="Soundness" sum="aa1c41b51a76f536179c52b8dcf8a473">
<goal name="A" proved="true">
<proof prover="0"><result status="valid" time="0.17"/></proof>
</goal>
<goal name="Fail">
<transf name="compute_specified" >
<goal name="Fail.0">
</goal>
</transf>
</goal>
<goal name="Absurd" proved="true">
<proof prover="0"><result status="valid" time="0.02"/></proof>
</goal>
</theory>
</file>
</why3session>
......@@ -881,12 +881,10 @@ end
(* -- send the task -- *)
let task_of_id d id do_intros show_full_context loc =
let task,tables =
if do_intros then get_task d.cont.controller_session id
else
let task = get_raw_task d.cont.controller_session id in
let tables = Args_wrapper.build_naming_tables task in
task,tables
let task,tables = get_task d.cont.controller_session id in
let task =
if do_intros then task else
get_raw_task d.cont.controller_session id
in
(* This function also send source locations associated to the task *)
let loc_color_list = if loc then get_locations task else [] in
......@@ -924,7 +922,7 @@ end
Pp.string_of (Model_parser.print_model_human ?me_name_trans:None)
res.Call_provers.pr_model
in
result ^ "\n\n" ^ ce_result
result ^ "\n\n" ^ "Counterexample suggested by the prover:\n\n" ^ ce_result
| None -> "Result of the prover not available.\n"
in
P.notify (Task (nid, prover_text ^ prover_ce, list_loc))
......
......@@ -1090,6 +1090,8 @@ let load_theory session parent_name old_provers acc th =
List.iter2
(load_goal session old_provers (Theory mth))
th.Xml.elements goals;
let proved = bool_attribute "proved" th false in
Hid.add session.th_state thname proved;
mth::acc
| s ->
Warning.emit "[Warning] Session.load_theory: unexpected element '%s'@."
......
......@@ -208,7 +208,8 @@ let replace_subst lp lv f1 f2 withed_terms t =
begin
(* Catch any error from first_order_matching or with_terms. *)
match matching_with_terms ~trans_name:"rewrite" slv lv f1 t (Some withed_terms) with
| exception _ -> Term.t_map_fold
| exception _e ->
Term.t_map_fold
(fun is_replaced t -> replace is_replaced f1 f2 t)
is_replaced t
| subst_ty, subst ->
......@@ -224,7 +225,7 @@ let replace_subst lp lv f1 f2 withed_terms t =
let is_replaced, t =
t_map_fold (fun is_replaced t -> replace is_replaced f1 f2 t) None t in
match is_replaced with
| None -> raise (Arg_trans "matching/replace")
| None -> raise (Arg_trans "rewrite: no term matching the given pattern")
| Some(subst_ty,subst) ->
(List.map (t_ty_subst subst_ty subst) lp, t)
......
This diff is collapsed.
......@@ -202,7 +202,7 @@ let rec num_lines s acc tr =
(color_of_status ~dark:true) (th_proved s th)
name;
if th_proved s th then
fprintf fmt "fully verified in (TODO)%%.02f s"
fprintf fmt "fully verified" (*TODO in %%.02f s*)
else fprintf fmt "not fully verified";
fprintf fmt "</span></h2>@\n";
......
module Naming
use import int.Int
constant x : int
goal G : forall x:int. x >= 0 -> x = 0
end
module ApplyRewrite
use import int.Int
(* Use apply H require some cases of quantifications in first_order_matching *)
goal g: (forall y. exists x. x <= y /\ y = 0) -> forall x. exists y. y <= x /\ x = 0
function f int int : int
use HighOrd
axiom H: forall x. (\z: int. x + z) = f x
goal g1: (\toto. 42 + toto) = f 42
axiom Ha: forall x. (\z: int. x + z) 2 = 2
goal g3: (\toto. 42 + toto) 2 = 2
goal g2: (\y. y + y) = f 24
end
module A
use import int.Int
use HighOrd
function f int: int
axiom H: forall y. exists x. f x = x + y
goal g1: exists x. f x = x + 42
goal g: (\y. f y) 0 = 3
constant b: bool
axiom Ha: forall y. if b = true then let x = 3 in f x = x + y else false
goal ga: if b = true then let z = 3 in f z = z + 42 else false
goal gb: if b = true then let z = 453 in f z = z + 42 else false
end
module Soundness
use import int.Int
use HighOrd
function f0 (x y z:int) : int = x * y + z
predicate p (f:int -> int) =
f (-1) = 0 && forall n:int. f n = f 0 + (f 1 - f 0) * n
lemma A : forall y z:int. p (\x. f0 x y z) <-> y = z
meta rewrite prop A
lemma Fail : 0 = 0 /\ p (\x. f0 x x x)
lemma Absurd : false
end
module TestCEX
......
......@@ -10,11 +10,66 @@
<prover id="5" name="Eprover" version="2.0" timelimit="5" steplimit="0" memlimit="1000"/>
<prover id="6" name="Alt-Ergo" version="2.0.0" timelimit="5" steplimit="0" memlimit="1000"/>
<file name="../demo-itp.mlw">
<theory name="ApplyRewrite" proved="true" sum="06c28a672d2fbb0de6998078f2cfe895">
<goal name="g" proved="true">
<theory name="Naming" sum="887148d0be0266efa5001ad2fedbe72e">
<goal name="G">
</goal>
</theory>
<theory name="ApplyRewrite" sum="a5d903eba2570fb4645483c4ff500ebb">
<goal name="g1" proved="true">
<transf name="apply" proved="true" arg1="H">
</transf>
<transf name="rewrite" proved="true" arg1="H">
<goal name="g1.0" proved="true">
<transf name="compute_in_goal" proved="true" >
</transf>
</goal>
</transf>
</goal>
<goal name="g3" proved="true">
<transf name="apply" proved="true" arg1="Ha">
</transf>
</goal>
<goal name="g2">
<transf name="compute_specified" >
<goal name="g2.0">
</goal>
</transf>
</goal>
</theory>
<theory name="A" sum="1abc5293356c4003ce35806f735459dc">
<goal name="g1" proved="true">
<transf name="apply" proved="true" arg1="H">
</transf>
</goal>
<goal name="g">
</goal>
<goal name="ga" proved="true">
<transf name="apply" proved="true" arg1="Ha">
</transf>
</goal>
<goal name="gb">
</goal>
</theory>
<theory name="Soundness" sum="aa1c41b51a76f536179c52b8dcf8a473">
<goal name="A" proved="true">
<proof prover="2" timelimit="5"><result status="valid" time="0.24"/></proof>
</goal>
<goal name="Fail">
<transf name="assert" arg1="(forall y:int, z:int. y = z -&gt; p (\ x:int. f0 x y z))">
<goal name="Fail.0" proved="true">
<proof prover="2" timelimit="5"><result status="valid" time="0.21"/></proof>
</goal>
<goal name="Fail.1">
<transf name="compute_specified" >
<goal name="Fail.1.0">
</goal>
</transf>
</goal>
</transf>
</goal>
<goal name="Absurd" proved="true">
<proof prover="2" timelimit="5"><result status="valid" time="0.02"/></proof>
</goal>
</theory>
<theory name="TestCEX" sum="55ceea8b24a88c1829a53af2c814f1a6">
<goal name="g">
......
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