SlideShare una empresa de Scribd logo
1 de 1
Prolog Code [Family Tree] by Shahzeb Pirzada
male(anwar).
male(nadeem).
male(waseem).
male(saleem).
male(faheem).
male(saad).
male(fahad)
female(firdos).
female(atiya).
female(fozia).
female(sadaf).
female(sonia).
female(fatima).
parent(anwar,firdos,nadeem).
parent(anwar,firdos,waseem).
parent(nadeem,atiya,faheem).
parent(waseem,fozia,saleem).
parent(waseem,fozia,sadaf).
brother(nadeem,waseem).
brother(waseem,nadeem).
brother(faheem,saleem).
brother(saleem,faheem).
sister(sadaf,saleem).
sister(sadaf,faheem).
wife(anwar,firdos).
wife(nadeem,atiya).
husband(firdos,anwar).
husband(atiya,nadeem).
husband(fozia,waseem).
aunt(sonia,saad).
uncle(fahad,fatima).
grandmother(anwar,sadaf).
father(X,Y) :- parent(X,Z,Y).
mother(X,Y) :- parent(Z,X,Y).
son(X,Y,Z) :- male(X),father(Y,X),mother(Z,X).
daughter(X,Y,Z) :- female(X),father(Y,X),mother(Z,X).
wife(X,Y) :- female(X),parent(Y,X,Z).
husband(X,Y) :- male(X),parent(Y,X,Z).
grandfather(X,Y) :- male(X),father(X,Z),father(Z,Y).
grandmother(X,Y) :- female(Y),mother(Y,Z),mother(Z,Y).
uncle(X,Y) :- husband(X,Z),aunt(Z,Y).
aunt(X,Y) :- wife(X,Z),uncle(Z,Y).
cousin(X,Y) :- father(Z,X),brother(Z,W),father(W,Y).
ancestor(X,Y,Z) :- parent(X,Y,Z).
ancestor(X,Y,Z) :- parent(X,Y,W),ancestor(W,U,Z).
brother(X,Y) :- male(X),parent(X,Y).

Más contenido relacionado

La actualidad más candente

Chaps 1-3-ai-prolog
Chaps 1-3-ai-prologChaps 1-3-ai-prolog
Chaps 1-3-ai-prolog
saru40
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
hodcsencet
 
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
Simplilearn
 

La actualidad más candente (20)

Chaps 1-3-ai-prolog
Chaps 1-3-ai-prologChaps 1-3-ai-prolog
Chaps 1-3-ai-prolog
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
SYNCHRONIZATION
SYNCHRONIZATIONSYNCHRONIZATION
SYNCHRONIZATION
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 
graph.ppt
graph.pptgraph.ppt
graph.ppt
 
SINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.pptSINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.ppt
 
Insertion sort bubble sort selection sort
Insertion sort bubble sort  selection sortInsertion sort bubble sort  selection sort
Insertion sort bubble sort selection sort
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Artificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gameArtificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe game
 
Problem solving
Problem solvingProblem solving
Problem solving
 
DFS and BFS
DFS and BFSDFS and BFS
DFS and BFS
 
Graph coloring problem
Graph coloring problemGraph coloring problem
Graph coloring problem
 
Spanning trees
Spanning treesSpanning trees
Spanning trees
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
 
Parsing
ParsingParsing
Parsing
 
First order logic
First order logicFirst order logic
First order logic
 
client server protocol
client server protocolclient server protocol
client server protocol
 
Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems Webinar : P, NP, NP-Hard , NP - Complete problems
Webinar : P, NP, NP-Hard , NP - Complete problems
 
Predicate calculus
Predicate calculusPredicate calculus
Predicate calculus
 

Más de Shahzeb Pirzada

Más de Shahzeb Pirzada (20)

Sigma Society Inauguration
Sigma Society Inauguration Sigma Society Inauguration
Sigma Society Inauguration
 
Newton's Ninja - Combat'13
Newton's Ninja - Combat'13Newton's Ninja - Combat'13
Newton's Ninja - Combat'13
 
The Open Systems Interconnect (OSI) Model - IS AUDIT
The Open Systems Interconnect (OSI) Model - IS AUDITThe Open Systems Interconnect (OSI) Model - IS AUDIT
The Open Systems Interconnect (OSI) Model - IS AUDIT
 
RAID - IS AUDIT
RAID - IS AUDITRAID - IS AUDIT
RAID - IS AUDIT
 
Process Improvement Techniques - IS AUDIT
Process Improvement Techniques - IS AUDITProcess Improvement Techniques - IS AUDIT
Process Improvement Techniques - IS AUDIT
 
Project Management Certifications - IS AUDIT
Project Management Certifications - IS AUDITProject Management Certifications - IS AUDIT
Project Management Certifications - IS AUDIT
 
Computer Assisted Audit Techniques (CAATS) - IS AUDIT
Computer Assisted Audit Techniques (CAATS) - IS AUDITComputer Assisted Audit Techniques (CAATS) - IS AUDIT
Computer Assisted Audit Techniques (CAATS) - IS AUDIT
 
Certifications on Security - IS AUDIT
Certifications on Security - IS AUDITCertifications on Security - IS AUDIT
Certifications on Security - IS AUDIT
 
Google Advance Searching- Information System Audit & Control Report
Google Advance Searching- Information System Audit & Control ReportGoogle Advance Searching- Information System Audit & Control Report
Google Advance Searching- Information System Audit & Control Report
 
What is Fuzzy Logic?
What is Fuzzy Logic?What is Fuzzy Logic?
What is Fuzzy Logic?
 
Elements of Quality Management System
Elements of Quality Management SystemElements of Quality Management System
Elements of Quality Management System
 
City School Network- Routing & Switching Final Report
City School Network- Routing & Switching Final ReportCity School Network- Routing & Switching Final Report
City School Network- Routing & Switching Final Report
 
THE SEVEN HABITS OF HIGHLY EFFECTIVE TEENS
THE SEVEN HABITS OF HIGHLY EFFECTIVE TEENSTHE SEVEN HABITS OF HIGHLY EFFECTIVE TEENS
THE SEVEN HABITS OF HIGHLY EFFECTIVE TEENS
 
Entrepreneurial Leadership-FINAL REPORT
Entrepreneurial Leadership-FINAL REPORTEntrepreneurial Leadership-FINAL REPORT
Entrepreneurial Leadership-FINAL REPORT
 
SP STUDENT MANAGEMENT SYSTEM-Human Computer Interaction Final Report
SP STUDENT MANAGEMENT SYSTEM-Human Computer Interaction Final ReportSP STUDENT MANAGEMENT SYSTEM-Human Computer Interaction Final Report
SP STUDENT MANAGEMENT SYSTEM-Human Computer Interaction Final Report
 
White collar vs Blue collar
White collar vs Blue collarWhite collar vs Blue collar
White collar vs Blue collar
 
Story Narration Competition -Script
Story Narration Competition -Script Story Narration Competition -Script
Story Narration Competition -Script
 
Declamation Contest Script for Moc
Declamation Contest Script for MocDeclamation Contest Script for Moc
Declamation Contest Script for Moc
 
BOOTABLE OPERATING SYSTEM PPT
BOOTABLE OPERATING SYSTEM PPTBOOTABLE OPERATING SYSTEM PPT
BOOTABLE OPERATING SYSTEM PPT
 
BOOTABLE OPERATING SYSTEM
BOOTABLE OPERATING SYSTEMBOOTABLE OPERATING SYSTEM
BOOTABLE OPERATING SYSTEM
 

Último

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Último (20)

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 

Prolog Code [Family Tree] by Shahzeb Pirzada

  • 1. Prolog Code [Family Tree] by Shahzeb Pirzada male(anwar). male(nadeem). male(waseem). male(saleem). male(faheem). male(saad). male(fahad) female(firdos). female(atiya). female(fozia). female(sadaf). female(sonia). female(fatima). parent(anwar,firdos,nadeem). parent(anwar,firdos,waseem). parent(nadeem,atiya,faheem). parent(waseem,fozia,saleem). parent(waseem,fozia,sadaf). brother(nadeem,waseem). brother(waseem,nadeem). brother(faheem,saleem). brother(saleem,faheem). sister(sadaf,saleem). sister(sadaf,faheem). wife(anwar,firdos). wife(nadeem,atiya). husband(firdos,anwar). husband(atiya,nadeem). husband(fozia,waseem). aunt(sonia,saad). uncle(fahad,fatima). grandmother(anwar,sadaf). father(X,Y) :- parent(X,Z,Y). mother(X,Y) :- parent(Z,X,Y). son(X,Y,Z) :- male(X),father(Y,X),mother(Z,X). daughter(X,Y,Z) :- female(X),father(Y,X),mother(Z,X). wife(X,Y) :- female(X),parent(Y,X,Z). husband(X,Y) :- male(X),parent(Y,X,Z). grandfather(X,Y) :- male(X),father(X,Z),father(Z,Y). grandmother(X,Y) :- female(Y),mother(Y,Z),mother(Z,Y). uncle(X,Y) :- husband(X,Z),aunt(Z,Y). aunt(X,Y) :- wife(X,Z),uncle(Z,Y). cousin(X,Y) :- father(Z,X),brother(Z,W),father(W,Y). ancestor(X,Y,Z) :- parent(X,Y,Z). ancestor(X,Y,Z) :- parent(X,Y,W),ancestor(W,U,Z). brother(X,Y) :- male(X),parent(X,Y).