Question: (Logic programming PROLOG) Write, run, and test a predicate abc(L) which succeeds if list L contains (for any list element) an atom a, followed directly

(Logic programming PROLOG) Write, run, and test a predicate abc(L) which succeeds if list L contains (for any list element) an atom a, followed directly by an atom b, followed directly by an atom c; and which fails otherwise. For example, abc( [d,a,b,c,e,f] ) should succeed, and abc( [d,a,b,g,c,e,f] ) should fail. Show screen shots of code and 10 test queries below in PROLOG.

abc( [d,a,b,c,e,f] ). abc( [d,a,b,g,c,e,f] ). abc( [ ] ). abc( [a,a,a,b,c] ). abc( [b,a,c,b,a,b,a,c,b,c,a,a,b,b,c] ). abc( [a,b] ). abc( [a],[b],[c] ). abc( [ [a,b,c],b,a,c] ). abc( [b,a,a,a,b,a,c,b,c,a,a,b,c] ). abc( [abc,[a],c,b,a,b,a,c,b,c,a,a,b,b,c] ).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!