SlideShare a Scribd company logo
4
Most read
5
Most read
15
Most read
Prolog Programming Language
CSE 337
Concepts of Programming Languages
Qassim University
College of Computer –IT department
Ms.Sadaf Ambreen Abbasi.
Reham AL blihed
Muna AL rajhi
1
Outline
• About Prolog programming language
• Simple idea of prolog program
• Prolog Syntax
• General purpose arithmetic
2
About prolog programming language
•Prolog
• Prolog is one of the most widely used programming languages in artificial
intelligence research.
• It is a declarative programming language unlike most common programming
languages.
3
Simple Idea about Prolog Program
• Prolog programs specify relationships among objects and
properties of objects.
4
PrologEnglish
father(ibrahim,reham).Ibrahim is the father of Reham.
eats(ibrahim,pizza).Ibrahim eats pizza.
happy(muna).Muna is happy.
Prolog Syntax
• Terms
• Terms are of four kinds: atoms, numbers, variables, and compound terms.
• Example atom:
• Example variables:
• Example compound term:
5
elephant, b, abcXYZ, x_123
X, Elephant, _
is_bigger(horse, X), f(g(X, _), 7),
Prolog Syntax
• Clauses and Queries
Clauses Facts & Rules
A fact is a predicate followed by a full stop.
Example:
A rule consists of a head and a body .Head and body are separated by the sign :-
Example:
Queries
it is a sequence of predicates separated by commas and terminated by a full stop.
Example:
6
bigger(whale, _).
Head :- Body.
is_smaller(X, Y) :- is_bigger(Y, X).
aunt(Aunt, Child) :-
sister(Aunt, Parent),
parent(Parent, Child).
?- weather(City,summer), temp(City,40).
General Purpose Arithmetic
7
• Numeric comparison operator:
General purpose arithmetic
• The is-Operator for Arithmetic Evaluation
• The expression in the right of the is-Operator is evaluated and bound to
the left hand argument.
• = does not cause evaluation of its arguments:
• Example:
8
Lists in Prolog Programming language
• List contain of head and tail and separated by bar sign | (bar).
• Example:
• Example:
9
Some Built-in Predicates for List Manipulation:
• Length
• Sum
10
General Example of prolog
• personal Information
• Knowledge Based
• Queries
11
General Example of prolog
Example on testing mark
• Knowledge Based
• Queries
12
General Example of prolog
Example of prolog program about the Weather
• Knowledge Based
• Queries
13
General Example of prolog
• Maximum of two numbers
• Knowledge Based
• Queries
14
General Example of prolog
• Example:
Knowledge Based
Queries
• Example:
15

More Related Content

PPTX
ProLog (Artificial Intelligence) Introduction
PPTX
Prolog Programming : Basics
PDF
Ai lab manual
DOCX
AI Lab Manual.docx
PPTX
State space search and Problem Solving techniques
PPTX
Knnowledge representation and logic lec 11 to lec 15
PPT
Introduction to prolog
PPTX
Artificial Intelligence Notes Unit 5
ProLog (Artificial Intelligence) Introduction
Prolog Programming : Basics
Ai lab manual
AI Lab Manual.docx
State space search and Problem Solving techniques
Knnowledge representation and logic lec 11 to lec 15
Introduction to prolog
Artificial Intelligence Notes Unit 5

What's hot (20)

PDF
Logic programming (1)
PDF
Algorithms Lecture 1: Introduction to Algorithms
PPT
Prolog basics
PPTX
Spell checker using Natural language processing
PPT
First order logic
PDF
Symbol table in compiler Design
PPTX
Webinar : P, NP, NP-Hard , NP - Complete problems
PDF
Little o and little omega
PPTX
Asymptotic notations
PPTX
sum of subset problem using Backtracking
PPTX
PROLOG: Introduction To Prolog
PPTX
B and B+ tree
PPT
Algorithm analysis
DOC
Time and space complexity
PDF
I.BEST FIRST SEARCH IN AI
DOCX
Artificial Intelligence Lab File
PPTX
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
PPTX
First order logic
PPTX
Prim's algorithm
PPTX
Asymptotic Notations
Logic programming (1)
Algorithms Lecture 1: Introduction to Algorithms
Prolog basics
Spell checker using Natural language processing
First order logic
Symbol table in compiler Design
Webinar : P, NP, NP-Hard , NP - Complete problems
Little o and little omega
Asymptotic notations
sum of subset problem using Backtracking
PROLOG: Introduction To Prolog
B and B+ tree
Algorithm analysis
Time and space complexity
I.BEST FIRST SEARCH IN AI
Artificial Intelligence Lab File
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
First order logic
Prim's algorithm
Asymptotic Notations
Ad

Similar to Prolog Programming Language (20)

PPTX
Prolog final
PPTX
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
PDF
Prolog,Prolog Programming IN AI.pdf
DOCX
Prolog_Programminvfygugy7gtugbugtg_Notes.docx
PPTX
Prolog & lisp
PPTX
Prolog (present)
PPTX
PPTX
Introduction to Prolog
PPTX
Artificial Intelligence and Expert System
PPTX
Ics1019 ics5003
DOCX
Artificial intelligence - Prolog
PPT
Prolog programming
PPT
Prolog programming
PPT
Prolog programming
PPT
Prolog programming
PPT
Prolog programming
PPT
Prolog programming
PPT
Prolog programming
PDF
ICS1019.pdf
PPT
Chaps 1-3-ai-prolog
Prolog final
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
Prolog,Prolog Programming IN AI.pdf
Prolog_Programminvfygugy7gtugbugtg_Notes.docx
Prolog & lisp
Prolog (present)
Introduction to Prolog
Artificial Intelligence and Expert System
Ics1019 ics5003
Artificial intelligence - Prolog
Prolog programming
Prolog programming
Prolog programming
Prolog programming
Prolog programming
Prolog programming
Prolog programming
ICS1019.pdf
Chaps 1-3-ai-prolog
Ad

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
KodekX | Application Modernization Development
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Electronic commerce courselecture one. Pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
cuic standard and advanced reporting.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Review of recent advances in non-invasive hemoglobin estimation
KodekX | Application Modernization Development
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Machine learning based COVID-19 study performance prediction
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Electronic commerce courselecture one. Pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
MYSQL Presentation for SQL database connectivity
Encapsulation_ Review paper, used for researhc scholars
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
cuic standard and advanced reporting.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
The Rise and Fall of 3GPP – Time for a Sabbatical?

Prolog Programming Language

  • 1. Prolog Programming Language CSE 337 Concepts of Programming Languages Qassim University College of Computer –IT department Ms.Sadaf Ambreen Abbasi. Reham AL blihed Muna AL rajhi 1
  • 2. Outline • About Prolog programming language • Simple idea of prolog program • Prolog Syntax • General purpose arithmetic 2
  • 3. About prolog programming language •Prolog • Prolog is one of the most widely used programming languages in artificial intelligence research. • It is a declarative programming language unlike most common programming languages. 3
  • 4. Simple Idea about Prolog Program • Prolog programs specify relationships among objects and properties of objects. 4 PrologEnglish father(ibrahim,reham).Ibrahim is the father of Reham. eats(ibrahim,pizza).Ibrahim eats pizza. happy(muna).Muna is happy.
  • 5. Prolog Syntax • Terms • Terms are of four kinds: atoms, numbers, variables, and compound terms. • Example atom: • Example variables: • Example compound term: 5 elephant, b, abcXYZ, x_123 X, Elephant, _ is_bigger(horse, X), f(g(X, _), 7),
  • 6. Prolog Syntax • Clauses and Queries Clauses Facts & Rules A fact is a predicate followed by a full stop. Example: A rule consists of a head and a body .Head and body are separated by the sign :- Example: Queries it is a sequence of predicates separated by commas and terminated by a full stop. Example: 6 bigger(whale, _). Head :- Body. is_smaller(X, Y) :- is_bigger(Y, X). aunt(Aunt, Child) :- sister(Aunt, Parent), parent(Parent, Child). ?- weather(City,summer), temp(City,40).
  • 7. General Purpose Arithmetic 7 • Numeric comparison operator:
  • 8. General purpose arithmetic • The is-Operator for Arithmetic Evaluation • The expression in the right of the is-Operator is evaluated and bound to the left hand argument. • = does not cause evaluation of its arguments: • Example: 8
  • 9. Lists in Prolog Programming language • List contain of head and tail and separated by bar sign | (bar). • Example: • Example: 9
  • 10. Some Built-in Predicates for List Manipulation: • Length • Sum 10
  • 11. General Example of prolog • personal Information • Knowledge Based • Queries 11
  • 12. General Example of prolog Example on testing mark • Knowledge Based • Queries 12
  • 13. General Example of prolog Example of prolog program about the Weather • Knowledge Based • Queries 13
  • 14. General Example of prolog • Maximum of two numbers • Knowledge Based • Queries 14
  • 15. General Example of prolog • Example: Knowledge Based Queries • Example: 15