:- module(guard_entailment, [ entails_guard/2, simplify_guards/5 ]). :- include(chr_op). :- use_module(hprolog). :- use_module(builtins). :- use_module(chr_compiler_errors). :- chr_option(debug, off). :- chr_option(optimize, full). :- chr_option(verbosity,off). %:- chr_option(dynattr,on). :- chr_constraint known/1, test/1, cleanup/0, variables/1. entails_guard(A, B) :- copy_term_nat((A, B), (C, F)), term_variables(C, D), variables(D), sort(C, E), entails_guard2(E), !, test(F), !, cleanup. entails_guard2([]). entails_guard2([A|B]) :- known(A), entails_guard2(B). simplify_guards(A, H, B, G, I) :- copy_term_nat((A, B), (C, E)), term_variables(C, D), variables(D), sort(C,Z), entails_guard2(Z), !, simplify(E, F), simplified(B, F, G, H, I), !, cleanup. simplified([], [], [], A, A). simplified([A|B], [keep|C], [A|D], E, F) :- simplified(B, C, D, E, F). simplified([_|_], [fail|_], fail, A, A). simplified([A|B], [true|L], [I|M], F, J) :- builtins:binds_b(A, C), term_variables(B, D), intersect_eq(C, D, E), !, ( E=[] -> term_variables(F, G), intersect_eq(C, G, H), !, ( H=[] -> I=true, J=K ; I=true, J= (A, K) ) ; I=A, J=K ), simplified(B, L, M, F, K). simplify([], []). simplify([A|D], [B|E]) :- ( \+try(true, A) -> B=true ; builtins:negate_b(A, C), ( \+try(true, C) -> B=fail ; B=keep ) ), known(A), simplify(D, E). try(A, B) :- ( known(A) -> true ; chr_error(internal, 'Entailment Checker: try/2.\n', []) ), ( test(B) -> fail ; true ). add_args_unif([], [], true). add_args_unif([A|C], [B|D], (A=B, E)) :- add_args_unif(C, D, E). add_args_nunif([], [], fail). add_args_nunif([A|C], [B|D], (A\=B;E)) :- add_args_nunif(C, D, E). add_args_nmatch([], [], fail). add_args_nmatch([A|C], [B|D], (A\==B;E)) :- add_args_nmatch(C, D, E). all_unique_vars(A, B) :- all_unique_vars(A, B, []). all_unique_vars([], _, _). all_unique_vars([A|D], B, C) :- var(A), \+memberchk_eq(A, B), \+memberchk_eq(A, C), all_unique_vars(D, [A|C]). :- chr_constraint'test/1_1_$default'/1, 'test/1_1_$special_,/2'/2, 'test/1_1_$special_\\+/1'/1, 'test/1_1_$special_integer/1'/1, 'test/1_1_$special_float/1'/1, 'test/1_1_$special_number/1'/1, 'test/1_1_$special_ground/1'/1, 'test/1_1_$special_=:=/2'/2, 'test/1_1_$special_==/2'/2, 'test/1_1_$special_true/0'/0, 'test/1_1_$special_functor/3'/3, 'test/1_1_$special_=/2'/2, 'test/1_1_$special_;/2'/2, 'test/1_1_$special_is/2'/2, 'test/1_1_$special_=/2'/2, 'test/1_1_$special_>/2'/2, 'test/1_1_$special_=\\=/2'/2, 'test/1_1_$special_==/2'/2, 'known/1_1_$special_>/2'/2, 'known/1_1_$special_='test/1_1_$special_,/2'(A, B). test(\+A)<=>'test/1_1_$special_\\+/1'(A). test(integer(A))<=>'test/1_1_$special_integer/1'(A). test(float(A))<=>'test/1_1_$special_float/1'(A). test(number(A))<=>'test/1_1_$special_number/1'(A). test(ground(A))<=>'test/1_1_$special_ground/1'(A). test(A=:=B)<=>'test/1_1_$special_=:=/2'(A, B). test(A==B)<=>'test/1_1_$special_==/2'(A, B). test(true)<=>'test/1_1_$special_true/0'. test(functor(A, B, C))<=>'test/1_1_$special_functor/3'(A, B, C). test(A=B)<=>'test/1_1_$special_=/2'(A, B). test((A;B))<=>'test/1_1_$special_;/2'(A, B). test(A is B)<=>'test/1_1_$special_is/2'(A, B). test(A'test/1_1_$special_=B)<=>'test/1_1_$special_>=/2'(A, B). test(A>B)<=>'test/1_1_$special_>/2'(A, B). test(A=\=B)<=>'test/1_1_$special_=\\=/2'(A, B). test(A='test/1_1_$special_='test/1_1_$special_\\==/2'(A, B). test(A)<=>'test/1_1_$default'(A). known((A;B))<=>'known/1_1_$special_;/2'(A, B). known(nonvar(A))<=>'known/1_1_$special_nonvar/1'(A). known(var(A))<=>'known/1_1_$special_var/1'(A). known(atom(A))<=>'known/1_1_$special_atom/1'(A). known(atomic(A))<=>'known/1_1_$special_atomic/1'(A). known(compound(A))<=>'known/1_1_$special_compound/1'(A). known(ground(A))<=>'known/1_1_$special_ground/1'(A). known(integer(A))<=>'known/1_1_$special_integer/1'(A). known(float(A))<=>'known/1_1_$special_float/1'(A). known(number(A))<=>'known/1_1_$special_number/1'(A). known(A=\=B)<=>'known/1_1_$special_=\\=/2'(A, B). known(\+A)<=>'known/1_1_$special_\\+/1'(A). known(functor(A, B, C))<=>'known/1_1_$special_functor/3'(A, B, C). known(A\=B)<=>'known/1_1_$special_\\=/2'(A, B). known(A=B)<=>'known/1_1_$special_=/2'(A, B). known((A, B))<=>'known/1_1_$special_,/2'(A, B). known(A\==B)<=>'known/1_1_$special_\\==/2'(A, B). known(A==B)<=>'known/1_1_$special_==/2'(A, B). known(A is B)<=>'known/1_1_$special_is/2'(A, B). known(A'known/1_1_$special_=B)<=>'known/1_1_$special_>=/2'(A, B). known(A>B)<=>'known/1_1_$special_>/2'(A, B). known(A='known/1_1_$special_='known/1_1_$special_=:=/2'(A, B). known(fail)<=>'known/1_1_$special_fail/0'. known(A)<=>'known/1_1_$default'(A). 'known/1_1_$special_;/2'(A, B)\'known/1_1_$special_;/2'(A, B)<=>true. 'known/1_1_$special_nonvar/1'(A)\'known/1_1_$special_nonvar/1'(A)<=>true. 'known/1_1_$special_var/1'(A)\'known/1_1_$special_var/1'(A)<=>true. 'known/1_1_$special_atom/1'(A)\'known/1_1_$special_atom/1'(A)<=>true. 'known/1_1_$special_atomic/1'(A)\'known/1_1_$special_atomic/1'(A)<=>true. 'known/1_1_$special_compound/1'(A)\'known/1_1_$special_compound/1'(A)<=>true. 'known/1_1_$special_ground/1'(A)\'known/1_1_$special_ground/1'(A)<=>true. 'known/1_1_$special_integer/1'(A)\'known/1_1_$special_integer/1'(A)<=>true. 'known/1_1_$special_float/1'(A)\'known/1_1_$special_float/1'(A)<=>true. 'known/1_1_$special_number/1'(A)\'known/1_1_$special_number/1'(A)<=>true. 'known/1_1_$special_=\\=/2'(A, B)\'known/1_1_$special_=\\=/2'(A, B)<=>true. 'known/1_1_$special_\\+/1'(A)\'known/1_1_$special_\\+/1'(A)<=>true. 'known/1_1_$special_functor/3'(A, B, C)\'known/1_1_$special_functor/3'(A, B, C)<=>true. 'known/1_1_$special_\\=/2'(A, B)\'known/1_1_$special_\\=/2'(A, B)<=>true. 'known/1_1_$special_=/2'(A, B)\'known/1_1_$special_=/2'(A, B)<=>true. 'known/1_1_$special_,/2'(A, B)\'known/1_1_$special_,/2'(A, B)<=>true. 'known/1_1_$special_\\==/2'(A, B)\'known/1_1_$special_\\==/2'(A, B)<=>true. 'known/1_1_$special_==/2'(A, B)\'known/1_1_$special_==/2'(A, B)<=>true. 'known/1_1_$special_is/2'(A, B)\'known/1_1_$special_is/2'(A, B)<=>true. 'known/1_1_$special_true. 'known/1_1_$special_>=/2'(A, B)\'known/1_1_$special_>=/2'(A, B)<=>true. 'known/1_1_$special_>/2'(A, B)\'known/1_1_$special_>/2'(A, B)<=>true. 'known/1_1_$special_=true. 'known/1_1_$special_=:=/2'(A, B)\'known/1_1_$special_=:=/2'(A, B)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_fail/0'<=>true. 'known/1_1_$default'(A)\'known/1_1_$default'(A)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_,/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_\\+/1'(_)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_integer/1'(_)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_float/1'(_)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_number/1'(_)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_ground/1'(_)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_=:=/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_==/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_true/0'<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_functor/3'(_, _, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_=/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_;/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_is/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_true. 'known/1_1_$special_fail/0'\'test/1_1_$special_>=/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_>/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_=\\=/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$special_=true. 'known/1_1_$special_fail/0'\'test/1_1_$special_\\==/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$default'(_)<=>true. 'known/1_1_$special_;/2'(A, B)\'test/1_1_$special_;/2'(A, B)<=>true. 'known/1_1_$special_nonvar/1'(A)\'test/1_1_$default'(nonvar(A))<=>true. 'known/1_1_$special_var/1'(A)\'test/1_1_$default'(var(A))<=>true. 'known/1_1_$special_atom/1'(A)\'test/1_1_$default'(atom(A))<=>true. 'known/1_1_$special_atomic/1'(A)\'test/1_1_$default'(atomic(A))<=>true. 'known/1_1_$special_compound/1'(A)\'test/1_1_$default'(compound(A))<=>true. 'known/1_1_$special_ground/1'(A)\'test/1_1_$special_ground/1'(A)<=>true. 'known/1_1_$special_integer/1'(A)\'test/1_1_$special_integer/1'(A)<=>true. 'known/1_1_$special_float/1'(A)\'test/1_1_$special_float/1'(A)<=>true. 'known/1_1_$special_number/1'(A)\'test/1_1_$special_number/1'(A)<=>true. 'known/1_1_$special_=\\=/2'(A, B)\'test/1_1_$special_=\\=/2'(A, B)<=>true. 'known/1_1_$special_\\+/1'(A)\'test/1_1_$special_\\+/1'(A)<=>true. 'known/1_1_$special_functor/3'(A, B, C)\'test/1_1_$special_functor/3'(A, B, C)<=>true. 'known/1_1_$special_\\=/2'(A, B)\'test/1_1_$default'(A\=B)<=>true. 'known/1_1_$special_=/2'(A, B)\'test/1_1_$special_=/2'(A, B)<=>true. 'known/1_1_$special_,/2'(A, B)\'test/1_1_$special_,/2'(A, B)<=>true. 'known/1_1_$special_\\==/2'(A, B)\'test/1_1_$special_\\==/2'(A, B)<=>true. 'known/1_1_$special_==/2'(A, B)\'test/1_1_$special_==/2'(A, B)<=>true. 'known/1_1_$special_is/2'(A, B)\'test/1_1_$special_is/2'(A, B)<=>true. 'known/1_1_$special_true. 'known/1_1_$special_>=/2'(A, B)\'test/1_1_$special_>=/2'(A, B)<=>true. 'known/1_1_$special_>/2'(A, B)\'test/1_1_$special_>/2'(A, B)<=>true. 'known/1_1_$special_=true. 'known/1_1_$special_=:=/2'(A, B)\'test/1_1_$special_=:=/2'(A, B)<=>true. 'known/1_1_$special_fail/0'\'test/1_1_$default'(fail)<=>true. 'known/1_1_$default'(A)\'test/1_1_$default'(A)<=>true. 'test/1_1_$special_\\==/2'(F, A)<=>nonvar(A), functor(A, C, B)|A=..[_|E], length(D, B), G=..[C|D], add_args_nmatch(D, E, H), I= (\+functor(F, C, B);functor(F, C, B), F=G, H), test(I). 'test/1_1_$special_\\==/2'(A, B)<=>nonvar(A)|'test/1_1_$special_\\==/2'(B, A). 'known/1_1_$special_=:=/2'(A, B)\'test/1_1_$special_=true. 'known/1_1_$special_=:=/2'(A, C)\'test/1_1_$special_=number(B), number(C), C=number(B), number(C), B=number(B), number(C), C=number(B), number(C), C=number(B), number(C), B>C|true. 'known/1_1_$special_=number(B), number(C), C/2'(B, A)<=>'known/1_1_$special_=/2'(B, A)<=>'known/1_1_$special_='known/1_1_$special_='known/1_1_$special_=:=/2'(A, B). 'test/1_1_$special_>/2'(B, A)<=>'test/1_1_$special_=/2'(B, A)<=>'test/1_1_$special_='test/1_1_$special_,/2'(A='test/1_1_$special_=:=/2'(A, B). 'known/1_1_$special_==/2'(A, B)==>number(A)|'known/1_1_$special_=:=/2'(A, B). 'known/1_1_$special_==/2'(B, A)==>number(A)|'known/1_1_$special_=:=/2'(B, A). 'known/1_1_$special_\\==/2'(A, B)==>number(A)|'known/1_1_$special_=\\=/2'(A, B). 'known/1_1_$special_\\==/2'(B, A)==>number(A)|'known/1_1_$special_=\\=/2'(B, A). 'known/1_1_$special_fail/0'\'known/1_1_$special_;/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_nonvar/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_var/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_atom/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_atomic/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_compound/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_ground/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_integer/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_float/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_number/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_=\\=/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_\\+/1'(_)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_functor/3'(_, _, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_\\=/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_=/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_,/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_\\==/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_==/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_is/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_true. 'known/1_1_$special_fail/0'\'known/1_1_$special_>=/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_>/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_=true. 'known/1_1_$special_fail/0'\'known/1_1_$special_=:=/2'(_, _)<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$special_fail/0'<=>true. 'known/1_1_$special_fail/0'\'known/1_1_$default'(_)<=>true. 'known/1_1_$special_,/2'(A, B)<=>known(A), known(B). 'known/1_1_$special_=:=/2'(A, A)<=>true. 'known/1_1_$special_==/2'(A, A)<=>true. 'known/1_1_$special_=true. 'known/1_1_$special_=/2'(A, A)<=>true. 'known/1_1_$special_=/2'(A, B)<=>var(A)|A=B. 'known/1_1_$special_=/2'(B, A)<=>var(A)|B=A. 'known/1_1_$special_\\=/2'(A, B)<=>ground(A), ground(B), A=B|'known/1_1_$special_fail/0'. variables(E), 'known/1_1_$special_functor/3'(A, B, C)<=>var(A), ground(B), ground(C)|functor(A, B, C), A=..[_|D], append(D, E, F), variables(F). 'known/1_1_$special_functor/3'(A, B, C)<=>nonvar(A), \+functor(A, B, C)|'known/1_1_$special_fail/0'. 'known/1_1_$special_\\+/1'(functor(A, B, C))<=>nonvar(A), functor(A, B, C)|'known/1_1_$special_fail/0'. 'known/1_1_$special_functor/3'(A, B, C), 'known/1_1_$special_functor/3'(A, D, E)<=>nonvar(B), nonvar(C), nonvar(D), nonvar(E)|'known/1_1_$special_fail/0'. 'known/1_1_$special_\\=/2'(A, A)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_=/2'(A, B)<=>nonvar(A), nonvar(B), functor(A, C, D)|functor(B, C, D), A=B->true;'known/1_1_$special_fail/0'. 'known/1_1_$special_\\=/2'(A, B)<=>var(A), nonvar(B), functor(B, D, C), C>0|length(E, C), B=..[D|F], G=..[D|E], add_args_nunif(F, E, H), I= (\+functor(A, D, C);A=G, H), known(I). 'known/1_1_$special_\\=/2'(A, B)<=>nonvar(A), nonvar(B), functor(A, C, D)|functor(B, C, D)->A=..[C|E], B=..[C|F], add_args_nunif(E, F, G), known(G);true. 'known/1_1_$special_\\=/2'(B, A)==>'known/1_1_$special_\\=/2'(A, B). 'known/1_1_$special_=number(A), number(B), A>B|'known/1_1_$special_fail/0'. 'known/1_1_$special_=number(B), number(C), B=number(B), number(C), B='known/1_1_$special_=:=/2'(B, A). 'known/1_1_$special_='known/1_1_$special_='known/1_1_$special_=\\=/2'(A, C). 'known/1_1_$special_=:=/2'(A, B)<=>number(A), number(B), A=\=B|'known/1_1_$special_fail/0'. 'known/1_1_$special_=\\=/2'(A, B)<=>number(A), number(B), A=:=B|'known/1_1_$special_fail/0'. 'known/1_1_$special_=\\=/2'(A, A)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_=:=/2'(A, B), 'known/1_1_$special_=\\=/2'(A, B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_=:=/2'(B, A), 'known/1_1_$special_=:=/2'(A, C)==>B\==C|'known/1_1_$special_=:=/2'(B, C). 'known/1_1_$special_=:=/2'(B, A)==>'known/1_1_$special_=:=/2'(A, B). 'known/1_1_$special_=\\=/2'(B, A)==>'known/1_1_$special_=\\=/2'(A, B). 'known/1_1_$special_number/1'(A)<=>nonvar(A), \+number(A)|'known/1_1_$special_fail/0'. 'known/1_1_$special_float/1'(A)<=>nonvar(A), \+float(A)|'known/1_1_$special_fail/0'. 'known/1_1_$special_integer/1'(A)<=>nonvar(A), \+integer(A)|'known/1_1_$special_fail/0'. 'known/1_1_$special_integer/1'(A)==>'known/1_1_$special_number/1'(A). 'known/1_1_$special_float/1'(A)==>'known/1_1_$special_number/1'(A). 'known/1_1_$special_;/2'(A, B), 'known/1_1_$special_\\+/1'((A;B))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_nonvar/1'(A), 'known/1_1_$special_\\+/1'(nonvar(A))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_var/1'(A), 'known/1_1_$special_\\+/1'(var(A))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_atom/1'(A), 'known/1_1_$special_\\+/1'(atom(A))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_atomic/1'(A), 'known/1_1_$special_\\+/1'(atomic(A))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_compound/1'(A), 'known/1_1_$special_\\+/1'(compound(A))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_ground/1'(A), 'known/1_1_$special_\\+/1'(ground(A))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_integer/1'(A), 'known/1_1_$special_\\+/1'(integer(A))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_float/1'(A), 'known/1_1_$special_\\+/1'(float(A))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_number/1'(A), 'known/1_1_$special_\\+/1'(number(A))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_=\\=/2'(A, B), 'known/1_1_$special_\\+/1'(A=\=B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_\\+/1'(A), 'known/1_1_$special_\\+/1'(\+A)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_functor/3'(A, B, C), 'known/1_1_$special_\\+/1'(functor(A, B, C))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_\\=/2'(A, B), 'known/1_1_$special_\\+/1'(A\=B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_=/2'(A, B), 'known/1_1_$special_\\+/1'(A=B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_,/2'(A, B), 'known/1_1_$special_\\+/1'((A, B))<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_\\==/2'(A, B), 'known/1_1_$special_\\+/1'(A\==B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_==/2'(A, B), 'known/1_1_$special_\\+/1'(A==B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_is/2'(A, B), 'known/1_1_$special_\\+/1'(A is B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_'known/1_1_$special_fail/0'. 'known/1_1_$special_>=/2'(A, B), 'known/1_1_$special_\\+/1'(A>=B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_>/2'(A, B), 'known/1_1_$special_\\+/1'(A>B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_='known/1_1_$special_fail/0'. 'known/1_1_$special_=:=/2'(A, B), 'known/1_1_$special_\\+/1'(A=:=B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_fail/0', 'known/1_1_$special_\\+/1'(fail)<=>'known/1_1_$special_fail/0'. 'known/1_1_$default'(A), 'known/1_1_$special_\\+/1'(A)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_\\==/2'(A, B), 'known/1_1_$special_==/2'(A, B)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_==/2'(B, A), 'known/1_1_$special_==/2'(A, C)==>'known/1_1_$special_==/2'(B, C). 'known/1_1_$special_==/2'(B, A), 'known/1_1_$special_\\==/2'(A, C)==>'known/1_1_$special_\\==/2'(B, C). 'known/1_1_$special_==/2'(B, A)==>'known/1_1_$special_==/2'(A, B). 'known/1_1_$special_\\==/2'(B, A)==>'known/1_1_$special_\\==/2'(A, B). 'known/1_1_$special_\\==/2'(A, A)==>'known/1_1_$special_fail/0'. 'known/1_1_$special_\\==/2'(A, B)<=>nonvar(A), nonvar(B), functor(A, C, D)|functor(B, C, D)->A=..[C|E], B=..[C|F], add_args_nmatch(E, F, G), known(G);true. 'known/1_1_$special_==/2'(A, B)==>'known/1_1_$special_=/2'(A, B). 'known/1_1_$special_ground/1'(A)==>'known/1_1_$special_nonvar/1'(A). 'known/1_1_$special_compound/1'(A)==>'known/1_1_$special_nonvar/1'(A). 'known/1_1_$special_atomic/1'(A)==>'known/1_1_$special_nonvar/1'(A). 'known/1_1_$special_number/1'(A)==>'known/1_1_$special_nonvar/1'(A). 'known/1_1_$special_atom/1'(A)==>'known/1_1_$special_nonvar/1'(A). 'known/1_1_$special_var/1'(A), 'known/1_1_$special_nonvar/1'(A)<=>'known/1_1_$special_fail/0'. 'known/1_1_$special_;/2'(A, B)\'known/1_1_$special_;/2'(\+ (A;B), C)<=>known(C). 'known/1_1_$special_nonvar/1'(A)\'known/1_1_$special_;/2'(\+nonvar(A), B)<=>known(B). 'known/1_1_$special_var/1'(A)\'known/1_1_$special_;/2'(\+var(A), B)<=>known(B). 'known/1_1_$special_atom/1'(A)\'known/1_1_$special_;/2'(\+atom(A), B)<=>known(B). 'known/1_1_$special_atomic/1'(A)\'known/1_1_$special_;/2'(\+atomic(A), B)<=>known(B). 'known/1_1_$special_compound/1'(A)\'known/1_1_$special_;/2'(\+compound(A), B)<=>known(B). 'known/1_1_$special_ground/1'(A)\'known/1_1_$special_;/2'(\+ground(A), B)<=>known(B). 'known/1_1_$special_integer/1'(A)\'known/1_1_$special_;/2'(\+integer(A), B)<=>known(B). 'known/1_1_$special_float/1'(A)\'known/1_1_$special_;/2'(\+float(A), B)<=>known(B). 'known/1_1_$special_number/1'(A)\'known/1_1_$special_;/2'(\+number(A), B)<=>known(B). 'known/1_1_$special_=\\=/2'(A, B)\'known/1_1_$special_;/2'(\+A=\=B, C)<=>known(C). 'known/1_1_$special_\\+/1'(A)\'known/1_1_$special_;/2'(\+ \+A, B)<=>known(B). 'known/1_1_$special_functor/3'(A, B, C)\'known/1_1_$special_;/2'(\+functor(A, B, C), D)<=>known(D). 'known/1_1_$special_\\=/2'(A, B)\'known/1_1_$special_;/2'(\+A\=B, C)<=>known(C). 'known/1_1_$special_=/2'(A, B)\'known/1_1_$special_;/2'(\+A=B, C)<=>known(C). 'known/1_1_$special_,/2'(A, B)\'known/1_1_$special_;/2'(\+ (A, B), C)<=>known(C). 'known/1_1_$special_\\==/2'(A, B)\'known/1_1_$special_;/2'(\+A\==B, C)<=>known(C). 'known/1_1_$special_==/2'(A, B)\'known/1_1_$special_;/2'(\+A==B, C)<=>known(C). 'known/1_1_$special_is/2'(A, B)\'known/1_1_$special_;/2'(\+A is B, C)<=>known(C). 'known/1_1_$special_known(C). 'known/1_1_$special_>=/2'(A, B)\'known/1_1_$special_;/2'(\+A>=B, C)<=>known(C). 'known/1_1_$special_>/2'(A, B)\'known/1_1_$special_;/2'(\+A>B, C)<=>known(C). 'known/1_1_$special_=known(C). 'known/1_1_$special_=:=/2'(A, B)\'known/1_1_$special_;/2'(\+A=:=B, C)<=>known(C). 'known/1_1_$special_fail/0'\'known/1_1_$special_;/2'(\+fail, A)<=>known(A). 'known/1_1_$default'(A)\'known/1_1_$special_;/2'(\+A, B)<=>known(B). 'known/1_1_$special_;/2'(A, B)\'known/1_1_$special_;/2'((\+ (A;B), _), C)<=>known(C). 'known/1_1_$special_nonvar/1'(A)\'known/1_1_$special_;/2'((\+nonvar(A), _), B)<=>known(B). 'known/1_1_$special_var/1'(A)\'known/1_1_$special_;/2'((\+var(A), _), B)<=>known(B). 'known/1_1_$special_atom/1'(A)\'known/1_1_$special_;/2'((\+atom(A), _), B)<=>known(B). 'known/1_1_$special_atomic/1'(A)\'known/1_1_$special_;/2'((\+atomic(A), _), B)<=>known(B). 'known/1_1_$special_compound/1'(A)\'known/1_1_$special_;/2'((\+compound(A), _), B)<=>known(B). 'known/1_1_$special_ground/1'(A)\'known/1_1_$special_;/2'((\+ground(A), _), B)<=>known(B). 'known/1_1_$special_integer/1'(A)\'known/1_1_$special_;/2'((\+integer(A), _), B)<=>known(B). 'known/1_1_$special_float/1'(A)\'known/1_1_$special_;/2'((\+float(A), _), B)<=>known(B). 'known/1_1_$special_number/1'(A)\'known/1_1_$special_;/2'((\+number(A), _), B)<=>known(B). 'known/1_1_$special_=\\=/2'(A, B)\'known/1_1_$special_;/2'((\+A=\=B, _), C)<=>known(C). 'known/1_1_$special_\\+/1'(A)\'known/1_1_$special_;/2'((\+ \+A, _), B)<=>known(B). 'known/1_1_$special_functor/3'(A, B, C)\'known/1_1_$special_;/2'((\+functor(A, B, C), _), D)<=>known(D). 'known/1_1_$special_\\=/2'(A, B)\'known/1_1_$special_;/2'((\+A\=B, _), C)<=>known(C). 'known/1_1_$special_=/2'(A, B)\'known/1_1_$special_;/2'((\+A=B, _), C)<=>known(C). 'known/1_1_$special_,/2'(A, B)\'known/1_1_$special_;/2'((\+ (A, B), _), C)<=>known(C). 'known/1_1_$special_\\==/2'(A, B)\'known/1_1_$special_;/2'((\+A\==B, _), C)<=>known(C). 'known/1_1_$special_==/2'(A, B)\'known/1_1_$special_;/2'((\+A==B, _), C)<=>known(C). 'known/1_1_$special_is/2'(A, B)\'known/1_1_$special_;/2'((\+A is B, _), C)<=>known(C). 'known/1_1_$special_known(C). 'known/1_1_$special_>=/2'(A, B)\'known/1_1_$special_;/2'((\+A>=B, _), C)<=>known(C). 'known/1_1_$special_>/2'(A, B)\'known/1_1_$special_;/2'((\+A>B, _), C)<=>known(C). 'known/1_1_$special_=known(C). 'known/1_1_$special_=:=/2'(A, B)\'known/1_1_$special_;/2'((\+A=:=B, _), C)<=>known(C). 'known/1_1_$special_fail/0'\'known/1_1_$special_;/2'((\+fail, _), A)<=>known(A). 'known/1_1_$default'(A)\'known/1_1_$special_;/2'((\+A, _), B)<=>known(B). 'known/1_1_$special_\\+/1'(A)\'known/1_1_$special_;/2'(A, B)<=>known(B). 'known/1_1_$special_\\+/1'(A)\'known/1_1_$special_;/2'((A, _), B)<=>known(B). 'known/1_1_$special_;/2'(fail, A)<=>known(A). 'known/1_1_$special_;/2'(A, fail)<=>known(A). 'known/1_1_$special_;/2'(true, _)<=>true. 'known/1_1_$special_;/2'(_, true)<=>true. 'known/1_1_$special_functor/3'(A, _, _)\'known/1_1_$special_;/2'(\+functor(A, _, _), _)<=>true. 'known/1_1_$special_;/2'(\+functor(A, B, C), D)<=>nonvar(A), functor(A, B, C)|known(D). 'known/1_1_$special_;/2'(\+functor(A, B, C), _)<=>nonvar(A), \+functor(A, B, C)|true. 'test/1_1_$special_;/2'(fail, A)<=>test(A). 'test/1_1_$special_;/2'(A, fail)<=>test(A). % 'test/1_1_$special_=/2'(A, B)<=>A=B|A=B. 'test/1_1_$special_=/2'(A, B)<=>ground(A), ground(B)|A=B. % 'test/1_1_$special_=/2'(A, B)<=>nonvar(A), var(B)|'test/1_1_$special_=/2'(B, A). % variables(F)\'test/1_1_$special_=/2'(A, B)<=>var(A), nonvar(B), functor(B, D, C), C>0, B=..[D|E], \+all_unique_vars(E, F)|G= (functor(A, D, C), A=B), test(G). % variables(F) \ 'test/1_1_$special_=/2'(A, B) <=> % var(A), % nonvar(B), % \+ memberchk_eq(A,F), % functor(B, C, D), % B=..[C|_] % | % E=functor(A, C, D), % test(E). % 'test/1_1_$special_=/2'(A, B)<=>nonvar(A), nonvar(B), functor(B, C, D), B=..[C|F]|functor(A, C, D), A=..[C|E], add_args_unif(E, F, G), test(G). variables(D)\'test/1_1_$special_functor/3'(A, B, C)<=>var(A), ground(B), ground(C), \+memberchk_eq(A, D)|functor(A, B, C). 'test/1_1_$special_true/0'<=>true. 'test/1_1_$special_==/2'(A, B)<=>A==B|true. 'test/1_1_$special_=:=/2'(A, B)<=>A==B|true. 'test/1_1_$special_=A==B|true. 'test/1_1_$special_=ground(A), ground(B), A=ground(A), ground(B), A>B|fail. 'test/1_1_$special_=:=/2'(A, B)<=>ground(A), ground(B), A=:=B|true. 'test/1_1_$special_=:=/2'(A, B)<=>ground(A), ground(B), A=\=B|fail. 'test/1_1_$special_=\\=/2'(A, B)<=>ground(A), ground(B), A=\=B|true. 'test/1_1_$special_=\\=/2'(A, B)<=>ground(A), ground(B), A=:=B|fail. 'test/1_1_$special_functor/3'(A, B, C)<=>nonvar(A), functor(A, B, C)|true. 'test/1_1_$special_functor/3'(A, _, _)<=>nonvar(A)|fail. 'test/1_1_$special_ground/1'(A)<=>ground(A)|true. 'test/1_1_$special_number/1'(A)<=>number(A)|true. 'test/1_1_$special_float/1'(A)<=>float(A)|true. 'test/1_1_$special_integer/1'(A)<=>integer(A)|true. 'test/1_1_$special_number/1'(A)<=>nonvar(A)|fail. 'test/1_1_$special_float/1'(A)<=>nonvar(A)|fail. 'test/1_1_$special_integer/1'(A)<=>nonvar(A)|fail. 'test/1_1_$special_\\+/1'(functor(A, B, C))<=>nonvar(A), functor(A, B, C)|fail. 'test/1_1_$special_\\+/1'(functor(A, _, _))<=>nonvar(A)|true. 'test/1_1_$special_\\+/1'(ground(A))<=>ground(A)|fail. 'test/1_1_$special_\\+/1'(number(A))<=>number(A)|fail. 'test/1_1_$special_\\+/1'(float(A))<=>float(A)|fail. 'test/1_1_$special_\\+/1'(integer(A))<=>integer(A)|fail. 'test/1_1_$special_\\+/1'(number(A))<=>nonvar(A)|true. 'test/1_1_$special_\\+/1'(float(A))<=>nonvar(A)|true. 'test/1_1_$special_\\+/1'(integer(A))<=>nonvar(A)|true. 'test/1_1_$special_,/2'(A, B)<=>test(A), known(A), test(B). 'test/1_1_$special_;/2'(A, B)<=>true|negate_b(A, D), negate_b(B, C), (known(C), test(A);known(D), test(B)). 'test/1_1_$special_,/2'(B, C), 'known/1_1_$special_;/2'(A, E)<=>true|\+try(A, (B, C)), !, negate_b(A, D), known(D), \+try(E, (B, C)). 'test/1_1_$special_\\+/1'(B), 'known/1_1_$special_;/2'(A, D)<=>true|\+try(A, \+B), !, negate_b(A, C), known(C), \+try(D, \+B). 'test/1_1_$special_integer/1'(B), 'known/1_1_$special_;/2'(A, D)<=>true|\+try(A, integer(B)), !, negate_b(A, C), known(C), \+try(D, integer(B)). 'test/1_1_$special_float/1'(B), 'known/1_1_$special_;/2'(A, D)<=>true|\+try(A, float(B)), !, negate_b(A, C), known(C), \+try(D, float(B)). 'test/1_1_$special_number/1'(B), 'known/1_1_$special_;/2'(A, D)<=>true|\+try(A, number(B)), !, negate_b(A, C), known(C), \+try(D, number(B)). 'test/1_1_$special_ground/1'(B), 'known/1_1_$special_;/2'(A, D)<=>true|\+try(A, ground(B)), !, negate_b(A, C), known(C), \+try(D, ground(B)). 'test/1_1_$special_=:=/2'(B, C), 'known/1_1_$special_;/2'(A, E)<=>true|\+try(A, B=:=C), !, negate_b(A, D), known(D), \+try(E, B=:=C). 'test/1_1_$special_==/2'(B, C), 'known/1_1_$special_;/2'(A, E)<=>true|\+try(A, B==C), !, negate_b(A, D), known(D), \+try(E, B==C). 'test/1_1_$special_true/0', 'known/1_1_$special_;/2'(A, C)<=>true|\+try(A, true), !, negate_b(A, B), known(B), \+try(C, true). 'test/1_1_$special_functor/3'(B, C, D), 'known/1_1_$special_;/2'(A, F)<=>true|\+try(A, functor(B, C, D)), !, negate_b(A, E), known(E), \+try(F, functor(B, C, D)). 'test/1_1_$special_=/2'(B, C), 'known/1_1_$special_;/2'(A, E)<=>true|\+try(A, B=C), !, negate_b(A, D), known(D), \+try(E, B=C). 'test/1_1_$special_;/2'(B, C), 'known/1_1_$special_;/2'(A, E)<=>true|\+try(A, (B;C)), !, negate_b(A, D), known(D), \+try(E, (B;C)). 'test/1_1_$special_is/2'(B, C), 'known/1_1_$special_;/2'(A, E)<=>true|\+try(A, B is C), !, negate_b(A, D), known(D), \+try(E, B is C). 'test/1_1_$special_true|\+try(A, B=/2'(B, C), 'known/1_1_$special_;/2'(A, E)<=>true|\+try(A, B>=C), !, negate_b(A, D), known(D), \+try(E, B>=C). 'test/1_1_$special_>/2'(B, C), 'known/1_1_$special_;/2'(A, E)<=>true|\+try(A, B>C), !, negate_b(A, D), known(D), \+try(E, B>C). 'test/1_1_$special_=\\=/2'(B, C), 'known/1_1_$special_;/2'(A, E)<=>true|\+try(A, B=\=C), !, negate_b(A, D), known(D), \+try(E, B=\=C). 'test/1_1_$special_=true|\+try(A, B=true|\+try(A, B\==C), !, negate_b(A, D), known(D), \+try(E, B\==C). 'test/1_1_$default'(B), 'known/1_1_$special_;/2'(A, D)<=>true|\+try(A, B), !, negate_b(A, C), known(C), \+try(D, B). 'test/1_1_$special_,/2'(_, _)<=>fail. 'test/1_1_$special_\\+/1'(_)<=>fail. 'test/1_1_$special_integer/1'(_)<=>fail. 'test/1_1_$special_float/1'(_)<=>fail. 'test/1_1_$special_number/1'(_)<=>fail. 'test/1_1_$special_ground/1'(_)<=>fail. 'test/1_1_$special_=:=/2'(_, _)<=>fail. 'test/1_1_$special_==/2'(_, _)<=>fail. 'test/1_1_$special_true/0'<=>fail. 'test/1_1_$special_functor/3'(_, _, _)<=>fail. 'test/1_1_$special_=/2'(_, _)<=>fail. 'test/1_1_$special_;/2'(_, _)<=>fail. 'test/1_1_$special_is/2'(_, _)<=>fail. 'test/1_1_$special_fail. 'test/1_1_$special_>=/2'(_, _)<=>fail. 'test/1_1_$special_>/2'(_, _)<=>fail. 'test/1_1_$special_=\\=/2'(_, _)<=>fail. 'test/1_1_$special_=fail. 'test/1_1_$special_\\==/2'(_, _)<=>fail. 'test/1_1_$default'(_)<=>fail. cleanup\'known/1_1_$special_;/2'(_, _)<=>true. cleanup\'known/1_1_$special_nonvar/1'(_)<=>true. cleanup\'known/1_1_$special_var/1'(_)<=>true. cleanup\'known/1_1_$special_atom/1'(_)<=>true. cleanup\'known/1_1_$special_atomic/1'(_)<=>true. cleanup\'known/1_1_$special_compound/1'(_)<=>true. cleanup\'known/1_1_$special_ground/1'(_)<=>true. cleanup\'known/1_1_$special_integer/1'(_)<=>true. cleanup\'known/1_1_$special_float/1'(_)<=>true. cleanup\'known/1_1_$special_number/1'(_)<=>true. cleanup\'known/1_1_$special_=\\=/2'(_, _)<=>true. cleanup\'known/1_1_$special_\\+/1'(_)<=>true. cleanup\'known/1_1_$special_functor/3'(_, _, _)<=>true. cleanup\'known/1_1_$special_\\=/2'(_, _)<=>true. cleanup\'known/1_1_$special_=/2'(_, _)<=>true. cleanup\'known/1_1_$special_,/2'(_, _)<=>true. cleanup\'known/1_1_$special_\\==/2'(_, _)<=>true. cleanup\'known/1_1_$special_==/2'(_, _)<=>true. cleanup\'known/1_1_$special_is/2'(_, _)<=>true. cleanup\'known/1_1_$special_true. cleanup\'known/1_1_$special_>=/2'(_, _)<=>true. cleanup\'known/1_1_$special_>/2'(_, _)<=>true. cleanup\'known/1_1_$special_=true. cleanup\'known/1_1_$special_=:=/2'(_, _)<=>true. cleanup\'known/1_1_$special_fail/0'<=>true. cleanup\'known/1_1_$default'(_)<=>true. cleanup\variables(_)<=>true. cleanup<=>true.