<< Prev | - Up - | Next >> |
We can use our
tabl/3
-predicate right away to generate models. The generated model will be found in theOutBranch
-argument. As a little add-on, we'll now look at a wrapper calledmodGen/3
(inprop.pl
). It allows us to generate a model for a formula and include some world knowledge.
World Knowledge
You can think of world knowledge as a collection of formulae stating facts about the world. Typically, there will be basic facts like and rule-like facts like
.
modGen(Formula,WKNumber,Model) :-
wk(WKNumber,WK),
toconj([Formula|WK],Conjunction),
naonly(Conjunction,Converted),
tabl(true(Converted),[],Model).
We have to give the world knowledge as a list of formulas. This list has to be put in the database together with a number, as a term wk(N,Formulas)
. Our predicate modGen/3
accesses the world knowledge by the number given as second argument, then conjoins it with the input formula (using toconj/2
, which we won't discuss here). It then calls tabl/3
to make the resulting conjunction true.
To give an example, we have added the toy world knowledge wk(1,[man(john),love(john,mary)]).
You can try the following test call modGen(love(john,mary)>woman(mary),1,M).
A listing of all necessary files can be found in Section 8.2
<< Prev | - Up - | Next >> |