compfindx(expression,sentence,dataset,ruleset) → expression / false

The compfindx subroutine takes as arguments an expression (called the aspect), a sentence (called the query), a dataset, and a ruleset. It uses the facts in the dataset and the rules in the ruleset (and the definitions of predefined functions and relations) to derive an instance of the query. If it succeeds, it returns the corresponding instance of the aspect; if it fails to derive an instance of the query, it returns false.

Call: definefacts(repository,readdata('p(art,bob) p(bob,cal) p(bob,cam)')) Exit: true Call: definerules(library,readdata('g(X,Z) :- p(X,Y) & p(Y,Z)')) Exit: true Call: compfindx('Z',read('g(art,Z)'),repository,library) Exit: cal Call: compfindx('X',read('g(X,cal)'),repository,library) Exit: art Call: grind(compfindx(read('answer(X,Z)'),read('g(X,Z)'),repository,library)) Exit: answer(art,cal) Call: grind(compfindx(read('answer(X,Z)'),read('p(X,Y) & p(Y,Z)'),repository,library)) Exit: answer(art,cal) Call: compfindx('Z',read('g(bob,Z)'),repository,library) Exit: false

See related subroutines compfindp, compfinds, and compfindg.

Comments and complaints to genesereth@stanford.edu.