In a computer science university assignment, a computer program must implement PROLOG. A Prolog programming assignment typically begins with a programmer defining a model of some kind. For example, the programmer might define a domain (the physical universe within which an agent operates), a set of rules (procedural procedures that an agent will follow), and an environment (the processes of observation in which an agent makes an interpretation of its environment).
Next, the programmer uses a simple language to describe the operations that an agent will undertake in the domain and environment. The agent is then given a set of instructions (steps to follow) and it is expected that it will perform the operations in the specified order. An agent is said to be successful if it follows the prescribed instructions to the letter.
Prolog also has an interpretive grammar. This grammar, unlike other grammars, does not use quantifiers or any other grammatical structure which would cause an interpretation error. Rather, it requires an agent to make certain predictions about its environment.
The key to the success of a PROLOG computer program lies in the programmer’s ability to define a language which can be used by an agent to perform an entire PROLOG program. There are two main languages used in an assignment, namely the syntax-rules notation and the declarative grammar. The syntax-rules notation is a syntax tree in which an abstract syntax is defined. A syntax tree is composed of a number of nodes and an edge of one or more nodes at the left or right of the syntax tree.
The declarative grammar is used by the programmer when describing a particular task that an agent must perform in the environment. The syntax-rules notation uses a grammar that describes a grammatical action which must occur repeatedly in the environment. These actions are described in the form of a formula whose arguments are expressions whose values are nouns.
One main task that an agent must accomplish in an assignment is to classify an object from a collection of other objects in a hierarchy. There are four ways to classify an object in the hierarchy:
The assignment may also specify that the object is an instance of a specific class, which could be an animal, a machine, an object in the human world, or some other entity. It may also specify that the object is an instance of a family, an instance of a class of objects, a specific class of object, or a category.
When an agent has to perform an assignment and has an appropriate class, it can choose between two alternatives: it can either choose to assign each of the classes of object to an instance of the same object or it can choose to assign the object to each class of an instance of an object. For instance, suppose that we are to assign each class of object to an animal, then we know that the object we have to assign to an animal will be a mammal and therefore the corresponding instance of that animal will be a mammal. Similarly, suppose that we are to assign each class of an instance of an animal to a machine and then assign the machine an instance of a machine, then we know that the corresponding instance of that machine will be an animal.
If we are to assign each instance of a machine to an instance of a human, then the corresponding instance of the machine will be a human, the corresponding instance of a machine will be an animal, the corresponding instance of a human will be an instance of a human, and so on until the machine class can be assigned to an actual human. Finally, suppose that we are to assign each machine to an instance of a human and an instance of a machine, then the corresponding machine will be an instance of a human, the corresponding machine will be an instance of an animal, and so on until the machine class cannot be assigned to an actual human.
We can then say that when the machine class cannot be assigned to an actual human, the assignment fails in one of three ways: it fails because it is not a machine, it fails because it is not an appropriate machine class, or it fails because it is not appropriate for the situation. In order to avoid these failure conditions, an agent can use a rule which tells it to choose between the first two.
Whenever an agent has to perform an assignment, it first decides whether it is to assign an appropriate machine class to an instance of the object. Then, it determines how to make certain predictions about the environment and whether or not the predictions are true.