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
541a37b4
Commit
541a37b4
authored
Apr 04, 2011
by
Jean-Christophe
Browse files
muller's spec made even simpler
parent
0644836a
Changes
1
Show whitespace changes
Inline
Side-by-side
examples/programs/muller.mlw
View file @
541a37b4
...
@@ -12,13 +12,13 @@ module Muller
...
@@ -12,13 +12,13 @@ module Muller
let compact (a : array int) =
let compact (a : array int) =
let count = ref 0 in
let count = ref 0 in
for i = 0 to length a - 1 do
for i = 0 to length a - 1 do
invariant { 0 <= count
<= i and count
= num_of a 0 i }
invariant { 0 <= count = num_of a 0 i
<= i
}
if a[i] <> 0 then incr count
if a[i] <> 0 then incr count
done;
done;
let u = make !count 0 in
let u = make !count 0 in
count := 0;
count := 0;
for i = 0 to length a - 1 do
for i = 0 to length a - 1 do
invariant { 0 <= count
<= i and count
= num_of a 0 i and
invariant { 0 <= count = num_of a 0 i
<= i
and
length u = num_of a 0 (length a) }
length u = num_of a 0 (length a) }
if a[i] <> 0 then begin u[!count <- a[i]]; incr count end
if a[i] <> 0 then begin u[!count <- a[i]]; incr count end
done
done
...
...
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