SlideShare a Scribd company logo
1 of 17
An Overview of Prolog
1
What is Prolog
 Prolog is a powerful language for AI and non-
numerical programming
 Stands for programming in logic
 Centered around a small set of basic mechanisms,
including:
 Pattern matching
 Tree-based data structuring
 Automatic back tracking
 Well suited for problems that involves structured
objects and relations between them.
2
Chapter One: Introduction to Prolog
1. Defining relations by facts
2. Defining relations by rules
3. Recursive rules
4. How Prolog answers questions
5. Declarative and procedural meaning of programs
3
Chapter one:
1. Defining relations by facts
2. Defining relations by rules
4
1.1 Defining relations by facts
5
Example
The fact that tom is a parent of bob
parent(tom, bob).
the name of a relation argument1 argument2
Fact clause
1.1 Defining relations by facts
6
 The family tree is defined by the following Prolog
program:
parent(pam, bob)
parent(tom, bob)
parent(tom, liz)
parent(bob, ann)
parent(bob, pat)
parent(pat, jim)
This program consists of six clauses.
 Each clause declares one fact about parent
relation (particular instance of the parent relation)
* a relation is the set of all its instances
1.1 Defining relations by facts
7
When the program communicated to Prolog system,
Prolog can be posed some questions about the
parent relation:
Is bob a parent of pat?
?- parent(bob, pat)
Prolog answer: True
?- parent(liz, pat)
Prolog answer: No solutions
?- parent(tom, pat)
Prolog answer: No solutions
tom
bob
ann
pat jim
liz
pam
1.1 Defining relations by facts
8
Who is liz’s parent?
?- parent(X, liz)
Prolog answer: X = tom
Who are bob’s children?
?- parent(bob, X)
Prolog answer:
X = ann.
X = pat.
tom
bob
ann
pat jim
liz
pam
1.1 Defining relations by facts
9
Find X and Y such that X is a parent of Y.
?- parent (X, Y).
Prolog answers:
X = pam.
Y = bob.
X = tom.
Y = bob.
X = tom.
Y = liz.
X = bob.
Y = ann.
X = bob.
Y = pat.
X = pat.
Y = jim.
tom
bob
ann
pat jim
liz
pam
1.1 Defining relations by facts
10
Who is a grandparent of jim?
Who is the parent of jim? Assume that this is Y
Who is the parent of Y? Assume that this is X
?- parent(Y, jim), parent (X, Y)
Prolog answer: X = bob
Y = pat
• Changing the order of the requirements will affect the
result.
?- parent(X, jim), parent (Y, X)
Prolog answer: X = pat.
Y = bob.
?- parent(X, jim), parent (X, Y)
Prolog answer: X = pat.
Y = jim.
√
x
x
1.1 Defining relations by facts
11
Do ann and pat have a common parent?
Who is a parent X of ann?
Is X a parent of pat?
?- parent (X, ann), parent(X, pat)
Prolog answer: X = bob
tom
bob
ann
pat jim
liz
pam
1.2 Defining relations by rules
12
 We can add the information on the sex of the people
that occur in the parent relation:
female(pam).
male(tom).
male(bob).
female(liz).
female(pat).
female(ann).
male(jim).
male and female are unary relations, whereas
parent is a binary relation.
Gender(pam, female).
Gender(tom, male).
Gender(bob, male).
1.2 Defining relations by rules
13
Let us introduce the offspring relation (inverse of
parent)
offspring(liz, tom).
offspring(bob, tom).
...
The logical statement is:
For all X and Y,
Y is an offspring of X if
X is a parent of Y
offspring(Y, X) :- parent(X, Y).
Rule clause
tom
bob
ann
pat jim
liz
pam
Fact
caluses
1.2 Defining relations by rules
14
There is an important difference between facts and
rules:
 Facts is something that is always, unconditionally,
true
parent(tom, liz).
 Rules specify things that are true if some condition
is satisfied. Rules have:
 Condition part (right-hand side) = body
 Conclusion part (left-hand side) = head
offspring(Y, X) :- parent(X, Y).
head body
1.2 Defining relations by rules
15
Questions
 Is liz an offspring of tom?
?- offspring(liz, tom).
Prolog answer: True
How Prolog answer this question using the rule:
Offspring(Y, X) :- parent(X, Y).
Prolog answer: True
1.2 Defining relations by rules
16
 How to express:
 Mother relation
 Grandparent relation
 Sister relation
in Prolog?
Important Points
17

More Related Content

Viewers also liked

Viewers also liked (18)

Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
 
List and iterator
List and iteratorList and iterator
List and iterator
 
Cache recap
Cache recapCache recap
Cache recap
 
Python basics
Python basicsPython basics
Python basics
 
Text classification
Text classificationText classification
Text classification
 
Basic dns-mod
Basic dns-modBasic dns-mod
Basic dns-mod
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
 
Hashfunction
HashfunctionHashfunction
Hashfunction
 
Information retrieval
Information retrievalInformation retrieval
Information retrieval
 
Abstract class
Abstract classAbstract class
Abstract class
 
Game theory
Game theoryGame theory
Game theory
 
Exception
ExceptionException
Exception
 
Crypto theory practice
Crypto theory practiceCrypto theory practice
Crypto theory practice
 
Aristokrat corporate
Aristokrat corporateAristokrat corporate
Aristokrat corporate
 
Datamining with nb
Datamining with nbDatamining with nb
Datamining with nb
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
 

More from Young Alista

Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.pptYoung Alista
 
Motivation for multithreaded architectures
Motivation for multithreaded architecturesMotivation for multithreaded architectures
Motivation for multithreaded architecturesYoung Alista
 
Serialization/deserialization
Serialization/deserializationSerialization/deserialization
Serialization/deserializationYoung Alista
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data miningYoung Alista
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data miningYoung Alista
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherenceYoung Alista
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching worksYoung Alista
 
Abstract data types
Abstract data typesAbstract data types
Abstract data typesYoung Alista
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with javaYoung Alista
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsYoung Alista
 
Cobol, lisp, and python
Cobol, lisp, and pythonCobol, lisp, and python
Cobol, lisp, and pythonYoung Alista
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysisYoung Alista
 
Programming for engineers in python
Programming for engineers in pythonProgramming for engineers in python
Programming for engineers in pythonYoung Alista
 
Extending burp with python
Extending burp with pythonExtending burp with python
Extending burp with pythonYoung Alista
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendYoung Alista
 
Rest api to integrate with your site
Rest api to integrate with your siteRest api to integrate with your site
Rest api to integrate with your siteYoung Alista
 
How to build a rest api.pptx
How to build a rest api.pptxHow to build a rest api.pptx
How to build a rest api.pptxYoung Alista
 

More from Young Alista (20)

Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.ppt
 
Motivation for multithreaded architectures
Motivation for multithreaded architecturesMotivation for multithreaded architectures
Motivation for multithreaded architectures
 
Serialization/deserialization
Serialization/deserializationSerialization/deserialization
Serialization/deserialization
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
 
Object model
Object modelObject model
Object model
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Inheritance
InheritanceInheritance
Inheritance
 
Cobol, lisp, and python
Cobol, lisp, and pythonCobol, lisp, and python
Cobol, lisp, and python
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
 
Programming for engineers in python
Programming for engineers in pythonProgramming for engineers in python
Programming for engineers in python
 
Learning python
Learning pythonLearning python
Learning python
 
Extending burp with python
Extending burp with pythonExtending burp with python
Extending burp with python
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Rest api to integrate with your site
Rest api to integrate with your siteRest api to integrate with your site
Rest api to integrate with your site
 
How to build a rest api.pptx
How to build a rest api.pptxHow to build a rest api.pptx
How to build a rest api.pptx
 

Recently uploaded

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 

Recently uploaded (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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 ...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

Overview prolog

  • 1. An Overview of Prolog 1
  • 2. What is Prolog  Prolog is a powerful language for AI and non- numerical programming  Stands for programming in logic  Centered around a small set of basic mechanisms, including:  Pattern matching  Tree-based data structuring  Automatic back tracking  Well suited for problems that involves structured objects and relations between them. 2
  • 3. Chapter One: Introduction to Prolog 1. Defining relations by facts 2. Defining relations by rules 3. Recursive rules 4. How Prolog answers questions 5. Declarative and procedural meaning of programs 3
  • 4. Chapter one: 1. Defining relations by facts 2. Defining relations by rules 4
  • 5. 1.1 Defining relations by facts 5 Example The fact that tom is a parent of bob parent(tom, bob). the name of a relation argument1 argument2 Fact clause
  • 6. 1.1 Defining relations by facts 6  The family tree is defined by the following Prolog program: parent(pam, bob) parent(tom, bob) parent(tom, liz) parent(bob, ann) parent(bob, pat) parent(pat, jim) This program consists of six clauses.  Each clause declares one fact about parent relation (particular instance of the parent relation) * a relation is the set of all its instances
  • 7. 1.1 Defining relations by facts 7 When the program communicated to Prolog system, Prolog can be posed some questions about the parent relation: Is bob a parent of pat? ?- parent(bob, pat) Prolog answer: True ?- parent(liz, pat) Prolog answer: No solutions ?- parent(tom, pat) Prolog answer: No solutions tom bob ann pat jim liz pam
  • 8. 1.1 Defining relations by facts 8 Who is liz’s parent? ?- parent(X, liz) Prolog answer: X = tom Who are bob’s children? ?- parent(bob, X) Prolog answer: X = ann. X = pat. tom bob ann pat jim liz pam
  • 9. 1.1 Defining relations by facts 9 Find X and Y such that X is a parent of Y. ?- parent (X, Y). Prolog answers: X = pam. Y = bob. X = tom. Y = bob. X = tom. Y = liz. X = bob. Y = ann. X = bob. Y = pat. X = pat. Y = jim. tom bob ann pat jim liz pam
  • 10. 1.1 Defining relations by facts 10 Who is a grandparent of jim? Who is the parent of jim? Assume that this is Y Who is the parent of Y? Assume that this is X ?- parent(Y, jim), parent (X, Y) Prolog answer: X = bob Y = pat • Changing the order of the requirements will affect the result. ?- parent(X, jim), parent (Y, X) Prolog answer: X = pat. Y = bob. ?- parent(X, jim), parent (X, Y) Prolog answer: X = pat. Y = jim. √ x x
  • 11. 1.1 Defining relations by facts 11 Do ann and pat have a common parent? Who is a parent X of ann? Is X a parent of pat? ?- parent (X, ann), parent(X, pat) Prolog answer: X = bob tom bob ann pat jim liz pam
  • 12. 1.2 Defining relations by rules 12  We can add the information on the sex of the people that occur in the parent relation: female(pam). male(tom). male(bob). female(liz). female(pat). female(ann). male(jim). male and female are unary relations, whereas parent is a binary relation. Gender(pam, female). Gender(tom, male). Gender(bob, male).
  • 13. 1.2 Defining relations by rules 13 Let us introduce the offspring relation (inverse of parent) offspring(liz, tom). offspring(bob, tom). ... The logical statement is: For all X and Y, Y is an offspring of X if X is a parent of Y offspring(Y, X) :- parent(X, Y). Rule clause tom bob ann pat jim liz pam Fact caluses
  • 14. 1.2 Defining relations by rules 14 There is an important difference between facts and rules:  Facts is something that is always, unconditionally, true parent(tom, liz).  Rules specify things that are true if some condition is satisfied. Rules have:  Condition part (right-hand side) = body  Conclusion part (left-hand side) = head offspring(Y, X) :- parent(X, Y). head body
  • 15. 1.2 Defining relations by rules 15 Questions  Is liz an offspring of tom? ?- offspring(liz, tom). Prolog answer: True How Prolog answer this question using the rule: Offspring(Y, X) :- parent(X, Y). Prolog answer: True
  • 16. 1.2 Defining relations by rules 16  How to express:  Mother relation  Grandparent relation  Sister relation in Prolog?

Editor's Notes

  1. offspring(bob, pam). offspring(ann, bob). offspring(pat, bob). offspring(jim, pat).