Write a prolog relation subsequence

Assignment Help Programming Languages
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.

Reference no: EM13333366

Questions Cloud

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

Reviews

Write a Review

Programming Languages Questions & Answers

  Identify components that perform distinct service

Identify components that perform a distinct service. Although the details can be quite complex, these details are the basic principles of object-oriented programming

  Write a shell script to read students first names

Write a shell script that reads 5 students' first names, last names and grades and then it calculates the average, maximum and minimum grade.

  Program to retrieve records based on last name-first name

Customer service representatives wish to be able to retrieve records based on Last Name + First Name, Product Number, or State fields. Write down steps involved in your analysis of this problem?

  Write program using getline command

How would you write a program using the getline command, prompting the user to enter their first and then their last name. Also, using a float variable to enter their weight in lbs and height in inches.

  Describe logic why it is not enough to show reduction

If we can only show: if x belongs to A, then y does not belongs to B;explain the logic why it is not enough to show A reduction B.IN other words why the theory needs to prove"if and only if"?

  Determining suitable parameters if pass-by-reference is used

Subprocedures in VBA utilize pass-by-reference. Which function or sub procedure alters its parameter?

  Write a program to enter the number of apartment units

Write a program that prompts the user to enter the number of apartment units, the rent to occupy all the units, the increase in rent that result in a vacant unit.

  Program where the computer plays against a human opponent

Write a function playExpert(marbles) that given a number of marbles returns the number of marbles that the computer will take following the expert mode rules.

  Write program to accept data for each student in school

Write the program which accepts data for each student in school- student ID, classroom number, and score on achievement test. Create program which lists total points scored for each of the 30 classrooms.

  Program to create professor rating class

Write down program to create Professor Rating class comprising of professor ID and three ratings. Three ratings are utilized to estimate easiness.

  Iimplement a class called monetarycoin

Create an implement a class called MonetaryCoin that is derived from the class Coin class. Store a value in the in the monetary coin that represents its value.

  Write program to prompt number of rooms in house

Write down the program which prompts for number of rooms in house. Use input, n, to declare array of rectangles dynamically. In loop, input dimensions for n rooms.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd