Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
85
Issues
85
List
Boards
Labels
Milestones
Merge Requests
10
Merge Requests
10
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
199df4f4
Commit
199df4f4
authored
Oct 24, 2011
by
Tuyen Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bitvector1.why
parent
20a16bde
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
446 additions
and
505 deletions
+446
-505
tests/bitvector1.why
tests/bitvector1.why
+46
-6
tests/bitvector1/why3session.xml
tests/bitvector1/why3session.xml
+400
-499
No files found.
tests/bitvector1.why
View file @
199df4f4
...
...
@@ -143,6 +143,7 @@ theory BitVector
0 <= n < size -> 0 <= s ->
n+s >= size -> nth (lsr b s) n = False
(* arithmetic shift right *)
function asr bv int : bv
...
...
@@ -192,7 +193,9 @@ theory BitVector
i >= size ->
to_nat_aux b i = 0
function to_nat (b:bv) : int = to_nat_aux b 0
(* generalization : (to_nat_sub b j i) returns the non-negative number represented
by b[j..i] *)
...
...
@@ -236,12 +239,12 @@ theory BitVector
i > j ->
to_nat_sub b j i = 0
lemma to_nat_sub_low_true :
(*
lemma to_nat_sub_low_true :
forall b:bv, j:int.nth b j = True -> to_nat_sub b j j = 1
lemma to_nat_sub_low_false :
forall b:bv, j:int.nth b j = False -> to_nat_sub b j j = 0
*)
lemma to_nat_of_zero:
forall b:bv, i j:int.
(forall k:int. j >= k >= i -> nth b k = False) ->
...
...
@@ -255,6 +258,21 @@ theory BitVector
lemma to_nat_sub_footprint: forall b1 b2:bv, j i:int.
(forall k:int. i <= k <= j -> nth b1 k = nth b2 k) ->
to_nat_sub b1 j i = to_nat_sub b2 j i
(*
lemma to_nat_sub_of_zero_ij:
forall b:bv, i j:int.
(forall k:int. j >= k >= i -> nth b k = False) ->
to_nat_sub b j i = 0
*)
(* function to_nat (b:bv) : int = to_nat_aux b 0*)
function to_nat (b:bv) : int = to_nat_sub b (size-1) 0
(* this lemma is for TestBv32*)
lemma lsr_to_nat_sub:
forall b:bv, n s:int.
0 <= s -> to_nat_sub (lsr b s) (size -1) 0 = to_nat_sub b (size-1-s) 0
(* 2-complement version *)
...
...
@@ -281,7 +299,14 @@ theory BitVector
axiom to_int_aux_neg :
forall b:bv. nth b (size-1) = True ->
to_int_aux b (size-1) = -1
lemma to_int_zero:
forall b:bv. (forall i:int. 0 <= i <size-1-> nth b i = False)
-> to_int_aux b 0 = 0
lemma to_int_one:
forall b:bv. (forall i:int. 0 <= i <size-> nth b i = True)
-> to_int_aux b 0 = -1
function to_int (b:bv) : int = to_int_aux b 0
(* (from_uint n) returns the bitvector representing the non-negative
...
...
@@ -333,10 +358,10 @@ theory TestNatSub
use import BV64
function b:bv = from_int 7
lemma to_nat_sub_b: (to_nat_sub b 4 0) = 7
end
theory BV32_64
...
...
@@ -489,6 +514,7 @@ theory TestDoubleOfInt
use import real.RealInfix
use import real.FromInt
use import real.Power
use import int.Int
function j : BV32.bv = BV32.from_int 0x43300000
...
...
@@ -497,7 +523,21 @@ theory TestDoubleOfInt
function const : BV64.bv = BV32_64.concat j j'
lemma sign_const: sign(const) = False
lemma exp_const: exp(const) = 1075
lemma mantissa_const_nth:
forall i:int. 0 <=i <=30 -> BV64.nth const i = False
lemma mantissa_const_31th:
BV64.nth const 31 = True
lemma to_nat_mantissa_1: (BV64.to_nat_sub const 30 0) = 0
lemma mantissa_const_to_nat:
BV64.to_nat_sub const 31 0 = pow_of2 31
lemma mantissa_const_to_nat51:
BV64.to_nat_sub const 51 0 = BV64.to_nat_sub const 31 0
lemma mantissa_const: mantissa(const) = pow_of2 31
function const_as_double : real = double_of_bv64 const
...
...
@@ -545,7 +585,7 @@ theory TestBv32
to_nat bvzero = 0
goal to_nat_0x0000000F:
to_nat (lsr bvone 28) = 15
to_nat (lsr bvone 28) = 15
goal to_nat_0x0000001F:
to_nat (lsr bvone 27) = 31
...
...
tests/bitvector1/why3session.xml
View file @
199df4f4
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment