CSE 465/565 代写代考 Prolog – cscodehelp代写

CSE  465/565

Winter 2022

Homework #3

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.


  1. (16 points; 4 points each) Answer the following review questions from Chapter 16:
    1. What are antecedents? Consequences?
    2. Give general (not rigorous) definitions of resolution and unification.
    3. What are the forms of Horn clauses.
    4. Explain what is wrong with the Prolog statement K is K + 1.
  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.
  1. (14 points) quadratic(A, B, C, ROOTS)
  2. (14 points) isLargerCube(W1, L1, H1, W2, L2, W2)
  3. (14 points) allSame(L)
  4. (10 points) allDifferent(L)
  5. (10 points) zip(L1, L2, PAIRS)
  6. (8 points) removeKth(K, L, O)
  1. (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.

    and

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *