Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
03d1c7b2
Commit
03d1c7b2
authored
Oct 13, 2012
by
Andrei Paskevich
Browse files
whyml: new specification syntax
parent
65af15a2
Changes
195
Hide whitespace changes
Inline
Side-by-side
bench/programs/bad-typing/alias1.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
let foo (x : ref int) (y : ref int) =
x := 1;
...
...
bench/programs/bad-typing/alias2.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
let foo (x : ref int) (y : ref int) =
x := 1;
...
...
bench/programs/bad-typing/alias3.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
let foo (x : ref int) (y : ref int) =
x := 1;
...
...
bench/programs/bad-typing/alias4.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
val r : ref int
...
...
bench/programs/bad-typing/alias5.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
let foo (x : ref int) (y: ref int) =
x := 1;
...
...
bench/programs/bad-typing/at1.mlw
View file @
03d1c7b2
module M
use import int.Int
use import
module
ref.Ref
use import ref.Ref
let test (a: (ref int, int)) =
{}
let (r,_) = a in r := !r + 1
{ let (x, _) = a in !x = (old !x) + 1 }
let test (a: (ref int, int))
ensures { let (x, _) = a in !x = (old !x) + 1 }
= let (r,_) = a in r := !r + 1
end
...
...
bench/programs/bad-typing/at2.mlw
View file @
03d1c7b2
module M
use import int.Int
use import
module
ref.Ref
use import ref.Ref
let test (a: (ref int, int)) =
'L:
...
...
bench/programs/bad-typing/effect1.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
val f
:
x:int
-> {}
unit writes a.contents
{
}
val f
(
x:int
) :
unit writes
{
a.contents}
end
bench/programs/bad-typing/effect2.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
val f
:
x:int
-> {}
unit writes x.contents
{
}
val f
(
x:int
) :
unit writes
{
x.contents }
end
bench/programs/bad-typing/effect3.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
val a : int
val f
:
x:int
-> {}
unit writes a.contents
{
}
val f
(
x:int
) :
unit writes
{
a.contents }
end
bench/programs/bad-typing/effect4.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
val foo : int
->
int
val foo
(_x
: int
) :
int
val f
:
x:int
-> {}
unit writes foo.contents
{
}
val f
(
x:int
) :
unit writes
{
foo.contents }
end
bench/programs/bad-typing/effect5.mlw
View file @
03d1c7b2
module M
val f
:
x:int
-> {}
unit writes 1
{
}
val f
(
x:int
) :
unit writes
{
1 }
end
bench/programs/bad-typing/effect6.mlw
View file @
03d1c7b2
module M
val f
:
x:int
-> {}
unit writes
x
{}
val f
(
x:int
) :
unit writes {
x
}
end
bench/programs/bad-typing/effect7.mlw
View file @
03d1c7b2
...
...
@@ -3,10 +3,10 @@ module Bad
use import int.Int
use import ref.Ref
let f (x y : ref int) : unit
=
{ !x = !y }
x
:
= !
x
+ 1
{ !
x = !
y
+ 1
}
let f (x y : ref int) : unit
requires
{ !x = !y }
ensures { !
x = !
y
+ 1
}
=
x
:
= !
x
+ 1
let g () : unit =
let r = ref 0 in
...
...
bench/programs/bad-typing/escape1.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
(* reference would escape its scope *)
let test () =
let x = ref 0 in
fun y ->
{ } x := y; !x
{ result = !x }
fun y ->
ensures
{ result = !x }
x := y; !x
end
bench/programs/bad-typing/old1.mlw
View file @
03d1c7b2
module M
use import int.Int
use import module ref.Ref
let test1 (x: ref int) =
{ !x >= 0}
while !x > 0 do
use import ref.Ref
let test1 (x: ref int)
requires { !x >= 0 }
ensures { !x >= old !x }
= while !x > 0 do
invariant { !x >= old !x }
x := !x - 1
done
{ !x >= old !x }
end
(*
...
...
bench/programs/bad-typing/old2.mlw
View file @
03d1c7b2
module M
use import int.Int
use import module ref.Ref
let test1 (x: ref int) =
{ !x >= 0}
x := !x - 1;
use import ref.Ref
let test1 (x: ref int)
ensures { !x >= old !x }
requires { !x >= 0}
= x := !x - 1;
assert { !x >= old !x }
{ !x >= old !x }
end
(*
...
...
bench/programs/bad-typing/old3.mlw
View file @
03d1c7b2
...
...
@@ -2,7 +2,7 @@
module Test
use import
module
ref.Refint
use import ref.Refint
let test (x: ref int) =
if !x = old !x then 1 else 2
...
...
bench/programs/bad-typing/polyref1.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
val r : ref 'a
...
...
bench/programs/bad-typing/polyref3.mlw
View file @
03d1c7b2
module M
use import
module
ref.Ref
use import ref.Ref
use import list.List
val r : ref (list 'a)
...
...
Prev
1
2
3
4
5
…
10
Next
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