11LispProlog·--··--2P12-183P18-201a)b)c)d)e)a)LIKE(x,y)xy,PERSON(x)((∃x)PERSON(x)LIKE(x,))((∃y)PERSON(y)LIKE(y,))((∃x)PERSON(x)LIKE(x,)LIKE(y,))2b)PLAY(x,y):xyAFTERNOON(t),t(∃x)(∀t)(AFTERNOON(t)→PLAY(x,))c)Computer(x):xNewType(x)xHaveSpeed(x,y)xyHigh(y):yHaveMemory(x,z)xzLarge(z)z(Computer(x)NewType(x))→(High(y)HaveSpeed(x,y))(Large(z)HaveMemory(x,z))d)Computer(x):xStudent(x):xLike(x,y)(∀x)((Computer(x)Student(x))→Like(x,programming))e)(∀x)(Person(x)Like(x,programming)→Like(x,computer)2P383a)3×38b)c)IFTHEN41)2)3)4)5)5a)b)37c)d)5632e)3213a)P(x,B,B)P(A,y,z)b)P(g(f(v)),g(u))P(x,x)c)P(x,f(x))P(y,y)d)P(y,y,B)P(z,x,z)1)P(x,B,B)P(A,y,z)Mgu={A/x,B/y,B/z}2)P(g(f(v)),g(u))P(x,x)3)P(x,f(x))P(y,y)4)P(y,y,B)P(z,x,z)Mgu={B/x,B/y,B/z}2(((PQ)→R)→(PR))(((PQ)→R)→(PR))=((PQ)→R)(PR)=((PQ)R)(PR)=(PR)(QR)(PR)S={PR,QR,PR}3HerbrandH4S={P(x),Q(f(x),y)}HSH{a,f(a),f(f(a)),……}SP(a),Q(f(a),f(a))P(f(a)),Q(f(f(a)),a)5a)xyyzxzb)uv,vufather(x,y):xyGrandfather(x,y):xy11))(∀x)(∀y)(∀z)father(x,y)father(y,z)→Grandfather(x,z)2)(∀y)(∃x)father(x,y)(∀u)(∃v)Grandfather(v,u)F{(∀x)(∀y)(∀z)father(x,y)father(y,z)→Grandfather(x,z)(∀y)(∃x)father(x,y)(∀u)(∃v)Grandfather(v,u)}FS{father(x,y)father(y,z)Grandfather(x,z)father(f(w),w),4Grandfather(f(u),u)}Sfather(x,y)father(y,z)Grandfather(x,z)6a)b)c)d)O1e)O21)(x)(pushable(x))→blue(x))→(x)(pushable(x)→green(x))2)(x)(((blue(x)green(x))(blue(x)green(x)))3)(x)(pushable(x))→(x)(pushable(x)→blue(x))4)pushable(O1)5)pushable(O2)(x)(green(x))1(1)pushable(x)green(x)(2)blue(a)pushable(y)green(x)2(3)green(x)blue(x)(4)green(x)blue(x)3(5)pushable(x)pushable(y)blue(y)4(6)pushable(O1)5(7)~pushable(O2)(8)green(x)(9)blue(x)pushable(y)(2)(8)(10)blue(x)(7)(9)(11)blue(x)(4)(8)(12)□(10)(11)7xyzGtxyGtyz→GtxzuvSuccuv→Gtuvx~GtxxGt5258a)TonyMikeJohnAlpineb)Alpinec)d)MikeTonyTonye)TonyAlpineSkier(x)xAlpinist(x)xAlpine(x)xAlpine(1)Alpine(Tony)(2)Alpine(Mike)(3)Alpine(John)(4)(∀x){Alpine(x)→[Skier(x)Alpinist(x)]}(5)(∀x){Alpinist(x)→~Like(x,Rain)}(6)(∀x){~Like(x,Snow)→~Skier(x)}(7)(∀x){Like(Tony,x)→~Like(Mike,x)}(8)(∀x){~Like(Tony,x)→Like(Mike,x)}(9)Like(Tony,Snow)(10)Like(Tony,Rain)(∃x){Alpine(x)Alpinist(x)~Skier(x)}69ONTABLEACLEAREONTABLECCLEARDONDCHEAVYDONBAWOODENBHEAVYBONEBB(x)(∃y){[BIG(x)BLUE(x)]→ON(x,y)GREEN(y)}(x){[HEAVY(x)WOODEN(x)]→BIG(x)}(x){CLEAR(x)→BLUE(x)}(x){WOODEN(x)→BLUE(x)}(∃x)(∃y)GREEN(y)ON(x,y)SkolemSkolemONTABLEACLEAREONTABLECCLEARDONDCHEAVYDONBAWOODENBHEAVYBONEBr1:[BIG(x1)BLUE(x1)]→ON(x1,f(x1))r2:[BIG(x2)BLUE(x2)]→GREEN(f(x2))r3:[HEAVY(x3)WOODEN(x3)]→BIG(x3)r4:CLEAR(x4)→BLUE(x4)r5:WOODEN(x5)→BLUE(x5)GREEN(y)ON(x,y)7{B/x,f(B)/y}GREEN(f(B))ON(B,f(B))Bf(B)B10(1)s~Ps(2)sPgs(3)xsyPsQbxs→Hy(4)xsQbxs→Qbxgs(5)xsy~Ps→Qbxy(x)H(x)(x)H(x)skolem1(s)~P(a)2(s)(P(g(s)))P(g(s))3(x)(s)(y)((P(s)Q(bxs))→H(y)(P(s)Q(bcs))→H(f(s))4(x)(s)(Q(bxs)→Q(bxg(s)))Q(bxs)→Q(bxg(s))5(x)(s)(y)(~P(s)→Q(bxy))8~P(s)→Q(bxh(x,s))~P(a)P(g(s1))r1:(P(s2)Q(bcs2))→H(f(s2))r2:Q(bx3s3)→Q(bx3g(s3))r3:~P(s4)→Q(bx4h(x4,s4))skolem(x)H(x)H(x)()U1U2U1=(x,s2,x3,s2,x4,s3,s4)U2=(f(s2),g(s1),c,g(s3),c,h(x4,s4),a)U1U2{f(g(h(c,a)))/x,g(h(c,a))/s2,c/x3,h(c,a)/s3,c/x4,h(c,a)/s1,a/s4}}x=f(g(h(c,a)))91P1222P123-P1243R1E1→HCFHE10.9R2E2→HCFHE20.6R3E3→HCFHE3-0.5R4E4(E5E6)→E1CFE1E4(E5E6)0.9CFE20.8CFE30.6CFE40.5CFE50.6CFE60.8,CFH=0CFHCF(E1)=0.8*max{0,CF(E4AND(E5ORE6))}=0.8*max{0,min{CF(E4),CF(E5ORE6)}}=0.8*max{0,min{0.5,max(CF(E5),CF(E6)}}=0.8*max{0,min{0.5,0.8}}=0.8*max{0,0.5}=0.8*0.5=0.4CF1(H)=CF(H,E1)*max{0,CF(E1)}=0.9*0.4=0.36CF2(H)=CF(H,E2)*max{0,CF(E2)}=0.6*0.8=0.48CF3(H)=CF(H,E3)*max{0,CF(E3)}=-0.5*0.6=-0.3CF12(H)=CF1(H)+CF2(H)-CF1(H)*CF2(H)=0.36+0.48-0.36*0.48=0.67CF123(H)=(CF12(H)+CF3(H))/(1-min{|CF12(H)|,|CF3(H)|})=(0.67+(-0.3))/(1-0.3)=0.534E1,E2,E3,E4,H.H0.03,R1:E1→HLS=20LN=1R2:E2→HLS=300LN=1R3:E3→HLS=75LN=1R4:E4→HLS=4LN=1:(1)P(H)=0.03,:O(H)=P(H)/(1-P(H))=0.03/1-0.03=0.030927(2)R1,:O(H|E1)=LS*O(H)=20*0.030927=0.61854P(H|E1)=O(H)/(1+O(H))=0.382(3)R2,:(3)R2,:O(H|E1,E2)=O(H|E1)/O(H)*O(H|E2)/O(H)*O(H)=LS*O(H|E1)=300*0.61854=185.562P(H|E1,E2)=O(H|E1,E2)/(1+O(H|E1,E2)=0.99464(4)R3,:10O(H|E1,E2,E3)=LS*O(H|E1,E2)=13917.15P(H|E1,E2,E3)=0.99993(5)R3,:O(H|E1,E2,E3,E4)=LS*O(H|E1,E2,E3)=55668.6P(H|E1,E2,E3,E4)=0.9999853:E,H10.03R1E→H1LS=20LN=1R2H1→H2LS=300LN=0.0001P(H2)0.01,P(H2|E):(1)R1P(H1)=0.03,:P(H1|E)=LS*P(H1)/((LS-1)*P(H1)+1)=20*0.03/((20-1)*0.03+1)=0.382(2)H1,.P(H1|E)P(H1),P(H1|E)=P(H1),:P(H2|E)=P(H2)=0.01P(H1|E)=1,:P(H2|E)=P(H2|H1)=LS*P(H2)/((LS-1)*P(H2))+1=0.75188(3)P(H2|E)=0.01+(0.75188-0.01)/(1-0.03)*(0.382-0.03)=0.2792152522a)L5,L20=L5=550=L2=22b)r1IF(L5,L2)THEN(5,L2)/*L5*/r2IF(L5,L2)THEN(L5,2)/*L2*/r3IF(L5,L2)THEN(0,L2)/*L5*/r4IF(L5,L2)THEN(L5,0)/*L2*/r5IF(L5,L2)andL5+L2=5THEN(L5+L2,0)/*L2L5*/r6IF(L5,L2)andL5+L25THEN(5,L5+L2-5)/*L2L5*/r7IF(L5,L2)andL5+L2=2THEN(0,L5+L2)/*L5L2*/r8IF(L5,L2)andL5+L25THEN(L5+L2-2,2)/*L5L2*/c)(5,0)d)(x,1)x(0,1)2111,x,y,z,nx,y,x[0,1]10n=0,1,2,3n2r1:IF(x,y,z,n)THEN(~x,y,z,n+1)r2:IF(x,y,z,n)THEN(x,~y,z,n+1)r3:IF(x,y,z,n)THEN(x,y,~z,n+1)~xx3(1,1,0,0)4(1,1,1,3)(0,0,0,3)3a)b)41-25AAP2005-3351-3P2005-3461-4ABAP2005-367hASTf12fF(16)S-B-F-J-T