Reasoning and Writing in the Mathematics Underlying Computation

Reasoning and Writing in the Mathematics Underlying Computation

Reasoning and Writing in the Mathematics Underlying Computation Jack Snoeyink May 5, 2021 ii ‘Reeling and Writhing, of course, to begin with,’ the Mock Turtle replied; ‘and then the different branches of Arithmetic – Ambition, Distraction, Uglification, and Contents Derision.’ —Lewis Carroll, Alice’s Adventures in Wonderland Page Glossary of Notation ix 1 Introduction1 1.1 Defining Kara’s world............................1 1.2 On problem solving.............................3 1.3 The purpose of puzzles...........................7 1.4 Summary...................................8 1.5 Exercises and Explorations........................9 2 Propositional Logic 13 2.1 Logic operations............................... 13 2.2 Conditionals................................. 16 2.3 Logic puzzles................................. 18 2.4 Properties of operations and inference................. 20 2.4.1 Inference with properties..................... 21 2.5 Boolean circuits............................... 23 2.6 Solving a puzzle with logic notation................... 24 2.6.1 Defining and using notation................... 24 2.6.2 Solution via truth table...................... 25 2.6.3 Solution by inference from properties............. 26 2.6.4 Solution by cases and decision tree............... 28 2.7 Summary................................... 28 2.8 Exercises and Explorations........................ 30 3 Sets, Tuples, & Counting 35 3.1 Defining sets and tuples.......................... 35 3.1.1 Sets.................................. 36 3.1.2 Tuples................................ 38 3.1.3 Sequences, strings, and series.................. 39 3.2 Counting elements in sets......................... 41 3.2.1 The sum and product rules.................... 41 3.2.2 Permutations and factorial.................... 42 3.2.3 Combinations and choose.................... 44 3.3 A mixed example: distributing donuts................. 46 3.4 Counting multisets............................. 50 3.5 Summary................................... 51 3.6 Exercises and Explorations........................ 52 iii iv 4 First Order Logic: Quantifiers 57 4.1 Quantified statements........................... 57 4.1.1 Writing a quantified statement................. 58 4.1.2 Negation and inference for quantifiers............. 60 4.1.3 Scope and nested quantifiers.................. 61 4.1.4 Idioms and abbreviations..................... 62 4.2 Event-time logic using quantifiers.................... 64 4.3 Summary................................... 68 4.4 Exercises and Explorations........................ 69 5 Set Operations and Properties 73 5.1 Set operations................................ 73 5.1.1 Definitions for set operations.................. 74 5.1.2 Properties for set operations................... 75 5.1.3 Proofs for set operations..................... 76 5.2 Inclusion/exclusion counting....................... 79 5.3 Families of sets................................ 80 5.3.1 Partitions............................... 80 5.3.2 Further questions......................... 80 5.4 Summary................................... 81 5.5 Exercises and Explorations........................ 83 6 Relations and Functions 85 6.1 Relations................................... 85 6.1.1 Binary relations........................... 87 6.2 Functions................................... 89 6.2.1 Some numerical functions.................... 90 6.2.2 Types of functions......................... 92 6.3 Bijections and counting.......................... 94 6.3.1 Resource bounds and asymptotic notation.......... 95 6.4 Summary................................... 98 6.5 Exercises and Explorations........................ 99 7 Math Review 103 7.1 Messages and bases............................. 103 7.1.1 Strings to numbers......................... 104 7.1.2 Floor and ceiling.......................... 104 7.1.3 Length of a given message.................... 105 7.1.4 Mod for decoding......................... 105 7.2 Encoding by exponentiation mod hidden primes........... 106 7.2.1 Divisibility.............................. 106 7.2.2 Hiding two primes in a composite number.......... 107 7.2.3 Messages of given length..................... 108 7.2.4 The unexpected power of counting............... 109 7.3 Finding the encoding and decoding exponents............ 111 7.3.1 Fun with fractions......................... 111 7.3.2 A vector view............................ 113 v 7.3.3 Common divisors.......................... 114 7.3.4 Encryption.............................. 115 7.4 Summary................................... 115 7.5 Exercises and Explorations........................ 117 8 Recursive definition 121 8.1 Recursive definition. ............................ 121 8.1.1 . of sets.............................. 121 8.1.2 . of functions and relations.................. 123 8.1.3 . of tuples, lists, and sequences................ 124 8.1.4 . of notation for operations.................. 126 8.1.5 . of strings and languages................... 127 8.1.6 . of other structures....................... 127 8.2 Recurrences, series, and counting.................... 128 8.2.1 Combinatorial proof of a numerical identity......... 128 8.2.2 Counting partitions........................ 129 8.2.3 Mathematical series........................ 130 8.2.4 Estimating factorial........................ 132 8.2.5 Generating functions....................... 133 8.3 Summary................................... 134 8.4 Exercises and Explorations........................ 135 9 Proof 137 9.1 What is a proof............................... 137 9.1.1 The roles of definitions and properties............. 139 9.1.2 Proof types............................. 139 9.2 Modified two-column proof form.................... 142 9.2.1 Example two column proofs................... 142 9.3 Communication............................... 145 9.4 What may I use?............................... 147 9.4.1 Primitives.............................. 148 9.4.2 Basic definitions and properties that follow from them... 149 9.4.3 Definitions with variations: Functions, relations, graphs.. 150 9.5 Summary................................... 150 9.6 Exercises and Explorations........................ 152 10 Mathematical Induction 157 10.1 Strong induction............................... 157 10.1.1 Examples.............................. 158 10.1.2 8-step template for strong induction.............. 160 10.2 Variants.................................... 163 10.2.1 Weak vs. strong induction.................... 164 10.2.2 With nested quantifiers...................... 165 10.2.3 Strengthen what is to be proved................ 167 10.2.4 Minimal counterexample..................... 168 10.3 Summary................................... 170 10.4 Exercises and Explorations........................ 171 vi 11 Algorithms and invariants 177 11.1 Preliminaries................................. 177 11.2 Max in a list(A)............................... 178 11.3 Iterative binary search........................... 187 11.4 Sorting by insertion............................. 190 11.5 Greatest common divisor......................... 194 12 Binary Relations & Applications 201 12.1 Binary relations extended......................... 201 12.1.1 Closure operations for relations................. 202 12.2 Aboveness: A partial order........................ 205 12.3 Equivalence relations and finite state automata............ 207 12.3.1 Regular languages and simplified Kara............ 207 12.3.2 Recognizing a regular language with superKara....... 209 12.3.3 Simple Kara simulates superKara................ 210 12.3.4 An equivalence relation L ................... 211 12.3.5 Proof in detail:...........................≡ 211 12.3.6 The smallest machine for L ................... 212 12.3.7 Reducing K0 to KL ......................... 213 12.4 Summary................................... 214 12.5 Exercises and Explorations........................ 216 13 Graphs and Trees 219 13.1 A draw-it-yourself chapter outline.................... 220 13.2 Foundational definitions.......................... 227 13.3 Modify, count, draw, and color graphs................. 231 13.3.1 Modifying graphs......................... 231 13.3.2 Counting graphs.......................... 231 13.3.3 Drawing partial order graphs.................. 233 13.3.4 Coloring............................... 233 13.4 Paths and cycles............................... 234 13.5 Trees...................................... 238 13.5.1 Equivalent definitions for rooted trees............. 238 13.5.2 Counting Trees........................... 243 13.6 Planar Graphs and Triangulations.................... 245 13.6.1 Drawing and encoding planar graphs............. 248 13.7 Exercises and Explorations........................ 251 14 Discrete Probability 255 14.1 Definitions.................................. 255 14.1.1 Monty Hall and sample spaces................. 257 14.2 Random variables and expectation................... 258 14.2.1 Non-transitive dice......................... 261 14.3 Examples: balls into bins......................... 263 14.4 Exercises and Explorations........................ 268 Bibliography 271 vii Selected Solutions 273 viii One of the biggest problems of mathematics is to ex- plain to everyone else what it is all about. The technical trappings of the subject, its symbolism and formality, its baffling terminology, its apparent delight in lengthy calculations: these tend to obscure its real nature. A mu- Glossary sician would be horrified if his art were to be summed up as “a lot of tadpoles drawn on a row of lines,” but

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    318 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us