Reference no: EM13333366
Your Assignment:
1. Given the relations
father(X,Y) X is the father of Y
mother(X, Y) X is the mother of Y
female(X) X is female
male(X ) X is male
Define prolog relations for the following:
a. sibling
b. sister
c. grandson
d. descendant
Provide some facts for the father, mother, male, and female predicates and then test the entire thing using Prolog.
2. Write a Prolog relation remove(E,L,R) that is true if R is the list which results from removing one instance of E from list L. The relation is false if E isn't a member of L.
What are all of the answers to the following queries?
ask remove(a,[b,a,d,a],R).
ask remove(E,[b,a,d,a],R).
ask remove(E,L,[b,a,d]).
ask remove(p(X),[a,p(a),p(p(a)),p(p(p(a)))],R).
3. Write a Prolog relation subsequence(L1,L2) that is true if list L1 contains a subset of the elements of L2 in the same order.
How many different proofs are there for each of the following queries?
ask subsequence([a,d],[b,a,d,a]).
ask subsequence([b,a],[b,a,d,a]).
ask subsequence([X,Y],[b,a,d,a]).
ask subsequence(S,[b,a,d,a]).
Explain why there are that many.
4. Write a Prolog relation that returns a list containing the union of the elements of two given lists.
5. Write another relation (anything you want) that does something not performed above. Explain what your relation does.
Write a prolog relation remove
: Write a Prolog relation remove(E,L,R) that is true if R is the list which results from removing one instance of E from list L. The relation is false if E isn't a member of L.
|
Define prolog relations for the following
: Provide some facts for the father, mother, male, and female predicates and then test the entire thing using Prolog.
|
Explain what is the ph of a 0.0700 m solution of h2a
: What is the pH of a 0.0700 M solution of H2A? What are the equilibrium conecntrations of H2A and A^2- in this solution? pH = ? [H2A} = ? [A^2-] = ?
|
What is the speed of the large cart after the collision
: A small, 300g cart is moving at 1.30m/s on an air track when it collides with a larger, 5.00kg cart at rest. What is the speed of the large cart after the collision
|
Write a prolog relation subsequence
: Write a Prolog relation remove(E,L,R) that is true if R is the list which results from removing one instance of E from list L. The relation is false if E isn't a member of L.
|
Explain chloroform and chcl3 immiscible or miscible
: Predict whether each of the following solvents is miscible or immiscible with hexane,C6H14. 1.) formic acid, HCOOH immiscible or miscible 3.) methyl ethyl ketone, C4H8O immiscible or miscible 2.) methanol CH3OH immiscible or miscible 4.) chlorofor..
|
Determine his speed at the bottom of the swing
: Tarzan swings on a 31.0m vine initially inclined at an angel of 28.0 degrees to the vertical. What is his speed at the bottom of the swing if he pushes himself with a speed of 2.5m/s
|
Determine what was the earnings per share for the year 2010
: allen lumber company had earnings after taxes of $547,000 in the year 2009 with 400,000 shares outstanding. on january 1, 2010, the firm issued 26,000 new shares.
|
Find the speed of the cab just before it hits the spring
: he cable of the 1400 kg elevator cab in the figure snaps when the cab is at rest at the first floor, Find the speed of the cab just before it hits the spring
|