You are on page 1of 70

1943 .

1943 ,
,
.

1950 Mc Culloch, Turing .

1950
2 . 3000
, 40 .

2
Logic Threorist .
.

// // .
.
.
.

1952 Arthur Samuel .


.


.
.

1958 Mc Carthy MIT-


LISP

.
2 . .

1958 // //
// //

.
.
.


.
.

. 1963
First
Order Logic .

1959 HerbertGelernter
. Logic Theorist-
.

1968 Bertram Raphael- SIR (Semantic Information


Retrieval )
.

1967 STUDENT
.

1972 Natural Language .

Expert .
MYCIN

450 junior

1980-1988 .
R1 DEC- 1981
.
40 $

. 1980
1988 2 .

1989 HITECH
.
,

.

1993 .

1993 Cog , .

Deep Blue .

Honda Motors Asimo


,
,
.

Sony
. SDR ( sony Dream Robots )
, .
, ,
.
,
,
.

MIT Media Lab ,


Kismet .

, , .
Kismet

.

Kismet

,
15 .

Tiger Electronics
Furby
.

, 2 .
.
.
,
. :.
1.

( Automatic Programming ) :

.
2. (Baysian Networks ) :
.
3. (Natural Language Processing/NLP ) :
, .
4.

.
5. ( Planning ) :
.
.
6. (Machine Learning ) : ,
,
.
7. ( Visual Pattern Recognition ) :
.

8. ( Search ) :
.
9. ( Fuuzy
Logic Systems ) :
.
10. ( Nearal Networks ) :
.


.
.
, , ,
.

.
5 , ,
.
.

.
.
.
Function - ( ) returns
Static : _
_ __ (_, )
___ (_)
_ (_, )
Return

. 2 .

(
persept )
.

.

1

.
.

.


.

35100
.

.

.

?
. 4- .

.

. : 50Mb
. :

2606050 .

. .
IF then .
. .


, .

Function _ ( ) returns
Static :
_( )
3

_(, )
_()
return
_
. _
.
.

.
.

.

.
.

.
.
. ?


.
.

.
.
,

.

.

.
, ,
, .
.

.

.
2
. :

,
.
.



.


.


.
.

:
.

.

:
.
.
,
.
.

( Episodic ) :
. ?
.

.
.

:

.

.

.

: ,
.
.

.
.
.

Yes

Yes

No

Yes

Yes

Yes

No

Yes

Yes

No

No

No

No

No

No

No

No

No

No

Yes

Yes

Yes

Yes

No

No

Yes

No

No

No

No

No

No

Yes


Procedure _(, _, , )
Inputs : ,
_,

:
Repeat
For each in do
[]_(,)
End
For each in do
[] []([])
End
_ _(,,)
Until ()

LISP

LISP .
Other : top-down
LISP : bottom-up
LISP . form form- .
F(x)(Fx)
Cos(x)(Cos x)
4+6 +46 . .
.

+,*

2*6*8 *268 . .
Function (argyment 1, argyment 2, . . . . . . argyment n)
Math
(+ x1, x2, x3, . . . . . . .xn) -
(- x1, x2, x3, . . . . . . .xn) -
(* x1, x2, x3, . . . . . . .xn) -
(/xy) -
(abc x) -
(ram xy) - - -
(max x1, x2, x3, . . . . . . .xn) -
(min x1, x2, x3, . . . . . . .xn) -


( defun _ ( ) )
( )

; .
:
(=xy) -
(/=xy) -
(<xy) - -
(>xy) - -
(<=xy) - -
(>=xy) - -
:
(zerop x) -
(plusp x) - 0-
(minusp x) -
(oddp x) - .
(x=(ram x2)0)
( or, x2, x3, . . . . . . .xn) -
( and x2, x3, . . . . . . .xn) - ,
(not x) -
LISP .
.

: n .
If n=1 then n!=1

n!=n*(n-1) .

( defun factrol (n) )


( if ( = n 1 )
1
( * n factrol ( - n 1 ) ) ) )

(List)

.
, , .
, .
LISP () .
null . .
: (1 3 8). 0- .
LISP
.
1. (cons x l ) : l .
: (cons 1(cons 2 nill )) (1 2 )
2. quote ( 1 2 7 5) : .
: (1 2 8 30) ( 1 2 8 30 )
3. first .
: (first (2 4 8)) 2 .

4. rest .
: (rest (2 4 8 9)) (4 8 9)
5. list-length .
: (list-length ( 1 8 9 5)) 4 .
(List-length (1 2 (2 3)) 3
6. L n- nth .
: (nth 0 (1 2 )) 1 .
7. last .
: (last (1 5 7 3)) 3 .
8. cond .
: (cond
(null l) nil))
9.
memder .
: (memder a (I have a book) ) a book
10. :
(=xy) x y .
(eg x y ) x y .
(egl x y ) x y , .
(equal l x y) , , .
11. 2 append .
: (append x y)
12. 2 intersection .
: (intersection L1 L2)
4

13. 2 union .
: (union L1 L2)
14. 2 difference .
: (difference L1 L2)
15. but last .
: (but last (1 6 7 9)) (6 7 9) .
16. 2 .
: (first (rest(2 4 8))) 4 .

: .
( defun My ( L )
( if ( null L )
nil
( + 1 ( My ( rest L ) ) ) ) )


,
.
.
.
.
.
,
.
.
- .
. 6-
.

(Goal Formulation )
. Problem formulatin

.
.

. .
<<, , >>


.
.
Function ___(p) returns
Inputs : ,
Static : S, , .
,

G, , .
,
_(,)
IF S then
G_()
_(, G)
S()
(S,)
S(S,)
Returns

.

:
.

:
.

:
. .

2
.

.
.

P
M

F
G
H

.
. :
A

D- :
A

D
A

B
L

.

.
.
. .
Function _(,) returns ,
.
Loop do
IF then return
.
IF then return

Else
.
End
. ----
.

.
. :

( Parent node )


. .

.

.

2 .

fringe frontier .
.
.
.

. :

Make-Queue ()

Empty? ( ) : true .

Remove-Front () :
.

Queuing-Fn(, ) :
.

:
?

: ?

:
?

:
.

Uninformed
Uninformed ,

.
. B, C, D
.

D .
Informed . Uninformed
informed .
Uninformed
. Uninformed 6
.
1. Breadth-first
2. Uniform cost
3. Depth-first
4. Depth-limited
5. Iterative deepening
6. Bidirectional
.
1. Breadth-first
.

d+1

.

.

.

. b ,
d .
:

1 + b + b 2 + b 3 + ...... + b d
d .
, .
b=10 .

1 millisecond

100 byte

111

0.1

11 Kb

11.111

11

1 Mb

106

18

111 Mb

31

11 Gb

10

128

1 Tera b

12

35

111 Tb

14

3500

11.111 Tb

10
12
14

10

10
10
10

.
, .
.

2. Uniform cost

. Breadth-first
. n- g(n)
Breath-first Uniform cost g(n)=(n)
.

. : S- G-
.
A
1
S

10
5

15

G
5

C
.
S

S(0)
A(1)

B(5) C(15)

G(11)

A
G(11)

G(10)

SAG .
SBG .
.
G((n))>=G(n)


.


uniformed cost
.
.

3. Depth-first


.
. .
.
d
b*d
. Breadth-first
. :

. .

,
. ,
. Depth-first
.
4. Depth-limited

Depth-first
.
depth-first .
.
bj b*j .

5. Iteratuve deepening

Depth-limited .
20 19 .
9
. 9
.
. Iterative Deppening

Depth&Breadth .
.
Breadth-


.

.

Function Iterative_deepening_() returns


Inputs :
For =0 to do
If Depth_Limited_(, )
then return
End
Return
.
=0
=1

=2

=3

d Depth Limited :
1 + b + b 2 + ..... + b d .

b=10, d=5 :

1 + 10 + 10 2 + 10 3 + 10 4 + 10 5 = 111,111
. Iterative Deepening :

(d + 1) *1 + (d ) * b + ....2 * b d 1 + (1) * b d
b=10, d=5 6+50+400+3000+20000+100000=123.456 .
11% .
bd b*d
.

6. Bidirectional


.
. bA/2
. : b=10, d=6 Breadth first
1.111.111 Bidirectional 2.222
.
.
.
.

Breadth

Uniform

Depth

Depth

Iterative

Bidirec-

first

cost

first

limited

deepening

tional

bd/2

bd

bd

b*m

b*l

b*d

bd/2

yes

yes

no

no

yes

yes

yes

yes

no

yes(if l>d)

yes

yes

.

.
.

.

.

.
bd
.

Hash .
.

Informed
Uniformed .

.
Best-First

.
Best First .

.

.
.
.
Function Best_First_(, _ )
retuns
Inputs :

_


return _(, _)

.


.
h .
h(n)= n-
h Bestfirst greedy .
.
Function Greedy_() returns
Return Best_First_ (, h)
h n h(n)=0 .
Greedy Depth first
. .

.
*
Greedy
. , . Uniform
cost g(n)- .
. 2
. .
F(n)=g(n)+h(n)
.
Function A*_() returns
Return Best_First_ (, g+h)

. H F
. :
g(A)=3 h(A)=4 g(M)=4 h(M)=2

F(A)=7, F(M)=6 . h
.
. f
f-
:
F(A)=max(f(A),g(M)+h(M)) .

. *
.

.
. uninformed
.


.
.
.
* Iterative deepening A*
.
1. IDA*
Depth first
. f
. f

.
. *
, Depth-First
.
, f b*f/
. b*d . F
, IDA* 2.3

* .
IDA*
* .

,
. .

.
.
1


.

.
.

.

.

.

. f
.

.

.
. 3- .
0+12=12

20+5=25

E 30+5=35

10+5=15

30+0=30

G 8+5=13

20+0=20

16+2=18

24+0=24

24+0=24

24+5=29

1.
12

5.
15(15)

2.

12

13(15)

15

15

13

15

G
24()

13

4.

6.

3.

15(24)

15

24

24

G
13
H
18

8.

7.

B
15
C
25

20(24)

B
20()
D

20

.
1. .
2. - 12 G .
- -
F(A)=13 . .
3. G- .
.
. - 15
. 18
.
. F(H)=
.
4. G . - I- F(I)=24 .
G- 2 24-
F(G)= 24 . F()=15 F(G)
15 . I
- 15
3

.
.
5. .
. G-
.
6. -
.
7. D- C- .
20 - .
8. D
. D .

Function IDA*() returns


Inputs :
: f_limit
Root (_[])
f_limit f_(root)
loop do
, f_limitDFS_(root, f_limit)
If then return
If f-limit= then return
End

Function DFS_(,f_limit ) returns f



Inputs : , f_limit( )
: _ f, f
.
4

If f_[]>f_limit then null, f_[]


If _[]([]) then return ,
f_limit
For each s in Successors() do
, _fDFS_(s, f_limit)
If then return , f_limit
Next_fMIN(next_f, _f) end
Return null, next_f
2. SMA*
IDA*
.
.

.

.

. *
.

Function SMA*() returns


: , f_

_({(_[])})
loop do
If then return
n f

If _(n) then return success


5

S_(n)
If s then f(s)
Else
F(n) Max(f(n),g(s0)+h(s))
If n- then n-
.
If n- then n-
.
If then , f
.
.
.
s- .
End

3. Hill-climbing
.

.
.



.

.
.
.



.
.
. .
< >- .

ASK TELL .
.
Function _() returns
Static :
t=0 .
Tell ( , __(,t) )
Ask( , _(t))
tell ( , __(,t) )
tt+1
return

. _(t) t
.
Ask, Tell .
.
1. :

.
2.

.
3. :
.
.
.
2 .
1. Syntax :
2. Semantic :
?
.
: <
x>=y > x>=y x -

Syntax

Semantic

.

.
.
()
. .

2 .
.
.
. (English)
.
. : < >
.
.
<-d+c> - d- .
2 .
,
. First Order
logic .
Semantics

? , .
? ?


.
.
. x2+y2 x2, y2 - .

.
. .


. ,
. <
>


. <
>

.
.
. [2.2]
? .
<[2.2] is OK>
.
< [2.2] is OK>
. .

2 .

:
.

2 . , First Order logic.


Propositional
.
. First Order logic
(
)


.
Fuzzy logic ,

.
.

Propositional logic

//

First Order logic

, ,

//

Temporal logic

, , ,

//

0. . . .1

Fuzzy logic

0. . . .1



.
.
.

.
.
.
P

PQ

PQ

PQ

PQ

< 5 >
.

.
. .
((PH) H) P
P < [1.3] . > < [2.2]
. > .

PH ,

H
.

PH

(PH) H

((PH) H) P


. [1.3]
.


.
.
.
.

. Propositional logic-
.
.
Propostional logic

.
. -
. .

.

.
.
. Modus ponens :

1.

2.

1 2 ...... n
i

3.

1 , 2 ,.......... n
1 2 ........ n

4.
5.

k
1 2 ..... n

6.

7.

,
,



.
.
2n n
.

Wumpus World
wumpus World .
.
, .
.
.
. ,
[1.1] .

. .
-

1.4

2.4

3.4

4.4

1.3 !

2.3

3.3

4.3

1.2 , ,

2.2

3.2

4.2

1.1 ,

2.1 , , 3.1

4.1

Y1,2 [ 1.2 ] .
:

1.1

1.1

2.1

2.1

1.2

1.2


.
.

3-
.
1 : 1.1 1.1 1.2 2.1
2 : 2.1 1.1 2.1 2.23.1
3 : 1.2 1.1 1.2 2.21.3
[ 1.2 ]
.
4 : 2.1 1.1 1.2 2.2 1.3

[1.3]
.
1. 1.1 1 1- .

1.1 1.2 2.1


2. 2- .

1.1

1.2

2.1

3. 2.1 2 1- 2-

2.1 ,

2.2 ,

3.1

4. 2.1 4 1-
1.1 1.2 2.2 1.3
5. a=1.2 2.2 1.3 b= 1.1 ( 2- 1.1
) 6-
1.2 2.2 1.3
6.

1.2 1.3 2.2- (3- 2.2 ) 6-


1.2 1.3 .
7. 1.3 1.2 - 6-
1.3 .



.
.
.
ASK .
Propositional Logic <
? >
< ?> .
.
Function Propositional_() returns
Static , 0 .
Tell ( , (, t))
For each in the do
If ASK( , __(t, ) )
then

tt+1

return
end
Propositional logic

. Wumpus
world .
. <
. > 64
. (16 x 4 ). 44-
.

.
.
.
. : Wumpus world [1.1] [1.2]
1.1 12 .
A1.1- .

.
.

. .
01.1 0 02.1 0
11.1 1 12.1 1
21.1 2 22.1 2
01.1 0 02.1 0
01.1 0 02.1 0
01.1 0 02.1 0
100 <
> 6400 . First
Order logic- 6400 1 .

First Order Logic


.
( property ) .
.

.
.
: , , , , ,
.
: - , , , , ,
, .
: , , , .
: best friend, one more than, father of .

. :

. : , ,
. : . : .

.
, . : . : .

FOL
. , ,
. FOL
.


,. . . . .

( , . . . . ) / =
( , . . . )
/
/

: , , , . . .

.
. .

: , . . . .
. :
.

. <> .
:
{<, >, <, >}

: , , . . . . .

.
.

, ,
.

.
. .
() .

:
.

. P(x,y)
x - . (, )
.
( (), () )
.

.
:

(, ) (, )
.

_ (, 30) _(, 30) 30 .

_(, 30) _(, 30) 30-


30- .


FOL 2 .
()
Propositional logic-
. FOL < >
.
(), ()
. < >
. FOL :
() ()
, . ,
.
.
. .
.
() ()
.
.
(),
ground term .

()

.
. :
(,) () .
, .
.
(x, ) ()
(, ) () ( )
.
.
- - -
:
, (,) (,)
, - .
:
(,)
:
(,)

.
( (,) )
. .
[() ( ( , ))]

.
[() ( z ( , z ))]

.

.
.
(y)
.
(, )
x (, )
. :

P x P

x P x P

x P x P
3

x P x P

P Q (PQ)

PQ (P Q)

PQ (P Q)

, ,
.
.
.


FOL-
. 2
. :
()=
2 .
< > .
.
:
{ <, >, <, >, <, >. . . . . . . . }

!

.
! .
! ()
.
.
() () x=y

FOL

.
. < >, <
> , < - , z- parent
z- . > .
.
, , .
, 2 . Parent
, . 2-
, , , , , , . ()
() . :
m,c () (m) Parent (m,c)
Parent .
:
() ()
Parent :
, Parent(p, c) (, )
g,c Grandparent (g, c ) p Parent(g, p)Parent(p,c)


.
.
8- .
.
1. s (s)(s=)(x, s2 (s2)s=(, s2))
2. x, s (, s) =
3. x, s (x, s) s = (, s)
4. x, s (x, s) y, s2 (s=(y, s2) (x=y (x, s2)))
5. s1, s2 (s1, s2)(x (x, s1) (x, s2))
6. s1, s2 (s1= s2)( (s1, s2) (s2, s1)
7. x, s1, s2 (x, (s1, s2)) (x s1) (x s2)
8. x, s1, s2 (x, (s1, s2)) (x s1) (x s2)
.
:
=
{x}=(x, )
{x,y}= (x, (y, ))
{x,y|s}=(x, (y, s))
xy = ( x, y )
xy= ( x,y )
xy= ( x, s )
xy=( x, y )

:
[]=nil
[x]=Cons(x,nil)
[x, y]=Cons(x, Cons(y, nil))
[x, y| l]=Cons(x, Cons(y, l))
:
TELL( , ( m, c (c)(m)Parent(m,c)))
.
TELL( , (() Parent(, )Parent
(, )))
.
ASK( , (, ))
.



. diachronic
. [1.1]
[1.2]
.

.

.

.
.
. S1
. 2
.
At (Agent, [1.1], S0) At (Agent, [1.2], S1)
(, )
.
(, S0)=S1
((), S1)=S2
(, S2)=S3
.

S0

S1

S2

S3

.
s AtGold(s)Present(Gold, s)
x,s Present(x,s)Portable(x) (x, (, s))
.
x,s (x, (, s))

.

.
,
.
a,x,s (x,s)(a)(x, (a, s))
a,x,s (x,s)(a(Present(x,s)Portable(x))
(x, (a, s))
.

.
.
a,x,s(x,(a,s))((a=Present(x,s)Portable(x))
((x,s)a))


Wumpus .
.
.

. 0 ,
90 Y . :
(, S0)=0

.

.
x,y ([x,y],0)=[x+1,y]
x,y ([x,y],90)=[x,y+1]
x,y ([x,y],180)=[x-1,y]
x,y ([x,y],270)=[x,y-1]

.
a,b (a,b) d a=(b,d)
:
x,y ([x,y])(x=0x=5y=0y=5)
.
.
1

a,d,p,s At (p,l, (a,s)) [(a=l=(p,s)


(l))(At(p,l,s)a)]
.
a,d,p,s(p,(a,s))[(a=()d=((p,s)-90, 360))
(a=()d=((p,s)+90,360))((p,s)=d(a=
()a=()))]

?
.
l,s At(Agent, l, s) (s)(l)
l,s At(Agent, l, s) (s)(l)
, ( ,
) , .

. 2 .

:
.
.
a,b,c At(Wumpus, a, s) (a,b)(b)
a,b,c At(, a, s) (a,b)(b)

:
.
:
l,s (l)( a At (Wumpus, a,s )(l=a(a,l))

. ,
.
x, y, g, u, c, s ([, , g, u, c],t) At (Agent, x, s)
(x,y) OK (x,y)
.
x,t (At(Wumpus, x, t ) (x))OK (x)
.

.
.
. , ,
, , .

. .
a,s (a,s) (a,s)
a,s (a,s)( b (b,s)) (a,s)
a,s (a,s)( b (b,s) (b,s)) (a,s)

.

.
s ( , s) ([1.1], s )
.
3- .

:
(ASK ) . 44 Wumpus

.

:
.

.

:
.

You might also like