2.9. , 2.1, Prolog :?- big (), dark (X).
2.1,
,
:
?- darkt X), big(X).
Prolog , ?
2. Prolog
2.2. Prolog
procedure execute (Program, GoalList, Success); ;
Program -
GoalList - :
Success - ; Success true, GoalList true Program :
Goal -
OtherGoals -
Satisfied -
MatchOK -
Instant -
, ', 1, BI ',...,, ::' - :
empty(L) - true, L -
head(L) -
tail(L) - L
append(Ll,L2) - L2 L1
match(1,2,MatchOK,Instant ) - 1
12; MatchOK true, a Instant
substitute(Instant,Goals) - Goals
: Instant
Begin
if empty(GoalList) then Success:= true else begin
Goal:= head(GoalList); OtherGoals:= tail(GoalList); Satisfied:- false;
while not Satisfied and " " do begin
, Program
:- 1,..., .
":- 1 ',..., '. match(Goal,H',MatchOK,Instant); if MatchOK then begin
NewGoals:= append([Bl',...,Bn'], OtherGoals); NewGoals: substitute (Instant,NewGoals),-execute(Program,NewGoals,Satisfied) end end; Success:= Satisfied end end;
2.5. :
. Prolog, , , . , . , .
I. Prolog
. , , . . , . , . : , , ( ) , . ?
|
|
. ", ", , . . , .
1. .
2. .
i |
3. . 4. . . state (), . . 2.10 , ,
State