0% found this document useful (0 votes)
22 views27 pages

Lecture # 2+3 Ds

This document provides an overview of discrete structures including: - Conditional statements like "if p then q" and their truth tables - Special definitions like converse, contrapositive, and inverse - Propositional logic concepts like tautology, contradiction, and contingency and examples of each - Translating English sentences to propositional logic statements using predicates and quantifiers - Bit operations like bitwise OR, AND, and XOR

Uploaded by

usmansafdar12535
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views27 pages

Lecture # 2+3 Ds

This document provides an overview of discrete structures including: - Conditional statements like "if p then q" and their truth tables - Special definitions like converse, contrapositive, and inverse - Propositional logic concepts like tautology, contradiction, and contingency and examples of each - Translating English sentences to propositional logic statements using predicates and quantifiers - Bit operations like bitwise OR, AND, and XOR

Uploaded by

usmansafdar12535
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Discrete Structures

LECTURE # 2
The Course
Course Title: Discrete structures
Instructor: MUHAMMAD AWAIS
Semester : 1st
Duration: 16 Weeks
Conditional statement
It corresponds to English “if p then q” or “p implies q.”
Conditional: Let p and q be two propositions. The conditional
statement (implication) p → q is the proposition “if p, then q”. The
conditional statement p → q is false when p is true and q is false,
otherwise true.
Example: If it is raining, then it is cloudy.
p q p→q
If I am elected, then I will lower taxes. T T T
T F F
Truth table for implication: F T T
F F T
Special definitions
Converse: q → p is converse of p → q.
Ex. p → q: “If it is noon, then I am hungry.”
q → p: “If I am hungry, then it is noon.”
Contrapositive: ¬q → ¬p is contrapositive of p → q.
Ex. p → q: “If it is noon, then I am hungry.”
¬q → ¬p: “If I am not hungry, then it is not noon.”
Inverse: ¬p → ¬q is inverse of p → q.
Ex. p → q: “If it is noon, then I am hungry.”
¬p → ¬q: “If it is not noon, then I am not hungry.”
p → q has same truth values as ¬q → ¬p
Biconditional statement
It corresponds to English “p if and only if q”.
Biconditional: Let p and q be two propositions. The biconditional
statement (bi-implication) p ↔ q is the proposition “p if and only if q”.
The biconditional statement p ↔ q is true when p and q have the same
truth values, otherwise false.
p ↔ q has same truth value as (p→ q) ∧ (q → p).
p q p↔q
Example: p: “You can take the flight”.
q : “You buy a ticket” T T T
T F F
p ↔ q : “You can take the flight F T F
if and only if you buy a ticket” F F T
Propositional logic
A compound proposition that is:
(1) always true is called a tautology.
(2) always false is called a contradiction.
(3) neither a tautology nor a contradiction is called contingency.
Tautologies
A Tautology is a formula which is always true for every value of its
propositional variables.
Example − Prove [ ( A → B ) ∧ A ] → B is a tautology

A B A→B (A→B)∧A [(A→B)∧A]→B


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

[ ( A → B ) ∧ A ] → B is tautology.
Contradiction
A Contradiction is a formula which is always false for every value of its
propositional variables.
Example − ( A ∨ B ) ∧ [ ( ¬ A ) ∧ ( ¬ B ) ] is a contradiction

A B A∨B ¬A ¬B (¬A)∧(¬ (A∨B)∧[(¬A)∧(¬


B) B)]
T T T F F F F
T F T F T F F
F T T T F F F
F F F T T T F

( A ∨ B ) ∧ [ ( ¬ A ) ∧ ( ¬ B ) ] is contradiction.
Contingency
A Contingency is a formula which has both some true and some false
values for every value of its propositional variables.
Example − (A ∨ B) ∧ (¬ A) is a contingency

A B A∨B ¬A (A ∨ B) ∧ (¬ A)
T T T F F
T F T F F
F T T T T
F F F T F

(A ∨ B) ∧ (¬ A) is a contingency.
Propositional logic compound
Construct truth table for (p ∨ ¬q) → (p ∧ q).

p q ¬q p∨ p∧q (p ∨ ¬q) → (p ∧ q)
¬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
Q3. Construct truth table for
1. (p ∨ ¬q) ↔ (p ∧ q).
2. (p ⊕ ¬q) → (p ⊕ q).
Logical Equivalences
Equivalence: The compound propositions p and q are logically
equivalent if p↔q is a tautology. In other words, p and q are logically
equivalent if their truth tables are the same. We write p ≡ q.
Two Types:

•The truth tables of each statement have the same truth values.

•The bi-conditional statement X⇔Y is a tautology.


Matching truth table
Prove ¬(A∨B)and[(¬A)∧(¬B)]are equivalent

¬ (A ∨
A B A∨B ¬A ¬B [(¬ A) ∧ (¬ B)]
B)
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
Biconditional is tautology
Prove ¬(A∨B)and[(¬A)∧(¬B)]are equivalent

¬ (A ∨ [(¬ A) ∧ (¬ B)] [¬ (A ∨ B)] ⇔ [(¬ A ) ∧ (¬ B)]


A B A∨B
B)
T T T F F T
T F T F F T
F T T F F T
F F F T T T
Exercise
Equivalence Name
Identity laws
p Λ T ≡ p and p ν F ≡ p

Domination laws
p ν T ≡ T and p Λ F ≡ F

Idempotent laws
p ν p ≡ p and p Λ p ≡ p

Double negation law


¬( ¬ p) ≡ p

Commutative laws
p ν q ≡ q ν p and p Λ q ≡ q Λ p

Associative laws
(p ν q) ν r ≡ p ν (q ν r) and (p Λ q) Λ r ≡ p Λ (q Λ r)

Distributive laws
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)

De Morgan’s laws
¬(p ν q) ≡ ¬p Λ ¬q and ¬(p Λ q) ≡ ¬p ν ¬q

Absorption laws
p ∨ (p ∧ q) ≡ p and p ∧ (p ∨ q) ≡ p
Prove the equivalnces
Translating English sentences
⮚ The sentence “The automated reply cannot be sent
when the file system is full” can be translated as
q → ¬p
where p: “The automated reply can be sent ”
q: “The file system is full”
⮚ The sentence “You cannot drive a car if you are under 4 feet tall
unless you are older than 16 years old” can be translated as
(q ∧¬r) → ¬p
where p: “You can drive a car ”
q: “You are under 4 feet tall ”
r: “You are older than 16 years old”
example
⮚ The sentence “You can access the Internet from campus only if
you are a computer science major or you are not a freshman” can
be translated as
p → (q ∨ ¬r)
where p: “You can access the Internet from campus”
q: “You are a computer science major”
r: “You are a freshman”
Bit operations
⮚ Bit: A bit is a symbol with two possible values, namely, 0 (zero)

and 1 (one).
⮚ A bit can be used to represent a truth value as 1 for T and 0 for F
⮚ Bit string: A bit string is a sequence of bits. The length of the string
is number of bits in the string.
⮚ Example: 10101001 is a bit string of length eight
⮚ We define the bitwise OR, AND, and XOR of two strings of same
length to be the strings that have as their bits the OR, AND, and XOR
of the corresponding bits in the two strings, respectively.
⮚ We use the symbols ∨, ∧, and ⊕ to represent bitwise OR, AND,
and XOR, respectively.
Predicates and Quantifiers
⮚ The statements “x > 3”,“x = y + 3”, and “computer x is functioning
properly” are not propositions

⮚ This section discusses how proposition can be produced from


such statements
⮚ The statement “x > 3” has two parts –
⮚the variables x, the subject of the statement
⮚is greater than 3, the predicate, the property that the subject of
the statement can have
⮚ We denote P(x) =“x > 3”, where P denotes the predicate “is
greater than 3” and x is the variable
⮚ Once we assign a value to x, it becomes proposition
Predicates

⮚ Def: A predicate, or propositional function, is a function that


takes some variable(s) as arguments and returns True or False.
⮚ Example: Let P(x) =“x > 3”, what are the truth values of P(2) and
P(4)?
⮚ Sol: P(2) =“2 > 3” is false and P(4) =“4 > 3” is true
⮚ Example: Let Q(x, y) =“x = y + 3”, what are the truth values of
Q(1, 2) and Q(3, 0)?
⮚ Sol: Q(1,2)= “1=2+3” is false, Q(3,0)= “3=0+3” is true
Example
⮚ Example: Consider the statement
if x > 0 then x := x + 1.
Here P(x) =“x > 0”. If P(x) is true for the value of x, then the
assignment statement x := x + 1 is executed, x is increased by 1.
If P(x) is false for the value of x, then the assignment statement
is not executed, x remains same
⮚ The statements that describe valid input are known as
preconditions, and the conditions that the output should satisfy
when it has run are known as postconditions
⮚ Q7: Let R(x, y, z) =“x + y = z”, what are the truth values of R(1, 2,
3) and R(0, 0, 1)?
Quantifiers
In predicate logic, predicates are used alongside quantifiers to express
the extent to which a predicate is true over a range of elements. Using
quantifiers to create such propositions is called quantification.
⮚ Two types of quantifications:
⮚Universal quantifications – a predicate is true for every
element under consideration.
⮚Existential quantifications – there is one or more element under
consideration for which predicate is true.
Universal quantifiers
Def: The universal quantification of P(x) is the statement “P(x) for
all values of x in the domain”. The notation ∀x P(x) denotes the
universal quantification of P(x). Here ∀ is called universal
quantifier.
⮚ Quantifiers:

Statement When True? When False?


∀x P(x) ∃ x P(x) every x There is an x for which
P(x) is false
P(x) is true for There is an x for P(x) is false for every x
which P(x) is true
Universal Quantifiers
⮚ Example: Let P(x) =“x+1 > x”. What is the truth value of the
quantification ∀x P(x), where the domain consists of all real
numbers?
⮚ Sol: Because P(x) is true for all real numbers x, the quantification
∀x P(x) is true.
⮚ Example: Let Q(x) =“x < 2”. What is the truth value of the
quantification ∀x Q(x), where the domain consists of all real
numbers?
⮚ Sol: Because Q(x) is not true for every real number x, because, for
instance, Q(3) is false. That is, x=3 is a counterexample for the
statement ∀x Q(x).
Universal Quantifiers
⮚ Q8: Let P(x) =“x2 > 0”. What is the truth value of the
quantification ∀x P(x), where the domain consists of all real
numbers?

⮚ Q9: Let Q(x) =“x2 < 10”. What is the truth value of the
quantification ∀x Q(x), where the domain consists of positive
integers less than 4?
Existential Quantifiers
⮚ Def: The existential quantification of P(x) is the statement
“There exists an element x in the domain such that P(x)”. The
notation ∃ x P(x) denotes the existential quantification of P(x). Here
∃ is called existential quantifier.
⮚ Example: Let P(x) =“x > 3”. What is the truth value of the
quantification ∃x P(x), where the domain consists of all real
numbers?
⮚ Sol: Because P(x) is sometimes true - for instance, when x=4 – the
existential quantification of P(x), which is ∃x P(x), is true.
Existential quantifiers
⮚ Example: Let P(x) =“x = x+1”. What is the truth value of the
quantification ∃ x P(x), where the domain consists of all real
numbers?
⮚ Sol: Because P(x) is false for every real number x, the
quantification ∃ x P(x) is false.
⮚ Q11: Let Q(x) =“x2 > 10”. What is the truth value of the
quantification ∃ x Q(x), where the domain consists of positive
integers not exceeding 4?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy