SlideShare ist ein Scribd-Unternehmen logo
1 von 15
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

Weitere ähnliche Inhalte

Was ist angesagt?

10 logic+programming+with+prolog
10 logic+programming+with+prolog10 logic+programming+with+prolog
10 logic+programming+with+prologbaran19901990
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IMohamed Loey
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic Junya Tanaka
 
Discrete Math Chapter 1 :The Foundations: Logic and Proofs
Discrete Math Chapter 1 :The Foundations: Logic and ProofsDiscrete Math Chapter 1 :The Foundations: Logic and Proofs
Discrete Math Chapter 1 :The Foundations: Logic and ProofsAmr Rashed
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithmsRajendran
 
NAIVE BAYES CLASSIFIER
NAIVE BAYES CLASSIFIERNAIVE BAYES CLASSIFIER
NAIVE BAYES CLASSIFIERKnoldus Inc.
 
Prolog (present)
Prolog (present) Prolog (present)
Prolog (present) Melody Joey
 
Prolog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdfProlog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdfCS With Logic
 
Prolog example explanation(Family Tree)
Prolog example explanation(Family Tree)Prolog example explanation(Family Tree)
Prolog example explanation(Family Tree)Gayan Geethanjana
 
#2 formal methods – principles of logic
#2 formal methods – principles of logic#2 formal methods – principles of logic
#2 formal methods – principles of logicSharif Omar Salem
 
Multi-Layer Perceptrons
Multi-Layer PerceptronsMulti-Layer Perceptrons
Multi-Layer PerceptronsESCOM
 
Randomized Algorithms
Randomized AlgorithmsRandomized Algorithms
Randomized AlgorithmsKetan Kamra
 

Was ist angesagt? (20)

Prolog
PrologProlog
Prolog
 
10 logic+programming+with+prolog
10 logic+programming+with+prolog10 logic+programming+with+prolog
10 logic+programming+with+prolog
 
AI-09 Logic in AI
AI-09 Logic in AIAI-09 Logic in AI
AI-09 Logic in AI
 
LISP: Introduction to lisp
LISP: Introduction to lispLISP: Introduction to lisp
LISP: Introduction to lisp
 
Ai lab manual
Ai lab manualAi lab manual
Ai lab manual
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
 
Inference in First-Order Logic
Inference in First-Order Logic Inference in First-Order Logic
Inference in First-Order Logic
 
Prolog
PrologProlog
Prolog
 
Discrete Math Chapter 1 :The Foundations: Logic and Proofs
Discrete Math Chapter 1 :The Foundations: Logic and ProofsDiscrete Math Chapter 1 :The Foundations: Logic and Proofs
Discrete Math Chapter 1 :The Foundations: Logic and Proofs
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
NAIVE BAYES CLASSIFIER
NAIVE BAYES CLASSIFIERNAIVE BAYES CLASSIFIER
NAIVE BAYES CLASSIFIER
 
Lisp
LispLisp
Lisp
 
prolog ppt
prolog pptprolog ppt
prolog ppt
 
Prolog (present)
Prolog (present) Prolog (present)
Prolog (present)
 
Prolog & lisp
Prolog & lispProlog & lisp
Prolog & lisp
 
Prolog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdfProlog,Prolog Programming IN AI.pdf
Prolog,Prolog Programming IN AI.pdf
 
Prolog example explanation(Family Tree)
Prolog example explanation(Family Tree)Prolog example explanation(Family Tree)
Prolog example explanation(Family Tree)
 
#2 formal methods – principles of logic
#2 formal methods – principles of logic#2 formal methods – principles of logic
#2 formal methods – principles of logic
 
Multi-Layer Perceptrons
Multi-Layer PerceptronsMulti-Layer Perceptrons
Multi-Layer Perceptrons
 
Randomized Algorithms
Randomized AlgorithmsRandomized Algorithms
Randomized Algorithms
 

Ähnlich wie Prolog Programming Language

UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptxUOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptxqasim ali
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)Nitesh Singh
 
Learning Morphological Rules for Amharic Verbs Using Inductive Logic Programming
Learning Morphological Rules for Amharic Verbs Using Inductive Logic ProgrammingLearning Morphological Rules for Amharic Verbs Using Inductive Logic Programming
Learning Morphological Rules for Amharic Verbs Using Inductive Logic ProgrammingGuy De Pauw
 
Fasttext 20170720 yjy
Fasttext 20170720 yjyFasttext 20170720 yjy
Fasttext 20170720 yjy재연 윤
 
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxRuchitaMaaran
 
Programming in Computational Biology
Programming in Computational BiologyProgramming in Computational Biology
Programming in Computational BiologyAtreyiB
 
python programming for beginners and advanced
python programming for beginners and advancedpython programming for beginners and advanced
python programming for beginners and advancedgranjith6
 
Basics Of Python Programming
Basics Of Python ProgrammingBasics Of Python Programming
Basics Of Python ProgrammingBhawna Tuteja
 
An-Exploration-of-scientific-literature-using-Natural-Language-Processing
An-Exploration-of-scientific-literature-using-Natural-Language-ProcessingAn-Exploration-of-scientific-literature-using-Natural-Language-Processing
An-Exploration-of-scientific-literature-using-Natural-Language-ProcessingTheodore J. LaGrow
 
Family Tree on PROLOG
Family Tree on PROLOGFamily Tree on PROLOG
Family Tree on PROLOGAbdul Rafay
 

Ähnlich wie Prolog Programming Language (20)

Prolog final
Prolog finalProlog final
Prolog final
 
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptxUOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
 
Presentation1
Presentation1Presentation1
Presentation1
 
Logic Programming and ILP
Logic Programming and ILPLogic Programming and ILP
Logic Programming and ILP
 
PARADIGM IT.pptx
PARADIGM IT.pptxPARADIGM IT.pptx
PARADIGM IT.pptx
 
Prolog 7-Languages
Prolog 7-LanguagesProlog 7-Languages
Prolog 7-Languages
 
Plc part 4
Plc  part 4Plc  part 4
Plc part 4
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)
 
Learning Morphological Rules for Amharic Verbs Using Inductive Logic Programming
Learning Morphological Rules for Amharic Verbs Using Inductive Logic ProgrammingLearning Morphological Rules for Amharic Verbs Using Inductive Logic Programming
Learning Morphological Rules for Amharic Verbs Using Inductive Logic Programming
 
Fasttext 20170720 yjy
Fasttext 20170720 yjyFasttext 20170720 yjy
Fasttext 20170720 yjy
 
Chaps 1-3-ai-prolog
Chaps 1-3-ai-prologChaps 1-3-ai-prolog
Chaps 1-3-ai-prolog
 
Python Training
Python TrainingPython Training
Python Training
 
Python Module-1.1.pdf
Python Module-1.1.pdfPython Module-1.1.pdf
Python Module-1.1.pdf
 
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptxARTIFICIAL INTELLIGENCE---UNIT 4.pptx
ARTIFICIAL INTELLIGENCE---UNIT 4.pptx
 
3.5
3.53.5
3.5
 
Programming in Computational Biology
Programming in Computational BiologyProgramming in Computational Biology
Programming in Computational Biology
 
python programming for beginners and advanced
python programming for beginners and advancedpython programming for beginners and advanced
python programming for beginners and advanced
 
Basics Of Python Programming
Basics Of Python ProgrammingBasics Of Python Programming
Basics Of Python Programming
 
An-Exploration-of-scientific-literature-using-Natural-Language-Processing
An-Exploration-of-scientific-literature-using-Natural-Language-ProcessingAn-Exploration-of-scientific-literature-using-Natural-Language-Processing
An-Exploration-of-scientific-literature-using-Natural-Language-Processing
 
Family Tree on PROLOG
Family Tree on PROLOGFamily Tree on PROLOG
Family Tree on PROLOG
 

Kürzlich hochgeladen

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 

Kürzlich hochgeladen (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 

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