csc236 summer 2017 - university of torontocsc236h/summer/lectures/week01.pdfcsc236 summer 2017...

24
www.cdf.toronto.edu/ ~ csc236h/summer/index.shtml

Upload: hathuy

Post on 02-Jul-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

CSC236 Summer 2017Introduction to the Theory of Computation

Alex Palioudakis

[email protected]

www.cdf.toronto.edu/~csc236h/summer/index.shtml

Course Notes: Introduction to the Theory of Computation

Page 2: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Outline

Logistics and Introduction

Chapter 1: Simple Induction

Page 3: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

CSC236 Logistics

I Course website - check this often!

I Tutorials begin next week

I Tutorial room assignments are BA 1180, BA 1230, and BA

1240. The assignment of each student to a tutorial will be

posted on the course's website.

Page 4: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Lecture Format

I Reading sections will be posted in advance.

I Tutorial problems will also be posted in advance.

I A summary of lecture (and any other electronic materials)

will be posted as well.

Page 5: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Lecture Format (Continued)

I The consepts of the course will be covered in lectures.

Given the time we will see some examples in lectures as

well.

I At the start of each tutorial a quiz will be given - it will be

for 20 min. (For the marking scheme of the course see the

course's syllabus.

I Each quiz will examine material covered in a previous week.

I The rest of the tutorial will be examples of the day's topic.

Page 6: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Why Reason about Computing?

I More than just hacking

I Testing isn't enough

Page 7: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

What will we learn in this course?

I Reasoning to argue a claim is right or wrong.

I A math property holds or not.

I A computer program is corrent or not.

I Systematic counting.

I Practise math proofs.

Page 8: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

You should already know

I Chapter 0 material from Introduction to Theory of

Computation

I CSC165 material, especially mathematical notation, proof

techniques, and introduction to big-Oh.

I But you can relax the structure of your proofs

I Recursion, e�ciency material from CSC148

Page 9: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

What is CSC236 about?

I Part 1: Induction as a proof technique.

I Part 2: Analysis of Recursive Algorithms.

I Part 3: Introduction to formal languages.

Page 10: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

What is CSC236 about? (continued)

I One of a sequence of courses on mathematical techniques

for CS

I General goal - practice reading and writing mathematically

dense statements

I More practice with proofs - in CSC263, your proofs will get

more creative

Page 11: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Part 1: Induction

Page 12: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Simple Induction

I Some of you will have seen a bit of this in CSC165

I We'll start here, and then move on to other types of

induction.

Page 13: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

The Principle of Simple Induction

domino-0

domino-1

domino-2

domino-3

domino-4

domino-5

domino-6

domino-7

domino-8

domino-9

domino-10

[P(0) ^ ( 8n 2 N;P(n)) P(n + 1) ) ] =) 8n 2 N;P(n)

If the initial case works,

and each case that works implies its successor works,

then all cases work (we don't have to start at 0).

Page 14: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Simple Induction Outline

Inductive Hypothesis: State inductive hypothesis H (n)

Verify base case(s): Verify that the claim is true for any cases

not covered in the inductive step

Inductive Step C (n): Show that C (n) follows from H (n),

indicating where you use H (n) and why that is

valid

In simple induction H (n) is the claim you intend to prove

about n , and C (n) is the same claim about n + 1 | \simple"

because the reasoning moves from n to n + 1.

Page 15: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

How many subsets of a set? (count them)

I fg

I fag

I fa ; bg

I fa ; b; cg

Page 16: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

How many subsets of a set? (answer)

I fg - 1

I fag - 2

I fa ; bg - 4

I fa ; b; cg - 8

Page 17: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Every set with n elements has exactly 2n subsets. . .Scratch work: check a few more sets

Page 18: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Use Simple Induction

Prove by simple induction that

1 + 2 + 3 + � � �+ n =n � (n + 1)

2

(Proposition 1.2 of notes)

Page 19: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Why Simple Induction Works?

See Theorem 1.1 (proof a) of notes.

Page 20: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Every set with n elements has exactly 2n subsets

We can prove it formally using simple induction (Proposition

1.3 of notes)

Page 21: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

7n � 1 is a multiple of 6Scratch work: substitute a few values for n

Page 22: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

The units digit of 7n is either 1, 3, 7, or 9Scratch work: substitute a few values for n

Page 23: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

4n � n4?

Scratch work: check for a few values of n (n � 4)

Page 24: CSC236 Summer 2017 - University of Torontocsc236h/summer/lectures/week01.pdfCSC236 Summer 2017 Introduction to the ... 1240. The assignment of each student to a tutorial will be

Represent any amount greater than 18 with any coinsof value 4 or 7

Tip: Take cases for whether you use or not a coin (at least one)

of value 7.