Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AnaStat-Frama-C-24-25
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Ettayeb Yassine
AnaStat-Frama-C-24-25
Commits
3aaaf304
Commit
3aaaf304
authored
2 weeks ago
by
Ettayeb Yassine
Browse files
Options
Downloads
Patches
Plain Diff
TP3: Treillis des intervalles, version finale
parent
71873050
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Pystan/config/interval_analysis.py
+47
-30
47 additions, 30 deletions
Pystan/config/interval_analysis.py
with
47 additions
and
30 deletions
Pystan/config/interval_analysis.py
+
47
−
30
View file @
3aaaf304
...
@@ -405,44 +405,61 @@ def reduce_state(s: state,c: BoolExpr) -> state:
...
@@ -405,44 +405,61 @@ def reduce_state(s: state,c: BoolExpr) -> state:
class
Interval_analysis
(
Transfer
[
state
]):
class
Interval_analysis
(
Transfer
[
state
]):
variables
:
frozenset
[
str
]
variables
:
frozenset
[
str
]
def
__init__
(
self
,
instr
:
Instr
):
def
__init__
(
self
,
instr
:
Instr
):
self
.
variables
=
variables_of_instr
(
instr
)
self
.
variables
=
variables_of_instr
(
instr
)
def
bottom
(
self
)
->
state
:
def
bottom
(
self
)
->
state
:
return
None
return
None
def
init_state
(
self
)
->
state
:
def
init_state
(
self
)
->
state
:
return
dict
.
fromkeys
(
self
.
variables
,
Interval
(
None
,
None
))
return
dict
.
fromkeys
(
self
.
variables
,
Interval
(
None
,
None
))
def
join
(
self
,
s1
:
state
,
s2
:
state
)
->
state
:
if
s1
is
None
:
return
s2
def
join
(
self
,
s1
:
state
,
s2
:
state
)
->
state
:
if
s2
is
None
:
return
s1
if
s1
is
None
:
res
:
abstract_env
=
{}
return
s2
for
var
in
self
.
variables
:
if
s2
is
None
:
v1
=
s1
[
var
]
return
s1
v2
=
s2
[
var
]
return
{
v
:
interval_join
(
s1
[
v
],
s2
[
v
])
for
v
in
self
.
variables
}
v
=
interval_join
(
v1
,
v2
)
res
[
var
]
=
v
def
widen
(
self
,
s1
:
state
,
s2
:
state
)
->
state
:
return
res
if
s1
is
None
:
return
s2
def
widen
(
self
,
s1
:
state
,
s2
:
state
)
->
state
:
if
s2
is
None
:
raise
NotImplementedError
return
s1
return
{
v
:
interval_widen
(
s1
[
v
],
s2
[
v
])
for
v
in
self
.
variables
}
def
included
(
self
,
s1
:
state
,
s2
:
state
)
->
bool
:
if
s1
is
None
:
return
True
def
included
(
self
,
s1
:
state
,
s2
:
state
)
->
bool
:
if
s2
is
None
:
return
False
if
s1
is
None
:
for
var
in
self
.
variables
:
return
True
if
not
interval_leq
(
s1
[
var
],
s2
[
var
]):
return
False
if
s2
is
None
:
return
True
return
False
return
all
(
interval_leq
(
s1
[
v
],
s2
[
v
])
for
v
in
self
.
variables
)
def
tr_skip
(
self
,
s
:
state
)
->
state
:
def
tr_skip
(
self
,
s
:
state
)
->
state
:
return
s
return
s
def
tr_set
(
self
,
s
:
state
,
v
:
str
,
e
:
ArithExpr
)
->
state
:
def
tr_set
(
self
,
s
:
state
,
v
:
str
,
e
:
ArithExpr
)
->
state
:
raise
NotImplementedError
if
s
is
None
:
return
None
val
=
eval_aexp
(
s
,
e
)
if
val
is
None
:
return
None
s1
=
s
.
copy
()
s1
[
v
]
=
val
if
not
isinstance
(
val
,
Top
)
else
Interval
(
None
,
None
)
return
s1
def
tr_test
(
self
,
s
:
state
,
c
:
BoolExpr
)
->
state
:
def
tr_test
(
self
,
s
:
state
,
c
:
BoolExpr
)
->
state
:
r
aise
NotImplementedError
r
eturn
reduce_state
(
s
,
c
)
def
tr_err
(
self
,
s
:
state
,
e
:
Expr
)
->
state
:
def
tr_err
(
self
,
s
:
state
,
e
:
Expr
)
->
state
:
raise
NotImplementedError
if
s
is
None
:
return
None
if
isinstance
(
e
,
ArithExpr
):
return
s
if
eval_aexp
(
s
,
e
)
is
not
None
else
None
if
isinstance
(
e
,
BoolExpr
):
return
s
if
eval_bexp
(
s
,
e
)
is
not
None
else
None
return
s
def
analyze
(
i
:
Instr
)
->
None
:
def
analyze
(
i
:
Instr
)
->
None
:
cfg
=
Cfg
(
i
)
cfg
=
Cfg
(
i
)
...
...
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