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
27451f70
Commit
27451f70
authored
Mar 18, 2016
by
Jean-Christophe Filliâtre
Committed by
Guillaume Melquiond
May 18, 2016
Browse files
reduction engine: rewrite rules applies to projection symbols as well
parent
af22e5a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/transform/reduction_engine.ml
View file @
27451f70
...
...
@@ -707,9 +707,9 @@ and reduce_app_no_equ engine st ls ~orig ty rem_cont =
}
with
Not_found
|
Undetermined
->
let
args
=
List
.
map
term_of_value
args
in
try
let
d
=
Ident
.
Mid
.
find
ls
.
ls_name
engine
.
known_map
in
let
rewrite
()
=
let
d
=
try
Ident
.
Mid
.
find
ls
.
ls_name
engine
.
known_map
with
Not_found
->
assert
false
in
let
rewrite
()
=
(* try a rewrite rule *)
begin
try
...
...
@@ -754,7 +754,9 @@ and reduce_app_no_equ engine st ls ~orig ty rem_cont =
cont_stack
=
(
Keval
(
rhs
,
mv
)
,
orig
)
::
rem_cont
;
}
with
Irreducible
->
raise
Not_found
{
value_stack
=
Term
(
t_label_copy
orig
(
t_app
ls
args
ty
))
::
rem_st
;
cont_stack
=
rem_cont
;
}
end
in
match
d
.
Decl
.
d_node
with
|
Decl
.
Dtype
_
|
Decl
.
Dprop
_
->
assert
false
...
...
@@ -779,13 +781,13 @@ and reduce_app_no_equ engine st ls ~orig ty rem_cont =
rewrite
()
|
Decl
.
Ddata
dl
->
(* constructor or projection *)
match
args
with
begin
try
match
args
with
|
[
{
t_node
=
Tapp
(
ls1
,
tl1
)
}
]
->
(* if ls is a projection and ls1 is a constructor,
we should compute that projection *)
let
rec
iter
dl
=
match
dl
with
|
[]
->
raise
Not_found
|
[]
->
raise
Exit
|
(
_
,
csl
)
::
rem
->
let
rec
iter2
csl
=
match
csl
with
...
...
@@ -807,16 +809,13 @@ and reduce_app_no_equ engine st ls ~orig ty rem_cont =
iter3
prs
tl1
|
None
::
prs
,
_
::
tl1
->
iter3
prs
tl1
|
_
->
raise
Not_found
|
_
->
raise
Exit
in
iter3
prs
tl1
else
iter2
rem2
in
iter2
csl
in
iter
dl
|
_
->
raise
Not_found
with
Not_found
->
{
value_stack
=
Term
(
t_label_copy
orig
(
t_app
ls
args
ty
))
::
rem_st
;
cont_stack
=
rem_cont
;
}
|
_
->
raise
Exit
with
Exit
->
rewrite
()
end
and
reduce_equ
(* engine *)
~
orig
st
v1
v2
cont
=
...
...
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