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
58421550
Commit
58421550
authored
Sep 01, 2010
by
Andrei Paskevich
Browse files
add "eliminate_recursion"
parent
94be8e9b
Changes
2
Hide whitespace changes
Inline
Side-by-side
drivers/alt_ergo.drv
View file @
58421550
...
...
@@ -15,7 +15,7 @@ transformation "simplify_recursive_definition"
transformation "inline_trivial"
transformation "eliminate_builtin"
transformation "eliminate_
mutual_
recursion"
transformation "eliminate_recursion"
transformation "eliminate_inductive"
transformation "eliminate_algebraic"
transformation "eliminate_if"
...
...
src/transform/eliminate_definition.ml
View file @
58421550
...
...
@@ -98,17 +98,39 @@ let add_ld func pred axl d = match d with
|
_
->
axl
,
d
end
let
elim
func
pred
mutual
d
=
match
d
.
d_node
with
|
Dlogic
l
when
not
mutual
||
List
.
length
l
>
1
->
let
axl
,
l
=
map_fold_left
(
add_ld
func
pred
)
[]
l
in
let
d
=
create_logic_decl
l
in
d
::
List
.
rev
axl
let
elim_decl
func
pred
l
=
let
axl
,
l
=
map_fold_left
(
add_ld
func
pred
)
[]
l
in
let
d
=
create_logic_decl
l
in
d
::
List
.
rev
axl
let
elim
func
pred
d
=
match
d
.
d_node
with
|
Dlogic
l
->
elim_decl
func
pred
l
|
_
->
[
d
]
let
is_rec
=
function
|
[]
->
assert
false
|
[
_
,
None
]
->
false
|
[
ls
,
Some
ld
]
->
let
_
,
e
=
open_ls_defn
ld
in
begin
match
e
with
|
Term
t
->
t_s_any
(
const
false
)
(
ls_equal
ls
)
t
|
Fmla
f
->
f_s_any
(
const
false
)
(
ls_equal
ls
)
f
end
|
_
->
true
let
elim_recursion
d
=
match
d
.
d_node
with
|
Dlogic
l
when
is_rec
l
->
elim_decl
true
true
l
|
_
->
[
d
]
let
elim_mutual
d
=
match
d
.
d_node
with
|
Dlogic
l
when
List
.
length
l
>
1
->
elim_decl
true
true
l
|
_
->
[
d
]
let
eliminate_definition_func
=
Trans
.
decl
(
elim
true
false
false
)
None
let
eliminate_definition_pred
=
Trans
.
decl
(
elim
false
true
false
)
None
let
eliminate_definition
=
Trans
.
decl
(
elim
true
true
false
)
None
let
eliminate_mutual_recursion
=
Trans
.
decl
(
elim
true
true
true
)
None
let
eliminate_definition_func
=
Trans
.
decl
(
elim
true
false
)
None
let
eliminate_definition_pred
=
Trans
.
decl
(
elim
false
true
)
None
let
eliminate_definition
=
Trans
.
decl
(
elim
true
true
)
None
let
eliminate_recursion
=
Trans
.
decl
elim_recursion
None
let
eliminate_mutual_recursion
=
Trans
.
decl
elim_mutual
None
let
()
=
Trans
.
register_transform
"eliminate_definition_func"
...
...
@@ -117,6 +139,8 @@ let () =
eliminate_definition_pred
;
Trans
.
register_transform
"eliminate_definition"
eliminate_definition
;
Trans
.
register_transform
"eliminate_recursion"
eliminate_recursion
;
Trans
.
register_transform
"eliminate_mutual_recursion"
eliminate_mutual_recursion
...
...
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