PROLOG

% trace of various calls to prolog ebg using the cup example.
% a top level execution predicate would compine prolog ebg and extract rule 
% plus do some syntactic stuff to build a new rule



?- prolog_ebg(cup(obj1), cup(X), P, GenP).
    X = _0,
    P = [ (cup(obj1) :- 
               [[ (liftable(obj1) :- 
                       [[ (light(obj1) :- 
                               [small(obj1)])],part(obj1,handle)])],
                [ (stable(obj1) :- 
                       [part(obj1,bottom),flat(bottom)])],
                [ (open_vessel(obj1) :- 
                       [part(obj1,concavity),points_up(concavity)])]])],
    GenP = [ (cup(_0) :- 
                [[ (liftable(_0) :- 
                       [[ (light(_0) :- 
                                  [small(_0)])],
                           part(_0,handle)])],
                   [ (stable(_0) :- 
                          [part(_0,bottom),flat(bottom)])],
                   [ (open_vessel(_0) :- 
                          [part(_0,concavity),points_up(concavity)])]])] 

?- extract_support([ (cup(_0) :- 
                  [[ (liftable(_0) :- 
                          [[ (light(_0) :- 
                                  [small(_0)])],
                           part(_0,handle)])],
                   [ (stable(_0) :- 
                          [part(_0,bottom),flat(bottom)])],
                   [ (open_vessel(_0) :- 
                          [part(_0,concavity),points_up(concavity)])]])], Premise).
    _0 = _0,
    Premise =  (small(_0), part(_0,handle)), 
                (part(_0,bottom), flat(bottom)), 
                part(_0,concavity), points_up(concavity) 
		
		
%%%% This conjunctive query would be the heart (plus some syntactic sugar)
% of a rule constructor.
		
?- prolog_ebg(cup(obj1), cup(X), P, GenP), extract_support(GenP, Premise).
    X = _0,
    P = [ (cup(obj1) :- 
               [[ (liftable(obj1) :- 
                       [[ (light(obj1) :- 
                               [small(obj1)])],part(obj1,handle)])],
                [ (stable(obj1) :- 
                       [part(obj1,bottom),flat(bottom)])],
                [ (open_vessel(obj1) :- 
                       [part(obj1,concavity),points_up(concavity)])]])],
    GenP = [ (cup(_0) :- 
                  [[ (liftable(_0) :- 
                          [[ (light(_0) :-
                                  [small(_0)])],
                           part(_0,handle)])],
                   [ (stable(_0) :- 
                          [part(_0,bottom),flat(bottom)])],
                   [ (open_vessel(_0) :- 
                          [part(_0,concavity),points_up(concavity)])]])],
    Premise =  (small(_0), part(_0,handle)), 
                (part(_0,bottom), flat(bottom)), 
                part(_0,concavity), points_up(concavity)   

Close Window