45 6 71 3 1
play

45'6(71+! 3%(1#&$/()#% - PowerPoint PPT Presentation

45'6(71+! 3%(1#&$/()#% "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% ! 9$(:)%7 3%(1#&$/)%.+01#:#.+61#.1'2*+'%&+;$71)7* <5#=)%.+(57+'&>'%('.7*+#,+&7/:'1'()>7+61#.1'22)%.


  1. 45'6(71+! 3%(1#&$/()#% "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !

  2. 9$(:)%7 3%(1#&$/)%.+01#:#.+61#.1'2*+'%&+;$71)7* <5#=)%.+(57+'&>'%('.7*+#,+&7/:'1'()>7+61#.1'22)%. 3::$*(1'()%.+*5#1(/#2)%.*+#,+01#:#. "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% 8

  3. @+01#:#.+01#.1'2 direct(frankfurt,san_francisco). "'/(* direct(frankfurt,chicago). direct(san_francisco,honolulu). direct(honolulu,maui). A$:7* connection(X, Y) :- direct(X, Y). connection(X, Y) :- direct(X, Z), connection(Z, Y). "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% ?

  4. C$71)7*+D3E direct(frankfurt,san_francisco). direct(frankfurt,chicago). direct(san_francisco,honolulu). direct(honolulu,maui). connection(X, Y) :- direct(X, Y). connection(X, Y) :- direct(X, Z), connection(Z, Y). | ?- connection(frankfurt, maui). yes "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% B

  5. C$71)7*+D33E direct(frankfurt,san_francisco). direct(frankfurt,chicago). direct(san_francisco,honolulu). direct(honolulu,maui). connection(X, Y) :- direct(X, Y). connection(X, Y) :- direct(X, Z), connection(Z, Y). | ?- connection(san_francisco, X). X = honolulu ; X = maui ; no "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% F

  6. C$71)7*+D333E direct(frankfurt,san_francisco). direct(frankfurt,chicago). direct(san_francisco,honolulu). direct(honolulu,maui). connection(X, Y) :- direct(X, Y). connection(X, Y) :- direct(X, Z), connection(Z, Y). | ?- connection(maui, X). no "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% G

  7. @%+326#1('%(+I'('+<(1$/($17J+-)*(* K ! ! "###"$ ! " L K %&&'() M &(%*) M &'+,) L K !"#$ +N+ %#&' L O+K %&&'() +N+K &(%*) M &'+,) LL member(X, [X | List]). member(X, [Y | List]) :- member(X, List). member_both(X, L1, L2) :- member(X, L1), member(X, L2). | ?- member_both(X, [apples,pears,plums], [peaches,plums,pears]). X = pears ; X = plums ; no "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% H

  8. @%+32671'()>7+01#.1'2+,#1+4#26'1)*#% -.&( + (&)% O %**%. K !## " L+ /0 + &*%"+", Q &*/1(2+*( + -"-.",) D ! M+ # +J+ (&)% Q+ 3%* + $ +J+ (&)% Q+ 3%* + % +J+ &*%"+", EQ + 3%* + & M+ ' M+ ( +J+ &*%"+", Q + 4(567 + ( +JO+ ! Q + 0/* + & +JO+ ! + -/ + " + 2/ + 0/* + ' +JO+ ! + -/ + " + 2/ + 60 + ! K & L+O+ # K ' L+ -8(7$4(567 + $ K ( L+JO+ ! K & LQ )( +JO+ ( $9$! + (72 Q + % +JO++ ( $:$! ++ (72 Q "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% P

  9. I7/:'1'()>7+01#.1'2*+'17+":7S)T:7 member(X, [X | List]). member(X, [Y | List]) :- member(X, List). member_both(X, L1, L2) :- member(X, L1), member(X, L2). | ?- member_both(pears,[apples,pears,plums],[peaches,plums,pears]). yes | ?- member_both(apples,[apples,pears,plums],[peaches,X]). X = apples "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% R

  10. I7/:'1'()>7+01#.1'2*+'17+":7S)T:7 VW++S+X+U+O+S++WV add(X,0,X). VW++S+X+Y+O+Z+ [+S+X+*DYE+O+*DZE+ +WV add(X,s(Y),s(Z)) :- add(X,Y,Z). | ?- add(s(0),s(0),Z). Z = s(s(0)) | ?- add(X,Y,s(s(0))). X = s(s(0)), Y = 0 ; X = s(0), Y = s(0) ; X = 0 Y = s(s(0)) "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !U

  11. \7(+@%#(571+I7/:'1'()>7+<67/),)/'()#% ]57+*;$'17+#,+BF+)*+8U8FM+'%&+8U+X+8F+)*+BFM+)*%^(+(5'(+*(1'%.7_ ")%&+2#17+6')1*+#,+%$2T71*+(5'(+7S5)T)(+(5)*+67/$:'1)(Y` solution(N, Z) :- between(1, 99, N), Z is N*N, Z >= 1000, (Z // 100) + (Z mod 100) =:= N. | ?- solution(N, Z). N = 45, Z = 2025 ; N = 55, Z = 3025 ; N = 99, Z = 9801 "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !!

  12. 01#.1'22)%.+-'%.$'.7* 32671'()>7+01#.1'22)%.+-'%.$'.7* a I7/:'1'()#%+6'1(+&7,)%7*+6#**)T:7+*('(7*+D#,+>'1)'T:7*EQ+*('(727%(+6'1(+&7,)%7* (1'%*,#12'()#%+#%+*('(7* a 4:#*7+(#+>#%+b7$2'%%+/#26$(71+'1/5)(7/($17 a I7*/1)6()#%+#,+ 8/; +*#27(5)%.+)*+/#26$(7& a cS'26:7J+d'>' I7/:'1'()>7+01#.1'22)%.+-'%.$'.7* a @T*(1'/()#%+,1#2+*('(7*+'%&+*('(7+(1'%*,#12'()#%* a I)17/(+,#12$:'()#%+#,+2'(572'()/':+#Te7/(*+D,$%/()#%*M+17:'()#%*M+/#%*(1')%(*E a I7*/1)6()#%+#,+ ;8%- +)*+/#26$(7& a cS'26:7J+01#:#.M+c/:)6*7M+f'*g7::M+'%&+4$11Y "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !8

  13. I7/:'1'()>7+01#.1'22)%.+-'%.$'.7* -#.)/+01#.1'22)%.+-'%.$'.7* cS'26:7+:'%.$'.7J+01#:#. 4#%*(1')%(+-#.)/+01#.1'22)%.+-'%.$'.7* cS'26:7+:'%.$'.7J+c/:)6*7 "$%/()#%':+01#.1'22)%.+-'%.$'.7* cS'26:7+:'%.$'.7J+f'*g7:: 3%(7.1'(7&+D"$%/()#%':a:#.)/E+01#.1'22)%.+-'%.$'.7* cS'26:7+:'%.$'.7J+4$11Y "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !?

  14. @&>'%('.7*+#,+I7/:'1'()>7+01#.1'22)%. <67/),)/'()#%*+'17+61#.1'2* ]57+/#26$('()#%+27/5'%)*2+)*+%#(+6'1(+#,+(57+61#.1'2 h]5)%g)%.i+&7/:'1'()>7:Y+)*+7'*)71+(5'%+h(5)%g)%.i+61#/7&$1'::Y I7/:'1'()>7+61#.1'2*+'17+(5717,#17+2$/5+*)26:71+(#+$%&71*('%&M+&7>7:#6M+ '%&+>71),Y ]57+#$(6$(+#,+'+:#.)/+61#.1'2+)*+'+:#.)/':+/#%*7;$7%/7+#,+(57+61#.1'2 -#.)/+61#.1'2*+'17+,:7S)T:7 "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !B

  15. <5#1(/#2)%.*+#,+01#:#.J+]712)%'()#%+D3E direct(frankfurt,san_francisco). direct(frankfurt,chicago). direct(san_francisco,honolulu). direct(honolulu,maui). direct(san_francisco,san_francisco). connection(X, Y) :- direct(X, Y). connection(X, Y) :- direct(X, Z), connection(Z, Y). | ?- connection(san_francisco, X). X = honolulu ; X = san_francisco ; X = maui ; X = honolulu ; ... "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !F

  16. <5#1(/#2)%.*+#,+01#:#.J+]712)%'()#%+D33E direct(san_francisco,san_francisco). direct(frankfurt,san_francisco). direct(frankfurt,chicago). direct(san_francisco,honolulu). direct(honolulu,maui). connection(X, Y) :- direct(X, Y). connection(X, Y) :- direct(X, Z), connection(Z, Y). | ?- connection(san_francisco, X). X = san_francisco ; X = honolulu ; X = san_francisco ; X = honolulu ; ... "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !G

  17. <5#1(/#2)%.*+#,+01#:#.J+]712)%'()#%+D333E direct(frankfurt,san_francisco). direct(frankfurt,chicago). direct(san_francisco,honolulu). direct(honolulu,maui). direct(san_francisco,san_francisco). connection(X, Y) :- direct(X, Z), connection(Z, Y). connection(X, Y) :- direct(X, Y). | ?- connection(san_francisco, X). X = maui ; X = maui ; X = maui ; ... "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !H

  18. <5#1(/#2)%.*+#,+01#:#.J+]712)%'()#%+D3jE direct(san_francisco,san_francisco). direct(frankfurt,san_francisco). direct(frankfurt,chicago). direct(san_francisco,honolulu). direct(honolulu,maui). connection(X, Y) :- direct(X, Z), connection(Z, Y). connection(X, Y) :- direct(X, Y). | ?- connection(san_francisco, X). _ "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !P

  19. <5#1(/#2)%.*+#,+01#:#.J+h9//$1+457/gi+a+"'):$17 @+671*#%+ / +'%&+(57+2#(571+#,+ / +/'%+%7>71+T7+(57+*'27k mystery :- same_person(X, mother_of(X)). same_person(Z, Z). | ?- mystery. yes "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% !R

  20. <5#1(/#2)%.*+#,+01#:#.J+ 3*+01#:#.+]1$:Y+I7/:'1'()>7_ ]5)*+1$:7+/'%+#%:Y+T7+h/'::7&i+),+'::+(5177+'1.$27%(*+'17+%$2T71*J between(X, Y, Z) :- X =< Z, Z =< Y. ]5)*+)*+(57+h*)26:7*(i+$*'T:7+*67/),)/'()#%J between (X, Y, Z) :- X =< Y, Z is X. between (X, Y, Z) :- X < Y, X1 is X+1, between(X1, Y, Z). "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% 8U

  21. f#=+(#+l*7+'+01#:#.+<Y*(72+D3E % add-program in file add.pl: add(X,0,X). add(X,s(Y),s(Z)) :- add(X,Y,Z). irz601:~> sicstus SICStus 3 #5: Fri Nov 1 15:49:55 MET 1996 | ?- [add]. {consulting/usr/users/ith/ak15/add.pl...} {/usr/users/ith/ak15/add.pl consulted, 0 msec 352 bytes} yes | ?- add(X,Y,s(s(0))). "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% 8!

  22. f#=+(#+l*7+'+01#:#.+<Y*(72+D33E X = s(s(0)), Y = 0 ? ; X = s(0), Y = s(0) ? ; X = 0, Y = s(s(0)) ? ; no | ?- halt. "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% 88

  23. 9Te7/()>7* 3%(1#&$/)%.+01#:#.+61#.1'2*+'%&+;$71)7* <5#=)%.+(57+'&>'%('.7*+#,+&7/:'1'()>7+61#.1'22)%. 3::$*(1'()%.+*5#1(/#2)%.*+#,+01#:#. "#$%&'()#%*+#,+-#.)/+01#.1'22)%. 3%(1#&$/()#% 8?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend