CSE 311: Foundations of Computing I CSE Fall 2014 311 Lecture 1 Lecture 1 Lecture 1: Propositional Logic Lecture 1 Foundations of Computing I Fall 2014 Some Perspective About the Course We will study the theory needed for CSE: Computer Science Logic : and Engineering How can we describe ideas precisely ? Formal Proofs : Theory Programming How can we be positive we’re correct? CSE 14x 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? CSE 311 Hardware Turing Machines: Are there problems computers can’t solve?
About the Course Administrivia Instructors: Paul Beame and Adam Blank It’s about perspective! Teaching assistants: Homework: Example: Sudoku • Antoine Bosselut Nickolas Evans Due WED at start of class Given one , solve it by hand • Akash Gupta Jeffrey Hon Write up individually Given most , solve them with a program Shawn Lee Elaine Levey • Evan McCarty Yueqi Sheng Exams: Given any , solve it with computer science • Midterm: Monday, November 3 Quiz Sections: Thursdays Final: Monday, December 8 Tools for reasoning about difficult problems • 2:30-4:20 or 4:30-6:20 Tools for communicating ideas, methods, objectives… Non- Non Non Non - - -standard time standard time standard time standard time • Fundamental structures for computer science (Optional) Book: • Grading (roughly): Rosen 50% homework Discrete Mathematics 35% final exam 6 th or 7 th edition 15% midterm Can buy online for ~$50 All course information at http://www.cs.washington.edu/311 Logic: The Language of Reasoning Logic Logic Logic Why Learn A New Language? • Why not use English? • Turn right here… • Logic, as the “language of reasoning”, will help us… • Buffalo buffalo Buffalo buffalo buffalo buffalo • Be more precise precise precise precise Buffalo buffalo • Be more concise concise concise concise • We saw her duck • Figure out what a statement means more quickly quickly quickly quickly • “Language of Reasoning” like Java or English • Words, sentences, paragraphs, arguments… • Today is about words words and sentences words words sentences sentences sentences
A proposition is a statement that has a truth value, Propositions and is “well-formed”... • Consider these statements: • A proposition proposition proposition proposition is a statement that • 2 + 2 = 5 • has a truth value, and • The home page renders correctly in IE. • is “well-formed” • This is the song that never ends… • Turn in your homework on Wednesday. • This statement is false. • Akjsdf? • The Washington State flag is red. • Every positive even integer can be written as the sum of two primes. Propositions A Proposition “Roger is an orange elephant who has toenails if he • A proposition proposition proposition is a statement that proposition has tusks, and has toenails, tusks, or both.” • has a truth value, and • What does this proposition mean? • is “well-formed” • It seems to be built out of other, more basic propositions that are sitting inside it! What are they? • Propositional Variables: �, �, �, �, … • Truth Values: T T for true, F T T F F for false F
How are the basic propositions combined? Logical Connectives ¬� • Negation (not) “Roger is an orange elephant who has toenails if he has tusks, and has toenails, tusks, or both.” � ∧ � • Conjunction (and) RElephant : “Roger is an orange elephant” • Disjunction (or) � ∨ � • RTusks : “Roger has tusks” • • Exclusive or � ⊕ � RToenails : “Roger has toenails” • � → � • Implication � ↔ � • Biconditional Logical Connectives Some Truth Tables ¬� • Negation (not) Negation (not) Negation (not) Negation (not) • Conjunction (and) Conjunction (and) � ∧ � Conjunction (and) Conjunction (and) p q p ∧ ∧ q ∧ ∧ p ¬ ¬ p ¬ ¬ • Disjunction (or) Disjunction (or) Disjunction (or) Disjunction (or) � ∨ � � ⊕ � • Exclusive or Exclusive or Exclusive or Exclusive or • Implication Implication � → � Implication Implication • Biconditional Biconditional Biconditional Biconditional � ↔ � “Roger is an orange elephant who has toenails if p q p ∨ ∨ q p q p ⊕ ⊕ q ∨ ∨ ⊕ ⊕ he has tusks, and has toenails, tusks, or both.” RElephant and and and and ( RToenails if if RTusks ) and if if and ( RToenails or and and or or RTusks or or or (RToenails and or or and and and RTusks))
� → � � → � p p p p q q q q p p p → p → q q q q → → • “If p , then q ” is a promise promise promise: promise “I am a Pokémon master only if I have collected all 151 Pokémon” • Whenever p is true, then q is true Can we re-phrase this as if p , then q ? • Ask “has the promise been broken” If it’s raining, then I have my umbrella Suppose it’s not raining… � → � Converse, Contrapositive, Inverse p q p → q • Implication: p → q Implication: • Converse: q → p – p implies q – whenever p is true q must be true • Contrapositive: ¬ q → ¬ p – if p then q • Inverse: ¬ p → ¬ q – q if p – p is sufficient for q How do these relate to each other? – p only if q
Back to Roger’s Sentence Roger’s Sentence with a Truth Table “Roger is an orange elephant who has toenails if he has tusks, and has toenails, tusks, or both.” � → � � ∧ � → � � ∨ � � ∧ � (� ∨ �) ∨ � ∧ � � ∧ � → � ∧ (� ∨ � ∨ � ∧ � ) p p p p q q q q r r r r RElephant ∧ ( RToenails if if RTusks ) ∧ ( RToenails ∨ RTusks ∨ (RToenails ∧ RTusks)) if if Define shorthand … p : RElephant q : RTusks r : RToenails More about Roger More about Roger Roger is only orange if whenever he either has tusks or Roger is only orange if whenever he either has tusks or toenails, he doesn't have tusks and he is an orange elephant.” toenails, he doesn't have tusks and he is an orange elephant.” RElephant : “Roger is an orange elephant” • RTusks : “Roger has tusks” ( RElephant only only only only if (whenever ( if (whenever ( if (whenever ( if (whenever ( RTusks x x x x or or or or RToenails ) then not ) then not ) then not RTusks )) and ) then not )) and )) and )) and • RToenails : “Roger has toenails” RElephant • ( RElephant → (whenever ( ( ( ( RTusks ⊕ ⊕ ⊕ ⊕ RToenails ) then ) then ) then ¬ ) then ¬ RTusks )) )) ∧ )) )) ∧ ∧ ∧ RElephant ¬ ¬ p : RElephant q : RTusks r : RToenails
Roger’s Second Sentence with a Truth Table Biconditional: � ↔ � • p iff q p p p p q q q q r r r r � ⊕ � ¬� (� ⊕ � → ¬�) � → ( � ⊕ � → ¬�) � → ( � ⊕ � → ¬�) ∧ � • p is equivalent to q T T T T T F • p implies q and q implies p T F T T F F F T T p q p ↔ q F T F F F T F F F
Recommend
More recommend