1 / 12

TS2023 Chapter 1: introduction to Prolog What is PROLOG ?? PROLOG – PRO gamming in LOG ic

TS2023 Chapter 1: introduction to Prolog What is PROLOG ?? PROLOG – PRO gamming in LOG ic Early 1970s- programming language. Robert Kowalski(Edinburgh) in theory aspect & Colmersuer(Marseilles) in implementation aspect.

hilld
Download Presentation

TS2023 Chapter 1: introduction to Prolog What is PROLOG ?? PROLOG – PRO gamming in LOG ic

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. TS2023 Chapter 1: introduction to Prolog • What is PROLOG ?? • PROLOG – PROgamming in LOGic • Early 1970s- programming language. • Robert Kowalski(Edinburgh) in theory aspect & Colmersuer(Marseilles) in implementation aspect. • Associated with mantic logic and it is a programming language for symbolic calculation and non-numeric

  2. TS2023 Chapter 1: introduction to Prolog • Most suitable – solve the problems associated with the objects and relationships between objects, pattern matching problem, back tracking problem and incomplete problems. • Prolog algorithm consists of logic and control • Logic - fact and rules that describe what should be done by algorithm • Control - a way algorithm can be implemented by using the rules • syntax in clause form or First Order Predicate Logic formula.

  3. TS2023 Chapter 1: introduction to Prolog Clause:- parent(siti,abu). parent (ali,abu). parent (ali,rini). parent (abu,ani). parent (abu,alia). parent (alia,mat). parent (rini,adri). siti ali abu rini ani alia adri mat Figure 1.1 Family Tree

  4. TS2023 Chapter 1: introduction to Prolog Qs:- ?-parent(abu,alia). ?-parent(rini,alia). ?-parent(ali,ahmad). ?-parent(X,rini). ?-parent(abu,X). ?-parent(X,Y).

  5. TS2023 Chapter 1: introduction to Prolog • Complex Qs:- • Who are parents of Mat? Assume Y. • Who are parents of Y? Assume Y. X Grandfather/Grandmother Y mat

  6. TS2023 Chapter 1: introduction to Prolog • Statement in Prolog:- • ?-parent(Y,mat),parent(X,Y). • Question 2 • Who are parents of Ani? Assume X. • Are parents (X) same with parents for alia? • Statement in Prolog:- • ?-parent(X,ani),parent(X,alia).

  7. TS2023 Chapter 1: introduction to Prolog Extra Example:- : Aliya and Hasan world. Power_Ranger is a toy. Snoopy is a toy. Aliya play with Snoopy. Aliya likes every toy that she play with. Hasan likes what Aliya likes. Terjemahan dlm prolog toy(power_ranger). toy(snoopy). play(aliya,snoopy). likes(aliya,X):-toy(X),play(aliya,X). likes(hasan,Y):-likes(aliya,Y).

  8. TS2023 Chapter 1: introduction to Prolog Fact and rule Fact – represents a unit of information which always true. Example :- Sky is blu sky(blue). Today is raining today(raining). Sim likes apple likes(sim,apple).

  9. TS2023 Chapter 1: introduction to Prolog Control – a relationship between facts by using the logical implications‘:-’. Example:- X dan Y are friends if there is a Z where X likes Z and Y likes Z. Prolog statement Sim loves book loves(sim,book). Siti loves book loves(siti,book). friends(sim,siti):-loves(sim,book),loves(siti,book).

  10. TS2023 Chapter 1: introduction to Prolog Expansion the program using rules Example:- Include the gender as additional information female(Siti). male(ali). male(abu). female(rini). ……

  11. TS2023 Chapter 1: introduction to Prolog Example:- For every X and Y, X is mother of Y if X is parent of Y and X is female. Prolog statement mother(X,Y):- parent(X,Y),female(X).

  12. Individual exercise • Please make a family tree program respectively. • Genealogies should have: • Uncle & aunty • son & daughter • Grandmother & grandfather • Grandchild • Great-grandmother & great-grandfather • Second cousin • Mother in law / father in law • Daughter in law • Extra mark untuk extra predikat.

More Related