24.11.2014 Views

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

9. Flex Predicates 148<br />

the agenda. It is defined by the program:<br />

once( Name, [Name|Names], Names ).<br />

once( Name, [Head|Names], [Head|Newnames]) :-<br />

once( Name, Names, Newnames ).<br />

possibles(+Name,+Names,-Newnames)<br />

prove( +Goal )<br />

This is a built-in program for re-organising the rule agenda after each cycle<br />

of the forward chaining engine. It removes unsatisfied rules from the<br />

agenda, and is defined by the program:<br />

possibles( Name, Names, [Name|Newnames] ) :-<br />

append( _, [Name|NewNames], Names ).<br />

Dereference each of the arguments of the Goal and then try to prove it.<br />

If there is a Prolog program for the Goal, then that program is run,<br />

otherwise the workspace is searched for a matching fact (see new_fact/1),<br />

and in addition a check is made that there are no matching exceptions (see<br />

new_exception/1).<br />

Example<br />

?- prove( likes( X, @(father,peter)) )<br />

X = mary<br />

?- prove( likes( mary, fred) ).<br />

no<br />

where fred is not the father of peter.<br />

reconsult_rules( +FileName )<br />

Reconsult a <strong>flex</strong> ksl file.<br />

remember_exception( +Term )<br />

Add the given Term as a new exception in the workspace, which can be<br />

accessed through the prove/1 and disprove/1 procedures.<br />

If subsequent backtracking happens, then the asserted exception will be<br />

removed.<br />

Example<br />

remember_exception( likes(mary,fred) ) .<br />

remember_fact( +Term )<br />

<strong>flex</strong> toolkit

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!