Chapter 16

Logic Programming Languages

Assignment from Tri Djoko Wahjono

Review Questions

1. What are the three primary uses of symbolic logic in formal logic?
– Express propositions
– Express relationships between propositions
– Describe how new propositions can be inferred from other propositions

2. What are the two parts of a compound term?
– Functor: function symbol that names the relationship
– Ordered list of parameters (tuple)

3. What are the two modes in which a proposition can be stated?
Fact and query

4. What is the general form of a proposition in clausal form?
B1 u B2 u … u Bn c A1 n A2 n … n Am
means if all the As are true, then at least one B is true

5. What are antecedents? Consequents?
Antecedents are right side of a clausal form proposition. Consequent is left side of a clausal form propositions

9. What does it mean for a language to be nonprocedural?
Programs do not state now a result is to be computed, but rather the form of the result

Problem Set

1. Compare the concept of data typing in Ada with that of Prolog.
Ada variables are statically bound to types. Prolog variables are bound to types only when they are bound to values. These bindings take place during execution and are tempoarary.

2. Describe how a multiple-processor machine could be used to implement resolution. Could Prolog, as currently defined, use this method?
On a single processor machine, the resolution process takes place on the rule base, one rule at a time, starting with the first rule, and progressing toward the last until a match is found. Because the process on each rule is independent of the process on the other rules, separate processors could concurrently operate on separate rules. When any of the processors finds a match, all resolution processing could terminate.

6. Explain two ways in which the list-processing capabilities of Scheme and Prolog are similar.
The list processing capabilities of Scheme and Prolog are similar in that they both treat lists as consisting of two parts, head and tail, and in that they use recursion to traverse and process lists.

7. In what way are the list-processing capabilities of Scheme and Prolog different?
The list processing capabilities of Scheme and Prolog are different in that Scheme relies on the primitive functions CAR, CDR, and CONS to build and dismantle lists, whereas with Prolog these functions are not necessary