foundations of computational agents
The third edition of Artificial Intelligence: foundations of computational agents, Cambridge University Press, 2023 is now available (including full text).
The first step in giving the semantics of Datalog is to give the semantics for the ground (variable-free) case.
An interpretation is a triple $$
$D$ is a non-empty set called the domain. Elements of $D$ are individuals.
$\varphi $ is a mapping that assigns to each constant an element of $D$.
$\pi $ is a mapping that assigns to each n-ary predicate symbol a function from ${D}^{n}$ into $\{\text{true},\text{false}\}$.
$\varphi $ is a function from names into individuals in the world. The constant $c$ is said to denote the individual $\varphi (c)$. Here $c$ is a symbol but $\varphi (c)$ 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.
$\pi (p)$ specifies whether the relation denoted by the $n$-ary predicate symbol $p$ is true or false for each $n$-tuple of individuals. If predicate symbol $p$ has no arguments, then $\pi (p)$ is either true or false. Thus, for predicate symbols with no arguments, this semantics reduces to the semantics of propositional definite clauses.
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 telephone, and ✎ is a pencil.
Suppose the constants in our language are ${p}{\mathit{}}{h}{\mathit{}}{o}{\mathit{}}{n}{\mathit{}}{e}$, ${p}{\mathit{}}{e}{\mathit{}}{n}{\mathit{}}{c}{\mathit{}}{i}{\mathit{}}{l}$, and ${t}{\mathit{}}{e}{\mathit{}}{l}{\mathit{}}{e}{\mathit{}}{p}{\mathit{}}{h}{\mathit{}}{o}{\mathit{}}{n}{\mathit{}}{e}$. We have the predicate symbols ${n}{\mathit{}}{o}{\mathit{}}{i}{\mathit{}}{s}{\mathit{}}{y}$ and ${l}{\mathit{}}{e}{\mathit{}}{f}{\mathit{}}{t}{\mathit{}}{\mathrm{\_}}{\mathit{}}{o}{\mathit{}}{f}$. Assume ${n}{\mathit{}}{o}{\mathit{}}{i}{\mathit{}}{s}{\mathit{}}{y}$ is a unary predicate (it takes a single argument) and that ${l}{\mathit{}}{e}{\mathit{}}{f}{\mathit{}}{t}{\mathit{}}{\mathrm{\_}}{\mathit{}}{o}{\mathit{}}{f}$ is a binary predicate (it takes two arguments).
An example interpretation that represents the individuals on the table is
${D}{=}{\{}{\mathit{\text{\u2702}}}{,}{\mathit{\text{\u260e}}}{,}{\mathit{\text{\u270e}}}{\}}$.
${\varphi}{}{(}{p}{}{h}{}{o}{}{n}{}{e}{)}{=}{\mathit{\text{\u260e}}}$, ${\varphi}{}{(}{p}{}{e}{}{n}{}{c}{}{i}{}{l}{)}{=}{\mathit{\text{\u270e}}}$, ${\varphi}{}{(}{t}{}{e}{}{l}{}{e}{}{p}{}{h}{}{o}{}{n}{}{e}{)}{=}{\mathit{\text{\u260e}}}$.
${\pi}{}{(}{n}{}{o}{}{i}{}{s}{}{y}{)}$:
${\u27e8}{\mathit{\text{\u2702}}}{\u27e9}$
false
${\u27e8}{\mathit{\text{\u260e}}}{\u27e9}$
true
${\u27e8}{\mathit{\text{\u270e}}}{\u27e9}$
false
${\pi}{}{(}{l}{}{e}{}{f}{}{t}{}{\mathrm{\_}}{}{o}{}{f}{)}$:
${\u27e8}{\mathit{\text{\u2702}}}{,}{\mathit{\text{\u2702}}}{\u27e9}$
false
${\u27e8}{\mathit{\text{\u2702}}}{,}{\mathit{\text{\u260e}}}{\u27e9}$
true
${\u27e8}{\mathit{\text{\u2702}}}{,}{\mathit{\text{\u270e}}}{\u27e9}$
true
${\u27e8}{\mathit{\text{\u260e}}}{,}{\mathit{\text{\u2702}}}{\u27e9}$
false
${\u27e8}{\mathit{\text{\u260e}}}{,}{\mathit{\text{\u260e}}}{\u27e9}$
false
${\u27e8}{\mathit{\text{\u260e}}}{,}{\mathit{\text{\u270e}}}{\u27e9}$
true
${\u27e8}{\mathit{\text{\u270e}}}{,}{\mathit{\text{\u2702}}}{\u27e9}$
false
${\u27e8}{\mathit{\text{\u270e}}}{,}{\mathit{\text{\u260e}}}{\u27e9}$
false
${\u27e8}{\mathit{\text{\u270e}}}{,}{\mathit{\text{\u270e}}}{\u27e9}$
false
Because ${n}{}{o}{}{i}{}{s}{}{y}$ is unary, it takes a singleton individual and has a truth value for each individual.
Because ${l}{}{e}{}{f}{}{t}{}{\mathrm{\_}}{}{o}{}{f}$ 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, ${\pi}{}{(}{l}{}{e}{}{f}{}{t}{}{\mathrm{\_}}{}{o}{}{f}{)}{}{(}{\u27e8}{\mathit{\text{\u2702}}}{,}{\mathit{\text{\u260e}}}{\u27e9}{)}{=}{t}{}{r}{}{u}{}{e}$, because the scissors are to the left of the telephone; ${\pi}{}{(}{l}{}{e}{}{f}{}{t}{}{\mathrm{\_}}{}{o}{}{f}{)}{}{(}{\u27e8}{\mathit{\text{\u270e}}}{,}{\mathit{\text{\u270e}}}{\u27e9}{)}{=}{f}{}{a}{}{l}{}{s}{}{e}$, because the pencil is not to the left of itself.
Note how the ${D}$ is a set of things in the world. The relations are among the individuals in the world, not among the names. As ${\varphi}$ specifies that ${p}{\mathit{}}{h}{\mathit{}}{o}{\mathit{}}{n}{\mathit{}}{e}$ and ${t}{\mathit{}}{e}{\mathit{}}{l}{\mathit{}}{e}{\mathit{}}{p}{\mathit{}}{h}{\mathit{}}{o}{\mathit{}}{n}{\mathit{}}{e}$ refer to the same individual, exactly the same statements are true about them in this interpretation.
Consider the interpretation of Figure 13.1.
${D}$ 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 ${D}$, ${\varphi}$, and ${\pi}$ by pointing to the physical individuals or a depiction of them (as is done in Figure 13.1) and describe the meaning in natural language.
The constants are ${k}{\mathit{}}{i}{\mathit{}}{m}$, ${r}{\mathit{}}{\mathrm{123}}$, ${r}{\mathit{}}{\mathrm{023}}$, and ${c}{\mathit{}}{s}{\mathit{}}{\mathrm{\_}}{\mathit{}}{b}{\mathit{}}{u}{\mathit{}}{i}{\mathit{}}{l}{\mathit{}}{d}{\mathit{}}{i}{\mathit{}}{n}{\mathit{}}{g}$. The mapping ${\varphi}$ is defined by the gray arcs from each of these constants to an individual in the world in Figure 13.1.
The predicate symbols are ${p}{\mathit{}}{e}{\mathit{}}{r}{\mathit{}}{s}{\mathit{}}{o}{\mathit{}}{n}$, ${i}{\mathit{}}{n}$, and ${p}{\mathit{}}{a}{\mathit{}}{r}{\mathit{}}{t}{\mathit{}}{\mathrm{\_}}{\mathit{}}{o}{\mathit{}}{f}$. The meaning of these are meant to be conveyed in the figure by the arcs from the predicate symbols.
Thus, the person called Kim is in the room ${r}{\mathit{}}{\mathrm{123}}$ and is also in the CS building, and these are the only instances of the ${i}{\mathit{}}{n}$ relation that are true. Similarly, room ${r}{\mathit{}}{\mathrm{123}}$ and room ${r}{\mathit{}}{\mathrm{023}}$ are part of the CS building, and there are no other ${p}{\mathit{}}{a}{\mathit{}}{r}{\mathit{}}{t}{\mathit{}}{\mathrm{\_}}{\mathit{}}{o}{\mathit{}}{f}$ relationships that are true in this interpretation.
Each ground term denotes an individual in an interpretation. A constant $c$ denotes in $I$ the individual $\varphi (c)$.
A ground atom is either true or false in an interpretation. Atom $p({t}_{1},\mathrm{\dots},{t}_{n})$ is true in $I$ if $$, where ${t}_{i}^{\prime}$ is the individual denoted by term ${t}_{i}$, and is false in $I$ otherwise.
The atom ${i}{\mathit{}}{n}{\mathit{}}{\mathrm{(}}{k}{\mathit{}}{i}{\mathit{}}{m}{\mathrm{,}}{r}{\mathit{}}{\mathrm{123}}{\mathrm{)}}$ is true in the interpretation of Example 13.5, because the person denoted by ${k}{\mathit{}}{i}{\mathit{}}{m}$ is indeed in the room denoted by ${r}{\mathit{}}{\mathrm{123}}$. Similarly, ${p}{\mathit{}}{e}{\mathit{}}{r}{\mathit{}}{s}{\mathit{}}{o}{\mathit{}}{n}{\mathit{}}{\mathrm{(}}{k}{\mathit{}}{i}{\mathit{}}{m}{\mathrm{)}}$ is true, as is ${p}{\mathit{}}{a}{\mathit{}}{r}{\mathit{}}{t}{\mathit{}}{\mathrm{\_}}{\mathit{}}{o}{\mathit{}}{f}{\mathit{}}{\mathrm{(}}{r}{\mathit{}}{\mathrm{123}}{\mathrm{,}}{c}{\mathit{}}{s}{\mathit{}}{\mathrm{\_}}{\mathit{}}{b}{\mathit{}}{u}{\mathit{}}{i}{\mathit{}}{l}{\mathit{}}{d}{\mathit{}}{i}{\mathit{}}{n}{\mathit{}}{g}{\mathrm{)}}$. The atoms ${i}{\mathit{}}{n}{\mathit{}}{\mathrm{(}}{c}{\mathit{}}{s}{\mathit{}}{\mathrm{\_}}{\mathit{}}{b}{\mathit{}}{u}{\mathit{}}{i}{\mathit{}}{l}{\mathit{}}{d}{\mathit{}}{i}{\mathit{}}{n}{\mathit{}}{g}{\mathrm{,}}{r}{\mathit{}}{\mathrm{123}}{\mathrm{)}}$ and ${p}{\mathit{}}{e}{\mathit{}}{r}{\mathit{}}{s}{\mathit{}}{o}{\mathit{}}{n}{\mathit{}}{\mathrm{(}}{r}{\mathit{}}{\mathrm{123}}{\mathrm{)}}$ are false in this interpretation.
Logical connectives, models and logical consequences have the same meaning as in the propositional calculus:
A ground clause is false in an interpretation if the head is false and the body is true (or is empty); otherwise, the clause is true in the interpretation.
A model of a knowledge base $KB$ is an interpretation in which all the clauses in $KB$ are true.
If $KB$ is a knowledge base and $g$ is a proposition, $g$ is a logical consequence of $KB$, written $KB\vDash g$, if $g$ is true in every model of $KB$. Thus $KB\vDash \u0338g$, meaning $g$ is not a logical consequence of $KB$, when there is a model of $KB$ in which $g$ is false.