One reason to build a description of a real or imaginary world is to be able to determine what else must be true in that world. After the computer is given a knowledge base about a particular domain, a user might like to ask the computer questions about that domain. The computer can answer whether or not a proposition is a logical consequence of the knowledge base. If the user knows the meaning of the atoms, the user can interpret the answer in terms of the domain.

A query is a way of asking whether a proposition is a logical consequence of a knowledge base. Once the system has been provided with a knowledge base, a query is used to ask whether a formula is a logical consequence of the knowledge base. Queries have the form

 $\displaystyle{\mbox{{ask}~{}}~{}b.}$

where $b$ is a an atom or a conjunction of atoms (analogous to the body of a rule).

A query is a question that has the answeryes” if the body is a logical consequence of the knowledge base, or the answer “no” if the body is not a consequence of the knowledge base. The latter does not mean that $body$ is false in the intended interpretation but rather that it is impossible to determine whether it is true or false based on the knowledge provided.

###### Example 5.8.

Once the computer has been told the knowledge base of Example 5.7, it can answer queries such as

 $\displaystyle{{\mbox{{ask}~{}}~{}\mbox{light\_l}_{1}.}}$

for which the answer is yes. The query

 $\displaystyle{{\mbox{{ask}~{}}~{}\mbox{light\_l}_{6}.}}$

has answer no. The computer does not have enough information to know whether or not $l_{6}$ is a light. The query

 $\displaystyle{{\mbox{{ask}~{}}~{}\mbox{lit\_l}_{2}.}}$

has answer yes. This atom is true in all models.

The user can interpret this answer with respect to the intended interpretation.