Assigning Meanings to Programs

Assigning Meanings to Programs

In 1967 Robert Floyd (who later won an ACM Turing Award) explained how logical propositions could be used to assert useful properties of programs without the need to use a computer or a specific programming language.

7330b65ea54e1b90a987a552e5c5cf32?s=128

Mark Allen

August 23, 2016
Tweet

Transcript

  1. Mark Allen Alert Logic @bytemeorg mrallen1@yahoo.com

  2. Assigning Meanings to Programs | @bytemeorg

  3. Assigning Meanings to Programs | @bytemeorg

  4. • ACM Turing Award 1978 • Completely self-taught (worked as

    a computer operator during the night shift) • Never earned a PhD • BS 1953 (aged 17) • Wrote one of the first ALGOL compilers • Primary pre-publication reviewer of Knuth’s The Art of Computer Programming Assigning Meanings to Programs | @bytemeorg
  5. “The state of the art of computer programming was recently

    referred to by Robert Balzer in these words: It is well known that software is in a depressed state. It is unreliable, delivered late, unresponsive to change, inefficient, and expensive. Furthermore, since it is currently labor intensive, the situation will further deteriorate as demand increases and labor costs rise. If this sounds like the famous "software crisis" of a decade or so ago, the fact that we have been in the same state for ten or fifteen years suggests that "software depression" is a more apt term.” Assigning Meanings to Programs | @bytemeorg
  6. The older schools gradually disappear. In part their disappearance is

    caused by their members' conversion to the new paradigm. But there are always some men who cling to one or another of the older views, and they are simply read out of the profession, which thereafter ignores their work. Thomas S. Kuhn In computing, there is no mechanism for reading such men out of the profession. I suspect they mainly become managers of software development…I believe the best chance we have to improve the general practice of programming is to attend to our paradigms. Assigning Meanings to Programs | @bytemeorg
  7. Assigning Meanings to Programs | @bytemeorg

  8. “…The proposal that the semantics of a programming language may

    be defined independently of all processors for that language, by establishing standards of rigor for proofs about programs in the language appear to be novel...” Assigning Meanings to Programs | @bytemeorg
  9. n = 10 i = 1 S = 0 while

    i <= n: S = S + i i = i + 1 print "S is {0}".format(S) Assigning Meanings to Programs | @bytemeorg
  10. Assigning Meanings to Programs | @bytemeorg

  11. n = 3 i = 1 S = 0 while

    i <= n: S = S + i i = i + 1 print "S is {0}".format(S) Assigning Meanings to Programs | @bytemeorg
  12. n = 3 i = 1 S = 0 while

    i <= n: S = S + i i = i + 1 print "S is {0}".format(S) State: n = 3 i = 1 S = 0 Assigning Meanings to Programs | @bytemeorg
  13. n = 3 i = 1 S = 0 while

    i <= n: S = S + i i = i + 1 print "S is {0}".format(S) State: n = 3 i = 1 S = 1 Assigning Meanings to Programs | @bytemeorg
  14. n = 3 i = 1 S = 0 while

    i <= n: S = S + i i = i + 1 print "S is {0}".format(S) State: n = 3 i = 2 S = 1 Assigning Meanings to Programs | @bytemeorg
  15. n = 3 i = 1 S = 0 while

    i <= n: S = S + i i = i + 1 print "S is {0}".format(S) State: n = 3 i = 2 S = 1 Assigning Meanings to Programs | @bytemeorg
  16. n = 3 i = 1 S = 0 while

    i <= n: S = S + i i = i + 1 print "S is {0}".format(S) State: n = 3 i = 4 S = 6 Eventually… Assigning Meanings to Programs | @bytemeorg
  17. § Assign 1st order logical predicates to edges in a

    graph of computation. § These logical predicates define the state the computer must be in. § The logic statements have a 1:1 correspondence with programming language statements. § In Assigning Meanings to Programs Floyd defines logical statements for an abstract flowchart “language” and for certain ALGOL60 instructions. § Also defined logical predicates for “start” and “termination.” Assigning Meanings to Programs | @bytemeorg
  18. §Assert correctness: an execution solves a given problem correctly. §Assert

    invariants: a program has certain properties which are never violated during its execution. §Assert equivalence: one program and another program are the same program. (Thus any invariants also hold.) §Assert termination: computation will end. Assigning Meanings to Programs | @bytemeorg
  19. Assigning Meanings to Programs | @bytemeorg

  20. Assigning Meanings to Programs | @bytemeorg

  21. Assigning Meanings to Programs | @bytemeorg

  22. Assigning Meanings to Programs | @bytemeorg

  23. §Documentation §Test suites §“Use the Source, Luke” Assigning Meanings to

    Programs | @bytemeorg
  24. §Visualization §Analysis – Manual and Automatic Assigning Meanings to Programs

    | @bytemeorg
  25. Assigning Meanings to Programs | @bytemeorg

  26. Assigning Meanings to Programs | @bytemeorg

  27. Assigning Meanings to Programs | @bytemeorg

  28. Assigning Meanings to Programs | @bytemeorg

  29. §Using logical statements lets us abstract computation away from specific

    language and computer implementations. §Using logical statements lets us assert various useful properties of a program. §Visualization and code (AST) analysis are powerful techniques to understand how code behaves. §Historical papers are dope! Assigning Meanings to Programs | @bytemeorg
  30. QUESTIONS? Assigning Meanings to Programs | @bytemeorg

  31. § https://en.wikipedia.org/wiki/Robert_W._Floyd § Robert Floyd obituary, http://news.stanford.edu/news/2001/november7/floydobit-117.html § Assigning Meaning

    to Programs, https://www.cs.virginia.edu/~weimer/2007-615/reading/FloydMeaning.pdf § The paradigms of programming (1978 Turing Award Lecture), http://dl.acm.org/ft_gateway.cfm?id=359140 § http://paperswelove.org § http://pythontutor.com § http://tlaplus.net § http://code.activestate.com/recipes/213898/ § https://github.com/HewlettPackard/gas Assigning Meanings to Programs | @bytemeorg