Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Why3
why3
Commits
7dcf5523
Commit
7dcf5523
authored
Sep 25, 2013
by
Jean-Christophe Filliâtre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maximum_subarray: proof of algo 3 in progress
parent
7ed9920a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
687 additions
and
620 deletions
+687
-620
examples/in_progress/maximum_subarray.mlw
examples/in_progress/maximum_subarray.mlw
+3
-0
examples/in_progress/maximum_subarray/why3session.xml
examples/in_progress/maximum_subarray/why3session.xml
+684
-620
No files found.
examples/in_progress/maximum_subarray.mlw
View file @
7dcf5523
...
...
@@ -118,6 +118,8 @@ module Algo3
assert { !s = sum a i (mid+1) };
if !s > !ms then begin ms := !s; lo := i end
done;
assert { forall l': int. l <= l' <= mid ->
sum a l' (mid+1) <= sum a !lo (mid+1) };
s := !ms;
for i = mid+1 to h-1 do
invariant { l <= !lo <= mid < !hi <= h && !ms = sum a !lo !hi }
...
...
@@ -126,6 +128,7 @@ module Algo3
invariant { !s = sum a !lo i }
s += a[i];
assert { !s = sum a !lo (i+1) };
assert { !s = sum a !lo (mid+1) + sum a (mid+1) (i+1) };
if !s > !ms then begin ms := !s; hi := (i+1) end
done;
(* then consider sums in a[l..mid[ and a[mid+1..h[, recursively *)
...
...
examples/in_progress/maximum_subarray/why3session.xml
View file @
7dcf5523
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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