[PDF] [PDF] Learn Prolog Now

Our next example shows that Prolog can chain together uses of modus ponens Suppose we ask: ?- It is a good idea to think about Prolog programs in terms of the predicates they contain In essence, the directTrain(freyming,forbach)



Previous PDF Next PDF





[PDF] JOURNAL DE LA - Communauté de commune de Freyming

16 jui 2018 · A Freyming-Merlebach, près de 300 http://www centre-best com/ diversité dans sa programmation : pièces de théâtre, one man show,



[PDF] 1018 THÉODORE GOUVY THEATRE, FREYMING - Amazon AWS

29 oct 2018 · Aseminar at the interiors-focused 100 Design trade show, held problem for them, namely trying to attract the best staff internationally



[PDF] top 15 things to do - Tourisme en Moselle

was voted France's best zoo and animal park in 2019 sainte-croix THE TEMPORARY EXHIBITION SHOWCASES www tourisme-pays-de-freyming-



[PDF] Learn Prolog Now

Our next example shows that Prolog can chain together uses of modus ponens Suppose we ask: ?- It is a good idea to think about Prolog programs in terms of the predicates they contain In essence, the directTrain(freyming,forbach)



[PDF] Ergebnisliste

13 fév 2016 · Best in Show Erwachsene, weiblich Katze: Eu Ch Exokiss Imogene, Perser, white Besitzer: Ropital Luc u Antoinette, Freyming-Merlebach



Framework for multiple hypothesis testing improves the use of

4 mai 2015 · single best-fit model is continuously updated or refined when additional to a geological model project of the Perth Basin, Australia, where we show how it UTAM Est, BP 30006, 57801 Freyming-Merlebach Cedex, France



[PDF] Metz Travel Guide - France Hotel Guide

However, if you see the bright red “FULL” sign, you might get a chance to find a “ Pay and Display” spot friendly and economical, riding your bike is the best way to discover and wander •“Metz is between Siberia and Freyming-Merlebach



[PDF] Bleu Russe & Nebelung - Organisation-feline-belge

Special show(s): Hairless cats, Sacred Birman, Russian Blue Nebelung You can make a separate Best in Show for specific breeds, which must be made 

[PDF] best laptop under 300

[PDF] Best Masters Ranking in Business Intelligence, Knowledge and - Anciens Et Réunions

[PDF] Best Masters Ranking in Insurance

[PDF] Best men`s fashion to celebrate. - Anciens Et Réunions

[PDF] Best Newsletter Article by a Young Practitioner Award

[PDF] Best n°153 - avril

[PDF] Best n°67, février 1974

[PDF] Best of "Grease"

[PDF] Best Of 2005.pub - Juno Beach Centre

[PDF] best of andorre - LCPA Passion Aventure Junior

[PDF] Best of Australie - Aventure

[PDF] Best of Best Poils Courts Best of Best Poils Mi-Longs Best of

[PDF] Best of Content Marketing 2016

[PDF] Best of Cuba

[PDF] Best of Dance : le quatrième concours de danse moderne amateur - Anciens Et Réunions

LearnPrologNow!

PatrickBlackburn

JohanBos

KristinaStriegnitz

patrick@aplog.org jbos@cogsci.ed.ac.uk kris@coli.uni-sb.de

Thiscourseisalsoavailableonline:

Contents

1Facts,Rules,andQueries1

1.2.1Atoms.............................9

2MatchingandProofSearch17

3Recursion37

4Lists55

5Arithmetic69

6MoreLists81

7DefiniteClauseGrammars93

8MoreDefiniteClauseGrammars109

9ACloserLookatTerms125

10CutsandNegation145

12WorkingWithFiles171

1

Facts,Rules,andQueries

Thisintroductorylecturehastwomaingoals:

performingmatchingwiththeaidofvariables. othersyntacticconcepts.

1.1Somesimpleexamples

wayoflearningProlog,it'stheonlyway...

1.1.1KnowledgeBase1

fourfacts: woman(mia). woman(jody). woman(yolanda). playsAirGuitar(jody).

2Chapter1.Facts,Rules,andQueries

whyalittlelater. isawomanbyposingthequery: ?-woman(mia).

Prologwillanswer

yes ?-playsAirGuitar(jody). supposeweaskwhetherMiaplaysairguitar: ?-playsAirGuitar(mia).

Wewillgettheanswer

no ?-playsAirGuitar(vincent). deducedfromtheinformationinKB1.

Similarly,supposeweposethequery:

?-tatooed(jody). cannotbededucedfromtheinformationinKB1.

1.1.Somesimpleexamples3

1.1.2KnowledgeBase2

HereisKB2,oursecondknowledgebase:

listensToMusic(mia). happy(yolanda). listensToMusic(yolanda):-happy(yolanda). itemsarerules. head. ?-playsAirGuitar(mia). weask: ?-playsAirGuitar(yolanda). listensToMusic(yolanda):-happy(yolanda), explicitlyrecordedintheknowledgebase - itisonlyimplicitlypresent(itisinferred

Thus,togetherwiththerule

4Chapter1.Facts,Rules,andQueries

knowledgebase. listensToMusic happy playsAirGuitar andhowtheyareinter-related. "degeneraterules".

1.1.3KnowledgeBase3

happy(vincent). listensToMusic(butch). playsAirGuitar(vincent):- listensToMusic(vincent), happy(vincent). playsAirGuitar(butch):- happy(butch). playsAirGuitar(butch):- listensToMusic(butch). threerules. rule

1.1.Somesimpleexamples5

playsAirGuitar(vincent):- listensToMusic(vincent), happy(vincent).

Thus,ifweposedthequery

?-playsAirGuitar(vincent). writtenitas codereadable. playsAirGuitar(butch):- happy(butch). playsAirGuitar(butch):- listensToMusic(butch). ?-playsAirGuitar(butch). playsAirGuitar(butch):- listensToMusic(butch).

6Chapter1.Facts,Rules,andQueries

toconcludethatplaysAirGuitar(butch). rulesgivenabovebythesinglerule playsAirGuitar(butch):- happy(butch); listensToMusic(butch).

1.1.4KnowledgeBase4

HereisKB4,ourfourthknowledgebase:

woman(mia). woman(jody). woman(yolanda). loves(vincent,mia). loves(marcellus,mia). loves(pumpkin,honey_bunny). loves(honey_bunny,pumpkin).

Here'sanexample:

?-woman(X). aboutisawoman.

1.1.Somesimpleexamples7

X=mia binding,orinstantiationthatledtosuccess. Butthat'snottheendofthestory.Thewholepointofvariables - andnotjustin Prologeither - isthattheycan"standfor"or"matchwith"differentthings.And

X=jody

time,Prologreturnstheanswer

X=yolanda

Let'stryamorecomplicatedquery,namely

loves(marcellus,X),woman(X). theanswer X=mia ofProlog.Forsure,Prologhasmanyotherinterestingaspects - butwhenyouget variablebindingtousthatiscrucial.

8Chapter1.Facts,Rules,andQueries

1.1.5KnowledgeBase5

KB5: loves(vincent,mia). loves(marcellus,mia). loves(pumpkin,honey_bunny). loves(honey_bunny,pumpkin). jealous(X,Y):-loves(X,Z),loves(Y,Z). doesitsay? orpumpkin,oranyoneinparticular - it'saconditionalstatementabouteverybodyin ourlittleworld.

Supposeweposethequery:

?-jealous(marcellus,W).

Mia.SoPrologwillreturnthevalue

W=vincent

1.2PrologSyntax

1.2.PrologSyntax9

rules,andqueriesbuiltoutof? termsofProlog. unbrokensequenceofcharacters.

1.2.1Atoms

Anatomiseither:

butch,big_kahuna_burger,andm_monroe2. spacesinsuchatoms - infact,acommonreasonforusingsinglequotesisso wecandopreciselythat. pre-definedmeaning.

1.2.2Numbers

inthiscourse.

1.2.3Variables

areallPrologvariables.

10Chapter1.Facts,Rules,andQueries

1.2.4Complexterms

structures. recursivedefinition).Forexample hide(X,father(father(father(butch)))) stantbutch. termwitharity2. pletelydifferentpredicates. listensToMusic happy playsAirGuitar

1.3.Exercises11

weshouldreallysaythatitdefinespredicates listensToMusic/1 happy/1 playsAirGuitar/1 pletelydistinct.

1.3Exercises

variables,andwhichareneither?

1.vINCENT

2.Footmassage

3.variable23

4.Variable2000

5.big_kahuna_burger

6.'bigkahunaburger'

7.bigkahunaburger

8.'Jules'

9._Jules

10.'_Jules'

andarityofeachcomplexterm.

1.loves(Vincent,mia)

2.'loves(Vincent,mia)'

3.Butch(boxer)

4.boxer(Butch)

5.and(big(burger),kahuna(burger))

6.and(big(X),kahuna(X))

7._and(big(X),kahuna(X))

12Chapter1.Facts,Rules,andQueries

8.(ButchkillsVincent)

9.kills(ButchVincent)

10.kills(Butch,Vincent

contain? woman(vincent). woman(mia). man(jules). person(X):-man(X);woman(X). loves(X,Y):-knows(Y,X). father(Y,Z):-man(Y),son(Z,Y). father(Y,Z):-man(Y),daughter(Z,Y).

1.Butchisakiller.

2.MiaandMarcellusaremarried.

3.Zedisdead.

5.Mialoveseveryonewhoisagooddancer.

wizard(ron). hasWand(harry). quidditchPlayer(harry). wizard(X):-hasBroom(X),hasWand(X). hasBroom(X):-quidditchPlayer(X).

1.wizard(ron).

2.witch(ron).

3.wizard(hermione).

4.witch(hermione).

5.wizard(harry).

6.wizard(Y).

7.witch(Y).

1.4.PracticalSession113

1.4PracticalSession1

shorterthanthetextyouhavejustread - thepracticalpartofthecourseisdefinitely downinfrontofacomputerandplaywithProlog - alot! somethinglike return.Thatis,type ?-listing. andpressthereturnkey. aboutanyknowledgebases,soitwilljustsay yes Thisisacorrectanswer:asyetPrologknowsnothing - soitcorrectlydisplaysall anyknowledgebases!"answer. is ?-[kb2].

14Chapter1.Facts,Rules,andQueries

yes file. ?-listing. listensToMusic(mia). happy(yolanda). playsAirGuitar(mia):- listensToMusic(mia). playsAirGuitar(yolanda):- listensToMusic(yolanda). listensToMusic(yolanda):- happy(yolanda). yes beenloaded. ?-listing(playsAirGuitar). icate.SointhiscasePrologwilldisplay playsAirGuitar(mia):- listensToMusic(mia). playsAirGuitar(yolanda):- listensToMusic(yolanda). yes

1.4.PracticalSession115

Well - nowyou'rereadytogo.KB2isloadedandPrologisrunning,soyoucan(and mastertogetthisfar: tousethistowriteyourPrologcode. whereyouwantit. alotlonger). knowledgebasefromscratch...

16Chapter1.Facts,Rules,andQueries

2

MatchingandProofSearch

Today'slecturehastwomaingoals:

Prologpredicateformatching.

2.1Matching

means.

Recallthattherearethreetypesofterm:

24).

2.Variables.

18Chapter2.MatchingandProofSearch

termsequal. theyarethesameatom,orthesamenumber. eachother,andwesaythattheysharevalues.) (a)Theyhavethesamefunctorandarity. (b)Alltheircorrespondingargumentsmatch theymatch. don'tmatch.

2.1.Matching19

2.1.1Examples

ifweposethequery =(mia,mia). =(mia,vincent).

Prologwillrespond'no'.

mia=mia. nicer)infixnotation.

Let'sreturntothisexample:

mia=mia. yes matchingsucceeds. 2=2. yes mia=vincent. no

20Chapter2.MatchingandProofSearch

quotesdbs_dbs27.pdfusesText_33