1 / 16

PROLOG

PROLOG. www.MrsBillinghurst.net. The Prolog Language. Prolog allows us to make use of Facts and Rules in order to establish the relationships between objects in a system. What’s the point??!

talmai
Download Presentation

PROLOG

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PROLOG www.MrsBillinghurst.net

  2. The Prolog Language • Prolog allows us to make use of Facts and Rules in order to establish the relationships between objects in a system. • What’s the point??! • Prolog is predominantly used in AI, however there have also been incidents of Prolog being used to prototype logic, and forming the basis of insurance companies calculating risk and ultimately premiums to be paid. www.MrsBillinghurst.net

  3. Our Family Tree Rules mother(M,X) :- female(M), parent(M,X). father(F,X) :- male(F), parent(F,X). husband(H,X) :- male(H), spouse(H,X). wife(W,X) :- female(W), spouse(X,W). illegitimate(X) :- mother(M,X), father(F,X), not(wife(M,F)). snow(X) :- illegitimate(X). www.MrsBillinghurst.net

  4. www.MrsBillinghurst.net

  5. Are You A Lannister? Facts lannister(tywin). lannister(jaime). lannister(cersai). lannister(tyrion). Rules alwayspaysdebts(x) :- lannister(x). male(tywin). male(jaime). female(cersai). male(tyrion). www.MrsBillinghurst.net

  6. Are You A Lannister? Facts parent(tywin, cersai). parent (tywin, jaime). parent(tywin, tyrion). parent(jaime, joffrey). parent(jaime, myrcella). parent(jaime, tommen). parent(cersai, joffrey). parent(cersai, myrcella). parent(cersai, tommen). spouse(tyrion, sansa). www.MrsBillinghurst.net

  7. Are You A Baratheon? male(robert). male (stannis). male(renly). male(joffrey). female(myrcella). male(tommen). female(shireen). Facts baratheon(robert). baratheon (stannis). baratheon(renly). baratheon(joffrey). baratheon(myrcella). baratheon(tommen). baratheon(shireen). www.MrsBillinghurst.net

  8. Are You A Baratheon? Facts parent(stannis, shireen). parent(selyse, shireen). spouse(stannis,shireen). spouse(robert, cersai). spouse(renly, margaery). spouse(joffrey, margaery). www.MrsBillinghurst.net

  9. www.MrsBillinghurst.net

  10. Are You A Stark? Facts stark(rickard). stark(eddard). stark(robb). stark(brandon). stark(lyanna). stark(benjen). stark(jon). stark(sansa). stark(arya). stark(bran). stark(rickon). www.MrsBillinghurst.net

  11. Are You A Stark? Facts male(rickard). male(eddard). male(robb). male(brandon). female(lyanna). male(benjen). male(jon). female(sansa). female(arya). male(bran). male(rickon). www.MrsBillinghurst.net

  12. Are You A Stark? Facts parent(eddard,robb). parent(eddard,jon). parent(eddard,sansa). parent(eddard,arya). parent(eddard, bran). parent(eddard, rickon). parent(caitlyn, robb). parent(caitlyn,sansa). parent(caitlyn,arya). parent(caitlyn, bran). parent(caitlyn, rickon). spouse(eddard, caitlyn). www.MrsBillinghurst.net

  13. Are You A Targaryan? male(aerys). male(viserys). female(daenrys). male(drogo). Facts targaryan(aerys). targaryan(viserys). targaryan(daenrys). dragon(drogon). dragon(rhaegal). dragon(viserion). dothraki(drogo). www.MrsBillinghurst.net

  14. Are You A Targaryan? Facts parent(daenrys, drogon). parent(daenrys, rhaegal). parent(daenrys, viserion). spouse(drogo, daenrys). Rules wife(x,drogo) :- kalisi(x). Inthevault(x) : dragon(x). www.MrsBillinghurst.net

  15. Anything Else? Facts handoftheking(tywin). handoftheking(jon_arryn). handoftheking(eddard). handoftheking(tyrion). kingofthenorth(robb). kingofthenorth(rickard). www.MrsBillinghurst.net

  16. Anything Else? dead(aerys). dead(viserys). dead(drogo) Facts dead(rickard). dead(lyanna). dead(robert). dead(eddard). dead(renly). dead(joffrey). dead(benjen). dead(caitlyn). dead(robb). likelytodiewithoutwarning(X):- (male(X) ; female(X)), not(dead(X)). www.MrsBillinghurst.net

More Related