Not sure how this swi-Prolog problem is suppose to be answered

  • Context: Comp Sci 
  • Thread starter Thread starter r0bHadz
  • Start date Start date
Click For Summary
SUMMARY

The discussion centers on writing Prolog facts to represent familial relationships, specifically using Donald Trump's family tree. The correct syntax for defining a mother-child relationship is established as mother('Ivana Trump', 'Ivanka Trump'), where the first argument is the mother and the second is the child. The user expresses confusion about the conventions of predicate order in Prolog but receives clarification that consistency in interpretation is key. The conversation emphasizes the importance of understanding predicate definitions in Prolog programming.

PREREQUISITES
  • Understanding of Prolog syntax and predicates
  • Familiarity with familial relationship representation in programming
  • Basic knowledge of Donald Trump's family tree
  • Experience with writing facts and rules in Prolog
NEXT STEPS
  • Study Prolog predicate definitions and their applications
  • Explore examples of familial relationships in Prolog
  • Learn about Prolog facts and rules for complex queries
  • Research best practices for structuring Prolog programs
USEFUL FOR

Students learning Prolog, programmers interested in logic programming, and anyone working on family tree representations in Prolog.

r0bHadz
Messages
194
Reaction score
17
Homework Statement
Using Donald Trump’s family tree, write a prolog program ( a collection of facts
and rules) to answer the following queries about the relationships within Donald
trump’s family tree.
• Who is the mother of Ivanka trump
Relevant Equations
none
From what I know, we can write a fact, such as mother('Ivana Trump', 'Ivanka Trump').

But I am lost. Is there suppose to be some convention, which states which one comes first? Does the mother or the child come first?

Basically, I have no clue what the answer to this question is suppose to look like. It seems simple enough. I've email my professor but she hasn't replied, and I really want to get a head start on this homework
 
Physics news on Phys.org
r0bHadz said:
Homework Statement: Using Donald Trump’s family tree, write a prolog program ( a collection of facts
and rules) to answer the following queries about the relationships within Donald
trump’s family tree.
• Who is the mother of Ivanka trump
Homework Equations: none

From what I know, we can write a fact, such as mother('Ivana Trump', 'Ivanka Trump').

But I am lost. Is there suppose to be some convention, which states which one comes first? Does the mother or the child come first?

Basically, I have no clue what the answer to this question is suppose to look like. It seems simple enough. I've email my professor but she hasn't replied, and I really want to get a head start on this homework
The rules you write (predicates, I believe they are called in Prolog) are how you define them. In your example, the meaning would be 'Ivana Trump' is the mother of 'Ivanka Trump'. As long as you keep the same interpretation for these predicates, you should be fine.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 56 ·
2
Replies
56
Views
7K
  • · Replies 54 ·
2
Replies
54
Views
8K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
7
Views
1K
  • · Replies 2 ·
Replies
2
Views
4K