SlideShare a Scribd company logo
1 of 3
Download to read offline
Then we need the rules that will allow for the queries that will answer the following:
Find the Father of any of the man.
Find the Sons of any man
Find the Grandfather of any of the man
Find the Mother of any man.
Display a list of all the pairs of siblings.
Display a list of all the men.
in my program the
findson and list_siblings predicates care not working
find son should look like
findson(jacob).
and then list all of jacobs sons
list_siblings should look like
perez and zerah are siblings. judah and reuban are siblings, etc....
please use this code to modify and include it in your answer :) i dont want to make too much of a
drastic change unless necessary.
gender(male,[abraham, isaac, jacob,judah, reuben, simeon, levi, dan, naphtali, gad, asher,
issachar, zebulun, joseph, benjamin, perez, zerah, hezron, ram,amminadab,nahshon,
salmon,
boaz, obed, jesse, david, solomon, rehoboam, abijah, asa, jehoshaphat, jehoram,
uzziah,jotham,ahaz,
hezehiah, manasseh, amon,
josiah,jeconiah,shealtiel,zerubbabel,abihud,eliakim,azor,zadok,akim,
elihud, eleazar,matthan,jacob,joseph,jesus]).
gender(female,[dinah,tamar,rahab,ruth,bathsheeba,mary]).
%father facts
father(abraham, isaac).
father(isaac, jacob).
father(jacob, judah).
father(jacob, reuben).
father(jacob, simeon).
father(jacob, levi).
father(jacob, dan).
father(jacob, naphtali).
father(jacob, gad).
father(jacob, asher).
father(jacob, issachar).
father(jacob, zebulun).
father(jacob, dinah).
father(jacob, joseph).
father(jacob, benjamin).
father(judah, perez).
father(judah, zerah).
father(perez, hezron).
father(herzon, ram).
father(ram, amminadab).
father(amminadab, nahshon).
father(nahshon, salmon).
father(salmon, boaz).
father(boaz, obed).
father(obed, jesse).
father(jesse, david).
father(david, solomon).
father(solomon, rehoboam).
father(rehoboam, abijah).
father(abijah, asa).
father(asa, jehoshaphat).
father(jehoshaphat, jehoram).
father(jehoram, uzziah).
father(uzziah, jotham).
father(jotham, ahaz).
father(ahaz, hezekiah).
father(hezekiah, manasseh).
father(manasseh, amon).
father(amon, josiah).
father(josiah, jeconiah).
father(jeconiah, shealtiel).
father(shealtiel, zerubbabel).
father(zerubbabel, abihud).
father(abihud, eliakim).
father(eliakim, azor).
father(azor, zadok).
father(zadok, akim).
father(akim, elihud).
father(elihud, eleazar).
father(eleazar, matthan).
father(matthan, jacobNew).%New for new Testement - fixes duplicates
father(jacobNew, josephNew).
father(josephNew, jesus).
%mother facts
mother(tamar, zerah).
mother(tamar, perez).
mother(rahab, boaz).
mother(ruth, obed).
mother(bathsheeba, solomon).
mother(mary, jesus).
sibling(X, Y) :- father(Z, X), father(Z, Y), X = Y.
sibling(X, Y) :- mother(Z, X), mother(Z, Y), X = Y.
grandfather(X, Y) :- father(X, Z), father(Z, Y).
grandfather(X, Y) :- father(X, Z), mother(Z, Y).
son(X, Y) :- father(Y, X).
son(X, Y) :- mother(Y, X).
findson(X):-father(X,Y), siblings(Y,Z), format("~w are the sons of ~w",[Z,X]). %find multiple
sons
findfather(X) :- father(Y, X), write(Y), write(' is the father of '), write(X), nl.
findsons(X) :- son(Y, X), write(Y), write(' is a son of '), write(X), nl.
findgrandfather(X) :- grandfather(Y, X), write(Y), write(' is the grandfather of '), write(X), nl.
findmother(X) :- mother(Y, X), write(Y), write(' is the mother of '), write(X), nl.
list_siblings :- sibling(X, Y), write(X), write(' and '), write(Y), write(' are siblings.'), nl.
displaymales:- X = male,format("The males are:n"),forall(gender(X,Y),writeln(Y)).%displays
all males.
displayfemales:- Y = female,format("The females
are:n"),forall(gender(Y,X),writeln(X)).%displays all females.

More Related Content

More from ambikagarmentsjdp

There is no more information provided to me other then what i alread.pdf
There is no more information provided to me other then what i alread.pdfThere is no more information provided to me other then what i alread.pdf
There is no more information provided to me other then what i alread.pdfambikagarmentsjdp
 
There is no more information provided to me. Determine the value of .pdf
There is no more information provided to me. Determine the value of .pdfThere is no more information provided to me. Determine the value of .pdf
There is no more information provided to me. Determine the value of .pdfambikagarmentsjdp
 
There is a period between when animals become infected and when they.pdf
There is a period between when animals become infected and when they.pdfThere is a period between when animals become infected and when they.pdf
There is a period between when animals become infected and when they.pdfambikagarmentsjdp
 
There is a link between security and quality.1. Examine the relati.pdf
There is a link between security and quality.1. Examine the relati.pdfThere is a link between security and quality.1. Examine the relati.pdf
There is a link between security and quality.1. Examine the relati.pdfambikagarmentsjdp
 
There are advantages to buying an existing business. Which of the fo.pdf
There are advantages to buying an existing business. Which of the fo.pdfThere are advantages to buying an existing business. Which of the fo.pdf
There are advantages to buying an existing business. Which of the fo.pdfambikagarmentsjdp
 
There are different types of Intrusion DetectionPrevention Systems..pdf
There are different types of Intrusion DetectionPrevention Systems..pdfThere are different types of Intrusion DetectionPrevention Systems..pdf
There are different types of Intrusion DetectionPrevention Systems..pdfambikagarmentsjdp
 
There are 4200 college instructors in Canada that teach at local com.pdf
There are 4200 college instructors in Canada that teach at local com.pdfThere are 4200 college instructors in Canada that teach at local com.pdf
There are 4200 college instructors in Canada that teach at local com.pdfambikagarmentsjdp
 
The X axis shows how far away from the equator the population lives..pdf
The X axis shows how far away from the equator the population lives..pdfThe X axis shows how far away from the equator the population lives..pdf
The X axis shows how far away from the equator the population lives..pdfambikagarmentsjdp
 
The World Values Survey interviewed a random sample of people from n.pdf
The World Values Survey interviewed a random sample of people from n.pdfThe World Values Survey interviewed a random sample of people from n.pdf
The World Values Survey interviewed a random sample of people from n.pdfambikagarmentsjdp
 
The Yellow Company made year-end adjusting entries affecting each of.pdf
The Yellow Company made year-end adjusting entries affecting each of.pdfThe Yellow Company made year-end adjusting entries affecting each of.pdf
The Yellow Company made year-end adjusting entries affecting each of.pdfambikagarmentsjdp
 
The Worst Part Was That She Often Was Right. The Winston County Bank.pdf
The Worst Part Was That She Often Was Right. The Winston County Bank.pdfThe Worst Part Was That She Often Was Right. The Winston County Bank.pdf
The Worst Part Was That She Often Was Right. The Winston County Bank.pdfambikagarmentsjdp
 
The Western Spruce Budworm, Choristoneura occidentalis Freeman, is a.pdf
The Western Spruce Budworm, Choristoneura occidentalis Freeman, is a.pdfThe Western Spruce Budworm, Choristoneura occidentalis Freeman, is a.pdf
The Western Spruce Budworm, Choristoneura occidentalis Freeman, is a.pdfambikagarmentsjdp
 
The West Coast City (City) had a staff of 7325 with an annual budget.pdf
The West Coast City (City) had a staff of 7325 with an annual budget.pdfThe West Coast City (City) had a staff of 7325 with an annual budget.pdf
The West Coast City (City) had a staff of 7325 with an annual budget.pdfambikagarmentsjdp
 
The task is to match the phrases with the concepts.Group of answer.pdf
The task is to match the phrases with the concepts.Group of answer.pdfThe task is to match the phrases with the concepts.Group of answer.pdf
The task is to match the phrases with the concepts.Group of answer.pdfambikagarmentsjdp
 
The University of the East Europe is interested in the overall perfo.pdf
The University of the East Europe is interested in the overall perfo.pdfThe University of the East Europe is interested in the overall perfo.pdf
The University of the East Europe is interested in the overall perfo.pdfambikagarmentsjdp
 
The user name and password for the database connection is embedded i.pdf
The user name and password for the database connection is embedded i.pdfThe user name and password for the database connection is embedded i.pdf
The user name and password for the database connection is embedded i.pdfambikagarmentsjdp
 
The United States federal government is currently concerned with enc.pdf
The United States federal government is currently concerned with enc.pdfThe United States federal government is currently concerned with enc.pdf
The United States federal government is currently concerned with enc.pdfambikagarmentsjdp
 
The U.S. government funds deficit spending byissuing bondsselli.pdf
The U.S. government funds deficit spending byissuing bondsselli.pdfThe U.S. government funds deficit spending byissuing bondsselli.pdf
The U.S. government funds deficit spending byissuing bondsselli.pdfambikagarmentsjdp
 
The question is for genetics Cross together two double heterozygous.pdf
The question is for genetics  Cross together two double heterozygous.pdfThe question is for genetics  Cross together two double heterozygous.pdf
The question is for genetics Cross together two double heterozygous.pdfambikagarmentsjdp
 
The total mass of all living things on Earth is 545 Gigatons.Part .pdf
The total mass of all living things on Earth is 545 Gigatons.Part .pdfThe total mass of all living things on Earth is 545 Gigatons.Part .pdf
The total mass of all living things on Earth is 545 Gigatons.Part .pdfambikagarmentsjdp
 

More from ambikagarmentsjdp (20)

There is no more information provided to me other then what i alread.pdf
There is no more information provided to me other then what i alread.pdfThere is no more information provided to me other then what i alread.pdf
There is no more information provided to me other then what i alread.pdf
 
There is no more information provided to me. Determine the value of .pdf
There is no more information provided to me. Determine the value of .pdfThere is no more information provided to me. Determine the value of .pdf
There is no more information provided to me. Determine the value of .pdf
 
There is a period between when animals become infected and when they.pdf
There is a period between when animals become infected and when they.pdfThere is a period between when animals become infected and when they.pdf
There is a period between when animals become infected and when they.pdf
 
There is a link between security and quality.1. Examine the relati.pdf
There is a link between security and quality.1. Examine the relati.pdfThere is a link between security and quality.1. Examine the relati.pdf
There is a link between security and quality.1. Examine the relati.pdf
 
There are advantages to buying an existing business. Which of the fo.pdf
There are advantages to buying an existing business. Which of the fo.pdfThere are advantages to buying an existing business. Which of the fo.pdf
There are advantages to buying an existing business. Which of the fo.pdf
 
There are different types of Intrusion DetectionPrevention Systems..pdf
There are different types of Intrusion DetectionPrevention Systems..pdfThere are different types of Intrusion DetectionPrevention Systems..pdf
There are different types of Intrusion DetectionPrevention Systems..pdf
 
There are 4200 college instructors in Canada that teach at local com.pdf
There are 4200 college instructors in Canada that teach at local com.pdfThere are 4200 college instructors in Canada that teach at local com.pdf
There are 4200 college instructors in Canada that teach at local com.pdf
 
The X axis shows how far away from the equator the population lives..pdf
The X axis shows how far away from the equator the population lives..pdfThe X axis shows how far away from the equator the population lives..pdf
The X axis shows how far away from the equator the population lives..pdf
 
The World Values Survey interviewed a random sample of people from n.pdf
The World Values Survey interviewed a random sample of people from n.pdfThe World Values Survey interviewed a random sample of people from n.pdf
The World Values Survey interviewed a random sample of people from n.pdf
 
The Yellow Company made year-end adjusting entries affecting each of.pdf
The Yellow Company made year-end adjusting entries affecting each of.pdfThe Yellow Company made year-end adjusting entries affecting each of.pdf
The Yellow Company made year-end adjusting entries affecting each of.pdf
 
The Worst Part Was That She Often Was Right. The Winston County Bank.pdf
The Worst Part Was That She Often Was Right. The Winston County Bank.pdfThe Worst Part Was That She Often Was Right. The Winston County Bank.pdf
The Worst Part Was That She Often Was Right. The Winston County Bank.pdf
 
The Western Spruce Budworm, Choristoneura occidentalis Freeman, is a.pdf
The Western Spruce Budworm, Choristoneura occidentalis Freeman, is a.pdfThe Western Spruce Budworm, Choristoneura occidentalis Freeman, is a.pdf
The Western Spruce Budworm, Choristoneura occidentalis Freeman, is a.pdf
 
The West Coast City (City) had a staff of 7325 with an annual budget.pdf
The West Coast City (City) had a staff of 7325 with an annual budget.pdfThe West Coast City (City) had a staff of 7325 with an annual budget.pdf
The West Coast City (City) had a staff of 7325 with an annual budget.pdf
 
The task is to match the phrases with the concepts.Group of answer.pdf
The task is to match the phrases with the concepts.Group of answer.pdfThe task is to match the phrases with the concepts.Group of answer.pdf
The task is to match the phrases with the concepts.Group of answer.pdf
 
The University of the East Europe is interested in the overall perfo.pdf
The University of the East Europe is interested in the overall perfo.pdfThe University of the East Europe is interested in the overall perfo.pdf
The University of the East Europe is interested in the overall perfo.pdf
 
The user name and password for the database connection is embedded i.pdf
The user name and password for the database connection is embedded i.pdfThe user name and password for the database connection is embedded i.pdf
The user name and password for the database connection is embedded i.pdf
 
The United States federal government is currently concerned with enc.pdf
The United States federal government is currently concerned with enc.pdfThe United States federal government is currently concerned with enc.pdf
The United States federal government is currently concerned with enc.pdf
 
The U.S. government funds deficit spending byissuing bondsselli.pdf
The U.S. government funds deficit spending byissuing bondsselli.pdfThe U.S. government funds deficit spending byissuing bondsselli.pdf
The U.S. government funds deficit spending byissuing bondsselli.pdf
 
The question is for genetics Cross together two double heterozygous.pdf
The question is for genetics  Cross together two double heterozygous.pdfThe question is for genetics  Cross together two double heterozygous.pdf
The question is for genetics Cross together two double heterozygous.pdf
 
The total mass of all living things on Earth is 545 Gigatons.Part .pdf
The total mass of all living things on Earth is 545 Gigatons.Part .pdfThe total mass of all living things on Earth is 545 Gigatons.Part .pdf
The total mass of all living things on Earth is 545 Gigatons.Part .pdf
 

Recently uploaded

ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 

Recently uploaded (20)

ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 

Then we need the rules that will allow for the queries that will ans.pdf

  • 1. Then we need the rules that will allow for the queries that will answer the following: Find the Father of any of the man. Find the Sons of any man Find the Grandfather of any of the man Find the Mother of any man. Display a list of all the pairs of siblings. Display a list of all the men. in my program the findson and list_siblings predicates care not working find son should look like findson(jacob). and then list all of jacobs sons list_siblings should look like perez and zerah are siblings. judah and reuban are siblings, etc.... please use this code to modify and include it in your answer :) i dont want to make too much of a drastic change unless necessary. gender(male,[abraham, isaac, jacob,judah, reuben, simeon, levi, dan, naphtali, gad, asher, issachar, zebulun, joseph, benjamin, perez, zerah, hezron, ram,amminadab,nahshon, salmon, boaz, obed, jesse, david, solomon, rehoboam, abijah, asa, jehoshaphat, jehoram, uzziah,jotham,ahaz, hezehiah, manasseh, amon, josiah,jeconiah,shealtiel,zerubbabel,abihud,eliakim,azor,zadok,akim, elihud, eleazar,matthan,jacob,joseph,jesus]). gender(female,[dinah,tamar,rahab,ruth,bathsheeba,mary]). %father facts father(abraham, isaac). father(isaac, jacob). father(jacob, judah). father(jacob, reuben). father(jacob, simeon). father(jacob, levi). father(jacob, dan). father(jacob, naphtali).
  • 2. father(jacob, gad). father(jacob, asher). father(jacob, issachar). father(jacob, zebulun). father(jacob, dinah). father(jacob, joseph). father(jacob, benjamin). father(judah, perez). father(judah, zerah). father(perez, hezron). father(herzon, ram). father(ram, amminadab). father(amminadab, nahshon). father(nahshon, salmon). father(salmon, boaz). father(boaz, obed). father(obed, jesse). father(jesse, david). father(david, solomon). father(solomon, rehoboam). father(rehoboam, abijah). father(abijah, asa). father(asa, jehoshaphat). father(jehoshaphat, jehoram). father(jehoram, uzziah). father(uzziah, jotham). father(jotham, ahaz). father(ahaz, hezekiah). father(hezekiah, manasseh). father(manasseh, amon). father(amon, josiah). father(josiah, jeconiah). father(jeconiah, shealtiel). father(shealtiel, zerubbabel). father(zerubbabel, abihud). father(abihud, eliakim).
  • 3. father(eliakim, azor). father(azor, zadok). father(zadok, akim). father(akim, elihud). father(elihud, eleazar). father(eleazar, matthan). father(matthan, jacobNew).%New for new Testement - fixes duplicates father(jacobNew, josephNew). father(josephNew, jesus). %mother facts mother(tamar, zerah). mother(tamar, perez). mother(rahab, boaz). mother(ruth, obed). mother(bathsheeba, solomon). mother(mary, jesus). sibling(X, Y) :- father(Z, X), father(Z, Y), X = Y. sibling(X, Y) :- mother(Z, X), mother(Z, Y), X = Y. grandfather(X, Y) :- father(X, Z), father(Z, Y). grandfather(X, Y) :- father(X, Z), mother(Z, Y). son(X, Y) :- father(Y, X). son(X, Y) :- mother(Y, X). findson(X):-father(X,Y), siblings(Y,Z), format("~w are the sons of ~w",[Z,X]). %find multiple sons findfather(X) :- father(Y, X), write(Y), write(' is the father of '), write(X), nl. findsons(X) :- son(Y, X), write(Y), write(' is a son of '), write(X), nl. findgrandfather(X) :- grandfather(Y, X), write(Y), write(' is the grandfather of '), write(X), nl. findmother(X) :- mother(Y, X), write(Y), write(' is the mother of '), write(X), nl. list_siblings :- sibling(X, Y), write(X), write(' and '), write(Y), write(' are siblings.'), nl. displaymales:- X = male,format("The males are:n"),forall(gender(X,Y),writeln(Y)).%displays all males. displayfemales:- Y = female,format("The females are:n"),forall(gender(Y,X),writeln(X)).%displays all females.