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

Similar documents
CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Fall

1 Elementary number theory

CSC Discrete Math I, Spring Sets

Propositional Calculus. Math Foundations of Computer Science

Summary of Course Coverage

Math Introduction to Advanced Mathematics

Propositional Calculus

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

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

Chapter 3. Set Theory. 3.1 What is a Set?

Program Verification & Testing; Review of Propositional Logic

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

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

Introduction to Sets and Logic (MATH 1190)

1 Elementary number theory

Standard Boolean Forms

Boolean Algebra & Digital Logic

Discrete Mathematics Lecture 4. Harper Langston New York University

Propositional Calculus. Math Foundations of Computer Science

Mathematical Logic Part One

CS3110 Spring 2017 Lecture 10 a Module for Rational Numbers

Lecture Notes, CSE 232, Fall 2014 Semester

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

Lecture (04) Boolean Algebra and Logic Gates

Lecture (04) Boolean Algebra and Logic Gates By: Dr. Ahmed ElShafee

Strategies for Proofs

CS 221 Lecture. Tuesday, 13 September 2011

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

(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

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

Mathematical Logic Part One

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Logic Design: Part 2

Computer Organization and Levels of Abstraction

Lecture 5. Logic I. Statement Logic

(1) Modular arithmetic

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014

(Refer Slide Time 3:31)

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

Ch 3.4 The Integers and Division

CS40-S13: Functional Completeness

Problem One: A Quick Algebra Review

Foundations of Computation

Reductions and Satisfiability

Propositional Logic:

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Connecting Statements. Today. First there was logic jumping forward.. ..and then proofs and then induction...

r=1 The Binomial Theorem. 4 MA095/98G Revision

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

(Refer Slide Time 6:48)

Conditionals !

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion

Designing Computer Systems Boolean Algebra

1 / 43. Today. Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm.

The set consisting of all natural numbers that are in A and are in B is the set f1; 3; 5g;

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

A Random Walk through CS70

36 Modular Arithmetic

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.

Chapter Summary. Mathematical Induction Recursive Definitions Structural Induction Recursive Algorithms

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

Computer Organization and Levels of Abstraction

STUDENT NUMBER: MATH Final Exam. Lakehead University. April 13, Dr. Adam Van Tuyl

CS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points

Chapter 4. Number Theory. 4.1 Factors and multiples

SAMS Programming A/B. Lecture #1 Introductions July 3, Mark Stehlik

Math 126 Number Theory

Circuit analysis summary

To illustrate what is intended the following are three write ups by students. Diagonalization

About the Author. Dependency Chart. Chapter 1: Logic and Sets 1. Chapter 2: Relations and Functions, Boolean Algebra, and Circuit Design

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

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal.

DISCRETE MATHEMATICS

Today. Finish Euclid. Bijection/CRT/Isomorphism. Review for Midterm.

At this point in our study of digital circuits, we have two methods for representing combinational logic: schematics and truth tables.

Information Science 1

CS1 Lecture 3 Jan. 18, 2019

Geometry Agenda. Week 1.5 Objective Grade. Deductive Reasoning Practice

A Survey of Mathematics with Applications 8 th Edition, 2009

Boolean algebra. June 17, Howard Huang 1

EE292: Fundamentals of ECE

COMPSCI 230 Discrete Math Prime Numbers January 24, / 15

1. [5 points each] True or False. If the question is currently open, write O or Open.

Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

CPSC 121: Models of Computation Assignment #4, due Thursday, March 16 th,2017at16:00

DIGITAL SYSTEM DESIGN

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1

Integers and Mathematical Induction

Topic 10 Part 2 [474 marks]

SUMMER REVIEW PACKET 2 FOR STUDENTS ENTERING ALGEBRA 1

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

11 Sets II Operations

Read this before starting!

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

Math 302 Introduction to Proofs via Number Theory. Robert Jewett (with small modifications by B. Ćurgus)

Transcription:

Math 55 - Spring 04 - Lecture notes # 1 - Jan 20 (Tuesday) Name, class, URL (www.cs.berkeley.edu/~demmel/ma55) on board Head TA Mike West speaks on bureaucracy Advertise CS 70 (T Th 2-3:30) as an "honors" alternative to Ma55 All material on web page and at Copy Central Northside Read Course Outline on web page for course rules and grading policies You are responsible for reading this and knowing the rules! Class outline: Basics (Chap 1) - common language for rest of course logic (basis of proofs, logical operations in programs (CS61) hardware design (CS150)) sets and functions (same proof of 3 results: (1) can show that can t write a program to implement every possible function, because there are more functions than programs; (2) can show it is impossible to to write a debugger that finds "infinite loops" in other programs (CS 172)) (3) there are more real numbers than rational numbers (even though there are infinitely many of both Used in most of math curriculum Integer algorithms (Chap 2) Big-O notation (measure approximately how fast a function f(n) increases as n increases) Using Big-O to analyze speed of algorithms (used in CS61, CS170) Prime numbers, GCD (Greatest common divisors), "modular arithmetic" (a mod b), Chinese remainder theorem Applications: generating random numbers integer with "bignums" cryptography (eg RSA used in Netscape) (Ma 113, CS 170) More proof techniques (Chap 3) induction (knowing when a theorem, or program, is correct) (CS 17x, most of math curriculum) Probability theory and counting (Chaps 4, 5, Lenstra s notes) analyzing, designing algorithms (CS 170, CS 162, CS 188...) 1

(sometimes an algorithm that uses "random numbers" is faster than one that does not) how many ways to pair up n students into teams of 2 or 3 or... how to gamble in Reno algorithms that use random numbers EX suppose you build a web search engine (or web page to sell books or...) you buy 100 PCs and put them in a room when a request comes in, you pick a PC at random, and send it to that PC what is the average waiting time to service a request? Read Chapter 1 of book, homework due Wednesday Jan 28 at the beginning of section Do problems sec 1.1: 6, 16(a,c,e,g), 40, 42, 48, 60 1.2: 4a, 8(a,b), 10 (for 8a and 8b), 20, 38 (assume results of 36, 37) 1.3: 8, 14, 26(a,c,e), 56(a,b) 1.4: 4, 8(a,c,e), 28(a,c,e,g,i) 1.5: 6, 8(a,c,e), 22, 52 Begin course: DEF: Proposition is a statement that must be either true (T) or false (F) EG: 2+2 = 4 (Y) 2+2 = 3 (Y) Is 2+2=4? (N) Let x = 3. (N) x+1 = 2 (N, unless we know the value of x) Every even number > 2 is the sum of two primes. (Y) Notation: propositions denoted p,q,r... DEF: not p, p or q (disjunction), p and q (conjunction), p xor q (exclusive or) Truth tables DEF: a compound proposition is formed by simple propositions connected by logical operators and parentheses; EG: (p and q) or (r and s) programming example below DEF: p -> q, "if p, then q", "p implies q", "p sufficient for q", "q necessary for p"; p -> q same as not(p) or q; EG: if it is sunny, then we go to the beach 2

p = it is sunny, q = we go to the beach (T unless it is sunny (p) and we don t go (not q)) Truth table ASK&WAIT EG: if (today is Friday), then (2+3 = 6); on which days is this true? p = (today is Friday), q = (2+3=6) T every day except Friday ASK&WAIT EG: if (1+1=3) then (2+2=4) Note that p and q need not have anything to do with one another in order to form the expression p -> q DEF: The converse of p -> q is q -> p; they need not be true at the same time ASK&WAIT EG: If I am exactly 18 years old then I am allowed to vote; converse is if I am allowed to vote, then I am exactly 18 years old note that converse not necessarily true if original is DEF: The contrapositive of p -> q is not q -> not p; ASK&WAIT these are the same EG: If I am exactly 18 years old then I am allowed to vote; converse is if I am not allowed to vote, then I am not exactly 18 years old contrapositive is true Truth table proof of prop <=> contrapositive DEF: p <-> q "p if and only q", "p->q and q->p", biconditional Application to programming (C or C++ syntax) if (compound proposition, or logical expression) then do something... if ((n>0) && (m<k)) then do something... (n>0) and (m<k) are propositions whose value (T or F) can be evaluated when you get to this line in the program, and && means "and", means "or", etc. in computer 1 represents true and 0 false (representation details in CS61C, CS150) Application to Web search In www.google.com you can type into the Advanced Search form: With all the words: guano and With at least one of the words: geometry tickle Same as "find all web pages W for which the proposition is true" 3

(W contains guano) and ((W contains geometry) or (W contains tickle)) ASK&WAIT: what web pages do you get? EX: Geometry Learning center page on disease histoplasmosis, caused by fungus growing in bat guano, contains guano and geometry, not tickle EX: Magazine article about "tickle down economics" of Christmas toys and a town in Florida that smells like alligator guano contains guano and tickle, not geometry EX: poem in on-line poetry magazine Lynx contains all 3 Now let s try google with With all the words: guano and With at least one of the words: geometry tickle and Without the words the ASK&WAIT: Same as "find all web pages W for which the proposition is true" (W contains guano) and ((W contains geometry) or (W contains tickle)) and (not(w contains the)) ASK&WAIT: what web pages do you get? EX: "G" page of an Esperanto dictionary contains guano, geometry, not tickle or the... Next Goal: simplifying compound propositions or replacing an expression depending on p, q, r,... combined with "and", "or", etc. with another "equivalent" and "simpler" one that has the same truth/false value for all values of p, q, r,... (just like when you learned algebra in high school; algebra with variables that can only have values True and False is called "Boolean Algebra") What is "equivalence"? DEF: p <-> q means (p -> q) and (q -> p); true if p and q are both true or both false (show truth table) DEF: propositions p and q are called logically equivalent if p <-> q is always true (a tautology); write p <=> q; EG: p <=> not(not(p)) EG: p or not(p) <=> True (p or not(p) a "tautology") EG: p and not(p) <=> False (p and not(p) a "contradiction") 4

When is q "simpler" than p? Roughly, if q is a "smaller" compound expression, with fewer operations like and, or etc Motivation: 1) Proofs: if the compound prop. p equivalent to True (p a tautology), then you have proved a theorem 2) In programming, simple expressions (in "if" statements) are easier to understand and debug, faster to evaluate, since each "and" or "or" costs an operation 3) In computer design: A computer stores and computes with "bits" which are either 1 (true) or 0 (false), represented by electrical signals. The computations are done with little pieces of hardware that, say, take two input bits and compute their "and" to get an output bit. Each little piece of hardware corresponds to one of the operations "and", "or", etc. that we have talked about, and so computer hardware is just evaluating compound propositions. A "simpler" compound proposition needs fewer pieces of hardware to evaluate it, which is smaller, cheaper, faster... See also CS150, Chap 10, other "CAD" courses in EECS, and whole industries. Rules we can use to simplify compound propositions: EG: True or q <=> True (domination) ASK&WAIT EG: (I am a student at Stanford) or (2+2=4) <=> True EG: False and q <=> False (domination) EG: p or q <=> q or p (commutativity) EG: EG: ( p or q ) or r <=> p or ( q or r ) (associativity) DeMorgan s laws not(p or q) <=> (not p) and (not q) not(p and q) <=> (not p) or (not q) proof: Truth table ASK&WAIT EG: Prove that not(p -> q) -> p a tautology, i.e. <=> True not(p -> q) -> p not(not(p) or q) -> p Def -> not(not(not(p) or q)) or p Def -> (not(p) or q) or p Double negative not(p) or (q or p) associativity not(p) or (p or q) commutativity (not(p) or p) or q associativity (True ) or q not(p) or p <=> True True true or q <=> true Like musical instrument: practice 5

Also: Truth Table (Ref: EE290H - logic verification, 150 vars) EG: p or (q and r) <=> (p or q) and (p or q) distributivity EG: p and (q or r) <=> (p and q) or (p and q) distributivity (notice that names of rules -- distributivity etc -- are same as rules for regular algebra with numbers, since the rules are analogous) How does one interpret an expression like not p or q? as (not p) or q, or as not(p or q), which are quite different The precedence for operators in absence of parentheses is Highest to Lowest: not, ( and, or ), ( ->, <-> ) If there is ambiguity, I will use parentheses 6