1
2:- table p/1.
3p(_X).
4
5:- table q/1 as subgoal_abstract(2).
6q(_X).
7
8% error -- "deep" terms
9test:- set_prolog_flag(unify_with_occurs_check,off),fail.
10test:- set_prolog_flag(max_table_subgoal_size_action,error),set_prolog_flag(max_table_subgoal_size,2),fail.
11test:- catch(p(f(f(f(1)))),_E,(writeln(error(e1)),fail)),writeln(success(e1)),fail.
12test:- abolish_table_pred(p/1),fail.
13test:- catch(p(f(f(f(1)))),_E,(writeln(error(e2)),fail)),writeln(success(e2)),fail.
14test:- abolish_table_call(p(f(f(f(1))))),fail.
15test:- abolish_all_tables,fail.
16%
17% error -- cyclic terms
18test:- X = f(X),catch(p(X),_E,(writeln(error(ce1)),fail)),writeln(success(ce1)),fail.
19test:- abolish_table_pred(p/1),fail.
20test:- X = f(X),catch(p(X),_E,(writeln(error(ce2)),fail)),writeln(success(ce2)),fail.
21test:- X = f(X),catch(abolish_table_call(p(X)),_E,(writeln(error(ce3)),fail)),fail.
22test:- abolish_all_tables,fail.
23%
24% error -- "deep" terms / tnot
25test:- catch(tnot(p(f(f(f(1))))),_E,(writeln(error(e3)),fail)),writeln(success(e3)),fail.
26test:- abolish_table_pred(p/1),fail.
27test:- catch(tnot(p(f(f(f(1))))),_E,(writeln(error(e4)),fail)),writeln(success(e4)),fail.
28test:- abolish_table_call(p(f(f(f(1))))),fail.
29test:- abolish_all_tables,fail.
30%
31% error -- cyclic terms / tnot
32test:- X = f(X),catch(tnot(p(X)),_E,(writeln(error(ce4)),fail)),writeln(success(ce4)),fail.
33test:- abolish_table_pred(p/1),fail.
34test:- X = f(X),catch(tnot(p(X)),_E,(writeln(error(ce5)),fail)),writeln(success(ce5)),fail.
35test:- X = f(X),catch(abolish_table_call(p(X)),_E,(writeln(error(ce6)),fail)),fail.
36test:- abolish_all_tables,fail.
37%
38%% abstraction -- "deep" terms
39test:- set_prolog_flag(max_table_subgoal_size_action,abstract),fail.
40test:- catch(q(f(f(f(1)))),_E,(writeln(error(a1)),fail)),writeln(success(a1)),fail.
41test:- abolish_table_pred(q/1),fail.
42test:- catch(q(f(f(f(1)))),_E,(writeln(error(a2)),fail)),writeln(success(a2)),fail.
43test:- abolish_table_call(q(f(f(f(1))))),fail.
44test:- abolish_all_tables,fail.
45%
46% abstraction -- cyclic terms
47test:- X = f(X),catch(q(X),_E,(writeln(error(ca1)),fail)),writeln(success(ca1)),fail.
48test:- abolish_table_pred(q/1),fail.
49test:- X = f(X),catch(q(X),_E,(writeln(error(ca2)),fail)),writeln(success(ca2)),fail.
50test:- X = f(X),catch(abolish_table_call(q(X)),_E,(writeln(error(cae3)),fail)),fail.
51test:- abolish_all_tables,fail.
52%
53% abstraction -- "deep" terms / tnot
54test:- catch(tnot(q(f(f(f(1))))),_E,(writeln(error(a3)),fail)),writeln(success(a3)),fail.
55test:- abolish_table_pred(q/1),fail.
56test:- catch(tnot(q(f(f(f(1))))),_E,(writeln(error(a4)),fail)),writeln(success(a4)),fail.
57test:- abolish_table_call(q(f(f(f(1))))),fail.
58test:- abolish_all_tables,fail.
59%%
60% abstraction -- cyclic terms / tnot
61test:- X = f(X),catch(tnot(q(X)),_E,(writeln(error(ca4)),fail)),writeln(success(ca3)),fail.
62test:- abolish_table_pred(q/1),fail.
63test:- X = f(X),catch(tnot(q(X)),_E,(writeln(error(ca4)),fail)),writeln(success(ca4)),fail.
64test:- X = f(X),catch(abolish_table_call(q(X)),_E,(writeln(error(cae4)),fail)),fail.
65test:- abolish_all_tables,fail.
66%
67%TBD: floundering goals are not yet detected properly
68%test:- catch(tnot(q(_X)),_E,(writeln(error(f1)),fail)),fail.
69%%
70test:- X = f(X),catch(tnot(X),_E,(writeln(error(c1)),fail)),fail.
71%%
72test:- set_prolog_flag(max_table_subgoal_size_action,error),fail.
73test.
74