Lecture 01
Lecture 01
Lecture 01
(CSC 0611101)
Chapter 1
1.1 Propositional Logic
2
Reasoning is the
3
Key Terms
Propositional variable: A variable that represents a
proposition. The conventional letters used for propositional
variables are p, q, r, s, t,..
Compound proposition: A proposition constructed by
combining two or more propositions using logical
operators(AKA : logical connectives)
Logical Operators: Operators used to combine propositions
Truth Value: The truth value of a proposition is true, denoted
by T, if it is a true statement and false, denoted by F, if it is a
false statement. Truth Value ==> True/False
Truth Table: A table displaying the truth values of
propositions.
4
Proposition: Examples
3 + 2 = 32 Bring me coffee!
3+2=5 3+2
5
Proposition: More Examples
Which of the following are propositions? What are the truth values of
those that are propositions?
a. Read this carefully.
b. 2 + 2 = 4.
c. Comilla is the capital of Bangladesh.
d. What time is it?
6
Solution
Solution.
a. Not a proposition.
b. A proposition with truth value (T).
c. A proposition with truth value (F).
d. Not a proposition.
7
Proposition: More Examples
• Which of the following are propositions? What are
the truth values of those that are propositions?
a) 5 + 7 = 17
b) Answer the question
c) x + 2 = 13
d) x + y = z
e) UU is the best Private university in Bangladesh
8
Logical operators
• Logical operators ==> unary, binary
• Unary:
– Negation
• Binary
– Conjunction
– Disjunction
– Exclusive OR
– Implication
– Biconditional
9
Logical Operators
Operator Symbol Usage
Negation NOT
Conjunction AND
Disjunction OR
Exclusive or XOR
Conditional if, then
Biconditional iff
10
Propositional Logic -
Negation
• Let p be a proposition. The negation of p, denoted by
p (orp), is the statement “It is not the case that p.”
• The proposition p is read “not p”
• The truth value of the negation of p, p, is the
opposite of the truth value of p.
11
Propositional Logic -
Negation
• Negation just turns a false proposition to true and the
opposite for a true proposition.
12
Truth table for Negation
13
Negation: More Example
• Example: Find the negation of the proposition
“Today is Friday.”
14
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 p q is true when both p and q are
true and is false otherwise.
• Conjunction corresponds to English “and.”
15
Truth Table for Conjunction
16
Conjunction: Example
• Example: P:‘I am going to town’
Q: ‘It is going to rain’
17
Conjunction: Example
p = “Clinton was the president.”
q = “Monica was the president.”
r = “The meaning of is important.”
• Assuming p and r are true, while q false.
Out of pq, pr, qr , only p r is true.
Q: what is the value of pqr?
18
Conjunction
• Conjunction is a binary operator in that it
operates on two propositions when creating
compound proposition. On the other hand,
negation is a unary operator.
19
Disjunction
• Let p and q be propositions.
• The disjunction of p and q, denoted by p q, is the
proposition “p or q.”
• The disjunction p q is false when both p and q are
false and is true otherwise.
• Disjunction is true when at least one of the
components is true.
• Disjunction corresponds to English “or.”
– Ex. Michael is brave OR intelligent
20
Truth Table for Disjunction
21
Examples of Conjunction & Disjunction
Let,
p:5<9
q : 9 < 7.
Construct the propositions pq and p ν q.
Solution:
The conjunction of the propositions p and q is the proposition
pq : 5 < 9 and 9 < 7
The disjunction of the propositions p and q is the proposition
p v q : 5 < 9 or 9 < 7
22
Example 5 & 6(Page 4 & 5): Examples of
Conjunction & Disjunction
Consider the following propositions:
p : It is Friday
q : It is raining.
Construct the propositions p ^ q and p ν q.
Solution:
The conjunction of the propositions p and q is the proposition
p q : It is Friday and it is raining.
The disjunction of the propositions p and q is the proposition
p v q : It is Friday or It is raining.
23
Exclusive Or
• Let p and q be propositions.
• The exclusive or of p and q, denoted by p q,
is the proposition that is true when exactly
one of p and q is true and is false otherwise.
24
Truth Table of Exclusive Or
25
Example of Exclusive Or
• Construct a truth table for (p q) r.
Solution:
26
Conditional Statements
• Let p and q be propositions.
• The conditional statement p q is the proposition “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 hypothesis and
q is called conclusion.
• This one is the English usage of “if, then” or “implies”.
• The connective is called the ‘conditional connective’.
• A conditional statement is also called an implication.
27
Truth Table for Conditional Statement
28
Conditional Statements
• In terms of words, the proposition p q
also reads:
(a) if p, then q
(b) p implies q
(c) p is a sufficient condition for q
(d) q is a necessary condition for p
(e) p only if q
29
Example1 of Conditional Statement
p = “Cruise ships only go on big rivers.”
q = “Cruise ships go on the Hudson.”
r = “The Hudson is a big river.”
r = “The Hudson is not a big river.”
30
Example2 of Conditional Statement
• Let p : "Maria learns discrete mathematics" and
q : "Maria will find a good job."
Express the statement p q as a statement in English.
Solution:
"If Maria learns discrete mathematics, then she will find a good job.“
• There are many other ways to express this conditional statement in
English.
– "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 discrete
mathematics.”
31
Converse, Contrapositive, and Inverse
We can form some new conditional statements starting with
a conditional statement p q
32
Examples of Converse, Contrapositive and Inverse
Converses: p q ==> q p
• Ex: “If it is noon, then I am hungry.”
“If I am hungry, then it is noon.”
Contrapositives: p q ==> q p
• Ex: “If it is noon, then I am hungry.”
“If I am not hungry, then it is not noon.”
Inverses: p q ==> p q
• Ex: “If it is noon, then I am hungry.”
“If it is not noon, then I am not hungry.”
33
Bi-Conditional
• Let p and q be propositions.
• The biconditional statement 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, and is false otherwise.
• Biconditional statements are also called “bi-implications”
• Question : Which operator is the opposite of ?
• Answer: has exactly the opposite truth table as .
34
Truth Table for Biconditional p q
35
Example
• Show that the bi-conditional proposition of p and q is
logically equivalent to the conjunction of the conditional
propositions p q and q p:
• Solution
36
Example of Biconditional statement
• Example 10 ( Page 9): Let p be the statement “ You
can take the flight” and q be the statement “ You buy
a ticket”.
What is the statement for p q ?
Solution:
“You can take the flight if and only if you buy a ticket”
37
Truth Tables of Compound Propositions
38
Truth Tables of Compound Propositions
39
A Demonstration That p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨
r) Are Logically Equivalent.
40
Precedence of Logical Operators
• Negation operator is applied before all other logical
operators
• Conjunction operator takes precedence over
disjunction operator
• Conditional and biconditional operators have lower
precedence
• Parentheses are used whenever necessary
41
Precedence of Logical Operators
42
Logic and Bit Operations
• bit ==> binary digit
• Boolean variable: either true or false
– Can be represented by a bit
• Bit String: A bit string is a sequence of zero or more
bits. The length of the string is the number of bits in
the string.
• Example 20(p.15): 101010011 is a bit string of length
nine
43
Bit operations
• 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
⊕, the tables shown in Table 9 for the corresponding
bit operations are obtained. We will also use the
notation OR, AND, and XOR for the operators ∨,∧,
and ⊕ respectively, as is done in various
programming languages.
44
Table for Bit Operations
45
Bit string and bit operation
46