Welcome to the MOOC on discrete mathematics,
this is the third lecture on mathematical
logic. In the previous lecture, we talked
about propositional logic. In propositional
logic, we have propositions and truth values
to propositions. We saw, how propositions
can be combined to form larger composite propositions
and how the truth values of the component
propositions will combine to form the truth
values of the larger propositions.
But not every logical statement can be captured
using the apparatus of propositional calculus
there are some arguments for which propositional
calculus are not adequate.
For example, consider the statement of this
form, all men are mortal, Socrates is a man,
so Socrates is mortal. In this statement,
we form the conclusion from the first two
propositions. So, if we call these propositions,
let us say this is proposition p and this
is proposition q whether proposition p and
q are true or false will not help us in forming
the third conclusion. So, even if we assume
that the first two propositions are true,
there is no way we can conclude that the third
proposition is true using the apparatus of
propositional calculus that is because the
statements include predication and quantifiers.
So, let us see what we mean by this.
In the statement, all men are mortal, men
form the subject of the sentence and are mortal
form a predicate or a sub quantifier.
In general, when we have a sentence of the
form, 4 greater than 3, we can say that 4
is the subject of the statement and greater
than 3 is the predicate of the statement,
from this statement we can abstract the subject
away and write in this form, I use a variable
for the subject and we say that x is greater
than three. Let us say, we denote this symbolically
in this manner, suppose P of x denotes x greater
than 3, we might want to abstract away the
other constant 3 as well.
So, if you abstract that away too then we
will have two variables then we will have
a sentence of the form x greater than y where
both x and y are unknown, we could denote
this as R of x y. So, now we have two predicates
P of x which says that x greater than 3 and
R of x y which greater than, which says that
x greater than y. If you substitute constants
for the variables in these predicates, in
these formulae by substituting 4 for x, we
have P 4 which is 4 greater than 3, this is
correct.
On the other hand if you substitute 2 for
x, we have 2 greater than 3 which is false.
If you substitute 5 for x we have 5 greater
than 3 which is true. So, depending on the
value that you substitute for x here, P of
x may be true or false. Similarly, in the
case of R of x y you can substitute various
values for x and y, you can substitute 3 and
4 which then would say 3 greater than 4 which
is false, if you substitute 4 and 3 you will
have 4 greater than 3 which is true, if you
have 7 and 4 you will have 7 greater than
3 which is true and so on.
So, now we have a way of abstracting individuals
away and replacing them with variables.
Now, let me introduce what are called quantifiers.
The first quantifier is the universal quantifier.
A universal quantifier stands for the expression
for all, for example, when we say for all
x P x what we mean is that? For every x, P
x is true.
The other quantifier is the existential quantifier.
Using an existential quantifier, when we say
that when we write a formula of this sort
here, this is supposed to stand for there
exists, what we essentially say is that, there
exists an x such that P of x is true. So,
P x is a predicate with an argument supplied
x is the argument here, so that will take
on a truth value as we have seen before.
So, this statement is supposed to say that
the there exists an x such that P of x is
true.
Now, in these statements, we say for all x
or there exists an x such that some predicate
is satisfied or here for all x, so that some
predicate Q x is satisfied but then what do
we mean by for all x? What kind of x do we
talk about here? And here there exists an
x where this question is not clear when we
say for all x or there exists an x. Now, these
quantified statements happen in a context,
in a discourse, these happen in a context
in a discourse.
So, from the context of the discourse it should
be clear, what is the domain of the discourse?
The domain of the discourse is the set of
elements about which we are conversing at
the moment for example, we could be talking
about natural numbers 
or we could be talking about people. Depending
on the domain of discourse, the statement
that we say might make sense.
For example, when we say for all x, x is odd
or x is even makes sense if the domain of
discourse D is the set of all natural numbers,
every natural number is either odd or even
you can classify natural numbers as odd or
even or D could be a proper subset of N, so
in these context the statement x is odd or
x is even makes sense because is odd or is
even predicates do apply to natural numbers.
But if you are talking about people, these
statements need not make sense, to make sense
of these statements we will have to interpret
the predicates is odd and is even in a manner
which is appropriate to the members of the
domain of discourse. So, if domain of discourse
is the set of all people then these will have
to be interpreted appropriately in terms of
the people for this statement to make sense.
So, for a first orders statement to make sense,
we will have to first fix the domain of discourse.
So, we assume that in the context in which
our conversation is happening the domain of
discourse is fixed and in that context we
quantify.
Similarly, when we say there exists an x such
that x is prime, if the domain of discourse
is the set of natural numbers then what do
we assert? We assert that there is a natural
number 
x which is prime, so once the domain of discourse
is fixed and the predicate is prime as understood
then the sentence makes sense then you can
assert whether the statement is true or false.
Sometimes, we want to make restrictions on
the domain of discourse. Suppose, D is the
domain of discourse and let us say we want
to make restrictions. So, let us assume the
D is the set of all natural numbers and let
us say we have a statement of this form, for
every x greater than 11, P of x that if we
want to assert that the predicate P of x is
true for every x which is greater than 11.
How would we write this in 
our logic using the quantifiers? You have
to write this way, there exists an x, so that
when x is greater than 11, if x is greater
than 11 then P of x is true this is the correct
representation of this statement, this cannot
be paraphrased as this is an often made mistake
people often write this way. The second statement,
says that (there exists) the for every x,
x is greater than 11 and P of x this would
be true if and only if every x is greater
than 11 and for every x, P x is true that
is not what we intend to say, what we intend
to say is that for every x which is greater
than 11 P of x is true, these two are not
the same at all but these two you can see
are the same.
So, this is the correct paraphrasing of the
sentence, the quantified sentence for every
x greater than 11 P of x.
And then you can make an assertion of the
sort there exists an x such that x greater
than 11 and P of x then we would write this
as there is an x greater than 11 such that
P of x is what we want to say and we would
write it in this way, you should remember
that here x greater than 11 implies P x will
not do, that is because this says that there
is an x such that either x is less than or
equal to 11 or P of x, what we assert is that
x greater than 11 implies P of x.
So, from what we saw in the last lecture,
we know that alpha implies beta is logically
equivalent to negation of alpha or beta therefore
x greater than 11 implies P x would paraphrase
as x less than or equal to 11 or P x but these
two statements are not the same at all. Therefore,
this is the correct representation of the
top statement.
So, we can write statements of this sort using
quantifiers, so the extension of propositional
calculus. In propositional calculus, we have
propositions these are the syntax entities
and composite propositions which are made
from atomic propositions and the truth values
which are the semantic entities. So, these
are what we deal with in propositional calculus
but when we come to this logic which we called
first order logic, recall propositional calculus
is also called 0th order logic as supposed
to that here we have first order logic which
is also called predicate logic.
So, when we extend a propositional calculus
to first order logic or predicate logic we
have variables, variables are akin to pronouns
in English. Constants, constants are similar
to proper nouns in English. Function symbols,
function symbols are used to create entities
which can be used as names of objects, for
example, father of Neeraj, this is a naming
mechanism father of is a function which is
applied to the constant Neeraj to create the
phrase father of Neeraj, so this phrase is
a naming phrase.
So, we can have function symbols that serve
this purpose and we have predicate symbols
and we have quantifiers for all in the there
exists and we have all the apparatus of propositional
calculus for example, the logical connectives,
AND, OR, NOT, etcetera implication and what
not. So, the apparatus of propositional calculus
are still with us along with these additions.
So, this richer logic is called the first
order logic or predicate logic.
Quantifiers take higher precedence 
than connectives. In the last lecture we discussed,
precedence of connectives, we saw that negation
has the highest precedence and double implication
has the least presidents but quantifiers take
a precedence which is higher than that of
all the connectives including negation. Therefore,
a statement of the form for all x P x or Q
x should be interpreted as 
for all x P x or Q x that is for all x applies
only on P x not on Q x.
This is as supposed to for all x P x or Q
x that is the scope of a quantifier is the
immediately adjacent predicate unless otherwise
specified using parentheses.
Consider the formula x greater than 3, here
we say that x is greater than 3 but what is
x? x is a variable. So, when you look at this
formula, we do not know what x is, so x is
to be inferred from the context, so in that
sense x is like a pronoun in English. We say
that x is free in the statement x greater
than 3, the occurrence of x is free in x greater
than 3. As supposed to this when we say for
all x x greater than 3, of course the statement
would be false if we are talking about natural
numbers but never mind we are not talking
about the truth value of the statement.
Look at the statement, the form of this statement,
in the statement we say for all x x greater
than 3, so in this statement x has a bound
occurrence, this occurrence of x is bound
to this quantifier. So, variables can have
a free and bound occurrences, it is also possible
to mix free and bound occurrences within the
same statement.
For example, when I have a statement of this
form x less than 100 and for all x x greater
than 3 this occurrence of x is bound to the
x in the quantifier, so this is a bound occurrence
of x. Whereas, this is a free occurrence,
so this x is talking about some individual
which is known only from the context, so it
is rather like a pronoun whereas this second
x is bound to the x in the quantifier, so
that does not depend on the context.
This is similar to a statement of the form,
the tigress is free that is one sentence that
provides a context and let us say, in the
second (state) the sentence we have, she is
coming here and now it is everyone for herself.
So, consider the second sentence, in this
sentence the pronoun she occurs in two places
that is similar to x in the statement x less
than hundred and for all x x greater than
3.
The first she is a free occurrence of the
pronoun, the meaning of this she has to be
inferred from the context now what is the
context? In the context, the previous sentence
says that the tigress is free, therefore this
she refers to this tigress but the she in
herself is a bound occurrence, it is bound
to everyone, so we have a group of women facing
the tiger, so this quantification is over
this group of women facing the tiger, so everyone
refers to the individuals within this group,
so the she in herself is bound to this occurrence
of x.
Consider the statement, for all x P of x,
so as we said before this says that for all
x in the domain of discourse D, P of x is
true. Suppose we want to negate this, then
we want to say that this is not the case,
suppose we want to negate this, we want to
say that it is not the case that for every
x P of x is true then clearly somebody violates
P of x that is if you go to every individual
belonging to the set D we would (sign) find
that P of x is not satisfied by everybody.
So, there is somebody who does not satisfy
P of x. In other words, some x belonging to
D does not satisfy the predicate P or in other
words, there exists an x within D, so that
P of x is not satisfied. So, we find that
these two statements are equivalent there
is a negation of for all x P x is the same
as there exists an x NOT of P x, of course
parenthesizing correctly, we will use this
convention of parentheses, you will find in
literature that there are different ways of
parenthesizing quantified statements, we will
always use this notation.
A quantifier will be immediately followed
by a parenthesized statement, the scope of
the quantifier will be defined by the parentheses,
if such a parentheses parenthesization is
not done then for all x will associate to
the nearest relegate, it has the highest precedence
as we said before.
Similarly, let us try to negate this statement
there exists an x so that P of x, let us say
we want to negate this. So, what this asserts
is that there does not exist 
an x in D, so that P of x is true or in other
words if you go to the individual members
of D, we will find that P of x is violated
by every x in D or in other words for all
x 
P of x is violated.
So, these two equivalences, you can avoid
these parentheses and simplify the expression
it says that, there exists x so that P of
x is violated if it is not the case that P
of x is true for everybody then there must
be some x for which P of x is violated. Analogously,
if there does not exist an x, so that P of
x is true then for every x P of x must be
false, these two are called De Morgan’s
laws for the first order logic.
Let us try a few examples, paraphrasing sentences
in English into sentences in first order logic.
These examples are from the textbook of Mendelssohn,
anyone who is persistent can learn logic.
We want to translate this sentence in English
into a first order formula. So, let us consider
the predicates here, is persistent is one
predicate, can learn logic is another predicate,
so we can have P of x stand for x is persistent,
we can have C of x stand for x can learn logic
then what we essentially assert is that any
person who is persistent is capable of learning
logic.
In other words, for every x when x is a person
that is our domain of discourse is a set of
people, for every x where x belongs to D that
is understood, the domain of discourse is
understood, for every x if x is persistent
then x can learn logic, this would be the
first order representation of the sentence.
Consider another statement, no politician
is honest, a debatable statement but there
we have it. Let us consider the compliment
of this statement, the compliment of this
statement would say that some politician is
honest, some politicians are honest or in
other words there exists of politician who
is honest. So, let us say there exists an
x in D, the domain of discourse is the set
of people here again.
So, there exists an x, so that x is a politician
so in this case P stands for the predicate
is politician, so P x means x is a politician
and honest x. so, we have the statement there
is some x who is both a politician and honest
that would be a negation of this statement.
Now, what we want here is to negate this,
no politician is honest. So, here we have
a negation of quantified statement then we
can apply De Morgan’s laws to take the negation
inside.
So, from the De Morgan’s laws, we know that
when negation is taken inside a quantified
formula it changes the quantifier for example,
when a negation travels over a universal quantifier
into the parentheses then the universal quantifier
changes into the existential quantifier, this
universal quantifier changes into an existential
quantifier when the negation travels inside
the brackets.
Similarly, when the negation travels over
an existential quantifier, inside the parentheses
it converts the existential quantifier into
a universal quantifier. So, let us use that
here and take the negation inside then this
becomes, for all x and we have the negation
of P x and H x, but the negation of P x and
H x can be found using the De Morgan’s laws
of first order logic which would be here we
have the negation of a conjunction, the negation
of a conjunction is the disjunction of the
negations.
So, we have negation of P of x or negation
of H of x which is logically equivalent to
saying this, so what does it say? For every
x if x is a politician then x is not honest,
x is dishonest. So, that is tantamount to
asserting that every politician is dishonest
which is logically equivalent to saying that
no politician is honest.
Similarly, consider the statement not all
birds can fly. Suppose, we want to say that
every bird can fly, then we would say for
every x if x is a bird then x can fly, here
B of x stands for x is a bird and F of x stands
for x can fly. So, the statement asserts that
every bird can fly, suppose we want to negate
this then we would have the required assertion
so that says that not all birds can fly.
Once again, if you take the negation inside
the brackets the quantifier flips, we have
there exists, then we have the negation of
the implication B of x implies F of x but
the negation of an implication is the conjunction
of the antecedent and the negation of the
consequent which means, we have B of x and
F of x, what does this say? There exists an
x, there is x such that bird of x and not
of F of x.
In other words, there is a bird that cannot
fly, you see that this is logically equivalent
to our original statement, not all birds can
fly.
Another interesting example, if anyone can
solve the problem, Lakshmi can. Let us say,
S of x denotes the predicate x can solve the
problem, so if anyone can solve the problem
translates into this quantified statements
there exists an x, so that x can solve the
problem, this asserts that someone can solve
the problem. Now, we have an implication if
anyone can solve the problem in other words,
if there is someone who can solve the problem
then Lakshmi can solve the problem.
Let small l denote the individual Lakshmi,
so the statement now asserts that if there
is some x that can solve the problem then
Lakshmi can solve the problem. So, this is
a translation of the given statement, let
us take the logical equivalents of this, the
logical equivalents of an implication would
be the negation of the antecedent and the
consequent. So, the negation of the antecedent
here would be for all x, not of S of x and
then or S l which by commutativity of or can
be written like this, which is logically equivalent
to saying this, that is because alpha implies
beta is logically equivalent to alpha bar
or beta, we are invoking that in the reverse
here.
So, what does this say? If Lakshmi cannot
solve the problem 
then no one can, which is exactly the first
assertion. The first assertion and the last
are logically equivalent.
One more example, nobody in the algebra class
is smarter than everyone in the logic class.
So, to paraphrase this we would write this
way, first let us assume that there is somebody
in the algebra class who is smarter than everyone
in the logic class. So, we would say there
exists an x, so that x is in the algebra class
and for all y, if y is in the logic class
then x is smarter than y.
So, what it asserts is that, there is some
x, who is in the algebra class and is smarter
than every y in the logic class, this is what
we want to negate. So, if you put a negation
symbol here, we are asserting that nobody
in the algebra class is smarter than everybody
in the logic class. So, this is the first
order translation of the above sentence given
in English. So, now that gives you an idea
as to how English sentences can be translated
into first other sentences.
We say that, two first order formulae, I have
not formally defined a formula yet which we
will do that later, at least now you know
you have an idea about what a first order
formula is. Considered two first order formulae,
two first order formulae are logically equivalent
if they evaluate to the same truth value 
irrespective of the interpretations, interpretations
of constants, function symbols, predicate
symbols, etcetera.
For example, by De Morgan’s laws as we saw
just now, negation of for all x P x is logically
equivalent to there exists x negation of P
x. Similarly, negation of there exists x P
x is logically equivalent to for all x negation
of P x. So, these are logical equivalences.
We can have quantifiers nested within one
another but then when universal quantifiers
and existential quantifiers are nested within
one another, the order in which we nest them
is significant. So, if our domain of discourse
is the set of natural numbers then what does
this statement say? It says that, for every
x there is once you fix the x, there is a
y such that y is x is additive inverse, when
x and y are added together we get 0 or y is
the negative of x.
In other words, we say every natural number
has an additive inverse or every integer,
we would of course be making the statement
correctly only if we are talking about integers,
that is the domain of discourse will have
to be the set of integers. Compare those two,
this statement if there exists a y, so that
for all x, x plus y equal to 0, what does
this say? It says that that there is a number,
there is an integer which upon addition with
x gives 0 for all x but this is patently false.
So, we see that the two statements mean entirely
different things. So, in a sequence of universal
quantifiers and existential quantifiers, if
you change the order the meaning of the statement
would change.
But that is not the case with a sequence of
universal quantifiers when we have an assertion
of this form for all x y P x y what we want
to assert is that for every ordered pair drawn
from the domain of discourse for every ordered
pair x y, P is true for x and y, this would
be exactly the same even if we change the
order of x and y, as you can verify. Therefore,
in a sequence of universal quantifiers we
can change the order of the quantifications.
Analogously there exists x, there exists y
P x y is logically equivalent to there exists
y, there exists an x P x y.
In a sequence of existential quantifiers too,
we can permute the order of the quantifications.
We say that a formula is logically valid 
if it is true irrespective of the interpretations
of the function symbols, predicate symbols,
constants, variables, etcetera. So, a (logical)
logically valid formula is akin to tautologies.
Tautologies is in the context of propositional
calculus, that is a formula which always evaluates
to true. A logically valid formula in first
order logic is similar, it always evaluates
to true irrespective of the interpretation
that you place on the various symbols of the
language.
For example, consider this statement for all
x P x implies Q x implies for all x P x implies
for all x Q x, I want to claim that this is
logically valid 
that is irrespective of the interpretation
that is placed on P and Q this statement will
always be true, how do we argue this? To argue
this, let us look at the structure of the
sentence, this is an implication. So, this
is the implication at the topmost level.
So, this implication has an antecedent and
a consequent, we want to assert that this
implication is always true. In an implication,
if the antecedent is false the statement anyway
evaluates to true, so we do not have to worry
about the situation where the antecedent is
false. So, let us consider only the case where
the antecedent is true. So, let us assume
that for all x P x implies Q x is true then
for the implication to be true the consequent
will have to be true that is when the antecedent
is true the consequent will have to be true
for the implication to be true.
Now, we want to show that the consequent is
true. Now, let us look at the consequent,
the consequent itself is an implication and
we want to claim that it is true. So, for
an implication to be true the antecedent has
to be true the antecedent has to be false
or the antecedent and the consequent both
have to be true. So, here again let us assume
that the antecedent of this implication is
true.
So, we make these two assumptions for all
x P x implies Q x is true and for all x P
x is true then consider any x belonging to
D, for this x we have that P x implies Q x
is true and P x is true, you can readily verify
that P x implies Q x and P x together ensures
that P x and Q x are both true or in particular
Q x is true. Therefore, this is true for every
single x, we have taken an arbitrary x and
D therefore we can assert that for all x Q
x there is an x here.
So, we have shown that for all x P x assuming
these two. Therefore, the formula has to be
logically valid that is in that implication
the antecedent and also the antecedent of
the consequent are both true and we show that
the consequent within that global consequent
is also true therefore the formula is true
always, that is irrespective of the interpretation
that you place on P and Q the formula will
be true.
So, this is an example of a logically valid
formula, but if you take the converse of the
formula that will not be true.
For example for all x P x implies for all
x Q x implies for all x P x implies Q x need
not be true, that will depend on the interpretation
for P and Q. Let us consider an interpretation
which will make this formula false, let us
say the domain of discourse is the set of
people, let us say P of x stands for x is
peaceful and Q of x stands for x is happy,
so what does this statement assert?
It asserts that if all are peaceful, all are
the implies that all are happy then for every
individual x if x is peaceful then x is happy
that need not be the case because even if
the antecedent is true, that is if all are
peaceful then peace will prevail within humanity
and that is sufficient for all to be happy,
still the consequent does not follow, what
does the consequent say? It says that for
every single individual, if that individual
is peaceful then he is happy, that may not
be the case because this individual might
be surrounded by quarrelsome people, so even
if he holds the peace the his neighbours may
not therefore he may not be happy.
Therefore, this is a counter example to establish
that this statement is not logically valid.
To prove that first order formula is logically
valid you have to argue in terms of all interpretations,
you have to show that this formula has to
be necessarily true in every single interpretation.
On the other hand, to prove that formula is
not logically valid all that you have to do
is to come up with a counter example, come
up with one particular interpretation in which
this formula will not be true.
So, in this case you have to come up with
a counter example in which P and Q are universal
properties but if P is a universal property
then Q is also an universal property, so you
have to assume that about the properties P
and Q but then it should still be the case,
it should still be the, be such that if P
is held only by one person then that person
need not satisfy Q. If you can find such an
interpretation then you have a counter example
and that is what we have just done.
So, that is it from this lecture, hope to
see you in the next, thank you.
