Impossible Programs - GOTO...

79
Impossible Programs Tom Stuart

Transcript of Impossible Programs - GOTO...

Page 1: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Impossible ProgramsTom Stuart

Page 2: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

IMPOSSIBLEPROGRAMS

@tomstuart / GOTO Chicago / 2015-05-11

Page 3: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

CAN’TDOPROGRAMS

EVERYTHING

Page 4: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

IMPOSSIBLEPROGRAMS

@tomstuart / GOTO Chicago / 2015-05-11

Page 5: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

how can a

PROGRAMbe

IMPOSSIBLE?

Page 6: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

WE DEMAND UNIVERSAL SYSTEMS

Page 7: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Compare two programming languages, say Python and Ruby.

Page 8: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

We can translate any Python program into Ruby.We can translate any Ruby program into Python.

We can implement a Python interpreter in Ruby.We can implement a Ruby interpreter in Python.

We can implement a Python interpreter in JavaScript.We can implement a JavaScript interpreter in Python.

Page 9: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

JavaScript

Ruby

Python

Lambda calculus Turing machines

SKI calculusTag systems

Partial recursive functions

Game of Life

Rule 110C++ Haskell

Lisp Register machines

Magic: The Gathering

C

Java

XSLT

Page 10: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Universal systems can run software.

We don’t just want machines, we want general-purpose machines.

Page 11: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

PROGRAMS ARE DATA

Page 12: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

>> puts 'hello world'hello world=> nil

>> program = "puts 'hello world'"=> "puts 'hello world'">> bytes_in_binary = program.bytes. map { |byte| byte.to_s(2).rjust(8, '0') } => ["01110000", "01110101", "01110100", "01110011", "00100000", "00100111", "01101000", "01100101", "01101100", "01101100", "01101111", "00100000", "01110111", "01101111", "01110010", "01101100", "01100100", "00100111"]

>> number = bytes_in_binary.join.to_i(2) => 9796543849500706521102980495717740021834791

Page 13: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

>> number = 9796543849500706521102980495717740021834791=> 9796543849500706521102980495717740021834791

>> bytes_in_binary = number.to_s(2).scan(/.+?(?=.{8}*\z)/) => [ "1110000", "01110101", "01110100", "01110011", "00100000", "00100111", "01101000", "01100101", "01101100", "01101100", "01101111", "00100000", "01110111", "01101111", "01110010", "01101100", "01100100", "00100111"]

>> program = bytes_in_binary.map { |string| string.to_i(2).chr }.join=> "puts 'hello world'"

>> eval programhello world=> nil

Page 14: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

UNIVERSAL SYSTEMS+

PROGRAMS ARE DATA=

INFINITE LOOPS

Page 15: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Every universal system can simulate every other universal system, including itself.

More specifically: every universal programming language can implement its own interpreter.

Page 16: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

def evaluate(program, input) # parse program # evaluate program on input while capturing output # return outputend

Page 17: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

>> evaluate('print $stdin.read.reverse', 'hello world')=> "dlrow olleh"

Page 18: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

def evaluate(program, input) # parse program # evaluate program on input while capturing output # return outputenddef evaluate_on_itself(program) evaluate(program, program)end

Page 19: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

>> evaluate_on_itself('print $stdin.read.reverse')=> "esrever.daer.nidts$ tnirp"

Page 20: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

def evaluate(program, input) # parse program # evaluate program on input while capturing output # return outputenddef evaluate_on_itself(program) evaluate(program, program)endprogram = $stdin.readif evaluate_on_itself(program) == 'no' print 'yes'else print 'no'end

does_it_say_no.rb

Page 21: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

$ echo 'print $stdin.read.reverse' | ruby does_it_say_no.rbno

$ echo 'print "no" if $stdin.read.include?("no")' | ruby does_it_say_no.rbyes

$ ruby does_it_say_no.rb < does_it_say_no.rb???

Page 22: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

does_it_say_no.rb

yesno

does_it_say_no.rb

✘ ✘

Page 23: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

does_it_say_no.rb

yesno

never finishother output?

does_it_say_no.rb

✘ ✔✘ ✘

Page 24: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Ruby is universal

so we can write #evaluate in it

so we can construct a special program that loops forever

Page 25: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

so here's one

PROGRAMIMPOSSIBLE

Page 26: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Sometimes infinite loops are bad.

We could remove features from a language until there’s no way to cause an infinite loop.

Page 27: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

remove while loops etc, only allow iteration over finite data structures

to prevent (λx.x x)(λx.x x)

e.g. only allow a function to call other functions whose names come later in the alphabet

• No unlimited iteration

• No lambdas

• No recursive function calls

• No blocking I/O• ...

Page 28: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

The result is called a total programming language.

It must be impossible to write an interpreter for a total

language in itself.

Page 29: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

if we could write #evaluate in a total language

so it must be impossible to write #evaluate in one

then we could use it to construct a special program that loops forever

but a total language doesn’t let you write programs that loop forever

Page 30: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

(That’s weird, because a total language’s interpreter always finishes eventually, so

it feels like the kind of program we should be able to write.)

Page 31: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

We could write an interpreter for a total language in a universal language, or in some other more

powerful total language.

Page 32: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

ABOUTREALITY?

WHATokay but

Page 33: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

#evaluate is an impossible program for any total language, which means that total

languages can’t be universal.

Universal systems have impossible programs too.

Page 34: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

input = $stdin.readputs input.upcase

This program always finishes.*

* assuming STDIN is finite & nonblocking

Page 35: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

input = $stdin.read

while true # do nothingend

puts input.upcase

This program always loops forever.

Page 36: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Can we write a program that candecide this in general?

(This question is called the halting problem.)

Page 37: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

input = $stdin.readoutput = '' n = input.lengthuntil n.zero? output = output + '*' n = n - 1 endputs output

Page 38: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

require 'prime'def primes_less_than(n) Prime.each(n - 1).entriesenddef sum_of_two_primes?(n) primes = primes_less_than(n) primes.any? { |a| primes.any? { |b| a + b == n } } endn = 4 while sum_of_two_primes?(n) n = n + 2 endprint n

Page 39: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

def halts?(program, input) # parse program # analyze program # return true if program halts on input, false if notend

Page 40: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

>> halts?('print $stdin.read', 'hello world')=> true

>> halts?('while true do end', 'hello world')=> false

Page 41: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

def halts?(program, input) # parse program # analyze program # return true if program halts on input, false if notenddef halts_on_itself?(program) halts?(program, program)endprogram = $stdin.readif halts_on_itself?(program) while true # do nothing endend

do_the_opposite.rb

Page 42: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

$ ruby do_the_opposite.rb < do_the_opposite.rb

Page 43: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

do_the_opposite.rb

eventually finish loop forever

do_the_opposite.rb

✘ ✘

Page 44: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Every real program must either loop forever or not, but whichever happens, #halts?

will be wrong about it.

do_the_opposite.rb forces #halts? to give the wrong answer.

Page 45: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

if we could write #halts?

so it must be impossible to write #halts?

then we could use it to construct a special program that forces #halts? to give the wrong answer

but a correct implementation of #halts? would always give the right answer

Page 46: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

WHOCARES?

okay but

Page 47: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

We never actually want to ask a computer whether a program will loop forever.

But we often want to ask computers other questions about programs.

Page 48: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

def prints_hello_world?(program, input) # parse program # analyze program # return true if program prints "hello world", false if notend

Page 49: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

>> prints_hello_world?('print $stdin.read.reverse', 'dlrow olleh')=> true

>> prints_hello_world?('print $stdin.read.upcase', 'dlrow olleh')=> false

Page 50: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

def prints_hello_world?(program, input) # parse program # analyze program # return true if program prints "hello world", false if notenddef halts?(program, input) hello_world_program = %Q{ program = #{program.inspect} input = $stdin.read evaluate(program, input) print 'hello world' } prints_hello_world?(hello_world_program, input)end

Page 51: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

if we could write #prints_hello_world?

so it must be impossible to write #prints_hello_world?

then we could use it to construct a correct implementation of #halts?

but it’s impossible to correctly implement #halts?

Page 52: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Not only can we not ask “does this program halt?”,

we also can’t ask “does this program do what I want it to do?”.

Page 53: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

This is Rice’s theorem:

Any interesting property of program behavior

is undecidable.

Page 54: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

WHY

HAPPEN?

DOESTHIS

Page 55: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

We can’t look into the future and predict what a program will do.

The only way to find out for sure is to run it.

But when we run a program, we don’t know how long we have to wait for it to finish.

(Some programs never will.)

Page 56: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Any system with enough power to be self-referential can’t correctly answer every question about itself.

We need to step outside the self-referential system and use a different, more powerful system to answer

questions about it.

But there is no more powerful system to upgrade to.

Page 57: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

HOW

COPE?CAN WE

Page 58: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

• Ask undecidable questions, but give up if an answer can’t be found in a reasonable time.

• Ask several small questions whose answers provide evidence for the answer to a larger question.

• Ask decidable questions by being conservative.

• Approximate a program by converting it into something simpler, then ask questions about the approximation.

Page 59: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

StuartU

nderstanding Com

putation

From Simple Machines to Impossible Programs

Tom Stuart

Understanding Computation

Finally, you can learn computation theory and programming language design in an engaging, practical way. Understanding Computation explains theoretical computer science in a context you’ll recognize, helping you appreciate why these ideas matter and how they can inform your day-to-day programming.

Rather than use mathematical notation or an unfamiliar academic programming language like Haskell or Lisp, this book uses Ruby in a reductionist manner to present formal semantics, automata theory, and functional programming with the lambda calculus. It’s ideal for programmers versed in modern languages, with little or no formal training in computer science.

■ Understand fundamental computing concepts, such as Turing completeness in languages

■ Discover how programs use dynamic semantics to communicate ideas to machines

■ Explore what a computer can do when reduced to its bare essentials

■ Learn how universal Turing machines led to today’s general-purpose computers

■ Perform complex calculations, using simple languages and cellular automata

■ Determine which programming language features are essential for computation

■ Examine how halting and self-referencing make some computing problems unsolvable

■ Analyze programs by using abstract interpretation and type systems

Programming / C++

Understanding Computation

ISBN: 978-1-449-32927-3

US $34.99 CAN $36.99

oreilly.com

Twitter: @oreillymediafacebook.com/oreilly

Tom Stuart, a computer scientist and programmer, is the founder of Codon, a digital product consultancy in London. He works as a consultant, mentor, and trainer, helping companies to improve the quality and clarity of their approach to creating software products.

computationbook.com

Page 60: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 61: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 62: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 63: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 64: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 65: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 66: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 67: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 68: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 69: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 70: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 71: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 72: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 73: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 74: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 75: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 76: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation
Page 77: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

StuartU

nderstanding Com

putation

From Simple Machines to Impossible Programs

Tom Stuart

Understanding Computation

Finally, you can learn computation theory and programming language design in an engaging, practical way. Understanding Computation explains theoretical computer science in a context you’ll recognize, helping you appreciate why these ideas matter and how they can inform your day-to-day programming.

Rather than use mathematical notation or an unfamiliar academic programming language like Haskell or Lisp, this book uses Ruby in a reductionist manner to present formal semantics, automata theory, and functional programming with the lambda calculus. It’s ideal for programmers versed in modern languages, with little or no formal training in computer science.

■ Understand fundamental computing concepts, such as Turing completeness in languages

■ Discover how programs use dynamic semantics to communicate ideas to machines

■ Explore what a computer can do when reduced to its bare essentials

■ Learn how universal Turing machines led to today’s general-purpose computers

■ Perform complex calculations, using simple languages and cellular automata

■ Determine which programming language features are essential for computation

■ Examine how halting and self-referencing make some computing problems unsolvable

■ Analyze programs by using abstract interpretation and type systems

Programming / C++

Understanding Computation

ISBN: 978-1-449-32927-3

US $34.99 CAN $36.99

oreilly.com

Twitter: @oreillymediafacebook.com/oreilly

Tom Stuart, a computer scientist and programmer, is the founder of Codon, a digital product consultancy in London. He works as a consultant, mentor, and trainer, helping companies to improve the quality and clarity of their approach to creating software products.

computationbook.com

Page 78: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

thanks!@tomstuart / [email protected] / computationbook.com

Page 79: Impossible Programs - GOTO Conferencegotocon.com/dl/goto-chicago-2015/slides/TomStuart_ImpossiblePrograms.pdfFrom Simple Machines to Impossible Programs Tom Stuart Understanding Computation

Questions?Please remember to evaluate via the GOTO

Guide App