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

3 Proposition Logic

Uploaded by

somanfatima33
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)
3 views

3 Proposition Logic

Uploaded by

somanfatima33
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/ 28

1

CSC102: Discrete Structure


Lecture #: 3
Unit #: 1
Instructor:
MISHAL IQBAL

COMSATS University Islamabad


Vehari Campus
Topics 2

Proposition Logic
Compound Propositions
Applications of Propositional
Logic
Logic on 3

Logic is the basis of all mathematical reasoning,


and of all automated reasoning (Crucial for
mathematical reasoning)
It helps us to understand how to construct a valid
argument
Logic defines:
Syntax of statements
The meaning of statements
The rules of logical inference (manipulation)
Logic on 4

The rules of logic specify the meaning of


mathematical statements.
These rules are used to distinguish between valid
and invalid mathematical arguments.
For instance, these rules help us understand and
reason with statements such as:
 There exists an integer that is not the sum of two
squares”
 For every positive integer n, the sum of the positive
integers not exceeding n is n(n + 1)/2.
Logic on 5

It has practical applications:


 To the design of computing machines (computer
circuits)
 To the specification of systems
 To artificial intelligence
 To the construction of computer programs
 To the verification of the correctness of programs
 To programming languages
 To define a formal language for representing
knowledge and for making logical inferences and to
other areas of computer science
Logic Overview
Logic (Propositional ) is a system based on
6

propositions.
A proposition is a (declarative) statement that is
either true or false but not both.
We say that the truth value of a proposition is
either true (T) or false (F).
Examples: Islamabad is Capital of Pakistan.
(True)
– 5 + 2 = 8. (False)
It is raining today. (either
True or False)
Logic
Propositional variables (or
Overview
statement
7

variables), that is, variables that


Logic (Propositional ) is a system based on
represent
propositions, just as letters are used to denote
propositions.
numerical variables.
A proposition is a (declarative) statement that is
The conventional letters used for propositional
either true or false but not both.
variables are p, q, r, s, . . . .
We say that the truth value of a proposition is
The truth value of a proposition is true, denoted
either true (T) or false (F).
by T, if it is a true proposition, and the truth value
Examples: Islamabad
of a proposition is Capital
is false, denotedof by
Pakistan.
F, if it is a
(True)
false proposition.
The area of logic that – 5deals
+ 2 =with
8. (False)
propositions is
called the propositional calculus
It is raining today. (either or
Propositions Overview 8

Many mathematical statements are constructed


by combining one or more propositions.
New propositions, called compound
propositions, are formed from existing
(elementary) propositions using logical operators.

Example:
 Proposition A: It rains outside
 Proposition B: We will see a movie
A new (combined) proposition:
 If it rains outside then we will see a movie
Propositions Operators 9

Logical connectives (operators):


 Negation ( ¬ )
 Conjunction (∧)
 Disjunction (∨)
 Exclusive OR (⊕)
 Implication or conditional (→)
 Bi-conditional (↔)
Propositions (¬) 10

“Ahsan’s PC runs Linux”


Negation: “It is not case that Ahsan’s PC runs Linux”
“Aslam’s smartphone has at least 32GB of memory”
Negation: “It is not case that Aslam’s smartphone has at
least 32GB of memory”
“Aslam’s smartphone does not has at least 32GB of
memory”
Propositions (∧) 11

 Find the conjunction of the following propositions:


p: “Aslam’s PC has more than 16 GB free hard disk
space”
q: “The processor in Aslam’s PC runs faster than 1
GHz.”
 Conjunction of p and q:
p ∧ q, is the proposition “Aslam’s PC has more than
16 GB free hard disk space, and the processor in
Aslam’s PC runs faster than 1 GHz.”
“Aslam’s PC has more than 16 GB free hard disk
space, and its processor runs faster than 1 GHz.”
Propositions (∨) 12

Connective or (Inclusive way)


 Find the disjunction of the following propositions:
p: “Aslam’s PC has more than 16 GB free hard disk
space”
q: “The processor in Aslam’s PC runs faster than 1
GHz.”
 Disjunction of p and q:
p ∧ q, is the proposition “Aslam’s PC has more than
16 GB free hard disk space, or the processor in
Aslam’s PC runs faster than 1 GHz.”
Propositions (⊕) 13

Connective or (Exclusive way)


 Sometimes, we use connective or in an
exclusive sense.
 When the exclusive or is used to
connect the propositions p and q, the
proposition “p or q (but not both)” is
obtained.
 This proposition is true when p is true
and q is false, and when p is false and q
is true. It is false when both p and q are
Propositions Statement 14

 Because conditional statements play


such an essential role in mathematical
reasoning, a variety of terminology is
 used
“if p, to express
then q” p
→“qq. if p”  “a sufficient
 “q whenever condition for q is
 “p implies q” p”
p”
 “q is necessary for
 “if p, q”  “q when p”
p”
 “p only if q”  “q follows from
 “a necessary
 “p is sufficient p”
condition for p is
Propositions Statement 15

 Example:
“If I am elected, then I will lower taxes.”
“If you get 100% on the final, then you will
Let an
get p be
A.”the 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.
“If Maria learns discrete mathematics, then she will find a
good job.”
“Maria will find a good job when she learns discrete
mathematics.”
“For Maria to get a good job, it is sufficient for her to learn
discrete mathematics.”
“Maria will find a good job unless she does not learn
 We can form some new conditional statements starting
Propositions Statement
with a conditional statement p → q.
16

 In particular, there are three related conditional


statements that occur so often that they have special
names.
 Converse: The proposition q → p is called the
converse of p → q.
 Contrapositive:
The contrapositive of p → q is the proposition ¬
q → ¬ p.
OR
The proposition ¬ q → ¬ p is called the
contrapositive of p → q.

Propositions Statement 17

Implication Converse Contrapositive Inverse


p q p→q p q q→p ¬p ¬q ¬q → ¬p ¬p ¬q ¬p → ¬q
T T T T T T F F T F F T
T F F T F T F T F F T T
F T T F T F T F T T F F
F F T F F T T T T T T T
 The contrapositive, ¬ q → ¬ p, of a conditional statement
p → q always has the same truth value as p → q.
 The contrapositive is false only when ¬ p is false and ¬
q is true, that is, only when p is true and q is false.
 Neither the converse, q → p, nor the inverse, ¬ p → ¬ q,
has the same truth value as p → q for all possible truth
values of p and q.
 Note that when p is true and q is false, the original
conditional statement is false, but the converse and the
Propositions Statement 18

Implication Converse Contrapositive Inverse


p q p→q p q q→p ¬p ¬q ¬q → ¬p ¬p ¬q ¬p → ¬q
T T T T T T F F T F F T
T F F T F T F T F F T T
F T T F T F T F T T F F
F F T F F T T T T T T T

 When two compound propositions always have the


same truth value we call them equivalent.
 A conditional statement and its contrapositive are
equivalent.
 The converse and the inverse of a conditional statement
are also equivalent.
Propositions
Example: Statement 19

 What are the contrapositive, the converse, and the


inverse of the conditional statement “The home team
wins whenever it is raining?”
Solution: One way to express p → q is “q whenever p” so
original conditional statement can be written as:
“If it is raining, then the home team wins.”
 Contrapositive: “If the home team does not win, then it
is not raining.”
 Converse: “If the home team wins, then it is raining.”
 Inverse: “If it is not raining, then the home team does
not win.”
Only the contrapositive is equivalent to the original
Propositions Statement 20

 Note that the statement p ↔ q is true


when both the conditional statements
p → q and q → p are true and is false
otherwise.
 That is why we use the words “if and
only if” to express this logical
“p is necessary
connective
and sufficient
 There are some other common ways to for q”
express
“if p then q, and
p ↔ q: conversely”
 Note that p ↔ q has exactly the same “p iff q.”
Propositions Statement 21

 Let p be the statement “You can take the flight,” and let
q be the statement “You buy a ticket.”
Solution: p ↔ q is the statement
“You can take the flight if and only if you buy a ticket.”
Propositions Table 22

 Construct the truth table of the compound proposition


(p ∨ ¬ q) → (p ∧ q).
Propositions Operator 23

 We can construct compound propositions using


the negation operator and the logical operators
 The negation operator is applied before all
other logical operators.
 This means that ¬ p ∧ q is the conjunction of ¬
p and q, namely, ( ¬ p) ∧ q, not the negation of
the conjunction of p and q, namely ¬ (p ∧ q).
 The conjunction operator takes precedence
over the disjunction operator, so that p ∧ q ∨ r
means (p ∧ q) ∨ r rather than p ∧ (q ∨ r).
 We will use parentheses so that the order of
the disjunction and conjunction operators is
Propositions Operator 24

 The conditional → and biconditional ↔


operators have lower precedence than the
conjunction ∧ and disjunction ∨ operators.
 Consequently, p ∨ q → r is the same as (p ∨
q) → r.
 Although the conditional → operator has
precedence over the biconditional ↔
operator
 We will use parentheses when the order of
the conditional operator and biconditional
operator is at issue.
Compound
 Computers represent information usingBit
bits. A bit is a
25

Propositions
symbol Operations
with two possible values, namely, 0 (zero) and 1
(one).
 1 represents T (true), 0 represents F (false).
 A variable is called a Boolean variable if its value is
either true or false.
 Consequently, a Boolean variable can be represented
using a bit.
 Computer bit operations correspond to the logical
connectives.
 By replacing true by a one and false by a zero in the truth
tables for the operators ∧, ∨, and ⊕ as follows:
 We will also use the notation OR, AND,
Compound Logic and Bit 26

Propositions Operations
Example:
 Find the bitwise OR, bitwise AND, and bitwise XOR of the
bit strings 01 1011 0110 and 11 0001 1101.
Solution:
 The bitwise OR, bitwise AND, and bitwise XOR of these
strings are obtained by taking the OR, AND, and XOR of
the corresponding bits, respectively
Proposition Logic Applications 27

 Translating English
 Logic Puzzles
Sentences
 System Specifications  Logic Circuits

 Boolean Searches

Basic logic gates

Combinatorial circuit
28

You might also like