Download presentation
Presentation is loading. Please wait.
1
Discrete Structures Prepositional Logic 2
Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore. Some of the material is taken from Dr. Muhammad Atifโs slides
2
Recap Truth table: A truth table displays the relationship between the truth values of propositions. A table has 2 ๐ rows where ๐ is number of proposition variables. Exclusive or: โ ๐โ๐ is true when exactly one of ๐ and ๐ is true and is false otherwise. Exercise: Draw a truth table of (๐โ๐)โจ(๐โ๐)
3
Special Definitions ๐โ๐ Inverse:ยฌ๐โยฌ๐ Converse: ๐โ๐
Contrapositive: ยฌ๐โยฌ๐
4
Example Pakistani team wins whenever it is raining p: It is raining q: Pakistani team wins q whenever p โก if p, then q (๐โ๐) If it is raining, then Pakistani team wins. Inverse:ยฌ๐โยฌ๐ If it isnโt raining, then Pakistani team doesnโt win. Converse : ๐โ๐ If Pakistani team wins, then it is raining. Contrapositive: ยฌ๐โยฌ๐ If Pakistani team doesnโt win, then it isnโt raining.
5
๐ ๐ ๏๐ ๏๐ ๐ ๏ฎ ๐ ๏๐ ๏ฎ ๏๐ ๐ ๏ฎ ๐ ๏๐ ๏ฎ ๏๐ ๐ ๐น Conditional Inverse Converse
Contrapositive ๐ ๐ ๏๐ ๏๐ ๐ ๏ฎ ๐ ๏๐ ๏ฎ ๏๐ ๐ ๏ฎ ๐ ๏๐ ๏ฎ ๏๐ ๐ ๐น
6
Conditional โกContrapositive
๐โ๐ โกยฌ๐โยฌ๐ Inverse โก Converse ยฌ๐โยฌ๐ โก๐โ๐
7
Biconditionals Definition 6 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.
8
Truth Table p โ q has exactly the same truth value as
(p โ q) โง (q โ p)
9
Common ways to express p โ q
โp is necessary and sufficient for qโ โif p then q, and converselyโ โp iff qโ
10
Example p: โYou can take the flightโ q: โYou buy a ticketโ p โ q: You can take the flight if and only if you buy a ticket You can take the flight iff you buy a ticket The fact that you can take the flight is necessary and sufficient for buying a ticket
11
You can take flight if and only if you buy a ticket
p: You can take flight q: You buy a ticket ๐โ๐ You can take flight if and only if you buy a ticket What is the truth value when: you buy a ticket and you can take the flight ?? ๐โ๐โก๐ you donโt buy a ticket and you canโt take the flight ?? ๐นโ๐นโก๐ you buy a ticket but you canโt take the flight ?? ๐โ๐นโก๐น you canโt buy a ticket but can take the flight ?? ๐นโ๐โก๐น
12
Precedence of Logical Operators
(๐โ๐)โจ(๐โ๐) Can be written as (๐โ๐)โจ๐โ๐ (T/F) ? ยฌ๐โง๐ ๐โจ๐โ๐โจ๐ ๐โง๐โจ๐ ๐โง๐โง๐ ๐โจ๐โจ๐
13
Exercise: For which values of a, b and c one gets 0 in the truth table of ๐โง ๐โ๐ โ( ๐โ๐ โง๐)
14
Logic and Bit Operations
Boolean values can be represented as 1 (true) and 0 (false) A bit string is a series of Boolean values. Length of the string is the number of bits. is eight Boolean values in one string We can then do operations on these Boolean strings Each column is its own boolean operation
15
1.2 Applications of Propositional Logic
Translating English sentences (Formalization) System Specifications Boolean Searches Logic circuits โฆ
16
Translating English Sentences
You can access the Internet from campus only if you are a computer science major or you are not a freshman. ๐: You can access the Internet from campus ๐: You are a computer science major ๐: you are a freshman ๐โ (๐โจยฌ๐)
17
You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old. ๐: you can ride roller coaster ๐ : you are under 4 feet ๐ : you are older than 16 years old ๐โงยฌ๐ โยฌ๐
18
System Specifications
The automated reply cannot be sent when the file system is full p: The automated reply can be sent q: The system is full ๐ โถยฌ๐
19
Consistency System specifications should be consistent,
They should not contain conflicting requirements that could be used to derive a contradiction When specifications are not consistent, there would be no way to develop a system that satisfies all specifications
20
Determine whether these system specifications are consistent:
The diagnostic message is stored in the buffer or it is retransmitted. The diagnostic message is not stored in the buffer. If the diagnostic message is stored in the buffer, then it is retransmitted.
21
Determine whether these system specifications are consistent:
The diagnostic message is stored in the buffer or it is retransmitted. The diagnostic message is not stored in the buffer. If the diagnostic message is stored in the buffer, then it is retransmitted. p: The diagnostic message is stored in the buffer q: The diagnostic message is retransmitted 1. ๐โจ๐ ยฌ๐ ๐โ๐
22
1. ๐โจ๐ ยฌ๐ ๐โ๐ Reasoning An assignment of truth values that makes all three specifications true must have p false to make ๏ฟข๐ true. Because we want ๐ โจ ๐ to be true but ๐ must be false, q must be true. Because ๐ โ ๐ is true when ๐ is false and ๐ is true we conclude that these specifications are consistent Let us do it with truth table now
23
Is it remain consistent if the specification
โThe diagnostic message is not retransmittedโ is added? p: The diagnostic message is stored in the buffer q: The diagnostic message is retransmitted 1. ๐โจ๐ ยฌ๐ ๐โ๐
24
Inconsistent Is it remain consistent if the specification
โThe diagnostic message is not retransmittedโ is added? p: The diagnostic message is stored in the buffer q: The diagnostic message is retransmitted 1. ๐โจ๐ ยฌ๐ ๐โ๐ 4. ยฌ๐ Inconsistent
25
Boolean Searches Logical connectives are used extensively in searches of large collections of information, such as indexes of Web pages. Because these searches employ techniques from propositional logic, they are called Boolean searches.
26
Finding Web pages about universities in New Mexico:
New AND Mexico AND Universities โNew Mexicoโ Universities New Universities in Mexico โNew Mexicoโ AND Universities (New AND Mexico OR Arizona) AND Universities Arizona Universities (Mexico AND Universities) NOT New
27
Quiz Let x = โฺฺูฉโ Then x + โุงโ = ฺฺูฉุง
Write Boolean search capturing this pattern
28
Logic Puzzles An island has two kinds of inhabitants,
Knights, who always tell the truth Knaves, who always lie. You encounter two people A and B. What are A and B if A says โB is a knightโ B says โThe two of us are opposite types?
29
p: A is a knight ยฌ๐: A is a knave q: B is a knight ยฌ๐: B is a knave
A says โB is a knightโ B says โThe two of us are opposite types? p: A is a knight ยฌ๐: A is a knave q: B is a knight ยฌ๐: B is a knave
30
p: A is a knight ยฌ๐: A is a knave q: B is a knight ยฌ๐: B is a knave
A says โB is a knightโ B says โThe two of us are opposite types? p: A is a knight ยฌ๐: A is a knave q: B is a knight ยฌ๐: B is a knave First possibility: A is a knight; that is p is true.
31
p: A is a knight ยฌ๐: A is a knave q: B is a knight ยฌ๐: B is a knave
A says โB is a knightโ B says โThe two of us are opposite types? p: A is a knight ยฌ๐: A is a knave q: B is a knight ยฌ๐: B is a knave First possibility: A is a knight; that is p is true. If A is a knight, then he is telling the truth when he says that B is a knight, so that q is true, and A and B are the same type (both knight). But, if B is a knight, then Bโs statement that A and B are of opposite types (p โง๏ฟขq) โจ (๏ฟขp โง q), have to be true. But it is not; because A and B are both knights. Not consistent. Conclusion: A is not a knight (p is false).
32
p: A is a knight ยฌ๐: A is a knave q: B is a knight ยฌ๐: B is a knave
A says โB is a knightโ B says โThe two of us are opposite types? p: A is a knight ยฌ๐: A is a knave q: B is a knight ยฌ๐: B is a knave Second possibility: A is a knave; that is p is false. If A is a knave, then he is telling lie when he says that B is a knight. So B is knave (q is false). Also when B says that A and B are of opposite types (p โง๏ฟขq) โจ (๏ฟขp โง q), he again lies. Conclusion: A and B are both knaves.
33
Logic Circuits Propositional logic can be applied to the design of computer hardware A logic circuit (or digital circuit) receives input signals ๐ 1 , ๐ 2 , , ๐ ๐ , each a bit [either 0 (off) or 1 (on)], and produces output signals ๐ 1 , ๐ 2 , , ๐ ๐ , each a bit.
34
Quiz: Draw ๐โงยฌ๐ โจยฌ๐
35
Quiz: Draw ๐โงยฌ๐ โจยฌ๐
36
1.3 Propositional Equivalence
An important type of step used in a mathematical argument is the replacement of a statement with another statement with the same truth value Propositional Equivalence is extensively used in the construction of mathematical arguments.
37
Tautology and Contradiction
A compound proposition which is always true, is called tautology. For example, ยฌ๐โจ๐, ๐โ๐, ๐โ(๐โ๐) A compound proposition which is always false, is called contradiction. For example, ยฌ๐โง๐, ยฌ(๐โ๐), ๐โง๐ โงยฌ๐
38
Example on notebook: ๐โ(๐โ๐) ๐โ๐
39
Logical Equivalences Compound propositions that have the same truth values in all possible cases are called logically equivalent. The compound propositions p and q are called logically equivalent if p โ q is a tautology. The notation p โก q denotes that p and q are logically equivalent.
40
Show that ยฌ ๐โจ๐ โกยฌ๐โงยฌ๐
41
Standard equivalences
Identity ๐ โง ๐ป โก ๐ ๐ โจ ๐ญ โก ๐ Domination ๐ โจ ๐ป โก ๐ป ๐ โง ๐ญ โก ๐ญ
42
Standard equivalences
Idempotence ๐โง๐โก๐ ๐โจ๐โก๐ Double Negation ยฌยฌ๐โก๐
43
Standard Equivalences
Commutative law: ๐โง๐โก๐โง๐ ๐โจ๐โก๐โจ๐ ๐โ๐โก๐โ๐
44
Standard equivalences
Associativity ๐โง๐ โง๐โก๐โง ๐โง๐ ๐โจ๐ โจ๐โก๐โจ ๐โจ๐ ๐โ๐ โ๐โก๐โ(๐โ๐)
45
Standard equivalences
Inversion ยฌ๐โก๐น ยฌ๐นโก๐ Negation ยฌ๐ โก (๐โ๐น) Contradiction ๐โงยฌ๐ โก ๐น
46
Distributive Law ๐โง ๐โจ๐ โก ๐โง๐ โจ ๐โง๐ ๐โจ ๐โง๐ โก ๐โจ๐ โง ๐โจ๐
48
ยฌ ๐โง๐ โกยฌ๐โจยฌ๐ ยฌ ๐โจ๐ โกยฌ๐โงยฌ๐ De Morganโs Law
ยฌ( ๐ 1 โง ๐ 2 โง ยท ยท ยท โง ๐ ๐ ) โก (ยฌ ๐ 1 โจยฌ ๐ 2 โจ ยทยทยท โจยฌ ๐ ๐ ) ยฌ ๐โจ๐ โกยฌ๐โงยฌ๐ ยฌ ( ๐ 1 โจ ๐ 2 โจ ยท ยท ยท โจ ๐ ๐ )โก (ยฌ ๐ 1 โงยฌ ๐ 2 โง ยทยทยท โง ยฌ๐ ๐ )
49
Generalization De Morganโs Laws ยฌ ๐=1 ๐ ๐ ๐ โก ๐=1 ๐ ยฌ ๐ ๐
๐=1 ๐ ๐ ๐ ๐๐๐ ๐๐ ๐ข๐ ๐๐ ๐๐๐ ๐ 1 โง ๐ 2 โงโฆโง ๐ ๐ ๐=1 ๐ ๐ ๐ ๐๐๐ ๐๐ ๐ข๐ ๐๐ ๐๐๐ ๐ 1 โจ ๐ 2 โจโฆโจ ๐ ๐ De Morganโs Laws ยฌ ๐=1 ๐ ๐ ๐ โก ๐=1 ๐ ยฌ ๐ ๐ ยฌ( ๐=1 ๐ ๐ ๐ ) โก ๐=1 ๐ ยฌ๐ ๐
51
Absorption laws ๐ โจ (๐ โง ๐) โก ๐ ๐ โง ๐ โจ ๐ โก ๐
52
Negation laws ๐ โจ๏ฟข๐ โก ๐ป ๐ โง๏ฟข๐ โก ๐ญ
53
Implication ๐โ๐โกยฌ๐โจ๐ ๐โจ๐โกยฌ๐โ๐
54
More Implication Laws ๐ โ ๐ โก ๏ฟข๐ โ๏ฟข๐ ๐ โง ๐ โก ๏ฟข(๐ โ๏ฟข๐) ยฌ(๐ โ ๐) โก ๐ โง๏ฟข๐
(๐ โ ๐) โง (๐ โ ๐) โก ๐ โ (๐ โง ๐) (๐ โ ๐) โง (๐ โ ๐) โก (๐ โจ ๐) โ ๐ (๐ โ ๐) โจ (๐ โ ๐) โก ๐ โ (๐ โจ ๐) (๐ โ ๐) โจ (๐ โ ๐) โก (๐ โง ๐) โ ๐
55
Bi-implications ๐ โ ๐ โก (๐ โ ๐) โง (๐ โ ๐) ๐ โ ๐ โก ๏ฟข๐ โ๏ฟข๐
๐ โ ๐ โก (๐ โง ๐) โจ (๏ฟข๐ โง๏ฟข๐) ๏ฟข(๐ โ ๐) โก ๐ โ๏ฟข๐
56
Using Logical Equivalence
Show that ๏ฟข(๐ โ ๐) and ๐ โง๏ฟข๐ are logically equivalent. Show that ๏ฟข(๐ โจ (๏ฟข๐ โง ๐)) and ๏ฟข๐ โง๏ฟข๐ are logically equivalent by developing a series of logical equivalences. Prove that (๐โง๐)โ(๐โจ๐) is a tautology.
57
Using Logical Equivalence
Ex: Prove that ๐โง๐ โ(๐โจ๐) is a tautology. To show that this statement is a tautology, we will use logical equivalences to demonstrate that it is logically equivalent to T ๐ โง ๐ โ ๐ โจ ๐ โกยฌ ๐ โง ๐ โจ ๐ โจ ๐ Implication equivalence โก ยฌ๐โจยฌ๐ โจ ๐ โจ ๐ 1st De Morgan law โกยฌ๐โจ(ยฌ๐โจ ๐ โจ ๐ ) Associative law โกยฌ๐โจ(๐โจ ยฌq โจ ๐ ) Commutative law โก(ยฌ๐โจ๐)โจ ยฌq โจ ๐ Associative law โก๐โจ๐ Tautologies โก๐ Idempotence
58
Do Exercises
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.