9.3 Wrapping it up (Model Generation)

We can use our tabl/3-predicate right away to generate models. The generated model will be found in the OutBranch-argument. As a little add-on, we'll now look at a wrapper called modGen/3 (in prop.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


Aljoscha Burchardt, Stephan Walter, Alexander Koller, Michael Kohlhase, Patrick Blackburn and Johan Bos
Version 1.2.5 (20030212)