Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

I Want to Write Software That Doesn't Hang

I Want to Write Software That Doesn't Hang

Presentation at the Open Days of the Faculty of Electrical Engineering, Mathematics, and Computer Science, of Delft University of Technology, October 18, 2013
http://www.tudelft.nl/studeren/bacheloropleidingen/voorlichting-bachelors/open-dagen/

Explaining the Halting Problem and Reductio Ad Absurdum to High School Students

Arie van Deursen

October 18, 2013
Tweet

More Decks by Arie van Deursen

Other Decks in Education

Transcript

  1. I  Want  to  Write   So,ware   That  Doesn’t  Hang

      Arie  van  Deursen              @avandeursen           Open  Days  EEMCS   October  18,  2013  
  2. The  So,ware  Engineering     Research  Group   Educa&on  

    •  Programming,     so,ware  engineering   •  MSc,  BSc  projects   Research   •  So,ware  change   •  So,ware  architecture   •  So,ware  tesNng   •  CollaboraNon   •  End-­‐user  programming   •  Language  engineering   2  
  3. David  Notkin     “…  the  intent  is  to  make

        the  engineering  of  so1ware  more  effec5ve     so  that  society  can  benefit  even  more     from  the  amazing  poten5al  of  so1ware.”       (ACM  TOSEM  Editorial,  2013)  
  4. How  can  I  know  that     my  program  won’t

     stop?   •  Can  I  just  try  it?   •  You  may  have  to  wait   infinitely  long  
  5. How  can  I  know  that   my  program  won’t  stop?

      •  Can  I  carefully  read  it?   •  That  may  help.   But  real  programs  are   too  complicated  for   that.   hTp://www.flickr.com/photos/abee5/8314929977/  
  6. How  can  I  know  that   my  program  won’t  stop?

        •  Isn’t  there  some  other  program  that  can  tell   me  if  my  program  will  ever  stop?   •  Can’t  TU  Del1  come  up  with  a  clever  program   that  can  check  for  any  other  program  whether   it  will  loop  for  ever?    
  7. Wanted!   Does-­‐it-­‐halt?   Any   program   Yes!  

    No!   But  provably  impossible  to  make!!  
  8. ReducNo  Ad  Absurdum   •  How  can  you  prove  that

        something  is  impossible?   1.  Assume  it    (let’s  call  it  X)  is  possible!   2.  Show  what  you  then  could  do   3.  Show  how  this  would  contradict  X’s  very   existence.  
  9. Does-­‐it-­‐halt?   Yes?   No?   Let’s  assume  we  have

     “Does-­‐it-­‐Halt”   Any   program  
  10. Does-­‐it-­‐halt?   Go  looping!   Stop  now!   I-­‐Will-­‐Do-­‐The-­‐Opposite  

    Yes?   No?   Let’s  build  another  program  using  it,   doing  just  the  opposite   Any   program  
  11. Does-­‐it-­‐halt?   Go  looping!   Stop  now!   I-­‐Will-­‐Do-­‐The-­‐Opposite  

    Yes?   No?   What  happens  if  I  pass     “I  will  do  the  opposite”  to  itself?  
  12. Does-­‐it-­‐halt?   Go  looping!   Stop  now!   I-­‐Will-­‐Do-­‐The-­‐Opposite  

    Yes?   No?   If  Does-­‐it-­‐halt  says  I-­‐Will-­‐Do-­‐The-­‐ Opposite  halts,  it  won’t!  
  13. Does-­‐it-­‐halt?   Go  looping!   Stop  now!   I-­‐Will-­‐Do-­‐The-­‐Opposite  

    Yes?   No?   If  Does-­‐it-­‐halt  says  I-­‐Will-­‐Do-­‐The-­‐ Opposite  does  not  halt,  it  will!  
  14. Does-­‐it-­‐halt?   Yes?   No?   This  is  a  contradicNon.

        The  premise  must  be  false.   Does-­‐it-­‐halt  cannot  exist!   Any   program  
  15. The  HalNng  Problem     •  Fundamentally  undecidable   (Alan

     Turing,  1936).     •  Many  other  important   properNes  (safety,  security,  …)   can  be  ‘reduced  to’  the  halNng   problem.   hTp://en.wikipedia.org/wiki/Alan_Turing  
  16. Fancy  Studying    Computer  Science?   •  Amazing  potenNal  of

        so,ware   •  Enjoy  programming!   •  The  power  of  abstracNon   •  So,ware  has  its  limits!   Image:  Wikipedia  
  17. Homework   •  Write  a  1000  word  essay  on  Alan

     Turing   •  [advanced]  Learn  about  decidability  from   Hofstadter’s  book  “Gödel,  Escher  Bach”   •  Learn  programming  on  Khan  Academy   •  [advanced]  Explore  github  &  contribute