Concepts of Programming Languages Chapter 16
Name : Erland
NIM : 1601218035
Lecturer : Tri Djoko Wahjono, Ir., M.Sc. (D0206)
Assignment : Concept of programming languages Chapter 16
1. What are the three primary uses of symbolic logic in formal logic ?
- to express propositions, to express the relationships between propositions, and todescribe how new propositions can be inferred from other propositions thatare assumed to be true.
2. What are the two parts of a compound term ?
- functor and and ordered list of of parameters
3. What are the two modes in which a proposition can be stated ?
- one in which a proposition is defined to be true and one in which that the proposition is something to be determined.
4. What is general form of a proposition in clausal form ?
-B1 U B2 U . . . U Bn C A1 n A2 n . . . n Am
5. What are antecedents ? Consequents ?
- Antecedents are right side of a clausal form proposition. Consequent is left side of a clausal form propositions
6. Give general definitions of resolution and unification
- Resolution : inference rule that allows inferred propositions to be computed from given propositions, thus providing a method with potential application to automatic theorem proving.-Unification : Process of determining useful values for variables.
7. What are the forms of Horn clauses?
Headed and headless.
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
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.
8. Critically comment on the following statement : “ Logic programs
- It is true, because logical programs use lots of different processes based on its conditions. If a certain logical requirement is true, then a program will execute the corresponding process, instead of procedurally executing the statements.
9. From a book on Prolog, learn and write a description of a monkey-banana
prolem. Why does Prolog allow this problem to exist in its implementation ?
- The problem is defined as this : a monkey is in a room. Suspended from the ceiling is a bunch of bananas, beyond the monkey’s reach. However, in the room there are also a chair and a stick. The ceiling is just the right height so that a monkey standing on a chair could knock the bananas down with the stick. The monkey knows how to move around, carry other things around, reach for the bananas, and wave a stick in the air. What is the best sequence of actions for the monkey?It exists to create a variation in output of Prolog. As Prolog is an AI programming language, a variation might be needed in AI output to make them respond relevant to the situation.