Exercise 1.
1. Define a predicate sibling(X,Y) which holds iff X and Y are siblings.
2. Define a predicate cousin(X,Y) which hold iff X and Y are cousins.
3. Define a predicate grandchild(X,Y) which holds iff X is a grandchild of Y.
Copyright By PowCoder代写 加微信 powcoder
4. 4. Define a predicate descendent(X,Y) which holds iff X is a descendent of Y.
Exercise 2.
1. member(X,L) which holds iff the element X occurs in L.
2. subset(L,K), which holds iff L is a subset of K.
3. disjoint(L,K), which holds iff L and K are disjoint (i.e. they have no elements in common).
Exercise 3. Define a predicate sum_list(L, N) that returns the sum N of all the elements of a given list L.
Exercise 4. Define a predicate observed(N, L, X) that holds if the element X is observed at the position N of a given list L. The positions should start at one.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com