UNIT-1 Logic and Proof Methods New1
UNIT-1 Logic and Proof Methods New1
Introduction: Logic is concerned with the study of the principles and techniques of reasoning. It is the
study of correct reasoning, especially as it involves the drawing of inferences. The Greek philosopher and
scientist Aristotle is said to the first person to have studied logical reasoning. Logical reasoning is the
essence of mathematics and is therefore an important starting point for study of discrete mathematics.
Logic, among other things, have provided the theoretical basis for many years of computer science such
as digital logic design, automata theory, computability and artificial intelligence.
The rules of logic give precise meaning to mathematical statements. These rules are used to distinguish
between valid and invalid mathematical arguments.
In logic, on the basis of its representation capability is of two types: propositional Logic and predicate
logic
Proposition: A proposition is a declarative sentence (that is, a sentence that declares a fact) that is either
true or false but not both.
Any proposition whose truth value does not depend on another proposition is called simple proposition
Compound propositions are formed from simpler propositions and express relationships among the
constituent sentences. There are six types of compound propositions are: negation, conjunctions,
disjunctions, implications, biconditional and equivalences
Negation: Let p be a proposition. The negation of p, denoted by ¬p is the statement “It is not case that
p”.
The proposition –p is read as “not p”. The truth value of the negation of p, ¬p is the opposite of the truth
value of p.
1
“Today is not Friday”
Example 2: Find the negation of the proposition “ At least 10 inches of rain fell today in Kathamndu”
and express this in simple English.
Solution: It is not the case that at least 10 inches of rain fell today in Kathmandu”.
P -p
T F
F T
Conjunction: Let p and q be propositions. The conjunction of p and q, denoted by p^q, is the proposition
“ p and q”. The conjunction of p^q is true when both p and q are true and is false otherwise.
P Q P^q
T T T
T F F
F T F
F F F
Example: Find the conjunction of the propositions p and q where p is the proposition “Today is Friday”
and q is the proposition “It is raining today”
Solution: The conjunction of these propositions, p^q, is the proposition “Today is Friday and it is raining
today”. This proposition is true on rainy Friday and is false on any day that is not Friday and on Fridays
when it does not rain.
Disjunction: Let p and q be propositions. The disjunction of p and q, denoted by pvq, is the proposition
“p or q”. The disjunction p v q is false when both p and q are false and is true otherwise.
A disjunction is true when at least one of the two propositions is true. For instance, the inclusive or is
being used in the statement.
“Students who have taken calculus or computer science can take this class”
2
Here, we mean that students who have taken both calculus and computer science can take the class, as
well as the students who have taken one of the two subjects.
Example: Find the disjunction of the propositions p and q where p is the proposition “Today is Friday”
and q is the proposition “It is raining today”.
This proposition is true on any day that is either a Friday or a rainy day or rainy Fridays. It is only false
on days that are not Fridays when it also does not rain
P q Pvq
T T T
F T T
T F T
F F F
Conditional Statements
Let p and q be propositions. The conditional statement p→q is the propositions “if p, then q.” The
conditional statement p→q is false when p is true and q is false, and true otherwise. In the conditional
statement p→q, p is called the hypothesis and q is called conclusion or consequence.
The statement p→q is called a conditional statement because p→q asserts that q is true on the condition
that p holds. A conditional statement is also called an implication.
p→q is true when both p and q are true and when p is false (no matter what truth value q has)
A useful way to understand the truth value of a conditional statement is to think of an obligation or a
contract. For example, the pledge many politicians make when running for office is
If the politician is elected, voters would expect this politician to lower taxes. Furthermore, if the politician
is not elected then voters will not have expectation that this person will lower taxes, although the person
may have sufficient influences to cause those in power to lower taxes. It is only when the politician is
elected but does not lower taxes that voters can say the politician has broken the campaign pledge. This
last scenario corresponds to the case when p is true but q is false in p→q.
3
“If you get 100% on the final, then you will get an A”.
If you manage to get a 100% on the final, then you would expect to receive an A. If you do not get 100 %
you may or may not receive an A depending other factors. However, if you do get 100%, but the
professor does not give you an A, you will be cheated.
Example: Let p be a statement “Maria learns discrete mathematics” and q the statement “Maria will find
a good job”. Express the statement p→q as a statement in English.
Solution: From the definition of conditional statements, we see that when p is the statement “Maria learns
discrete mathematics” and q is the statement “Maria will find a good job”, p→q represents the statement
“If Maria learns discrete mathematics then she will find a good job”.
P Q p→q
T T T
T F F
F T T
F F T
Inverse of Implication: When we add “not” to the hypothesis and conclusion of implication p→q then it
becomes ¬p →¬q, which is known as inverse of p→q
Example
Implication Inverse
p→q ¬p→¬q
If it is raining then the road is muddy If it not raining then the road is not muddy
Converse of Implication
When we interchange the hypothesis and conclusion of implication p→q then the result becomes q→p
which is known as converse of given implication.
Implication Converse
p→q q→p
If it is raining then the road is muddy If the road is muddy then it is raining
Contra positive of Implication
When we interchange the hypothesis and conclusion of inverse statement of implication p→q then the
resulting statement ¬q→¬p is known as contra positive.
4
Implication Contra positive
p→q ¬q→¬p
If it is raining then the road is muddy If the road is not muddy then it is not raining
Bi-Conditional Statements
Let p and q be the propositions. The bi-conditional statements p↔q is the proposition “ p if and only if
q”. The bi-conditional statement ↔ is true when p and q have the same truth values and is false otherwise.
Bi-conditional statements are also called bi-implications.
P q p↔q
F F T
F T F
T F F
T T T
Example: Let p be the statement “You can take the flight” and let q be the statement “ You buy a ticket”.
Then p↔q is the statement
“You can take the flight if and only if you buy a ticket”
This statement is true if p and q are either true or both false, that is, if you buy a ticket and can take the
flight or if you do not buy a ticket and you cannot take the flight. It is false when p and q have opposite
truth values, that is, when you do not buy a ticket but you can take the flight (such as when you get a free
trip) and when you buy a ticket and cannot take the flight (such as when the airline bumps you)
There are many reasons to translate English sentences into expressions involving propositional variables
and logical connectives. In particular, English and every other human language is often ambiguous.
Translating sentences into compound statements removes the ambiguity. Moreover, once we have
translated sentences from English into logical expressions we can analyze these logical expressions to
determine their truth values, we can manipulate them and we can use rules of inference to reason about
them
5
The process of translating English sentences into logical expression consists of following steps
1. First we break down the given complex English sentences into atomic sentences
2. We represent each atomic sentence by propositional variables
3. Now each atomic sentence is connected with appropriate connectives
Solution:
• It is raining
• Home team wins the game
p = "It is raining"
Let: p: It is raining
q: Sita is sick
Translating Conjunction
Translating Disjunction
i. Kathmandu is capital of Nepal and its is not raining or Ashok is a loud mouth: (t^p)vu
ii. Sita is not sick or Sita is sick: qvq
iii. Ram stayed up at last night or Kathmandu is not capital of Nepal (rvt)
Translating Implication
6
i. If it is raining then Sita is sick :p→q
ii. It is raining when Ashok is a loudmouth :u→p
iii. Sita is sick and it is raining implies that Ram stayed up late last night : (q^p)→r
Translating Biconditional
“You can access the Internet from campus only if you are a computer science major or you are not a
freshman”.
Let a, c and f represent “You can access the Internet from campus”, “You are a computer science major”
and “You are a freshman” respectively.
a→(c v ¬f)
Tautology: A compound proposition that is always true, no matter what the truth values of the
propositions that occur in it, is called a tautology.
Solution: We can verify this statement with the help of truth table as follows:
P ¬P p v ¬p
T F T
F T T
Solution: We can verify this statement with the help of truth table as follows:
P ¬P P ^ ¬P
T F F
F T F
Contingency: A compound proposition that is neither tautology nor contradiction is called contingency.
7
Example: Show that ¬p ^ ¬q is contingency
Solution: We can verify this statement with the help of truth table as follows:
P q ¬p ¬q ¬p ^ ¬q
T T F F F
T F T T F
F T T F F
F F T T F
Logical Equivalences
An important type of step used in a mathematical argument is the replacement of a statement with another
statement with the same truth value. Because of this, methods that produce propositions with the same
truth values as a given compound proposition are used extensively in the construction of mathematical
arguments. The term compound proposition refers to an expression formed from propositional variables
using logical operators such as p^q.
Compound propositions that have the same truth values in all possible cases are called logically
equivalent.
The compound propositions p and q are called logically equivalent if p↔q is a tautology. The notation p
≡ q denotes that p and q are logically equivalent.
One way to determine whether two compound propositions are equivalent is to use truth table. In
particular, the compound propositions p and q are logically equivalent if and only if the columns giving
their truth values agree.
Solution:
P q pvq ¬ (p v q) ¬p ¬q ¬p ^ ¬q
T T T F F F F
T F T F T T F
F T T F F F F
F F F T T T T
The truth tables for these compound propositions are displayed in above table. Because the truth values of
the compound propositions ¬(p v q) and ¬p ^ ¬q agree for all possible combinations of the truth values of
p and q, it follows that ¬ (p v q) ↔ ¬p ^ ¬q is a tautology and that these compound propositions are
logically equivalent.
8
Example: Show that p v (q ^ q) and (p v q) ^(p v r) are logically equivalent.
Solution:
Propositional Equivalences
The compound propositions p and q are logically equivalent, denoted by p↔q or p ≡ q if propositions p↔
is a tautology.
9
Associative Laws (pvq)vr ≡ pv(qvr)
(p^q)^r ≡ p^(q^r)
Distributive Laws pv(q^r) ≡ (pvq)^(pvr)
p^(q^r) ≡ (p^q)v(p^r)
De Morgan’s Laws ¬(p^q) ≡ ¬p v ¬q
¬(pvq) ≡ ¬p ^ ¬q
Absorption Laws pv(p^q) ≡ p
P^(pvq) ≡ p
Negation Laws pv¬p ≡ T
p ^ ¬p=F
p→q pvq
p→q q→p
pvq p→q
p^q (q→p)
p^q (p→q)
(p→q)^(q→r) p→(q^r)
(p→r)^(q→r) (pvq)→r
(p→q)v(p→r) p→(qvr)
(p→r)v(q→r) (p^q)→r
pq (p→q)^(q→p)
pq pq
pq (p^q)v(p^q)
(pq) pq
Solution: We could use a truth to show that these compound propositions are equivalent. Indeed, it would
not be hard to do so. However, we want to illustrate how to use logical identities that we already know to
establish new logical identities, something that is of practical importance for establishing equivalences of
compound propositions with a large number of variables. So, we will establish this equivalence by
developing a series of logical equivalences using one of the equivalence in the above table.
≡ p^¬q
10
Example: Sow that ¬(pv(¬p^q)) and ¬p ^ ¬q are logically equivalent by developing a series of
logical equivalences
Solution: ¬(pv(¬p^q))
Solution: To show that this statement is a tautology, we will use logical equivalences to demonstrate that
it is logically equivalent to T
(p^q)→(pvq) ≡ ¬(p^q)v(pvq)
≡T v T
≡T
Predicate: Statements involving the variables such as "x>3", "x=y+1", "z=x+y", "computer x is
functioning properly are often found in mathematical assertions, in programs and in system
specifications. These statements are neither true nor false when the values of the variables are not
specified.
The statement "x is greater than 3" has two parts. The first part, the variable x, is the subject of the
statement. The second part-the predicate, "is greater than 3"-refers to a property that the subject of
the statement can have. We can denote the statement " x is greater than 3" by P(x) where P
denotes the predicate " is greater than 3" and x is the variable. We also call P as a propositional
function where P(x) is also said to be the value of the propositional function P at x. Once a value
has assigned to the variable x, the statement P(x) becomes a proposition and has a truth value.
Example 1: Let P(x) denotes the statement " x >3". What are the truth values of P(4) and P(2)?
Solution:
11
We obtain the statement P(4) by setting x=4 in the statement "x>3". Hence P(4) which is the statement
"4>3" is true. However, P(2) which is the statement "2>3" is false.
Example 2: Let Q(x,y) denote the statement "x = y+3". What are truth values of the propositions Q(1,2)
and Q(3,0)?
Solution: To obtain Q(1,2) set x=1 and y=2 in the statement Q(x,y). Hence, Q(1,2) is the statement
"1=2+3" which is false. The statement Q(1,0) is the proposition "3=0+3 " which is true.
Quantifiers
When the variables in a propositional function are assigned values, the resulting statement becomes a
proposition with certain truth value. However, there is another important way, called
quantification, to create a proposition from a proposition. Quantification expresses the extent to
which a predicate is true over a range of elements. In English, the words all, some, many, none
and few are used in quantifications. We have two types of quantifications.
Quantifiers are the tools that change the propositional function into a proposition. Construction of
propositions from predicate using quantifiers is called quantification.
Universal quantification which tells us that a predicate is true for every element under consideration and
existential quantification which tells us that there is one or more element under consideration for
which the predicate is true.
Many mathematical statements asserts that a property is true for all values of a variable in a particular
domain, called the domain of discourse or universe of discourse, often just referred to as the
domain. Such a statement is expressed using universal quantification. The universal
quantification of P(x) for a particular domain is the proposition that asserts that P(x) is true for all
values of x in this domain. The domain must always be specified when a universal quantifier is
used, without it, the universal quantification of a statement is not defined.
Definition: The universal quantification of P(x) is the statement " P(x) for all value of x in the domain"
The notation ∀x P(x) denotes the universal quantification of P(x). Here ∀ is called the universal
quantification. We read ∀ x P(x) as "for all x P(x)".
Example 1: Let P(x) be the statement "x+1>x". What is the truth value of the quantification ∀ x P(x)
where domain consists of all real numbers.
Solution: Because P(x) is true for all real number x, the quantification ∀ x P(x) is true.
Example 2 : Let Q(x) be the statement "x<2". What is the truth value of the quantification ∀ x P(x) where
the domain consists of all real numbers
12
Solution: Q(x) is not true for every real number x because for instance Q(3) is false. That is x=3 is
counterexample for the statement ∀ x P(x)
Example 3: What is the truth value of ∀ x P(x) where P(x) is the statement "x2<10" and the domain
consists of the positive integers not exceeding 4
P(1)^P2(2)^p(3)^P(4)
Because the domain consists of the integers 1,2,3,4. Because P(4) which is the statement "42<10" which is
false, it follows that ∀ x P(x) is false.
The Existential Quantifier: Many mathematical statements assert that there is an element with a certain
property. Such statements are expressed using existential quantification. With existential
quantification, we form a proposition that is true if and only if P(x) is true for at least one value of
x in the domain.
Definition
The existential quantification of P(x) is the proposition "There exists an element x in the domain such that
P(x)".
We use the notation ∃ x P(x) for the existential quantification of P(x). Here ∃ is called the existential
quantifier
A domain must always be specified when a statement ∃ x P(x) is used. Furthermore, the domain of ∃ x
P(x) changes when the domain changes. Without specifying the domain, the statement ∃ x P(x)
has no meaning.
Besides the words "there exists", we can also express existential quantification in many other ways, such
as by using the words "for some ", "for at least one", "there is ". The existential quantification ∃x
P(x) us read as
Example 1: Let P(x) denotes the statement "x>3". What is the truth value of the quantification of ∃ x
P(x), where the domain consists of all real numbers?
Solution: Because "x>3" is sometimes true-for instance, when x=4-the existential quantification of P(x),
which is ∃x P(x), is true.
The statement ∃ x P(x) is false if and only if there is no element x in the domain for which P(x) is true.
That is, ∃x is false if and only if P(x) is false for every element of the domain.
13
Example 2: Let Q(x) denotes the statement "x = x+1". What is the truth value of the quantification ∃ x
Q(x) where the domain consists of all real numbers?
Solution:
Because Q(x) is false for every real number x, the existential quantification of Q(x), which is ∃ x Q(x), is
false.
Example 3: What is the truth value of ∃ x P(x), where P(x) is the statement "x2>10" and the universe of
discourse consists of the positive integers not exceeding 4?
Solution: Because the domain is {1,2,3,4}, the proposition ∃ x P(x ) is same as the disjunction
P(1)vP(2)vP(3)vP(4)
Because P(4) which is the statement 42>10 is true, it follows that ∃ x P(x) is true.
Example 4: Let N = {1,2,3,4,5,6,7,8,9} be set of natural number. Determine the truth value of each of the
following statements;
a. ∃ x N, x+5=12
b. ∀ x N, x+4<15
c. ∀ x N x+5≤10
Solution:
N = {1 ,2,3,4,5,6,7,8,,9}
Binding Variables
When a quantifier is used on variable then it is called bounded variable. An occurrence of a variable that
is not bounded by a quantifier or set equal to a particular value is said to be free.
The part of a logical expression to which a quantifier is applied is called the scope of quantifier.
Example: In the statement ∀ y Q(x,y), the variable y is bounded by universal quantifier ∀ x but variable
x free because it not bounded by a quantifier.
Example 1: Translate “Not every integer is even” where the universe of discourse is set of integers.
Solution:
14
Then ¬∀ x E(x) represents the above statement “not every integer is even”.
Solution: Let M(x) denote x is mortal, where x is from set of man (here universe of discourse is all man)
P(x): x is precious
Q(x): x is precious
For some x, x is student of this college and x has passed CSIT entrance
Example 5: Every student in this class has studied discrete mathematics where universe of discourse is set
of person.
For every person x, if x is student of this class then x has studied discrete
Therefore ∀ x P(x)→Q(x)
C(x): x is clever
M(x): x is successful
15
Express the following using quantifier
∃ x (S(x)^ ¬M(x))
We will often want to consider the negation of a quantified expression. For instance, consider the
negation of the statement
This statement is a universal quantification, namely ∀ x P(x) where P(x) is the statement "x has taken a
course in calculus" and the domain consists of the students in your class. The negation of this
statement is "It is not the case that every student in your class has taken a course in calculus".
And this is simply the existential quantification of the negation of the original propositional
function namely
∃ x P(x)
∀ x P(x) ∃ x P(x)
To show that ∀ x P(x and ∃ x P(x) are logically equivalent no matter what the propositional function
P(x) is and what the domain is, first note that ∀ x P(x) is true if and only if ∀ x P(x) is false.
Also note that ∀ x P(x) is false if and only if there is an element x in the domain for which P(x) is false.
This holds if and only if there is an element x in the domain for which P(x) is true. Finally, note
that there is an element x in the domain for which P(x) is true if and only if ∃ x P(x) is true.
Putting these steps together, we can conclude that ∀ x P(x) is true if only if ∃ x P(x) is true. It follows
that ∀ x P(x) and ∃ x P(x) are logically equivalent.
16
Suppose that we want to negate an existential quantification. For instance, consider the proposition "
There is a student in this class who has taken a course in calculus" This is the existential
quantification
∃ x Q(x)
Where Q(x) is the statement " x has taken a course in calculus". The negation of this statement is the
proposition "It is not the case that there is a student in this class who has taken a course in
calculus". This is equivalent to " Every student in this class has not taken a course in calculus"
which is just the universal quantification of the negation of the propositional function or phrased
in the language of quantifiers,
∀ x Q(x).
∃ x P(x) ∀ x Q(x)
Example: What are the negations of the statements "There is an honest politician" and "All
Americans eat cheeseburgers"?
Solution: Let H(x) denote " x is honest". Then the statement " There is an honest politician" is represented
by ∃ xH(x) where the domain consists of all politicians. The negation of this statement is ∃
xH(x), which is equivalent to ∀ x H(x). This negation can be expressed as "Every politician is
dishonest"
Let C(x) denotes "x eats cheeseburger". Then the statement "All American eat cheese burgers" is
represented ∀ x C(x), where the domain consists of all Americans. The negation of this statement is is
∀ x C(x) which is equivalent to ∃ x C(x) . This negation can be expressed as "Some Americans does not
eat cheeseburgers.
17
Translating sentences from English into logical expression is a crucial task in mathematics, logic
programming, artificial intelligence, software engineering and many other applications.
Translating from English to logical expressions becomes even more complex when quantifiers are
needed. Furthermore, there can be many ways to translate a particular sentence. The goal in this
translation is to produce simple and useful logical expression.
Example: Express the statement “Every student in this class has studied calculus” using predicates and
quantifiers.
Solution: First, we rewrite the statement so that we can clearly identify the appropriate quantifiers to use.
“For every student in this class, that student has studied calculus”.
Continuing, we introduce C(x), which is the statement, “x has studied calculus”. Consequently, if the
domain for x consists of the student in the class, we can translate our statement as ∀ x C(x)
If we are interested in a wider group of people than only those in this class then we change the domain to
consist of all people, we will need to express our statement as:
“For every person x, if person x is a student in this class then x has studied calculus”.
If S(x) represent the statements the statement that person x is in this class, we see that our statement can
be expressed as:
∀ x (S(x)→C(x)).
Example 2: Express the statements “Some students in this class has visited Mexico” and “Every student
in this class has visited either Canada or Mexico” using predicate and quantifiers.
Solution: The statement “Some student in this class has visited Mexico” means that
“There is a student in this class with the property that the student has visited Mexico”.
“There is a student x in this class having the property that x has visited Mexico”
We introduce M(x), which is the statement “x has visited Mexico”. If the domain for x consists of the
students in this class, we can translate this statement as ∃ x M(x).
However, if we are interested in people other than those in this class, we look at the statement a little
differently. Our statement can be expressed
“There is a person x having the property that x is a student in this class and x has visited Mexico
18
In this case, the domain for the variable x consists of all people. We introduce S(x) to represent “x is a
student in this class”. Our solution becomes ∃ x(S(x) ^ M(x)) because statement is that there is a person x
who is student in this class and who has visited Mexico.
For every x in this class, x has the property that x has visited Mexico or x has visited Canada”.
Following our earlier reasoning, we see that if the domain for x consists of the student in this class, this
second statement can be expressed as
∀ x (C(x) v M(x))
However, if the domain for x consists of all people, our statement can be expressed as
“For every person x, if x is a student in this class, then x has visited Mexico or x has visited Canada”.
Example 3: Consider these statements. The first two are called premises and the third is called the
conclusion. The entire set is called an argument
Solution: Let P(x), Q(x) and R(x) be the statements “ x is a lion” ,”x is fierce”, and “x drinks coffee”
respectively. Assuming that domain consists of all creatures, express the statements in the argument using
quantifiers and P(x), Q(x) and R(x)
∀ x (P(x)→Q(x)).
∃ x(P(x) ^ ¬R(x))
∃ x(Q(x) ^¬ R(x))
Example 4: Consider these statements, of which the first three are premises and the fourth is a valid
conclusion:
19
Solution: Let P(x), Q(x), R(x) and S(x) be the statements “ x is a humminfbird”, “x is large”, “x lives on
honey” and “ x is richy colored” respectively.
Assuming that the domain consists of all birds, express the statements in the argument using quantifiers
and P(x), Q(x), R(x) and S(x).
∀ x (P(x)→S(x))
∃ x(Q(x) ^R(x))
∀ x (¬R(x)→¬S(x))
∀ x (P(x)→¬Q(x))
Nested Quantifiers
Two quantifiers are nested if one is within the scope of the other such as
∀ x ∃ y(x+y=0)
Note that everything within the scope of a quantifier can be thought of as a propositional function.
Nested quantifiers commonly occur in mathematics and computer science. Although, nested quantifiers
can sometime be difficult to understand.
To understand these statements involving many quantifiers, we need to unravel what the quantifiers and
predicates that appear mean.
Example 1: Assume that the domain for the variables x and y consists of all real numbers. The statements
∀ x ∀ y (x+y = y+x)
Says that x+y = y+x for all real numbers x and y. This the commutative law for addition of real numbers
where the domain for both variables consists of all real numbers.
Solution: This statement says that for every real number x and for every real number y, if x>0 and y<0
then xy<0. That is, this statement says that for every real number x and y if x is positive and y is negative
then xy is negative. Simply, the product of a positive real number and negative real number is negative.
20
Solution:
Let L(x,y): x loves y
Then,
∀ x ∃ y L(x,y)
∃ x ∃ y L(x,y)
∀ x ∀ y L(x,y)
Example 1: Let P(x,y) be the statement “x+y = y+x”. What are the truth values of the quantification ∀ x
∀ y P(x,y) where the domain for all variables consists of all real numbers.
Solution:
“For all real numbers x, for all real numbers y, x+y = y+x”
Example 1: Translate the statement “The sum of two positive integers is always positive “into a logical
expression.
Solution: To translate this statement into a logical expression, we first rewrite it so that the implied
quantifiers and a domain are shown: “For every two integers, if these integers are both positive the sum of
these integers is positive.
Next, we introduce the variables x and y to obtain “For all positive integers x and y, x+y is positive.
∀ x ∀ y ((x>0)^(y>0)→(x+y>0))
Example 2: Translate the statement “Every real number except zero has a multiplicative inverse”
Solution: We first rewrite this as “for every real number x except zero, x has a multiplicative inverse”. We
can rewrite as “For every real number x , if x ≠0, then there exists a real number y such that xy = 1”
21
∀ x ((x≠0)→ ∃ y(xy=1))
Example 3 : Express the statement “If a person is female and is a parent, then this person is someone’s
mother” as a logical expression involving predicates, quantifiers with a domain consisting of all people
and logical connectives
Solution: The statement “If a person is female and is a parent, then this person is someone’s mother” can
be expressed as “For every person x, if person x is a female and person x is a parent then there exists a
person y such that person y is the mother of person y”. We introduce the propositional function F(x) to
represent “x is female”, P(x) to represent “ x is a apparent”, and M(x,y) to represent “ x is the mother of
y”.
∀ x ∃ y ((F(x) ^P(x))→M(x,y)).
Example 4: Express the statement “Everyone has exactly one best friend” as a logical expression
involving predicates, quantifiers with a domain consisting of all people and logical connectives.
Solution: The statement “Everyone has exactly one best friend” can be expressed as “For every person x,
if person x has exactly one best friend”. Introducing the universal quantifier, we see that this statement is
same as
Example 5: Use quantifiers to express the statement “There is woman who has taken flight on every
airline in the world”.
Solution:
∃ w ∀ a ∃ (P(w,f) ^Q(f,a))
where the domain of discourse for w,f and a consists of all the woman in the world, all airline flights and
all airlines respectively.
Rules of Inferences
Proofs in mathematics are valid arguments that establish the truth of mathematical statements. By an
argument, we mean a sequence of statements that end with a conclusion. By valid, we mean that
the conclusion or final statement of the argument must follow from the truth of the preceding
22
statements or premises of the argument. That is, an argument is valid if and only if it is
impossible for all the premises to be true and the conclusion to be false. To deduce new
statements from statements we already have, we use rules of inference which are template for
constructing valid arguments. Rules of inference are our basic tools for establishing the truth of
elements.
Rules of Inference
Proofs in mathematics are valid arguments that establish the truth of mathematical statements. By an
argument, we mean a sequence of statements that end with a conclusion. By valid we mean that
the conclusion or final statement of the argument must follow from the truth of the preceding
statements or premises of the argument. That is, an argument is valid if and only if it is
impossible for all the premises to be true and the conclusion to be false. To deduce new
statements from statements we already have, we use rules of inference which are templates for
constructing valid arguments. Rules of inference are our basic tools for establishing the truth of
statements
An argument in propositional logic is a sequence of propositions. All but the first proposition in the
argument are called premises and the final proposition is called the conclusion. An argument is
valid is the truth of all its premises implies that the conclusion is true.
From the definition of a valid argument form we see that the argument form with premises p1, p2, p3….. pn
and conclusion q is valid.
We can always use a truth table to show that an argument form is valid. We do this by showing that
whenever the premises are true, the conclusion must also be true. However, this cannot be a
tedious approach. For example, when an argument form involves 10 different propositional
variables, to use a truth table to show this argument form is valid requires 2 10 = 1024 different
rows. Fortunately, we do not have to resort to truth tables. Instead, we can first establish the
validity of some relatively simple arguments called rules of inference. These rules of inferences
can be used as building blocks to construct more complicated valid argument forms.
The tautology (p^(p→q))→q is the basis of the rule of inference called modus ponens or law of
detachment. This law tells us that if a conditional statement and the hypothesis of this conditional
statement are both true then the conclusion must also be true.
23
……………
∴q
2 ¬q [¬p^(p→q)]→¬p Modus Tollens
p→q
……………
∴ ¬p
3 p→q [(p→q)^(q→r)]→(p→r) Hypothetical Syllogism
q→r
………..
∴p→r
4 Pvq [(pvq)^¬p]→q Disjunctive Syllogism
¬p
………
∴q
5 P p→(pvq) Addition
……….
∴ pvq
6 P^q (p^q)→p Simplification
………
∴p
7 P ((p)^(q))→(p^q) Conjunction
q
…………
∴ p^q
8 Pvq [(pvq)^(¬pvr)]→(qvr) Resolution
¬pvr
…………..
∴pvr
Example 1: State which rule of inference is the basis for the following arguments: “It is below
freezing now. Therefore, it is either below freezing or raining now”.
Solution: Let p the proposition “ It is below freezing now” and q be the proposition “It is raining now”
Then this argument is of the form
p
…………..
∴ pvq
This is r an argument that uses the addition rule
Example 2: State which rule of inference is the basis of the following argument: “It is below
freezing and raining now. Therefore, it is below freezing now.
Solution:
24
Let p be the proposition “It is below freezing now”. And let q be the proposition “It is raining now”. This
argument is of the form:
P^q
…………..
∴p
Solution:
Let p be the proposition “It is raining today”
Let q be the proposition “ We will not have a barbecue today”
Let r be the proposition “ We will have a barbecue tomorrow”
Then this argument if of the form
p→q
q→r
……..
∴ p→r
Hence, this argument is a hypothetical syllogism
Using Rules of Inferences to Build Arguments
When there are many premises, several rules of inferences are often needed to show that an argument is
valid.
Example 1: Show that the hypothesis "It is not sunny this afternoon and it is colder than
yesterday,". "We will go swimming only if it is sunny", "If we do not go swimming then we will
take a canoe trip", and "If we take a canoe trip then we will be home by sunset" leads to the
conclusion "we will be home by sunset"
Solution: Let p be the proposition " It is sunny this afternoon", q be the proposition "It is colder than
yesterday", r be the proposition, " we will go swimming ", s be the proposition, "We will take a canoe
trip" and t be the proposition "We be home by sunset".
We construct an argument to show that our hypothesis lead to the desired conclusion as follows:
25
5 r→s Hypothesis
6 S Modus ponens using 4 and 5
7 s→t Hypothesis
8 T Modus ponens using 6 and 7
Note that we could have used a truth table to show that whenever each of the four hypotheses is true, the
conclusion is also true. However, because we are working with five propositional variables p, q, r, s and t
such a truth table would have 32 rows.
Example 2: Show that the hypothesis "If you send me an email message then I will finish writing the
program,". If you do not send me an email message then I will go to sleep early", and "If I go to sleep
early the I will wake up feeling refreshed " lead to the conclusion "If I don’t finish writing the program
then I will wake up feeling refreshed"
Solution:
Then the hypothesis are p→q, ¬q→r , r→s and the conclusion is ¬q→s.
Example 3: Show that the following argument is valid. If today is Tuesday, I have a test in
mathematics or economics. If my economics professor is sick, I will not have a test in Economics.
Today is Tuesday and my Economics professor is sick. Therefore I have a test in Mathematics.
Solution:
26
Let r be the proposition “ I have a test in Economics”
Example 4: Use resolution to show that the hypothesis “Jasmine is skiing or it is not snowing” and
“It is snowing or Bart is playing hockey imply that Jasmine is skiing or Bart is playing hockey”.
Example 5: Show that the hypothesis (p^q)v r and r→s imply the conclusion pvs
Solution:
27
Solution:
Example 7: Construct an argument using rules of inference to show that the hypotheses “If it does not
rain or if it is cloudy today then the swimming competition will be help and the life saving demonstrating
will go on. If the swimming competition is held then the trophy will be awarded and the trophy was not
awarded “imply the conclusion “It rained”
Solution:
Let P = “ It rains”
Q = “It is foggy”
T = “trophy is awarded”
Now,
28
4 (¬p v ¬q) → (r ^ s) Hypothesis
5 ¬(¬p v ¬q) v (r ^ s) Implication on 4
6 (p ^ q) v (r ^s) De Morgan’s Law in step 5
7 p v (r^s) Simplification on 6
8 pvr Simplification on 7
9 rvp Commutative law on 8
10 ¬rv p Addition using 3
11 pvp Resolution law on 9 and 10
12 p Idempotent law
Universal Instantiation: It is the rule of inference used to conclude that P© is true where c is a particular
member of the domain, given the premise ∀x P(x). Universal instantiation is used when we
conclude from the statement “All women are wise “that “Lisa is wise” where Lisa is a member of
the domain of all women.
Universal Generalization: It is the rule of inference that states that ∀x P(x) is true, given the premise that
P© is true for all element c in the domain. Universal generalization is used when we know that ∀x
P(x) is true by taking an arbitrary element c from the domain. Universal generalization is used
when we show that ∀x P(x) is true by taking an arbitrary element c from the domain and showing
that P© is true. That is, when we assert from ∀x P(x) the existence of an element c in the domain,
we have no control over c and cannot make any other assumptions about c other than it comes
from the domain. Universal generalization is used implicitly in many proofs in mathematics and
is seldom mentioned explicitly.
Existential Instantiation: It is rule that allows us to conclude that there is an element c in the domain for
which P© is true if we know that ∃ x P(x) is true. We cannot select an arbitrary value of c hare,
but rather it must be a c for which P© is true. Usually we have no knowledge of what c is, only
that it exists. Because it exists, we may give it a name c and continue our argument.
Existential Generalization: It is the rule of inference that is used to conclude that ∃ x P(x) is true when a
particular element c with P© true in known. That is, if we know one element c in the domain for
which P© is true, then we know that ∃ x P(x) is true
29
Rule of Inference Name
∀x P(x) Universal Instantiation
…………
P(c )
P(c ) for an arbitrary c Universal Generalization
………………
∀x P(x)
∃ x P(x) Existential Instantiation
…………..
P (c ) for some element c
P(c ) for some element c Existential Generalization
…………………..
∃ x P(x)
Example 1: Show that the premises “Everyone in this discrete mathematics class has taken a course in
computer science” and “Marla is a student in this class” imply the conclusion “ Marla has taken a
course in computer science”.
Solution:
Then the premises are ∀x D(x)→C(x) and D(Marla). The conclusion is C(Marla)
The following steps can be used to establish the conclusion from the premises
Example 2: Show that the premises “A student in this class has not read the book “and everyone in this
class passed the first exam” imply the conclusion “Someone passed the first term exam has not
read the book”.
The premises are ∃ x(C(x) ^ B(x)) and ∀x (C(x)→P(x)). The conclusion is ∃ x(P(x) ^
B(x))
30
S.N Step Reason
1 ∃ x(C(x) ^ B(x)) Assumption
2 C(a) ^ B(a) Existential instantiation from 1
3 C(a) Simplification on 2
4 ∀x (C(x)→P(x)) Assumption
5 C(a)→P(a) Universal Instantiation from 4
6 P(a) Modus ponens from 3 and 5
7 B(a) Simplification on
8 P(a) ^ B(a) Conjunction from 6 and 7
9 ∃ x P(x) ^ B(x) Existential generalization from 8
Example 3 : Reema, a student of this class knows how to write programs in Java. Everyone who knows
how to write programs in Java can get a high job. Therefore someone in this class can get a high
paying job.
i. ∀x J(x)→H(x)
ii. J(Reema)
Example 4: Everyone in discrete structure class has taken a course in computer science and Reema is a
student in this class implies the conclusion Reema has taken a course in computer science.
31
Then, the premises are as:
a. ∀x D(x)→C(x)
b. D(Reema)
Now,
Example 5: Prove or disprove the validity of argument “Every living thing is a plant or an animal. Hari’s
god is alive and it is not plant. All animals have heart. Hence Hari’s dog has heart.
Solution:
A(x): x is alive
L(x): x is alive
Then
Example 6: Someone in the class who has visited Pokhara. Everyone who has been in Pokhara visits
Fewalake. Therefore someone in this class has visited Fewalake.
32
S(x): x is a student of this class
Then,
Proof Methods
A theorem is a mathematical statement that is can be shown to be true. A proof of given theorem is said to
be well founded if its steps of mathematical statement can be present on argument that makes the
theorem true.
Problem solving is not just a science so there is not hard and fast rule that is applied in problem solving.
However, there are some guiding methods that help us to solve different kinds of problem.
Direct Proof
The implication p→q can be proved by showing that if p is true then q must also be true. To carry out
such as proof, we must assume that hypothesis p is true and using information already available if
conclusion q becomes true then argument becomes valid.
Solution:
Proof: We know that if a number is even then we can represent it as 2k where k is an integer and if the
number is odd then it can be written as 2I+1 where I is an integer. Assume that a = 2k+1 and b =
2I+1 for some integers I and K.
33
Solution: Let p→q : if n is odd integer then n2 is an odd integer
We assume that hypothesis of this implication is true. That is, suppose that n is odd and then n can be
expressed as n = 2k+1
Therefore n2 is odd.
Solution:
Proof: Suppose that A and B are two rational number and then by definition of rational number, it follows
𝑝
that there are two integers p and q where q ≠0 such that A = 𝑞 and integers x and y with y≠0 such
𝑥
that B = 𝑦
𝑝 𝑥 𝑝𝑦+𝑞𝑥
Now, A+B = 𝑞 +𝑦 = 𝑞𝑦
Since q≠0 and y≠0, it follows that ay≠0. Here, we have expressed A+B as the ratio of two integers py+qx
and qy with qy≠0
Example: Using direct proof, prove that for every positive integer n, n3+n is even
Proof:
Now,
Case II: Suppose that n is odd then we have n = 2k+1 for some integer k
Now,
Indirect Proof
We have p→q ≡ ¬q→¬p i.e. contra positive of implication is equivalent to the implication. So, the
implication p→q can be proved by showing that its contra positive ¬q→¬p is true. We prove the
implication p→q by assuming that the conclusion (q) is false and using the known facts we show
that the hypothesis (p) is also true.
34
Example: If the product of two integers a and b is even then either a is even or b is even
Solution: Suppose that a and b are odd then we have a = 2k+1 and b =2l+1
So ab = (2k+1).(2l+1) = 4kl+2k+2k+1 = 2(2kl+k+1)+1 which is odd integer. Hence both a and b being
odd implies that ab is odd. This is indirect proof.
Example: Using indirect proof show that is 3n+2 is odd then n is odd
Solution:
Assume that conclusion of this implication is false i.e. n is even then we can express n as
It follows that
3n+2 = 3*2k+2
= 6k+2
2(3k+1)
Proof by Contradiction
Solution;
Proof: Assume that a2 is an even number and a is odd number. Since a is odd number we have a = 2k+1,
for some integer k. so a2 = (2k+1)2 = 4k2+4k+1 = 2(k2+k)+1. Here k2+1 is some integer say I then a2 =
I2+1 i.e. a2 is odd number. This contradicts our assumption that is a2 is even.
Hence proved.
35
Example: Prove that if n3+5 is odd then n is even
=8k3+12k2+6k+6
To prove that the statements of the form x p(x) is false, we just need some value of x. So while proving
for falsity we just look for counter example.
Example: Here we instantly try to get the product of irrational to try it. Let us take both the number for
product be √2 the √2. √2 = 2 (not rational). Hence by counter example it is shown that the product of two
irrational numbers is not necessarily irrational.
In the implication p→q, we can show that the consequence q is true then regardless of the truth values of
p, the implication p→q is true. Such type of proof technique is called trivial proof.
In the implication p→q, if we can show that the hypothesis p is false, then regardless of truth values of q,
the implication p→q is true. Such kind of proof of an implication p→q is called vacuous proof.
Existence Proofs
A proof of a proposition of the form x(p(x) is called an existence proof. There are different ways of
proving a theorem of this type. Sometime some element a is found to show p(a) to be true. This is called
constructive existence proof. In other method we do not provide a such that p(a) is true but prove that
x(p(x)) in different way, this is called non-constructive existence proof.
Example: Prove that there are 100 consecutive positive integers that are not perfect squares.
36
Solution: Let’s consider 2500 this is a perfect square of 50, and 2601 this is a perfect square of 51. In
between 2500 and 2601 there are 100 consecutive positive integers. Hence the proof.
Proof By Cases:
The implication of the form (p1 v p2 v p3….v pn)→q can be proved by using the tautology ((p1 v p2 v
p3….v pn)→q ↔[(p1→q) ^(p2→q)^(p3→q) ^………..^(pn→q)].
Solution: Here we have to consider two cases –x>3 and x>3 since |x| represents an absolute value of x, we
have the following relations
-x when x≤0
Mistakes in Proofs
There are many common errors in constructing mathematical proofs. Among the most common errors are
mistakes in arithmetic and basic algebra. Even professional mathematicians make such errors, especially
when working with complicated formulae. Whenever you use such computations you should check them
carefully as possible.
Each step of mathematical proof needs to be correct and the conclusion needs to follow logically from the
steps that precede it. Many mistakes result from the introduction of steps that do not logically follow from
that precedes it.
Example: What is wrong with this famous supposed “proof” that 1=2?
Solution:
Proof: We use these steps, where a and b are two equal positive integers
37
Example 2: What is wrong with this proof?
Proof: Suppose that n2 is positive. Because the conditional statement “ If n is positive then n 2 is positive
is true, we conclude that n is positive
Solution: Let P(n) be “ n is positive” and Q(n) be “n2 is positive”. Then our hypothesis is Q(n). The
statement “If n is positive then n2 is positive” is the statement n (P(n)→Q(n). From the hypothesis
Q(n) and the statement n (P(n)→Q(n)) we cannot conclude P(n), because we are not using a valid
rule of inference. Instead, this is an example of affirming the conclusion.
Assignment 3
38
11. Prove that the product of rational number is rational
List of C programs
Lab 3
39
int OR(int a,int b);
int main()
{
int a,b;
printf("A\tB\tA V B\n\n");
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
{
printf("%d\t%d\t%d\n\n",a,b,OR(a,b));
}
}
getch();
return 0;
}
int OR(int a,int b)
{
if(a==1||b==1)
return 1;
else
return 0;
}
Output:
A B AVB
0 0 0
0 1 1
1 0 1
1 1 1
Write a C program to print truth table of NOT Operation
Ans:
#include<stdio.h>
#include<conio.h>
int NOT(int a);
int main()
{
int a,b;
printf("A\t~A\n");
for(a=0;a<=1;a++)
{
printf("%d\t%d\n",a,NOT(a));
}
getch();
return 0;
}
40
int NOT(int a)
{
if(a==1)
return 0;
else
return 1;
}
Output:
A ¬A
0 1
1 0
Write a C program to print truth table of IMPLICATION Operation
Ans:
#include<stdio.h>
#include<conio.h>
int IMPLICATION(int a,int b);
int main()
{
int a,b;
printf("A\tB\tA-->B\n\n");
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
{
printf("%d\t%d\t%d\n\n",a,b,IMPLICATION(a,b));
}
}
getch();
return 0;
}
int IMPLICATION(int a,int b)
{
if(a==1&&b==0)
return 0;
else
return 1;
}
Output:
A B A-->B
0 0 1
0 1 1
1 0 0
1 1 1
Write a C program to print truth table of BIDIRECTIONAL Operation
41
Ans:
#include<stdio.h>
#include<conio.h>
int BIDIRECTIONAL(int a,int b);
int main()
{
int a,b;
printf("A\tB\tA<-->B\n\n");
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
{
printf("%d\t%d\t%d\n\n",a,b, BIDIRECTIONAL(a,b));
}
}
getch();
return 0;
}
int BIDIRECTIONAL(int a, int b)
{
if(a==1&&b==0)
return 0;
else if(b==1&&a==0)
return 0;
else
return 1;
}
Output:
A B A<-->B
0 0 1
0 1 0
1 0 0
1 1 1
Write a C program to find validity of arguments by using truth table
Ans: prove that (p-->q)^(q-->r) is equivalent to p-->r
Here we write a C program to prove that (p-->q)^(q-->r)-->(p-->r) is tautology
#include<conio.h>
#include<stdio.h>
int AND(int p,int q)
{
if(p==1&&q==1)
return 1;
else
return 0;
42
}
int OR(int p,int q)
{
if(p==1||q==1)
return 1;
else
return 0;
}
int IMPL(int p,int q)
{
if(p==1&&q==0)
return 0;
else
return 1;
}
int main()
{
int p,q,r;
printf("P\tQ\tR\t(P-->Q)^(Q-->R)-->(P --> R)\n");
for(p=0;p<=1;p++)
{
for(q=0;q<=1;q++)
{
for(r=0;r<=1;r++)
{
printf("%d\t%d\t%d\t\t%d\n\n",p,q,r,IMPL(AND(IMPL(p,q),IMPL(q,r)),IMPL(p,r)));
}
}
}
getch();
return 0;
}
Output:
P Q R (P-->Q)^(Q-->R)-->(P --> R)
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
Write a C program to print truth table for tautology and contradiction operations
Ans:
43
Tautology
#include<conio.h>
#include<stdio.h>
int AND(int p,int q)
{
if(p==1&&q==1)
return 1;
else
return 0;
}
int OR(int p,int q)
{
if(p==1||q==1)
return 1;
else
return 0;
}
int IMPLICATION(int p,int q)
{
if(p==1&&q==0)
return 0;
else
return 1;
}
int main()
{
int p,q;
printf("P\tQ\t(P^Q)-->(P V Q)\n");
for(p=0;p<=1;p++)
{
for(q=0;q<=1;q++)
{
printf("%d\t%d\t\t%d\n\n",p,q,IMPLICATION(AND(p,q),OR(p,q)));
}
}
getch();
return 0;
}
Output:
P Q (P^Q)-->(P V Q)
0 0 1
0 1 1
1 0 1
1 1 1
44
Contradiction
#include<conio.h>
#include<stdio.h>
int AND(int p,int q)
{
if(p==1&&q==1)
return 1;
else
return 0;
}
int OR(int p,int q)
{
if(p==1||q==1)
return 1;
else
return 0;
}
int IMPLICATION(int p,int q)
{
if(p==1&&q==0)
return 0;
else
return 1;
}
int NOT(int p)
{
if(p==1)
return 0;
else
return 1;
}
int main()
{
int p,q;
printf("P\tQ\t(P V Q) ^((~P)^~(Q))\n");
for(p=0;p<=1;p++)
{
for(q=0;q<=1;q++)
{
printf("%d\t%d\t\t%d\n\n",p,q,AND(OR(p,q),AND(NOT(p),NOT(q))));
}
}
getch();
return 0;
45
}
Output
P Q (P V Q) ^((~P)^~(Q))
0 0 0
0 1 0
1 0 0
1 1 0
46