Practical Implications of Rice's Theorem

Practical Implications of Rice's Theorem

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

3958e748e0704904fc94840c6872566b?s=128

Simon Cross

June 01, 2013
Tweet

Transcript

  1. RICE'S THEOREM AND WHAT IT MEANS FOR YOU! :) Created

    by / Simon Cross @hodgestar
  2. WHAT THE HECK IS RICE'S THEOREM?

  3. SOME THINGS ARE JUST UNPOSSIBLE! Which things? Glad you asked!

    :)
  4. PROPERTIES OF COMPUTABLE PARTIAL FUNCTIONS

  5. 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
  6. NON-TRIVIAL A least one function that has the property A

    least one function that doesn't have the property
  7. See for the gory details. :) Wikipedia

  8. KINDS OF PROPERTIES

  9. WORKS FOR: Properties that refer to behaviour Properties that refer

    to input and output only
  10. 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
  11. SKETCH OF A PROOF ...

  12. ... 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 )
  13. SO THESE IMPLICATIONS YOU PROMISED?

  14. QA AND TESTING

  15. SECURITY AND SANDBOXES

  16. COMPILING AND STATIC ANALYSIS

  17. NON-IMPLICATIONS a.k.a. things that might work

  18. UPFRONT DESIGN If you want a property, design it in

    up front ... because you won't be able to check later. :/
  19. HALT? BY SIMON CROSS / HODGESTAR.ZA.NET

  20. WHAT MADE YOU LOOK INTO ALL THIS?!

  21. BLAME PERL! It's unparsable. :/

  22. 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 ! " ;
  23. 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
  24. AN UNRELATED COOL THING: by John M. Zelle Python as

    a First Language
  25. “Compiling a program and staring at a screenfull of nagging

    messages is a dull and exasperating activity.”
  26. “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.”
  27. 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.