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

Similar documents
Strategies for Proofs

(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

Program Verification & Testing; Review of Propositional Logic

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Announcements. CS243: Discrete Structures. Strong Induction and Recursively Defined Structures. Review. Example (review) Example (review), cont.

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

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

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ).

AXIOMS FOR THE INTEGERS

Lecture 1. 1 Notation

CSE 20 DISCRETE MATH. Winter

Basic Combinatorics. Math 40210, Section 01 Fall Homework 4 Solutions

CS103 Spring 2018 Mathematical Vocabulary

Introduction to Sets and Logic (MATH 1190)

Solutions to the Second Midterm Exam

Definition MATH Benjamin V.C. Collins, James A. Swenson MATH 2730

Logic and Computation Lecture 20 CSU 290 Spring 2009 (Pucella) Thursday, Mar 12, 2009

Recursively Enumerable Languages, Turing Machines, and Decidability

1. Chapter 1, # 1: Prove that for all sets A, B, C, the formula

CSE 21 Spring 2016 Homework 5. Instructions

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

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

Discrete Mathematics Lecture 4. Harper Langston New York University

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

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

CSE 20 DISCRETE MATH. Fall

Math236 Discrete Maths with Applications

14 More Graphs: Euler Tours and Hamilton Cycles

Notes for Recitation 8

Lecture 19 Thursday, March 29. Examples of isomorphic, and non-isomorphic graphs will be given in class.

Induction and Semantics in Dafny

COT 3100 Spring 2010 Midterm 2

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Outline. Introduction. 2 Proof of Correctness. 3 Final Notes. Precondition P 1 : Inputs include

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

CS103 Handout 14 Winter February 8, 2013 Problem Set 5

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

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

Comparing sizes of sets

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

Summary of Course Coverage

Homework 1 CS 1050 A Due:

Guidelines for Writing Mathematical Proofs

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

Answer Key #1 Phil 414 JL Shaheen Fall 2010

Problem Set 2 Solutions

MATHEMATICS 191, FALL 2004 MATHEMATICAL PROBABILITY Outline #1 (Countability and Uncountability)

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

Lemma (x, y, z) is a Pythagorean triple iff (y, x, z) is a Pythagorean triple.

Practice Problems: All Computer Science majors are people. Some computer science majors are logical thinkers. Some people are logical thinkers.

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

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

Graph Theory Questions from Past Papers

Solutions to Homework 10

CS 512, Spring 2017: Take-Home End-of-Term Examination

A Random Walk through CS70

CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University. Name: ID#: Section #: Score: / 4

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

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

Approximation Algorithms

2009 HMMT Team Round. Writing proofs. Misha Lavrov. ARML Practice 3/2/2014

CSE 21 Spring 2016 Homework 5. Instructions

Homework Set #2 Math 440 Topology Topology by J. Munkres

Lecture 6: Sequential Sorting

CS525 Winter 2012 \ Class Assignment #2 Preparation

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Proofwriting Checklist

PACKING DIGRAPHS WITH DIRECTED CLOSED TRAILS

Cardinality of Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Cardinality of Sets Fall / 15

Forward Assignment; Strongest Postconditions

Lecture Notes 15 Number systems and logic CSS Data Structures and Object-Oriented Programming Professor Clark F. Olson

CSE505, Fall 2012, Midterm Examination October 30, 2012

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully.

Material from Recitation 1

Lecture 15 : Review DRAFT

Recitation 4: Elimination algorithm, reconstituted graph, triangulation

REGULAR GRAPHS OF GIVEN GIRTH. Contents

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

2. CONNECTIVITY Connectivity

1 Elementary number theory

Lecture 5. Logic I. Statement Logic

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

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

Math 170- Graph Theory Notes

Lecture 1 Contracts. 1 A Mysterious Program : Principles of Imperative Computation (Spring 2018) Frank Pfenning

CSE 20 DISCRETE MATH WINTER

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

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

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

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

Hardware versus software

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

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

Transcription:

CS 3512, Spring 2011 Instructor: Doug Dunham Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010 Prerequisites: Calc I, CS2511 Rough course outline: Ch 1 5, 11. Proofs! Sets, tuples, lists, strings, relations, trees Functions, countability, diagonalization Inductively defined sets, recursive functions Structural and mathematical induction Program correctness (prove correctness of recursive programs by induction) Time/space analysis of algorithms (big O) Regular expressions, finite automata

Course organization Details in syllabus Weekly graded homework, and you should expect to work lots of problems... You learn math by doing math! Ask questions!! Two 50 minute exams during semester (100 points each), plus scheduled final (200 points)

Section 1.1: Logical form of statements We consider statements that are either true or false. Negation If S is a statement, its negation is the statement not S. [Consider truth table for negation] We often rephrase: Earth is not a star instead of Not Earth is a star. Quantifiers: every and some Nicely related via negation: Not every planet has a moon has the same meaning as some planet doesn t have a moon. Similarly, no planet is a star has the same meaning as...

Conjunction and disjunction The conjunction of statements A and B is the statement A and B. It is true when both A and B are. The disjunction of statements A and B is the statement A or B. It is true when at least one of A and B is. [Consider truth table for conjunction and disjunction] Sometimes rephrased: Earth and Mars are planets instead of... Either x or y is positive instead of...

Conditionals If A and B are statements, then if A then B is a conditional statement whose hypothesis is A and whose conclusion is B. A conditional is false only when the hypothesis is true and the conclusion is false. [Consider truth table for conditional] You may need to be careful about this one not necessarily a causal connection between hypothesis and conclusion. The converse of is the statement if A then B if B then A. Notice that a conditional and its converse may have different truth values. If x and y exceed 0, then so does x +y.

Equivalent statements not (not A) is equivalent to A not (A and B) is equivalent to (not A) or (not B) not (A or B) is equivalent to... Example: Simplify not (x > 0 and y > 0) A and (B or C) (A and B) or (A and C) A or (B and C)... The contrapositive of a conditional statement if A then B is the equivalent statement if not B then not A. if A then B (not A) or B not (if A then B)...

Overview of proof techniques Proof by exhaustive checking May be useful when a statement asserts that each of a finite number of things has a property. May not be practical if there are many of these things. Not applicable if there are infinitely many things. Proof by counterexample We can often prove the falsity of a (false) universal claim by finding an instance that falsifies it. Example: Every odd number greater than 1 that is not prime has the form 2+p for some prime number p. (What is a counterexample?)

Direct conditional proof To prove if A then B, assume A in order to derive B. Indirect conditional proof by contrapositive To prove if A then B, assume the negation of B in order to derive the negation of A. Indirect proof by contradiction To prove A, assume the negation of A and derive a contradiction. How would this work if you wished to prove if A then B by contradiction?

Iff proof in two parts A iff B stands for A if and only if B, which in turn stands for (if A then B) and (if B then A). [What is the truth table for iff?] A typical approach to proving an iff claim is to prove the two conditionals separately. ( left-to-right and right-to-left ) Iff proof by chain of equivalences An alternative approach is to find a chain of iff claims that takes you from A to B. Constructive proof of existence If a statement asserts that an object with some property exists, there are typically two approaches: either use proof by contradiction or construct an instance with the property. The second, constructive approach is usually preferable.

General remarks on proofs Write out your proofs carefully. (Or proofread and edit them well.) Have a plan, and present your proof so that the reader can follow the plan. Say enough to make your reasoning clear. Be clear about where variables come from. (This will become clearer.) Use definitions as they are. (Don t use intuitions as facts.) About finding proofs... Try various proof structures, based on the structure of the claim! Apply definitions. If you re stuck, maybe it will help to consider cases. Look at instances of the claim you re trying to prove. Do something else, and come back to it later. Review examples in textbook and lecture.

Integers, divisibility, primality: something to talk about The integers:..., 3, 2, 1,0,1,2,3,... An even integer can be written 2n for some integer n. An odd integer can be written 2n +1 for some integer n. An integer d divides an integer n if d 0 and there is an integer k such that n = dk. We write d n to say that d divides n. ( d is a factor, or divisor, of n, n is divisible by d,...) Notice: It follows easily that the even integers are the integers n such that 2 n. An integer p > 1 is prime if 1 and p are its only positive divisors.

Proof examples Claim: The sum of any two odd integers is an even integer. Proof outline: 1. Rephrase as a universally quantified conditional. For all integers x,y, if x and y are odd, then x +y is even. 2. Instantiate the universally quantified variables. Take arbitrary integers x, y. 3. Assume the hypothesis (direct conditional proof). Assume that x and y are odd. 4. Apply the relevant definition. 5. Derive the conclusion (of the conditional).

Claim: The sum of any two odd integers is an even integer. Proof Take arbitrary integers x,y. Assume that x and y are odd. We need to show that x +y is even. Since x and y are odd, there are integers m,n s.t. x = 2m +1 and y = 2n+1. Notice that x +y = 2m +1+2n +1 = 2(m +n+1) We can conclude that x +y is even. (Why?)

Let s do it again, more like we ll normally do it... Claim: The sum of any two odd integers is an even integer. Proof Assume that x and y are odd integers. [NTS: x +y is even] So there are integers m,n s.t. x = 2m +1 and y = 2n+1. Notice that x +y = 2m +1+2n +1 = 2(m +n+1) It follows that x +y is even.

Claim: If d a and a b, then d b. (1.1a) Again let s try a direct conditional proof...

Claim: If x 2 is odd, then x is odd. Let s try an indirect proof by contrapositive... [Useful lemma: For all integers n, n is even iff n is not odd. (Your textbook uses this lemma without seeming to notice. Can you prove it?)]

Claim: If n is an integer, then n 2 +2 is not divisible by 4. We ll use proof by contradiction. (Within this, consider cases on whether or not n is even.) Proof: Suppose that n is an integer s.t. n 2 +2 is divisible by 4. (What is our goal now?) That is, 4 (n 2 +2), which is to say that for some integer k. Consider two cases. (What will we derive in each case?) n 2 +2 = 4k (1) Case 1: n is even. That is, n = 2m for some integer m. Then 4k = n 2 +2 (by (??)) = (2m) 2 +2 (n = 2m) = 4m 2 +2 Dividing by 2, we have 2k = 2m 2 +1. The lhs is even; the rhs is odd. Contradiction (by the earlier lemma, if the rhs is odd we know it is not even). Case 2: n is not even. [Try this. Similar to case 1.]

Claim: Every integer greater than 1 is divisible by a prime. Proof by contradiction. [Try it. Tough one. Textbook has a proof. Try to understand it and present it more clearly.]

For the following example, we ll want several lemmas: 1. For any integer n, n(n+1) is even. 2. Exactly one of any two consective integers is even. 3. No even number divides an odd number. [You should try to prove these yourself.] Claim: x is odd iff 8 (x 2 1). Try proving both directions. Proof: (Left-to-right) Assume that x is odd. That is, x = 2k +1 for some integer k. So x 2 1 = (2k +1) 2 1 = 4k 2 +4k = 4k(k +1). Since k and k +1 are consecutive integers, their product is even (by lemma 1 above), so k(k +1) = 2m for some integer m. Substituting for k(k +1) above, we have x 2 1 = 4(2m) = 8m, which shows that 8 divides x 2 1. (Right-to-left) Assume x is not odd. (What is our goal now!?) By previous lemma, it follows that x is even. Since x is even, we know x 2 is even (by earlier claim), and so (by lemma 2 above) x 2 1 is odd. By lemma 3 above, no even number divides an odd number. So 8 does not divide x 2 1.

Claim: x is odd iff x 2 +2x +1 is even. Proof by chain of equivalences. For this proof, we ll want the following easy lemma. Lemma. x is even iff x 2 is even. (Try to prove it.) Proof of claim: x is odd iff x = 2k +1 for some integer k iff x +1 = 2(k +1) for some integer k iff x +1 is even iff (x +1) 2 is even iff x 2 +2x +1 is even (defn odd) (defn even) (Lemma)

In the chain of iffs, we included the phrase for some integer k twice... x is odd iff x = 2k +1 for some integer k (defn odd) iff x +1 = 2(k +1) for some integer k iff x +1 is even (defn even) iff (x +1) 2 is even (Lemma) iff x 2 +2x +1 is even What happens if we drop both occurrences of for some integer k? The argument is no longer sound. For instance, is the claim in the first step still true? That is, do we believe that x is odd iff x = 2k +1 Hint: Even if we assume that x and k are both integers, it is possible to falsify this claim.