0% found this document useful (0 votes)
148 views

Logic Chapter04 Predicate Logic

The document discusses predicate language and quantification. It covers: 1) The need for rich programming languages and the basic components and definitions of a programming language. 2) Logical quantification constructs like universal and existential quantification that are used to express statements about predicates. 3) Notation for quantifiers like "∀" for universal quantification meaning "for all" and "∃" for existential quantification meaning "there exists".

Uploaded by

hamzaadem
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views

Logic Chapter04 Predicate Logic

The document discusses predicate language and quantification. It covers: 1) The need for rich programming languages and the basic components and definitions of a programming language. 2) Logical quantification constructs like universal and existential quantification that are used to express statements about predicates. 3) Notation for quantifiers like "∀" for universal quantification meaning "for all" and "∃" for existential quantification meaning "there exists".

Uploaded by

hamzaadem
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Chapter 04- Predicate Language

4.1. The need of Rich language

A programming language is a formal constructed language designed to communicate


instructions to a machine, particularly a computer. Programming languages can be used to create
programs to control the behavior of a machine or to express algorithms.

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.

A programming language is a notation for writing programs, which are specifications of a


computation or algorithm. Some, but not all, authors restrict the term "programming language" to
those languages that can express all possible algorithms. Traits often considered important for
what constitutes a programming language include:

Function and target


A computer programming language is a language used to write computer programs,
which involve a computer performing some kind of computation or algorithm and
possibly control external devices such as printers, disk drives, robots, and so on. For
example, PostScript programs are frequently created by another program to control a
computer printer or display. More generally, a programming language may describe
computation on some, possibly abstract, machine. It is generally accepted that a complete
specification for a programming language includes a description, possibly idealized, of a
machine or processor for that language. In most practical contexts, a programming
language involves a computer; consequently, programming languages are usually defined
and studied this way.[8] Programming languages differ from natural languages in that
natural languages are only used for interaction between people, while programming
languages also allow humans to communicate instructions to machines.

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.

Another usage regards programming languages as theoretical constructs for programming


abstract machines, and computer languages as the subset thereof that runs on physical computers,
which have finite hardware resources. John C. Reynolds emphasizes that formal specification
languages are just as much programming languages as are the languages intended for execution.
He also argues that textual and even graphical input formats that affect the behavior of a
computer are programming languages, despite the fact they are commonly not Turing-complete,
and remarks that ignorance of programming language concepts is the reason for many flaws in
input formats.

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".

An example of translating a quantified English statement would be as follows. Given the


statement, "Each of Peter's friends either likes to dance or likes to go to the beach", we can
identify key aspects and rewrite using symbols including quantifiers. So, let X be the set of all
Peter's friends, P(x) the predicate "x likes to dance", and lastly Q(x) the predicate "x likes to go to
the beach". Then the above sentence can be written in formal notation as, which is read, "for
every x that is a member of X, P applies to x or Q applies to x."

Universal Quantification

"∀" redirects here. For similar symbols, see Turned A.

In predicate logic, a universal quantification is a type of quantifier, a logical constant which is


interpreted as "given any" or "for all". It expresses that a propositional function can be satisfied
by every member of a domain of discourse. In other words, it is the predication of a property or
relation to every member of the domain. It asserts that a predicate within the scope of a universal
quantifier is true of every value of a predicate variable.

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

∀xP(x) which can be read “for all x”

If the universe of discourse is finite, say {n1, n2, . . . , nk}, then the universal quantifier is simply
the conjunction of all elements:

∀xP(x) P(n1) ^ P(n2) ^ · · · ^ P(nk)

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”.

∀x(Q(x) --- P(x))

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.

"∃" redirects here. It is not to be confused with Ǝ.

In predicate logic, an existential quantification is a type of quantifier, a logical constant which


is interpreted as "there exists", "there is at least one", or "for some". Some sources use the term
existentialization to refer to existential quantification. It is usually denoted by the turned E (∃)
logical operator symbol, which, when used together with a predicate variable, is called an
existential quantifier ("∃x" or "∃(x)"). Existential quantification is distinct from universal
quantification ("for all"), which asserts that the property or relation holds for all members of the
domain.

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

Express the commutative law of addition for R.Mixing Quantifiers

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?

4.4. Predicate Logic as Formal Language

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.

 These properties or relations are referred to as predicates.


7
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.
 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.
A predicate name, followed by an argument list in parantheses is called an atomic
formula .
 The atomic formulas can be combined by logical connectives like propositions.
 For instance, if cat(Tom) and hastail(Tom) are two atomic formulas, expressing that Tom
is a cat and that Tom has a tail respectively, one can form cat(Tom)  hastail(Tom):

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.

When a quantifier is used on a variable x, we say that x is bound. If no quantifier is used on a


variable in a predicate statement, it is called free.

In the expression ∃x∀y P(x, y) both x and y are bound.


In the expression ∀x P(x, y), x is bound, but y is free.

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.

Example: Find the free variables in


∀z (P(z) ^ Q(x)) v ∃y Q(y):
Solution: Only one variable x is free. All occurrences of z are bound, and so are all occurrences
of the variable y.
-Note that the status of a variable changes as formulas are divided into subformulas.
-For instance, in ∀x P(x), x occurs twice and it is bound both times.
-Nevertheless, in P(x) the variable x is free.

4.6. Validity- A formula is logically valid if it is true in every interpretation. In logic, an


argument is valid if and only if it takes a form that makes it impossible for the premises to be
true and the conclusion nevertheless to be false.[1] It is not required that a valid argument have
premises that are actually true,[2] but to have premises that, if they were true, would guarantee the
truth of the argument's conclusion. A formula is valid if and only if it is true under every
interpretation, and an argument form (or schema) is valid if and only if every argument of that
logical form is valid.

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.

An argument that is not valid is said to be "invalid".

An example of a valid argument is given by the following well-known syllogism:


9
All men are mortal.

Socrates is a man.

Therefore, Socrates is mortal.

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:

All cups are green.

Socrates is a cup.

Therefore, Socrates is green.

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:

All men are immortal.

Socrates is a man.

Therefore, Socrates is mortal.

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.

Similarly, the third argument becomes:

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

-It is assignment of meaning to the symbols of a formal language.

- 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.

For interpretation (I) of language L.

F(x) – x is a piece
G(x) – x is a power
H(x)- x is a black.

11

You might also like