comp 170 l2 part 3 of course chapter 3 of textbook
TRANSCRIPT
![Page 1: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/1.jpg)
COMP 170 L2
Part 3 of Course
Chapter 3 of Textbook
![Page 2: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/2.jpg)
COMP 170 L2
Introduction to Part 3
Objectives Introduce the basics of logic (L07, L08)
Develop a language for talking about proofs
Discuss the logic principles behind proofs (L09)
Page 2
![Page 3: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/3.jpg)
COMP 170 L2
L07: Intro to Logic
Objective Introduce basic ingredients of the language of logic.
Page 3
![Page 4: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/4.jpg)
COMP 170 L2
Outline
Example: Logic in programs
Logic statements, truth table, and equivalence
Basic laws about logic statements
Conditional connectives
Page 4
![Page 5: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/5.jpg)
COMP 170 L2
Logic in ProgramsPage 5
![Page 6: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/6.jpg)
COMP 170 L2
Logic in ProgramsPage 6
![Page 7: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/7.jpg)
COMP 170 L2Page 7
![Page 8: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/8.jpg)
COMP 170 L2
Outline
Example: Logic in programs
Logic statements, truth table, and equivalence
Basic laws about logic statements
Conditional connectives
Page 8
![Page 9: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/9.jpg)
COMP 170 L2
What make up logic statements?
Symbolic compound statements consist of
Variables, logical connectives, and conditional connectives
Page 9
![Page 10: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/10.jpg)
COMP 170 L2
Logic StatementsPage 10
![Page 11: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/11.jpg)
COMP 170 L2
Logic Statements can be True or False
Variables such as s, t, u can be either true (T) or false (F)
Meaning of connectives as follows:
Page 11
![Page 12: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/12.jpg)
COMP 170 L2
Truth Table for Logic Statements
Variables such as s, t, u can be either true (T) or false (F) Many possible scenarios
s = T, t=T, u=T;
s = T, t=T, u=F;
s = T, t=F, u=T;
….
Truth table Shows whether a compound statement is true for false in all cases Allow us to determine whether two statements are equivalent
Page 12
![Page 13: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/13.jpg)
COMP 170 L2
Truth Table for Statements Involving ONE Connective
Page 13
![Page 14: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/14.jpg)
COMP 170 L2
The two programs are equivalent because they are true in the same scenarios.
Page 14
![Page 15: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/15.jpg)
COMP 170 L2
EquivalencePage 15
![Page 16: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/16.jpg)
COMP 170 L2Page 16
![Page 17: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/17.jpg)
COMP 170 L2
Outline
Example: Logic in programs
Logic statements, truth table, and equivalence
Basic laws about logic statements
Conditional connectives
Page 17
![Page 18: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/18.jpg)
COMP 170 L2Page 18
Also: w \/ ( u /\ v) = (w \/ u ) /\ (w /\ v)
![Page 19: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/19.jpg)
COMP 170 L2Page 19
![Page 20: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/20.jpg)
COMP 170 L2Page 20
![Page 21: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/21.jpg)
COMP 170 L2
Outline
Example: Logic in programs
Logic statements, truth table, and equivalence
Basic laws about logic statements
Conditional connectives
Page 21
![Page 22: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/22.jpg)
COMP 170 L2
Conditional ConnectivesPage 22
![Page 23: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/23.jpg)
COMP 170 L2Page 23
![Page 24: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/24.jpg)
COMP 170 L2Page 24
![Page 25: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/25.jpg)
COMP 170 L2Page 25
Truth Table for Implication
![Page 26: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/26.jpg)
COMP 170 L2Page 26
Truth Table for Implication
![Page 27: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/27.jpg)
COMP 170 L2
Truth Table for ImplicationPage 27
![Page 28: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/28.jpg)
COMP 170 L2Page 28
![Page 29: COMP 170 L2 Part 3 of Course Chapter 3 of Textbook](https://reader034.vdocuments.net/reader034/viewer/2022051820/5697bf741a28abf838c7f96b/html5/thumbnails/29.jpg)
COMP 170 L2Page 29
Truth Table for If-and-Only-If