Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
121
Issues
121
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
50f410a8
Commit
50f410a8
authored
Apr 26, 2010
by
Andrei Paskevich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
treat correctly the triggers in "eliminate_if"
parent
6d11889d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
src/transform/eliminate_if.ml
src/transform/eliminate_if.ml
+19
-13
No files found.
src/transform/eliminate_if.ml
View file @
50f410a8
...
...
@@ -24,32 +24,38 @@ open Decl
(* eliminate if-then-else in terms *)
let
rec
elim_t
case
letl
contT
t
=
match
t
.
t_node
with
let
rec
elim_t
letl
contT
t
=
match
t
.
t_node
with
|
Tlet
(
t1
,
tb
)
->
let
u
,
t2
=
t_open_bound
tb
in
let
t_let
e1
e2
=
if
e1
==
t1
&&
e2
==
t2
then
t
else
t_let
u
e1
e2
in
let
cont_in
t1
t2
=
contT
(
t_let
t1
t2
)
in
let
cont_let
t1
=
elim_t
case
((
u
,
t1
)
::
letl
)
(
cont_in
t1
)
t2
in
elim_t
case
letl
cont_let
t1
|
Tcase
_
->
t_map_cont
(
elim_t
(
Some
t
)
letl
)
elim_f
contT
t
|
Tif
_
when
case
<>
None
->
Register
.
unsupportedExpression
(
Term
(
of_option
case
))
"cannot eliminate 'if-then-else' under 'match' in terms"
let
cont_let
t1
=
elim_t
((
u
,
t1
)
::
letl
)
(
cont_in
t1
)
t2
in
elim_t
letl
cont_let
t1
|
Tif
(
f
,
t1
,
t2
)
->
let
f
=
elim_f
(
fun
f
->
f
)
f
in
let
f
=
List
.
fold_left
(
fun
f
(
v
,
t
)
->
f_let
v
t
f
)
f
letl
in
f_if
f
(
elim_t
case
letl
contT
t1
)
(
elim_t
case
letl
contT
t2
)
f_if
f
(
elim_t
letl
contT
t1
)
(
elim_t
letl
contT
t2
)
|
Tcase
_
->
Register
.
unsupportedExpression
(
Term
t
)
"cannot eliminate 'if-then-else' under 'match' in terms"
|
_
->
t_map_cont
(
elim_t
case
letl
)
elim_f
contT
t
t_map_cont
(
elim_t
letl
)
elim_f
contT
t
and
elim_f
contF
f
=
match
f
.
f_node
with
|
Fapp
_
|
Flet
_
|
Fcase
_
->
contF
(
f_map_cont
(
elim_t
None
[]
)
elim_f
(
fun
f
->
f
)
f
)
|
_
->
f_map_cont
(
fun
_
_
->
assert
false
)
elim_f
contF
f
contF
(
f_map_cont
(
elim_t
[]
)
elim_f
(
fun
f
->
f
)
f
)
|
_
->
f_map_cont
elim_tr
elim_f
contF
f
(* the only terms we can still meet in a formula are the terms
* in triggers. Since we cannot eliminate 'if' in a trigger term
* (and we shouldn't have one in the first place), we will simply
* replace it with a fresh variable and let the prover sort it out. *)
and
elim_tr
contT
t
=
match
t
.
t_node
with
|
Tif
_
->
contT
(
t_var
(
create_vsymbol
(
id_fresh
"if"
)
t
.
t_ty
))
|
_
->
t_map_cont
elim_tr
elim_f
contT
t
let
elim_f
f
=
elim_f
(
fun
f
->
f
)
f
...
...
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