SlideShare a Scribd company logo
UMESHCHANDRA YADAV
ROLL NO.1783910909
III year CSE
Introduction of Prolog
Content
 Introduction
 SWI_PROLOG
 Fundamentals of PROLOG
 Application
 References
Introduction
PROgramming in LOGic.
Declarative language.
It is widely used in the field ofAI.
LISP is also a logic programing.
Problem in Declarative Form
Logic Machine
Basic Machine
• Open source software is software that can be freely used, changed, and shared
(in modified or unmodified form) by anyone.
• SWI-Prolog offers a comprehensive FREE SOFTWARE Prolog
environment.
• Link for downloading: http://www.swi-prolog.org/download/stable
• A Self-installing in MS-Windows: swipl-win.exe
• LINUX versions are also available.
• Use command sudo apt-get install swi-prolog
SWI-Prolog
Fundamentals
1. Facts
2. Rules
3. Query
4. Unification
5. Backtracking
6. Recursion
Facts
• Facts are statements about what is true about a problem, instead of instructions
how to accomplish the solution.
• Facts are properties of objects or relationships between objects.
• A relation identifier is referred to as a predicate.
Syntax for fact declaration
• Names of relationship and objects must begin with a lower- case letter.
• Relationship is written first (typically the predicate of the sentence).
• Objects are written separated by commas and are enclosed by a pair of round
brackets.
• The full stop character ‘.’ must come at the end of a fact.
Ex. phoneno(ramesh, 12345….).
Predicate
valuable(gold)
buy( john,gold)
father( john, mary)
gives (john,book,mary)
Interpretation
Gold is valuable.
John buygold.
John is thefatherof Mary
John gives thebookto Mary
Examples of Facts
Rules
• Specifies under what conditions a tuple of
values satisfies a predicate.
• The basic building block of a rule is called an
atom
• Atom :- Atom1, ...,AtomN
• If each of Atom1,...,AtomN is true, then Atom
is also true.
Syntax Rules
<head> :- <body>
Read ‘:-’ as ‘if’.
likes(john,X) :-likes(X,cricket).
“John likes X if X likes cricket”.
i.e., “John likes anyone who likes cricket”.
Rules always end with ‘.’
It is based on Facts and Rules.
Queries is terminated by full stop.
If queries is true then its succeeds.
If queries is false then its failed.
Queries
?- likes(john,X).
?- likes (john,Something).
Arithmetic in Prolog
Prolog provides a number of basic arithmetic tools.
Arithmetic examples
6 + 2 = 8
6 ∗2 = 12
Prolog Notation
8 is 6+2.
12 is 6*2.
Answers to arithmetic questions by using ariables.
For example:
?- X is 6+2.
X=8
Example
Queries
o | ? likes(mary, cricket).
o yes.
o | ? likes(mary,football).
o no.
Facts: ()
◦ likes(john,football).
◦ likes(john, cricket).
◦ likes(mary, cricket).
◦ likes(mary ,john).
Unification
Its is use of pattern matching in Prolog.
Backtracking
When a task fails Prolog trace backwards and tries to satisfy
previous task.
Recursion
Recursion use for any search in program.
Application
Expert Systems (Knowledge Representation and Inferencing)
Natural Language Processing
Artificial Intelligence
Pattern Matching etc.
References
1. www.swi-prolog.org/
2. http://www.learnprolognow.org/
Thank You

More Related Content

What's hot

Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced concepts
AminaRepo
 
Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming Language
Reham AlBlehid
 
Annotations
AnnotationsAnnotations
Annotations
Ostap Maliuvanchuk
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingMike Clement
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introduction
wahab khan
 
Python 45 minutes Hangouts #4
Python 45 minutes Hangouts  #4Python 45 minutes Hangouts  #4
Python 45 minutes Hangouts #4
Al Sayed Gamal
 
Executable specifications for xtext
Executable specifications for xtextExecutable specifications for xtext
Executable specifications for xtextmeysholdt
 

What's hot (8)

Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced concepts
 
Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming Language
 
Annotations
AnnotationsAnnotations
Annotations
 
Using Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit TestingUsing Rhino Mocks for Effective Unit Testing
Using Rhino Mocks for Effective Unit Testing
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) IntroductionProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introduction
 
Python 45 minutes Hangouts #4
Python 45 minutes Hangouts  #4Python 45 minutes Hangouts  #4
Python 45 minutes Hangouts #4
 
Chapter4
Chapter4Chapter4
Chapter4
 
Executable specifications for xtext
Executable specifications for xtextExecutable specifications for xtext
Executable specifications for xtext
 

Similar to Prolog

Plc part 4
Plc  part 4Plc  part 4
Plc part 4
Taymoor Nazmy
 
Prolog final
Prolog finalProlog final
Prolog final
Hassaan Ahmad
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)Nitesh Singh
 
Prolog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdfProlog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdf
CS With Logic
 
Logic Progamming in Perl
Logic Progamming in PerlLogic Progamming in Perl
Logic Progamming in Perl
Curtis Poe
 
Prolog Programming : Basics
Prolog Programming : BasicsProlog Programming : Basics
Prolog Programming : Basics
Mitul Desai
 
Chaos Engineering, When should you release the monkeys?
Chaos Engineering, When should you release the monkeys?Chaos Engineering, When should you release the monkeys?
Chaos Engineering, When should you release the monkeys?
Thoughtworks
 
Why on Earth would I test if I have to just "Let it crash"?
Why on Earth would I test if I have to just "Let it crash"?Why on Earth would I test if I have to just "Let it crash"?
Why on Earth would I test if I have to just "Let it crash"?
Laura M. Castro
 
Hack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programingHack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programing
unihack
 
Giving automated tests the love they deserve at Listings
Giving automated tests the love they deserve at ListingsGiving automated tests the love they deserve at Listings
Giving automated tests the love they deserve at Listings
Jordi Pradel
 
Fun with Functional Programming in Clojure
Fun with Functional Programming in ClojureFun with Functional Programming in Clojure
Fun with Functional Programming in Clojure
Codemotion
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
Christian Hujer
 
CPSC 125 Ch 1 Sec 5
CPSC 125 Ch 1 Sec 5CPSC 125 Ch 1 Sec 5
CPSC 125 Ch 1 Sec 5
David Wood
 
KorraAI - a probabilistic virtual agent framework
KorraAI - a probabilistic virtual agent frameworkKorraAI - a probabilistic virtual agent framework
KorraAI - a probabilistic virtual agent framework
AntonAndreev13
 
SWI-PROLOG TUTORIAL LEARN LOGIC PROGRAMMING.pptx
SWI-PROLOG TUTORIAL LEARN LOGIC PROGRAMMING.pptxSWI-PROLOG TUTORIAL LEARN LOGIC PROGRAMMING.pptx
SWI-PROLOG TUTORIAL LEARN LOGIC PROGRAMMING.pptx
adeboyeakinlolu
 
Exactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test OraclesExactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test Oracles
Iosif Itkin
 
Grails Spock Testing
Grails Spock TestingGrails Spock Testing
Grails Spock Testing
TO THE NEW | Technology
 
Logic Programming and ILP
Logic Programming and ILPLogic Programming and ILP
Logic Programming and ILP
Pierre de Lacaze
 
ActionScript 9-10
ActionScript 9-10ActionScript 9-10
ActionScript 9-10
Edison
 
Python Training
Python TrainingPython Training
Python Training
softcrayons3
 

Similar to Prolog (20)

Plc part 4
Plc  part 4Plc  part 4
Plc part 4
 
Prolog final
Prolog finalProlog final
Prolog final
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)
 
Prolog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdfProlog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdf
 
Logic Progamming in Perl
Logic Progamming in PerlLogic Progamming in Perl
Logic Progamming in Perl
 
Prolog Programming : Basics
Prolog Programming : BasicsProlog Programming : Basics
Prolog Programming : Basics
 
Chaos Engineering, When should you release the monkeys?
Chaos Engineering, When should you release the monkeys?Chaos Engineering, When should you release the monkeys?
Chaos Engineering, When should you release the monkeys?
 
Why on Earth would I test if I have to just "Let it crash"?
Why on Earth would I test if I have to just "Let it crash"?Why on Earth would I test if I have to just "Let it crash"?
Why on Earth would I test if I have to just "Let it crash"?
 
Hack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programingHack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programing
 
Giving automated tests the love they deserve at Listings
Giving automated tests the love they deserve at ListingsGiving automated tests the love they deserve at Listings
Giving automated tests the love they deserve at Listings
 
Fun with Functional Programming in Clojure
Fun with Functional Programming in ClojureFun with Functional Programming in Clojure
Fun with Functional Programming in Clojure
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
 
CPSC 125 Ch 1 Sec 5
CPSC 125 Ch 1 Sec 5CPSC 125 Ch 1 Sec 5
CPSC 125 Ch 1 Sec 5
 
KorraAI - a probabilistic virtual agent framework
KorraAI - a probabilistic virtual agent frameworkKorraAI - a probabilistic virtual agent framework
KorraAI - a probabilistic virtual agent framework
 
SWI-PROLOG TUTORIAL LEARN LOGIC PROGRAMMING.pptx
SWI-PROLOG TUTORIAL LEARN LOGIC PROGRAMMING.pptxSWI-PROLOG TUTORIAL LEARN LOGIC PROGRAMMING.pptx
SWI-PROLOG TUTORIAL LEARN LOGIC PROGRAMMING.pptx
 
Exactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test OraclesExactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test Oracles
 
Grails Spock Testing
Grails Spock TestingGrails Spock Testing
Grails Spock Testing
 
Logic Programming and ILP
Logic Programming and ILPLogic Programming and ILP
Logic Programming and ILP
 
ActionScript 9-10
ActionScript 9-10ActionScript 9-10
ActionScript 9-10
 
Python Training
Python TrainingPython Training
Python Training
 

Recently uploaded

CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 

Recently uploaded (20)

CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 

Prolog

  • 1. UMESHCHANDRA YADAV ROLL NO.1783910909 III year CSE Introduction of Prolog
  • 2. Content  Introduction  SWI_PROLOG  Fundamentals of PROLOG  Application  References
  • 3. Introduction PROgramming in LOGic. Declarative language. It is widely used in the field ofAI. LISP is also a logic programing. Problem in Declarative Form Logic Machine Basic Machine
  • 4. • Open source software is software that can be freely used, changed, and shared (in modified or unmodified form) by anyone. • SWI-Prolog offers a comprehensive FREE SOFTWARE Prolog environment. • Link for downloading: http://www.swi-prolog.org/download/stable • A Self-installing in MS-Windows: swipl-win.exe • LINUX versions are also available. • Use command sudo apt-get install swi-prolog SWI-Prolog
  • 5. Fundamentals 1. Facts 2. Rules 3. Query 4. Unification 5. Backtracking 6. Recursion
  • 6. Facts • Facts are statements about what is true about a problem, instead of instructions how to accomplish the solution. • Facts are properties of objects or relationships between objects. • A relation identifier is referred to as a predicate.
  • 7. Syntax for fact declaration • Names of relationship and objects must begin with a lower- case letter. • Relationship is written first (typically the predicate of the sentence). • Objects are written separated by commas and are enclosed by a pair of round brackets. • The full stop character ‘.’ must come at the end of a fact. Ex. phoneno(ramesh, 12345….).
  • 8. Predicate valuable(gold) buy( john,gold) father( john, mary) gives (john,book,mary) Interpretation Gold is valuable. John buygold. John is thefatherof Mary John gives thebookto Mary Examples of Facts
  • 9. Rules • Specifies under what conditions a tuple of values satisfies a predicate. • The basic building block of a rule is called an atom • Atom :- Atom1, ...,AtomN • If each of Atom1,...,AtomN is true, then Atom is also true.
  • 10. Syntax Rules <head> :- <body> Read ‘:-’ as ‘if’. likes(john,X) :-likes(X,cricket). “John likes X if X likes cricket”. i.e., “John likes anyone who likes cricket”. Rules always end with ‘.’
  • 11. It is based on Facts and Rules. Queries is terminated by full stop. If queries is true then its succeeds. If queries is false then its failed. Queries ?- likes(john,X). ?- likes (john,Something).
  • 12. Arithmetic in Prolog Prolog provides a number of basic arithmetic tools. Arithmetic examples 6 + 2 = 8 6 ∗2 = 12 Prolog Notation 8 is 6+2. 12 is 6*2. Answers to arithmetic questions by using ariables. For example: ?- X is 6+2. X=8
  • 13. Example Queries o | ? likes(mary, cricket). o yes. o | ? likes(mary,football). o no. Facts: () ◦ likes(john,football). ◦ likes(john, cricket). ◦ likes(mary, cricket). ◦ likes(mary ,john).
  • 14. Unification Its is use of pattern matching in Prolog. Backtracking When a task fails Prolog trace backwards and tries to satisfy previous task. Recursion Recursion use for any search in program.
  • 15. Application Expert Systems (Knowledge Representation and Inferencing) Natural Language Processing Artificial Intelligence Pattern Matching etc.