Programming in Prolog solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

For this programming assignment, you will be writing three short programs in Prolog. Please
submit your three Prolog programs in a zip file and upload them to Canvas under Assignment 2.
The name of your zip file should use the following format: assignment2_username.zip.
Question 1
Write a Prolog program named between_ints.pl so that between_ints(I,J,K) is true iff K is an
integer between integers I and J inclusive.
between_ints(3, 20, 5). should be true
between_ints(3, 20, 20). should be true
between_ints(3, 20, 21). should be false
Question 2
Write a Prolog program named p.pl so that p(X) is true if X is a list consisting of n a’s followed by n
b’s for some integer n.
p([a, a, b, b]). should be true
p([a, b, b, b]). should be false
Question 3
Write a Prolog program named list_min.pl so that list_min(L,M) is true if M is the smallest element
in the list L. The list will not be empty.
list_min([5, 2, 7, 1, 3], 1). should be true
list_min([5, 2, 7, 1, 3], 2). should be false