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
120
Issues
120
List
Boards
Labels
Service Desk
Milestones
Merge Requests
17
Merge Requests
17
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
60cfdaac
Commit
60cfdaac
authored
Jun 07, 2018
by
MARCHE Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transformation "abstract" : equality on terms should not take attributes and triggers into account.
parent
5128d367
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
9 deletions
+30
-9
src/core/term.ml
src/core/term.ml
+26
-6
src/core/term.mli
src/core/term.mli
+1
-0
src/transform/abstraction.ml
src/transform/abstraction.ml
+3
-3
No files found.
src/core/term.ml
View file @
60cfdaac
...
...
@@ -424,7 +424,7 @@ let t_similar t1 t2 =
|
Ttrue
,
Ttrue
|
Tfalse
,
Tfalse
->
true
|
_
,
_
->
false
let
t_hash
t
=
let
t_hash
t
rigger
attr
t
=
let
rec
pat_hash
bnd
bv
p
=
match
p
.
pat_node
with
|
Pwild
->
bnd
,
bv
,
0
|
Pvar
v
->
bnd
+
1
,
Mvs
.
add
v
bnd
bv
,
bnd
+
1
...
...
@@ -448,8 +448,13 @@ let t_hash t =
bnd
+
1
,
Mvs
.
add
v
bnd
bv
,
Hashcons
.
combine
hp
(
bnd
+
1
)
in
let
rec
t_hash
bnd
vml
t
=
let
comb
l
h
=
Hashcons
.
combine
(
attr_hash
l
)
h
in
let
h
=
Sattr
.
fold
comb
t
.
t_attrs
(
oty_hash
t
.
t_ty
)
in
let
h
=
oty_hash
t
.
t_ty
in
let
h
=
if
attr
then
let
comb
l
h
=
Hashcons
.
combine
(
attr_hash
l
)
h
in
Sattr
.
fold
comb
t
.
t_attrs
h
else
h
in
Hashcons
.
combine
h
begin
match
descend
vml
t
with
|
Bnd
i
->
i
+
1
...
...
@@ -485,8 +490,12 @@ let t_hash t =
|
[]
->
bnd
,
bv
in
let
bnd
,
bv
=
add
bnd
Mvs
.
empty
vl
in
let
vml
=
(
bv
,
b
.
bv_subst
)
::
vml
in
let
h
=
List
.
fold_left
(
Hashcons
.
combine_list
(
t_hash
bnd
vml
))
h
tr
in
let
h
=
if
trigger
then
List
.
fold_left
(
Hashcons
.
combine_list
(
t_hash
bnd
vml
))
h
tr
else
h
in
Hashcons
.
combine
h
(
t_hash
bnd
vml
f
)
|
Tbinop
(
op
,
f
,
g
)
->
let
ho
=
Hashtbl
.
hash
op
in
...
...
@@ -565,7 +574,7 @@ let add_nt_vars _ n t s = vars_union s
module
TermOHT
=
struct
type
t
=
term
let
hash
=
t_hash
let
hash
=
t_hash
true
true
let
equal
=
t_equal
let
compare
=
t_compare
end
...
...
@@ -574,6 +583,17 @@ module Mterm = Extmap.Make(TermOHT)
module
Sterm
=
Extset
.
MakeOfMap
(
Mterm
)
module
Hterm
=
Exthtbl
.
Make
(
TermOHT
)
module
TermOHT_nt_na
=
struct
type
t
=
term
let
hash
=
t_hash
false
false
let
equal
=
t_equal_nt_na
let
compare
=
t_compare
end
module
Hterm_nt_na
=
Exthtbl
.
Make
(
TermOHT_nt_na
)
let
t_hash
=
t_hash
true
true
(* hash-consing constructors for terms *)
let
mk_term
n
ty
=
{
...
...
src/core/term.mli
View file @
60cfdaac
...
...
@@ -152,6 +152,7 @@ val t_equal : term -> term -> bool
val
t_hash
:
term
->
int
(* Equality modulo attributes and triggers *)
val
t_equal_nt_na
:
term
->
term
->
bool
module
Hterm_nt_na
:
Exthtbl
.
S
with
type
key
=
term
(** {2 Bindings} *)
...
...
src/transform/abstraction.ml
View file @
60cfdaac
...
...
@@ -15,7 +15,7 @@ open Term
open
Decl
let
abstraction
(
keep
:
lsymbol
->
bool
)
=
let
term_table
=
Hterm
.
create
257
in
let
term_table
=
Hterm
_nt_na
.
create
257
in
let
extra_decls
=
ref
[]
in
let
rec
abstract
t
:
term
=
...
...
@@ -27,10 +27,10 @@ let abstraction (keep : lsymbol -> bool) =
t_map
abstract
t
|
_
->
let
t
=
t_attr_set
Sattr
.
empty
t
in
let
(
ls
,
tabs
)
=
try
Hterm
.
find
term_table
t
with
Not_found
->
let
(
ls
,
tabs
)
=
try
Hterm
_nt_na
.
find
term_table
t
with
Not_found
->
let
ls
=
create_lsymbol
(
id_fresh
"abstr"
)
[]
t
.
t_ty
in
let
tabs
=
t_app
ls
[]
t
.
t_ty
in
Hterm
.
add
term_table
t
(
ls
,
tabs
);
Hterm
_nt_na
.
add
term_table
t
(
ls
,
tabs
);
ls
,
tabs
in
extra_decls
:=
ls
::
!
extra_decls
;
tabs
in
...
...
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