Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Practical Implications of Rice's Theorem

Practical Implications of Rice's Theorem

Rice's Theorem -- and what it means for you! :)

Avatar for Simon Cross

Simon Cross

June 01, 2013
Tweet

More Decks by Simon Cross

Other Decks in Programming

Transcript

  1. FORMAL(ISH) STATEMENT Given a non-trivial property of computable partial functions

    the problem of whether a particular program computes such a function is undecidable
  2. NON-TRIVIAL A least one function that has the property A

    least one function that doesn't have the property
  3. DOESN'T WORK FOR: Properties that refer to the implementation Number

    of lines of code Number of for-loops Whether the code is syntactically correct
  4. ... IN PYTHON! d e f h a s _

    c o o l _ p r o p e r t y ( f ) : " " " R e t u r n s T r u e i f f h a s t h i s c o o l p r o p e r t y , F a l s e o t h e r w i s e . " " " # X X X : P u t m a g i c h e r e ! d e f t i n y _ c o o l _ f u n c t i o n ( * a r g s , * * k w ) : " " " T i n y f u n c t i o n w e w r o t e t o s h o w t h e c o o l p r o p e r t y i s s o m e t i m e s m e t . " " " # X X X : W r i t e t h i s . d e f h a l t s ( a , i ) : " " " R e t u r n s T r u e i f a h a l t s g i v e n i n p u t i . " " " d e f t ( * a r g s , * * k w ) : a ( i ) # t h i s i s j u s t h e r e t o m e s s w i t h h a s _ c o o l _ p r o p e r t y r e t u r n t i n y _ c o o l _ f u n c t i o n ( * a r g s , * * k w ) r e t u r n h a s _ c o o l _ p r o p e r t y ( t )
  5. UPFRONT DESIGN If you want a property, design it in

    up front ... because you won't be able to check later. :/
  6. ITS GRAMMAR IS AMBIGUOUS IN CRAZY WAYS: w h a

    t e v e r / 2 5 ; # / ; d i e " t h i s d i e s ! " ;
  7. IF YOU EVER NEED TO FEEL GREAT ABOUT USING PYTHON:

    by Randal Schwartz (2000) by Adam Kennedy by Jeffrey Kegler (2008) On Parsing Perl PPI man page Perl Cannot be Parsed: A Formal Proof
  8. “Compiling a program and staring at a screenfull of nagging

    messages is a dull and exasperating activity.”
  9. “In fact, I would venture to say that after a

    couple days playing with Python, many faculty who are now teaching C++ would know Python better.”
  10. IDEAS GENERATED BY QUESTIONS AND COMMENTS AFTER THE TALK Scalability

    is another property one can't tack on to programs afterwards. JIT compilation also benefits from Rice's Theorem since it imposes strong bounds on what static compilation can prove about the algorithm implemented.