Submit hw3W22.pl, which will contain all your source code. The answers to any non-coding questions should be placed at the top of the hw3W22.pl in a comment section.
- (16 points; 4 points each) Answer the following review questions from Chapter 16:
- What are antecedents? Consequences?
- Give general (not rigorous) definitions of resolution and unification.
- What are the forms of Horn clauses.
- Explain what is wrong with the Prolog statement K is K + 1.
- (70 points) Complete the Prolog code in hw3W22.pl to complete the following logic programming problems. See the comments in the prolog file for a detailed description of each rule. You should not have any warnings due to singleton variables.
- (14 points) quadratic(A, B, C, ROOTS)
- (14 points) isLargerCube(W1, L1, H1, W2, L2, W2)
- (14 points) allSame(L)
- (10 points) allDifferent(L)
- (10 points) zip(L1, L2, PAIRS)
- (8 points) removeKth(K, L, O)
- (14 points) Add the contents of parse.pl to the bottom of hw3W22.pl. Then modify those rules so that the number (i.e., plurality) of the noun phrase and verb phrase must match. That is,
sentence([the, sun, shines]). sentence([the, suns, shine]). Should both succeed.
sentence([the, suns, shines]). sentence([the, sun, shine]). Should both fail.
Make sure your code includes the following vocabulary. The approach you adopt should allow more nouns and verbs to be easily added.
Your main rule must be named sentence, as done in the original parse.pl.