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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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