3203. Introduction to Artificial Intelligence

Predicate Calculus

 

Logic is the study of valid inference. Predicate calculus, or predicate logic, is a kind of mathematical logic, which was developed to provide a logical foundation for mathematics, but has been used for inference in other domains.

1. The propositional calculus

Propositional calculus, or propositional logic, is a subset of predicate logic.

In propositional calculus, the basic unit of knowledge is a proposition. By definition, it is what is conveyed by a declarative sentence used to make a statement or assertion. Intuitively speaking, a proposition is the conceptual correspondence of a declarative sentence (in English). Therefore, if several sentences means the same thing, they represent the same proposition. Each proposition has a truth value, which is either true or false, though in a particular instance we may not know which value it has.

There are two types of propositions: atomic and compound, the former is represented by an identifier, while the latter is by a structure of propositions connected together by connectives. There are five common connectives (conjunction, disjunction, negation, implication, and equivalence), defined by the following truth table, where P and Q are (atomic or compound) propositions:
 

P Q (P ∧ Q) (P∨Q) (¬P) (P → Q) (P ↔ Q)
T T T T F T T
T F F T F F F
F T F T T T F
F F F F T T T

A well-formed formulas (wff), also called sentences in propositional calculus, is a formula that can be recursively formed with the connectives from atoms. A pair of parentheses can be omitted if no confusion will be caused.

From the above truth table, it can be derived that some compound propositions are true no matter what the truth values their components have. For instances:

    (P ∨ ¬P)
    (P → P)
    ¬(P ∧ ¬P)
    (P → (Q → P))
Double Negation:
    ¬(¬P) ↔ P
Symmetric Law:
    (P ∧ Q) ↔ (Q ∧ P)
    (P ∨ Q) ↔ (Q ∨ P)
Associative Law:
    (P ∧ (Q ∧ R)) ↔ ((P ∧ Q) ∧ R)
    (P ∨ (Q ∨ R)) ↔ ((P ∨ Q) ∨ R)
Distributive Law:
    (P ∧ (Q ∨ R)) ↔ ((P ∧ Q) ∨ (P ∧ R))
    (P ∨ (Q ∧ R)) ↔ ((P ∨ Q) ∧ (P ∨ R))
De Morgan's Law
    ¬(P ∨ Q) ↔ (¬P ∧ ¬Q)
    ¬(P ∧ Q) ↔ (¬P ∨ ¬Q)
Implication and equivalence:
    (P → Q) ↔ (¬P ∨ Q)
    (P ↔ Q) ↔ ((P → Q) ∧ (Q → P))
Law of Contrapositive:
    (P → Q) ↔ (¬Q → ¬P)
An inference rule derive a conclusion C from a set of premises S. It can be written as "S |- C".

An inference rule is sound if C logically follows from S, that is, if "S → C" is true. The following rules are all sound:

    {P, (P → Q)} |- Q 
    {¬Q, (P → Q)} |- ¬P 
    {(P → Q), (Q → R)} |- (P → R) 
    {P, (P ↔ Q)} |- Q 
    {P, Q} |- (P ∧ Q) 
    {(P ∧ Q)} |- P 
    {P} |- (P ∨ Q) 
    {(P ∨ Q), ¬P} |- Q 
An inference process consists of a sequence of inference steps, each of which is the application of an inference rule on available premises. Conclusions of the steps can be used as premises by the following steps.

 

2. The predicate calculus

In predicate logic, the definition of wff is extended. The simplest wff consists of a predicate (sometimes called relation) followed by one or more arguments (sometimes called objects, individuals, terms, or names): P(a1, a2, ..., an).

Intuitively, each argument represents an individual object in the domain under discussion, and each predicate represents an attribute (especially for predicates with single argument) or a relation (especially for predicates with multiple arguments) in the domain. For each predicate, the number of arguments and their order are determined. That is, if both P(a) and P(a, b) are wffs, then the two Ps are different predicates. In general, P(a, b) and P(b, a) may have difference in meaning and truth value.

In first-order predicate logic, a predicate can only be a constant identifier. On the other hand, an argument can be a constant identifier, a variable, or a function with the form of f(a1, a2, ..., an), where f is a function name (constant identifier), and a1, a2, ..., an are arguments. The difference between a function and a relation (predicate) is that the former (when evaluated) returns an argument as its value, while the latter has a truth value (true or false).

If a formula contains a variable x, then for the formula to be a wff, all occurrences of x must be bounded by the scope of either an universal quantifier "∀" or an existential quantifier "∃" (usually written as upside-down). (∀x)P(x) means that all objects in the domain have attribute P, while (∃x)P(x) means that at least one object in the domain has attribute P. Each quantifier has its own scope, which is the wff that directly follows it.

When there are multiple variable in a sentence, the order of quantifiers may matter. For example:

There are certain relations between quantifiers and connectives: When the scopes of variables have no overlap, it is better to use different identifiers for them, though in principle it is fine for them to share the same identifier. Even with the same variable name, they are still different variables if they are bounded by separated quantifiers.

All the inference rules in propositional calculus are also valid in predicate calculus.

What is new in predicate logic is that we need rules to handle the internal structure of propositions, especially, variables.

There are two important rules:

  1. Universal instantiation (UI): From (∀x)F(x), infer F(a), where a is a constant, and F(a) is obtained from F(x) with x substituted by a throughout F.
  2. Existential generalization (EG): From F(a), infer (∃x)F(x), where a is a constant, and F(x) is obtained from F(a) with a substituted by x throughout F.
Intuitively, the former says that what is true for everything must be true for a given thing; the latter says that it is fine to replace a constant name with an existential variable (to make it anonymous).

Example: given premises {(∀x)(P(x) → Q(x)), P(a)}, can (∃x)Q(x) be proven?

Proof:

  1. By UI, {∀x)(P(x) → Q(x)} |- (P(a) → Q(a)).
  2. By Deduction, {(P(a) → Q(a)), P(a)} |- Q(a).
  3. By EG, {Q(a)} |- (∃x)Q(x).
For a set of inference rules R defined on a formal language L and two wffs P and Q, if Q can be derived from P by R only when P logically follows Q, then R is called sound; if Q can be derived from P by R whenever P logically follows Q, then R is called complete. Intuitively speaking, a sound system only generates true propositions (therefore never gives wrong answers), and a complete system generates all true propositions (therefore never misses any truth).

All the inference rules introduced here are sound. For first-order predicate logic, there exist rule sets that are both sound and complete.