Commit 6b0839fa authored by MARCHE Claude's avatar MARCHE Claude

Continued proofs in bitvectors example. Only 3 basic lemmas on

pow2, div and mod missing
parent 773f4802
......@@ -345,9 +345,8 @@ theory BitVector
lemma nth_from_int2c_0:
forall i:int. size > i >= 0 -> nth (from_int2c 0) i = False
lemma nth_from_int2c_plus_pow2:
forall x k i:int. 0 <= k < i ->
forall x k i:int. 0 <= k < i /\ k < size-1 ->
nth (from_int2c (x+pow2 i)) k = nth (from_int2c x) k
end
......
......@@ -163,6 +163,15 @@ Axiom Div_pow2 : forall (x:Z) (i:Z), (((-(pow2 i))%Z <= x)%Z /\
(x < (-(pow2 (i - 1%Z)%Z))%Z)%Z) -> ((int.EuclideanDivision.div x
(pow2 (i - 1%Z)%Z)) = (-2%Z)%Z).
Axiom Mod_pow2 : forall (x:Z) (i:Z),
((int.EuclideanDivision.mod1 (x + (pow2 i))%Z
2%Z) = (int.EuclideanDivision.mod1 x 2%Z)).
Axiom Mod_pow2_gen : forall (x:Z) (i:Z) (k:Z), ((0%Z <= k)%Z /\ (k < i)%Z) ->
((int.EuclideanDivision.mod1 (int.EuclideanDivision.div (x + (pow2 i))%Z
(pow2 k)) 2%Z) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.div x
(pow2 k)) 2%Z)).
Parameter size: Z.
Axiom size_positive : (1%Z < size)%Z.
......@@ -338,31 +347,23 @@ Require Import Why3.
Ltac ae := why3 "alt-ergo" timelimit 3.
(* Why3 goal *)
Theorem nth_from_int2c_plus_pow2 : forall (x:Z) (k:Z) (i:Z), ((0%Z <= k)%Z /\
(k < i)%Z) -> ((nth (from_int2c (x + (pow2 i))%Z) k) = (nth (from_int2c x)
k)).
intros x k i (h1 & h2).
generalize i h1 h2.
pattern k; apply Z_lt_induction; auto.
clear k i h1 h2.
intros k Hind i Hk Hki.
assert (h: k = 0 \/ k > 0) by omega.
destruct h.
Theorem nth_from_int2c_plus_pow2 : forall (x:Z) (k:Z) (i:Z),
(((0%Z <= k)%Z /\ (k < i)%Z) /\ (k < (size - 1%Z)%Z)%Z) ->
((nth (from_int2c (x + (pow2 i))%Z) k) = (nth (from_int2c x) k)).
(*case k = 0*)
subst k.
assert (h: nth (from_int2c (x)) 0 = true
\/ nth (from_int2c (x)) 0 = false).
destruct (nth (from_int2c (x)) 0);auto.
intros x k i (h1 & h2).
assert (h: int.EuclideanDivision.mod1
(int.EuclideanDivision.div x (pow2 k)) 2 = 0 \/
int.EuclideanDivision.mod1
(int.EuclideanDivision.div x (pow2 k)) 2 <> 0) by omega.
destruct h.
rewrite H.
apply nth_from_int2c_low_odd.
rewrite Mod_pow2.
(*case k >0*)
rewrite nth_from_int2c_high_even; intuition.
rewrite nth_from_int2c_high_even; intuition.
rewrite Mod_pow2_gen; auto.
rewrite nth_from_int2c_high_odd.
rewrite nth_from_int2c_high_odd; intuition.
split; auto with zarith.
rewrite Mod_pow2_gen; auto.
Qed.
......@@ -47,7 +47,7 @@
name="nth_one1"
locfile="bitvectors/double/../double.why"
loclnum="73" loccnumb="8" loccnume="16"
sum="3848d3fd3fbc40c879e047aaab4a85a2"
sum="1de7d115c0c2e47b0f7c904ae25676bb"
proved="true"
expanded="false"
shape="ainfix =anthaoneV0aFalseIainfix &lt;=V0c51Aainfix &lt;=c0V0F">
......@@ -57,14 +57,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.07"/>
<result status="valid" time="0.26"/>
</proof>
</goal>
<goal
name="nth_one2"
locfile="bitvectors/double/../double.why"
loclnum="74" loccnumb="8" loccnume="16"
sum="719c2d2317fadc995adafb386c90b2c5"
sum="4239a716540729c82b5bc2cb996d81d4"
proved="true"
expanded="false"
shape="ainfix =anthaoneV0aTrueIainfix &lt;=V0c61Aainfix &lt;=c52V0F">
......@@ -74,14 +74,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.07"/>
<result status="valid" time="0.22"/>
</proof>
</goal>
<goal
name="nth_one3"
locfile="bitvectors/double/../double.why"
loclnum="75" loccnumb="8" loccnume="16"
sum="6778125994116ef0019c84160a720db2"
sum="928a77dfb46ea44de4515a93357273e6"
proved="true"
expanded="false"
shape="ainfix =anthaoneV0aFalseIainfix &lt;=V0c63Aainfix &lt;=c62V0F">
......@@ -91,14 +91,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.07"/>
<result status="valid" time="0.23"/>
</proof>
</goal>
<goal
name="sign_one"
locfile="bitvectors/double/../double.why"
loclnum="77" loccnumb="8" loccnume="16"
sum="b70858eca86de90b74841ff3d76acfbc"
sum="788a6aa6d6f8e7ef9798104faf310e0b"
proved="true"
expanded="false"
shape="ainfix =asignaoneaFalse">
......@@ -124,7 +124,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.03"/>
<result status="valid" time="0.02"/>
</proof>
<proof
prover="2"
......@@ -132,7 +132,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.03"/>
<result status="valid" time="0.02"/>
</proof>
<proof
prover="5"
......@@ -140,14 +140,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.12"/>
<result status="valid" time="0.10"/>
</proof>
</goal>
<goal
name="exp_one"
locfile="bitvectors/double/../double.why"
loclnum="78" loccnumb="8" loccnume="15"
sum="15a5f4ba0b6c6193db79d281053be198"
sum="39c4e12e174fe68af3511bdb137ff4c0"
proved="true"
expanded="false"
shape="ainfix =aexpaonec1023">
......@@ -157,7 +157,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.58"/>
<result status="valid" time="2.12"/>
</proof>
<proof
prover="3"
......@@ -166,14 +166,14 @@
edited="double_TestDouble_exp_one_1.v"
obsolete="false"
archived="false">
<result status="valid" time="0.66"/>
<result status="valid" time="0.60"/>
</proof>
</goal>
<goal
name="mantissa_one"
locfile="bitvectors/double/../double.why"
loclnum="79" loccnumb="8" loccnume="20"
sum="d8d24976ea1004e5f2a002910f1f0307"
sum="4a54620e16f0d6a5918a273d53fcdbeb"
proved="true"
expanded="false"
shape="ainfix =amantissaaonec0">
......@@ -183,7 +183,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.77"/>
<result status="valid" time="0.72"/>
</proof>
<proof
prover="0"
......@@ -191,7 +191,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.26"/>
<result status="valid" time="0.09"/>
</proof>
<proof
prover="5"
......@@ -199,14 +199,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="3.21"/>
<result status="valid" time="2.92"/>
</proof>
</goal>
<goal
name="double_value_of_1"
locfile="bitvectors/double/../double.why"
loclnum="81" loccnumb="8" loccnume="25"
sum="fef95cf59dfcb5007abf14eb78393ff2"
sum="eca3f0dc4bf6860b6c1b6bb8e52e8b86"
proved="true"
expanded="false"
shape="ainfix =adouble_of_bv64aonec1.0">
......@@ -224,7 +224,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.04"/>
<result status="valid" time="0.03"/>
</proof>
<proof
prover="2"
......
......@@ -32,7 +32,7 @@
name="Nth_j"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="13" loccnumb="8" loccnume="13"
sum="313f7cfd9cb238cefe6b30a61ef11c31"
sum="d3063104903bdd668679f74cb5f68a13"
proved="true"
expanded="false"
shape="ainfix =anthajV0aFalseIainfix &lt;=V0c62Aainfix &lt;=c0V0F">
......@@ -42,14 +42,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.09"/>
<result status="valid" time="0.27"/>
</proof>
</goal>
<goal
name="sign_of_j"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="15" loccnumb="8" loccnume="17"
sum="1c5c190d58ac88ccf9f66a6e92798676"
sum="b08967f54f1e1489f089ec817a18e2f7"
proved="true"
expanded="false"
shape="ainfix =asignajaTrue">
......@@ -59,14 +59,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.03"/>
<result status="valid" time="0.05"/>
</proof>
</goal>
<goal
name="mantissa_of_j"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="16" loccnumb="8" loccnume="21"
sum="522d8bafdca7f060bd6692b30a154154"
sum="55572bb59d8addee4c9cfe6fd7ee4ef9"
proved="true"
expanded="false"
shape="ainfix =amantissaajc0">
......@@ -76,7 +76,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.74"/>
<result status="valid" time="0.68"/>
</proof>
<proof
prover="0"
......@@ -84,7 +84,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.16"/>
<result status="valid" time="0.06"/>
</proof>
<proof
prover="3"
......@@ -92,14 +92,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="3.69"/>
<result status="valid" time="3.01"/>
</proof>
</goal>
<goal
name="exp_of_j"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="17" loccnumb="8" loccnume="16"
sum="8124c943d92944659f01f19ed43f7c04"
sum="f8f50f4305a26cc7f52c1387cafe90aa"
proved="true"
expanded="false"
shape="ainfix =aexpajc0">
......@@ -109,7 +109,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.74"/>
<result status="valid" time="0.70"/>
</proof>
<proof
prover="0"
......@@ -117,7 +117,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.16"/>
<result status="valid" time="0.06"/>
</proof>
<proof
prover="3"
......@@ -125,14 +125,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="3.08"/>
<result status="valid" time="3.35"/>
</proof>
</goal>
<goal
name="int_of_bv"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="18" loccnumb="8" loccnume="17"
sum="d341fed6fab8b02bd0bba58deeb31623"
sum="159f78875f137f073a9314efffe2ca7a"
proved="true"
expanded="false"
shape="ainfix =adouble_of_bv64ajc0.0">
......@@ -158,14 +158,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.12"/>
<result status="valid" time="0.11"/>
</proof>
</goal>
<goal
name="MainResultBits"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="20" loccnumb="8" loccnume="22"
sum="9ea8f95e8958d5af3426f01ba4e45dbf"
sum="c6fe8a6f64727e31d01f461b664b4a81"
proved="true"
expanded="false"
shape="ainfix =anthabw_xorV0ajV1anthV0V1Iainfix &lt;V1c63Aainfix &lt;=c0V1FF">
......@@ -175,14 +175,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.08"/>
<result status="valid" time="0.03"/>
</proof>
</goal>
<goal
name="MainResultSign"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="23" loccnumb="8" loccnume="22"
sum="9b95d73cc715f26a6e4a596ad40601a2"
sum="e0b3867568f72ea27b09baae32e7f679"
proved="true"
expanded="false"
shape="ainfix =anthabw_xorV0ajc63anotbanthV0c63F">
......@@ -199,7 +199,7 @@
name="Sign_of_xor_j"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="25" loccnumb="8" loccnume="21"
sum="5c22f51afd72897f2722925bdf3ca2b0"
sum="9174061a363d9c2b808fff999dd1c00d"
proved="true"
expanded="false"
shape="ainfix =asignabw_xorV0ajanotbasignV0F">
......@@ -232,7 +232,7 @@
name="Exp_of_xor_j"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="27" loccnumb="8" loccnume="20"
sum="ccbeb8d697184227f9f75d9bacb2a039"
sum="f86ab36765de5476dc2c4e7364803681"
proved="true"
expanded="false"
shape="ainfix =aexpabw_xorV0ajaexpV0F">
......@@ -242,7 +242,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.76"/>
<result status="valid" time="0.70"/>
</proof>
<proof
prover="0"
......@@ -250,7 +250,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.96"/>
<result status="valid" time="0.92"/>
</proof>
<proof
prover="3"
......@@ -258,14 +258,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="3.39"/>
<result status="valid" time="3.52"/>
</proof>
</goal>
<goal
name="Mantissa_of_xor_j"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="29" loccnumb="8" loccnume="25"
sum="14f714cc419ba2f8a7c89860ce5b945b"
sum="6adbf301ff82007071dbc52506e1365f"
proved="true"
expanded="false"
shape="ainfix =amantissaabw_xorV0ajamantissaV0F">
......@@ -275,7 +275,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.77"/>
<result status="valid" time="0.71"/>
</proof>
<proof
prover="0"
......@@ -283,7 +283,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.60"/>
<result status="valid" time="0.57"/>
</proof>
<proof
prover="3"
......@@ -291,14 +291,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="3.58"/>
<result status="valid" time="3.38"/>
</proof>
</goal>
<goal
name="MainResultZero"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="31" loccnumb="8" loccnume="22"
sum="397e23c002ef82f6a4eace3139cc49c2"
sum="621950aa9bf7f4a583419ff60844561c"
proved="true"
expanded="false"
shape="ainfix =adouble_of_bv64abw_xorV0ajaprefix -.adouble_of_bv64V0Iainfix =amantissaV0c0Aainfix =c0aexpV0F">
......@@ -308,7 +308,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="1.07"/>
<result status="valid" time="0.97"/>
</proof>
<proof
prover="0"
......@@ -316,7 +316,7 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.39"/>
<result status="valid" time="1.73"/>
</proof>
<proof
prover="3"
......@@ -324,14 +324,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="3.58"/>
<result status="valid" time="3.19"/>
</proof>
</goal>
<goal
name="sign_neg"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="34" loccnumb="8" loccnume="16"
sum="610aa54b635d7d1565a29d17127341ca"
sum="b229184f963e55e6442db8ef235d1c89"
proved="true"
expanded="false"
shape="ainfix =asign_valueanotbasignV0aprefix -.asign_valueasignV0F">
......@@ -341,14 +341,14 @@
memlimit="1000"
obsolete="false"
archived="false">
<result status="valid" time="0.34"/>
<result status="valid" time="2.84"/>
</proof>
</goal>
<goal
name="MainResult"
locfile="bitvectors/neg_as_xor/../neg_as_xor.why"
loclnum="36" loccnumb="8" loccnume="18"
sum="99f2c975165d320981338aa6c0532b76"
sum="7d1ac00d3cad260c4aba86035625d542"
proved="true"
expanded="true"
shape="ainfix =adouble_of_bv64abw_xorV0ajaprefix -.adouble_of_bv64V0Iainfix &lt;aexpV0c2047Aainfix &lt;c0aexpV0F">
......@@ -359,7 +359,7 @@
edited="neg_as_xor_TestNegAsXOR_MainResult_1.v"
obsolete="false"
archived="false">
<result status="valid" time="1.03"/>
<result status="valid" time="0.94"/>
</proof>
</goal>
</theory>
......
......@@ -89,6 +89,11 @@ theory Pow2int
lemma Div_pow2: forall x i:int. -pow2 i <= x < -pow2 (i-1) ->
div x (pow2 (i-1)) = -2
(*
lemma Mod_pow2: forall x i:int. mod (x + pow2 i) 2 = mod x 2
*)
lemma Mod_pow2_gen: forall x i k :int. 0 <= k < i -> mod (div (x + pow2 i) (pow2 k)) 2 = mod (div x (pow2 k)) 2
end
......
This diff is collapsed.
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