%%% KL1-B Test for B_Arithmetic (Exception) %%%
% B_Add %%%%%%%%%%%%%%%%% abcdefghijklmn
% B_Subtract %%%%%%%%%%%% abcdefghijklmn
% B_Multiply %%%%%%%%%%%% abcdefghijklmn
% B_Divide %%%%%%%%%%%%%% abcdefghijklmn
% B_Modulo %%%%%%%%%%%%%% abcdefghijklm
% B_Minus %%%%%%%%%%%%%%% abcdefg
% B_Increment %%%%%%%%%%% abcdefg
% B_Decrement %%%%%%%%%%% abcdefg

:- module b_arith_e.
:- public go/0
,do_add/3,do_subtract/3,do_multiply/3,do_divide/3,do_modulo/3,do_minus/2,do_increment/2,do_decrement/2.

go:- put_console(ascii#"%%% KL1-B Test for B_Arithmetic (Exception) %%%"), put_console(key#lf) | add.

add:- put_console(ascii#"% B_Add %%%%%%%%%%%%%%%%% ") | add00.

add00:- true | execute_in_shoen(do_add,{16#"7FFFFFFF",0,Z},R), add00(R,Z).
add00(success,_):- put_console(c#"a") | add01.
otherwise.
add00(_,_):- put_console(c#"*") | add01.

add01:- true | execute_in_shoen(do_add,{16#"7FFFFFFF",1,Z},R), add01(R,Z).
add01(integer_overflow,_):- put_console(c#"b") | add02.
otherwise.
add01(_,_):- put_console(c#"*") | add02.

add02:- true | execute_in_shoen(do_add,{16#"80000000",0,Z},R), add02(R,Z).
add02(success,_):- put_console(c#"c") | add03.
otherwise.
add02(_,_):- put_console(c#"*") | add03.

add03:- true | execute_in_shoen(do_add,{16#"80000000",-1,Z},R), add03(R,Z).
add03(integer_overflow,_):- put_console(c#"d") | add04.
otherwise.
add03(_,_):- put_console(c#"*") | add04.

add04:- true | execute_in_shoen(do_add,{0,atom,Z},R), add04(R,Z).
add04(illegal_input,_):- put_console(c#"e") | add05.
otherwise.
add04(_,_):- put_console(c#"*") | add05.

add05:- true | execute_in_shoen(do_add,{0,12.34,Z},R), add05(R,Z).
add05(illegal_input,_):- put_console(c#"f") | add06.
otherwise.
add05(_,_):- put_console(c#"*") | add06.

add06:- true | execute_in_shoen(do_add,{0,[list],Z},R), add06(R,Z).
add06(illegal_input,_):- put_console(c#"g") | add07.
otherwise.
add06(_,_):- put_console(c#"*") | add07.

add07:- true | execute_in_shoen(do_add,{0,{0,1},Z},R), add07(R,Z).
add07(illegal_input,_):- put_console(c#"h") | add08.
otherwise.
add07(_,_):- put_console(c#"*") | add08.

add08:- true | execute_in_shoen(do_add,{0,ascii#"String",Z},R), add08(R,Z).
add08(illegal_input,_):- put_console(c#"i") | add09.
otherwise.
add08(_,_):- put_console(c#"*") | add09.

add09:- true | execute_in_shoen(do_add,{atom,0,Z},R), add09(R,Z).
add09(illegal_input,_):- put_console(c#"j") | add10.
otherwise.
add09(_,_):- put_console(c#"*") | add10.

add10:- true | execute_in_shoen(do_add,{12.34,0,Z},R), add10(R,Z).
add10(illegal_input,_):- put_console(c#"k") | add11.
otherwise.
add10(_,_):- put_console(c#"*") | add11.

add11:- true | execute_in_shoen(do_add,{[list],0,Z},R), add11(R,Z).
add11(illegal_input,_):- put_console(c#"l") | add12.
otherwise.
add11(_,_):- put_console(c#"*") | add12.

add12:- true | execute_in_shoen(do_add,{{0,1},0,Z},R), add12(R,Z).
add12(illegal_input,_):- put_console(c#"m") | add13.
otherwise.
add12(_,_):- put_console(c#"*") | add13.

add13:- true | execute_in_shoen(do_add,{ascii#"String",0,Z},R), add13(R,Z).
add13(illegal_input,_):- put_console(c#"n") | add14.
otherwise.
add13(_,_):- put_console(c#"*") | add14.

add14:- put_console(key#lf) | sub.

sub:- put_console(ascii#"% B_Subtract %%%%%%%%%%%% ") | sub00.

sub00:- true | execute_in_shoen(do_subtract,{16#"7FFFFFFF",0,Z},R), sub00(R,Z).
sub00(success,_):- put_console(c#"a") | sub01.
otherwise.
sub00(_,_):- put_console(c#"*") | sub01.

sub01:- true | execute_in_shoen(do_subtract,{16#"7FFFFFFF",-1,Z},R), sub01(R,Z).
sub01(integer_overflow,_):- put_console(c#"b") | sub02.
otherwise.
sub01(_,_):- put_console(c#"*") | sub02.

sub02:- true | execute_in_shoen(do_subtract,{16#"80000000",0,Z},R), sub02(R,Z).
sub02(success,_):- put_console(c#"c") | sub03.
otherwise.
sub02(_,_):- put_console(c#"*") | sub03.

sub03:- true | execute_in_shoen(do_subtract,{16#"80000000",1,Z},R), sub03(R,Z).
sub03(integer_overflow,_):- put_console(c#"d") | sub04.
otherwise.
sub03(_,_):- put_console(c#"*") | sub04.

sub04:- true | execute_in_shoen(do_subtract,{0,atom,Z},R), sub04(R,Z).
sub04(illegal_input,_):- put_console(c#"e") | sub05.
otherwise.
sub04(_,_):- put_console(c#"*") | sub05.

sub05:- true | execute_in_shoen(do_subtract,{0,12.34,Z},R), sub05(R,Z).
sub05(illegal_input,_):- put_console(c#"f") | sub06.
otherwise.
sub05(_,_):- put_console(c#"*") | sub06.

sub06:- true | execute_in_shoen(do_subtract,{0,[list],Z},R), sub06(R,Z).
sub06(illegal_input,_):- put_console(c#"g") | sub07.
otherwise.
sub06(_,_):- put_console(c#"*") | sub07.

sub07:- true | execute_in_shoen(do_subtract,{0,{0,1},Z},R), sub07(R,Z).
sub07(illegal_input,_):- put_console(c#"h") | sub08.
otherwise.
sub07(_,_):- put_console(c#"*") | sub08.

sub08:- true | execute_in_shoen(do_subtract,{0,ascii#"String",Z},R), sub08(R,Z).
sub08(illegal_input,_):- put_console(c#"i") | sub09.
otherwise.
sub08(_,_):- put_console(c#"*") | sub09.

sub09:- true | execute_in_shoen(do_subtract,{atom,0,Z},R), sub09(R,Z).
sub09(illegal_input,_):- put_console(c#"j") | sub10.
otherwise.
sub09(_,_):- put_console(c#"*") | sub10.

sub10:- true | execute_in_shoen(do_subtract,{12.34,0,Z},R), sub10(R,Z).
sub10(illegal_input,_):- put_console(c#"k") | sub11.
otherwise.
sub10(_,_):- put_console(c#"*") | sub11.

sub11:- true | execute_in_shoen(do_subtract,{[list],0,Z},R), sub11(R,Z).
sub11(illegal_input,_):- put_console(c#"l") | sub12.
otherwise.
sub11(_,_):- put_console(c#"*") | sub12.

sub12:- true | execute_in_shoen(do_subtract,{{0,1},0,Z},R), sub12(R,Z).
sub12(illegal_input,_):- put_console(c#"m") | sub13.
otherwise.
sub12(_,_):- put_console(c#"*") | sub13.

sub13:- true | execute_in_shoen(do_subtract,{ascii#"String",0,Z},R), sub13(R,Z).
sub13(illegal_input,_):- put_console(c#"n") | sub14.
otherwise.
sub13(_,_):- put_console(c#"*") | sub14.

sub14:- put_console(key#lf) | mul.

mul:- put_console(ascii#"% B_Multiply %%%%%%%%%%%% ") | mul00.

mul00:- true | execute_in_shoen(do_multiply,{16#"7FFFFFFF",16#"7FFFFFFF",Z},R), mul00(R,Z).
mul00(integer_overflow,_):- put_console(c#"a") | mul01.
otherwise.
mul00(_,_):- put_console(c#"*") | mul01.

mul01:- true | execute_in_shoen(do_multiply,{16#"7FFFFFFF",16#"80000000",Z},R), mul01(R,Z).
mul01(integer_overflow,_):- put_console(c#"b") | mul02.
otherwise.
mul01(_,_):- put_console(c#"*") | mul02.

mul02:- true | execute_in_shoen(do_multiply,{16#"7FFFFFFF",1,Z},R), mul02(R,Z).
mul02(success,_):- put_console(c#"c") | mul03.
otherwise.
mul02(_,_):- put_console(c#"*") | mul03.

mul03:- true | execute_in_shoen(do_multiply,{16#"80000000",1,Z},R), mul03(R,Z).
mul03(success,_):- put_console(c#"d") | mul04.
otherwise.
mul03(_,_):- put_console(c#"*") | mul04.

mul04:- true | execute_in_shoen(do_multiply,{0,atom,Z},R), mul04(R,Z).
mul04(illegal_input,_):- put_console(c#"e") | mul05.
otherwise.
mul04(_,_):- put_console(c#"*") | mul05.

mul05:- true | execute_in_shoen(do_multiply,{0,12.34,Z},R), mul05(R,Z).
mul05(illegal_input,_):- put_console(c#"f") | mul06.
otherwise.
mul05(_,_):- put_console(c#"*") | mul06.

mul06:- true | execute_in_shoen(do_multiply,{0,[list],Z},R), mul06(R,Z).
mul06(illegal_input,_):- put_console(c#"g") | mul07.
otherwise.
mul06(_,_):- put_console(c#"*") | mul07.

mul07:- true | execute_in_shoen(do_multiply,{0,{0,1},Z},R), mul07(R,Z).
mul07(illegal_input,_):- put_console(c#"h") | mul08.
otherwise.
mul07(_,_):- put_console(c#"*") | mul08.

mul08:- true | execute_in_shoen(do_multiply,{0,ascii#"String",Z},R), mul08(R,Z).
mul08(illegal_input,_):- put_console(c#"i") | mul09.
otherwise.
mul08(_,_):- put_console(c#"*") | mul09.

mul09:- true | execute_in_shoen(do_multiply,{atom,0,Z},R), mul09(R,Z).
mul09(illegal_input,_):- put_console(c#"j") | mul10.
otherwise.
mul09(_,_):- put_console(c#"*") | mul10.

mul10:- true | execute_in_shoen(do_multiply,{12.34,0,Z},R), mul10(R,Z).
mul10(illegal_input,_):- put_console(c#"k") | mul11.
otherwise.
mul10(_,_):- put_console(c#"*") | mul11.

mul11:- true | execute_in_shoen(do_multiply,{[list],0,Z},R), mul11(R,Z).
mul11(illegal_input,_):- put_console(c#"l") | mul12.
otherwise.
mul11(_,_):- put_console(c#"*") | mul12.

mul12:- true | execute_in_shoen(do_multiply,{{0,1},0,Z},R), mul12(R,Z).
mul12(illegal_input,_):- put_console(c#"m") | mul13.
otherwise.
mul12(_,_):- put_console(c#"*") | mul13.

mul13:- true | execute_in_shoen(do_multiply,{ascii#"String",0,Z},R), mul13(R,Z).
mul13(illegal_input,_):- put_console(c#"n") | mul14.
otherwise.
mul13(_,_):- put_console(c#"*") | mul14.

mul14:- put_console(key#lf) | div.

div:- put_console(ascii#"% B_Divide %%%%%%%%%%%%%% ") | div00.

div00:- true | execute_in_shoen(do_divide,{16#"7FFFFFFF",1,Z},R), div00(R,Z).
div00(success,_):- put_console(c#"a") | div01.
otherwise.
div00(_,_):- put_console(c#"*") | div01.

div01:- true | execute_in_shoen(do_divide,{16#"80000000",1,Z},R), div01(R,Z).
div01(success,_):- put_console(c#"b") | div02.
otherwise.
div01(_,_):- put_console(c#"*") | div02.

div02:- true | execute_in_shoen(do_divide,{16#"80000000",-1,Z},R), div02(R,Z).
div02(integer_overflow,_):- put_console(c#"c") | div03.
otherwise.
div02(_,_):- put_console(c#"*") | div03.

div03:- true | execute_in_shoen(do_divide,{0,atom,Z},R), div03(R,Z).
div03(illegal_input,_):- put_console(c#"d") | div04.
otherwise.
div03(_,_):- put_console(c#"*") | div04.

div04:- true | execute_in_shoen(do_divide,{0,12.34,Z},R), div04(R,Z).
div04(illegal_input,_):- put_console(c#"e") | div05.
otherwise.
div04(_,_):- put_console(c#"*") | div05.

div05:- true | execute_in_shoen(do_divide,{0,[list],Z},R), div05(R,Z).
div05(illegal_input,_):- put_console(c#"f") | div06.
otherwise.
div05(_,_):- put_console(c#"*") | div06.

div06:- true | execute_in_shoen(do_divide,{0,{0,1},Z},R), div06(R,Z).
div06(illegal_input,_):- put_console(c#"g") | div07.
otherwise.
div06(_,_):- put_console(c#"*") | div07.

div07:- true | execute_in_shoen(do_divide,{0,ascii#"String",Z},R), div07(R,Z).
div07(illegal_input,_):- put_console(c#"h") | div08.
otherwise.
div07(_,_):- put_console(c#"*") | div08.

div08:- true | execute_in_shoen(do_divide,{1,0,Z},R), div08(R,Z).
div08(range_overflow,_):- put_console(c#"i") | div09.
otherwise.
div08(_,_):- put_console(c#"*") | div09.

div09:- true | execute_in_shoen(do_divide,{atom,0,Z},R), div09(R,Z).
div09(illegal_input,_):- put_console(c#"j") | div10.
otherwise.
div09(_,_):- put_console(c#"*") | div10.

div10:- true | execute_in_shoen(do_divide,{12.34,0,Z},R), div10(R,Z).
div10(illegal_input,_):- put_console(c#"k") | div11.
otherwise.
div10(_,_):- put_console(c#"*") | div11.

div11:- true | execute_in_shoen(do_divide,{[list],0,Z},R), div11(R,Z).
div11(illegal_input,_):- put_console(c#"l") | div12.
otherwise.
div11(_,_):- put_console(c#"*") | div12.

div12:- true | execute_in_shoen(do_divide,{{0,1},0,Z},R), div12(R,Z).
div12(illegal_input,_):- put_console(c#"m") | div13.
otherwise.
div12(_,_):- put_console(c#"*") | div13.

div13:- true | execute_in_shoen(do_divide,{ascii#"String",0,Z},R), div13(R,Z).
div13(illegal_input,_):- put_console(c#"n") | div14.
otherwise.
div13(_,_):- put_console(c#"*") | div14.

div14:- put_console(key#lf) | mod.

mod:- put_console(ascii#"% B_Modulo %%%%%%%%%%%%%% ") | mod00.

mod00:- true | execute_in_shoen(do_modulo,{16#"7FFFFFFF",1,Z},R), mod00(R,Z).
mod00(success,_):- put_console(c#"a") | mod01.
otherwise.
mod00(_,_):- put_console(c#"*") | mod01.

mod01:- true | execute_in_shoen(do_modulo,{16#"80000000",1,Z},R), mod01(R,Z).
mod01(success,_):- put_console(c#"b") | mod02.
otherwise.
mod01(_,_):- put_console(c#"*") | mod02.

mod02:- true | execute_in_shoen(do_modulo,{0,atom,Z},R), mod02(R,Z).
mod02(illegal_input,_):- put_console(c#"c") | mod03.
otherwise.
mod02(_,_):- put_console(c#"*") | mod03.

mod03:- true | execute_in_shoen(do_modulo,{0,12.34,Z},R), mod03(R,Z).
mod03(illegal_input,_):- put_console(c#"d") | mod04.
otherwise.
mod03(_,_):- put_console(c#"*") | mod04.

mod04:- true | execute_in_shoen(do_modulo,{0,[list],Z},R), mod04(R,Z).
mod04(illegal_input,_):- put_console(c#"e") | mod05.
otherwise.
mod04(_,_):- put_console(c#"*") | mod05.

mod05:- true | execute_in_shoen(do_modulo,{0,{0,1},Z},R), mod05(R,Z).
mod05(illegal_input,_):- put_console(c#"f") | mod06.
otherwise.
mod05(_,_):- put_console(c#"*") | mod06.

mod06:- true | execute_in_shoen(do_modulo,{0,ascii#"String",Z},R), mod06(R,Z).
mod06(illegal_input,_):- put_console(c#"g") | mod07.
otherwise.
mod06(_,_):- put_console(c#"*") | mod07.

mod07:- true | execute_in_shoen(do_modulo,{1,0,Z},R), mod07(R,Z).
mod07(range_overflow,_):- put_console(c#"h") | mod08.
otherwise.
mod07(_,_):- put_console(c#"*") | mod08.

mod08:- true | execute_in_shoen(do_modulo,{atom,0,Z},R), mod08(R,Z).
mod08(illegal_input,_):- put_console(c#"i") | mod09.
otherwise.
mod08(_,_):- put_console(c#"*") | mod09.

mod09:- true | execute_in_shoen(do_modulo,{12.34,0,Z},R), mod09(R,Z).
mod09(illegal_input,_):- put_console(c#"j") | mod10.
otherwise.
mod09(_,_):- put_console(c#"*") | mod10.

mod10:- true | execute_in_shoen(do_modulo,{[list],0,Z},R), mod10(R,Z).
mod10(illegal_input,_):- put_console(c#"k") | mod11.
otherwise.
mod10(_,_):- put_console(c#"*") | mod11.

mod11:- true | execute_in_shoen(do_modulo,{{0,1},0,Z},R), mod11(R,Z).
mod11(illegal_input,_):- put_console(c#"l") | mod12.
otherwise.
mod11(_,_):- put_console(c#"*") | mod12.

mod12:- true | execute_in_shoen(do_modulo,{ascii#"String",0,Z},R), mod12(R,Z).
mod12(illegal_input,_):- put_console(c#"m") | mod13.
otherwise.
mod12(_,_):- put_console(c#"*") | mod13.

mod13:- put_console(key#lf) | min.

min:- put_console(ascii#"% B_Minus %%%%%%%%%%%%%%% ") | min00.

min00:- true | execute_in_shoen(do_minus,{16#"7FFFFFFF",Z},R), min00(R,Z).
min00(success,_):- put_console(c#"a") | min01.
otherwise.
min00(_,_):- put_console(c#"*") | min01.

min01:- true | execute_in_shoen(do_minus,{16#"80000000",Z},R), min01(R,Z).
min01(integer_overflow,_):- put_console(c#"b") | min02.
otherwise.
min01(_,_):- put_console(c#"*") | min02.

min02:- true | execute_in_shoen(do_minus,{atom,Z},R), min02(R,Z).
min02(illegal_input,_):- put_console(c#"c") | min03.
otherwise.
min02(_,_):- put_console(c#"*") | min03.

min03:- true | execute_in_shoen(do_minus,{12.34,Z},R), min03(R,Z).
min03(illegal_input,_):- put_console(c#"d") | min04.
otherwise.
min03(_,_):- put_console(c#"*") | min04.

min04:- true | execute_in_shoen(do_minus,{[list],Z},R), min04(R,Z).
min04(illegal_input,_):- put_console(c#"e") | min05.
otherwise.
min04(_,_):- put_console(c#"*") | min05.

min05:- true | execute_in_shoen(do_minus,{{0,1},Z},R), min05(R,Z).
min05(illegal_input,_):- put_console(c#"f") | min06.
otherwise.
min05(_,_):- put_console(c#"*") | min06.

min06:- true | execute_in_shoen(do_minus,{ascii#"String",Z},R), min06(R,Z).
min06(illegal_input,_):- put_console(c#"g") | min07.
otherwise.
min06(_,_):- put_console(c#"*") | min07.

min07:- put_console(key#lf) | inc.

inc:- put_console(ascii#"% B_Increment %%%%%%%%%%% ") | inc00.

inc00:- true | execute_in_shoen(do_increment,{16#"7FFFFFFF",Z},R), inc00(R,Z).
inc00(integer_overflow,_):- put_console(c#"a") | inc01.
otherwise.
inc00(_,_):- put_console(c#"*") | inc01.

inc01:- true | execute_in_shoen(do_increment,{16#"80000000",Z},R), inc01(R,Z).
inc01(success,_):- put_console(c#"b") | inc02.
otherwise.
inc01(_,_):- put_console(c#"*") | inc02.

inc02:- true | execute_in_shoen(do_increment,{atom,Z},R), inc02(R,Z).
inc02(illegal_input,_):- put_console(c#"c") | inc03.
otherwise.
inc02(_,_):- put_console(c#"*") | inc03.

inc03:- true | execute_in_shoen(do_increment,{12.34,Z},R), inc03(R,Z).
inc03(illegal_input,_):- put_console(c#"d") | inc04.
otherwise.
inc03(_,_):- put_console(c#"*") | inc04.

inc04:- true | execute_in_shoen(do_increment,{[list],Z},R), inc04(R,Z).
inc04(illegal_input,_):- put_console(c#"e") | inc05.
otherwise.
inc04(_,_):- put_console(c#"*") | inc05.

inc05:- true | execute_in_shoen(do_increment,{{0,1},Z},R), inc05(R,Z).
inc05(illegal_input,_):- put_console(c#"f") | inc06.
otherwise.
inc05(_,_):- put_console(c#"*") | inc06.

inc06:- true | execute_in_shoen(do_increment,{ascii#"String",Z},R), inc06(R,Z).
inc06(illegal_input,_):- put_console(c#"g") | inc07.
otherwise.
inc06(_,_):- put_console(c#"*") | inc07.

inc07:- put_console(key#lf) | dec.

dec:- put_console(ascii#"% B_Decrement %%%%%%%%%%% ") | dec00.

dec00:- true | execute_in_shoen(do_decrement,{16#"7FFFFFFF",Z},R), dec00(R,Z).
dec00(success,_):- put_console(c#"a") | dec01.
otherwise.
dec00(_,_):- put_console(c#"*") | dec01.

dec01:- true | execute_in_shoen(do_decrement,{16#"80000000",Z},R), dec01(R,Z).
dec01(integer_overflow,_):- put_console(c#"b") | dec02.
otherwise.
dec01(_,_):- put_console(c#"*") | dec02.

dec02:- true | execute_in_shoen(do_decrement,{atom,Z},R), dec02(R,Z).
dec02(illegal_input,_):- put_console(c#"c") | dec03.
otherwise.
dec02(_,_):- put_console(c#"*") | dec03.

dec03:- true | execute_in_shoen(do_decrement,{12.34,Z},R), dec03(R,Z).
dec03(illegal_input,_):- put_console(c#"d") | dec04.
otherwise.
dec03(_,_):- put_console(c#"*") | dec04.

dec04:- true | execute_in_shoen(do_decrement,{[list],Z},R), dec04(R,Z).
dec04(illegal_input,_):- put_console(c#"e") | dec05.
otherwise.
dec04(_,_):- put_console(c#"*") | dec05.

dec05:- true | execute_in_shoen(do_decrement,{{0,1},Z},R), dec05(R,Z).
dec05(illegal_input,_):- put_console(c#"f") | dec06.
otherwise.
dec05(_,_):- put_console(c#"*") | dec06.

dec06:- true | execute_in_shoen(do_decrement,{ascii#"String",Z},R), dec06(R,Z).
dec06(illegal_input,_):- put_console(c#"g") | dec07.
otherwise.
dec06(_,_):- put_console(c#"*") | dec07.

dec07:- put_console(key#lf) | done.

done:- true | true.

execute_in_shoen(P,A,R):- vector(A,L) |
	'Sho-en':execute({b_arith_e,P,L},A, 0,0, -1, C0,R0),
	C0 = [add_resource(100),start|C],
	shoen_wait(R0,R,C).

shoen_wait([resource_added,started|R0],R,C):- true | shoen_check(R0,R,C).

shoen_check([terminated|_],R,C):- true |
	R=success, C=[].
shoen_check([exception(0,_,NewCode,NewArgv)|_],R,C):- true |
	NewCode=[], R=illegal_input, C=[abort].
shoen_check([exception(1,_,NewCode,NewArgv)|_],R,C):- true |
	NewCode=[], R=range_overflow, C=[abort].
shoen_check([exception(3,_,NewCode,NewArgv)|_],R,C):- true |
	NewCode=[], R=integer_overflow, C=[abort].

do_add(X,Y,Z):- true | Z:=X+Y.
do_subtract(X,Y,Z):- true | Z:=X-Y.
do_multiply(X,Y,Z):- true | Z:=X*Y.
do_divide(X,Y,Z):- true | Z:=X/Y.
do_modulo(X,Y,Z):- true | Z:=X mod Y.
do_minus(X,Z):- true | Z:= -X.
do_increment(X,Z):- true | Z:=X+1.
do_decrement(X,Z):- true | Z:=X-1.
