Logic Chapter04 Predicate Logic
Logic Chapter04 Predicate Logic
The earliest known programmable machine preceded the invention of the digital computer and is
the automatic flute player described in the 9th century by the brothers Musa in Baghdad, at the
time a major centre of knowledge. From the early 1800s, "programs" were used to direct the
behavior of machines such as Jacquard looms and player pianos. Thousands of different
programming languages have been created, mainly in the computer field, and many more still are
being created every year. Many programming languages require computation to be specified in
an imperative form (i.e., as a sequence of operations to perform), while other languages use other
forms of program specification such as the declarative form (i.e. the desired result is specified,
not how to achieve it).
The description of a programming language is usually split into the two components of syntax
(form) and semantics (meaning). Some languages are defined by a specification document (for
example, the C programming language is specified by an ISO Standard), while other languages
(such as Perl) have a dominant implementation that is treated as a reference. Some languages
have both, with the basic language defined by a standard and extensions taken from the dominant
implementation being common.
Abstractions
1
Programming languages usually contain abstractions for defining and manipulating data
structures or controlling the flow of execution. The practical necessity that a
programming language support adequate abstractions is expressed by the abstraction
principle; this principle is sometimes formulated as recommendation to the programmer
to make proper use of such abstractions.
Expressive power
The theory of computation classifies languages by the computations they are capable of
expressing. All Turing complete languages can implement the same set of algorithms.
ANSI/ISO SQL-92 and Charity are examples of languages that are not Turing complete,
yet often called programming languages.
Markup languages like XML, HTML or troff, which define structured data, are not usually
considered programming languages. Programming languages may, however, share the syntax
with markup languages if a computational semantics is defined. XSLT, for example, is a Turing
complete XML dialect. Moreover, LaTeX, which is mostly used for structuring documents, also
contains a Turing complete subset.
The term computer language is sometimes used interchangeably with programming language.
However, the usage of both terms varies among authors, including the exact scope of each. One
usage describes programming languages as a subset of computer languages. In this vein,
languages used in computing that have a different goal than expressing computer programs are
generically designated computer languages. For instance, markup languages are sometimes
referred to as computer languages to emphasize that they are not meant to be used for
programming.
4.2. Quantifiers
In logic, quantification is a construct that specifies the quantity of specimens in the domain of
discourse that satisfy an open formula.
For example, in arithmetic, it allows the expression of the statement that every natural number
has a successor. A language element which generates a quantification (such as "every") is called
a quantifier. The resulting expression is a quantified expression, it is said to be quantified over
the predicate (such as "the natural number x has a successor") whose free variable is bound by
the quantifier. In formal languages, quantification is a formula constructor that produces new
formulas from old ones. The semantics of the language specifies how the constructor is
interpreted. Two fundamental kinds of quantification in predicate logic are universal
2
quantification and existential quantification. The traditional symbol for the universal quantifier
"all" is "∀", a rotated letter "A", and for the existential quantifier "exists" is "∃", a rotated letter
"E". These quantifiers have been generalized beginning with the work of Mostowski and
Lindström.
Notation
The two most common quantifiers are the universal quantifier and the existential quantifier. The
traditional symbol for the universal quantifier is "∀", an rotated letter "A", which stands for "for
all" or "all". The corresponding symbol for the existential quantifier is "∃", a rotated letter "E",
which stands for "there exists" or "exists".
Universal Quantification
It is usually denoted by the turned A (∀) logical operator symbol, which, when used together
with a predicate variable, is called a universal quantifier ("∀x", "∀(x)", or sometimes by "(x)"
alone). Universal quantification is distinct from existential quantification ("there exists"), which
asserts that the property or relation holds only for at least one member of the domain.
The universal quantification of a predicate P(x) is the proposition “P(x) is true for all values of x
in the universe of discourse” We use the notation
If the universe of discourse is finite, say {n1, n2, . . . , nk}, then the universal quantifier is simply
the conjunction of all elements:
Example
3
Let P(x) be the predicate “x must take a discrete mathematics course” and let Q(x) be the
predicate “x is a computer science student”.
The universe of discourse for both P(x) and Q(x) is all UNL students.
Express the statement “Every computer science student must take a discrete mathematics
course”.
Express the statement “Everybody must take a discrete mathematics course or be a computer
science student”.
Let P(x) be the predicate “x must take a discrete mathematics course” and let Q(x) be the
predicate “x is a computer science student”.
The universe of discourse for both P(x) and Q(x) is all UNL students.
Express the statement “Every computer science student must take a discrete mathematics
course”.
∀x(Q(x) ! P(x))
Express the statement “Everybody must take a discrete mathematics course or be a computer
science student”.
Let P(x) be the predicate “x must take a discrete mathematics course” and let Q(x) be the
predicate “x is a computer science student”.
The universe of discourse for both P(x) and Q(x) is all UNL students.
Express the statement “Every computer science student must take a discrete mathematics
course”.
∀x(Q(x) --- P(x))
Express the statement “Everybody must take a discrete mathematics course or be a computer
science student”.
Example 2:
Express the statement “for every x and for every y, x+y > 10” Let P(x, y) be the statement x + y
> 10 where the universe of discourse for x, y is the set of integers.
Express the statement “for every x and for every y, x+y > 10” Let P(x, y) be the statement x + y
> 10 where the universe of discourse for x, y is the set of integers.
Answer:
∀x∀yP(x, y)
Express the statement “for every x and for every y, x+y > 10” Let P(x, y) be the statement x + y
> 10 where the universe of discourse for x, y is the set of integers.
Answer:
∀x ∀y P(x, y)
Note that we can also use the shorthand
∀x, yP (x, y)
4
Existential Quantification
"Existential quantifier" redirects here. For the symbol conventionally used for this quantifier, see
Turned E.
The existential quantification of a predicate P(x) is the proposition “There exists an x in the
universe of discourse such that P(x) is true.” We use the notation
∃xP(x)
which can be read “there exists an x”
Again, if the universe of discourse is finite, {n1, n2, . . . , nk}, then the existential quantifier is
simply the disjunction of all elements:
∀xP(x) P(n1) v P(n2) v · · · v P(nk)
Example-1
Let P(x, y) denote the statement, “x + y = 5”. What does the expression, ∃x∃yP(x) mean?
What universe(s) of discourse make it true?
Mixing Quantifiers
Existential and universal quantifiers can be used together to quantify a predicate statement; for
example,
∀x ∃y P(x, y)
is perfectly valid. However, you must be careful it must be read left to right.
For example, ∀x∃y P(x, y) is not equivalent to ∃y ∀x P (x, y).
Thus, ordering is important.
Example
∀x∃yLoves(x, y): everybody loves somebody ∃y∀xLoves(x, y): There is someone loved by
everyone Those expressions do not mean the same thing!
Note that ∃y∀xP(x, y) ! ∀x∃yP(x, y), but the converse does not hold.
However, you can commute similar quantifiers; ∃x∃y P(x, y) is equivalent to ∃y∃x P(x, y)
(which is why our shorthand was valid).
5
Example P
redic
Express, in predicate logic, the statement that there are an infinite number of integers.
Let P(x, y) be the statement that x < y. Let the universe of discourse be the integers, Z.ate
Logic and
Quantifiers
CSE235
Express, in predicate logic, the statement that there are an infinite number of integers.
Let P(x, y) be the statement that x < y. Let the universe of discourse be the integers, Z.
Then the statement can be expressed by the following.
∀x∃yP(x, y)
Example=2
We want to express that for every pair of reals, x, y the following identity holds:
x+y=y+x
We want to express that for every pair of reals, x, y the following identity holds:
x+y=y+x
Then we have the following:
∀x∀y(x + y = y + x)
Exercise
1) Express the statement “there is a number x such that when it is added to any number, the
result is that number, and if it is multiplied by any number, the result is x” as a logical
expression.
Solution:
Let P(x, y) be the expression “x + y = y”.
2) Express the statement “there is a number x such that when it is added to any number, the
result is that number, and if it is multiplied by any number, the result is x” as a logical
expression.
Solution:
Let P(x, y) be the expression “x + y = y”.
Let Q(x, y) be the expression “xy = x”.
3) Express the statement “there is a number x such that when it is added to any number, the
result is that number, and if it is multiplied by any number, the result is x” as a logical
expression.
Solution:
Let P(x, y) be the expression “x + y = y”.
Let Q(x, y) be the expression “xy = x”.
Then the expression is
∃x∀y (P(x, y) ^ Q(x, y))
6
4) Express the statement “there is a number x such that when it is added to any number, the
result is that number, and if it is multiplied by any number, the result is x” as a logical
expression.
Solution:
Let P(x, y) be the expression “x + y = y”.
Let Q(x, y) be the expression “xy = x”.
Then the expression is
∃x∀y (P(x, y) ^ Q(x, y))
Over what universe(s) of discourse does this statement hold?
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 sometime true.
Example: In All cats have tails, the word all indicates that the statement cats have tails is
universally true.
Example.
1. Jane is Paul's mother.
2. Jane is Mary's mother.
3. Any two persons having the same mother are siblings.
4. Paul and Mary are siblings.
The truth of the statement \Jane is Paul's mother" can only be assessed within a certain context.
There are many people named Jane and Paul, and without further information the statement in
question can refer to many di_erent people, which makes it ambiguous.
To prevent such ambiguities we introduce the concept of a domain or universe of discourse.
Generally, predicates make statements about individuals:
Mary and Paul are siblings.
Jane is the mother of Mary.
Tom is a cat.
The sum of 2 and 3 is 5.
In each of these statements, there is a list of individuals, which is given by the argument
list, together with phrases that describe certain relations among or properties of the
individuals mentioned in the argument list.
4.5. Variable
Often one does not want to associate the arguments of an atomic formula with a particular
individual. To avoid this, variables are used.
- Variables are frequently chosen from the end of the alphabet; that is x; y and z, with or
without subscripts, suggest variable names.
-
Examples:
cat(x) hastail(x)
dog(y) ^ brown(y)
grade(x) (x >= 0) ^ (x <= 100)
- Clearly, the _rst and third formulas contain the variable x, and the second the variable y.
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).
8
If A is a formula, one often has to replace all occurrences of a particular variable by a term.
A statement is called a well-formed formula, when all variables are properly quantified.
The set of all variables bound by a common quantifier is the scope of that quantifier.
In the expression ∃x, y∀z P(x, y, z, c) the scope of the existential quantifier is {x, y}, the scope
of the universal quantifier is just z and c has no scope since it is free. The variable appearing in
the quantifier is said to be
bound.
- For instance, in the expression ∀x(P(x) Q(x)), the variable x appears three times and each
time x is a bound variable.
- Any variable that is not bound is said to be free.
- Later we will see that the same variable can occur both bound and free in a formula. For this
reason it is also important to indicate the position of the variable in question.
An argument is valid if and only if the truth of its premises entails the truth of its conclusion and
each step, sub-argument, or logical operation in the argument is valid. Under such conditions it
would be self-contradictory to affirm the premises and deny the conclusion. The corresponding
conditional of a valid argument is a logical truth and the negation of its corresponding
conditional is a contradiction. The conclusion is a logical consequence of its premises.
Socrates is a man.
What makes this a valid argument is not that it has true premises and a true conclusion, but the
logical necessity of the conclusion, given the two premises. The argument would be just as valid
were the premises and conclusion false. The following argument is of the same logical form but
with false premises and a false conclusion, and it is equally valid:
Socrates is a cup.
No matter how the universe might be constructed, it could never be the case that these arguments
should turn out to have simultaneously true premises but a false conclusion. The above
arguments may be contrasted with the following invalid one:
Socrates is a man.
In this case, the conclusion contradicts the deductive logic of the preceding premises, rather than
deriving from it. Therefore, the argument is logically 'invalid', even though the conclusion could
be considered 'true' in general terms. The premise 'All men are immortal' would likewise be
deemed false outside of the framework of classical logic. However, within that system 'true' and
'false' essentially function more like mathematical states such as binary 1s and 0s than the
philosophical concepts normally associated with those terms.
A standard view is that whether an argument is valid is a matter of the argument's logical form.
Many techniques are employed by logicians to represent an argument's logical form. A simple
example, applied to two of the above illustrations, is the following: Let the letters 'P', 'Q', and 'S'
stand, respectively, for the set of men, the set of mortals, and Socrates. Using these symbols, the
first argument may be abbreviated as:
All P are Q.
S is a P.
Therefore, S is a Q.
10
All P are not Q.
S is a P.
Therefore, S is a Q.
An argument is termed formally valid if it has structural self-consistency, i.e. if when the
operands between premises are all true the derived conclusion is always also true. In the third
example, the initial premises cannot logically result in the conclusion and is therefore
categorized as an invalid argument.
4.7. Translation
- The standard kind of interpretation in this setting is a function that maps each propostional
symbol to one of the truth values true and false.
- The interpretation provide enough information to give a truth value to an atomic formula after
each of its variable.
F(x) – x is a piece
G(x) – x is a power
H(x)- x is a black.
11