Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
e945d78d
Commit
e945d78d
authored
3 years ago
by
Julien Signoles
Browse files
Options
Downloads
Patches
Plain Diff
[e-acsl:interval] simplify the case of \sum
parent
d6a7ebf5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/e-acsl/src/analyses/interval.ml
+32
-27
32 additions, 27 deletions
src/plugins/e-acsl/src/analyses/interval.ml
with
32 additions
and
27 deletions
src/plugins/e-acsl/src/analyses/interval.ml
+
32
−
27
View file @
e945d78d
...
@@ -351,36 +351,41 @@ let extended_interv_of_typ ty = match interv_of_typ ty with
...
@@ -351,36 +351,41 @@ let extended_interv_of_typ ty = match interv_of_typ ty with
of the lower (resp. upper) bound and [name] is the identifier of the extended
of the lower (resp. upper) bound and [name] is the identifier of the extended
quantifier (\sum, \product or \numof). The returned ival is the interval of
quantifier (\sum, \product or \numof). The returned ival is the interval of
the extended quantifier. *)
the extended quantifier. *)
let
interv_of_extended_quantifier
lambda
i
j
name
=
let
interv_of_extended_quantifier
lambda
lb
up
name
=
match
lambda
,
i
,
j
,
name
.
lv_name
with
match
lambda
,
lb
,
up
,
name
.
lv_name
with
|
Ival
lbd_iv
,
Ival
i
_iv
,
Ival
j
_iv
,
"
\\
sum"
->
|
Ival
lbd_iv
,
Ival
lb
_iv
,
Ival
ub
_iv
,
"
\\
sum"
->
(
try
(
try
let
min_lambda
,
max_lambda
=
Ival
.
min_and_max
lbd_iv
in
let
min_lambda
,
max_lambda
=
Ival
.
min_and_max
lbd_iv
in
let
i_lb
,
i_ub
=
Ival
.
min_and_max
i_iv
in
let
min_lb
,
min_ub
=
Ival
.
min_and_max
lb_iv
in
let
j_lb
,
j_ub
=
Ival
.
min_and_max
j_iv
in
let
max_lb
,
max_ub
=
Ival
.
min_and_max
ub_iv
in
let
compute_bound
bound_lambda
is_lower_bound
=
(* the number of iterations is the distance between the upper bound and
let
cond
=
match
bound_lambda
with
the lower bound, or 0 if it is negative. *)
|
Some
lambda
->
let
delta
a
b
=
Z
.
max
Z
.
zero
(
Z
.
sub
a
b
)
in
(
is_lower_bound
&&
Z
.
compare
lambda
Z
.
zero
=
1
)
||
let
min_iteration_number
=
(
not
is_lower_bound
&&
Z
.
compare
lambda
Z
.
zero
=
-
1
)
(* the minimum number of iterations is the distance between the
|
None
->
false
smallest upper bound and the biggest lower bound. *)
in
match
min_ub
,
max_lb
with
match
bound_lambda
,
i_lb
,
i_ub
,
j_lb
,
j_ub
with
|
Some
mub
,
Some
mlb
->
delta
mub
mlb
|
Some
lambda
,
_
,
Some
i_ub
,
Some
j_lb
,
_
when
cond
->
|
_
,
None
|
None
,
_
->
Z
.
zero
Some
(
Z
.
mul
lambda
(
Z
.
max
(
Z
.
sub
j_lb
i_ub
)
Z
.
zero
))
in
|
_
,
_
,
_
,
_
,
_
when
cond
->
Some
Z
.
zero
let
max_iteration_number
=
|
Some
lambda
,
Some
i_lb
,
_
,
_
,
Some
j_ub
->
(* the maximum number of iterations is the distance between the
Some
(
Z
.
mul
lambda
(
Z
.
max
(
Z
.
sub
j_ub
i_lb
)
Z
.
zero
))
biggest upper bound and the smallest lower bound. *)
|
Some
lambda
,
_
,
_
,
_
,
_
when
Z
.
compare
lambda
Z
.
zero
=
0
->
match
max_ub
,
min_lb
with
Some
Z
.
zero
|
Some
mub
,
Some
mlb
->
Some
(
delta
mub
mlb
)
|
None
,
Some
i_lb
,
_
,
_
,
Some
j_ub
when
Z
.
compare
j_ub
i_lb
=
0
->
|
_
,
None
|
None
,
_
->
None
Some
Z
.
zero
|
_
,
_
,
_
,
_
,
_
->
None
in
in
Ival
(* the lower (resp. upper) bound is the min (resp. max) value of
(
Ival
.
inject_range
the lambda term times the min (resp. max) number of iterations *)
(
compute_bound
min_lambda
true
)
let
lower_bound
=
match
min_lambda
with
(
compute_bound
max_lambda
false
))
|
None
->
None
|
Some
z
->
Some
(
Z
.
mul
z
min_iteration_number
)
in
let
upper_bound
=
match
max_lambda
,
max_iteration_number
with
|
None
,
_
|
_
,
None
->
None
|
Some
z
,
Some
n
->
Some
(
Z
.
mul
z
n
)
in
Ival
(
Ival
.
inject_range
lower_bound
upper_bound
)
with
Abstract_interp
.
Error_Bottom
->
with
Abstract_interp
.
Error_Bottom
->
bottom
)
bottom
)
|
_
,
_
,
_
,
"
\\
product"
->
Error
.
not_yet
"product"
|
_
,
_
,
_
,
"
\\
product"
->
Error
.
not_yet
"product"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment