Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(i) A variant of Program 3.14 for sublist is defined by the following three rules: Explain why the program above has a different meaning from

(i) A variant of Program 3.14 for sublist is defined by the following three rules:

image text in transcribed

Explain why the program above has a different meaning from Program 3.14 shown below:

image text in transcribed

(i) A variant of Program 3.14 for sublist is defined by the following three rules: subsequence ([X|Xs], [X|Ys]) - subsequence (Xs, Ys). subsequence (Xs, [Y|Ys]) - subsequence (Xs, Ys). subsequence ([ ], Ys). Explain why this program has a different meaning from Pro- gram 3.14. sublist of a tail of a list is a sublist of the list itself. The predicate member can be viewed as a special case of sublist de- fined by the rule member(X,Xs) - sublist([X] ,Xs). 60 Chapter 3 sublist (Sub,List) - Sub is a sublist of List. a: Suffix of a prefix sublist(X,Y) prefix(Ps, Ys), suffix(Xs, Ps). b: Prefix of a suffix sublist(X,Ys) - prefix(Xs, Ss), suffix(Ss, Ys). c: Recursive definition of a sublist sublist(Xs, Ys) - prefix(Xs, Ys). sublist(Xs, [Y|Ys]) - sublist(Xs, Ys). d: Prefix of a suffix, using append sublist(Xs, AsXsBs) - append(As, XsBs, AsXsBs), append(Xs,Bs ,XsBs). e: Suffix of a prefix, using append sublist(Xs, AsXsBs) - append(AsXs, Bs, AsXsBs), append(As, Xs, AsXs). Program 3.14 Determining sublists of lists (i) A variant of Program 3.14 for sublist is defined by the following three rules: subsequence ([X|Xs], [X|Ys]) - subsequence (Xs, Ys). subsequence (Xs, [Y|Ys]) - subsequence (Xs, Ys). subsequence ([ ], Ys). Explain why this program has a different meaning from Pro- gram 3.14. sublist of a tail of a list is a sublist of the list itself. The predicate member can be viewed as a special case of sublist de- fined by the rule member(X,Xs) - sublist([X] ,Xs). 60 Chapter 3 sublist (Sub,List) - Sub is a sublist of List. a: Suffix of a prefix sublist(X,Y) prefix(Ps, Ys), suffix(Xs, Ps). b: Prefix of a suffix sublist(X,Ys) - prefix(Xs, Ss), suffix(Ss, Ys). c: Recursive definition of a sublist sublist(Xs, Ys) - prefix(Xs, Ys). sublist(Xs, [Y|Ys]) - sublist(Xs, Ys). d: Prefix of a suffix, using append sublist(Xs, AsXsBs) - append(As, XsBs, AsXsBs), append(Xs,Bs ,XsBs). e: Suffix of a prefix, using append sublist(Xs, AsXsBs) - append(AsXs, Bs, AsXsBs), append(As, Xs, AsXs). Program 3.14 Determining sublists of lists

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago