Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
82033fd6
Commit
82033fd6
authored
Feb 16, 2010
by
Andrei Paskevich
Browse files
add missing checks in create_tysymbol
parent
6791bf05
Changes
2
Show whitespace changes
Inline
Side-by-side
src/term.ml
View file @
82033fd6
...
@@ -105,13 +105,22 @@ module Ty = struct
...
@@ -105,13 +105,22 @@ module Ty = struct
let
ty_exists
pr
ty
=
let
ty_exists
pr
ty
=
try
ty_fold
(
exists_fn
pr
)
false
ty
with
FoldSkip
->
true
try
ty_fold
(
exists_fn
pr
)
false
ty
with
FoldSkip
->
true
(* s
et of free type variable
s *)
(* s
mart constructor
s *)
let
rec
ty_vars
acc
ty
=
match
ty
.
ty_node
with
let
tv_add_unique
vs
tv
=
if
Name
.
S
.
mem
tv
vs
|
Tyvar
u
->
Name
.
S
.
add
u
acc
then
raise
NonLinearPattern
else
Name
.
S
.
add
tv
vs
|
_
->
ty_fold
ty_vars
acc
ty
(* smart constructors *)
let
rec
tv_known
vs
ty
=
match
ty
.
ty_node
with
|
Tyvar
n
->
Name
.
S
.
mem
n
vs
|
_
->
ty_forall
(
tv_known
vs
)
ty
let
create_tysymbol
name
args
def
=
let
tvs
=
List
.
fold_left
tv_add_unique
Name
.
S
.
empty
args
in
let
_
=
match
def
with
|
Some
ty
->
tv_known
tvs
ty
||
raise
UnboundVariable
|
_
->
true
in
create_tysymbol
name
args
def
exception
BadTypeArity
exception
BadTypeArity
...
@@ -119,6 +128,8 @@ module Ty = struct
...
@@ -119,6 +128,8 @@ module Ty = struct
if
List
.
length
tl
==
List
.
length
s
.
ts_args
if
List
.
length
tl
==
List
.
length
s
.
ts_args
then
ty_app
s
tl
else
raise
BadTypeArity
then
ty_app
s
tl
else
raise
BadTypeArity
(* type matching *)
exception
TypeMismatch
exception
TypeMismatch
let
rec
matching
s
ty1
ty2
=
let
rec
matching
s
ty1
ty2
=
...
@@ -672,8 +683,8 @@ let rec t_vars lvl acc t = match t.t_node with
...
@@ -672,8 +683,8 @@ let rec t_vars lvl acc t = match t.t_node with
and
f_vars
lvl
acc
t
=
f_fold_unsafe
t_vars
f_vars
lvl
acc
t
and
f_vars
lvl
acc
t
=
f_fold_unsafe
t_vars
f_vars
lvl
acc
t
let
t_vars
s
t
=
t_vars
0
s
t
let
t_
free
vars
s
t
=
t_vars
0
s
t
let
f_vars
s
f
=
f_vars
0
s
f
let
f_
free
vars
s
f
=
f_vars
0
s
f
(* USE PHYSICAL EQUALITY *)
(* USE PHYSICAL EQUALITY *)
(*
(*
...
...
src/term.mli
View file @
82033fd6
...
@@ -49,7 +49,6 @@ module Ty : sig
...
@@ -49,7 +49,6 @@ module Ty : sig
val
ty_fold
:
(
'
a
->
ty
->
'
a
)
->
'
a
->
ty
->
'
a
val
ty_fold
:
(
'
a
->
ty
->
'
a
)
->
'
a
->
ty
->
'
a
val
ty_forall
:
(
ty
->
bool
)
->
ty
->
bool
val
ty_forall
:
(
ty
->
bool
)
->
ty
->
bool
val
ty_exists
:
(
ty
->
bool
)
->
ty
->
bool
val
ty_exists
:
(
ty
->
bool
)
->
ty
->
bool
val
ty_vars
:
Name
.
S
.
t
->
ty
->
Name
.
S
.
t
val
ty_match
:
ty
->
ty
->
ty
Name
.
M
.
t
->
ty
Name
.
M
.
t
option
val
ty_match
:
ty
->
ty
->
ty
Name
.
M
.
t
->
ty
Name
.
M
.
t
option
...
@@ -268,8 +267,8 @@ val f_subst_single : vsymbol -> term -> fmla -> fmla
...
@@ -268,8 +267,8 @@ val f_subst_single : vsymbol -> term -> fmla -> fmla
(* set of free variables *)
(* set of free variables *)
val
t_vars
:
Svs
.
t
->
term
->
Svs
.
t
val
t_
free
vars
:
Svs
.
t
->
term
->
Svs
.
t
val
f_vars
:
Svs
.
t
->
fmla
->
Svs
.
t
val
f_
free
vars
:
Svs
.
t
->
fmla
->
Svs
.
t
(* USE PHYSICAL EQUALITY *)
(* USE PHYSICAL EQUALITY *)
(*
(*
...
...
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