SlideShare a Scribd company logo
1 of 2
Download to read offline
Prolog programming …
Using Amzi Prolog, create and test prolog clauses to perform relation between mother,father,
sister, brother, nephew, granddad, grandmother.
(make up something interesting relating to families.)
Solution
%trace
predicates
father(symbol,symbol)
mother(symbol,symbol)
male(symbol)
female(symbol)
sister(symbol,symbol)
brother(symbol,symbol)
uncle(symbol,symbol)
wife(symbol,symbol)
aunty(symbol,symbol)
sisterinlaw(symbol,symbol)
cousin(symbol,symbol)
nephew(symbol,symbol)
grand_son(symbol,symbol)
grand_duaghter(symbol,symbol)
clauses
sister(X,Y) :- father(X,A),father(Y,A),female(Y).
father(dhanjiBhai,vithhaldas).
father(chuniBhai,vithhaldas).
father(harshad,dhanjibhai).
father(darshan,dhanjibhai).
father(nilam,dhanjibhai).
father(kiran,dhanjibhai).
father(kamleshbhai,chunibhai).
mother(harshad,prabhaben).
mother(X,Y) :- father(X,Z),wife(Y,Z).
brother(X,Y) :- father(X,A),father(Y,A),male(X).
% brother(X,Y) :- brother(Y,X).
male(harshad).
male(darshan).
male(dhanjibhai).
male(chunibhai).
female(nilam).
female(kiran).
female(prabhaben).
female(nimishaben).
female(kokilaben).
wife(prabhaben,dhanjibhai).
wife(nimishaben,kamleshbhai).
Wife(kokilaben,chunibhai).
grand_son(X,Y) :- father(A,Y),father(X,A),male(X).
grand_duaghter(X,Y) :- father(A,Y),father(X,A),female(Y).
uncle(X,Y) :- father(X,Z),brother(Y,Z).
aunty(X,Y) :- wife(Y,Z),
brother(Z,W),
father(X,W).
sisterinlaw(X,Y) :- wife(X,Z),cousin(Y,Z),female(X).
cousin(X,Y) :- father(X,A),father(Y,B),brother(A,B).
nephew(X,Y) :- wife(Y,A),brother(A,B),father(X,B),male(X).

More Related Content

More from arpittradersjdr

The alpha-helix shown below is part of a water-soluble, globular prot.pdf
The alpha-helix shown below is part of a water-soluble, globular prot.pdfThe alpha-helix shown below is part of a water-soluble, globular prot.pdf
The alpha-helix shown below is part of a water-soluble, globular prot.pdfarpittradersjdr
 
Simple squamous epithelium is structured to best provideA. Diffus.pdf
Simple squamous epithelium is structured to best provideA. Diffus.pdfSimple squamous epithelium is structured to best provideA. Diffus.pdf
Simple squamous epithelium is structured to best provideA. Diffus.pdfarpittradersjdr
 
A tower leans at an angle of about 84.7°. The figure shows that 150 .pdf
A tower leans at an angle of about 84.7°. The figure shows that 150 .pdfA tower leans at an angle of about 84.7°. The figure shows that 150 .pdf
A tower leans at an angle of about 84.7°. The figure shows that 150 .pdfarpittradersjdr
 
A sample of 200 people were asked to identify their major source of .pdf
A sample of 200 people were asked to identify their major source of .pdfA sample of 200 people were asked to identify their major source of .pdf
A sample of 200 people were asked to identify their major source of .pdfarpittradersjdr
 
in java Can we create an object of type Interface Explain your answ.pdf
in java Can we create an object of type Interface Explain your answ.pdfin java Can we create an object of type Interface Explain your answ.pdf
in java Can we create an object of type Interface Explain your answ.pdfarpittradersjdr
 
Implement a client server design using a UDP socket and features of .pdf
Implement a client server design using a UDP socket and features of .pdfImplement a client server design using a UDP socket and features of .pdf
Implement a client server design using a UDP socket and features of .pdfarpittradersjdr
 
I need help in matlab.The task is echo removing from the signal.Supp.pdf
I need help in matlab.The task is echo removing from the signal.Supp.pdfI need help in matlab.The task is echo removing from the signal.Supp.pdf
I need help in matlab.The task is echo removing from the signal.Supp.pdfarpittradersjdr
 
Human language uses less sounds and is less symbolic than are the co.pdf
Human language  uses less sounds and is less symbolic than are the co.pdfHuman language  uses less sounds and is less symbolic than are the co.pdf
Human language uses less sounds and is less symbolic than are the co.pdfarpittradersjdr
 
How to build a Linked List that can insert any type of data. For exa.pdf
How to build a Linked List that can insert any type of data. For exa.pdfHow to build a Linked List that can insert any type of data. For exa.pdf
How to build a Linked List that can insert any type of data. For exa.pdfarpittradersjdr
 
Genetics homework1. The rut site involved in Rho-dependent termina.pdf
Genetics homework1. The rut site involved in Rho-dependent termina.pdfGenetics homework1. The rut site involved in Rho-dependent termina.pdf
Genetics homework1. The rut site involved in Rho-dependent termina.pdfarpittradersjdr
 
For the segment of code below display the contents of the Array Stack.pdf
For the segment of code below display the contents of the Array Stack.pdfFor the segment of code below display the contents of the Array Stack.pdf
For the segment of code below display the contents of the Array Stack.pdfarpittradersjdr
 
Explain the sources of police subculture. king undercover would affec.pdf
Explain the sources of police subculture. king undercover would affec.pdfExplain the sources of police subculture. king undercover would affec.pdf
Explain the sources of police subculture. king undercover would affec.pdfarpittradersjdr
 
Endocytosis will move substances ________ the cell using ___________.pdf
Endocytosis will move substances ________ the cell using ___________.pdfEndocytosis will move substances ________ the cell using ___________.pdf
Endocytosis will move substances ________ the cell using ___________.pdfarpittradersjdr
 
Cuckoos are birds that practice brood parasitism. Instead of raising.pdf
Cuckoos are birds that practice brood parasitism. Instead of raising.pdfCuckoos are birds that practice brood parasitism. Instead of raising.pdf
Cuckoos are birds that practice brood parasitism. Instead of raising.pdfarpittradersjdr
 
Case Study QuestionsWhat is the Major Problem identified in case .pdf
Case Study QuestionsWhat is the Major Problem identified in case .pdfCase Study QuestionsWhat is the Major Problem identified in case .pdf
Case Study QuestionsWhat is the Major Problem identified in case .pdfarpittradersjdr
 
Consider three hypothetical countries, Kipr, Ispania, and Atlantida, .pdf
Consider three hypothetical countries, Kipr, Ispania, and Atlantida, .pdfConsider three hypothetical countries, Kipr, Ispania, and Atlantida, .pdf
Consider three hypothetical countries, Kipr, Ispania, and Atlantida, .pdfarpittradersjdr
 
Below is the syntax and the encoding. The instruction below computes.pdf
Below is the syntax and the encoding. The instruction below computes.pdfBelow is the syntax and the encoding. The instruction below computes.pdf
Below is the syntax and the encoding. The instruction below computes.pdfarpittradersjdr
 
Answer the following questions with detailed justifications a) What i.pdf
Answer the following questions with detailed justifications a) What i.pdfAnswer the following questions with detailed justifications a) What i.pdf
Answer the following questions with detailed justifications a) What i.pdfarpittradersjdr
 
(1) Access the US Department of Commerce Bureau of Industry and Secu.pdf
(1) Access the US Department of Commerce Bureau of Industry and Secu.pdf(1) Access the US Department of Commerce Bureau of Industry and Secu.pdf
(1) Access the US Department of Commerce Bureau of Industry and Secu.pdfarpittradersjdr
 

More from arpittradersjdr (19)

The alpha-helix shown below is part of a water-soluble, globular prot.pdf
The alpha-helix shown below is part of a water-soluble, globular prot.pdfThe alpha-helix shown below is part of a water-soluble, globular prot.pdf
The alpha-helix shown below is part of a water-soluble, globular prot.pdf
 
Simple squamous epithelium is structured to best provideA. Diffus.pdf
Simple squamous epithelium is structured to best provideA. Diffus.pdfSimple squamous epithelium is structured to best provideA. Diffus.pdf
Simple squamous epithelium is structured to best provideA. Diffus.pdf
 
A tower leans at an angle of about 84.7°. The figure shows that 150 .pdf
A tower leans at an angle of about 84.7°. The figure shows that 150 .pdfA tower leans at an angle of about 84.7°. The figure shows that 150 .pdf
A tower leans at an angle of about 84.7°. The figure shows that 150 .pdf
 
A sample of 200 people were asked to identify their major source of .pdf
A sample of 200 people were asked to identify their major source of .pdfA sample of 200 people were asked to identify their major source of .pdf
A sample of 200 people were asked to identify their major source of .pdf
 
in java Can we create an object of type Interface Explain your answ.pdf
in java Can we create an object of type Interface Explain your answ.pdfin java Can we create an object of type Interface Explain your answ.pdf
in java Can we create an object of type Interface Explain your answ.pdf
 
Implement a client server design using a UDP socket and features of .pdf
Implement a client server design using a UDP socket and features of .pdfImplement a client server design using a UDP socket and features of .pdf
Implement a client server design using a UDP socket and features of .pdf
 
I need help in matlab.The task is echo removing from the signal.Supp.pdf
I need help in matlab.The task is echo removing from the signal.Supp.pdfI need help in matlab.The task is echo removing from the signal.Supp.pdf
I need help in matlab.The task is echo removing from the signal.Supp.pdf
 
Human language uses less sounds and is less symbolic than are the co.pdf
Human language  uses less sounds and is less symbolic than are the co.pdfHuman language  uses less sounds and is less symbolic than are the co.pdf
Human language uses less sounds and is less symbolic than are the co.pdf
 
How to build a Linked List that can insert any type of data. For exa.pdf
How to build a Linked List that can insert any type of data. For exa.pdfHow to build a Linked List that can insert any type of data. For exa.pdf
How to build a Linked List that can insert any type of data. For exa.pdf
 
Genetics homework1. The rut site involved in Rho-dependent termina.pdf
Genetics homework1. The rut site involved in Rho-dependent termina.pdfGenetics homework1. The rut site involved in Rho-dependent termina.pdf
Genetics homework1. The rut site involved in Rho-dependent termina.pdf
 
For the segment of code below display the contents of the Array Stack.pdf
For the segment of code below display the contents of the Array Stack.pdfFor the segment of code below display the contents of the Array Stack.pdf
For the segment of code below display the contents of the Array Stack.pdf
 
Explain the sources of police subculture. king undercover would affec.pdf
Explain the sources of police subculture. king undercover would affec.pdfExplain the sources of police subculture. king undercover would affec.pdf
Explain the sources of police subculture. king undercover would affec.pdf
 
Endocytosis will move substances ________ the cell using ___________.pdf
Endocytosis will move substances ________ the cell using ___________.pdfEndocytosis will move substances ________ the cell using ___________.pdf
Endocytosis will move substances ________ the cell using ___________.pdf
 
Cuckoos are birds that practice brood parasitism. Instead of raising.pdf
Cuckoos are birds that practice brood parasitism. Instead of raising.pdfCuckoos are birds that practice brood parasitism. Instead of raising.pdf
Cuckoos are birds that practice brood parasitism. Instead of raising.pdf
 
Case Study QuestionsWhat is the Major Problem identified in case .pdf
Case Study QuestionsWhat is the Major Problem identified in case .pdfCase Study QuestionsWhat is the Major Problem identified in case .pdf
Case Study QuestionsWhat is the Major Problem identified in case .pdf
 
Consider three hypothetical countries, Kipr, Ispania, and Atlantida, .pdf
Consider three hypothetical countries, Kipr, Ispania, and Atlantida, .pdfConsider three hypothetical countries, Kipr, Ispania, and Atlantida, .pdf
Consider three hypothetical countries, Kipr, Ispania, and Atlantida, .pdf
 
Below is the syntax and the encoding. The instruction below computes.pdf
Below is the syntax and the encoding. The instruction below computes.pdfBelow is the syntax and the encoding. The instruction below computes.pdf
Below is the syntax and the encoding. The instruction below computes.pdf
 
Answer the following questions with detailed justifications a) What i.pdf
Answer the following questions with detailed justifications a) What i.pdfAnswer the following questions with detailed justifications a) What i.pdf
Answer the following questions with detailed justifications a) What i.pdf
 
(1) Access the US Department of Commerce Bureau of Industry and Secu.pdf
(1) Access the US Department of Commerce Bureau of Industry and Secu.pdf(1) Access the US Department of Commerce Bureau of Industry and Secu.pdf
(1) Access the US Department of Commerce Bureau of Industry and Secu.pdf
 

Recently uploaded

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 

Recently uploaded (20)

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 

Prolog programming …Using Amzi Prolog, create and test prolog clau.pdf

  • 1. Prolog programming … Using Amzi Prolog, create and test prolog clauses to perform relation between mother,father, sister, brother, nephew, granddad, grandmother. (make up something interesting relating to families.) Solution %trace predicates father(symbol,symbol) mother(symbol,symbol) male(symbol) female(symbol) sister(symbol,symbol) brother(symbol,symbol) uncle(symbol,symbol) wife(symbol,symbol) aunty(symbol,symbol) sisterinlaw(symbol,symbol) cousin(symbol,symbol) nephew(symbol,symbol) grand_son(symbol,symbol) grand_duaghter(symbol,symbol) clauses sister(X,Y) :- father(X,A),father(Y,A),female(Y). father(dhanjiBhai,vithhaldas). father(chuniBhai,vithhaldas). father(harshad,dhanjibhai). father(darshan,dhanjibhai). father(nilam,dhanjibhai). father(kiran,dhanjibhai). father(kamleshbhai,chunibhai). mother(harshad,prabhaben).
  • 2. mother(X,Y) :- father(X,Z),wife(Y,Z). brother(X,Y) :- father(X,A),father(Y,A),male(X). % brother(X,Y) :- brother(Y,X). male(harshad). male(darshan). male(dhanjibhai). male(chunibhai). female(nilam). female(kiran). female(prabhaben). female(nimishaben). female(kokilaben). wife(prabhaben,dhanjibhai). wife(nimishaben,kamleshbhai). Wife(kokilaben,chunibhai). grand_son(X,Y) :- father(A,Y),father(X,A),male(X). grand_duaghter(X,Y) :- father(A,Y),father(X,A),female(Y). uncle(X,Y) :- father(X,Z),brother(Y,Z). aunty(X,Y) :- wife(Y,Z), brother(Z,W), father(X,W). sisterinlaw(X,Y) :- wife(X,Z),cousin(Y,Z),female(X). cousin(X,Y) :- father(X,A),father(Y,B),brother(A,B). nephew(X,Y) :- wife(Y,A),brother(A,B),father(X,B),male(X).