Discrete Structures Prepositional Logic 2 Dr Muhammad Humayoun

  • Slides: 58
Download presentation
Discrete Structures Prepositional Logic 2 Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer

Discrete Structures Prepositional Logic 2 Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore. mhumayoun@ciitlahore. edu. pk https: //sites. google. com/a/ciitlahore. edu. pk/dstruct/ Some of the material is taken from Dr. Muhammad Atif’s slides 1

Recap • 2

Recap • 2

Special Definitions • 3

Special Definitions • 3

Example • 4

Example • 4

Conditional Inverse Contrapositive 5

Conditional Inverse Contrapositive 5

Biconditionals Definition 6 Let p and q be propositions. The biconditional statement p ↔

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 biimplications. 7

Truth Table • p ↔ q has exactly the same truth value as (p

Truth Table • p ↔ q has exactly the same truth value as (p → q) ∧ (q → p) 8

Common ways to express p ↔ q • “p is necessary and sufficient for

Common ways to express p ↔ q • “p is necessary and sufficient for q” • “if p then q, and conversely” • “p iff q” 9

Example p: “You can take the flight” q: “You buy a ticket” p ↔

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 10

Precedence of Logical Operators 12

Precedence of Logical Operators 12

Logic and Bit Operations • Boolean values can be represented as 1 (true) and

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. – 10110100 is eight Boolean values in one string • We can then do operations on these Boolean strings – Each column is its own boolean operation 14

1. 2 Applications of Propositional Logic • • • Translating English sentences (Formalization) System

1. 2 Applications of Propositional Logic • • • Translating English sentences (Formalization) System Specifications Boolean Searches Logic circuits … 15

Translating English Sentences • 16

Translating English Sentences • 16

System Specifications • 18

System Specifications • 18

Consistency • System specifications should be consistent, – They should not contain conflicting requirements

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 19

Determine whether these system specifications are consistent: 1. The diagnostic message is stored in

Determine whether these system specifications are consistent: 1. The diagnostic message is stored in the buffer or it is retransmitted. 2. The diagnostic message is not stored in the buffer. 3. If the diagnostic message is stored in the buffer, then it is retransmitted. 20

Boolean Searches • Logical connectives are used extensively in searches of large collections of

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. 25

 • Finding Web pages about universities in New Mexico: • New AND Mexico

• 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 – ‘New Mexico’ Universities – Arizona Universities • (Mexico AND Universities) NOT New 26

Quiz • Let x = “ ”ﻟڑک Then x + “ ﻟڑکﺎ = ”ﺍ

Quiz • Let x = “ ”ﻟڑک Then x + “ ﻟڑکﺎ = ”ﺍ Write Boolean search capturing this pattern 27

Logic Puzzles • An island has two kinds of inhabitants, – Knights, who always

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? 28

Logic Circuits • 33

Logic Circuits • 33

34

34

35

35

1. 3 Propositional Equivalence • An important type of step used in a mathematical

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. 36

Tautology and Contradiction • 37

Tautology and Contradiction • 37

38

38

Logical Equivalences • Compound propositions that have the same truth values in all possible

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. 39

Standard equivalences • 41

Standard equivalences • 41

Standard equivalences • 42

Standard equivalences • 42

Standard Equivalences • 43

Standard Equivalences • 43

Standard equivalences • 44

Standard equivalences • 44

Standard equivalences • 45

Standard equivalences • 45

Distributive Law • 46

Distributive Law • 46

47

47

De Morgan’s Law • 48

De Morgan’s Law • 48

Generalization • 49

Generalization • 49

50

50

Absorption laws • 51

Absorption laws • 51

Negation laws • 52

Negation laws • 52

Implication • 53

Implication • 53

More Implication Laws • 54

More Implication Laws • 54

Bi-implications • 55

Bi-implications • 55

Using Logical Equivalence • 56

Using Logical Equivalence • 56

Using Logical Equivalence • 57

Using Logical Equivalence • 57

Do Exercises 58

Do Exercises 58