Options: ======= use_query_const: no derive_idb_literals: yes Input Rules: =========== sg(X0,X0) :- person(X0). sg(X0,X1) :- parent(X0,X2), call(sg(X2,X3)), parent(X1,X3). EDB-Predicates: ============== parent/2. person/1. Query: ===== sg(a,X1). Conditional Facts: ================= db(parent(X0,X1)) :- parent(X0,X1). db(person(X0)) :- person(X0). rule(sg(X0,X0),[person(X0)]) :- true. rule(sg(X0,X1),[parent(X0,X2),call(sg(X2,X3)),parent(X1,X3)]) :- true. query(sg(X0,X1)) :- p0(X0). Partial Evaluation is running ... Conditional Facts: ================= db(parent(X0,X1)) :- parent(X0,X1). db(person(X0)) :- person(X0). rule(sg(X0,X0),[person(X0)]) :- true. rule(sg(X0,X1),[parent(X0,X2),call(sg(X2,X3)),parent(X1,X3)]) :- true. query(sg(X0,X1)) :- p0(X0). node(sg(X0,X1),[sg(X0,X1)]) :- p1(X0). node(sg(X0,X0),[person(X0)]) :- p2(X0). node(sg(X0,X1),[parent(X0,X2),call(sg(X2,X3)),parent(X1,X3)]) :- p3(X0). node(sg(X0,X0),[]) :- p4(X0). node(sg(X0,X1),[call(sg(X2,X3)),parent(X1,X3)]) :- p5(X0,X2). answer(sg(X0,X1)) :- sg(X0,X1). node(sg(X0,X1),[parent(X1,X2)]) :- p6(X0,X2). node(sg(X0,X1),[]) :- p7(X0,X1). Rules after Partial Evaluation: ============================== p0(a). % Seed fact with query constants. p1(X0) :- p0(X0). p2(X0) :- p1(X0). p3(X0) :- p1(X0). p4(X0) :- p2(X0), person(X0). p5(X0,X2) :- p3(X0), parent(X0,X2). sg(X0,X0) :- p4(X0). p0(X0) :- p5(X2,X0). p6(X0,X2) :- p5(X0,X3), sg(X3,X2). p7(X0,X1) :- p6(X0,X2), parent(X1,X2). sg(X0,X1) :- p7(X0,X1). Rules after Copy Rule Elimination: ================================= p0(a). p4(X0) :- p0(X0), person(X0). p5(X0,X2) :- p0(X0), parent(X0,X2). sg(X0,X0) :- p4(X0). p0(X0) :- p5(X2,X0). p6(X0,X2) :- p5(X0,X3), sg(X3,X2). p7(X0,X1) :- p6(X0,X2), parent(X1,X2). sg(X0,X1) :- p7(X0,X1).