introduction to discrete structures fall 2017 · introduction to discrete structures fall 2017...

39
Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois Allee in the Park Van Gogh

Upload: vudien

Post on 17-May-2018

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Introduction to Discrete Structures Fall 2017

Discrete Structures (CS 173)

Madhusudan Parthasarathy (Madhu) University of Illinois

Allee in the Park

Van Gogh

Page 2: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Today’s class

• A little about me

• What is this course about?

An introduction to discrete structures

• Course logistics

Page 3: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

About me

India Germany Philadelphia Urbana

Page 4: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

My research Building safe and secure software

Examples:

- How do we build a secure voting machine?

- Safe Mars rover?

- Safe operating system?

- Secure Android platform?

- Secure cloud computing system?

Not just “reasonably correct” but “provably

correct”!

Idea: View the system being secure as a

theorem in mathematics. Prove the theorem!

Page 5: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

My research

Recent work: Secure Android platform(~10KLOC)

Combination of logic, theorem proving, algorithms and

software engineering

Page 6: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Discrete mathematics

Really, you should have done this course in school!

Reasons you didn’t:

- Science has hijacked math courses to teach what’s useful for science … calculus.

Math most useful for computer science hasn’t found

it’s way into school curricula.

But, don’t underestimate this course!

Page 7: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Calculus

In physics/mechanics:

𝑣 =𝑑𝑥

𝑑𝑡

𝑎 =𝑑𝑣

𝑑𝑡

In engineering:

Fluid mechanics, structural analysis, friction, flow rates, cooling laws, thrust, gravitation, …

But not as useful in computer science…

Page 8: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Fastest path from Chicago to Bloomington?

Page 9: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Fastest path from Chicago to Bloomington?

Page 10: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Fastest path from Chicago to Bloomington?

start

end

2 3

1

4

Page 11: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Fastest path from Chicago to Bloomington?

start

end

2 4

1

3

C

B

1 2

3 4

20 30

15

120

110

35

90 60 Lost in translation:

- curvature of Earth

- the curves in the road

- the potholes

- the number of Starbucks on each route

,,,

Page 12: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Modeling using graphs

Page 13: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Fastest path from Chicago to Bloomington?

Problem: find shortest path from C to B

– Many solutions: try random paths, enumerate all paths, depth first search C

B

1 2

3 4

20 30

15

120

110

35

90 60

Page 14: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Fastest path from Chicago to Bloomington?

C

B

1 2

3 4

20 30

15

120

110

35

90 60

30 20

140 65

140

Problem: find shortest path from C to B

– Many solutions: try random paths, enumerate all paths, depth first search

Dijkstra’s algorithm

– Explore neighboring nodes and keep track of shortest path to each

Page 15: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Fastest path from Chicago to Bloomington?

C

B

1 2

3 4

20 30

15

120

110

35

90 60

30 20

140 65

140

Problem: find shortest path from C to B

– Many solutions: try random paths, enumerate all paths, depth first search

Dijkstra’s algorithm

– Explore neighboring nodes and keep track of shortest path to each

How good is this algorithm?

– Does it find the best solution?

– How long does it take to compute?

Page 16: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Fastest path from Chicago to Bloomington?

C

B

1 2

3 4

20 30

15

120

110

35

90 60

30 20

140 65

140

Problem: find shortest path from C to B

– Many solutions: try random paths, enumerate all paths, depth first search

Dijkstra’s algorithm

– Explore neighboring nodes and keep track of shortest path to each

How good is this algorithm?

– Does it find the best solution?

– How long does it take to compute?

– How does the computation grow as the number of vertices or edges increases?

Page 17: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Modeling using graphs

Page 18: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Modeling using graphs

Modeling using

Discrete Structures:

Weigted graphs

Asymotitic Worst-case

analysis

Datastructure using discrete

structures: trees

Page 19: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Six degrees to Harry Lewis

Subject: Re: six degrees to harry lewis Date: January 23, 2004 Professor, I've been interested in graph theory and its applications to social networks for a while now, so I did some research that has to do with linking people through articles they appear in from the Crimson. I thought people would find this interesting, so I've set up a preliminary site that allows people to find the connection (through people and articles) from any person to the most frequently mentioned person in the time frame I looked at. ! This person is you.

Letter from Mark Zuckerberg to Prof. Lewis,

Six degrees to Harry Lewis was

a prototype website before Facebook.

Page 20: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Facebook network

By Paul Butler, 2010

Again, model is a graph.

Page 21: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

A puzzle

• Can you draw this on paper, without retracing any line/curve and without removing your pencil from the paper?

Page 22: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Proofs

How do you convince a fellow human being

(or your roommate) that something is really really true?

Eg. How do you show him/her that drawing

this is impossible?

Page 23: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Discrete Structures

• The calculus for computer science

• We want to solve problems computationally

This requires

– modeling the world discretely – devising an algorithm that uses discrete structures – determining the efficiency and correctness of that algorithm

(time and space are discrete).

• Discrete structures:

model for discretely capturing problems, and techniques to think computationally and rigorously about these models.

Page 24: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Discrete Structures

• Numbers

natural numbers: 0, 1, 2, …

integers: …., -3, -2, -1, 0, 1, 2, 3, …

• Graphs - undirected graphs - directed graphs - trees

Page 25: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Describing classes of discrete structures

• Recursion

A way to define functions where the function on a larger structure is defined

using the value of the function on smaller structures.

Very similar to recursion in programming!

Works only in discrete structure settings!

Page 26: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Reasoning with discrete structures

• Direct proofs • Proof-by-contrapositive • Proofs of equality of sets

• INDUCTION A way to prove properties of structures where the proof proves the property of a larger structure assuming the property holds on smaller structures. Again, induction works well only for discrete structures.

Page 27: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Recursion and induction

• Discrete structures in computer science of unbounded (but finite) size can be defined using recursion.

(A linked list is either the null list, or is a

node n whose next-pointer points to a linked list.)

• Recursion Programming!

Recursive functions are equivalent to programming. E.g., functional prog languages

• Induction: The main proof technique for proving properties of recursive structures *and* the programs that manipulate recursive structures.

Page 28: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Other names for this class

• The rewire-your-brain-to-think-formally class

Image from a Huffington Post article

• The ``proofs’’ class – How to make convincing arguments that other

scientists and mathematicians will consider solid enough. How to make convincing arguments that your system/algorithm/program is correct.

Page 29: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

What you’ll learn in this course

• How to model the world (and problems) – Logic, sets, sets of sets, trees, graphs, functions, etc.

• Techniques to prove and disprove statements – Direct, existential, contradiction, contrapositive,

induction, Some combinatorics, counting, etc.

• How to model the computational behavior of algorithms (time complexity and correctness) - Big O, recurrence relations, induction, etc.

• A foundation for computational thinking that will serve you all your life…

Page 30: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Course logistics

Course website:

http://courses.engr.illinois.edu/cs173/

Lecture B:

http://courses.engr.illinois.edu/cs173/B-lecture/

Page 31: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Course Logistics: Weekly Schedule

• Mon night: finish reading exercise/videos for Tue class • Tue: come to lecture • Wed night: finish reading exercise/videos for Thu class or do post quiz • Thu: come to lecture; start working on new problem set • Thu: submit HW (start working previous week!) • Fri: attend a discussion section • Weekend: start on new HW or start preparing for examlet, continue through the week

Time Monday Tuesday Wednesday Thursday Friday

Class

Lecture

11am-12:15pm

Lecture

11am-12:15pm

EXAMLET

Office Hours

Discussion

Sections

Discussion

Sections

11am, 12pm,

1pm, 2pm, 3pm

Homework

Reading Quiz /

Videos

due midnight

Reading Quiz /

Videos

due midnight

Mini-HW and

Long-form HW

Page 32: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Course Logistics: Grading • Homework/quizzes (35%)

– Quiz (pre or post lecture): 5%

Auto-graded on Moodle: can see score, fix, and resubmit – Mini-HW: 10%

Auto-graded for fast feedback

– Long-form HW: 15% Submitted online on Moodle; graded by TAs – Discussion assignments: 5%

Work done in discussion sections (need to turn in the assignments done; keep a copy)

• Exams (65%)

– Examlets (approiximately every other week; 5-6 over semester): 30% – Final Exam: 35% – No midterm exams

• Late policy

– Simple: late assignments will not be accepted – See website for details on extenuating circumstances – Lowest quiz, lowest mini-HW, lowest discussion assignment dropped.

But lowest long form homework NOT dropped.

• Cheating policy – See course website

Page 33: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Course Logistics: Grading

• Thresholds for guaranteed grades A- : 90%

B- : 80%

C- : 70%

D- : 50%

• We reserve right to curve up

• In previous terms, this course has given about 20% A's, 30% B's, 30% C's, 15% D's, and 5% F's

• Last offering of this course was graded unusually high: 37% A’s, 32% B’s, 13% C’s

Page 34: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Reading and Textbook • Mathematics for Computer Science

Lehman, Leighton, Meyer MIT Google for it

• Some lecture notes posted by me on course website. • Margaret Fleck’s notes

Building Blocks for Theoretical Computer Science http://mfleck.cs.illinois.edu/building-blocks/

A simple condensed text

• Optional book: Rosen “Discrete Mathematics and its Applications”, 5th to 7th edition – More detail, practice problems; heavy!

• Purchase the manual of discussion problems, available for $4.75 at the Union Bookstore. You should bring this to your assigned discussion each week.

Page 35: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Getting help

• Discussion sections and office hours

- On Fridays

• Newsgroup: piazza.com

Password: yoda

• Major problems See course page.

Page 36: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Textbooks: MIT Textbook, Fleck’s text,

Madhu’s notes

Discussion problems:

Need to buy from bookstore! (~$5)

RESOURCES

ROUTINE WORK

Reading assignments/

quiz (online,

autograded, Moodle)

Mini-HW (online,

auto-graded, Moodle)

Long-form HW (online; using

Moodle/LaTeX)

ONLINE Moodle

Piazza pwd: yoda

sign up for the right section use any email addr

Examlets roughly every two

weeks

Final

(comprehensive)

Page 37: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Tips

• This class is very difficult for most students • New ways of thinking require lots of practice; math is hard • But if you grasp things early, you will sail smoothly. • Basic approach to taking this class

– Come to lectures, take notes • If you have trouble following lecture, read the relevant sections of the

book first

– Try doing the homework – Read the online textbook – Complete the homework (use TAs, Piazza, Rosen book, online

resources as needed)

• Preparing for exams – Find extra problems from past homeworks and exams (see past

courses linked via website) – Do a few extra problems every week in a topic that is difficult for

you – 2 weeks before exam, start doing extra problems every day until

all the past homework and exam problems are easy

Page 38: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

Prerequisites, proficiency, honors

• Prerequisites – Calculus I (Math 220 or 221 or 234) and CS 125 or ECE 190 or CS 101 or a high

grade in INFO 103

– If you aren't sure whether you have the right background, speak to me (or Margaret Fleck)

Page 39: Introduction to Discrete Structures Fall 2017 · Introduction to Discrete Structures Fall 2017 Discrete Structures (CS 173) Madhusudan Parthasarathy (Madhu) University of Illinois

To do now

• Read syllabus and course information online

– Navigate and look at all parts of the course website

• Enroll in Piazza to get announcements

– Access code: yoda

• Reading assignment for Thursday: Read Chapter 1 and 2 of Fleck’s book.

Let’s learn some discrete mathematics… the calculus for computer science