Commit 739714d4 authored by MARCHE Claude's avatar MARCHE Claude
Browse files

Experiments with Alt-Ergo models

parent 0fb98676
(*
DONE alt-ergo devrait tenir que de certains labels, i.e.
pour les termes et les propositions, un label qui matche "model:.*", et
pour les variables "model:[0-9]+"
TODO: modele donné apres timeout
*)
module M1
use import int.Int
let f (x "0":int) : int =
{ }
let f (x "model:0":int) : int =
{ }
if ("model:cond" x >= 42) then x + 3 else 0
{ "model:post" result <= 50 }
let f_no_lab (x:int) : int =
{ }
if x >= 42 then x + 3 else 0
{ result <= 50 }
use import module ref.Ref
let g (x "0": ref int) : int =
{ }
let g (x "model:0": ref int) : int =
{ }
x := !x + 1;
if !x >= 42 then !x + 3 else 0
if ("model:cond" !x >= 42) then !x + 3 else 0
{ "model:post" result <= 50 }
let g_no_label (x : ref int) : int =
{ }
x := !x + 1;
if (!x >= 42) then !x + 3 else 0
{ result <= 50 }
end
(*
Local Variables:
compile-command: "../../bin/why3ide alt-ergo-models.mlw"
End:
*)
theory T1
theory T
use import int.Int
goal G : forall x "1":int. ("cond" x >= 42) -> x + 3 <= 50
goal g_no_lab : forall x:int. x >= 42 -> x + 3 <= 50
goal g_lab0 : forall x "model:0":int. ("model:cond" x >= 42) ->
("model:concl" x + 3 <= 50)
goal g_lab1 : forall x "model:1":int. ("model:cond" x >= 42) ->
("model:concl" x + 3 <= 50)
constant x : int
goal g2_lab : forall y "model:0":int. ("model:concl" x >= y)
end
theory T2
theory ModelInt
use import int.Int
use import int.Int
constant x : int
goal test0 : forall x "model:0":int. not (0 < x < 1)
goal test1 : forall x "model:0":int. not (0 <= x <= 1)
use import int.EuclideanDivision
goal test2 : forall x "model:0":int. div x x = 1
goal test_overflow:
forall x "model:0" y "model:0" : int.
0 <= x <= 65535 /\ 0 <= y <= 65535 -> 0 <= x + y <= 65535
goal test_overflow2:
forall x "model:0" y "model:0" : int.
-2 <= x <= 65535 /\ -2 <= y <= 65535 -> -2 <= x + y <= 65535
predicate is_int16 (x:int) = -65536 <= x <= 65535
goal test_overflow_int16:
forall x "model:0" y "model:0" : int.
is_int16 x /\ is_int16 y -> is_int16 (x + y)
goal test_overflow_int16_alt:
forall x "model:0" y "model:0" : int.
-65536 <= x <= 65535 /\ -65536 <= y <= 65535 -> -65536 <= x+y <= 65535
goal g : forall y:int. x >= y
goal test_overflow_int16_bis:
forall x "model:0" y "model:0" : int.
is_int16 x /\ is_int16 y /\ 0 <= x <= y -> is_int16 (x + y)
predicate is_int32 (x:int) = -2147483648 <= x <= 2147483647
goal test_overflow_int32:
forall x "model:0" y "model:0" : int.
is_int32 x /\ is_int32 y -> is_int32 (x + y)
goal test_overflow_int32_bis:
forall x "model:0" y "model:0" : int.
is_int32 x /\ is_int32 y /\ 0 <= x <= y -> is_int32 (x + y)
end
theory ModelReal
use import real.Real
goal test1 : forall x "model:0":real. not (0.0 < x < 1.0)
goal test2 : forall x "model:0":real. x/x=1.0
end
theory ModelArray
use import map.Map
goal t1 : forall t "model:0" :map int int, i "model:0" : int.
get (set t 0 42) i = get t i
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE why3session SYSTEM "/home/marche/why3/share/why3session.dtd">
<!DOCTYPE why3session SYSTEM "/usr/local/share/why3/why3session.dtd">
<why3session
name="tests-provers/alt-ergo-models/why3session.xml">
name="alt-ergo-models/why3session.xml">
<prover
id="0"
name="Alt-Ergo"
......@@ -12,14 +12,14 @@
expanded="true">
<theory
name="WP M1"
locfile="tests-provers/alt-ergo-models/../alt-ergo-models.mlw"
loclnum="2" loccnumb="7" loccnume="9"
locfile="alt-ergo-models/../alt-ergo-models.mlw"
loclnum="12" loccnumb="7" loccnume="9"
verified="false"
expanded="true">
<goal
name="WP_parameter f"
locfile="tests-provers/alt-ergo-models/../alt-ergo-models.mlw"
loclnum="6" loccnumb="6" loccnume="7"
locfile="alt-ergo-models/../alt-ergo-models.mlw"
loclnum="16" loccnumb="6" loccnume="7"
expl="normal postcondition"
sum="a0d81048eafffca9c2034507529acd5c"
proved="false"
......@@ -33,13 +33,33 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.00"/>
<result status="unknown" time="0.02"/>
</proof>
</goal>
<goal
name="WP_parameter f_no_lab"
locfile="alt-ergo-models/../alt-ergo-models.mlw"
loclnum="21" loccnumb="6" loccnume="14"
expl="normal postcondition"
sum="f840017f45e1c7b3f0532b46b9c8d8a6"
proved="false"
expanded="true"
shape="ainfix &lt;=iainfix &gt;=V0c42ainfix +V0c3c0c50F">
<label
name="expl:parameter f_no_lab"/>
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.01"/>
</proof>
</goal>
<goal
name="WP_parameter g"
locfile="tests-provers/alt-ergo-models/../alt-ergo-models.mlw"
loclnum="13" loccnumb="6" loccnume="7"
locfile="alt-ergo-models/../alt-ergo-models.mlw"
loclnum="28" loccnumb="6" loccnume="7"
expl="parameter g"
sum="044c6d04c9bbd10bd6ec37d09f41f130"
proved="false"
......@@ -51,9 +71,31 @@
prover="0"
timelimit="5"
memlimit="1000"
edited="altmnergomnmodels-WP_M1-WP_parameter_g_1.why"
obsolete="false"
archived="false">
<result status="unknown" time="0.00"/>
<result status="unknown" time="0.01"/>
</proof>
</goal>
<goal
name="WP_parameter g_no_label"
locfile="alt-ergo-models/../alt-ergo-models.mlw"
loclnum="34" loccnumb="6" loccnume="16"
expl="parameter g_no_label"
sum="907795ff697c8edc23616ffdf2169e79"
proved="false"
expanded="true"
shape="iainfix &gt;=V1c42ainfix &lt;=ainfix +V1c3c50ainfix &lt;=c0c50Iainfix =V1ainfix +V0c1FF">
<label
name="expl:parameter g_no_label"/>
<proof
prover="0"
timelimit="5"
memlimit="1000"
edited="altmnergomnmodels-WP_M1-WP_parameter_g_no_label_1.why"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
</theory>
......@@ -63,16 +105,50 @@
verified="false"
expanded="true">
<theory
name="T1"
locfile="tests-provers/alt-ergo-models/../alt-ergo-models.why"
loclnum="2" loccnumb="7" loccnume="9"
name="T"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="2" loccnumb="7" loccnume="8"
verified="false"
expanded="true">
<goal
name="G"
locfile="tests-provers/alt-ergo-models/../alt-ergo-models.why"
loclnum="6" loccnumb="7" loccnume="8"
sum="0a4bc6d339e5bafbbd8680953a519128"
name="g_no_lab"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="6" loccnumb="7" loccnume="15"
sum="5db0341ac76573a664138d873f2ee0cc"
proved="false"
expanded="true"
shape="ainfix &lt;=ainfix +V0c3c50Iainfix &gt;=V0c42F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
<goal
name="g_lab0"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="8" loccnumb="7" loccnume="13"
sum="8e9074693748b23939e9490537b3a1de"
proved="false"
expanded="true"
shape="ainfix &lt;=ainfix +V0c3c50Iainfix &gt;=V0c42F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.01"/>
</proof>
</goal>
<goal
name="g_lab1"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="11" loccnumb="7" loccnume="13"
sum="733127c7327e72652e8d2ad71f0740cb"
proved="false"
expanded="true"
shape="ainfix &lt;=ainfix +V0c3c50Iainfix &gt;=V0c42F">
......@@ -82,31 +158,266 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.00"/>
<result status="unknown" time="0.01"/>
</proof>
</goal>
<goal
name="g2_lab"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="16" loccnumb="7" loccnume="13"
sum="37fc380c22d847902ef0134ccfd8f656"
proved="false"
expanded="true"
shape="ainfix &gt;=axV0F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.01"/>
</proof>
</goal>
</theory>
<theory
name="T2"
locfile="tests-provers/alt-ergo-models/../alt-ergo-models.why"
loclnum="10" loccnumb="7" loccnume="9"
name="ModelInt"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="21" loccnumb="7" loccnume="15"
verified="false"
expanded="true">
<goal
name="g"
locfile="tests-provers/alt-ergo-models/../alt-ergo-models.why"
loclnum="16" loccnumb="7" loccnume="8"
sum="48acce19ca5523eaf2c70c5691e994a9"
name="test0"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="25" loccnumb="5" loccnume="10"
sum="506786d5b76e4f02e4466d0cc12354c1"
proved="true"
expanded="true"
shape="ainfix &lt;V0c1Aainfix &lt;c0V0NF">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.00"/>
</proof>
</goal>
<goal
name="test1"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="27" loccnumb="5" loccnume="10"
sum="53464dc8479872702159c917f9150dcb"
proved="false"
expanded="true"
shape="ainfix &gt;=axV0F">
shape="ainfix &lt;=V0c1Aainfix &lt;=c0V0NF">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.01"/>
</proof>
</goal>
<goal
name="test2"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="31" loccnumb="5" loccnume="10"
sum="8f22d32b4d3abb09a850b419749f7c47"
proved="false"
expanded="true"
shape="ainfix =adivV0V0c1F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.01"/>
</proof>
</goal>
<goal
name="test_overflow"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="33" loccnumb="5" loccnume="18"
sum="8d26f2c25b69efd849617e699a7319ef"
proved="false"
expanded="true"
shape="ainfix &lt;=ainfix +V0V1c65535Aainfix &lt;=c0ainfix +V0V1Iainfix &lt;=V1c65535Aainfix &lt;=c0V1Aainfix &lt;=V0c65535Aainfix &lt;=c0V0F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
<goal
name="test_overflow2"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="37" loccnumb="5" loccnume="19"
sum="0f56ea71245d1f6a62700fa6bce1db36"
proved="false"
expanded="true"
shape="ainfix &lt;=ainfix +V0V1c65535Aainfix &lt;=aprefix -c2ainfix +V0V1Iainfix &lt;=V1c65535Aainfix &lt;=aprefix -c2V1Aainfix &lt;=V0c65535Aainfix &lt;=aprefix -c2V0F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
<goal
name="test_overflow_int16"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="43" loccnumb="5" loccnume="24"
sum="927286ccd54988f36d1dab791dafd515"
proved="false"
expanded="true"
shape="ais_int16ainfix +V0V1Iais_int16V1Aais_int16V0F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
<goal
name="test_overflow_int16_alt"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="47" loccnumb="5" loccnume="28"
sum="bef9b5b701386cd82fede1553fe0c77a"
proved="false"
expanded="true"
shape="ainfix &lt;=ainfix +V0V1c65535Aainfix &lt;=aprefix -c65536ainfix +V0V1Iainfix &lt;=V1c65535Aainfix &lt;=aprefix -c65536V1Aainfix &lt;=V0c65535Aainfix &lt;=aprefix -c65536V0F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
<goal
name="test_overflow_int16_bis"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="51" loccnumb="5" loccnume="28"
sum="ca168cfbbc15d3fca583ea1ec2e44550"
proved="false"
expanded="true"
shape="ais_int16ainfix +V0V1Iainfix &lt;=V0V1Aainfix &lt;=c0V0Aais_int16V1Aais_int16V0F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
<goal
name="test_overflow_int32"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="57" loccnumb="5" loccnume="24"
sum="fa55a6e7efaa43cdd22cabdf66f49443"
proved="false"
expanded="true"
shape="ais_int32ainfix +V0V1Iais_int32V1Aais_int32V0F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
<goal
name="test_overflow_int32_bis"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="61" loccnumb="5" loccnume="28"
sum="2f6bae3db74a9de9ef6b4d0ddebf25ee"
proved="false"
expanded="true"
shape="ais_int32ainfix +V0V1Iainfix &lt;=V0V1Aainfix &lt;=c0V0Aais_int32V1Aais_int32V0F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
</theory>
<theory
name="ModelReal"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="67" loccnumb="7" loccnume="16"
verified="false"
expanded="true">
<goal
name="test1"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="71" loccnumb="5" loccnume="10"
sum="eca61bb8da58aab53b390824efa6096c"
proved="false"
expanded="true"
shape="ainfix &lt;V0c1.0Aainfix &lt;c0.0V0NF">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.02"/>
</proof>
</goal>
<goal
name="test2"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="73" loccnumb="5" loccnume="10"
sum="1db3567ffd1099c47db86de68de8b9ce"
proved="false"
expanded="true"
shape="ainfix =ainfix /V0V0c1.0F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.03"/>
</proof>
</goal>
</theory>
<theory
name="ModelArray"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="77" loccnumb="7" loccnume="17"
verified="false"
expanded="true">
<goal
name="t1"
locfile="alt-ergo-models/../alt-ergo-models.why"
loclnum="81" loccnumb="5" loccnume="7"
sum="80ac2844addd3bc5d617d1bfe18cfa0f"
proved="false"
expanded="true"
shape="ainfix =agetasetV0c0c42V1agetV0V1F">
<proof
prover="0"
timelimit="5"
memlimit="1000"
obsolete="false"
archived="false">
<result status="unknown" time="0.00"/>
<result status="unknown" time="0.02"/>
</proof>
</goal>
</theory>
......
......@@ -233,11 +233,11 @@ let load_config config original_config =
*)
let debug_save_config n c =
let coq = { prover_name = "Coq" ; prover_version = "8.3pl3";
let coq = { prover_name = "Coq" ; prover_version = "8.3pl3";
prover_altern = "" } in
let p = Mprover.find coq (get_provers c) in
let time = Whyconf.timelimit (Whyconf.get_main c) in
Format.eprintf "[debug] save_config %d: timelimit=%d ; editor for Coq=%s@."
Format.eprintf "[debug] save_config %d: timelimit=%d ; editor for Coq=%s@."
n time p.editor
let save_config t =
......@@ -730,7 +730,7 @@ let editors_page c (notebook:GPack.notebook) =
let editors = Whyconf.get_editors c.config in
let _,strings,indexes,map =
Meditor.fold
(fun k data (i,str,ind,map) ->
(fun k data (i,str,ind,map) ->
let n = data.editor_name in
(i+1, n::str, Meditor.add k i ind, Meditor.add n k map))
editors (2, [], Meditor.empty, Meditor.empty)
......@@ -754,11 +754,11 @@ let editors_page c (notebook:GPack.notebook) =
match combo#active_iter with
| None -> ()
| Some row ->
let data =
let data =
match combo#model#get ~row ~column with
| "(default)" -> ""
| s ->
try Meditor.find s map
| s ->
try Meditor.find s map
with Not_found -> assert false
in
(* Format.eprintf "prover %a : selected editor '%s'@." *)
......@@ -1004,7 +1004,8 @@ let replace_prover c to_be_removed to_be_copied =
res
*)
let read_config conf_file extra_files = read_config conf_file extra_files; init ()
let read_config conf_file extra_files =