Prolog "eqless"

Admin User, created Apr 07. 2025
         
/**
* 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.
*/
/**
* Source of test cases are the following standards and proposals:
* - 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>
* - New built-in flags, predicates, and functions proposal
* <a href="https://www.complang.tuwien.ac.at/ulrich/iso-prolog/N208">www.complang.tuwien.ac.at/ulrich/iso-prolog/N208</a>
*/
runner_file(arithmetic, eqless, 'ISO 8.7.1 order').
/****************************************************************/
/* Arithmetic Comparisons */
/****************************************************************/
/* X =:= Y */
runner_pred(=:=, 2, arithmetic, eqless, 'ISO 8.7.1.4').
runner_case(=:=, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 1') :-
\+ 0 =:= 1.
runner_case(=:=, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 7') :-
1.0 =:= 1.
runner_case(=:=, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 14') :-
3*2 =:= 7-1.
runner_case(=:=, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 1') :-
\+ -1048576 =:= -1024.
runner_case(=:=, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 2') :-
catch(7 =:= -foobar, error(E, _), true),
E == type_error(evaluable, foobar/0).
/* X =\= Y */
runner_pred(=\=, 2, arithmetic, eqless, 'ISO 8.7.1.4').
runner_case(=\=, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 2') :-
0 =\= 1.
runner_case(=\=, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 8') :-
\+ 1.0 =\= 1.
runner_case(=\=, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 15') :-
\+ 3*2 =\= 7-1.
runner_case(=\=, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 3') :-
-1048576 =\= -1024.
runner_case(=\=, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 4') :-
catch(7 =\= abs(_), error(E, _), true),
E == instantiation_error.
/* X < Y */
runner_pred(<, 2, arithmetic, eqless, 'ISO 8.7.1.4').
runner_case(<, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 3') :-
0 < 1.
runner_case(<, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 10') :-
\+ 1.0 < 1.
runner_case(<, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 16') :-
\+ 3*2 < 7-1.
runner_case(<, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 5') :-
-1048576 < -1024.
runner_case(<, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 6') :-
catch(sign(foobar) < 7, error(E, _), true),
E == type_error(evaluable, foobar/0).
/* X > Y */
runner_pred(>, 2, arithmetic, eqless, 'ISO 8.7.1.4').
runner_case(>, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 4') :-
\+ 0 > 1.
runner_case(>, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 11') :-
\+ 1.0 > 1.
runner_case(>, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 17') :-
\+ 3*2 > 7-1.
runner_case(>, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 7') :-
\+ -1048576 > -1024.
runner_case(>, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 23') :-
catch(_ > 5, error(E, _), true),
E == instantiation_error.
runner_case(>, 2, arithmetic, eqless, 'ISO 8.7.1.4, Note 2') :-
catch(2^1024 > 0.0, error(E, _), true),
E == evaluation_error(float_overflow).
/* X =< Y */
runner_pred(=<, 2, arithmetic, eqless, 'ISO 8.7.1.4').
runner_case(=<, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 6') :-
0 =< 1.
runner_case(=<, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 13') :-
1.0 =< 1.
runner_case(=<, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 19') :-
3*2 =< 7-1.
runner_case(=<, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 8') :-
-1048576 =< -1024.
runner_case(=<, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 9') :-
catch(foobar + 77 =< 7, error(E, _), true),
E == type_error(evaluable, foobar/0).
/* X >= Y */
runner_pred(>=, 2, arithmetic, eqless, 'ISO 8.7.1.4').
runner_case(>=, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 5') :-
\+ 0 >= 1.
runner_case(>=, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 12') :-
1.0 >= 1.
runner_case(>=, 2, arithmetic, eqless, 'ISO 8.7.1.4, ISO 18') :-
3*2 >= 7-1.
runner_case(>=, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 10') :-
\+ -1048576 >= -1024.
runner_case(>=, 2, arithmetic, eqless, 'ISO 8.7.1.4, XLOG 11') :-
catch(77-_ >= 7, error(E, _), true),
E == instantiation_error.
/* min(X, Y) */
runner_pred(min, -3, arithmetic, eqless, 'Corr.2 9.3.9').
runner_case(min, -3, arithmetic, eqless, 'Corr.2 9.3.9, ISO 1') :-
2 is min(2,3).
runner_case(min, -3, arithmetic, eqless, 'Corr.2 9.3.9, ISO 2') :-
2.0 is min(2,3.0).
runner_case(min, -3, arithmetic, eqless, 'Corr.2 9.3.9, ISO 3') :-
2.0 is min(3,2.0).
runner_case(min, -3, arithmetic, eqless, 'Corr.2 9.3.9, XLOG 1') :-
-1048576 is min(-1048576,-1024).
runner_case(min, -3, arithmetic, eqless, 'Corr.2 9.3.9, XLOG 2') :-
catch(3.0 is min(foobar,3.0), error(E, _), true),
E == type_error(evaluable, foobar/0).
runner_case(min, -3, arithmetic, eqless, 'Corr.2 9.3.9, Note 2') :-
catch(_ is min(2^1024, 0.0), error(E, _), true),
E == evaluation_error(float_overflow).
/* max(X, Y) */
runner_pred(max, -3, arithmetic, eqless, 'Corr.2 9.3.8').
runner_case(max, -3, arithmetic, eqless, 'Corr.2 9.3.8, ISO 1') :-
3 is max(2,3).
runner_case(max, -3, arithmetic, eqless, 'Corr.2 9.3.8, ISO 2') :-
3.0 is max(2.0,3).
runner_case(max, -3, arithmetic, eqless, 'Corr.2 9.3.8, ISO 3') :-
3.0 is max(3.0,2).
runner_case(max, -3, arithmetic, eqless, 'Corr.2 9.3.8, XLOG 1') :-
-1024 is max(-1048576,-1024).
runner_case(max, -3, arithmetic, eqless, 'Corr.2 9.3.8, XLOG 2') :-
catch(3.0 is max(2.0,_), error(E, _), true),
E == instantiation_error.