Logic 14
Logic 14
1
Example
2
• Generally, predicates are used to describe certain properties or
relationships between individuals or objects.
Example: In “Mary and Jane are sisters”, the phrase “are
sisters” is a predicate. The entities connected this way,
Mary and Jane, are called terms.
• Terms play a similar role in predicate calculus as nouns and
pronouns do in the English language.
• In addition to terms and predicates, one uses quantifiers.
Quantifiers indicate how frequently a certain statement is
true. Specifically, the universal quantifier is used to
indicate that a statement is always true, whereas the
existential quantifier indicates that a statement is
sometimes true.
Example: In “All cats have tails”, the word “all” indicates
that the statement “cats have tails” is universally true.
• Predicate calculus is a generalization of propositional calculus.
Hence, besides terms, predicates, and quantifiers, predicate
calculus contains propositional variables, constants and
connectives as part of the language.
• An important part is played by functions which are essential
when discussing equations.
3
Predicate calculus in Computer Science
4
Predicate Calculus: Syntax
5
Definition The universe of discourse or domain is the
collection of all persons, ideas, symbols, data structures, and
so on, that affect the logical argument under consideration.
The elements of the domain are called individuals.
6
• The elements of the domain are called individuals. An
individual can be a person, a number, a data structure, or
anything else one wants to reason about.
• To avoid trivial cases, one stipulates that every domain must
contain at least one individual. Hence, the set of all natural
numbers less than 0 does not constitute a domain (universe
of discourse) because there is no negative number.
• Instead of the word individual one sometimes uses the word
object, such as in “the domain must contain at least one
object”.
• To refer to a particular individual or object, identifiers must be
used. These identifiers are called individual constants.
If the universe of discourse consists of persons, the
individual constants may be their names. In the case of
natural numbers the individual constants are the digits
representing these numbers. Each individual constant must
uniquely identify a particular individual and no other one.
7
2. Predicates
8
• In the statement “Mary and Paul are siblings”, the argument
list is given by Mary and Paul, in that order, whereas the
predicate is described by the phrase “are siblings”.
• Similarly, the statement “Tom is a cat” has an argument list
with the single element “Tom” in it, and its predicate is
described by “is a cat”.
• The entries of the argument list are called arguments.
• The arguments can be either variables or individual constants,
but since we have not discussed variables yet, we restrict
our attention to the case when all arguments are individual
constants.
9
• In predicate calculus, each predicate is given a name, which is
followed by the list of arguments.
• The list of arguments is enclosed in parantheses.
• To express “Jane is the mother of Mary” one could choose an
identifier, say “mother” to express the predicate “is the
mother of”, and one would write mother (Jane, Mary).
• Many logicians use only single letters for predicate names and
constants. They would write, for instance M (j, m) instead
of mother(Jane, Mary); that is, they would use M as a
name for the predicate “is the mother of”, j for Jane and m
for Mary. To save space, we will often use this convention.
• Note that the order of arguments is important. Clearly, the
statements mother(Mary, Jane) and mother(Jane, Mary)
have a completely different meaning.
10
The number of elements in the argument list of a predicate is
called the arity of the predicate. For instance, mother(Jane,
Mary) has arity 2. The arity of a predicate is fixed. For
example a predicate cannot have two arguments in one case
and three in another. Alternatively, one can consider two
predicates different if their arity is different. The following
statement illustrates this:
11
• A predicate with arity n is often called an n-place predicate. A
one-place predicate is called a property.
cat(Tom) → hastail(Tom).
12
• If all arguments of a predicate are individual constants, then
the resulting atomic formula must be either true or false.
This is part of the definition of the predicate.
• For instance, if the domain consists of Jane, Doug, Mary and
Paul, we have to know for each ordered pair of individuals
whether or not the predicate “is the mother of” is true.
This can be done in the form of a table.
• The method that assigns truth values to all possible
combinations of individuals of a predicate is called an
assignment. For instance, the following table is an
assignment of the predicate “mother”.
13
Example
1 2 3 4
1 0 0 0 0
2 1 0 0 0
3 1 1 0 0
4 1 1 1 0
14
In a finite domain (universe of discourse), one can represent
the assignments of predicates with arity n by n-dimensional
arrays.
15
3. Variables and instantiation
16
• As in propositional calculus, formulas can be given names. For
instance, one can define A as follows:
A = cat(x) → hastail(x).
which means that when we write A we really mean
“cat(x) → hastail(x)”.
• Syntactically, one can use variables in any place where one is
allowed to use constants.
• The word term is therefore used to refer to either a constant or
a variable. More generally, a term is anything that can be
used in place of an individual (formal definition later).
17
Instantiation
18
Definition
Let A represent a formula, x represent a variable, and t
represent a term. Then StxA represents the formula obtained
by replacing all occurrences of x in A by t. StxA is called an
instantiation of A, and t is said to be an instance of x.
Example:
Let a, b, c be individual constants, P , Q, be predicate
symbols, and x and y be variables. Find
Sax(P (a) → Q(x))
Sby (P (y) ∨ Q(y))
Say Q(a).
Say (P (x) → Q(x)).
Stx is an operation that can be performed on predicates;
therefore it is not a predicate itself, and this makes Stx a
meta-formula.
19
4. Quantifiers
Definition.
Let A represent a formula, and let x represent a variable. If
we want to indicate that A is true for all possible values of x,
we write ∀xA. Here, ∀x is called universal quantifier, and A
is called the scope of the quantifier. The variable x is said to
be bound by the quantifier. The symbol ∀ is pronounced “for
all”.
20
Universal quantifiers contd.
21
Existential quantifier
Definition
Let A represent a formula, and let x represent a variable. If
we want to indicate that A is true for at least one value x, we
write ∃xA. This statement is pronounced “There exists an x
such that A.” Here, ∃x is called the existential quantifier,
and A is called the scope of the quantifier. The variable x is
said to be bound by the quantifier.
22
Comments 1
23
Comments 2
24
Comments 3
25
Bound and free variables
26
• Instantiation only affects free variables. Specifically, if A is a
formula, StxA only affects the free occurrences of the
variable x in A.
For instance, Syx∀xP (x) is still ∀xP (x); that is, the variable
x is not instantiated.
However, Syx(Q(x) ∧ ∀xP (x)) yields Q(y) ∧ ∀xP (x).
• Hence, instantiation treats the variable x differently, depending
on whether it is free or bound, even if this variable appears
twice in the same expression.
• Obviously, two things are only identical if they are treated
identically. This implies that, if a variable appears both free
and bound within the same formula, we have in fact two
different variables that happen to have the same name.
27
Comments
28
• For similar reasons there are restrictions to instantiation. For
example, the instantiation Sxy (∃xM (x, y)) is illegal because
it results in ∃xM (x, x). In such cases, one tampers with the
way in which a variable is defined, and this has undesired
side effects.
• We will refer to instances in which a variable becomes bound,
or otherwise changes scope, as variable clashes.
• All variable chashes must be avoided.
29
Restrictions of quantifiers
30
• Consider now the statement “Some dogs are brown”. This
means that there are some animals that are dogs and that
are brown. Of course, the statement “x is a dog and x is
brown” can be translated as
dog(x) ∧ brown(x).
• The statement
∃x(P (x) ∧ Q(x))
can in general be interpreted as “Some individuals with
property P have also property Q.”
31
• Note that if the universal quantifier is to apply only to
individuals with a given property, we use the conditional to
restrict the domain.
• If we similarly want to restrict application of the existential
quantifier, we use the conjunction.
• Consider statements containing the word “only” such as “only
dogs bark”. To convert this into predicate calculus, this
must be reworded as “It barks only if it is a dog” or,
equivalently “If it barks, then is is a dog”. One has therefore
∀x( barks(x) → dog(x)).
32