(, , ) , (, , ). , "if "then". , . , , , , ; , , ,
15.
, ; , .
Prolog , , . 15.5 , , , , : if condition then Conclusion
(Condition) AND/OR. , . , ( fact), (Conclusion), , ( assert) fact. , , :
?- forward.
Derived: probl_ijcitehi Derived: no_Water_from_outside Derived: ieak_in_kitchen No more facts
15.5.
I Prolog
forward:- new_derived_fact{ P), !, |
write 'No mote facts'). |
write! 'Derived: '), write (P), nl, assert (fact(P)), forward |
I
I
new_derived_f act [ Concl)
if Cond then Concl, not fact Concl), compcsed_fact(Cond).
-
<k %
I ?
composed_fact(Cond)
fact(Cond).
-
composed_fact Condi and Cond2) composed _fact [ Condi), composed_fact (Cond2).
-
*
compOsed_faCt Condi or Cond2) composed_fact[ Condi )
: -
compcsed_fact [ Cond2