Mathematical Logic Part One

Similar documents
Mathematical Logic Part One

Mathematical Logic Part Two

Mathematical Logic Part Two

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5

Mathematical Logic Part Two

MITOCW watch?v=flgjisf3l78

In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology.

Mathematical Logic Part Two

Skill 1: Multiplying Polynomials

CS103 Spring 2018 Mathematical Vocabulary

MITOCW watch?v=0jljzrnhwoi

The Stack, Free Store, and Global Namespace

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 9 Normal Forms

MITOCW watch?v=kz7jjltq9r4

Expressions and Control Statements

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

MITOCW ocw f99-lec12_300k

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

Post Experiment Interview Questions

Program Verification & Testing; Review of Propositional Logic

CS103 Handout 13 Fall 2012 May 4, 2012 Problem Set 5

Double Your Affiliate Commissions with this VERY Simple Strategy

Math 55 - Spring 04 - Lecture notes # 1 - Jan 20 (Tuesday)

MITOCW watch?v=4dj1oguwtem

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

MITOCW watch?v=ytpjdnlu9ug

Problem One: A Quick Algebra Review

CSE 20 DISCRETE MATH. Fall

Note: Please use the actual date you accessed this material in your citation.

COMP Intro to Logic for Computer Scientists. Lecture 2

MITOCW watch?v=w_-sx4vr53m

MITOCW MIT6_01SC_rec2_300k.mp4

Propositional Logic:

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

LECTURE 2 An Introduction to Boolean Algebra

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

The following content is provided under a Creative Commons license. Your support

MITOCW watch?v=rvrkt-jxvko

MITOCW watch?v=se4p7ivcune

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

Propositional Calculus

Most of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few

6.034 Notes: Section 10.1

How to Improve Your Campaign Conversion Rates

HW1. Due: September 13, 2018

CS103 Handout 14 Winter February 8, 2013 Problem Set 5

COMS 1003 Fall Introduction to Computer Programming in C. Bits, Boolean Logic & Discrete Math. September 13 th

MITOCW ocw f99-lec07_300k

Binary Relations Part One

Functions, High-School Edition

Fondamenti della Programmazione: Metodi Evoluti. Lezione 5: Invariants and Logic

CSE 20 DISCRETE MATH. Winter

Well, Hal just told us how you build robust systems. The key idea was-- I'm sure that many of

The following content is provided under a Creative Commons license. Your support

Propositional Logic. Part I

Module 6. Campaign Layering

Hey there, I m (name) and today I m gonna talk to you about rate of change and slope.

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Part IIa: Propositional Logic

Functions Structure and Parameters behind the scenes with diagrams!

The following content is provided under a Creative Commons license. Your support

The following content is provided under a Creative Commons license. Your support

(Refer Slide Time 3:31)

PROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between

Implementation of a Sudoku Solver Using Reduction to SAT

In today s video I'm going show you how you can set up your own online business using marketing and affiliate marketing.

BOOLEAN ALGEBRA AND CIRCUITS

CSE : Python Programming

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012

CPSC 121: Models of Computation. Module 5: Predicate Logic

Close Your File Template

Solutions to Selected Exercises

The following content is provided under a Creative Commons license. Your support

.Math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in .

The following content is provided under a Creative Commons license. Your support

Please try all of the TRY THIS problems throughout this document. When done, do the following:

Guide to First-Order Logic Translations

(Refer Slide Time 6:48)

6.001 Notes: Section 4.1

MITOCW watch?v=zm5mw5nkzjg

Lecture 9. Monday, January 31 CS 205 Programming for the Sciences - Lecture 9 1

Out for Shopping-Understanding Linear Data Structures English

Instructor (Mehran Sahami):

Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Predicate Logic CHAPTER What This Chapter Is About

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

Announcements. Written Assignment 2 due today at 5:00PM. Programming Project 2 due Friday at 11:59PM. Please contact us with questions!

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

Instructor: Craig Duckett. Lecture 03: Tuesday, April 3, 2018 SQL Sorting, Aggregates and Joining Tables

Range Minimum Queries Part Two

CSE143 Notes for Monday, 4/25/11

Summary of Course Coverage

Week 2: The Clojure Language. Background Basic structure A few of the most useful facilities. A modernized Lisp. An insider's opinion

Try typing the following in the Python shell and press return after each calculation. Write the answer the program displays next to the sums below.

Quiz 3; Tuesday, January 27; 5 minutes; 5 points [Solutions follow on next page]

CS3 Midterm 1 Fall 2006

Control Statements. if for while

CPSC 121: Models of Computation

The following content is provided under a Creative Commons license. Your support

MITOCW watch?v=kvtlwgctwn4

Transcription:

Mathematical Logic Part One

Question: How do we formalize the logic we've been using in our proofs?

Where We're Going Propositional Logic (Today) Basic logical connectives. Truth tables. Logical equivalences. First-Order Logic (Monday/Wednesday) Reasoning about properties of multiple objects.

Propositional Logic

A proposition is a statement that is, by itself, either true or false.

Some Sample Propositions Puppies are cuter than kittens. Kittens are cuter than puppies. Usain Bolt can outrun everyone in this room. CS103 is useful for cocktail parties. This is the last entry on this list.

More Propositions Got kiss myself I'm so pretty I'm too hot Called a policeman and a fireman Made a dragon want to retire, man Uptown funk gon' give it to you

Things That Aren't Propositions Commands Commands cannot cannot be be true true or or false. false.

Things That Aren't Propositions Questions Questions cannot cannot be be true true or or false. false.

Things That Aren't Propositions The The first first half half isis aa valid valid proposition. proposition. I am the walrus, goo goo g'joob Jibberish Jibberish cannot cannot be be true true or or false. false.

Propositional Logic Propositional logic is a mathematical system for reasoning about propositions and how they relate to one another. Every statement in propositional logic consists of propositional variables combined via propositional connectives. Each variable represents some proposition, such as You liked it or You should have put a ring on it. Connectives encode how propositions are related, such as If you liked it, then you should have put a ring on it.

Propositional Variables Each proposition will be represented by a propositional variable. Propositional variables are usually represented as lower-case letters, such as p, q, r, s, etc. Each variable can take one one of two values: true or false.

Propositional Connectives Logical NOT: p Read not p p is true if and only if p is false. Also called logical negation. Logical AND: p q Read p and q. p q is true if both p and q are true. Also called logical conjunction. Logical OR: p q Read p or q. p q is true if at least one of p or q are true (inclusive OR) Also called logical disjunction.

Truth Tables A truth table is a table showing the truth value of a propositional logic formula as a function of its inputs. Useful for several reasons: Formally defining what a connective means. Deciphering what a complex propositional formula means.

The Truth Table Tool

Summary of Important Points The operator is an inclusive or. It's true if at least one of the operands is true. Similar to the operator in C, C++, Java and the or operator in Python. If we need an exclusive or operator, we can build it out of what we already have.

Mathematical Implication

Implication The connective is used to represent implications. Its technical name is the material conditional operator. What is its truth table?

Why This Truth Table? The truth values of the are the way they are because they're defined that way. The intuition: We want p q to mean whenever p is true, q is true as well. The only way this doesn't happen is if p is true and q is false. In other words, p q should be true whenever (p q) is true. What's the truth table for (p q)?

Truth Table for Implication p F F T T q p q F T T T F F T T The The only only way way for for p p q q to to be be false false isis for for pp to to be be true true and and qq to to be be false. false. Otherwise, Otherwise, pp qq isis by by definition definition true. true.

The Biconditional Operator

The Biconditional Operator The biconditional operator is used to represent a two-directional implication. Specifically, p q means that p implies q and q implies p. What should its truth table look like?

The Biconditional The biconditional connective p q is read p if and only if q. Here's its truth table: p F F T T q p q F T T F F F T T One One interpretation interpretation of of isis to to think think of of itit as as equality: equality: the the two two propositions propositions must must have have equal equal truth truth values. values.

True and False There are two more connectives to speak of: true and false. The symbol is a value that is always true. The symbol is value that is always false. These are often called connectives, though they don't connect anything. (Or rather, they connect zero things.)

Operator Precedence How do we parse this statement? x y z x y z Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? x y z x y z Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? ( x) y z x y z Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? ( x) y z x y z Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? ( x) y z x (y z) Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? ( x) y z x (y z) Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? ( x) (y z) (x (y z)) Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? ( x) (y z) (x (y z)) Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? ( x) ((y z) (x (y z))) Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence How do we parse this statement? ( x) ((y z) (x (y z))) Operator precedence for propositional logic: All operators are right-associative. We can use parentheses to disambiguate.

Operator Precedence The main points to remember: binds to whatever immediately follows it. and bind more tightly than. We will commonly write expressions like p q r without adding parentheses. For more complex expressions, we'll try to add parentheses. Confused? Just ask!

Time-Out for Announcements!

Problem Set Two Problem Set One was due at 12:50PM today. Can use up to two late days on this assignment if you'd like. Problem Set Two goes out right now. Checkpoint due Monday, April 13 at 12:50PM. Remaining problems due Friday, April 17 at 12:50PM. Explore induction, puzzles, games, and tournament structures!

WiCS Casual Dinner Stanford WiCS is hosting its first of their biquarterly CS Casual Dinners next Wednesday, April 15. 6PM 8PM in the Gates Fifth Floor lounge. RSVP using this link. Wonderful event great way to meet other students, faculty members, industry professionals, and alums. Highly recommended!

Your Questions

What is your favorite class to teach? CS 106A? CS 103? Or another one? They're They're all all my my favorite favorite class class to to teach! teach!

How do we know that the principle of mathematical induction is valid? Isn't the choice of what makes some logic 'legit' and other logic not pretty arbitrary? What would happen if we chose a different logical system, say, where induction isn't true? Induction Induction isis usually usually given given as as an an axiom axiom it's it's legit legit because because we we define define itit to to be be legit. legit. II haven't haven't seen seen any any examples examples of of math math that that excludes excludes induction, induction, but but if if II find find something, something, I'll I'll be be sure sure to to tell tell you! you!

There are many people who come into Stanford with extensive experience in math/cs/etc. How can people who are just finding their passions now catch up to these students who were literally the best in the world of their field during high school? I've I've got got aa few few thoughts thoughts on on this, this, in in no no particular particular order. order.

What was your favorite CS class that you took during your time here at Stanford? What was your favorite non-cs class? Oh Oh wow, wow, that's that's hard. hard. For For CS, CS, probably probably one one of of CS154, CS154, CS161, CS161, or or CS227B. CS227B. For For non-cs, non-cs, that's that's aa funny funny story. story.

Back to CS103!

Recap So Far A propositional variable is a variable that is either true or false. The propositional connectives are Negation: p Conjunction: p q Disjunction: p q Implication: p q Biconditional: p q True: False:

Translating into Propositional Logic

Some Sample Propositions a: I will get up early this morning b: There is a lunar eclipse this morning c: There are no clouds in the sky this morning d: I will see the lunar eclipse

Some Sample Propositions a: I will get up early this morning b: There is a lunar eclipse this morning c: There are no clouds in the sky this morning d: I will see the lunar eclipse I I won't won't see see the the lunar lunar eclipse eclipse if if II don't don't get get up up early early this this morning. morning.

Some Sample Propositions a: I will get up early this morning b: There is a lunar eclipse this morning c: There are no clouds in the sky this morning d: I will see the lunar eclipse I I won't won't see see the the lunar lunar eclipse eclipse if if II don't don't get get up up early early this this morning. morning. a d

p if q translates to q p It does not translate to p q

Some Sample Propositions a: I will get up early this morning b: There is a lunar eclipse this morning c: There are no clouds in the sky this morning d: I will see the lunar eclipse

Some Sample Propositions a: I will get up early this morning b: There is a lunar eclipse this morning c: There are no clouds in the sky this morning d: I will see the lunar eclipse If If II get get up up early early this this morning, morning, but but it's it's cloudy cloudy outside, outside, II won't won't see see the the lunar lunar eclipse. eclipse.

Some Sample Propositions a: I will get up early this morning b: There is a lunar eclipse this morning c: There are no clouds in the sky this morning d: I will see the lunar eclipse If If II get get up up early early this this morning, morning, but but it's it's cloudy cloudy outside, outside, II won't won't see see the the lunar lunar eclipse. eclipse. a c d

p, but q translates to p q

The Takeaway Point When translating into or out of propositional logic, be very careful not to get tripped up by nuances of the English language. In fact, this is one of the reasons we have a symbolic notation in the first place! Many prepositional phrases lead to counterintuitive translations; make sure to double-check yourself!

Propositional Equivalences

Quick Question What would I have to show you to convince you that the statement p q is false?

Quick Question What would I have to show you to convince you that the statement p q is false?

De Morgan's Laws Using truth tables, we concluded that (p q) is equivalent to p q We also saw that (p q) is equivalent to p q These two equivalences are called De Morgan's Laws.

Logical Equivalence Because (p q) and p q have the same truth tables, we say that they're equivalent to one another. We denote this by writing (p q) p q The symbol is not a connective. The statement (p q) ( p q) is a propositional formula. If you plug in different values of p and q, it will evaluate to a truth value. It just happens to evaluate to true every time. The statement (p q) p q means these two formulas have exactly the same truth table. In other words, the notation φ ψ means φ and ψ always have the same truth values, regardless of how the variables are assigned.

An Important Equivalence Earlier, we talked about the truth table for p q. We chose it so that p q (p q) Later on, this equivalence will be incredibly useful: (p q) p q

Another Important Equivalence Here's a useful equivalence. Start with p q (p q) By De Morgan's laws: p q (p q) p q p q p q p q Thus p q p q

Another Important Equivalence Here's a useful equivalence. Start with p q (p q) By De Morgan's laws: p q (p q) p q p q If If pp isis false, false, then then p p q q isis true. true. If If pp isis p q p q Thus p q p q true, true, then then qq has has to to be be true true for for the the whole whole expression expression to to be be true. true.

One Last Equivalence

The Contrapositive The contrapositive of the statement p q is the statement q p These are logically equivalent, which is why proof by contradiction works: p q q p