
Massachusetts Institute of Technology 6.042J/18.062J, Spring ’08: Mathematics for Computer Science Prof. Albert R. Meyer revised May 17, 2008, 783 minutes 6.042, Spring 2008 Lecture notes Copyright © 2008, Prof. Albert R. Meyer. All rights reserved. Contents 1 Proofs 3 1.1 What is a Proof? ........................................ 3 1.2 Propositions .......................................... 4 1.3 The Axiomatic Method .................................... 5 1.3.1 Our Axioms ...................................... 6 1.3.2 Proofs in Practice ................................... 6 1.4 Proving an Implication .................................... 8 1.4.1 Method #1 ....................................... 8 1.4.2 Method #2 - Prove the Contrapositive ....................... 9 1.5 Proving an “If and Only If” ................................. 10 1.5.1 Method #1: Prove Each Statement Implies the Other ............... 10 1.5.2 Method #2: Construct a Chain of Iffs ........................ 10 1.6 How to Write Good Proofs .................................. 11 1.7 Propositional Formulas .................................... 12 1.7.1 Combining Propositions ............................... 13 1.7.2 Propositional Logic in Computer Programs .................... 15 1.7.3 A Cryptic Notation .................................. 16 1.7.4 Logically Equivalent Implications ......................... 17 1.8 Logical Deductions ...................................... 18 2 Predicates & Sets 20 2.1 More Proof Techniques .................................... 20 2.1.1 Proof by Cases .................................... 20 2.1.2 Proof by Contradiction ................................ 21 2.1.3 Method ......................................... 21 2.2 Predicates ........................................... 22 2 6.042, Spring 2008 3 2.2.1 Quantifying a Predicate ............................... 22 2.2.2 More Cryptic Notation ................................ 23 2.2.3 Mixing Quantifiers .................................. 24 2.2.4 Order of Quantifiers ................................. 24 2.2.5 Negating Quantifiers ................................. 25 2.2.6 Validity ......................................... 26 2.3 Mathematical Data Types .................................. 26 2.3.1 Some Popular Sets .................................. 27 2.3.2 Comparing and Combining Sets .......................... 27 2.3.3 Sequences ....................................... 28 2.3.4 Set Builder Notation ................................. 29 2.3.5 Functions ....................................... 30 2.4 Does All This Really Work? ................................. 33 3 Relations; Partial Orders 35 3.1 Binary Relations ........................................ 35 3.1.1 Binary Relations and Functions ........................... 35 3.1.2 Images and Inverse Images ............................. 36 3.1.3 Surjective and Total Relations ............................ 37 3.1.4 The sizes of infinite sets ............................... 37 3.2 Partial Orders ......................................... 41 3.2.1 Axioms for Partial Orders .............................. 42 3.2.2 Representing Partial Orders by Set Containment ................. 43 3.2.3 Total Orders ...................................... 44 3.2.4 Products of Relations ................................. 44 3.2.5 Topological Sorting .................................. 45 3.2.6 Parallel Task Scheduling ............................... 47 3.2.7 Dilworth’s Lemma .................................. 48 3.3 The Well Ordering Principle ................................. 49 3.4 Well-Founded Partial Orderings ............................... 51 3.4.1 Product Partial Orders ................................ 52 3.4.2 Well founded recursive definitions ......................... 53 4 6.042, Spring 2008 4 Induction 55 4.1 Induction ............................................ 55 4.2 Using Induction ........................................ 56 4.2.1 A Template for Induction Proofs .......................... 57 4.2.2 A Clean Writeup ................................... 58 4.2.3 Powers of Odd Numbers .............................. 59 4.2.4 Courtyard Tiling ................................... 59 4.2.5 A Faulty Induction Proof .............................. 61 4.3 Strong Induction ....................................... 63 4.3.1 The Strong Induction Principle ........................... 63 4.3.2 Products of Primes .................................. 63 4.3.3 Making Change .................................... 64 4.3.4 Unstacking ...................................... 65 4.4 Induction versus Well Ordering ............................... 66 4.5 Recursive Data Types ..................................... 67 4.6 Structural Induction on Recursive Data Types ....................... 68 4.6.1 Functions on Recursively-defined Data Types .................. 69 4.6.2 Recursive Functions on Nonnegative Integers .................. 70 4.7 Games as a Recursive Data Type .............................. 72 4.7.1 Tic-Tac-Toe ....................................... 72 4.7.2 Infinite Tic-Tac-Toe Games .............................. 75 4.7.3 Two Person Terminating Games .......................... 76 4.7.4 Game Strategies .................................... 77 4.7.5 Structural Induction versus Ordinary Induction ................. 78 5 State Machines; Stable Marriage 79 5.1 State machines ......................................... 79 5.1.1 Basic definitions ................................... 79 5.1.2 Reachability and Invariants ............................. 81 5.1.3 Sequential algorithm examples ........................... 84 5.1.4 Derived Variables ................................... 88 5.2 The Stable Marriage Problem ................................ 89 5.2.1 The Problem ...................................... 90 5.2.2 The Mating Ritual .................................. 91 6.042, Spring 2008 5 5.2.3 A State Machine Model ............................... 92 5.2.4 There is a Marriage Day ............................... 92 5.2.5 They All Live Happily Every After... ........................ 93 5.2.6 ...Especially the Boys ................................. 94 5.2.7 Applications ...................................... 95 6 Simple Graphs 97 6.1 Simple Graphs ......................................... 97 6.1.1 Introduction ...................................... 97 6.1.2 Definition of Simple Graph ............................. 98 6.1.3 Sex in America .................................... 99 6.1.4 Handshaking Lemma ................................ 100 6.1.5 Some Common Graphs ............................... 101 6.1.6 Isomorphism ..................................... 102 6.2 Connectedness ......................................... 103 6.2.1 Paths and Simple Cycles ............................... 103 6.2.2 Connected Components ............................... 105 6.2.3 How Well Connected? ................................ 105 6.2.4 Connection by Simple Path ............................. 106 6.2.5 The Minimum Number of Edges in a Connected Graph ............. 106 6.3 Coloring Graphs ........................................ 107 6.3.1 Degree-bounded Coloring .............................. 109 6.3.2 Why coloring? ..................................... 110 6.4 Trees .............................................. 110 6.4.1 Tree Properties .................................... 110 6.4.2 Spanning Trees .................................... 112 6.5 Bipartite Graphs ........................................ 113 6.6 Bipartite Matchings ...................................... 114 6.6.1 The Matching Condition ............................... 114 6.6.2 A Formal Statement ................................. 116 6.7 Planar Graphs ......................................... 117 6.7.1 Drawing Graphs in the Plane ............................ 117 6.7.2 Continuous & Discrete Faces ............................ 118 6.7.3 Planar Embeddings .................................. 120 6 6.042, Spring 2008 6.7.4 What outer face? ................................... 122 6.7.5 Euler’s Formula .................................... 123 6.7.6 Number of Edges versus Vertices .......................... 123 6.7.7 Classifying Polyhedra ................................ 126 7 Digraphs 128 7.1 Digraphs ............................................ 128 7.1.1 Paths in Digraphs ................................... 128 7.1.2 Directed Acyclic Graphs ............................... 129 7.2 Communication Networks .................................. 131 7.2.1 Complete Binary Tree ................................ 131 7.2.2 Latency and Diameter ................................ 131 7.2.3 Switch Size ...................................... 132 7.2.4 Switch Count ..................................... 132 7.2.5 Congestion ...................................... 133 7.2.6 2-D Array ....................................... 134 7.2.7 Butterfly ........................................ 135 7.2.8 Benes˘ Network .................................... 137 8 Introduction to Number Theory 142 8.1 Divisibility ........................................... 142 8.1.1 Facts About Divisibility ............................... 143 8.1.2 When Divisibility Goes Bad ............................. 143 8.2 Die Hard ............................................ 145 8.2.1 Finding an Invariant Property ........................... 145 8.3 The Greatest Common Divisor ............................... 146 8.3.1 Linear Combinations and the GCD ......................... 146 8.3.2 Properties of the Greatest Common Divisor .................... 147
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages297 Page
-
File Size-