You are on page 1of 53

CSC217

Discrete Mathematics with Applications I

Salvador Gutiérrez
http://faculty.plattsburgh.edu/~salvador.gutierrez

Lecture 01

CSC217 SUNY Plattsburgh, Fall 2010

1

Today
Announcements Organizational details Purpose of the course Material coverage Section 1.1 of the text
CSC217 SUNY Plattsburgh, Fall 2010

Lecture 01

2

Internet Resources
Class webpage: http://angel.plattsburgh.edu http://www.cs.plattsburgh.edu/~salv ador CSC217A Discrete Math CSC Applications

Lecture 01

CSC217 SUNY Plattsburgh, Fall 2010

3

Lectures
Instructor: Prof. Salvador Gutiérrez Time: Place: Text: TTh 9:30-10:45am REDCAY 0170 S.Epp. ´Discrete Math. & App.µ limited slide coverage, read the text before class

Attendance: required,

Lecture 01

CSC217 SUNY Plattsburgh, Fall 2010

4

Announcements
Add/Drop deadline end of the first week, contact your advisor. CS/IT Welcome Meeting. Tuesday, Aug. 31, Redcay (room TBA) CS&IT Lunch, Video and Discussion Series, EVERY TUESDAY, 12:30-1:20 PM (room TBA)

Lecture 01

CSC217 SUNY Plattsburgh, Fall 2010

5

Textbook Attending the lectures is not a substitute for reading the text Lectures merely highlight some examples Read the text and do as many exercises as humanly possible Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 6 .

Fall 2010 7 .. while preparing for an exam) consult the slides The slides are on the web (posted on the class Web site in Angel) NO substitute for the textbook! Lecture 01 CSC217 SUNY Plattsburgh.Slides To refresh a lecture (e.g.

Friday 11:00 . Fall 2010 8 . Salvador Gutiérrez Time: Monday .12:00 or by appointment Place: Redcay 155D Lecture 01 CSC217 SUNY Plattsburgh.Office Hours Instructor: Prof.

Fall 2010 9 .Marking Scheme 40 assignments Quizzes Midterm Final Exam: Curved Curve is tuned to the final overall distribution Participation may nudge grade 30% 10% 30% 30% Lecture 01 CSC217 SUNY Plattsburgh.

Fall 2010 10 .InIn-Class Participation Finding errors in slides (during the class period) Answering my questions Asking questions on the material Lecture 01 CSC217 SUNY Plattsburgh.

TAs. Fall 2010 11 . You should have worked through the focus problems before taking the quizzes. etc. The first assignment is out TODAY Available on the web (see ¶Schedule·) Lecture 01 CSC217 SUNY Plattsburgh. instructors. No late assignments will be accepted Can consult classmates.Assignments Assignments are based on the ´focus problemsµ (see 'Schedule').

Available on the web (Angel system.Quizzes Quizzes are based on the ´focus problemsµ (see 'Schedule'). Fall 2010 12 . You should have worked through the focus problems before taking the quizzes. Lessons tab) Lecture 01 CSC217 SUNY Plattsburgh.

Fall 2010 13 .Exams Midterm exams: October 14th In-class : 50 minutes Final exam: as per the time table (after Dec. 14) All comprehensive! Closed book! Lecture 01 CSC217 SUNY Plattsburgh.

Missed Midterm Provide a justification for missing the exam within 5 working days Then the weight of the midterm may be transferred to the final No deferred midterm Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 14 .

Collaboration . each assignment handed in must be done by the person submitting it No labor division: You do half of the problems and I do half Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 15 .Assignments YES! You are encouraged to discuss problems in the assignments and solution ideas Nevertheless.

Exams Absolutely NO collaboration on: Midterm Final exam Counter-measures include: Tight surveillance (proctors) Multiple similar-looking exam versions ID checking Unannounced other means Lecture 01 CSC217 SUNY Plattsburgh.Collaboration . Fall 2010 16 .

Prosecution Any detected case of academic dishonesty will be automatically passed to the office of the Dean The violator(s) will go there for a friendly chat with a jury formed by faculty Possible consequences: Failure in the course May jeopardize one s student visa status Permanently goes on the record Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 17 .

Questions? Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 18 .

etc. Fall 2010 19 . VLSI.Why This Course? Relation to real life: Algorithm correctness ~ programming. MS Access.) Predicate logic ~ Artificial Intelligence. compilers Proofs ~ Artificial Intelligence. debugging Propositional logic ~ hardware (including VLSI) design Sets/relations ~ databases (Oracle. theoretical physics/chemistry Lecture 01 CSC217 SUNY Plattsburgh. compilers. reverse-engineering.

Fall 2010 20 .Code Correctness Millions of programmers code away daily« How do we know if their code works? Lecture 01 CSC217 SUNY Plattsburgh.

linux.6. Fall 2010 21 .5 /kernel/sched.linuxfoundation.c Lecture 01 CSC217 SUNY Plattsburgh.Programming ‡ Producing code: ± Linux kernel: ‡ http://www.org/pub lications/whowriteslinux.no/#linux+v2.30.pdf ‡ http://lxr.

in which data leak from a temporary storage space in memory. and the error eventually brought down the ship's propulsion system. 22 .Importance USS Yorktown. the computer system proceeded to divide another quantity by that zero.the first to be outfitted with Smart Ship technology 09/97: suffered a widespread system failure off the coast of Virginia. After a crew member mistakenly entered a zero into the data field of an application. The result: the Yorktown was dead in the water for more than two Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 hours. The operation caused a buffer overflow. a guided-missile cruiser --.

More Software Bugs On June 4. 1996. representing the "horizontal bias" of the flight. There was no explicit exception handler to catch the exception.uninsured. Media reports indicated that the amount lost was half a billion dollars -. which should only have been applied to a number less than 2^15. hence the on-board computers. the maiden flight of the European Ariane 5 launcher crashed about 40 seconds after takeoff. Fall 2010 23 . hence the mission. was erroneously applied to a greater number. Lecture 01 CSC217 SUNY Plattsburgh. so it followed the usual fate of uncaught exceptions and crashed the entire software. The exception was due to a floating-point error: a conversion from a 64-bit integer to a 16-bit signed integer.

Fall 2010 24 .Where is CSC 217 ? How do we find such bugs in software? Tracing Debug statements Test cases Many software testers working in parallel All of that had been employed in the previous cases Yet the disasters occurred« Lecture 01 CSC217 SUNY Plattsburgh.

Fall 2010 25 .Program Correctness Logic : means to prove correctness of software Sometimes can be semi-automated Can also verify a provided correctness proof Lecture 01 CSC217 SUNY Plattsburgh.

.. Lecture 01 CSC217 SUNY Plattsburgh.Artificial Intelligence Medical Diagnosis Expert Systems helping in Finance Management Industry Quality Control Process Control Games Chess Go . Fall 2010 26 .

Fall 2010 27 .Argument #1 All men are mortal Socrates is a man Therefore. Socrates is mortal Lecture 01 CSC217 SUNY Plattsburgh.

Fall 2010 28 . a sandwich is better than God Lecture 01 CSC217 SUNY Plattsburgh.Argument #2 Nothing is better than God A sandwich is better than nothing Therefore.

Fall 2010 29 .Validity An argument is valid if and only if given that its premises hold its conclusion also holds So« Socrates argument: Valid or Invalid? Sandwich argument: Valid or Invalid? Lecture 01 CSC217 SUNY Plattsburgh.

Fall 2010 30 .How can we tell ? Common sense? Voting? Authority? What is valid argument anyway? Who cares? ??? Lecture 01 CSC217 SUNY Plattsburgh.

Fall 2010 31 .CSC 217 Logic : a formal way to assess a validity of an argument Can prove theorems in a semiautomatic fashion Can verify given proofs that an argument is valid Lecture 01 CSC217 SUNY Plattsburgh.

Material Coverage Chapter 1: propositional calculus Chapter 2: 1st order predicate calculus Chapter 3: methods of proof & number theory Chapter 4: mathematical induction Chapter 5: set theory Chapter 6: counting / probabilities Chapter 7: functions Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 32 .

Questions? Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 33 .

Fall 2010 34 .What is the name of this man? Lecture 01 CSC217 SUNY Plattsburgh.

Arguments in Puzzles The Island of Knights and Knaves Never lie Always lie Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 35 .

Fall 2010 36 .Example #1 You meet two people: A. B A says: I am a Knave or B is a Knight. Who is A? Who is B? Lecture 01 CSC217 SUNY Plattsburgh.

to keep S true Y must be true So B is a Knight too Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 37 .Solution The original statement can be written as: S = X or Y X = ´A is a Knaveµ Y = ´B is a Knightµ Suppose A is a Knave Then S must be false since A said it Then both X and Y are false If X is false then A is not a Knave Contradiction : A cannot be a Knave and not a Knave ! So A must be a Knight So S is true and X is not true Thus.

Fall 2010 38 .How about You meet just one guy : A A says: I m a Knave! Who is A? Lecture 01 CSC217 SUNY Plattsburgh.

Features Of An Argument arguments involve things or objects things have properties arguments consist of statements statements may be composed an argument starts with assumptions which create a context. within its context. each step yields another statement which is true. arguments may contain sub-arguments it is absurd for a statement to be both true and false Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 39 .

etc.Formalization Why formalize? to remove ambiguity to represent facts on a computer and use it for proving. Fall 2010 40 . to detect unsound reasoning in arguments Lecture 01 CSC217 SUNY Plattsburgh. proof-checking.

Fall 2010 41 .Graphically raphically Lecture 01 CSC217 SUNY Plattsburgh.

Logic Mathematical logic is a tool for dealing with formal reasoning In a nutshell: Logic does: Assess if an argument is valid/invalid Logic does not directly: Assess the truth of atomic statements Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 42 .

Fall 2010 43 .Differences Logic can deduce that: Plattsburgh is in the USA given these facts: Plattsburgh is in New York New York is a part of the USA and the definitions of: to be a part of to be in Logic knows nothing of whether these facts actually hold in real life! Lecture 01 CSC217 SUNY Plattsburgh.

Fall 2010 44 .Questions? Lecture 01 CSC217 SUNY Plattsburgh.

1) Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 45 .Propositional Calculus (Ch.

Fall 2010 46   Lecture 01 See the reverse of the text·s front cover .Connectives Different notation is in use We will use the common math notation: ~ V & not or (non-exclusive!) and implies (if then ) if and only if for all exists CSC217 SUNY Plattsburgh.

Fall 2010 47 .« P Q P Q Unit Formula: Lecture 01 CSC217 SUNY Plattsburgh. Q. Y. X. ~P.Formulae A statement/proposition: true or false Atomic: Conjunctive: Disjunctive: Conditional: Biconditional: P. (formula). P & ~Q. « P & Q. P v (P & X). « P v Q. « P.

Determining Truth of A Formula Atomic formulae: given Compound formulae: via meaning of the connectives Suppose: P is true Q is false How about: (P v Q) CSC217 SUNY Plattsburgh. Fall 2010 48 Lecture 01 Truth tables .

Truth Tables Suppose: P is false Q is false X is true How about: P&Q&X PvQ&X P&QvX Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 49 .

Fall 2010 50 .use ¶(¶ and ¶)·: P&QvX (P & Q) v X Lecture 01 CSC217 SUNY Plattsburgh.Precedence ~ & v . highest lowest Avoid confusion .

Fall 2010 51 .Parenthesizing Parenthesize & build truth tables Similar to arithmetics: 3*5+7 = (3*5)+7 but NOT 3*(5+7) A&B v C = (A&B) v C but NOT A&(B v C) So start with sub-formulae with highestprecedence connectives and work your way out Let·s do the knave & knight problem in TT Lecture 01 CSC217 SUNY Plattsburgh.

Fall 2010 52 .TT for K&K S = X or Y X = ´A is a Knaveµ Y = ´B is a Knightµ A B S X Y XvY Absurd --------------------------------------------------------------------------------------------Knave Knave false true false true yes Knave Knight false true true true yes Knight Knave true false false false yes Knight Knight true false true true no Lecture 01 CSC217 SUNY Plattsburgh.

Questions? Lecture 01 CSC217 SUNY Plattsburgh. Fall 2010 53 .