SlideShare uma empresa Scribd logo
1 de 3
Baixar para ler offline
can someone fix this prolog code that does not display the female siblings?
%gender of all the people
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).
%Siblings
siblings(judah,[judah, reuben, simeon, levi, dan, naphtali, gad, asher, issachar, zebulun, dinah,
joseph, benjamin,]).
siblings(perez,[perez,zerah]).
%rules relations
son(X, Y) :- father(Y, X).
son(X,Y):-mother(Y,X).
%queries
displaysiblings:- format("The sibling pairs are:n"),forall(siblings(_,Y),writeln(Y)).%displays
the sibling pairs.
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.
findfather(X):-father(Y,X),format("~w is the father of ~w.",[Y,X]).%finds the father of a certain
male.
findson(X):-father(X,Y), siblings(Y,Z), format("~w are the sons of ~w",[Z,X]).%finds the son
of a certain male if they have siblings.
findson(X):-father(X,Y), format("~w is the son of ~w",[Y,X]).%finds the son of a certain male
if they dont have siblings.
findgfather(X):- father(Y, Z), father(Z, X),format('~w is the grandfather of ~w',[Y,X]).%finds
the grandfather of certain male.
findmother(X):-mother(Y,X),format("~w is the mother of ~w.",[Y,X]).%finds the mother of a
certain male.

Mais conteúdo relacionado

Mais de info189835

California condors (Gymnogyps californianus) are listed on the IUCN .pdf
California condors (Gymnogyps californianus) are listed on the IUCN .pdfCalifornia condors (Gymnogyps californianus) are listed on the IUCN .pdf
California condors (Gymnogyps californianus) are listed on the IUCN .pdfinfo189835
 
California continues to face a water shortage. The quantity of water.pdf
California continues to face a water shortage. The quantity of water.pdfCalifornia continues to face a water shortage. The quantity of water.pdf
California continues to face a water shortage. The quantity of water.pdfinfo189835
 
Calculate the various ratios based on the following informationCa.pdf
Calculate the various ratios based on the following informationCa.pdfCalculate the various ratios based on the following informationCa.pdf
Calculate the various ratios based on the following informationCa.pdfinfo189835
 
calculate the return on assets calculate the return on equity ca.pdf
calculate the return on assets calculate the return on equity ca.pdfcalculate the return on assets calculate the return on equity ca.pdf
calculate the return on assets calculate the return on equity ca.pdfinfo189835
 
Calculate the frequency of alleles A and B for the two populations s.pdf
Calculate the frequency of alleles A and B for the two populations s.pdfCalculate the frequency of alleles A and B for the two populations s.pdf
Calculate the frequency of alleles A and B for the two populations s.pdfinfo189835
 
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdfCalculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdfinfo189835
 
Calculate the of total (portfolio weight) for eachStock A pr.pdf
Calculate the  of total (portfolio weight) for eachStock A pr.pdfCalculate the  of total (portfolio weight) for eachStock A pr.pdf
Calculate the of total (portfolio weight) for eachStock A pr.pdfinfo189835
 
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdfCalculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdfinfo189835
 
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdfCada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdfinfo189835
 
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdfCada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdfinfo189835
 
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdfC coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdfinfo189835
 
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdfC++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdfinfo189835
 
C++ help finish my code Topics class definitions, arrays of objec.pdf
C++ help finish my code Topics class definitions, arrays of objec.pdfC++ help finish my code Topics class definitions, arrays of objec.pdf
C++ help finish my code Topics class definitions, arrays of objec.pdfinfo189835
 
C++ help !!!!Sally wants to write a program to help with her kee.pdf
C++ help !!!!Sally wants to write a program to help with her kee.pdfC++ help !!!!Sally wants to write a program to help with her kee.pdf
C++ help !!!!Sally wants to write a program to help with her kee.pdfinfo189835
 
C++ 10.14 LAB Book information (overriding member functions)Given.pdf
C++ 10.14 LAB Book information (overriding member functions)Given.pdfC++ 10.14 LAB Book information (overriding member functions)Given.pdf
C++ 10.14 LAB Book information (overriding member functions)Given.pdfinfo189835
 
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdfC(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdfinfo189835
 
By answering the following question with references1. Which p.pdf
By answering the following question with references1. Which p.pdfBy answering the following question with references1. Which p.pdf
By answering the following question with references1. Which p.pdfinfo189835
 
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdfBUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdfinfo189835
 
C programming languageHello i currently have this code and it is s.pdf
C programming languageHello i currently have this code and it is s.pdfC programming languageHello i currently have this code and it is s.pdf
C programming languageHello i currently have this code and it is s.pdfinfo189835
 
C programming languageHello i am hoping to get some help understa.pdf
C programming languageHello i am hoping to get some help understa.pdfC programming languageHello i am hoping to get some help understa.pdf
C programming languageHello i am hoping to get some help understa.pdfinfo189835
 

Mais de info189835 (20)

California condors (Gymnogyps californianus) are listed on the IUCN .pdf
California condors (Gymnogyps californianus) are listed on the IUCN .pdfCalifornia condors (Gymnogyps californianus) are listed on the IUCN .pdf
California condors (Gymnogyps californianus) are listed on the IUCN .pdf
 
California continues to face a water shortage. The quantity of water.pdf
California continues to face a water shortage. The quantity of water.pdfCalifornia continues to face a water shortage. The quantity of water.pdf
California continues to face a water shortage. The quantity of water.pdf
 
Calculate the various ratios based on the following informationCa.pdf
Calculate the various ratios based on the following informationCa.pdfCalculate the various ratios based on the following informationCa.pdf
Calculate the various ratios based on the following informationCa.pdf
 
calculate the return on assets calculate the return on equity ca.pdf
calculate the return on assets calculate the return on equity ca.pdfcalculate the return on assets calculate the return on equity ca.pdf
calculate the return on assets calculate the return on equity ca.pdf
 
Calculate the frequency of alleles A and B for the two populations s.pdf
Calculate the frequency of alleles A and B for the two populations s.pdfCalculate the frequency of alleles A and B for the two populations s.pdf
Calculate the frequency of alleles A and B for the two populations s.pdf
 
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdfCalculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
 
Calculate the of total (portfolio weight) for eachStock A pr.pdf
Calculate the  of total (portfolio weight) for eachStock A pr.pdfCalculate the  of total (portfolio weight) for eachStock A pr.pdf
Calculate the of total (portfolio weight) for eachStock A pr.pdf
 
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdfCalculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
 
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdfCada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
 
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdfCada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
 
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdfC coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
 
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdfC++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
 
C++ help finish my code Topics class definitions, arrays of objec.pdf
C++ help finish my code Topics class definitions, arrays of objec.pdfC++ help finish my code Topics class definitions, arrays of objec.pdf
C++ help finish my code Topics class definitions, arrays of objec.pdf
 
C++ help !!!!Sally wants to write a program to help with her kee.pdf
C++ help !!!!Sally wants to write a program to help with her kee.pdfC++ help !!!!Sally wants to write a program to help with her kee.pdf
C++ help !!!!Sally wants to write a program to help with her kee.pdf
 
C++ 10.14 LAB Book information (overriding member functions)Given.pdf
C++ 10.14 LAB Book information (overriding member functions)Given.pdfC++ 10.14 LAB Book information (overriding member functions)Given.pdf
C++ 10.14 LAB Book information (overriding member functions)Given.pdf
 
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdfC(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
 
By answering the following question with references1. Which p.pdf
By answering the following question with references1. Which p.pdfBy answering the following question with references1. Which p.pdf
By answering the following question with references1. Which p.pdf
 
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdfBUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
 
C programming languageHello i currently have this code and it is s.pdf
C programming languageHello i currently have this code and it is s.pdfC programming languageHello i currently have this code and it is s.pdf
C programming languageHello i currently have this code and it is s.pdf
 
C programming languageHello i am hoping to get some help understa.pdf
C programming languageHello i am hoping to get some help understa.pdfC programming languageHello i am hoping to get some help understa.pdf
C programming languageHello i am hoping to get some help understa.pdf
 

Último

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
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
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
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
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
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
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 

Último (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.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...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
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 ...
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
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
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 

Fix prolog code to display female siblings

  • 1. can someone fix this prolog code that does not display the female siblings? %gender of all the people 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).
  • 2. 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).
  • 3. mother(mary, jesus). %Siblings siblings(judah,[judah, reuben, simeon, levi, dan, naphtali, gad, asher, issachar, zebulun, dinah, joseph, benjamin,]). siblings(perez,[perez,zerah]). %rules relations son(X, Y) :- father(Y, X). son(X,Y):-mother(Y,X). %queries displaysiblings:- format("The sibling pairs are:n"),forall(siblings(_,Y),writeln(Y)).%displays the sibling pairs. 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. findfather(X):-father(Y,X),format("~w is the father of ~w.",[Y,X]).%finds the father of a certain male. findson(X):-father(X,Y), siblings(Y,Z), format("~w are the sons of ~w",[Z,X]).%finds the son of a certain male if they have siblings. findson(X):-father(X,Y), format("~w is the son of ~w",[Y,X]).%finds the son of a certain male if they dont have siblings. findgfather(X):- father(Y, Z), father(Z, X),format('~w is the grandfather of ~w',[Y,X]).%finds the grandfather of certain male. findmother(X):-mother(Y,X),format("~w is the mother of ~w.",[Y,X]).%finds the mother of a certain male.