SlideShare a Scribd company logo
Introduction
To
PROLOG
PREPARED BY-
SHOWKOT USMAN
ID: 15-02-01-008
DEPT. OF CSE
GUB
1
2
 Introduction
 CURRENT IMPLEMENTATIONS
 SWI_PROLOG
 Fundamentals of PROLOG
 Applications
 References
Objective
 Prolog is the most popular language of the logic
programing languages.
 It is goal based language, it has automatic
backtracking and uses recursion.
 Prolog stands for programmation en logique", or
programming in logic.“
3
Introduction
CURRENT
IMPLEMENTATIONS
There are several popular Prolog interpreters
available. They include:
1.GNU Prolog (http://pauillac.inria.fr/vdiaz/gnuprolog/)
2. Visual Prolog (http://www.visualprolog.com/vip6/Download/Default.htm)
3. Bprolog
(http://www.cad.mse.kyutech.ac.jp/people/zhou/bpr
olog.html)
4. SWI_PROLOG
4
 SWI-Prolog offers a comprehensive FREE
Software Prolog environment.
 Link for downloading:
http://www.swi-prolog.org/download/stable
 A Self-installing executable for Windows: swipl-win.exe
 Works on Windows XP
 LINUX versions are also available.
5
SWI_PROLOG
o Prolog is a logical and a declarative
programming language.
o The name itself, Prolog, is short for
Programming in Logics.
o Prolog is the major example of a fourth
generation
programming language supporting the
declarative programming paradigm.
6
What is Prolog ?
Applications of Prolog
Some applications of Prolog are:
 Intelligent data base retrieval
 Natural language understanding
 Expert systems
 Specification language
 Machine learning
 Robot planning
 Problem solving
7
1. Facts
2. Rules
3. Query
4. Variables
5. Unification
6. Resolution
8
Fundamentals
 The Prolog system uses the facts to work out how
to accomplish the solution by searching through
the space of possible solutions.
 It is defined by an identifier followed by an n-
tuple of constants.
 A relation identifier is referred to as a predicate
 When a tuple of values is in a relation we say the
tuple satisfies the predicate.
 Names of relationship and objects must begin
with a lowercase letter.
9
Facts
1. Specifies under what conditions a tuple of
values satisfies a predicate.
2. The basic building block of a rule is called an
atom
3. Atom :- Atom1, ..., Atomn
If each of Atom1,...,Atomn is true, then Atom is
also true.
10
Rules
There are two types of queries:
1.Ground Query
 edge(a,b)
 This query is called a ground query because it consists only of
value identifiers as parameters to the predicate.
 a ground query is posed we expect a yes/no answer.
2. Non Ground Query
 They have variables as parameters
 tedge(a,X)
11
Query
 Always begin with a capital letter
 ?- likes (john,X).
 ?- likes (john, Something).
 But not
 ?- likes (john,something)
12
Variables
Example
 Facts: ()
◦ likes(john,mary).
◦ likes(john,X). % Variables begin with capital
 Queries
◦ ?- likes(X,Y).
◦ X=john, Y=Mary. % hit “;” for more
◦ ?- likes(X,X).
◦ X=john.
13
 Prolog associates variables and values using a
process
known as unification
 Variables that receive a value are said to be
instantiated
14
Unification
Arithmetic in prolog
 Prolog provides a number of basic arithmetic tools.
 Arithmetic examples Prolog Notation
 6 + 2 = 8 8 is 6+2.
 6 *2 = 12 12 is 6*2.
 Answers to arithmetic questions by using ariables.
 For example:
?- X is 6+2.
X=8
15
References
 Artificial Intellegence & Expert System
DAN .W PATERSON
 www.swi-prolog.org/
 http://www.learnprolognow.org
16
Thank You
17

More Related Content

Similar to Introduction to Prolog

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
 
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
 
Turbo prolog 2.0 basics
Turbo prolog 2.0 basicsTurbo prolog 2.0 basics
Turbo prolog 2.0 basics
Soham Kansodaria
 
Solr Cluster installation tool "Anuenue"
Solr Cluster installation tool "Anuenue"Solr Cluster installation tool "Anuenue"
Solr Cluster installation tool "Anuenue"
Lucidworks (Archived)
 
Prolog final
Prolog finalProlog final
Prolog final
Hassaan Ahmad
 
How to Reverse Engineer Web Applications
How to Reverse Engineer Web ApplicationsHow to Reverse Engineer Web Applications
How to Reverse Engineer Web Applications
Jarrod Overson
 
java Statements
java Statementsjava Statements
java Statements
Usman Ali Kjs
 
Testing Spring Boot application in post-JUnit 4 world
Testing Spring Boot application in post-JUnit 4 worldTesting Spring Boot application in post-JUnit 4 world
Testing Spring Boot application in post-JUnit 4 world
Yura Nosenko
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
Deniz Oguz
 
________ ________1.ppt
________ ________1.ppt________ ________1.ppt
________ ________1.ppt
SamiAAli44
 
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docxCOMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
cargillfilberto
 
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docxCOMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
drandy1
 
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docxCOMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
monicafrancis71118
 
Microsoft azure data fundamentals (dp 900) practice tests 2022
Microsoft azure data fundamentals (dp 900) practice tests 2022Microsoft azure data fundamentals (dp 900) practice tests 2022
Microsoft azure data fundamentals (dp 900) practice tests 2022
SkillCertProExams
 
Test Driven Development and Quality Improvement
Test Driven Development and Quality ImprovementTest Driven Development and Quality Improvement
Test Driven Development and Quality Improvement
Carlos Solís
 
Java For Automation
Java   For AutomationJava   For Automation
Java For Automation
Abhijeet Dubey
 
The Ring programming language version 1.5.1 book - Part 13 of 180
The Ring programming language version 1.5.1 book - Part 13 of 180The Ring programming language version 1.5.1 book - Part 13 of 180
The Ring programming language version 1.5.1 book - Part 13 of 180
Mahmoud Samir Fayed
 
PYTHON PPT.pptx
PYTHON PPT.pptxPYTHON PPT.pptx
PYTHON PPT.pptx
AbhishekMourya36
 

Similar to Introduction to Prolog (20)

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"?
 
55j7
55j755j7
55j7
 
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
 
Turbo prolog 2.0 basics
Turbo prolog 2.0 basicsTurbo prolog 2.0 basics
Turbo prolog 2.0 basics
 
Solr Cluster installation tool "Anuenue"
Solr Cluster installation tool "Anuenue"Solr Cluster installation tool "Anuenue"
Solr Cluster installation tool "Anuenue"
 
Prolog final
Prolog finalProlog final
Prolog final
 
How to Reverse Engineer Web Applications
How to Reverse Engineer Web ApplicationsHow to Reverse Engineer Web Applications
How to Reverse Engineer Web Applications
 
java Statements
java Statementsjava Statements
java Statements
 
Testing Spring Boot application in post-JUnit 4 world
Testing Spring Boot application in post-JUnit 4 worldTesting Spring Boot application in post-JUnit 4 world
Testing Spring Boot application in post-JUnit 4 world
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
 
________ ________1.ppt
________ ________1.ppt________ ________1.ppt
________ ________1.ppt
 
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docxCOMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
 
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docxCOMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
 
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docxCOMM 166 Final Research Proposal GuidelinesThe proposal should.docx
COMM 166 Final Research Proposal GuidelinesThe proposal should.docx
 
Microsoft azure data fundamentals (dp 900) practice tests 2022
Microsoft azure data fundamentals (dp 900) practice tests 2022Microsoft azure data fundamentals (dp 900) practice tests 2022
Microsoft azure data fundamentals (dp 900) practice tests 2022
 
Test Driven Development and Quality Improvement
Test Driven Development and Quality ImprovementTest Driven Development and Quality Improvement
Test Driven Development and Quality Improvement
 
Java For Automation
Java   For AutomationJava   For Automation
Java For Automation
 
The Ring programming language version 1.5.1 book - Part 13 of 180
The Ring programming language version 1.5.1 book - Part 13 of 180The Ring programming language version 1.5.1 book - Part 13 of 180
The Ring programming language version 1.5.1 book - Part 13 of 180
 
PYTHON PPT.pptx
PYTHON PPT.pptxPYTHON PPT.pptx
PYTHON PPT.pptx
 

More from Showkot Usman

Artificial Intelligence and Expert System
Artificial Intelligence and Expert System Artificial Intelligence and Expert System
Artificial Intelligence and Expert System
Showkot Usman
 
Modes of Operation
Modes of Operation Modes of Operation
Modes of Operation
Showkot Usman
 
HDLC
HDLC HDLC
Management
ManagementManagement
Management
Showkot Usman
 
Electro magnatism
Electro magnatismElectro magnatism
Electro magnatism
Showkot Usman
 
Economice
EconomiceEconomice
Economice
Showkot Usman
 
System Development Life Cycle (SDLC)
System Development Life Cycle (SDLC)System Development Life Cycle (SDLC)
System Development Life Cycle (SDLC)
Showkot Usman
 

More from Showkot Usman (7)

Artificial Intelligence and Expert System
Artificial Intelligence and Expert System Artificial Intelligence and Expert System
Artificial Intelligence and Expert System
 
Modes of Operation
Modes of Operation Modes of Operation
Modes of Operation
 
HDLC
HDLC HDLC
HDLC
 
Management
ManagementManagement
Management
 
Electro magnatism
Electro magnatismElectro magnatism
Electro magnatism
 
Economice
EconomiceEconomice
Economice
 
System Development Life Cycle (SDLC)
System Development Life Cycle (SDLC)System Development Life Cycle (SDLC)
System Development Life Cycle (SDLC)
 

Recently uploaded

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
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
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
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
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
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
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
"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
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
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
 
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
 
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
 

Recently uploaded (20)

Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
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
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
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
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
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
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
"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...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
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
 
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
 
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
 

Introduction to Prolog

  • 2. 2  Introduction  CURRENT IMPLEMENTATIONS  SWI_PROLOG  Fundamentals of PROLOG  Applications  References Objective
  • 3.  Prolog is the most popular language of the logic programing languages.  It is goal based language, it has automatic backtracking and uses recursion.  Prolog stands for programmation en logique", or programming in logic.“ 3 Introduction
  • 4. CURRENT IMPLEMENTATIONS There are several popular Prolog interpreters available. They include: 1.GNU Prolog (http://pauillac.inria.fr/vdiaz/gnuprolog/) 2. Visual Prolog (http://www.visualprolog.com/vip6/Download/Default.htm) 3. Bprolog (http://www.cad.mse.kyutech.ac.jp/people/zhou/bpr olog.html) 4. SWI_PROLOG 4
  • 5.  SWI-Prolog offers a comprehensive FREE Software Prolog environment.  Link for downloading: http://www.swi-prolog.org/download/stable  A Self-installing executable for Windows: swipl-win.exe  Works on Windows XP  LINUX versions are also available. 5 SWI_PROLOG
  • 6. o Prolog is a logical and a declarative programming language. o The name itself, Prolog, is short for Programming in Logics. o Prolog is the major example of a fourth generation programming language supporting the declarative programming paradigm. 6 What is Prolog ?
  • 7. Applications of Prolog Some applications of Prolog are:  Intelligent data base retrieval  Natural language understanding  Expert systems  Specification language  Machine learning  Robot planning  Problem solving 7
  • 8. 1. Facts 2. Rules 3. Query 4. Variables 5. Unification 6. Resolution 8 Fundamentals
  • 9.  The Prolog system uses the facts to work out how to accomplish the solution by searching through the space of possible solutions.  It is defined by an identifier followed by an n- tuple of constants.  A relation identifier is referred to as a predicate  When a tuple of values is in a relation we say the tuple satisfies the predicate.  Names of relationship and objects must begin with a lowercase letter. 9 Facts
  • 10. 1. Specifies under what conditions a tuple of values satisfies a predicate. 2. The basic building block of a rule is called an atom 3. Atom :- Atom1, ..., Atomn If each of Atom1,...,Atomn is true, then Atom is also true. 10 Rules
  • 11. There are two types of queries: 1.Ground Query  edge(a,b)  This query is called a ground query because it consists only of value identifiers as parameters to the predicate.  a ground query is posed we expect a yes/no answer. 2. Non Ground Query  They have variables as parameters  tedge(a,X) 11 Query
  • 12.  Always begin with a capital letter  ?- likes (john,X).  ?- likes (john, Something).  But not  ?- likes (john,something) 12 Variables
  • 13. Example  Facts: () ◦ likes(john,mary). ◦ likes(john,X). % Variables begin with capital  Queries ◦ ?- likes(X,Y). ◦ X=john, Y=Mary. % hit “;” for more ◦ ?- likes(X,X). ◦ X=john. 13
  • 14.  Prolog associates variables and values using a process known as unification  Variables that receive a value are said to be instantiated 14 Unification
  • 15. Arithmetic in prolog  Prolog provides a number of basic arithmetic tools.  Arithmetic examples Prolog Notation  6 + 2 = 8 8 is 6+2.  6 *2 = 12 12 is 6*2.  Answers to arithmetic questions by using ariables.  For example: ?- X is 6+2. X=8 15
  • 16. References  Artificial Intellegence & Expert System DAN .W PATERSON  www.swi-prolog.org/  http://www.learnprolognow.org 16