Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMP 170 L2 Part 3 of Course Chapter 3 of Textbook.

Similar presentations


Presentation on theme: "COMP 170 L2 Part 3 of Course Chapter 3 of Textbook."— Presentation transcript:

1 COMP 170 L2 Part 3 of Course Chapter 3 of Textbook

2 COMP 170 L2 Introduction to Part 3 l Objectives  Introduce the basics of logic (L07, L08)  Develop a language for talking about proofs  Discuss the logic principles behind proofs (L09) Page 2

3 COMP 170 L2 L07: Intro to Logic l Objective n Introduce basic ingredients of the language of logic. Page 3

4 COMP 170 L2 Outline l Example: Logic in programs l Logic statements, truth table, and equivalence l Basic laws about logic statements l Conditional connectives Page 4

5 COMP 170 L2 Logic in Programs Page 5

6 COMP 170 L2 Logic in Programs Page 6

7 COMP 170 L2 Page 7

8 COMP 170 L2 Outline l Example: Logic in programs l Logic statements, truth table, and equivalence l Basic laws about logic statements l Conditional connectives Page 8

9 COMP 170 L2 What make up logic statements? l Symbolic compound statements consist of n Variables, logical connectives, and conditional connectives Page 9

10 COMP 170 L2 Logic Statements Page 10

11 COMP 170 L2 Logic Statements can be True or False l Variables such as s, t, u can be either true (T) or false (F) l Meaning of connectives as follows: Page 11

12 COMP 170 L2 Truth Table for Logic Statements l Variables such as s, t, u can be either true (T) or false (F) n Many possible scenarios  s = T, t=T, u=T;  s = T, t=T, u=F;  s = T, t=F, u=T;  …. l Truth table n Shows whether a compound statement is true for false in all cases n Allow us to determine whether two statements are equivalent Page 12

13 COMP 170 L2 Truth Table for Statements Involving ONE Connective Page 13

14 COMP 170 L2 l The two programs are equivalent because they are true in the same scenarios. Page 14

15 COMP 170 L2 Equivalence Page 15

16 COMP 170 L2 Page 16

17 COMP 170 L2 Outline l Example: Logic in programs l Logic statements, truth table, and equivalence l Basic laws about logic statements l Conditional connectives Page 17

18 COMP 170 L2 Page 18 Also: w \/ ( u /\ v) = (w \/ u ) /\ (w /\ v)

19 COMP 170 L2 Page 19

20 COMP 170 L2 Page 20

21 COMP 170 L2 Outline l Example: Logic in programs l Logic statements, truth table, and equivalence l Basic laws about logic statements l Conditional connectives Page 21

22 COMP 170 L2 Conditional Connectives Page 22

23 COMP 170 L2 Page 23

24 COMP 170 L2 Page 24

25 COMP 170 L2 Page 25 Truth Table for Implication

26 COMP 170 L2 Page 26 Truth Table for Implication

27 COMP 170 L2 Truth Table for Implication Page 27

28 COMP 170 L2 Page 28

29 COMP 170 L2 Page 29 Truth Table for If-and-Only-If


Download ppt "COMP 170 L2 Part 3 of Course Chapter 3 of Textbook."

Similar presentations


Ads by Google