Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Q6: Quiz#6: Prolog logical expressions
1. Q6: Prolog logical expressions
38: Quiz#6: Prolog logical expressions , Name: ___________________________
CS 340, Fall 2019, York College of Pennsylvania
41, 20 points, 2019-10-31 (at start of class)
On a blank piece of paper, do the following.
A logical expression will be provided at the start of the quiz (8 minutes).
Write a complete Prolog program to output the logical expression and extended truth table using the method covered at the following link. The logical expression provided will be more complicated than the following.
X = Y
And it will be less involved than following.
(X & Y) | ((! X) & (! Y))
Here is the link.
Logical expressions using Prolog
You should order your interior nodes left to right starting at "
A" as in previous examples and use the ordering for the logical variables, etc., as done in the past.
2. Not needed
The following is not needed in your hand-written program.
The predicate
prints at the top.
prints([]):- nl.
prints([X|Rest]):- print(X), prints(Rest).
The query at the bottom.
:- solve(go).
3. General comments
Here are some general comments.
Periods go after facts.
Commas separate parts of a rule (such as in the go rule).
A go is required.
A fail at the end of the go is required. Otherwise, there is no backtracking to find more solutions.
Without the b predicate (for binary digits), the rows would be out of order.
The node letters should go A, B, etc. as we have been doing all semester.
4. Scoring rubric
CS 340 - Q6 : Quiz#6: Prolog logical expressions
Your grade: _ / 20
[LATE] Late or redo penalty: _ / -20
facts with names and values: _ / 4
go predicate: _ / 2
print predicates - before and after: _ / 4
provided variables names and letters A, B, etc.: _ / 2
predicate calls and proper row order: _ / 6
fail predicate: _ / 2
[CREDIT] Extra credit: _ / +4
Comments:
5. End of page