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

Unit 1 Logic

The document discusses propositional logic and discrete mathematics. It covers topics like logical operators, predicates, quantifiers, and sets of numbers. Propositional logic deals with propositions and logical expressions formed using variables and operators. Predicates are statements about variables, and quantifiers specify whether statements apply to all or some variables.

Uploaded by

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

Unit 1 Logic

The document discusses propositional logic and discrete mathematics. It covers topics like logical operators, predicates, quantifiers, and sets of numbers. Propositional logic deals with propositions and logical expressions formed using variables and operators. Predicates are statements about variables, and quantifiers specify whether statements apply to all or some variables.

Uploaded by

mustafa enam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Discrete Mathematics

1
Unit 1 Logic

2
Subunit 1(a): Propositional logic

3
Propositional Logic
• Propositional logic deals with propositions.
• A proposition is a declarative sentence (i. e.
a sentence that makes a claim) that is either
true or false but not both.
• A propositional variable is a variable that
represents propositions.
• Propositional variables are usually denoted by
letters such as p, q, r, s etc.

4
Logical operators
¬ stands for “Not”, ˅ stands for “or”, ˄ stands
for “and”. These are defined using truth tables
as follows:
p ¬𝑝 p q p˅q p q p˄q
T F T T T T T T
F T T F T T F F
F T T F T F
F F F F F F
5
More logical operators: Implications
• → stands for “implies” , ↔ stands for “if and
only if”
• 𝑝 → 𝑞 is also read as “if p then q”

p q p → q p q p↔q
T T T T T T
T F F T F F
F T T F T F
F F T F F T 6
Exclusive or (  )
This is defined as follows:
p q p q
T T F
T F T
F T T
F F F

7
Some terminology
• The converse of p  q is q  p
• The contrapositive of p  q is ( q)  ( p)
• A compound proposition is an expression
formed from propositional variables using
logical operators

8
Precedence
1. 
2. , 
3. , 
eg.,  p  q means ( p)  q.
It does not mean ( p  q).
p  q  r means ( p  q)  r. 9
An example of finding a truth table of
a compound proposition
Find the truth table of ( p   q)  ( p  q)
Answer:
p q ¬𝑞 𝑝 ∨ ¬𝑞 𝑝∧𝑞 (𝑝 ∨ ¬𝑞) → (𝑝 ∧ 𝑞)

T T F T T T
T F T T F F
F T F F F T
F F T T F F

10
A logical puzzle
An island has two kinds of inhabitants:
“knights” who always tell the truth and “knaves”
who always lie. On the island, you encounter two
of its inhabitants, A and B. A says “B is a knight”
and B says “the two of us are of opposite types”.
Determine the identities of A and B if possible.

11
Solution
• Suppose A is a knight. Then, the statement of
A (B is a knight) is true. Therefore B is a
knight. But then the statement of B (the two of
us are of opposite types) is false which is
impossible. Therefore, A is a knave. The
statement of A is false. So, B is a knave.
Answer: A and B are both knaves

12
Subunit 1(b) : Propositional
equivalences

13
Tautology and Contradiction
• A tautology is a compound proposition that is
always true irrespective of the truth values of
the propositional variables that occur in it
• A contradiction is a compound proposition
that is always false irrespective of the truth
values of the propositional variables that occur
in it
• p   p is a tautology and p   p is a
contradiction

14
Equivalence of compound propositions
Two compound propositions are said to be
logically equivalent provided that they have the
same truth value in all possible cases. We use the
symbol ≡ for logical equivalence.

15
Some examples of logical equivalence

• Show that  ( p  q)   p   q
Solution: Constructing the truth tables, we see
that both compound propositions are true when p
and q are false and false in all other cases.

16
p q r A, B
eg. Show that
T T T T
p  (q  r )  ( p  q)  ( p  r )
T T F T
Solution : Let A denote p  (q  r ).
T F T T
Let B denote ( p  q)  ( p  r ).
The truth tables of both A and B are T F F T
the same as shown on the right. F T T T
F T F F
F F T F
F F F F 17
Some obvious equivalences
p p  p
p p p
pq  q p
pq  q p
 ( p )  p

18
Some important equivalences
p q  pq
 ( p  q)   p   q 
 De Morgan' s laws
 ( p  q)   p   q 
p  q   q   p (An implication and its contrapositive are equivalent)
( p  q)  r  p  (q  r )
 Associative laws
( p  q)  r  p  (q  r )
p  (q  r )  ( p  q)  ( p  r )
 Distributive laws
p  (q  r )  ( p  q)  ( p  r )

19
Equivalences involving tautolgies and
contradictions
Let T stand for a tautology and let F stand for a
contradiction. We have the following
pT  T
p T  p
pF  p
p F F
p p  T
p  p  F

20
Proving an equivalence using known
equivalences
Prove that  ( p  ( p  q))   p   q using
known equivalences
Solution: We have
 ( p  ( p  q))   p   ( p  q)
  p  ( ( p )   q)
  p  ( p   q)
 ( p  p )  ( p   q )
 F  ( p   q)
  p  q

21
Some remarks about implications and
equivalences
Let P and Q be compound propositions.
• To prove that P  Q , it is sufficient to prove
that (a) if P is true then Q is true and (b) if Q
is true then P is true.
• To prove that P  Q is a tautology, it is
sufficient to prove that if P is true then Q is
true.

22
Proving that a compound proposition is
a tautology using logical reasoning
Show that p  q  p  q is a tautology
Solution: Suppose that p  q is true. Then, p and
q are both true. Therefore p  q is true. We
have shown that if p  q is true then p  q
must be true. Therefore, p  q  p  q is a
tautology.

23
Generalized “or” and “and”
• Because of the associative laws, we can talk
about p  q  r and p  q  r.
• The idea can be extended to any number of
propositional variables.
• Thus, we can talk about p1  p2   pn and
p1  p2    pn .
Note that p1  p2    pn is true if and only if at least one of
p1 , p2 , , pn is true.
Also, p1  p2    pn is true if and only if each of
p1 , p2 , , pn are true. 24
The Liar Paradox
• The earliest attribution is to Eubulides of Miletus
(~ 4th century B.C., contemporary of Aristotle)
who said “A man says that he is lying. Is what he
says true or false?”.
• Alternate version: “This sentence is false”
• In symbols : L is the sentence “L is false”. This
means that L is true if and only if L is false.
• In propositional logic, such sentences are not
considered.
25
Subunit 1(c): Predicates and
quantifiers

26
Predicates
• A predicate or propositional function is a
statement about one or more variables (of any
kind). If the values of the variables are
specified, the statement becomes a proposition.
• For example let P( x) be the statement " x  0".
Here, P is a predicate of one variable.
• Let Q( x, y) be the statement " x  y  10".
Here Q is predicate of two variables.
27
Quantifiers , 
• The universal quantifier  stands for “for all”.
 x P( x) means " for all x, P( x)"
• The existential quantifier  stands for “there
exists”
 x P( x) means " there exists an x such that P( x)"

28
Domain of discourse
Statements involving quantifiers are understood
to be with respect to a certain set called the
“universe or domain of discourse” which must
be specified in order for the statement to
become a proposition.

29
Some important sets of numbers
• The set of all natural numbers is the set
{0, 1, 2, 3, 4, ……}
• The set of all integers is the set
{0, 1,  1, 2,  2, 3,  3,}
• Some authors do not include 0 among the
natural numbers.

30
Rational numbers
• A rational number is a ratio of two integers.
• For example, 53 , 52 , 12 , 20 are rational numbers.
• It is clear that every integer is a rational
number but there are rational numbers which
are not integers.

31
The number line

32
Real numbers
• A number which corresponds to a “signed
distance” on the number line is called a real
number.
• It is clear that every rational number is a real
number.
• However, there are real numbers which are not
rational. Such numbers are called irrational.
• Examples of irrational numbers are 2 ,  , e.

33
Some examples of statements
involving predicates and quantifiers
Consider the statement ∀𝑥 (𝑥 > 0). Is it true if
the domain of discourse is the set of all real
numbers? What if the domain is the set of all
positive real numbers?
The statement ∀𝑥 (𝑥 > 0) is false if the domain
of discourse is the set of all real numbers.
However, it is true if the domain of discourse is
the set of all positive real numbers.

34
Consider the statement ∃𝑥 (𝑥 = 0). Is it true if
the domain of discourse is the set of all integers?
What if the domain is the set of all positive
integers?
The statement ∃𝑥 (𝑥 = 0) is true if the domain
of discourse is the set of all integers.
It is false if the domain of discourse is the set of
all positive integers.

35
Counterexamples
To show that a statement of the form  x P(x)
is false, we need to show that there is a value
of x in the domain of discourse for which P(x)
is false. Such an x is called a counterexample
to the statement  x P(x) .
For example, x  0 is a counterexample to the
statement  x (x > 0) when the domain of
discourse is the set of all real numbers.

36
Equivalence of statements involving
predicates and quantifiers
• Two statements involving predicates and
quantifiers are said to be logically equivalent,
provided that they have the same truth value
irrespective of which predicates are substituted
into these statements and which domain of
discourse is used for the variables. We use the
same symbol as before.
• For example,  x ( P( x)  Q( x))  ( x P( x))  ( x Q( x))
(It is understood that the same domain is used
throughout)
37
Negation of statements involving
predicates and quantifiers

  x P( x )   x  P( x )
  x P( x )   x  P( x )
For example,
  x ( x  0)   x  ( x  0)
  x ( x  0)

38
The politician puzzle

A certain convention numbered 100 politicians. Each


politician was either crooked or honest. We are given
the following two facts:
• At least one of the politicians was honest.
• For every choice of two of the politicians, at least one
of the two was crooked.
Can it be determined from these two facts how many of
the politicians were honest and how many of them were
crooked?
39
Solution to the Politician Puzzle
Let A be an honest politician. Let B be any
other politician. Since at least one of A and B
is crooked, it follows that B is crooked. This
applies to any politician other than A.
Therefore, there is one honest politician and
the other 99 are crooked.

40
Subunit 1(d): Nested quantifiers

41
Order of quantifiers
Suppose that the domain of discourse for all
variables below is the set of all real numbers.
• Consider the statement ∃𝑦∀𝑥 𝑥 + 𝑦 = 0 .
It is false since there is no real number y such that
for every real number x, we have 𝑥 + 𝑦 = 0.
• Consider the statement ∀𝑥∃𝑦 𝑥 + 𝑦 = 0 .
It is true since for every real number x, there is a
real number y (i. e. 𝑦 = −𝑥) such that 𝑥 + 𝑦 = 0.

42
Negation of statements involving
nested quantifiers
eg. Find the negation of the statement  x  y ( xy  1)
Solution: We have
  x  y ( xy  1)   x   y ( xy  1)
  x  y  ( xy  1)
  x  y ( xy  1)

43
Translating sentences in english into
statements involving quantifiers
Consider the sentence “The sum of two non-
negative integers is always non-negative”. This
can be translated into a statement involving
quantifiers as follows:
•  x  y (( x  0)  ( y  0)  ( x  y  0) where the
domain for both variables is the set of all integers.
• Another possibility is  x  y ( x  y  0) where the
domain for both variables is the set of all non-
negative integers.
44

You might also like