You are on page 1of 30

LECTURE:2

Course Title: Discrete Structure (DS)


Course Content
• Logic and proofs
• Sets
• Functions
• Integers and modular arithmetic
• Sequences and summations
• Counting
• Probability
• Relations
• Graphs
Propositional logic: review
• Propositional logic: a formal language for representing
• knowledge and for making logical inferences
• A proposition is a statement that is either true or false.
• A compound proposition can be created from other
• propositions using logical connectives
• The truth of a compound proposition is defined by truth values
of elementary propositions and the meaning of connectives.
• The truth table for a compound proposition: table with entries
(rows) for all possible combinations of truth values of
elementary propositions.
Composite statements
AND, OR, NOT are called LOGICAL CONNECTIVES.
– Negation
– Conjunction
– Disjunction
– Exclusive or
– Implication
– Biconditional
Exclusive or
Definition: Let p and q be propositions. The
proposition "p exclusive or q" denoted by p⊕q, is true
when exactly one of p and q is true and it
is false otherwise.
Truth Table For p⊕q or p XOR q
P q p⊕q
T T F
T F T
F T T
F F F
Practice Work
Draw Truth Table
Verify this: p ⊕ q =(p ∨ q) ∧ (∼ p ∨ ~ q)
Computer representation of True and False

We need to encode two values True and False:


-Computers represents data and programs using 0s and 1s
-Logical truth values – True and False
-A bit is sufficient to represent two possible values: – 0
(False) or 1(True)
A variable that takes on values 0 or 1 is called a Boolean
variable.
Definition: A bit string is a sequence of zero or more bits.
The length of this string is the number of bits in the string.
Bitwise operations
T and F replaced with 1 and 0
Bitwise operations
• Examples:
LOGICAL EQUIVALENCE
If two logical expressions have the same logical values in the
truth table, then we say that the two logical expressions are
logically equivalent.
In the following example, ~ (~ p ) is logically equivalent p. So it is
written as ~(~p) ≡ p
Double Negative Property ~(~p) ≡ p
P ~p ~(~p)
T F T
F T F
LOGICAL EQUIVALENCE
Example
Rewrite in a simpler form: “It is not true that I am
not happy.”
Solution:
Let p = “I am happy”
then ~ p = “I am not happy”
and ~ ( ~ p) = “It is not true that I am not happy”
Since ~ ( ~ p) ≡ p
Hence the given statement is equivalent to “I am happy”
Implication
Definition:
Let p and q be propositions.
The proposition "p implies q" denoted by p → q is
called implication. It is false when p is true and q is false
and is true otherwise.

In p → q, p is called the hypothesis and q is called the


conclusion.
Implication
Implication
The converse of p →q is q → p.
The contrapositive of p → q is ¬q → ¬p
The inverse of p → q is ¬p → ¬q
Implication
Examples:
If it snows, the traffic moves slowly.
p: it snows
q: traffic moves slowly.
p→q

– The converse: If the traffic moves slowly then it


snows. q → p
Implication
– The contrapositive:
If the traffic does not move slowly then it does
not snow. ¬q → ¬p

– The inverse:
If it does not snow the traffic moves quickly.
¬p → ¬q
Biconditional
Let p and q be propositions. The biconditional
p↔ q (read p if and only if q), is true when p
and q have the same truth values and is false
otherwise.
Biconditional
Practice Work
Constructing the truth table
Example:
Construct a truth table for (p → q) ^ (¬p ↔ q)
Simpler if we decompose the sentence to elementary
and intermediate propositions
p q ¬p p→ q ¬p↔q (p → q) ^
(¬p ↔ q)
T T
T F
F T
F F
Construct a truth table for (p → q) ^ (¬p ↔ q)

p q ¬p p→ q ¬p↔q (p → q) ^
(¬p ↔ q)

T T F
T F F
F T T
F F T
Construct a truth table for (p → q) ^ (¬p ↔ q)

p q ¬p p→ q ¬p↔q (p → q) ^
(¬p ↔ q)

T T F T F F
T F F F T F
F T T T T T
F F T T F F
DE MORGAN’S LAWS
1) The negation of an AND statement is logically
equivalent to the OR statement in which each
component is negated.
Symbolically ~ (p ∧ q) ≡ ~ p ∨ ~ q
2) The negation of an OR statement is logically
equivalent to the AND statement in which each
component is negated.
Symbolically ~ (p ∨ q) ≡ ~ p ∧ ~ q
Truth Table of ~ (p ∨ q) ≡ ~ p ∧ ~ q
Home Task
1. Show that (p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
2. Are the statements ( p ∧ q ) ∨ r and p ∧ ( q ∨
r ) logically equivalent?
TAUTOLOGY:
A tautology is a statement form that is always true
regardless of the truth values of the statement
variables. A tautology is represented by the symbol “t”
EXAMPLE: The statement form p ∨ ~ p istautology
CONTRADICTION:
A contradiction is a statement form that is always false
regardless of the truth values of the statement variables. A
contradiction is represented by the symbol “c”. So if we have to
prove that a given statement form is CONTRADICTION, we will
make the truth table for the statement form and if in the column
of the given statement form all the entries are F, then we say
that statement form is contradiction.
EXAMPLE: The statement form p ∧ ~ p is a
contradiction.

Since in the last column in the truth table we


have F in all the entries, so it is a contradiction
i.e. p ∧ ~ p ≡c
LAWS OF LOGIC
LAWS OF LOGIC
LAWS OF LOGIC

You might also like