# Extra-logical properties for typing

**Author(s):**Daniel Cabeza, Manuel Hermenegildo.

This library contains traditional Prolog predicates for testing types. They depend on the state of instantiation of their arguments, thus being of extra-logical nature.

## Usage and interface

## Documentation on exports

PROPERTY

**General properties:**

*The following properties hold globally:*

(native_props:is_det/1)All calls of the form var(Arg1) are deterministic.

(native_props:test_type/2)Indicates the type of test that a predicate performs. Required by the nonfailure analyisis.

`var(X)`

*The following properties hold globally:*

(basic_props:not_further_inst/2)X is not further instantiated.

(basic_props:native/1)This predicate is understood natively by CiaoPP.

(basic_props:sideff/2)var(X) is side-effect free.

`var(X)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)X is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:eval/1)var(X) is evaluable at compile-time.

`var(X)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)X is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)var(X) is equivalent to fail.

`var(X)`

*If the following properties hold at call time:*

(term_typing:var/1)X is a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)var(X) is equivalent to true.

**Usage:** `var(X)`

*Description:*X is a free variable.*The following properties hold globally:*

(basic_props:native/2)This predicate is understood natively by CiaoPP as free(X).

PROPERTY

**General properties:**

*The following properties hold globally:*

(native_props:is_det/1)All calls of the form nonvar(Arg1) are deterministic.

`nonvar(X)`

*The following properties hold globally:*

(basic_props:not_further_inst/2)X is not further instantiated.

(basic_props:sideff/2)nonvar(X) is side-effect free.

(basic_props:native/1)This predicate is understood natively by CiaoPP.

`nonvar(X)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)X is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:eval/1)nonvar(X) is evaluable at compile-time.

`nonvar(T)`

*If the following properties hold at call time:*

(term_typing:var/1)T is a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)nonvar(T) is equivalent to fail.

`nonvar(T)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)T is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)nonvar(T) is equivalent to true.

**Usage:** `nonvar(X)`

*Description:*X is currently a term which is not a free variable.*The following properties hold globally:*

(basic_props:native/2)This predicate is understood natively by CiaoPP as not_free(X).

PROPERTY

**General properties:**

`atom(X)`

*The following properties hold upon exit:*

(basic_props:atm/1)X is an atom.

*The following properties hold globally:*

(native_props:is_det/1)All calls of the form atom(Arg1) are deterministic.

(native_props:test_type/2)Indicates the type of test that a predicate performs. Required by the nonfailure analyisis.

`atom(X)`

*The following properties hold globally:*

(basic_props:not_further_inst/2)X is not further instantiated.

(basic_props:sideff/2)atom(X) is side-effect free.

(basic_props:native/1)This predicate is understood natively by CiaoPP.

`atom(X)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)X is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:eval/1)atom(X) is evaluable at compile-time.

`atom(T)`

*If the following properties hold at call time:*

(term_typing:var/1)T is a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)atom(T) is equivalent to fail.

**Usage:** `atom(X)`

*Description:*X is currently instantiated to an atom.*The following properties hold globally:*

(basic_props:native/1)This predicate is understood natively by CiaoPP.

PROPERTY

**General properties:**

`integer(X)`

*The following properties hold upon exit:*

(basic_props:int/1)X is an integer.

*The following properties hold globally:*

(native_props:is_det/1)All calls of the form integer(Arg1) are deterministic.

(native_props:test_type/2)Indicates the type of test that a predicate performs. Required by the nonfailure analyisis.

`integer(X)`

*The following properties hold globally:*

(basic_props:not_further_inst/2)X is not further instantiated.

(basic_props:sideff/2)integer(X) is side-effect free.

(basic_props:native/1)This predicate is understood natively by CiaoPP.

`integer(X)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)X is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:eval/1)integer(X) is evaluable at compile-time.

`integer(T)`

*If the following properties hold at call time:*

(term_typing:var/1)T is a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)integer(T) is equivalent to fail.

**Usage:** `integer(X)`

*Description:*X is currently instantiated to an integer.*The following properties hold globally:*

(basic_props:native/1)This predicate is understood natively by CiaoPP.

PROPERTY

**General properties:**

`float(X)`

*The following properties hold upon exit:*

(basic_props:flt/1)X is a float.

*The following properties hold globally:*

(native_props:is_det/1)All calls of the form float(Arg1) are deterministic.

(native_props:test_type/2)Indicates the type of test that a predicate performs. Required by the nonfailure analyisis.

`float(X)`

*The following properties hold globally:*

(basic_props:not_further_inst/2)X is not further instantiated.

(basic_props:sideff/2)float(X) is side-effect free.

(basic_props:native/1)This predicate is understood natively by CiaoPP.

`float(X)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)X is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:eval/1)float(X) is evaluable at compile-time.

`float(T)`

*If the following properties hold at call time:*

(term_typing:var/1)T is a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)float(T) is equivalent to fail.

**Usage:** `float(X)`

*Description:*X is currently instantiated to a float.*The following properties hold globally:*

(basic_props:native/1)This predicate is understood natively by CiaoPP.

PROPERTY

**General properties:**

`number(X)`

*The following properties hold upon exit:*

(basic_props:num/1)X is a number.

*The following properties hold globally:*

(native_props:is_det/1)All calls of the form number(Arg1) are deterministic.

(native_props:test_type/2)Indicates the type of test that a predicate performs. Required by the nonfailure analyisis.

`number(X)`

*The following properties hold globally:*

(basic_props:not_further_inst/2)X is not further instantiated.

(basic_props:sideff/2)number(X) is side-effect free.

(basic_props:native/1)This predicate is understood natively by CiaoPP.

`number(X)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)X is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:eval/1)number(X) is evaluable at compile-time.

`number(T)`

*If the following properties hold at call time:*

(term_typing:var/1)T is a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)number(T) is equivalent to fail.

**Usage:** `number(X)`

*Description:*X is currently instantiated to a number.*The following properties hold globally:*

(basic_props:native/1)This predicate is understood natively by CiaoPP.

PROPERTY

**General properties:**

`atomic(T)`

*The following properties hold upon exit:*

(basic_props:constant/1)T is an atomic term (an atom or a number).

*The following properties hold globally:*

(native_props:is_det/1)All calls of the form atomic(Arg1) are deterministic.

(native_props:test_type/2)Indicates the type of test that a predicate performs. Required by the nonfailure analyisis.

`atomic(X)`

*The following properties hold globally:*

(basic_props:not_further_inst/2)X is not further instantiated.

(basic_props:sideff/2)atomic(X) is side-effect free.

(basic_props:native/1)This predicate is understood natively by CiaoPP.

`atomic(X)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)X is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:eval/1)atomic(X) is evaluable at compile-time.

`atomic(T)`

*If the following properties hold at call time:*

(term_typing:var/1)T is a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)atomic(T) is equivalent to fail.

**Usage:** `atomic(X)`

*Description:*X is currently instantiated to an atom or a number.*The following properties hold globally:*

(basic_props:native/1)This predicate is understood natively by CiaoPP.

PROPERTY

**General properties:**

`ground(X)`

*The following properties hold upon exit:*

(basic_props:gnd/1)X is ground.

*The following properties hold globally:*

(native_props:is_det/1)All calls of the form ground(Arg1) are deterministic.

(native_props:test_type/2)Indicates the type of test that a predicate performs. Required by the nonfailure analyisis.

`ground(X)`

*The following properties hold globally:*

(basic_props:not_further_inst/2)X is not further instantiated.

(basic_props:sideff/2)ground(X) is side-effect free.

(basic_props:native/1)This predicate is understood natively by CiaoPP.

`ground(X)`

*If the following properties hold at call time:*

(term_typing:ground/1)X is currently ground (it contains no variables).*then the following properties hold globally:*

(basic_props:eval/1)ground(X) is evaluable at compile-time.

`ground(X)`

*If the following properties hold at call time:*

(term_typing:var/1)X is a free variable.*then the following properties hold globally:*

(basic_props:equiv/2)ground(X) is equivalent to fail.

`ground(X)`

*If the following properties hold at call time:*

(term_typing:ground/1)X is currently ground (it contains no variables).*then the following properties hold globally:*

(basic_props:equiv/2)ground(X) is equivalent to true.

**Usage:** `ground(X)`

*Description:*X is currently ground (it contains no variables).*The following properties hold globally:*

(basic_props:native/1)This predicate is understood natively by CiaoPP.

PROPERTY

**General properties:**

`type(X,Y)`

*The following properties hold upon exit:*

(basic_props:atm/1)Y is an atom.

*The following properties hold globally:*

(native_props:is_det/1)All calls of the form type(Arg1,Arg2) are deterministic.

*The following properties hold globally:*

(basic_props:sideff/2)type(Arg1,Arg2) is side-effect free.

(basic_props:native/1)This predicate is understood natively by CiaoPP.

`type(X,Y)`

*If the following properties hold at call time:*

(term_typing:nonvar/1)X is currently a term which is not a free variable.*then the following properties hold globally:*

(basic_props:eval/1)type(X,Y) is evaluable at compile-time.

**Usage:** `type(X,Y)`

*Description:*X is internally of type Y (`var`,`attv`,`float`,`integer`,`structure`,`atom`or`list`).*The following properties hold globally:*

(basic_props:native/1)This predicate is understood natively by CiaoPP.

## Known bugs and planned improvements

- Run-time checks have been reported not to work with this code. That means that either the assertions here, or the code that implements the run-time checks are erroneous.