Professional Documents
Culture Documents
Simeioseis Texnitis Noimosinis
Simeioseis Texnitis Noimosinis
PROLOG
-
1 : ________________________________________________ 1
1.1 ________________ 5
1.2 ____________________ 5
1.3 _____________________________________ 6
2 : PROLOG _______________________________________________ 11
2.1 (unification) ____________________________________________ 14
2.2 PROLOG _____________________ 15
2.3 ________________________ 15
2.4 ___________________________________________ 15
2.5 PROLOG _______________________________ 16
2.6 (Unification) __________________ 18
2.7 SUBGOALS _____________________________________________ 19
2.8 PROLOG; ________________________________________ 19
2.9 PROLOG; _________________________ 21
2.10 PROLOG ____________________________________ 22
2.11 PROLOG____________________________________ 24
2.12 _____________ 29
2.13 ! _______________________________________________ 31
3 - ____________________________________ 37
3.1 _________________________________________________________ 37
3.2 ________________________________________ 38
3.3 ______________________________ 42
3.4 ________________________ 43
3.5 __________________________________________ 47
3.6 ______________________________ 48
3.7 _____________________________________________ 56
3.8 ___________________ 58
3.9 _____________________________________________ 63
4 : _____________________________ 75
4.1 _________________________________________________________ 75
4.2 ____________________________________________________________ 75
4.3 ____________________________ 76
4.4 _____________ 79
4.5 ___________________________ 80
4.6 ______________________________ 86
4.7 B ____________________________________________________ 87
(Planning)
1 :
.
, ,
, .
,
( : , ,
, )
.
() (Artificial Intelligence - AI)
/ .
,
: ,
, ,
.
(
):
, ,
(Herbert Simon).
.
.
(science)
(engineering) (Nils Nilsson).
. ()
, () .
.
, .
,
. ,
.
; ; ;
, , , ,
.
,
,
:
,
.
,
.
:
.
, .
.
:
(REASONING)
(BEHAVIOUR)
1.
(cognitive
science)
(I/O), . :
GPS (General Problem Solver):
.
3.
Turing Test. 3 ,
.
.
.
.
.
:
Eliza:
Turing Test. :
:
Eliza:
..
Eliza:
..
Eliza
(pattern matcher) .
,
if sentence = ..mother..
then respond with Tell me about your family
,
Eliza .
.
2 4.
.
2.
. :
()
:
.
.
: . -
.
4.
, .. robot arm.
:
1.1
Puzzle, , .
, .. MACSYMA
500 , , , .
(expert systems)
MYCIN ()
EL ( )
PROSPECTOR ()
XCON (hardware configuration)
INTELLECT
LIFER
LOQUI
(Learning)
-
->
.. (block world - )
ROBOT , , , .
.
,
, .
1.2
:
5
, ,
:
:
-
..
:
: The spirit is willing but the flesh is weak
: vodka !
1.3
Newell & Simon:
.
.
.
.
( )
.
.
.
:
;
;
(knowledge) ( - belief).
;
;
..
: ;
pixels ;
;
(explicit) (implicit) ;
.
:
.
5 17
3 .
.
;
(. ) (
).
.
(17 5) 6000
.
, (6 3) , 20 .
17-5=12
4 ,
, 2 !
;
(Problem Solving) - (Search)
(Logic) - (Theorem Proving)
(Planning)
(Knowledge Representation)
(Machine Learning)
(Natural Language Understanding)
(Neural Networks)
LISP, PROLOG.
:
(
).
( )
;
.
(
). , ,
(
).
.
;
.
,
.
.
;
, ,
( )
. ,
.
;
( , , )
.
.
. '
.
:
, , .
"" ;
1. (
, , ...)
"" .
2. (search) .
.
. "crack"
(password) .
8 .
(~708)
.
(..
)
( "crack"
,
).
.
. , ,
9
.
3. (representation)
.
.
Fibonaci
( Pascal
C) ' GOTO
( Pascal
Fibonaci if ... goto ....).
.
1
'
.
4. (planning)
, .
.
.
10
2 : PROLOG
PROLOG
.
..
.
married (,).
(facts).
child (,).
child (,).
child (,).
child (, ).
child (,).
child (, ).
child (,).
child (,).
male ().
male ().
male ().
male ().
female ().
female ().
married (, ).
married (, ).
married (, ). married (, ).
:
?- child (, ).
YES
?- child (, ).
NO
?- child (X, ).
X=
?- child (,X).
X= ;
X=
?- child (X,Y).
X=
Y= ;
X=
Y= ;
11
(rules)
/
.
grandchild (X,Y) :- child (X,Z), child (Z,Y).
1:
parent (X,Y) :- child (X,Y).
mother (X,Y) :- parent (X,Y), female (X).
father (X,Y) :- parent (X,Y), male (X).
sibling (X,Y) :- child (X,Z), child (Y,Z), notequal (X,Y).
sister (X,Y) :- sibling (X,Y), female (X).
2:
related (X,X).
related (X,Y) :- married (X,Y).
related (X,Y) :- child (X,Z), related (Z,Y).
related (X,Y) :- child (Y,Z), related (Z,X).
.
(goal). ,
.
(verifier goals) (finder goals). -
. :
:
?- child (,).
?- child (X,Y).
(recursive rules)
PROLOG.
D D P
, :
descendant (D,A) :- child (D,A).
descendant (D,A) :- child (D,P), descendant (P,A).
12
:
uncle (U,N) :- child (N,P), sibling (P,U), male (U).
uncle (U,N) :- child (N,P), sibling (P,Q), married (Q,U), male (U).
H PROLOG
: = + .
.
PROLOG
( - executor)
PROLOG.
PROLOG
: . :
grandchild (X,Y) :- child (X,Z), child (Z,Y).
()
,
.
()
Y.
:
literal :
P (t1, t2, ,tn)
(predicate) n
ti
(terms) . ,
m (function) f(x1, x2, ,xm).
(substitution) :
(x1=t1, x2=t2, , xN=tN)
xi=
ti=
13
L = child(X,Y)
L = child(son(), U)
L = child(son(X), son())
L = child(son(son()), son())
2.1 (unification)
(unifies) literals L1 L2 L1 = L2.
.. L1=child(X,Y) L2=child(son(),U) ={ = son(),Y=U}
L1 = L2 = child(son(),U).
() , . :
parent(X,Y)
unify
parent(son(X), X)
:
parent(X,Y)
unify
parent(son(Z), Z).
14
2.2 PROLOG
PROLOG (firstorder predicate logic formulas) quantifiers, Horn clause
, . .
2.3
f (g (Ab, 2), 100)
Ab
100
np
art
vp
2.4
.. Pascal
type person = record
name: string;
address: string;
birth: array[1..3] of integer;
sex: boolean
end
PROLOG
person(name(N), address(A), birth(D.M.Y), sex(S)).
15
2.5 PROLOG
(dot) .
.. (a.(b.(c.d))) a . b . c . d . nil
[a,b,c,d]
nil
[]
ab.nil
[ab]
nil.nil.nil
[ [], [] ]
[ [a],[b] ]
[ [ [ab] ] ]
1. nil nil
2. , (head, tail) head,
tail .
..
total(L,N) .
: length (L,N)
length (nil,0).
length (Head.Tail,N) :- length (Tail,M), N=M+1.
length ([],0).
length ([H | Tail], N) :- length (Tail,M), N=M+1.
16
: member (X,L)
member (X, [X | Tail]).
member (X, [Head | Tail]) :- member (X,Tail).
: pick (X,L1,L2)
pick (X, [X | Tail], Tail).
pick (X, [Head | Tail], [Head | Rem]) :- pick (X, Tail, Rem).
: append (L1,L2,L3) ( L1 L2 L3)
append (nil, L, L).
append ([H | T], L, [H | P]) :- append (T,L,P).
:
?- append (L, L, [a,b,d,a,b,d]).
L = [a,b,d]
?- append ([a,b], [c], L3).
L3 = [a,b,c]
?- append (X, [b,c], [a,d,b,c]).
X = [a,d].
input output
.
: QUICKSORT
1.
qsort ([],[]).
2. , Head
.
qsort ([ H | T ], S) :-
partition(H,T,L1,L2),
qsort (L1,S1),
qsort (L2,S2),
append (S1, [H | S2], S).
17
L1 L2.
2.6 (Unification)
,
( unifiers);
1. literals (L1 clause C1 L2 clause C2)
.
2. unifier
literals
L1 = P(t1, t2, ., tk)
L2 = P(t1, t2, ., tk)
t1 t1, t1 t2, ., tk tk .
3. t1 t2 :
()
t1 ( t2) : =t2
()
q1 r1, q2 r2, .
.
:
L1 = parent (X,Y)
L2 = parent (Y,son(Z))
parent (W,son(Z))
= {X=W, Y=son(Z)}
18
2.7 SUBGOALS
goal
:- A1, A2, , Ai, , Am (m >=1)
clause
B :- B1, B2,., Bk
. goal unifier Ai
B
:- A1, A2, , B1, B2,., Bk, , Am (m >=1)
:
:- parent (X, ), parent (, Y)
{U=, V=Y}
2.8 PROLOG;
.
: P, goal G,
R PROLOG :
1. G
2. goal
3. A1, A2, , Am, , An , R
Am. T A :- B1, B2, ., Bl Am A ,
(A1,,Am-1, B1, ,Bl, Am+1, , An) A1, A2, , An.
4. clause ( ) .
19
:
r1
r2
child (,).
child (,).
child (,).
child (,).
child (,).
:
?- descendant (, )
descendant (, )
r1
r2
child (, )
child (, )
descendant (X, )
X=
r1
[ ]
child (, )
child (, )
[ ]
20
2.9 PROLOG;
:
LEFT TO RIGHT
TOP TO BOTTOM
PROLOG !
:
(1)
p(a,b).
(2)
p(c,b).
(3)
(4)
p(X,Y) :- p(Y,X).
:- p(a,c)
:-p(a,c)
4
p(c,a)
p(a,Y), p(Y,c)
1
p(b,c)
...
...
...
p(c,b)
p(b,Y), p(Y,c)
3
p(Y,a),p(Y,c)
p(b,Y'),p(Y',Y),p(Y,c)
4
...
[]
...
21
4
...
...
2.10 PROLOG
Goal literals left-to-right
goal literal, top-to-bottom clause
(consequent) (unifies).
, , body clause goal
list.
, goal backtracking (.
goal literals goal list).
goals
.
:
;
:
walk
pushbox
climbbox
reach
22
4-tuple:
(, , , )
(states)
:
= = (pm, pb, bbox bgrasp?)
pm = position of monkey -
pb = position of box -
bbox = boolean, monkey on box? - ;
bgrasp? = boolean, monkey has banana? - ;
pi {X | X Room}
bi {yes,no}
= { ( _ , _ , _ , yes) }
PROLOG
state (X, Y, Z, W)
move (S1, M, S2)
S1 =
M =
S2 =
:
move (state (middle, middle, yes, no), reach, state (middle, middle, yes, yes)).
move (state (P, P, no, H), climbbox, state (P, P, yes, H)).
move (state (P1, P1, no, H), pushbox(P1,P2), state (P2, P2, no, H)).
move (state (P1, B, no, H), walk(P1,P2), state (P2, B, no, H)).
:
23
reach
no
climb
push
no
walk(atdoor,P2)
no
no
climb
reach climb
no
no
walk push
no
backtrack
reach
no
no
climb
reach
P2' = middle
2.11 PROLOG
Prolog .
.
Prolog
ISO.
Prolog
. %
24
. /*
*/ .
.
:
% this is a comment that ends at the end of the line
/* this is a multiple line comment
*-()-()-/-/-()-()-*
..that ends here */
()
(atoms)
Prolog. :
(a..z)
.
'_' (underscore) .
.
:
hello,
mother,
'this is an atom',
f15_x7_sky,
m88,
'don''t panic',
'Athens'.
Prolog
. .
:
123,
814,
-93,
12.4,
-0.01,
97.0
Prolog .
'_'.
,
(..) '_' ,
'_'. '_'
.
25
:
X,
John,
X13,
Fire_987,
_big_variable,
_98765
Prolog ,
literal. ( )
. ..
halt.
.
:
.
( .
,. , ,
.
).
:
child(oidipous, iokasti)
male(oidipous)
bought(Student, book(title(Programming in Prolog),author(W.F.C. C.S.M.)))
Unusual name(X, 98,0.09876)
.
..
, ,
[ , ] |. [] (
nil). .
.
:
[]
nil
[]
26
.(a, [])
(a.nil)
[a]
.(a, b)
(a.b)
[a | b]
[a,b]
[a,b | c]
,
, , .
:
[1, 2, 74, hello, 93, male(oidipous)]
[this is the head of the list, this list is a list of atoms , last atom]
[
[a1,a2,[
b1
b2]
],c2,c3
[d1,d2]]
((a1.(a2.((b1,b2).[]))).(c2.(c3.(d1.(d2.[])))))
.
Prolog
.
. = =(,)
.
. 2*7+3
+(*(2,7),3)) *(2,+(7,3)).
:
x1 :- x2
1200
x2 x1 (Horn Cause).
x;y
1100
x OR y ( x y)
x,y
1000
x AND y ( x y)
x1 = x2
700
x1 x2
x1 \= x2
700
x1 x2
x1 == x2
700
x1 x2
x1 \== x2
700
x1 x2
x1 is x2
700
x1 x2
x1 =:= x2
700
x1 .
27
x2
x1 =\= x2
700
. x1 .
x2
x1 < x2
700
x1 x2 ( >, =<,
>=)
y+x
500
x1 x2 ( x - y)
y*x
400
y x ( y / x )
y // x
400
y x
y mod x
400
y x
:
10 + 20
X is 30 + 4 * 4 / 9.5
30*2+5=:=65
85//2=\=42.5
30*2+5\==65
a(X,L):- b(X,Z), c(Z,L)
a(X) = a(3)
b(3,4) \= b(3,5)
-
(, ,
, ) .
. 2(+)2
.
. AND
.
.
.
true/0 ,
. (: true/0
true 0 )
28
false/0
(backtracking).
repeat/0
.
repeat goal literal
repeat
repeat. Prolog
repeat ( ) goal literal
repeat. repeat
:
repeat.
repeat :- repeat.
! ( cut)
.
(side effects). !
goal literal
! .
cut .
2.12
X,Y
X Y
X;Y
(X.Y)
{ : [|] }
X=Y
X\=Y
X==Y
X\==Y
var(X)
nonvar(X)
var(X)
atom(X)
integer(X)
float(X)
[: real(X)]
29
atomic(X)
name(A,L)
L
.
!
repeat
true
false
not(X)
call(X)
halt
X is Y
X+Y
X-Y
X*Y
X/Y
//
X mod Y
X<Y
X>Y
X =< Y
X >= Y
X =:= Y
X =\= Y
get(X)
ASCII
>=32.
read(X)
X .
put(X)
nl
30
tab(X)
write(X)
display(X)
see(X)
. (
user )
seeing(X)
seen
tell(X)
telling(X)
told
asserta(X)
assertz(X)
retract(X)
functor(T,F,N)
T F .
arg(N,T,A)
- .
X=..L
L
.
consult(X)
- .
.
reconsult(X)
- .
.
listing
listing(A)
2.13 !
! ( cut)
Prolog.
.
31
:
A :- B, C , D.
:- E, F.
B, C D
E F.
(goal) Prolog1 A
B, C, D E
F. B, C, D, E, F .
Prolog
.
, C D.
Prolog (backtracking point)
( E F).
. :
B :- B1.
B :- B2.
. Prolog
B1
.
1 , . Prolog, ,
C
D. C D .
D Prolog (backtrack)
. B2. 2
E F.
C !. :
A :- B, ! , D.
A :- E, F.
32
Prolog
.
, Prolog 1.
B1 . Prolog
!.
.
!.
. , D
B2, E F.
!
( !)
! .
!.
!
.
! .
.
! :
.
sum_to(, S) :
sum_to(1,1) :- !.
sum_to(,S) :- = - 1 , sum_to(, R) , S=R + M.
1 .
! 1
1 1
. ,
: Prolog Prolog
33
. !
sum_to(3,7) .
IF THEN ELSE !.
IF THEN ELSE
A :- B, ! , C.
A :- D.
C
D.
!
C D.
.
.
, ,
.
.
:
(FamilyMembers, Income, Grade, Athens, Money) :- B(FamilyMembers,
ncome, X), C(Grade,Y), Money = X * Y * 1.7.
(FamilyMembers, Income, Grade, Patra, Money) :- B(FamilyMembers,
ncome, X), C(Grade,Y), Money = X * Y * 1.2.
(FamilyMembers, Income, Grade, Larisa, Money) :- B(FamilyMembers,
Income, X), C(Grade,Y), Money = X * Y * 3.7.
.
,
(Grade) 7,
.
.
! fail
34
.
7,
.
(FamilyMembers, Income, Grade, City, Money) :- Grade < 7.0, !, fail.
(FamilyMembers, Income, Grade, Athens, Money) :- B(FamilyMembers,
Income, X), C(Grade,Y), Money = X * Y * 1.7.
(FamilyMembers, Income, Grades, Patra, Money) :- B(FamilyMembers,
Income, X), C(Grade,Y), Money = X * Y * 1.2.
(FamilyMembers, Income, Grades, Larisa, Money) :- B(FamilyMembers,
Income, X), C(Grade,Y), Money = X * Y * 3.7.
.
Grade < 7.0 !
.
!. fail
.
.
! .
!
.
35
3 -
3.1
.
( ) . ,
.
.
2
() 100 . 1
1 40 .
4
10000 2 45
.
8
, 3
.
, ,
. ,
,
.
8
. ,
.
.
.
-
.
37
. ,
,
.
,
.
3.2
(missionaries & cannibals)
3 3 .
2 .
:
.
,
.
.
.
A
canniba
l
canniba
l
canniba
l
missionar
y
missionar
y
missionar
y
8 (8 puzzle)
3 x 3 (9 ).
1 8.
.
38
:
.
:
(block world)
3 : , B, C.
C B .
( ).
.
C , B C .
39
C1
C2
C3
C4
C5
B
C6
C8
C7
C9
C10
F
C12
C11
C13
D
C15
C14
12 (12 coins)
12 (
).
3 .
.
.
40
(Road-map)
,
,
.
50
150
141
197
144
210
120
80
100
60
60
40
26
80
92
120
212
140
100
80
45
90
80
75
8 (8 queens)
8 .
. , ,
.
:
2 .
41
3.3
.
.
(.. 8 ).
()
(..
).
. , ,
.
.
.
.
.
42
. ,
. (..
, ) .
.
,
.
.
.
3.4
:
1.
2.
3.
4.
5.
4
.
.
. ,
. ,
.
.
. d(s)
.
.
43
.
.
.
. 7 : 3
, 3 1
.
3
.
.
.
.
.
.
: (x, y, z)
:
(x=0 x y) (3-x = 0 3-x >= 3-y)
.
1: (x, y, ) (x-1,
y, B) x > 0.
2: (x, y, ) (x-2,
y, B) x > 1.
3: (x, y, ) (x, y1, B) y > 0.
4: (x, y, ) (x, y2, B) y > 1.
44
5: (x, y, ) (x-1,
y-1, B) x > 0 y > 0.
6: (x, y, B) (x+1,
y, A) x < 3.
7: (x, y, B) (x+2,
y, A) x < 2.
8: (x, y, B) (x,
y+1, A) y < 3.
9: (x, y, B) (x,
y+2, A) y < 2.
10: (x, y, B) (x+1,
y+1, A) x <3 y < 3.
(3,3,) : (0,0,).
.
. ,
.
.
.
.
4
45
3, 3, A
3, 2, B
3, 3, A
2, 2, B
3, 1, B
3, 2, A
2, 3, A
3, 3, A
......
......
3, 0, B
3, 1, B
2, 3, B
1, 3, B
3, 2, A
3, 3, A
......
......
2, 2, B
1, 2, B
2, 1, B
.
. ,
.
3, 3, A
3, 1, B
3, 2, B
2, 2, B
1, 3, B
2, 3, B
3, 2, A
2, 3, A
1, 2, B
2, 1, B
3, 0, B
2, 0, B
3, 1, A
1, 3, A
2, 1, A
1, 1, B
1, 2, A
2, 2, A
1, 1, A
0, 2, B
0, 3, A
0, 1, B
46
0, 2, A
0, 0, B
3.5
- .
(Divide and
conquer).
. ,
.
.
:
.
.
AND-OR:
OR
....................
-
........
........
OR
........
........
-
AND
........
47
........
AND
3.6
. :
,
,
.
( ).
d(s).
(
d(s) ). d(s)
. , d(s)
s. , d(s)
.
:
13
22
33
107
34
22
16
27
48
44
27
16
10
16
28
d(s). .
b ( b)
m. .
:
1. (queue) (root).
2. ,
.
2. .
2. , :
-
-
3. , , , .
: A, B, D, F, G, I
.
1
B
4
13
22
33
107
34
22
16
27
49
44
27
16
10
16
28
(bm) (bm).
m
.
b .
d(s).
:
1. (queue) (root).
2. ,
.
2. .
2. , :
-
-
3. , , , .
: A, B, F, M, G, M, N, T
.
1
B
3
13
22
27
10
22
107
16
16
33
34
27
50
44
16
28
(bm) (bm).
.
d(s).
(Hill Climbing)
. Hill
Climbing
.
Hill Climbing (
) .
d(s)
.
:
1. (queue) (root).
2. ,
.
2. .
2. , :
-
-
3. , , , .
: A, B, G, N, V
.
51
13
22
27
10
22
107
16
16
33
34
27
44
16
28
.
.
.
:
1. = 1
2.
.
2.1. 1
2.2. (queue) (root).
2.3. :
2.3.. .
2.3.. .
2.3.. , :
-
-
:
-
-
3. , , , .
52
: A, B, D, A, B, F, G, D, I
.
1,4
2,5
3,8
13
22
33
107
34
22
16
27
44
27
10
16
16
28
(bm) (bm).
m
.
b .
d(s).
:
1. (queue) (root).
2. ,
.
2. .
2. , :
-
-
- d(s) (
)
3. , , , .
53
d(s)
.
: A, B, D, G, K, F, R
.
1
B
6
13
22
27
10
22
33
107
34
16
27
44
16
16
28
(bm) (bm).
.
.
. , d(s)
d(s)
.
.
d(s) k
.
.
:
54
1. (queue) (root).
2. ,
.
2. .
2. , :
-
-
k .
3. , , , .
k=1
: A, B, G, N, V ( ).
k=2
: A, B, D, G, F, , I .
1
B
5
13
22
107
33
34
22
16
27
44
27
16
10
16
28
. (km)
O(km) O(km)
.
55
.
.
O(bm/2)
.
.
.
.
.
. ,
(
).
.
.
3.7
. , ,
.
. ,
. ,
. ,
.
,
.
56
. ,
. , ,
.
,
.
.
.
8 :
h1 = .
h2 =
.
,
.
, . ,
, .
.
.
, 12
8
.
,
.
.
. ,
.
57
h2
(
1).
3.8
. (
)
.
d(s)
s h(s)
s -.
.
- h 0.
h(s) (
) d(s) ( ).
.
58
21
20
13
22
0
8
3
107
56
33
76
22
27
0
16
0
34
38
27
43
44
10
16
1
16
28
(Greedy search)
:
1. (queue) (root).
2. ,
.
2. .
2. , :
-
-
- h(s) (
)
3. , , , .
59
h(s)
d(s). *
.
,
: A, B, G, M, N, T.
21
2
7
20
8
2
6
13
2
22
6
0
33
0
8
107
56
76
22
27
10
0
16
0
34
38
27
43
44
16
1
16
28
(bm) (bm).
.
.
, d(s).
60
*
. f(s) = d(s) + h(s).
. f(s)
s.
* h(s)
. ,
, h(s) (
) . f(s)
s.
f(s)
.
* , .
:
1. (queue) (root).
2. ,
.
2. .
2. , :
-
-
- f(s) ( )
3. , , , .
: A, B, G, D, K, R
.
61
21
2
7
20
8
2
6
13
5
0
76
22
27
10
6
2
22
3
107
56
33
0
16
0
34
38
27
43
44
16
1
16
28
(bm) (bm).
f(s)
. ,
f(s)
.
.
O(bm)
O(bm)
O(bm)
O(bm)
O(bm)
O(bm)
O(bm)
O(bm)
O(bm)
O(bm)
d(s)
d(s)
O(km)
O(km) O(km)
O(bm)
O(bm)
h(s)
OXI
O(bm)
O(bm)
62
3.9
.
. ,
, ,
- .
, , Claude Shannon Alan Turing,
. ,
.
.
,
. ,
.
,
.
.
,
.
. , ,
.
(
). MAX .
MAX
MIN .
63
.
.
( )
1 , 0 -1
.
7 (Grundys game).
7 .
. ,
.
.
MAX.
7, MAX
6, 1, MIN
5, 2, MIN
5, 1, 1, MAX
4, 3, MIN
4, 2, 1, MAX
4, 1, 1, 1, MIN
3, 2, 2, MAX
3, 2, 1, 1, MIN
3, 1, 1, 1, 1, MAX
3, 3, 1, MAX
2, 2, 2, 1, MIN
2, 2, 1, 1, 1, MAX
2, 1, 1, 1, 1, 1, MIN
( MAX)
. MIN
.
64
AND-OR.
OR
MAX
AND MIN .
MAX ( OR )
MIN ( OR ) MAX.
AND-OR
.
5, 2
6, 1
5, 1, 1
4, 1, 1, 1
3, 1, 1, 1, 1
4, 2, 1
3, 2, 1, 1
2, 2, 1, 1, 1
4, 3
3, 2, 1, 1
4, 2, 1
3, 2, 2
4, 2, 1
3, 2, 1, 1
2, 2, 1, 1, 1
2, 2, 2, 1
2, 2, 1, 1, 1
3, 2, 1, 1
2, 2, 1, 1, 1
3, 3, 1
3, 2, 1, 1
2, 2, 1, 1, 1
2, 1, 1, 1, 1, 1
OR , (
MAX) (, AND
MIN)
.
(, ).
65
-
.
-
- :
( AND-OR).
(
) MAX
.
:
MAX (AND )
.
MIN (OR )
.
.
7
(1 MAX -1 MIN).
AND-OR. ,
.
AND-OR
-
.
66
-1
-1
-1
5, 2
3, 1
-1
5, 1, 1
3, 2, 1, 1
-1
3, 2, 1, 1
2, 2, 1, 1, 1
-1
3, 2, 1, 1
-1
2, 2, 1, 1, 1
-1
2, 2, 1, 1, 1
-1
-1
3, 2, 1, 1
3, 2, 1, 1
-1
2, 2, 1, 1, 1
3, 3, 1
4, 2, 1
-1
3, 2, 1, 1
-1
3, 1, 1, 1, 1
3, 2, 2
4, 2, 1
-1
4, 1, 1, 1
-1
4, 2, 1
-1
4, 3
-1
2, 2, 1, 1, 1
2, 1, 1, 1, 1, 1
MAX ,
MAX .
MAX.
MIN-MAX
. ,
.
, ,
,
.
. ,
. , ,
67
. , ,
.
.
.
.
,
, MIN-MAX
.
Alfa-Beta .
MIN-MAX Prolog
.
Prolog state(Player, Board), Player
x Board 9 .
,
.
x, , e.
e .
x, state(x,[e,e,e,e,e,e,e,e,e])
.
. , minmax
MIN-MAX
. , minmax
MIN-MAX .
.
x.
triliza.
Board (
e). .
:
68
minmax(Pos1,_,Val1),
best(PosTail,BestTail, TailVal),
betterof(Pos1,Val1, BestTail, TailVal, BestPos, BestVal).
betterof(Pos0, Val0, _, Val1, Pos0, Val0):min_to_move(Pos0),
Val0>Val1, ! ;
max_to_move(Pos0),
Val0<Val1, !.
betterof(_, _, Pos1, Val1, Pos1, Val1).
% Generate all possible next states
moves(Pos,PosList):staticval(Pos,2),findall(X,make_a_move(Pos,X),PosList), PosList\=[].
% Generate a move
make_a_move(state(Player,Table),state(NextPlayer,NewTable)):member(N,[1,2,3,4,5,6,7,8,9]),
play_at_N_pos(Table,N,Player,NewTable),
switch_players(Player,NextPlayer).
% Define which is the next player
switch_players(x,o).
switch_players(o,x).
% Modify state
play_at_N_pos([e|Tail],1,Player,[Player|Tail]):- !.
play_at_N_pos([Head|Tail],N,Player,[Head|NewTail]):N>1, NewN is N - 1,
play_at_N_pos(Tail,NewN, Player, NewTail).
% All the winning states
staticval(state(_,[x,x,x,_,_,_,_,_,_]),V):- !, V=3.
staticval(state(_,[_,_,_,x,x,x,_,_,_]),V):- !, V=3.
staticval(state(_,[_,_,_,_,_,_,x,x,x]),V):- !, V=3.
staticval(state(_,[x,_,_,x,_,_,x,_,_]),V):- !, V=3.
staticval(state(_,[_,x,_,_,x,_,_,x,_]),V):- !, V=3.
staticval(state(_,[_,_,x,_,_,x,_,_,x]),V):- !, V=3.
staticval(state(_,[x,_,_,_,x,_,_,_,x]),V):- !, V=3.
staticval(state(_,[_,_,x,_,x,_,x,_,_]),V):- !, V=3.
staticval(state(_,[o,o,o,_,_,_,_,_,_]),V):- !, V=1.
staticval(state(_,[_,_,_,o,o,o,_,_,_]),V):- !, V=1.
staticval(state(_,[_,_,_,_,_,_,o,o,o]),V):- !, V=1.
70
staticval(state(_,[o,_,_,o,_,_,o,_,_]),V):- !, V=1.
staticval(state(_,[_,o,_,_,o,_,_,o,_]),V):- !, V=1.
staticval(state(_,[_,_,o,_,_,o,_,_,o]),V):- !, V=1.
staticval(state(_,[o,_,_,_,o,_,_,_,o]),V):- !, V=1.
staticval(state(_,[_,_,o,_,o,_,o,_,_]),V):- !, V=1.
% else we have a draw
staticval(_,2).
lfa-Beta
Alfa-Beta
. Alfa-Beta
MIN-MAX
.
,
:
(1, 2, ..., Xk-1, Xk) = MIN (1, 2, ..., Xk-1) i 0<i<k Xk > Xi.
AX (1, 2, ..., Xk-1, Xk) = MAX (1, 2, ..., Xk-1) i 0<i<k Xk < Xi.
MIN-MAX
MAX ( )
. , , MIN .
( )
.
. , .
Alfa-Beta .
.
_()
.
_()
.
71
, , Alfa Beta.
Alfa
MAX . Beta
MIN
. O
( )
.
.
Alfa-Beta
Alfa-Beta . MAX
Alfa
: MAX .
.
. Beta .
, Beta .
Alfa-Beta
:
MAX Alfa Beta.
M Beta Alfa.
:
, , . ,
- .
:
1. = .
72
2. = .
3. = MAX.
4. H minmax
TIMH_MAX(, , )
_(, , )
1. _() _().
2. .
2.1. = (, _(, , ))
2.2. .
3. .
_(, , )
1. _() _().
2. .
2.1. = (, _(, , ))
2.2. .
3. .
Alfa-Beta
: O, I, T, U, Y. ()
(
TIMH_MAX TIMH_MIN ). , F, C, K
MINMAX .
8
-2
73
4 :
.
4.1
,
(Natural Language Processing: NLP) .
' ,
.
4.2
,
- .
* * .
, ,
.
,
.
' ,
.
,
(Information Science)
(Artificial Intelligence).
.
,
(Computational Linguistics),
.
(Linguistic Engineering).
75
,
,
.
,
, (software
system).
: , , , , .
(artificial intelligence)
.
(formal languages)
.
, .
4.3
.
-
' .
.
:
,
.
76
. ,
(, , .).
(scanners)
(character set codes).
,
(word processor)
(text editor).
(keyboard driver)
. ,
,
,
.
, ,
, .
-
,
(understanding)
.
(identification)
:
, .. ,
network: ATN),
, .. .
(pattern matching),
.
, ,
.
,
,
(knowledge representation)
.
.
.
.
,
.
.
.
.
, , , ,
,
.
(formatting)
.
'
John Lyons
78
.
,
(speech generation)
.
4.4
.
. ,
, ,
(formatter).
,
, , , , , , , ,
, .. ,
.
.
,
, '
. ,
, (bytes)
(patterns)
.
(speech recognition).
,
79
(strings).
, , - (response)
.
4.5
:
.
, '
6.
, ,
.
,
, .
(shift).
, .
, ,
.
. .
,
- -
,
, .
(sorting).
, .
5
, ,
, ,
.
, (,)
( )
,
, ,
7 .
8. (transcription)
(transliteration)
. , ,
, .
(script)
.
(Hyphenation).
,
(format) , .. .
, (word
processors) (text editors) ,
(desk top publishing) (photo-composition).
.. ,
.
7
. : . - . ,
, "-84", ,
1984.
8
,
, , , . ,
81
,
, ,
.
)
9.
- . (corpus)
.
(compact disks).
.
(Text Data Bases), ,
, .
.
Thesaurus Linguae Graecae
Irvine California
.
-
Concordances).
,
. ,
, , ,
.
Index. -
(stop words) , (index) .
,
.
.
.
,
, 1995.
82
(knowledge
representation techniques) .
.
(Data Base Interface)
10
,
11.
,
.
' (.. C,
Pascal, LISP), (.. Prolog)
12
. ,
( ,
).
, -
(Query Languages)
- .
(command language) .
(Spelling
Check,
Error
Correction).
, ,
, ,
. ,
,
9
83
.
.
,
,
(, )
, .
(Syntax Checker).
, .
,
. ,
13 .
.
.
,
.
(unification)
- (attribute - value pair).
(parsing).
.
.
(hangman)
14
.
.
.
,
13
: ., K E
E B , K..E. , 1988.
14
: () . ,
, ,
, A 1991, () ., K
84
16
17
() -
( ).
A E , E,
T - E.M.. 1986.
15
()
, , 1984.
16
.
17
Windows 3.1.1, Windows '95 / NT, X-Windows (Unix)
85
4.6
, , , .
,
,
.
, , , :
, ,
, ,
,
(interface) ,
(hyphenation),
(concordance list keywords in context:
KWIC) ' ,
(error check,
correction),
2-, 3- ... n-
,
(text normalization),
(formatters)
(content
characters),
(transcription) (transliteration)
.
,
, ' :
,
- ,
.
(Artificial Intelligence)
86
(Knowledge Representation).
,
.
, ,
.
,
, , .
4.7 B
E (, )
Aho A. N. - J. D. Ullman, The theory of Parsing, Translation and Compiling,
Prentice Hall, 1972.
Aho A. N., Pattern Matching in Strings, Symposium on Formal Language Theory,
Santa Barbara, Univ. of Callifornia, 1979.
Bechtel W. Abrahamsen A., Connectionism and the Mind, Blackwell, 1991.
Chartres B. A., J. J. Florentin, A Universal Syntax Directed Top-Down Analyzer,
Journal of the Association for the Computing Machinery, Vol. 15, No 3, July
1968, pp 447-464.
Dix A., J. Finlay, G. Abowd, R. Beale, Human Computer Interaction, Prentice
Hall, 1993.
Kernighan Brian - Rob Pike, The UNIX Programming Environment, Prentice
Hall, 1984.
Moraitis C. S., J. G. Maistros, A Model Describing Connectivity and its
Application to Binary Picture Compression, International 84 AMSE Conference
Modeling and Simulation, 1984.
Moraitis C. S., J. G. Maistros, A Model Describing Digitized Images, International
Symposium Applied Informatics, Switzerland, 1985.
Papakonstantinou George, A Recursive Algorithm for the Optimal Conversion of
Decision Tables, Angewandte Informatik, vol. 9, 1980.
Russel S., P. Norvig, Artificial Intelligence - A Modern Approach, Prentice Hall,
1995
E -
87
Computer-aided Word-Class
Lauri,
Features
and
88
Graeme,
Stephen
Pulman,
Alan
Black,
Graham
Russell,
89
., , , 1967. A.
Mirambel, La Langue Grecque Modern - Description et Analyze, Klincksieck,
Paris, 1959.
Lembessi Z. - P., A Morphological Analysis of the Nominal Group of Greek
employing a computational model, M.A. Dissertation, Faculty of Arts, Exeter
Univ. 1988.
Mackridge Peter, The Modern Greek Language : A Descriptive Analysis
of
1978 (1941).
E
.,
, , , A
1991.
. - . ,
, "-84", ,
1984.
., Metodi Quantitativi e Informatici per l' Analisi del Testo
Letterario - Il "caso" delle Canzoni Popolari Greche e la Loro Versione in Italiano,
, 1984.
Eurotra - Preparatory Phase, Final Report, Eurotra Greek Language Group,
A - P 1985.
K, . M, A N , 1
, TEE - EY, A 1984.
Kotsanis . - Y. Maistros, Alexios Zavras,"Quicklem:: A Software System for
Greek Word-Class Determination, Literary and Linguistic Computing, Literary
and Linguistics Computing, Vol. 2, No 4, Oxford Univ. Press, 1987.
Kotsanis Y. - Y. Maistros, Describing Morphological Phenomena of Modern
Greek using a Unification Grammar Formalism, Information Systems Vol. 16, No
6, 1991.
Kotsanis Y. - Y. Maistros, Lexifanis: a Lexical Analyzer of Modern Greek, 2nd
Conference of the European Chapter of the ACL, Geneva, March 1985.
90
M ., K E E , 1
, TEE - EY, A 1984.
M . - . :
E, 2
EY, , 1988.
., -
,
Institut
Fran*ais
dAth*nes,
, 1995.
M .,
, , T
, A, 1987.
M ., ,
, T , A,
1988.
Packard David, Computer-Assisted Morphological Analysis of Ancient Greek,
Computational and Mathematical Linguistics (Proceedings of the International
Conference on Computational Linguistics), Pisa, 1973.
Ralli A. - E. Galiotou,
K E
E B , K..E. , 1988.
T
EOT
91
., ,
, 1995.
, , , . ,
,
,
1995.
K -
Alvin Toffler, Power Shift, Bantam Books, 1991,
Alvin Toffler, , , 1982
M ., T KAI, E
- EY, A 1988
M ., O P E
H Y, "O H Y E
E E",
I.
E - B, A 1988. :
I Goethe
A, . Goethe, 1987
M ., . M, N T E T
K , EETAA, EOK, OOA : "H
T A K 1990: N T
", A . 1988.
M ., T E X ,
T A - E.M.., A 1990.
92