Describe a real family as a list of facts of the following form:
father( f, c) /* f is father of child c */ mother( m, c) /* m is mother of child c */ man( m) /* m is man */ woman( w) /* w is woman */
Define the following predicates:
parent( P, C) /* P is father or mother of C */ parents( F, M, C) /* F is father, M is mother of C */ child( C, P) /* C is child of P */ son( S, P) /* S is son of P */ daughter( D, P) /* D is daughter of P */ grandfather( GP, GC) /* GV is grandfather of GC */ grandmother( GM, E /* GM is grandmother of E */ grandchild( GC, G) /* GC is grandchild of G */ brother( B, SB) /* B is brother of sibling SB */ sister( S, SB) /* S is sister of sibling SB */ uncle( U, N) /* U is uncle of N */ aunt( A, N) /* A is aunt of N */ woman( w) /* w is woman */
1.1.3 More Family Relations
Define further family relations (e.g. niece, cousin, spouse (!), ...) und test them.
The goal X \= Y with the predefined operator \= succeeds, if and only if X and Y are not equal (more precisely: if they do not unify).
People wish to live in piece. Men, women and children are people. I am a man (a woman). Therefore I wish to live in peace.
Use Prolog to prove this statement!
Fig. 1.1: A Student's Room
Represent this student's room such that the following queries are possible:
- Which furniture is in the room?
- How many doors, windows, tables, ... are in the room?
- Where is the table, the chair, ... ?
- What is to the left (right) of the table, ... (with respect to the center of the room)?
- What is at the wall 2, at the window 1, ... ?
- What is in the corner 1, ... ?
Start with the reprentation of the queries and adapt the reprentation of the room correspondigly. Aim at a concise program with few facts and many rules.