26
Discrete Structures (CS 173) Jose Meseguer University of Illinois Introduc=on to Discrete Structures Spring 2018

Discrete(Structures((CS(173)( Jose Meseguer(( University

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Discrete  Structures  (CS  173)  Jose  Meseguer    

University  of  Illinois  

Introduc=on    to  Discrete  Structures  Spring  2018  

Today’s  class  •  An  interes=ng  video  

•  Lessons  for  Computer  Science  

•  A  liHle  about  me    •  Introduc=on  to  discrete  structures  

•  What  you  will  learn  in  this  course  

•  Course  logis=cs  

Lessons    for  Computer  Science  •  The  way  to  build  high-­‐quality,  reliable  systems  in  any  discipline  is  to  use  Mathema=cal  Models.  

•  Current  soQware  systems  are  oQen  insecure  and  unreliable,  causing  immense  losses.  

•  This  is  due  to  the  sole  reliance  on  tes=ng  as  opposed  to  mathema=cal  modeling.  

•  It  is  also  due  to  the  lack  of  mathema=cal  abili=es  of  many  soQware  engineers.  

Tes=ng  versus  SoQware  Verifica=on  •  Tes=ng  soQware  is  of  course  a  necessary  requirement,  but  is  not  sufficient.  

•  Edsger  Dijkstra  pointed  out  that:                                                        ``Tes=ng  shows  the  presence,  not  the  absence  of  bugs’’  •  Progam  Verifica=on  uses  Mathema=cal  Models  to  prove  the  absence  of  bugs  

•  This  course  will  help  you  use  mathema=cal  models  to  build  high-­‐quality,  reliable  systems.  

         

Some  Existen=al  Ques=ons  •  Do  you  want  the  soQware  systems  you  will  build  in  the  future  to  be  like  the  Tacoma  Bridge  or  like  the  TransAmerica  Building?  

•  Are  you  serious  about  becoming  a  computer  scien=st  as  opposed  to  just  a  programmer?  

•  If  you  are  serious,  do  you  realize  that  you  will  not  be  able  to  build  high-­‐quality  systems  without  using  mathema=cal  models?  

My  research  Is in the area of Software Verification Examples: - How do we build a secure browser? - How do we build safe avionics software? - Models of programming languages? - Secure cryptographic protocols? - Reliable cloud computing system? Not just “tested systems” but “provably correct”! Idea: View the safety/security property as a mathematical theorem. Prove the theorem!

Discrete  Mathema=cs  The  models  used  in  Physics  and  in  other  Engineering  disciplines  use  Calculus  and  Differen=al  Equa=ons  to  reason  about  con=nuous  quan==es:  space,  =me,  speed,  force,  etc.    The  models  needed  to  reason  about  soQware  used  discrete  data  structures  such  as:  integers,  arrays,  lists,  trees,  graphs,    sets,  and  so  on.    Programs  themselves  are  also  finite,  discrete  structures  that  manipulate  all  these  data  structures.    Logic  is  crucial  to  reason  about  hardware,  programs  and  data,  but  logic  formulas  are  also  discrete  data  structures.                    

Discrete  Mathema=cs    •  Is  to  Computer  Science  what  Calculus  is  to  Physics  

•  Discrete  Mathema=cs  is  used  to:    – Modeling  data  structures  – Modeling  programs  and  their  computa=ons  – Proving  proper=es  of  data  structures  and  programs  

 •  Discrete  mathema=cs:  how  to  model  the  cyberworld  and  think  computa=onally  and  rigorously  

 

Discrete  Structures  •  Numbers,  including  natural  numbers:  0,1,2,…  and  also  integers:  …,-­‐3,-­‐2,-­‐1,0,1,2,…  as  well  as  ra=onal  numbers:    1  /22,  3/125,  -­‐323/13,  …  

•  Graphs,  including:  (i)  directed  graphs,  (ii)  undirected  graphs,  and  (iii)  trees  

•  Recursion:  a  general  way  to  define  computable  fuc=ons  on  discrete  structures  in  terms  of  their  values  for  smaller  structures  

Proving  Proper=es  of  Discrete  Structs  •  Direct  Proofs  •  Proofs  by  Contraposi=ve  •  Proofs  by  Contradic=on  

•  INDUCTIVE  PROOFS:    Ideally  suited  for  proving  proper=es  of  discrete  structures.    Prove  a  BASE  CASE  about  the  smallest  structures,  then  prove  an  INDUCTION  STEP  about  a  larger  structure  in  terms  of  smaller  ones.  

Recursion  and  induc=on  •  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  func=ons  are  equivalent  to                      programming.  E.g.,  func=onal  prog        languages  •  Induc=on:    

The  main  proof  technique  for  proving  proper=es  of  recursive  structures  *and*  the  programs  that  manipulate  recursive  structures.  

What  you  will  learn  in  this  course  

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

•  Techniques  to  prove  and  disprove  statements  – Direct,  existen=al,  contradic=on,  contraposi=ve,  induc=on,  combinatorics,  countability,  etc.  

•  How  to  model  algorithms  mathema=cally  and  reason  about  their  correctness      -­‐  Recursive  programs,  correctness  proofs,  etc.  

•  A  founda=on  for  rigorous  thinking    that  will  serve  you  all  your  life…  

Mathema=cs:  The  Training  of  the  Mind  •  Athle=cs  is  to  Physical  Excellence  what  Mathema=cs  is  to  Intellectual  Excellence  

•  This  course  can  help  you  excell  not  just  as  a  computer  scien=st,  but  as  a    thinker  

•  24  Centuries  ago  Plato  quoted  his  teacher  Socrates  saying:  ``Have  you  no=ced  that  people  good  with  numbers  are  quick  in  all  their  studies?’’      

•  4  Centuries  ago  Descartes  wrote:``mathema=cs  should  be  studied  almost  solely  for  the  purpose  of  training  us  in  this  method  [of  thinking  correctly]’’  

Course  logis=cs  

Course  website:          hHp://courses.engr.illinois.edu/cs173/          Lecture  B:        hHp://courses.engr.illinois.edu/cs173/B-­‐lecture/    

Course  Logis=cs:  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:  aGend  a  discussion  secHon  •  Weekend:  start  on  new  HW  or  start  preparing  for  examlet,  conHnue  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-4pm (1 hour slots)

Homework

Reading Quiz / Videos

due midnight

Reading Quiz / Videos due midnight

Mini-HW and  Long-form HW

Course  Logis=cs:  Grading  •  Homework/quizzes  (35%)  

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

Auto-­‐graded  for  fast  feedback  –  Long-­‐form  HW:  15%    

 SubmiHed  online  on  Moodle;  graded  by  TAs  –  Discussion  assignments:  5%    

 Work  done  in  discussion  sec=ons  (need  to  turn  in  the  assignments  done;  keep  a  copy)    •  Exams  (65%)  

–  Examlets  (every  other  week):  40%  –  Final  Exam:  25%  

•  Late  policy  –  Simple:  late  assignments    will  not  be  accepted  –  See  website  for  details  on  extenua=ng  circumstances  –  Lowest  quiz,  lowest  mini-­‐HW,  lowest  long-­‐form  HW  dropped,  lowest  discussion  assignment  

dropped  

•  CheaHng  policy  –  See  course  website  

Course  Logis=cs:  Grading  •  Thresholds  for  guaranteed  grades  

A-­‐  :  90%  B-­‐  :  80%  C-­‐  :  70%  D-­‐  :  50%  

•  We  reserve  right  to  curve  up  

 

Reading  and  Textbooks  •  Margaret  Fleck’s  notes  Building  Blocks  for  Theore4cal  Computer  Science    hHp://www.cs.uiuc.edu/~mfleck/building-­‐blocks/  

•  Mathema=cs  for  Computer  Science  by  Lehman,  Leighton  and  Meyer,  MIT,  freely  available  on  the  web  (Google  it)  

 •  Op=onal  book:  Rosen  “Discrete  Mathema=cs  and  its  

Applica=ons”,  5th  to  7th  edi=on  –  More  detail,  prac=ce  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.    

•  Course  slides  and  addi=onal  lecture  notes  will  be  posted  

Gexng  help  •  Discussion  secHons  and  office  hours  

-­‐  Discussion  sessions  on  Fridays  -­‐  TA  Office  Hours  start  next  week  -­‐  Meseguer  Office  Hours:  Tu  12:15-­‐1pm  Siebel  2108  

•  Newsgroup:  piazza.com  Password:  rainbow  

•  Major  problems  See  course  page.  

To  Contact  Me  •  See  me  right  aQer  the  class    •  See  me  during  office  hours  (Tu  12:15-­‐1pm  Siebel  2108)  

•  By  email  sending  email  to  cs173-­‐[email protected]  

•  By  appointment  arranged  sending  email  to  cs173-­‐[email protected]  

•  Please  do  NOT  send  email  to  my  UIUC  account:  due  to  heavy  traffic  it  may  not  get  answered  in  a  =mely  fashion  

 

Textbooks:  Fleck  and  MIT,  

Meseguer’s  Notes  

Discussion  problems:  

Need  to  buy  from    bookstore!  (~$5)  

Alt  Textbook:  Rosen  

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:  rainbow  sign  up  for  the  right  secHon  

               Examlets  roughly  every  two  

weeks  

 Final  

(comprehensive)    

Tips  •  This  class  is  very  difficult  for  most  students  •  New  ways  of  thinking  require  lots  of  prac=ce;  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  sec=ons  of  the  book  first  

–  Try  doing  the  homework  –  Read  the  online  textbooks  and  Meseguer’s  notes  –  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  un=l  all  the  past  homework  and  exam  problems  are  easy  

Tips  (Con=nued)  •  If  you  have  fears  or  doubts  about  your  abili=es  to  do  math,  they  can  become  SELF-­‐FULFILLING  PROPHECIES,  and  therefore  your  WORSE  ENEMY  

•  To  overcome  such  nega=ve  thoughts  and  see  how  you  CAN  CHANGE  the  situa=on  I  hear=ly  recommend  the  book:  

•  ``A  Mind  for  Numbers”  by  Barbara  Oakley,  Penguin,  which  can  also  help  you  a  lot  in  learning  how  to  MANAGE  your  TIME  well,  which  you  will  need  to  do.  I  will  post  her  ``Ten  Rules  for  Good  Studying”  brief  summary  with  this  lecture  slides.  

Prerequisites  and  Proficiency  

•  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    

Dr.Margaret  Fleck  

 •  Proficiency  exam  

–  See  course  website  for  details  and  sign  up  –  Scheduled  this  week  (Saturday,  and  conflict  exam  on  Wednesday)      

 

To  do  now  

•  Read  syllabus  and  course  informa=on  online  – Navigate  and  look  at  all  parts  of  the  course  website  

•  Enroll  in  Piazza  to  get  announcements  – URL:  piazza.com/illinois/spring2018/cs173bl2  – Access  code:  rainbow  

•  Make  sure  you  can  access  Moodle  •  Note:  no  discussion  sec=on  this  week!    Let’s  learn  discrete  mathema=cs…    

 the  calculus  of  computa.on  

Acknowledgement  Some  text  and  graphics  used  in  these  slides  has  been  kindly  provided  by  Prof.  Madhusudan  Parthasarathy.