Many of the meta-interpreters for expert systems are based on the so-called vanilla translator. This is a translator for Prolog without cut and without built-in modules. it reads as follows:
solve(true) :- !.
solve((A,B)) :- !, solve(A), solve(B).
solve(H) :- clause(H,B), solve(B).
You can easily use it to solve the following knowledge base and query. On some Prolog systems, which are more compatible with ISO, it is necessary to mark predicates as dynamic so that the / 2 section can find them:
pet(dog):- size(medium), noise(woof).
pet(cat):- size(medium), noise(meow).
pet(mouse):- size(small), noise(squeak).
size(medium).
noise(meow).
?- solve(pet(X)).
X=cat
,
, :
Bye
..: , :http://www.amzi.com/ExpertSystemsInProlog/