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

PDF
Python45 2
PPTX
Python Session - 6
PPTX
Python Session - 5
PPTX
Python Session - 4
PPTX
SWT Lecture Session 8 - Inference in jena
PPTX
C++ Made simple .pptx
PDF
Prolog,Prolog Programming IN AI.pdf
PPTX
Python45 2
Python Session - 6
Python Session - 5
Python Session - 4
SWT Lecture Session 8 - Inference in jena
C++ Made simple .pptx
Prolog,Prolog Programming IN AI.pdf

Similar to Introduction to Prolog (20)

PPT
Chaps 1-3-ai-prolog
PPTX
Prolog final
DOCX
Prolog_Programminvfygugy7gtugbugtg_Notes.docx
PPTX
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
PPTX
ProLog (Artificial Intelligence) Introduction
PPT
________ ________1.ppt
PPTX
Prolog language programming in the facts.pptx
PPT
Prolog basics
PPTX
PROLOG: Introduction To Prolog
PDF
Ai lab manual
PPTX
Unit 3 Prolog.pptxUnit 3 Prolog.pptxUnit 3 Prolog.pptxUnit 3 Prolog.pptxUnit
DOCX
AI Lab Manual.docx
PPTX
Ics1019 ics5003
PPTX
An introduction to Prolog language slide
PPTX
Plc part 4
PDF
10 logic+programming+with+prolog
PDF
PROLOG in artificial intelligence(Basic of pprolog)).pdf
PPT
2 Prolog L 1 V2.ppt
PPTX
Prolog Programming : Basics
Chaps 1-3-ai-prolog
Prolog final
Prolog_Programminvfygugy7gtugbugtg_Notes.docx
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
ProLog (Artificial Intelligence) Introduction
________ ________1.ppt
Prolog language programming in the facts.pptx
Prolog basics
PROLOG: Introduction To Prolog
Ai lab manual
Unit 3 Prolog.pptxUnit 3 Prolog.pptxUnit 3 Prolog.pptxUnit 3 Prolog.pptxUnit
AI Lab Manual.docx
Ics1019 ics5003
An introduction to Prolog language slide
Plc part 4
10 logic+programming+with+prolog
PROLOG in artificial intelligence(Basic of pprolog)).pdf
2 Prolog L 1 V2.ppt
Prolog Programming : Basics
Ad

More from Showkot Usman (7)

PPTX
Artificial Intelligence and Expert System
PPTX
Modes of Operation
PPTX
PPTX
Management
PPTX
Electro magnatism
PPTX
Economice
PPTX
System Development Life Cycle (SDLC)
Artificial Intelligence and Expert System
Modes of Operation
Management
Electro magnatism
Economice
System Development Life Cycle (SDLC)
Ad

Recently uploaded (20)

PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Cell Structure & Organelles in detailed.
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
master seminar digital applications in india
PDF
VCE English Exam - Section C Student Revision Booklet
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
TR - Agricultural Crops Production NC III.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Basic Mud Logging Guide for educational purpose
Cell Structure & Organelles in detailed.
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Renaissance Architecture: A Journey from Faith to Humanism
O7-L3 Supply Chain Operations - ICLT Program
O5-L3 Freight Transport Ops (International) V1.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
2.FourierTransform-ShortQuestionswithAnswers.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Insiders guide to clinical Medicine.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
master seminar digital applications in india
VCE English Exam - Section C Student Revision Booklet

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