foundations of computational agents
Predicate calculus, often just known as predicate logic, extends propositional calculus in two ways:
atoms have structure and can include constants and logical variables
quantification of logical variables.
This book follows the syntactic conventions of Prolog, where variables start with an upper-case letter. In mathematics, variables typically are , , and . In Prolog, as in other programming languages, longer names are typically used to make code more readable. The upper case is used to make variables stand out.
The syntax of the predicate calculus extends the syntax of the propositional calculus as follows, where a symbol is a sequence of letters, digits, or an underscore (“”):
A logical variable is a symbol starting with an upper-case letter or with “_”. For example, , , , , and are all variables.
A constant is a symbol that starts with a lower-case letter, or is a number constant or a string.
A predicate symbol is a symbol that starts with a lower-case letter. Constants and predicate symbols are distinguishable by their context in a knowledge base.
For example, , , , , and can be constants or predicate symbols, depending on the context; is a constant.
A term is either a variable or a constant.
For example, , , , , or can be terms.
An atomic symbol, or simply an atom, is of the form or , where is a predicate symbol and each is a term. Each is called an argument to the predicate.
For example, , , , , , and can all be atoms. From context in the atom , the symbol is a predicate symbol and is a constant.
A logical formula is built from the atoms using the connectives of the propositional calculus, and the quantifiers. The following are also logical formula:
, where is a variable, and is a logical formula (typically containing ), is read “for all , ”. Variable is said to be universally quantified.
, where is a variable, and is a logical formula, is read “there exists an such that ”. Variable is said to be existentially quantified.
The following are logical formulas:
From context, , , and are constants; , , , , , , , , and are predicate symbols; and , , , , , and are variables.
The first two formulas may make some intuitive sense, even without an explicitly provided formal specification for the meaning of formulas. However, regardless of the mnemonic names’ suggestiveness, as far as the computer is concerned, the first two formulas have no more meaning than the third. Meaning is provided only by virtue of a semantics.
An expression is ground if it does not contain any variables. For example, is ground, but is not ground.
The next sections define the semantics. First consider ground expressions and then extend the semantics to include variables.
The first step in giving the semantics of predicate calculus is to give the semantics for the ground (variable-free) case.
An interpretation is a triple :
is a non-empty set called the domain. Elements of are individuals.
is a mapping that assigns to each constant an element of .
is a mapping that assigns to each n-ary predicate symbol a function from into .
is a function from names into individuals in the world. The constant is said to denote the individual . Here is a symbol but can be anything: a real physical individual such as a person or a virus, an abstract concept such as a course, love, the number 2, or a symbol.
specifies whether the relation denoted by the -ary predicate symbol is true or false for each -tuple of individuals. If predicate symbol has no arguments, then is either or . Thus, for predicate symbols with no arguments, this semantics reduces to the semantics of the propositional calculus.
Consider the world consisting of three individuals on a table:
✂ ✈ ✎
These are drawn in this way because they are things in the world, not symbols. ✂ is a pair of scissors, ✈ is a model airplane, and ✎ is a pencil.
Suppose the constants in our language are , , and , and predicate symbols are and . Assume is a unary predicate (it takes a single argument) and that is a binary predicate (it takes two arguments).
An example interpretation that represents the individuals on the table is
.
, , .
:
:
Because is unary, it takes a singleton individual and has a truth value for each individual.
Because is a binary predicate, it takes a pair of individuals and is true when the first element of the pair is left of the second element. Thus, for example, , because the scissors are to the left of the model; , because the pencil is not to the left of itself.
Note how the is a set of things in the world. The relations are among the individuals in the world, not among the names. As specifies that and refer to the same individual, exactly the same statements are true about them in this interpretation.
Consider the interpretation of Figure 15.1.
is the set with four elements: the person Kim, room 123, room 023, and the CS building. This is not a set of four symbols, but it is the set containing the actual person, the actual rooms, and the actual building. It is difficult to write down this set and, fortunately, you never really have to. To remember the meaning and to convey the meaning to another person, knowledge base designers typically describe , , and by pointing to the physical individuals, or a depiction of them (as is done in Figure 15.1), or describe the meaning in natural language.
The constants are , , , and . The mapping is defined by the gray arcs from each of these constants to an individual in the world in Figure 15.1.
The predicate symbols are , , and . The meanings of these are meant to be conveyed in the figure by the arcs from the predicate symbols.
Thus, the person called Kim is in room and is also in the CS building, and these are the only instances of the relation that are true. Similarly, room and room are part of the CS building, and there are no other relationships that are true in this interpretation.
Each ground term denotes an individual in an interpretation. A constant denotes in the individual .
A ground atom is either true or false in an interpretation. Atom is true in if , where is the individual denoted by term , and is false in otherwise.
The atom is true in the interpretation of Example 15.5, because the person denoted by is indeed in the room denoted by . Similarly, is true, as is . The atoms and are false in this interpretation.
Logical connectives have the same meaning as in the propositional calculus; see Figure 5.1 for the truth tables for the logical connectives.
To define the semantics of logical formulas with variables, a variable assignment, , is a function from the variables into the domain . Thus, a variable assignment assigns an element of the domain to each variable. Given interpretation and variable assignment , each term denotes an individual in the domain. If the term is a constant, the individual is given by . If the term is a variable, the individual is given by . Given an interpretation and a variable assignment for all variables, each atom is either true or false, using the same definition as earlier.
The semantics of quantification is as follows:
Universally quantified formula is true in an interpretation if is true for all variable assignments of to an individual. Thus, a formula is false in an interpretation whenever there is a variable assignment to under which the formula is false. The formula is the scope of .
Existentially quantified formula is true in an interpretation if is true for some variable assignment of to an individual. The individual that exists can depend on universally quantified variables that is in the scope of. For example, in , the can depend on ; for every number there is an such that . In , the cannot depend on because is not in the scope of ; there does not exist an such that for every number , .
A formula that contains a variable that does not have an enclosing qualification is said to be open, and does not have a truth value, because not all variables have a variable assignment.
The formula
is false in the interpretation of Example 15.5, because under the variable assignment with denoting Kim and denoting Room 123, is true and is false.
The formula
is true in that interpretation, because is true in all variable assignments where is true.
Logical consequence is defined in the same way as it was for propositional calculus in Section 5.1.2: is a logical consequence of , written , if is true in every model of .
Suppose the knowledge base is the conjunction of the formulas
The interpretation defined in Example 15.5 is a model of , because each formula is true in that interpretation.
, because this is stated explicitly in the knowledge base. If every formula in is true in an interpretation, then must be true in that interpretation.
. The interpretation defined in Example 15.5 is a model of , in which is false.
. Although is true in the interpretation of Example 15.5, there is another model of in which is false. In particular, the interpretation which is like the interpretation of Example 15.5, but where
is a model of in which is false.
. If the formula in are true in interpretation , it must be the case that is true in , otherwise, there is an instance of the third formula of that is false in – a contradiction to being a model of .
The formal description of semantics does not tell us why semantics is interesting or how it can be used as a basis to build intelligent systems. The methodology for using semantics for propositional logic programs can be extended to predicate logic:
Select the task domain or world to represent. This could be some aspect of the real world, for example, the structure of courses and students at a university or a laboratory environment at a particular point in time, some imaginary world, such as the world of Alice in Wonderland, or the state of the electrical environment if a switch breaks, or an abstract world, for example, the world of money, numbers, and sets. Within this world, let the domain be the set of all individuals or things that you want to be able to refer to and reason about. Also, select which relations to represent.
Associate constants in the language with individuals in the world that you want to name. For each element of you want to refer to by name, assign a constant in the language. For example, you may select the name “” to denote a particular professor and the name “” for a particular introductory AI course. Each of these names denotes the corresponding individual in the world.
For each relation that you may want to represent, associate a predicate symbol in the language. Each -ary predicate symbol denotes a function from into , which specifies the subset of for which the relation is true. For example, the predicate symbol “” of two arguments (a teacher and a course) may correspond to the binary relation that is true when the individual denoted by the first argument teaches the course denoted by the second argument.
The association of symbols with their meanings forms an intended interpretation. This specifies what the symbols are intended to mean.
Write formulas that are true in the intended interpretation. This is often called axiomatizing the domain, where the given formulas are the axioms of the domain, or the knowledge base. For example, if the person denoted by the symbol teaches the course denoted by the symbol , you can assert the formula as being true in the intended interpretation. Not everything that is true needs to be written down; there is no need to state what is implied by other axioms.
Ask queries about the intended interpretation. The system gives answers that you can interpret using the meaning assigned to the symbols.
Following this methodology, the knowledge base designer does not actually tell the computer anything until step 4. The first three steps are carried out in the head of the designer. Of course, the designer should document the denotations to make their knowledge base understandable to other people, so that they remember each symbol’s denotation, and so that they can check the truth of the formulas.
The world itself does not prescribe what the individuals are.
In one conceptualization of a domain, may be a predicate symbol of one argument that is true when the individual denoted by that argument is pink. In another conceptualization, may be an individual that is the color pink, and it may be used as the second argument to a binary predicate , which says that the individual denoted by the first argument has the color denoted by the second argument. Alternatively, someone may want to describe the world at a level of detail where various shades of are not distinguished, and so the color would not be included. Someone else may describe the world in more detail, and decide that is too general a term, and use the terms and .
When the individuals in the domain are real physical things, it is usually difficult to give the denotation without physically pointing at the individual. When the individual is an abstract individual – for example, a university course or the concept of love – it is virtually impossible to write the denotation. However, this does not prevent the system from representing and reasoning about such concepts.