Prolog "intatom"

Admin User, erstellt 07. Apr. 2025
         
/**
* Prolog code for the structure type theory test cases.
*
* Source of test cases are the following standards:
* - Prolog General Core ISO/IEC 13211-1
* - Draft Technical Corrigendum 2, WG17, Ulrich Neumerkel
* <a href="https://www.complang.tuwien.ac.at/ulrich/iso-prolog/dtc2">www.complang.tuwien.ac.at/ulrich/iso-prolog/dtc2</a>
*
* Warranty & Liability
* To the extent permitted by applicable law and unless explicitly
* otherwise agreed upon, XLOG Technologies AG makes no warranties
* regarding the provided information. XLOG Technologies AG assumes
* no liability that any problems might be solved with the information
* provided by XLOG Technologies AG.
*
* Rights & License
* All industrial property rights regarding the information - copyright
* and patent rights in particular - are the sole property of XLOG
* Technologies AG. If the company was not the originator of some
* excerpts, XLOG Technologies AG has at least obtained the right to
* reproduce, change and translate the information.
*
* Reproduction is restricted to the whole unaltered document. Reproduction
* of the information is only allowed for non-commercial uses. Selling,
* giving away or letting of the execution of the library is prohibited.
* The library can be distributed as part of your applications and libraries
* for execution provided this comment remains unchanged.
*
* Restrictions
* Only to be distributed with programs that add significant and primary
* functionality to the library. Not to be distributed with additional
* software intended to replace any components of the library.
*
* Trademarks
* Jekejeke is a registered trademark of XLOG Technologies AG.
*/
runner_file(structure, intatom, 'ISO 8.3 type').
/****************************************************************/
/* Type Testing */
/****************************************************************/
/* var(X) */
runner_pred(var, 1, structure, intatom, 'ISO 8.3.1.4').
runner_case(var, 1, structure, intatom, 'ISO 8.3.1.4, ISO 1') :-
\+ var(foo).
runner_case(var, 1, structure, intatom, 'ISO 8.3.1.4, ISO 3') :-
\+ (foo=Foo, var(Foo)).
runner_case(var, 1, structure, intatom, 'ISO 8.3.1.4, ISO 4') :-
var(_).
/* nonvar(X) */
runner_pred(nonvar, 1, structure, intatom, 'ISO 8.3.7.4').
% runner_case(nonvar, 1, structure, intatom, _) :- nonvar(3).
runner_case(nonvar, 1, structure, intatom, 'ISO 8.3.7.4, ISO 1') :-
nonvar(33.3).
runner_case(nonvar, 1, structure, intatom, 'ISO 8.3.7.4, ISO 2') :-
nonvar(foo).
runner_case(nonvar, 1, structure, intatom, 'ISO 8.3.7.4, ISO 4') :-
foo=Foo, nonvar(Foo).
runner_case(nonvar, 1, structure, intatom, 'ISO 8.3.7.4, ISO 5') :-
\+ nonvar(_).
runner_case(nonvar, 1, structure, intatom, 'ISO 8.3.7.4, ISO 6') :-
nonvar(a(b)).
/* atom(X) */
runner_pred(atom, 1, structure, intatom, 'ISO 8.3.2.4').
runner_case(atom, 1, structure, intatom, 'ISO 8.3.2.4, ISO 1') :-
atom(atom).
runner_case(atom, 1, structure, intatom, 'ISO 8.3.2.4, ISO 2') :-
atom('string').
runner_case(atom, 1, structure, intatom, 'ISO 8.3.2.4, ISO 3') :-
\+ atom(a(b)).
runner_case(atom, 1, structure, intatom, 'ISO 8.3.2.4, ISO 4') :-
\+ atom(_).
runner_case(atom, 1, structure, intatom, 'ISO 8.3.2.4, ISO 5') :-
atom([]).
runner_case(atom, 1, structure, intatom, 'ISO 8.3.2.4, ISO 6') :-
\+ atom(6).
runner_case(atom, 1, structure, intatom, 'ISO 8.3.2.4, ISO 7') :-
\+ atom(3.3).
/* integer(X) */
runner_pred(integer, 1, structure, intatom, 'ISO 8.3.3.4').
runner_case(integer, 1, structure, intatom, 'ISO 8.3.3.4, ISO 1') :-
integer(3).
runner_case(integer, 1, structure, intatom, 'ISO 8.3.3.4, ISO 2') :-
integer(-3).
runner_case(integer, 1, structure, intatom, 'ISO 8.3.3.4, ISO 3') :-
\+ integer(3.3).
runner_case(integer, 1, structure, intatom, 'ISO 8.3.3.4, ISO 4') :-
\+ integer(_).
runner_case(integer, 1, structure, intatom, 'ISO 8.3.3.4, ISO 5') :-
\+ integer(atom).
/* atomic(X) */
runner_pred(atomic ,1, structure, intatom, 'ISO 8.3.5.4').
runner_case(atomic ,1, structure, intatom, 'ISO 8.3.5.4, ISO 1') :-
atomic(atom).
runner_case(atomic ,1, structure, intatom, 'ISO 8.3.5.4, ISO 2') :-
\+ atomic(a(b)).
runner_case(atomic ,1, structure, intatom, 'ISO 8.3.5.4, ISO 3') :-
\+ atomic(_).
runner_case(atomic ,1, structure, intatom, 'ISO 8.3.5.4, ISO 4') :-
atomic(6).
runner_case(atomic ,1, structure, intatom, 'ISO 8.3.5.4, ISO 5') :-
atomic(3.3).
/* float(X) */
runner_pred(float, 1, structure, intatom, 'ISO 8.3.4.4').
runner_case(float, 1, structure, intatom, 'ISO 8.3.4.4, ISO 1') :-
float(3.3).
runner_case(float, 1, structure, intatom, 'ISO 8.3.4.4, ISO 2') :-
float(-3.3).
runner_case(float, 1, structure, intatom, 'ISO 8.3.4.4, ISO 3') :-
\+ float(3).
runner_case(float, 1, structure, intatom, 'ISO 8.3.4.4, ISO 4') :-
\+ float(atom).
runner_case(float, 1, structure, intatom, 'ISO 8.3.4.4, ISO 5') :-
\+ float(_).
/* compound(X) */
runner_pred(compound, 1, structure, intatom, 'ISO 8.3.6.4').
runner_case(compound, 1, structure, intatom, 'ISO 8.3.6.4, ISO 1') :-
\+ compound(33.3).
runner_case(compound, 1, structure, intatom, 'ISO 8.3.6.4, ISO 2') :-
\+ compound(-33.3).
runner_case(compound, 1, structure, intatom, 'ISO 8.3.6.4, ISO 3') :-
compound(-a).
runner_case(compound, 1, structure, intatom, 'ISO 8.3.6.4, ISO 4') :-
\+ compound(_).
runner_case(compound, 1, structure, intatom, 'ISO 8.3.6.4, ISO 5') :-
\+ compound(a).
runner_case(compound, 1, structure, intatom, 'ISO 8.3.6.4, ISO 6') :-
compound(a(b)).
runner_case(compound, 1, structure, intatom, 'ISO 8.3.6.4, ISO 7') :-
\+ compound([]).
runner_case(compound, 1, structure, intatom, 'ISO 8.3.6.4, ISO 8') :-
compound([b]).
/* number(X) */
runner_pred(number, 1, structure, intatom, 'ISO 8.3.8.4').
runner_case(number, 1, structure, intatom, 'ISO 8.3.8.4, ISO 1') :-
number(3).
runner_case(number, 1, structure, intatom, 'ISO 8.3.8.4, ISO 2') :-
number(3.3).
runner_case(number, 1, structure, intatom, 'ISO 8.3.8.4, ISO 3') :-
number(-3).
runner_case(number, 1, structure, intatom, 'ISO 8.3.8.4, ISO 4') :-
\+ number(a).
runner_case(number, 1, structure, intatom, 'ISO 8.3.8.4, ISO 5') :-
\+ number(_).
/* callable(X) */
runner_pred(callable, 1, structure, intatom, 'Corr.2 8.3.9.4').
runner_case(callable, 1, structure, intatom, 'Corr.2 8.3.9.4, ISO 1') :-
callable(a).
runner_case(callable, 1, structure, intatom, 'Corr.2 8.3.9.4, ISO 2') :-
\+ callable(3).
runner_case(callable, 1, structure, intatom, 'Corr.2 8.3.9.4, ISO 3') :-
\+ callable(_).
runner_case(callable, 1, structure, intatom, 'Corr.2 8.3.9.4, ISO 4') :-
callable((1,2)).
runner_case(callable, 1, structure, intatom, 'Corr.2 8.3.9.4, XLOG 1') :-
callable('string').
/* ground(X) */
runner_pred(ground, 1, structure, intatom, 'Corr.2 8.3.10.4').
runner_case(ground, 1, structure, intatom, 'Corr.2 8.3.10.4, ISO 1') :-
ground(3).
runner_case(ground, 1, structure, intatom, 'Corr.2 8.3.10.4, ISO 2') :-
\+ ground(a(1,_)).
runner_case(ground, 1, structure, intatom, 'Corr.2 8.3.10.4, XLOG 1') :-
ground(atom).
runner_case(ground, 1, structure, intatom, 'Corr.2 8.3.10.4, XLOG 2') :-
ground(a(b)).
runner_case(ground, 1, structure, intatom, 'Corr.2 8.3.10.4, XLOG 3') :-
foo=Foo, ground(Foo).
runner_case(ground, 1, structure, intatom, 'Corr.2 8.3.10.4, XLOG 4') :-
\+ ground(_).
runner_case(ground, 1, structure, intatom, 'Corr.2 8.3.10.4, XLOG 5') :-
ground([]).
/* acyclic_term(X) */
runner_pred(acyclic_term, 1, structure, intatom, 'Corr.2 8.3.11.4').
runner_case(acyclic_term, 1, structure, intatom, 'Corr.2 8.3.11.4, ISO 1') :-
acyclic_term(a(_,1)).
runner_case(acyclic_term, 1, structure, intatom, 'Corr.2 8.3.11.4, ISO 2') :-
X = f(X), \+ acyclic_term(X).
runner_case(acyclic_term, 1, structure, intatom, 'Corr.2 8.3.11.4, XLOG 1') :-
X = f(X), Y = g(X), \+ acyclic_term(Y).
runner_case(acyclic_term, 1, structure, intatom, 'Corr.2 8.3.11.4, XLOG 2') :-
X = f(Y), Y = g(X), Z = h(X), \+ acyclic_term(Z).
runner_case(acyclic_term, 1, structure, intatom, 'Corr.2 8.3.11.4, XLOG 3') :-
X = [a,b,Y|c], Y = [d,e,Z|f], Z = [g,h,i], acyclic_term(X).
runner_case(acyclic_term, 1, structure, intatom, 'Corr.2 8.3.11.4, XLOG 4') :-
X = [a,b,Y|c], Y = [d,e,Z|f], Z = [g,h,X|i], \+ acyclic_term(X).