CIS 554 -- Prolog Quiz | Name
__________________________________ |

- (2 points) Write a Prolog predicate
that you can use to find the last element of a list. It declares that the second parameter is the last element of the list given as the first parameter. The predicate should fail if given an empty list. (Hint: two clauses.)`last`

- (1 point) Call your
`last`

predicate to find the last element in the list.`[a, b, c]`

- (1 point) What will be the value of
after you call your function as`X`

. ?**last(X, c)**

- (1 point) Help the prisoner to escape!

Do it by completing the following clause:`dynamic locked/1.`

locked(cell_door).

escape :- locked(cell_door), !, write('You are locked in!'), nl, fail.

escape :- write('You are free!'), nl.

`pick_lock :-`

- (1 point) Briefly define the term
"homoiconic."

- (1 point) Turn the following
into logical (not Prolog) clause form:

`female(X) ∧ rich(X) ⇒ loves(john, X).`

- (1
point) Circle the logical statements that, when turned into
clause form, require a Skolem function:

`∀x∀y, p(x, y) ∀x∃y, p(x, y) ∃x∀y, p(x, y) ∃x∃y, p(x, y)`

- (1 point) How do you indicate a "commit point" in Prolog?

- (1 point) State the resolution principle.