Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, you will create a logical system in Prolog that reasons about family relationships. You got a bit of a start on this

In this assignment, you will create a logical system in Prolog that reasons about family relationships. You got a bit of a start on this with the examples we used in class when introducing Prolog. You are to define at least 3 generations of specific individuals in a family of your choosing (this can be your own family or a fictitious one that has more complicated relationships than your own and/or preserves your own privacy) plus a set of Prolog rules that allow you to reason about relationships in families. As we have seen very basic parent, grandparent, half-sibling, and similar relationships in class, you will need to be more imaginative than this. Just extending the basic rules outward (e.g. grandparent to great-grandparent and so on) is also no real addition to what we've already done in class. Think of more complex relationships, especially those that fall into several different cases, have complex variations, or involve change over time.

In addition to these relationships, you must also define the following:

An ancestor predicate that indicates whether or not two people are ancestors

A related predicate that indicates whether or not two people are related by blood (i.e. share a genetic relationship, as opposed to being related via a marriage or partnership). As a possible extension, you could also consider writing a separate predicate that would indicate whether two people are related only by marriage.

A recursive printfam routine that prints all family members who are descendants of a specific person (i.e. prints directly: this should not require you to manually enter ;)

Your code should be documented as to the relationships you define, to point out semantics of multiple-place predicates that may not be obvious to the markers, and to flag any unusual cases (e.g. relationship Q will only work if there is at least one bound variable - though clearly your predicates should work as broadly as possible).

Do not define any more fact predicates than are absolutely necessary: you should have a small group of fact predicates that are then used by more general rules to define knowledge that can be derived from facts. A predicate stated as a fact should not also be the conclusion of any rule. The rules should be complete, even if your particular set of facts does not require all variations of a rule - for example, there is more way in which someone could be your aunt - by blood and by marriage - and even if all the existing aunts in your chosen family are of one variety, your rule should implement all cases. Ideally you should test all cases as well.

For testing your program/producing output, I am asking for you to put all your prolog predicates into a single source file, and then test these with appropriate queries (trying to show both variables and constants in your queries), and then cut that testing input/output from the listener window and paste it back as a Prolog comment in your source file, so that your code and testing can be handed in using a single file (remember, prolog comments can be open ended, as opposed to just line by line). Your testing does not have to cover every universal combination of variable/value/relationship possibility, but it should be comprehsensive: test all branches/possibilities of a relationship, and show that your predicates work with complex cases as well as simple ones. Your testing examples should be enough to both demonstrate the system works and give the markers enough examples to use your queries so that they can test the system on their own as well.

After you do this cut and paste, the file will be your handin submission, so it is vital that the output you pasted in a comment be the same output produced by the predicates in the file - if you make changes, you must retest, because any difference between the output you claim your system produces and that which it does would be considered academic dishonesty. If the markers test your routines with the same queries it must produce the same output. So, best be completely happy with your system before running your final tests rather than doing this pasting over and over.

After you have cut and pasted your testing/output as a prolog comment (yes, this will be a long file), you should save your source file and then try loading it into Prolog again, to ensure that the comment has been appropriately formatted - otherwise your source file may not load if the markers attempt to run it, and would be considered non-working code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

4. The team is trained to function without direct supervision.

Answered: 1 week ago