SlideShare a Scribd company logo
Prolog

Logic Programming Language

             Prepared by :
     Chin Joo Ee & Tan Geok Fah
A  computer programming language
  based on mathematical logic.
 Used for writing programs that
  model human logic and decision
  making.
 PROLOG has an elegant formulation.
 Prolog is a logical and declarative
  programming language.
 The first of the huge family of logic
  programming languages.
 Invented by Alain Colmerauer and Phillipe
  Roussel at the University of Aix-Marseille
  in 1971.



          Alain Colmerauer
 It was first implemented 1972 in
  ALGOL-W.
 Early implementations
  →included C-Prolog, ESLPDPRO, Frolic,
    LM-Prolog, Open Prolog, SB-Prolog,
    UPMAIL Tricia Prolog.
 In 1998, the most common Prologs in use
  are Quintus Prolog, SICSTUS Prolog, LPA
  Prolog, SWI Prolog, AMZI Prolog, SNI
  Prolog.
 Prolog was designed originally for natural-
  language processing but has become one of
  the most widely used languages for
  artificial.
 The first versions had no user-defined
  functions and no control structure other
  than the built-in depth-first search with
  backtracking.
 Early collaboration between Marseille and
  Robert Kowalski at University of Edinburgh
  continued until about 1975.

                   Robert Kowalski
 A rich collection of data structures in the
  language and human reasoning
 A powerful notation for encoding end-user
  applications
 It has its logical and declarative aspects,
  interpretive nature, compactness, and
  inherent modularity.
 In a logic language
  ✎consisting of Horn Clauses
  ✎enter into database by the
     programmer
 Unlike most common programming languages.
 In a declarative language
  ✎the programmer specifies a goal to be
     achieved
  ✎the Prolog system works out how to
     achieve it
 To simplify the resolution process in Prolog,
  statements must be expressed in a
  simplified form, called Horn clauses.
 Each statement (clause) has (at most) one
  term on the left hand side of an implication
  symbol ( :- ).
 Each statement has a conjunction of zero
  or more terms on the right hand side.
 Facts
 Rules
 Queries
 A collection of facts and rules is called a
  knowledge base (database)
 A collection of facts and queries which
  describe some collection of relationship.
Example facts:
   male(adam). female(anne). parent(adam,barney).

Example rules:
1. son(X,Y) :- parent(Y,X) ,
 The first rule is read as follows:
   →For all X and Y, X is the son of Y if there exists X &
     Y (X,Y)
   →such that Y is the parent of X and X is male.

2. male(X), daughter(X,Y) :- parent(Y,X) , female(X)
 The second rule is read as follows:
   →For all X and Y, X is the daughter of Y if
    there exists X & Y
   →such that Y is the parent of X and X is female.
 To   make things crystal clear, let’s first
  precise about the basic characters at
  disposal.
 The upper-case letters are A, B, …, Z
 The lower-case letters are a, b, …, z
 The digits are 0, 1, 2, …, 9
 In addition, the _ symbol, which is called
  underscore, & some special characters,
  which include characters such as +, -,*, /,
  <, >, =,:, &, ~.
 The blank space is also a character, but a
  rather unusual one, being invisible.
 To run a Prolog program, the user must ask a
  question (goal) by stating a theorem
  ( asserting a predicate) which the prolog
  interpreter try to prove.
 If the predicate contains variables, the
  interpreter prints the values of the variables
  used to make the predicate true.
 The interpreter uses backward chaining to
  prove a goal. It begins with the thing it is try
  to prove, and work backwards looking for
  things that would imply it, until it gets the
  facts.
 Logical relationships are asserted, and
  Prolog is used to determine whether or not
  certain statements are true, and if true,
  what variable bindings make them true.
 This leads to a very declarative style of
  programming.
 It is a program that is efficient to use if
  one want to work out problems by
  representing objects symbolically according
  to a type of relationships.
 It can used in software engineering.
   intelligent data base retrieval
   natural language understanding
   expert systems
   specification language
   machine learning
   robot planning
   automated reasoning
   problem solving
   adventure game
   customer order entry business application
 programs which perform
 Intelligent
                    useful tasks by utilizing
  Systems           artificial intelligence
                    techniques

 intelligent systems which                      Expert
  reproduce decision-making at                  Systems
  the level of a human expert


  Natural Language          which can analyses and
      Systems                respond to statements
                             made in ordinary language
                             as opposed to approved
                             keywords or menu
                             selections.
ease of representing
 knowledge
natural support of non-
 determinism
natural support of pattern-
 matching
natural support of meta-
 programming
meaning  of programs is
 independent of how they are
 executed
simple connection between
 programs & computed answers
 & specifications
no need to distinguish programs
 from databases
   Initially, due to insufficient investment in
    complimentary technologies, users were poorly
    served.
   In the beginning, poor facilities for supporting
    arithmetic, types, etc. had a discouraging
    effect on the programming community.
   There is no adequate way of representing
    computational concepts found in built-in
    mechanisms of state variables (as is usually found
    in conventional languages).
   Some programmers always have, & always will
    prefer the overtly operational nature of machine
    operated programs, since they prefer the active
    control over the 'moving parts'.
Description
This program demonstrates the text output
function of the Sample programming language
by displaying the message "Hello world!”
Source Code
// the main program (this is a comment)
Hello:-
      nl,
      write('Hello world!' ).
}
THANK YOU …




        Bye Bye ~

More Related Content

What's hot (20)

PPT
1.python interpreter and interactive mode
ManjuA8
 
PDF
Python Matplotlib Tutorial | Matplotlib Tutorial | Python Tutorial | Python T...
Edureka!
 
PDF
Python strings
Mohammed Sikander
 
PPT
Algorithm And analysis Lecture 03& 04-time complexity.
Tariq Khan
 
PDF
File and directories in python
Lifna C.S
 
PDF
Computer Network notes (handwritten) UNIT 1
NANDINI SHARMA
 
PPT
Planning
ahmad bassiouny
 
PDF
Python programming : Standard Input and Output
Emertxe Information Technologies Pvt Ltd
 
PPT
Classical Planning
ahmad bassiouny
 
PPTX
Linker and Loader
sonalikharade3
 
PPT
Prolog basics
shivani saluja
 
PPT
Divide and conquer
Dr Shashikant Athawale
 
PPT
Introduction to prolog
Harry Potter
 
PPTX
Presentation on the topic selection sort
District Administration
 
PPTX
8 queens problem using back tracking
Tech_MX
 
PDF
Code generation in Compiler Design
Kuppusamy P
 
PPT
Installing Python 2.7 in Windows
Siva Arunachalam
 
PPTX
Shortest job first Scheduling (SJF)
ritu98
 
PPT
Data structures using c
Prof. Dr. K. Adisesha
 
PDF
I. AO* SEARCH ALGORITHM
vikas dhakane
 
1.python interpreter and interactive mode
ManjuA8
 
Python Matplotlib Tutorial | Matplotlib Tutorial | Python Tutorial | Python T...
Edureka!
 
Python strings
Mohammed Sikander
 
Algorithm And analysis Lecture 03& 04-time complexity.
Tariq Khan
 
File and directories in python
Lifna C.S
 
Computer Network notes (handwritten) UNIT 1
NANDINI SHARMA
 
Planning
ahmad bassiouny
 
Python programming : Standard Input and Output
Emertxe Information Technologies Pvt Ltd
 
Classical Planning
ahmad bassiouny
 
Linker and Loader
sonalikharade3
 
Prolog basics
shivani saluja
 
Divide and conquer
Dr Shashikant Athawale
 
Introduction to prolog
Harry Potter
 
Presentation on the topic selection sort
District Administration
 
8 queens problem using back tracking
Tech_MX
 
Code generation in Compiler Design
Kuppusamy P
 
Installing Python 2.7 in Windows
Siva Arunachalam
 
Shortest job first Scheduling (SJF)
ritu98
 
Data structures using c
Prof. Dr. K. Adisesha
 
I. AO* SEARCH ALGORITHM
vikas dhakane
 

Viewers also liked (20)

PDF
พีระมิด
duangduand
 
PPTX
Презентация слайды2
goryakiny
 
PPTX
Mot 3033
Melody Joey
 
PPT
Physics
Daniel Gubalane
 
PDF
กรวย
duangduand
 
PDF
ใบงาน
duangduand
 
PPT
ใบงานที่4เซลล์
TANIKAN KUNTAWONG
 
DOCX
Excel trick
Abhishek Bhagat
 
PDF
ทรงกระบอก
duangduand
 
PPTX
Gross u11a3
haleybop219
 
PPT
Diapositivas
Mariela Terán
 
PPTX
Demo: How to make air refreshener ? (Powder form & Spray form)
Melody Joey
 
PDF
Converted by pdf suite
duangduand
 
DOCX
Research 2
rkatungi
 
PDF
ทรงกลม
duangduand
 
PPTX
Black Box Testing
Daniel Gubalane
 
PPS
Lets see the reality around us
Tishi Bali
 
PDF
SaaS con Symfony2
Matteo Moretti
 
PPT
Directed decision phase locked loop
Hitham Jleed
 
PPT
الخروج
peter_magdy
 
พีระมิด
duangduand
 
Презентация слайды2
goryakiny
 
Mot 3033
Melody Joey
 
กรวย
duangduand
 
ใบงาน
duangduand
 
ใบงานที่4เซลล์
TANIKAN KUNTAWONG
 
Excel trick
Abhishek Bhagat
 
ทรงกระบอก
duangduand
 
Gross u11a3
haleybop219
 
Diapositivas
Mariela Terán
 
Demo: How to make air refreshener ? (Powder form & Spray form)
Melody Joey
 
Converted by pdf suite
duangduand
 
Research 2
rkatungi
 
ทรงกลม
duangduand
 
Black Box Testing
Daniel Gubalane
 
Lets see the reality around us
Tishi Bali
 
SaaS con Symfony2
Matteo Moretti
 
Directed decision phase locked loop
Hitham Jleed
 
الخروج
peter_magdy
 
Ad

Similar to Prolog (present) (20)

PPTX
Nltk
Anirudh
 
PPTX
Programming languages ms harsha
Harsha Batra
 
PDF
NLP_A Chat-Bot_answering_queries_of_UT-Dallas_Students
Himanshu kandwal
 
PPTX
Programming paradigms Techniques_part2.pptx
ssuser5ecd1a
 
PPTX
CSCorganization of programming languages
OluwafolakeOjo
 
PDF
DataFest 2017. Introduction to Natural Language Processing by Rudolf Eremyan
rudolf eremyan
 
PPTX
nlp (1).pptx
Subramanian Mani
 
PPTX
Unit 3 Prolog.pptxUnit 3 Prolog.pptxUnit 3 Prolog.pptxUnit 3 Prolog.pptxUnit
ManishYadav243888
 
PDF
XAI LANGUAGE TUTOR - A XAI-BASED LANGUAGE LEARNING CHATBOT USING ONTOLOGY AND...
ijnlc
 
PDF
XAI LANGUAGE TUTOR - A XAI-BASED LANGUAGE LEARNING CHATBOT USING ONTOLOGY AND...
kevig
 
PPT
Oop by edgar lagman jr
Jun-jun Lagman
 
PPTX
Family Tree on PROLOG
Abdul Rafay
 
PPTX
Machine translation with statistical approach
vini89
 
DOCX
An-Exploration-of-scientific-literature-using-Natural-Language-Processing
Theodore J. LaGrow
 
PPT
lect1-introductiontoprogramminglanguages-130130013038-phpapp02.ppt
abigailjudith8
 
PPTX
Computational linguistics
AdnanBaloch15
 
PDF
History Of C Essay
Melissa Williams
 
DOCX
Natural Language Processing an introduction
crjothiesh
 
Nltk
Anirudh
 
Programming languages ms harsha
Harsha Batra
 
NLP_A Chat-Bot_answering_queries_of_UT-Dallas_Students
Himanshu kandwal
 
Programming paradigms Techniques_part2.pptx
ssuser5ecd1a
 
CSCorganization of programming languages
OluwafolakeOjo
 
DataFest 2017. Introduction to Natural Language Processing by Rudolf Eremyan
rudolf eremyan
 
nlp (1).pptx
Subramanian Mani
 
Unit 3 Prolog.pptxUnit 3 Prolog.pptxUnit 3 Prolog.pptxUnit 3 Prolog.pptxUnit
ManishYadav243888
 
XAI LANGUAGE TUTOR - A XAI-BASED LANGUAGE LEARNING CHATBOT USING ONTOLOGY AND...
ijnlc
 
XAI LANGUAGE TUTOR - A XAI-BASED LANGUAGE LEARNING CHATBOT USING ONTOLOGY AND...
kevig
 
Oop by edgar lagman jr
Jun-jun Lagman
 
Family Tree on PROLOG
Abdul Rafay
 
Machine translation with statistical approach
vini89
 
An-Exploration-of-scientific-literature-using-Natural-Language-Processing
Theodore J. LaGrow
 
lect1-introductiontoprogramminglanguages-130130013038-phpapp02.ppt
abigailjudith8
 
Computational linguistics
AdnanBaloch15
 
History Of C Essay
Melissa Williams
 
Natural Language Processing an introduction
crjothiesh
 
Ad

Prolog (present)

  • 1. Prolog Logic Programming Language Prepared by : Chin Joo Ee & Tan Geok Fah
  • 2. A computer programming language based on mathematical logic.  Used for writing programs that model human logic and decision making.  PROLOG has an elegant formulation.  Prolog is a logical and declarative programming language.
  • 3.  The first of the huge family of logic programming languages.  Invented by Alain Colmerauer and Phillipe Roussel at the University of Aix-Marseille in 1971. Alain Colmerauer
  • 4.  It was first implemented 1972 in ALGOL-W.  Early implementations →included C-Prolog, ESLPDPRO, Frolic, LM-Prolog, Open Prolog, SB-Prolog, UPMAIL Tricia Prolog.  In 1998, the most common Prologs in use are Quintus Prolog, SICSTUS Prolog, LPA Prolog, SWI Prolog, AMZI Prolog, SNI Prolog.
  • 5.  Prolog was designed originally for natural- language processing but has become one of the most widely used languages for artificial.  The first versions had no user-defined functions and no control structure other than the built-in depth-first search with backtracking.  Early collaboration between Marseille and Robert Kowalski at University of Edinburgh continued until about 1975. Robert Kowalski
  • 6.  A rich collection of data structures in the language and human reasoning  A powerful notation for encoding end-user applications  It has its logical and declarative aspects, interpretive nature, compactness, and inherent modularity.
  • 7.  In a logic language ✎consisting of Horn Clauses ✎enter into database by the programmer  Unlike most common programming languages.  In a declarative language ✎the programmer specifies a goal to be achieved ✎the Prolog system works out how to achieve it
  • 8.  To simplify the resolution process in Prolog, statements must be expressed in a simplified form, called Horn clauses.  Each statement (clause) has (at most) one term on the left hand side of an implication symbol ( :- ).  Each statement has a conjunction of zero or more terms on the right hand side.
  • 9.  Facts  Rules  Queries  A collection of facts and rules is called a knowledge base (database)  A collection of facts and queries which describe some collection of relationship.
  • 10. Example facts:  male(adam). female(anne). parent(adam,barney). Example rules: 1. son(X,Y) :- parent(Y,X) ,  The first rule is read as follows: →For all X and Y, X is the son of Y if there exists X & Y (X,Y) →such that Y is the parent of X and X is male. 2. male(X), daughter(X,Y) :- parent(Y,X) , female(X)  The second rule is read as follows: →For all X and Y, X is the daughter of Y if there exists X & Y →such that Y is the parent of X and X is female.
  • 11.  To make things crystal clear, let’s first precise about the basic characters at disposal.  The upper-case letters are A, B, …, Z  The lower-case letters are a, b, …, z  The digits are 0, 1, 2, …, 9  In addition, the _ symbol, which is called underscore, & some special characters, which include characters such as +, -,*, /, <, >, =,:, &, ~.  The blank space is also a character, but a rather unusual one, being invisible.
  • 12.  To run a Prolog program, the user must ask a question (goal) by stating a theorem ( asserting a predicate) which the prolog interpreter try to prove.  If the predicate contains variables, the interpreter prints the values of the variables used to make the predicate true.  The interpreter uses backward chaining to prove a goal. It begins with the thing it is try to prove, and work backwards looking for things that would imply it, until it gets the facts.
  • 13.  Logical relationships are asserted, and Prolog is used to determine whether or not certain statements are true, and if true, what variable bindings make them true.  This leads to a very declarative style of programming.  It is a program that is efficient to use if one want to work out problems by representing objects symbolically according to a type of relationships.  It can used in software engineering.
  • 14. intelligent data base retrieval  natural language understanding  expert systems  specification language  machine learning  robot planning  automated reasoning  problem solving  adventure game  customer order entry business application
  • 15.  programs which perform Intelligent useful tasks by utilizing Systems artificial intelligence techniques  intelligent systems which Expert reproduce decision-making at Systems the level of a human expert Natural Language  which can analyses and Systems respond to statements made in ordinary language as opposed to approved keywords or menu selections.
  • 16. ease of representing knowledge natural support of non- determinism natural support of pattern- matching natural support of meta- programming
  • 17. meaning of programs is independent of how they are executed simple connection between programs & computed answers & specifications no need to distinguish programs from databases
  • 18. Initially, due to insufficient investment in complimentary technologies, users were poorly served.  In the beginning, poor facilities for supporting arithmetic, types, etc. had a discouraging effect on the programming community.  There is no adequate way of representing computational concepts found in built-in mechanisms of state variables (as is usually found in conventional languages).  Some programmers always have, & always will prefer the overtly operational nature of machine operated programs, since they prefer the active control over the 'moving parts'.
  • 19. Description This program demonstrates the text output function of the Sample programming language by displaying the message "Hello world!” Source Code // the main program (this is a comment) Hello:- nl, write('Hello world!' ). }
  • 20. THANK YOU … Bye Bye ~