Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
126
Issues
126
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
e32fd3a7
Commit
e32fd3a7
authored
Sep 20, 2015
by
MARCHE Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try Why3: missing examples files
parent
12573bfa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
1 deletion
+56
-1
.gitignore
.gitignore
+3
-1
src/trywhy3/bin_mult.mlw
src/trywhy3/bin_mult.mlw
+31
-0
src/trywhy3/fact.mlw
src/trywhy3/fact.mlw
+22
-0
No files found.
.gitignore
View file @
e32fd3a7
...
...
@@ -273,8 +273,10 @@ pvsbin/
/src/trywhy3/trywhy3.byte
/src/trywhy3/index.en.html
/src/trywhy3/index.fr.html
/src/trywhy3/index.html
/src/trywhy3/ace-builds
/src/trywhy3/alt-ergo-0.99.1
/src/trywhy3/*.png
/src/trywhy3/alt-ergo-1.00-private-2015-01-29
# jessie3
/src/jessie/config.log
...
...
src/trywhy3/bin_mult.mlw
0 → 100644
View file @
e32fd3a7
module BinaryMultiplication
use import mach.int.Int
use import ref.Ref
let mult (a b: int)
requires { b >= 0 }
ensures { result = a * b }
= let x = ref a in
let y = ref b in
let z = ref 0 in
while !y <> 0 do
invariant { 0 <= !y }
invariant { !z + !x * !y = a * b }
variant { !y }
if !y % 2 <> 0 then z := !z + !x;
x := 2 * !x;
y := !y / 2
done;
!z
end
module Test1
use BinaryMultiplication as B
let main () = B.mult 6 7
end
module Test2
use BinaryMultiplication as B
let main () = B.mult 4546729 21993833369
end
\ No newline at end of file
src/trywhy3/fact.mlw
0 → 100644
View file @
e32fd3a7
module Fact
use import mach.int.Int
use import int.Fact
use import ref.Ref
let fact_imp (x:int) : int
requires { x >= 0 }
ensures { result = fact x }
= let y = ref 0 in
let r = ref 1 in
while !y < x do
invariant { 0 <= !y <= x }
invariant { !r = fact !y }
variant { x - !y }
y := !y + 1;
r := !r * !y
done;
!r
let main () = (fact_imp 7, fact_imp 42)
end
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