CSE 311: Foundations of Computing I. Lecture 1: Propositional Logic

Similar documents
CSE 311: Foundations of Computing I. Lecture 1: Propositional Logic

Adam Blank Spring 2017 CSE 311. Foundations of Computing I

CSE 311: Foundations of Computing I. Spring 2015 Lecture 1: Propositional Logic

CSE 311: Foundations of Computing I

Introduction Propositional Logic

Course Staff. Textbook

Math.3336: Discrete Mathematics. Applications of Propositional Logic

CS 340: Discrete Structures for Engineers

CSE507. Course Introduction. Computer-Aided Reasoning for Software. Emina Torlak

EECS 1028 M: Discrete Mathematics for Engineers

HW1 graded review form? HW2 released CSE 20 DISCRETE MATH. Fall

Overview, cont. Overview, cont. Logistics. Optional Reference #1. Optional Reference #2. Workload and Grading

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

CSE507. Introduction. Computer-Aided Reasoning for Software. Emina Torlak courses.cs.washington.edu/courses/cse507/17wi/

About the course. CSE 321 Discrete Structures. Why this material is important. Topic List. Propositional Logic. Administration. From the CSE catalog:

Boolean Logic. CS 231 Dianna Xu

CSE 240 Logic and Discrete Mathematics

ICS141: Discrete Mathematics for Computer Science I

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Example. Logic. Logical Statements. Outline of logic topics. Logical Connectives. Logical Connectives

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

NP-Completeness Part II

Propositional Logic. Spring Propositional Logic Spring / 32

2/13/2012. Logic: Truth Tables. CS160 Rosen Chapter 1. Logic?

Proposition/Statement. Boolean Logic. Boolean variables. Logical operators: And. Logical operators: Not 9/3/13. Introduction to Logical Operators

Logical Agents. Knowledge based agents. Knowledge based agents. Knowledge based agents. The Wumpus World. Knowledge Bases 10/20/14

MAT2345 Discrete Math

Lecture 02: Propositional Logic

AS 101: The Solar System (Spring 2017) Course Syllabus

Logic and Proofs. (A brief summary)

Definition 2. Conjunction of p and q

CSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal

Math.3336: Discrete Mathematics. Propositional Equivalences

CS 220: Discrete Structures and their Applications. Propositional Logic Sections in zybooks

Discrete Mathematics

CSE 241 Class 1. Jeremy Buhler. August 24,

Discrete Structures for Computer Science

Introducing Proof 1. hsn.uk.net. Contents

LOGIC CONNECTIVES. Students who have an ACT score of at least 30 OR a GPA of at least 3.5 can receive a college scholarship.

Today s Menu. Administrativia Two Problems Cutting a Pizza Lighting Rooms

CSE 20 DISCRETE MATH WINTER

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

COMP 2600: Formal Methods for Software Engineeing

MATH 341, Section 001 FALL 2014 Introduction to the Language and Practice of Mathematics

AI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic

Introduction to Theoretical Computer Science

Overview. 1. Introduction to Propositional Logic. 2. Operations on Propositions. 3. Truth Tables. 4. Translating Sentences into Logical Expressions

CS Lecture 19: Logic To Truth through Proof. Prof. Clarkson Fall Today s music: Theme from Sherlock

Preparing for the CS 173 (A) Fall 2018 Midterm 1

An Introduction to Logic 1.1 ~ 1.4 6/21/04 ~ 6/23/04

CS446: Machine Learning Spring Problem Set 4

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

Math 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011

Introduction Propositional Logic. Discrete Mathematics Andrei Bulatov

CSE 311 Lecture 02: Logic, Equivalence, and Circuits. Emina Torlak and Kevin Zatloukal

CSEP 521 Applied Algorithms. Richard Anderson Winter 2013 Lecture 1

Intermediate Logic. Natural Deduction for TFL

Extensions to the Logic of All x are y: Verbs, Relative Clauses, and Only

1 Propositional Logic

CSE 20 DISCRETE MATH. Fall

Mathematical Logic Part One

CS70: Discrete Math and Probability. Slides adopted from Satish Rao, CS70 Spring 2016 June 20, 2016

CSE 421 Algorithms. Richard Anderson Autumn 2015 Lecture 1

Outline for Today. What is an Implication? Negations and their Applications. Proof by Contrapositive. Proof by Contradiction

10/5/2012. Logic? What is logic? Propositional Logic. Propositional Logic (Rosen, Chapter ) Logic is a truth-preserving system of inference

Section A (not in the text) Which of the following are statements? Explain. 3. The President of the United States in 2089 will be a woman.

cis32-ai lecture # 18 mon-3-apr-2006

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

THE LOGIC OF COMPOUND STATEMENTS

Propositional Logic. Fall () Propositional Logic Fall / 30

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

AS The Astronomical Universe. Prof. Merav Opher - Fall 2013

DISCRETE STRUCTURES WEEK5 LECTURE1

Logic and Proofs. (A brief summary)

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

PHIL 422 Advanced Logic Inductive Proof

Discrete Structures for Computer Science

CS Module 1. Ben Harsha Apr 12, 2017

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

Logical Agents. September 14, 2004

Doc112: Hardware. Department of Computing, Imperial College London. Doc112: Hardware Lecture 1 Slide 1

Mathematical Logic Part One

Mat 243 Exam 1 Review

Outline for Today. What is an Implication? Negations and their Applications. Proof by Contrapositive. Proof by Contradiction

Deduction by Daniel Bonevac. Chapter 3 Truth Trees

Chapter 1: The Logic of Compound Statements. January 7, 2008

Midterm: CS 6375 Spring 2015 Solutions

1.1 Language and Logic

ARTIFICIAL INTELLIGENCE

MA103 STATEMENTS, PROOF, LOGIC

Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World

AI Programming CS S-09 Knowledge Representation

30. TRANSFORMING TOOL #1 (the Addition Property of Equality)

1.1 Language and Logic

CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis. Hunter Zahn Summer 2016

CS100: DISCRETE STRUCTURES. Lecture 5: Logic (Ch1)

Box. Turn in your e xam to Kathy Stackhouse in Chem 303 by noon on Thursday, March 30.

Transcription:

CSE 311: Foundations of Computing I Lecture 1: Propositional Logic

About CSE 311

Some Perspective Computer Science and Engineering Programming CSE 14x Theory Hardware CSE 311

About the Course We will study the theory needed for CSE: Logic: How can we describe ideas precisely? Formal Proofs: How can we be positive we re correct? Number Theory: How do we keep data secure? Relations/Relational Algebra: How do we store information? Finite State Machines: How do we design hardware and software? Turing Machines: Are there problems computers can t solve?

About the Course And become a better programmer By the end of the course, you will have the tools to... reasoning about difficult problems automating difficult problems communicating ideas, methods, objectives understand fundamental structures of CS

Course Logistics

Instructors Thomas Rothvoss Kevin Zatloukal Section B MWF 9:30-10:20 in CSE2 G01 Section A MWF 1:30-2:20 in JHN 102 Office Hours: M 10:30-11:30 both in CSE 342 W 11:30-12:30 Office Hours: W 2:30-1:20 both in CSE 436 F 12:30-1:20 Office hours are for students in both sections Section A lectures will be recorded

TAs Teaching Assistants: Yuqing Ai Austin Chan Philip Garrison Kush Gupta Siddharth Vaidynathan Sean Jaffe Belinda Li Zhu Li Oscar Sprumont Jason Waataja Section: Thursdays starting this week Office Hours: TBD

Administrivia (Optional) Book: Rosen: Readings for 6 th (used) or 7 th (cut down) editions. Good for practice with solved problems

Administrivia Homework: Due WED at 11:00 pm online Write up individually Extra Credit Exams: Midterm in class Final exam, Monday, June 10 Section A at 2:30-4:20 Section B at 4:30-6:20 both in JHN 102 Grading (roughly): 50% Homework 15-20% Midterm 30-35% Final Exam

Contact Us Piazza message board use for most questions (opt out of careers ) Staff mailing list private matters only cse311-staff at cs All Course Information @ cs.uw.edu/311

Course Web Site

About grades... Grades were very important up until now...

About grades... Grades were very important up until now Grades are much less important going forward companies care much more about your interviews grad schools care much more about recommendations

About grades... Grades were very important up until now Grades are much less important going forward companies care much more about your interviews grad schools care much more about recommendations Understanding the material is much more important interviews test your knowledge from these classes good recommendations involve knowledge beyond the classes

About grades... Grades were very important up until now Grades are much less important going forward companies care much more about your interviews grad schools care much more about recommendations Understanding the material is much more important interviews test your knowledge from these classes good recommendations involve knowledge beyond the classes Please relax and focus on learning

Please calm down about grades Most time spent on questions about grading issues is not worthwhile to either the student or teacher Try to avoid asking will I lose points if... If the thought of losing points worries you, show more work no sense having a 30 minute discussion to save 10 minutes Try to avoid the phrase not fair (this is probably not about the course material)

Grading Policies We will not debate size of point deductions We will grade problems based on the problem intent send your legalistic arguments to the law school

Collaboration Policy Collaboration with others is encouraged BUT you must: list anyone you work with turn in only your own work Recommended approach for group work do not leave with any solution written down or photographed wait 30 minutes before writing up your solution See Allen School Academic Misconduct policy also

Late Work To be accepted, late submission must be arranged at least 48 hours before the deadline

Propositional Logic

What is logic and why do we need it? Logic is a language, like English or Java, with its own words and rules for combining words into sentences (syntax) ways to assign meaning to words and sentences (semantics) Why learn another language when we know English and Java already?

Why not use English? Turn right here Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo We saw her duck

Why not use English? Turn right here Does right mean the direction or now? Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo This means Bison from Buffalo, that bison from Buffalo bully, themselves bully bison from Buffalo. We saw her duck Does duck mean the animal or crouch down?

Why not use English? Turn right here Does right mean the direction or now? Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo This means Bison from Buffalo, that bison from Buffalo bully, themselves bully bison from Buffalo. We saw her duck Does duck mean the animal or crouch down? Natural languages can be imprecise

Why not use Java? What does this code do: public static boolean mystery(int x) { for (int r = 2; r < x; r++) { for (int q = 2; q < x; q++) { if (r*q == x) return false; } } } return x > 1; }

Why not use Java? What does this code do: public static boolean mystery(int x) { for (int r = 2; r < x; r++) { for (int q = 2; q < x; q++) { if (r*q == x) return false; } } } return x > 1; } Determines if x is a prime number

Why not use Java? What does this code do: public static boolean mystery(int x) { for (int r = 2; r < x; r++) { for (int q = 2; q < x; q++) { if (r*q == x) return false; } } } return x > 1; } Determines if x is a prime number Programming languages can be verbose

Why learn a new language? We need a language of reasoning to state sentences more precisely state sentences more concisely understand sentences more quickly

Propositions: building blocks of logic A proposition is a statement that is either true or false is well-formed

Propositions: building blocks of logic A proposition is a statement that is either true or false is well-formed All cats are mammals true All mammals are cats false

Are These Propositions? 2 + 2 = 5 x + 2 = 5 Akjsdf! Who are you? Every positive even integer can be written as the sum of two primes.

Are These Propositions? 2 + 2 = 5 This is a proposition. It s okay for propositions to be false. x + 2 = 5 Not a proposition. Doesn t have a fixed truth value Akjsdf! Not a proposition because it s gibberish. Who are you? This is a question which means it doesn t have a truth value. Every positive even integer can be written as the sum of two primes. This is a proposition. We don t know if it s true or false, but we know it s one of them!

A first application of logic If I were to ask you out, would your answer to that question be the same as your answer to this one?

Propositions We need a way of talking about arbitrary ideas Propositional Variables:!, #, $, %, Truth Values: T for true F for false

A Compound Proposition Garfield has black stripes if he is an orange cat and likes lasagna, and he is an orange cat or does not like lasagna We d like to understand what this proposition means.

A Compound Proposition Garfield has black stripes if he is an orange cat and likes lasagna, and he is an orange cat or does not like lasagna We d like to understand what this proposition means. First find the simplest (atomic) propositions:! Garfield has black stripes # Garfield is an orange cat $ Garfield likes lasagna

A Compound Proposition Garfield has black stripes if he is an orange cat and likes lasagna, and he is an orange cat or does not like lasagna We d like to understand what this proposition means. First find the simplest (atomic) propositions:! Garfield has black stripes # Garfield is an orange cat $ Garfield likes lasagna (p if (q and r)) and (q or (not r))

Logical Connectives Negation (not)! Conjunction (and)! # Disjunction (or)! # Exclusive Or! # Implication! # Biconditional! #

Logical Connectives Negation (not)! Conjunction (and)! # Disjunction (or)! # Exclusive Or! # Implication! # Biconditional! #! Garfield has black stripes # Garfield is an orange cat $ Garfield likes lasagna Garfield has black stripes if he is an orange cat and likes lasagna, and he is an orange cat or does not like lasagna (p if (q and r)) and (q or (not r))

Logical Connectives Negation (not)! Conjunction (and)! # Disjunction (or)! # Exclusive Or! # Implication! # Biconditional! #! Garfield has black stripes # Garfield is an orange cat $ Garfield likes lasagna Garfield has black stripes if he is an orange cat and likes lasagna, and he is an orange cat or does not like lasagna (p if (q and r)) and (q or (not r)) (p if (q r)) (q r)

Some Truth Tables p p p q p Ù q p q p Ú q p q p Å q

Some Truth Tables p p T F F T p q p Ù q T T T T F F F T F F F F p q p Ú q T T T T F T F T T F F F p q p Å q T T F T F T F T T F F F

Implication If it s raining, then I have my umbrella It s useful to think of implications as promises. That is Did I lie? p q p q T T T T F F F T T F F T I have my umbrella I do not have my umbrella It s raining It s not raining

Implication If it s raining, then I have my umbrella It s useful to think of implications as promises. That is Did I lie? p q p q T T T T F F F T T F F T I have my umbrella I do not have my umbrella It s raining No Yes It s not raining No No The only lie is when: (a) It s raining AND (b) I don t have my umbrella

Implication If it s raining, then I have my umbrella Are these true? 2 + 2 = 4 earth is a planet p q p q T T T T F F F T T F F T 2 + 2 = 5 26 is prime

Implication If it s raining, then I have my umbrella Are these true? 2 + 2 = 4 earth is a planet p q p q T T T T F F F T T F F T The fact that these are unrelated doesn t make the statement false! 2 + 2 = 4 is true; earth is a planet is true. T T is true. So, the statement is true. 2 + 2 = 5 26 is prime Again, these statements may or may not be related. 2 + 2 = 5 is false; so, the implication is true. (Whether 26 is prime or not is irrelevant). Implication is not a causal relationship!

! # (1) I have collected all 151 Pokémon if I am a Pokémon master (2) I have collected all 151 Pokémon only if I am a Pokémon master These sentences are implications in opposite directions:

! # (1) I have collected all 151 Pokémon if I am a Pokémon master (2) I have collected all 151 Pokémon only if I am a Pokémon master These sentences are implications in opposite directions: (1) Pokémon masters have all 151 Pokémon (2) People who have 151 Pokémon are Pokémon masters So, the implications are: (1) If I am a Pokémon master, then I have collected all 151 Pokémon. (2) If I have collected all 151 Pokémon, then I am a Pokémon master.

! # Implication: p implies q whenever p is true q must be true if p then q q if p p is sufficient for q p only if q q is necessary for p p q p q T T T T F F F T T F F T