2
Most read
4
Most read
8
Most read
Prolog Example Explanation
2014/COM/13
Prolog example explanation(Family Tree)
Knowledge base
• male(james1).
• male(charles1).
• male(charles2).
• male(james2).
• male(george1).
• female(catherine).
• female(elizabeth).
• female(sophia).
• parent(charles1, james1).
• parent(elizabeth, james1).
• parent(charles2, charles1).
• parent(catherine, charles1).
• parent(james2, charles1).
• parent(sophia, elizabeth).
• parent(george1, sophia).
mother(M,X):-parent(M,X),female(M).
father(F,X):-parent(F,X),male(F).
sibling(X,Y):-parent(X,Z),parent(Y,Z).
Questions..
• a)Was George I the parent of Charles I?
• Query:
• ?-parent(charles1, george1).
• false
• b)Who was Charles I's parent?
• Query:
• ?- parent(charles1,X).
• X=james1
• c)Who were the children of Charles 1
• Query:
• ?-parent(X,charles1).
• X=Catherine
• X=charls2
• X=james2
Explanation of rules..
• M is the mother of X if she is a parent of X and is female
• mother(M,X):-parent(M,x),female(M).
• F is the father of X if he is a parent of X and is male
• father(F,X):-parent(F,X),male(F).
• X is a sibling of Y if they both have the same parent.
• sibling(X,Y):-parent(X,Z),parent(Y,Z).
Questions based on rules…
• who is mother of sophia?
• ?-mother(sophia,X)
• X=elizabeth.
• who is father of charles1?
• ?- father(charles1,X).
• X = james1.
Prolog example explanation(Family Tree)
Thank You..

More Related Content

PPT
Introduction to prolog
PPTX
Presentation on risc pipeline
PDF
Interrupt handling
PDF
A* Search Algorithm
PDF
Asymptotic notation
PPTX
Problem reduction AND OR GRAPH & AO* algorithm.ppt
PPT
Introduction to 8086 microprocessor
PPT
heap sort in the design anad analysis of algorithms
Introduction to prolog
Presentation on risc pipeline
Interrupt handling
A* Search Algorithm
Asymptotic notation
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Introduction to 8086 microprocessor
heap sort in the design anad analysis of algorithms

What's hot (20)

PPTX
Graph coloring using backtracking
PPT
KNOWLEDGE REPRESENTATION ISSUES.ppt
PPTX
Fuzzy sets
PPTX
Heuristics Search Techniques in AI
PDF
I. Hill climbing algorithm II. Steepest hill climbing algorithm
PPTX
Uninformed search /Blind search in AI
PPTX
State space search and Problem Solving techniques
PPTX
Logics for non monotonic reasoning-ai
PPTX
Tsp is NP-Complete
PPTX
Hashing Technique In Data Structures
PDF
Algorithms Lecture 7: Graph Algorithms
PPTX
First order logic
PPTX
Evaluation of Expression in Query Processing
PDF
Symbol table in compiler Design
DOCX
Artificial Intelligence Lab File
PPTX
Fuzzy logic - Approximate reasoning
PPTX
Sum of subset problem.pptx
PPT
UNIT-1-PPTS-DAA.ppt
Graph coloring using backtracking
KNOWLEDGE REPRESENTATION ISSUES.ppt
Fuzzy sets
Heuristics Search Techniques in AI
I. Hill climbing algorithm II. Steepest hill climbing algorithm
Uninformed search /Blind search in AI
State space search and Problem Solving techniques
Logics for non monotonic reasoning-ai
Tsp is NP-Complete
Hashing Technique In Data Structures
Algorithms Lecture 7: Graph Algorithms
First order logic
Evaluation of Expression in Query Processing
Symbol table in compiler Design
Artificial Intelligence Lab File
Fuzzy logic - Approximate reasoning
Sum of subset problem.pptx
UNIT-1-PPTS-DAA.ppt
Ad

Similar to Prolog example explanation(Family Tree) (17)

PPTX
Overview prolog
PPTX
Overview prolog
PPTX
Overview prolog
PPTX
Overview prolog
PPTX
Overview prolog
PPTX
Overview prolog
PPTX
Overview prolog
TXT
Prolog Code [Family Tree] by Shahzeb Pirzada
PDF
Prolog programming …Using Amzi Prolog, create and test prolog clau.pdf
PPT
Introduction to prolog
PPT
Introduction toprolog
PPT
Introduction to prolog
PPT
Introduction toprolog
PPT
Introduction toprolog
PPT
Introduction toprolog
PDF
Prolog PPT_merged.pdf
PPTX
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
Overview prolog
Overview prolog
Overview prolog
Overview prolog
Overview prolog
Overview prolog
Overview prolog
Prolog Code [Family Tree] by Shahzeb Pirzada
Prolog programming …Using Amzi Prolog, create and test prolog clau.pdf
Introduction to prolog
Introduction toprolog
Introduction to prolog
Introduction toprolog
Introduction toprolog
Introduction toprolog
Prolog PPT_merged.pdf
UOS-BSIT-3811-Artificial-Intelligence-Introduction-to-prolog-PDF.pptx
Ad

Recently uploaded (20)

PDF
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
PDF
NGÂN HÀNG CÂU HỎI TÁCH CHỌN LỌC THEO CHUYÊN ĐỀ TỪ ĐỀ THI THỬ TN THPT 2025 TIẾ...
PDF
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
PDF
HSE 2022-2023.pdf الصحه والسلامه هندسه نفط
PPTX
ENGlishGrade8_Quarter2_WEEK1_LESSON1.pptx
DOCX
HELMET DETECTION AND BIOMETRIC BASED VEHICLESECURITY USING MACHINE LEARNING.docx
PDF
New_Round_Up_6_SB.pdf download for free, easy to learn
PDF
BSc-Zoology-02Sem-DrVijay-Comparative anatomy of vertebrates.pdf
PDF
Jana-Ojana Finals 2025 - School Quiz by Pragya - UEMK Quiz Club
PDF
Kalaari-SaaS-Founder-Playbook-2024-Edition-.pdf
PPTX
climate change of delhi impacts on climate and there effects
PPTX
Environmental Sciences and Sustainability Chapter 2
PDF
gsas-cvs-and-cover-letters jhvgfcffttfghgvhg.pdf
PPTX
MMW-CHAPTER-1-final.pptx major Elementary Education
PDF
FAMILY PLANNING (preventative and social medicine pdf)
PDF
FYJC - Chemistry textbook - standard 11.
PDF
Physical pharmaceutics two in b pharmacy
PDF
IS1343_2012...........................pdf
PPTX
GW4 BioMed Candidate Support Webinar 2025
PDF
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
NGÂN HÀNG CÂU HỎI TÁCH CHỌN LỌC THEO CHUYÊN ĐỀ TỪ ĐỀ THI THỬ TN THPT 2025 TIẾ...
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
HSE 2022-2023.pdf الصحه والسلامه هندسه نفط
ENGlishGrade8_Quarter2_WEEK1_LESSON1.pptx
HELMET DETECTION AND BIOMETRIC BASED VEHICLESECURITY USING MACHINE LEARNING.docx
New_Round_Up_6_SB.pdf download for free, easy to learn
BSc-Zoology-02Sem-DrVijay-Comparative anatomy of vertebrates.pdf
Jana-Ojana Finals 2025 - School Quiz by Pragya - UEMK Quiz Club
Kalaari-SaaS-Founder-Playbook-2024-Edition-.pdf
climate change of delhi impacts on climate and there effects
Environmental Sciences and Sustainability Chapter 2
gsas-cvs-and-cover-letters jhvgfcffttfghgvhg.pdf
MMW-CHAPTER-1-final.pptx major Elementary Education
FAMILY PLANNING (preventative and social medicine pdf)
FYJC - Chemistry textbook - standard 11.
Physical pharmaceutics two in b pharmacy
IS1343_2012...........................pdf
GW4 BioMed Candidate Support Webinar 2025
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...

Prolog example explanation(Family Tree)

  • 3. Knowledge base • male(james1). • male(charles1). • male(charles2). • male(james2). • male(george1). • female(catherine). • female(elizabeth). • female(sophia). • parent(charles1, james1). • parent(elizabeth, james1). • parent(charles2, charles1). • parent(catherine, charles1). • parent(james2, charles1). • parent(sophia, elizabeth). • parent(george1, sophia).
  • 5. Questions.. • a)Was George I the parent of Charles I? • Query: • ?-parent(charles1, george1). • false • b)Who was Charles I's parent? • Query: • ?- parent(charles1,X). • X=james1 • c)Who were the children of Charles 1 • Query: • ?-parent(X,charles1). • X=Catherine • X=charls2 • X=james2
  • 6. Explanation of rules.. • M is the mother of X if she is a parent of X and is female • mother(M,X):-parent(M,x),female(M). • F is the father of X if he is a parent of X and is male • father(F,X):-parent(F,X),male(F). • X is a sibling of Y if they both have the same parent. • sibling(X,Y):-parent(X,Z),parent(Y,Z).
  • 7. Questions based on rules… • who is mother of sophia? • ?-mother(sophia,X) • X=elizabeth. • who is father of charles1? • ?- father(charles1,X). • X = james1.