Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
a0a10793
Commit
a0a10793
authored
Jan 10, 2013
by
Jean-Christophe Filliâtre
Browse files
slight simplification of mjrty example using a new module array.NumOfEq
parent
5184e595
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
examples/programs/mjrty.mlw
View file @
a0a10793
...
...
@@ -31,9 +31,7 @@ module Mjrty
type candidate
predicate pr (c: candidate) (i: int) (ai: candidate) = ai = c
clone import array.NumOfParam
with type elt = candidate, type param = candidate, predicate pr = pr
clone import array.NumOfEq with type elt = candidate
let mjrty (a: array candidate)
requires { 1 <= length a }
...
...
examples/programs/mjrty/why3session.xml
View file @
a0a10793
This diff is collapsed.
Click to expand it.
modules/array.mlw
View file @
a0a10793
...
...
@@ -205,10 +205,24 @@ module NumOfParam
predicate pr_ (p: param_) (i: int) = let (a, p) = p in pr p i a[i]
clone import int.NumOfParam with type param = param_, predicate pr = pr_
(* the number of a[i] such that [l <= i < u] and [pr p i a[i]] *)
(*
*
the number of a[i] such that [l <= i < u] and [pr p i a[i]] *)
function numof (a: array elt) (p: param) (l u: int) : int = num_of (a, p) l u
end
(** the number of a[i] such that [l <= i < u] and [a[i] = v] *)
module NumOfEq
use import Array
type elt
type param = (array elt, elt)
predicate pr (p: param) (i: int) = let (a, v) = p in a[i] = v
clone import int.NumOfParam with type param = param, predicate pr = pr
function numof (a: array elt) (v: elt) (l u: int) : int = num_of (a, v) l u
end
(** the number of a[i] such that [l <= i < u] and [pr i a[i]] *)
module NumOf
use import Array
...
...
@@ -219,7 +233,6 @@ module NumOf
predicate pr_ (a: param) (i: int) = pr i a[i]
clone import int.NumOfParam with type param = param, predicate pr = pr_
(* the number of a[i] such that [l <= i < u] and [pr i a[i]] *)
function numof (a: array elt) (l u: int) : int = num_of a l u
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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