SlideShare une entreprise Scribd logo
1  sur  33
Class 37:
Computability in
Theory and Practice




                        cs1120 Fall 2011
                            David Evans
                      21 November 2011
Plan
Questions for Exam 2
Computability Practice
Universal Languages (including Java)
Philosophical Discussion on Computability in
  Theory and Practice




                                               2
3
Inverse Problem
Input: strings p, q that each define Python
  procedures
Output: True if p and q are inverses (e.g., for all
  possible inputs x, p(q(x)) = x).
  Otherwise, False.




                                                      4
Inverse Problem is Noncomputable
 If we had an algorithm, inverse(p, q) that solves the
 InverseProblem, we could use it to define an
 algorithm halts(s) that solves the HaltingProblem:




                                                         5
Inverse Problem is Noncomputable
    If we had an algorithm, inverse(p, q) that solves the
    InverseProblem, we could use it to define an
    algorithm halts(s) that solves the HaltingProblem:

       def halts(s):
        inverse(“lambda x: x”,
                  “lambda x: begin(eval(s), x)”)
To make proof convincing: argue that this correctly defines halts
If s doesn’t finish the inputs are not inverses, hence inverse returns false (correct)
If s does finish, the inputs are inverses, hence inverse returns true (correct)


                                                                                         6
Python-Scheme-Equivalence Problem
Input: string s defines a Python program
Output: if there exists a Scheme program the
  defines the same function as s, output True.
  Otherwise, False.




                                                 7
Python-Scheme-Equivalence Problem
Input: string s that defines a Python program
Output: if there exists a Scheme program the
  defines the same function as s, output True.
  Otherwise, False.
  Python-Scheme-Equivalence is Computable.
  “Proof”:
  def pythonSchemeEquivalence(s):
    return True

                                                 8
Universal Programming Language
Definition: a programming language that can
  describe every algorithm.
Equivalently: a programming language that can
  simulate every Turing Machine.
Equivalently: a programming language in which
  you can implement a Universal Turing
  Machine.
Are
Python, Scheme, Charme, Java,
     and Aazda Universal
  Programming Languages?



                                10
Yes!
Proof: implement a Turing Machine simulator in
  the language.

What do you need to simulate a TM?




                                                 11
Simulating a Turing Machine
z   z              z                 z              z   z                 z             z   z   z   z   z   z   z   z   z   z   z   z   z



        ), #, R
                                          ), X, L



                                                                              (, #, L
                                                                                            Read/Write Infinite Tape
                                                                                                   Lists
                                                         2:
                                 1                      look
                                                        for (
           Start

                                          (, X, R

                                                                                            Finite State Machine
                       #, 1, -
                                            HALT                #, 0, -

                                                                                                   Numbers
                                         Finite State Machine
                                                                                            Processing
                                                                                                   Way to make decisions (if)
                                                                                                   Way to keep going
Can even simpler languages do this?




                                      13
Lambda Calculus
Rules for manipulating strings of symbols
     term = variable
           | term term
           | (term)
           | variable . term
                                                   Note: I have slightly altered
One main rule: -reduction                          the traditional syntax to
                                                   make it more like Scheme.
  (( x. M)N)        M
     with all x’s in M replaced by N
   This is a lot like Scheme, without primitives, special forms, mutation!
Church’s Computing Model:
          Lambda Calculus
Developed in 1930s in attempt
  to formalize mathematics
  (similar to Bertrand Russell’s
  goals)
Ran into similar paradoxes:
  solution: model computing
  not mathematics!
Basis of LISP and Scheme
                                   Alonzo Church, 1903-1995
Evaluating Lambda Expressions
redex: Term of the form (( x. M)N)
     Something that can be -reduced
An expression is in normal form if it contains no
  redexes.
To evaluate a lambda expression, keep doing
  reductions until you get to normal form.
 Why does Scheme/Charme need special forms to be universal,
 but lambda calculus can do everything with “application”?
Simulating a Turing Machine
z   z              z                 z              z   z                 z             z   z   z   z   z   z   z   z   z   z   z   z   z



        ), #, R
                                          ), X, L



                                                                              (, #, L
                                                                                            Read/Write Infinite Tape
                                                                                                   Lists
                                                         2:
                                 1                      look
                                                        for (
           Start

                                          (, X, R

                                                                                            Finite State Machine
                       #, 1, -
                                            HALT                #, 0, -

                                                                                                   Numbers
                                         Finite State Machine
                                                                                            Processing
                                                                                                   Way to make decisions (if)
                                                                                                   Way to keep going
Way to Keep Going: The Y-Combinator




        Y = λf (λx . (f (x x)) (λx . f (x x))
        This finds the fixed point of any function!
        (Y G) = (G (Y G))
Church-Turing Thesis
All mechanical computers are
  equally powerful (except for
  practical limits like memory
  size, time, display, energy, etc.)
There exists some Turing machine       Alonzo Church, 1903-1995

  that can simulate any mechanical
  computer
Any computer that is powerful
  enough to simulate a Turing
  machine, can simulate any
  mechanical computer

                                        Alan Turing, 1912-1954
All universal programming
language are equivalent in power:
they can all simulate a TM, which
can carry out any mechanical
algorithm.
Why so many equally powerful
 programming languages?
Proliferation of Universal PLs
“Aesthetics”
   Some people like :=, others prefer =.
   Some people think whitespace shouldn’t matter
     (e.g., Java, Scheme), others think programs should be
     formatted like they mean (e.g., Python)
   Some people like goto (BASIC, C) others like throw
     (Java, Python)
Expressiveness vs. Simplicity
   Python is more expressive than Scheme
Expressiveness vs. “Truthiness”
   How much you can say with a little code vs. how likely it
    is your code means what you think it does
high                              Programming Language
                  x86
                                           Design Space
                        C
Expressiveness


                                      Scheme    (display “Hello!”)

                                      Python   print ("Hello!")



                  public class HelloWorld {                                  strict typing,
                    public static void main(String[] args) {       Java      static
                      System.out.println ("Hello!");
                    }                                                    Ada
    low           }                                                            Spec#
                 more mistake prone                               less mistake prone
                                           “Truthiness”
Leading Philosopher on
     Computability
 in Theory and Practice


 http://video.google.com/videoplay?docid=1623254076490030585#
 http://www.funny-videos.co.uk/videoAliGScienceVideo39.html
Ali G Problem
Ali G Problem
Input: whole numbers x and y with up to d digits
  each (mostly nines)
Output: x y


            Theorist’s Question:
     Is the Ali G Problem computable?
Multiplication is Computable




                               27
Ali G Problem
Input: whole numbers x and y with up to d digits
  each (mostly nines)
Output: x y


             Ali G’s Question:
 Can real computers solve it for a given d?
Ali G was Right!
Theory assumes ideal computers:
  Unlimited, perfect memory
  Unlimited (finite) time
Real computers have:
  Limited memory, time, power outages, flaky
    programming languages, etc.
  There are many decidable problems we cannot solve
    with real computer: the actual inputs do matter
    (in practice, but not in theory!)
Things Real Computers Can Do
 That Turing Machines Cannot



Generate Heat




                   Provide an adequate
                      habitat for fish


     Stop a Door
flickrcc: martha_chapa95




         Happy Thanksgiving!
Don’t spend your Thanksgiving doing Exam 2! If you are well prepared, it should
only take a few hours. If you’re spending longer then that on it, you are doing
something wrong, or grossly misinterpreting the questions.

                                                                                  33

Contenu connexe

Tendances

Automata
AutomataAutomata
AutomataGaditek
 
AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESsuthi
 
Finite Automata in compiler design
Finite Automata in compiler designFinite Automata in compiler design
Finite Automata in compiler designRiazul Islam
 
Embedded systems
Embedded systemsEmbedded systems
Embedded systemsMitul Tank
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchySANUC2
 
5 decidability theory of computation
5 decidability theory of computation 5 decidability theory of computation
5 decidability theory of computation parmeet834
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysisDattatray Gandhmal
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdfDilouar Hossain
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Mohammad Ilyas Malik
 
2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練Abner Huang
 
Class 36: Halting Problem
Class 36: Halting ProblemClass 36: Halting Problem
Class 36: Halting ProblemDavid Evans
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 

Tendances (19)

Automata
AutomataAutomata
Automata
 
AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTES
 
App a
App aApp a
App a
 
Finite Automata in compiler design
Finite Automata in compiler designFinite Automata in compiler design
Finite Automata in compiler design
 
Embedded systems
Embedded systemsEmbedded systems
Embedded systems
 
Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchy
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
5 decidability theory of computation
5 decidability theory of computation 5 decidability theory of computation
5 decidability theory of computation
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
 
Ch2 finite automaton
Ch2 finite automatonCh2 finite automaton
Ch2 finite automaton
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdf
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
 
Automata Theory - Turing machine
Automata Theory - Turing machineAutomata Theory - Turing machine
Automata Theory - Turing machine
 
Mcs 031
Mcs 031Mcs 031
Mcs 031
 
2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練
 
Class 36: Halting Problem
Class 36: Halting ProblemClass 36: Halting Problem
Class 36: Halting Problem
 
Automaton
AutomatonAutomaton
Automaton
 
Randomized Computation
Randomized ComputationRandomized Computation
Randomized Computation
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 

En vedette

Lecture 1: Introduction
Lecture 1: IntroductionLecture 1: Introduction
Lecture 1: IntroductionDavid Evans
 
Truth Table Game
Truth Table GameTruth Table Game
Truth Table GameJesseAlloy
 
Class 1: What is an Operating System?
Class 1: What is an Operating System?Class 1: What is an Operating System?
Class 1: What is an Operating System?David Evans
 
Invent the Future (Operating Systems in 2029)
Invent the Future (Operating Systems in 2029)Invent the Future (Operating Systems in 2029)
Invent the Future (Operating Systems in 2029)David Evans
 
Stable Matching
Stable MatchingStable Matching
Stable MatchingMaria Hito
 

En vedette (6)

Lecture 1: Introduction
Lecture 1: IntroductionLecture 1: Introduction
Lecture 1: Introduction
 
Truth Table Game
Truth Table GameTruth Table Game
Truth Table Game
 
Class 1: What is an Operating System?
Class 1: What is an Operating System?Class 1: What is an Operating System?
Class 1: What is an Operating System?
 
Invent the Future (Operating Systems in 2029)
Invent the Future (Operating Systems in 2029)Invent the Future (Operating Systems in 2029)
Invent the Future (Operating Systems in 2029)
 
Sets
SetsSets
Sets
 
Stable Matching
Stable MatchingStable Matching
Stable Matching
 

Similaire à Class 37: Computability in Theory and Practice

Site visit presentation 2012 12 14
Site visit presentation 2012 12 14Site visit presentation 2012 12 14
Site visit presentation 2012 12 14Mitchell Wand
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computationprasadmvreddy
 
Csr2011 june17 12_00_morin
Csr2011 june17 12_00_morinCsr2011 june17 12_00_morin
Csr2011 june17 12_00_morinCSR2011
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxssuser039bf6
 
Class 11: Deeper List Procedures
Class 11: Deeper List ProceduresClass 11: Deeper List Procedures
Class 11: Deeper List ProceduresDavid Evans
 
Write Your Own JVM Compiler
Write Your Own JVM CompilerWrite Your Own JVM Compiler
Write Your Own JVM CompilerErin Dees
 
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
Busy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docxBusy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docx
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docxjasoninnes20
 
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
Busy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docxBusy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docx
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docxclairbycraft
 
Csr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCsr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCSR2011
 
Speech To Sign Language Interpreter System
Speech To Sign Language Interpreter SystemSpeech To Sign Language Interpreter System
Speech To Sign Language Interpreter Systemkkkseld
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler DesignKuppusamy P
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISPDevnology
 
Contributions to connectionist language modeling and its application to seque...
Contributions to connectionist language modeling and its application to seque...Contributions to connectionist language modeling and its application to seque...
Contributions to connectionist language modeling and its application to seque...Francisco Zamora-Martinez
 
compiler Design course material chapter 2
compiler Design course material chapter 2compiler Design course material chapter 2
compiler Design course material chapter 2gadisaAdamu
 
Undecidability.pptx
Undecidability.pptxUndecidability.pptx
Undecidability.pptxPEzhumalai
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghggggggggggggggggggggggggggggggggggadugnanegero
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaPRAVEENTALARI4
 

Similaire à Class 37: Computability in Theory and Practice (20)

Special topics in finance lecture 2
Special topics in finance   lecture 2Special topics in finance   lecture 2
Special topics in finance lecture 2
 
Site visit presentation 2012 12 14
Site visit presentation 2012 12 14Site visit presentation 2012 12 14
Site visit presentation 2012 12 14
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
 
Csr2011 june17 12_00_morin
Csr2011 june17 12_00_morinCsr2011 june17 12_00_morin
Csr2011 june17 12_00_morin
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptx
 
Unit2 Toc.pptx
Unit2 Toc.pptxUnit2 Toc.pptx
Unit2 Toc.pptx
 
Class 11: Deeper List Procedures
Class 11: Deeper List ProceduresClass 11: Deeper List Procedures
Class 11: Deeper List Procedures
 
Write Your Own JVM Compiler
Write Your Own JVM CompilerWrite Your Own JVM Compiler
Write Your Own JVM Compiler
 
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
Busy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docxBusy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docx
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
 
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
Busy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docxBusy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docx
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
 
Csr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCsr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminski
 
Speech To Sign Language Interpreter System
Speech To Sign Language Interpreter SystemSpeech To Sign Language Interpreter System
Speech To Sign Language Interpreter System
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
RegexCat
RegexCatRegexCat
RegexCat
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
 
Contributions to connectionist language modeling and its application to seque...
Contributions to connectionist language modeling and its application to seque...Contributions to connectionist language modeling and its application to seque...
Contributions to connectionist language modeling and its application to seque...
 
compiler Design course material chapter 2
compiler Design course material chapter 2compiler Design course material chapter 2
compiler Design course material chapter 2
 
Undecidability.pptx
Undecidability.pptxUndecidability.pptx
Undecidability.pptx
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
 

Plus de David Evans

Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!David Evans
 
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksTrick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksDavid Evans
 
Hidden Services, Zero Knowledge
Hidden Services, Zero KnowledgeHidden Services, Zero Knowledge
Hidden Services, Zero KnowledgeDavid Evans
 
Anonymity in Bitcoin
Anonymity in BitcoinAnonymity in Bitcoin
Anonymity in BitcoinDavid Evans
 
Midterm Confirmations
Midterm ConfirmationsMidterm Confirmations
Midterm ConfirmationsDavid Evans
 
Scripting Transactions
Scripting TransactionsScripting Transactions
Scripting TransactionsDavid Evans
 
How to Live in Paradise
How to Live in ParadiseHow to Live in Paradise
How to Live in ParadiseDavid Evans
 
Mining Economics
Mining EconomicsMining Economics
Mining EconomicsDavid Evans
 
Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More ParanoidDavid Evans
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key SignaturesDavid Evans
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to CryptographyDavid Evans
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?David Evans
 
Multi-Party Computation for the Masses
Multi-Party Computation for the MassesMulti-Party Computation for the Masses
Multi-Party Computation for the MassesDavid Evans
 
Proof of Reserve
Proof of ReserveProof of Reserve
Proof of ReserveDavid Evans
 
Blooming Sidechains!
Blooming Sidechains!Blooming Sidechains!
Blooming Sidechains!David Evans
 
Useful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinUseful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinDavid Evans
 

Plus de David Evans (20)

Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!Cryptocurrency Jeopardy!
Cryptocurrency Jeopardy!
 
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for CypherpunksTrick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
Trick or Treat?: Bitcoin for Non-Believers, Cryptocurrencies for Cypherpunks
 
Hidden Services, Zero Knowledge
Hidden Services, Zero KnowledgeHidden Services, Zero Knowledge
Hidden Services, Zero Knowledge
 
Anonymity in Bitcoin
Anonymity in BitcoinAnonymity in Bitcoin
Anonymity in Bitcoin
 
Midterm Confirmations
Midterm ConfirmationsMidterm Confirmations
Midterm Confirmations
 
Scripting Transactions
Scripting TransactionsScripting Transactions
Scripting Transactions
 
How to Live in Paradise
How to Live in ParadiseHow to Live in Paradise
How to Live in Paradise
 
Bitcoin Script
Bitcoin ScriptBitcoin Script
Bitcoin Script
 
Mining Economics
Mining EconomicsMining Economics
Mining Economics
 
Mining
MiningMining
Mining
 
The Blockchain
The BlockchainThe Blockchain
The Blockchain
 
Becoming More Paranoid
Becoming More ParanoidBecoming More Paranoid
Becoming More Paranoid
 
Asymmetric Key Signatures
Asymmetric Key SignaturesAsymmetric Key Signatures
Asymmetric Key Signatures
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
 
Class 1: What is Money?
Class 1: What is Money?Class 1: What is Money?
Class 1: What is Money?
 
Multi-Party Computation for the Masses
Multi-Party Computation for the MassesMulti-Party Computation for the Masses
Multi-Party Computation for the Masses
 
Proof of Reserve
Proof of ReserveProof of Reserve
Proof of Reserve
 
Silk Road
Silk RoadSilk Road
Silk Road
 
Blooming Sidechains!
Blooming Sidechains!Blooming Sidechains!
Blooming Sidechains!
 
Useful Proofs of Work, Permacoin
Useful Proofs of Work, PermacoinUseful Proofs of Work, Permacoin
Useful Proofs of Work, Permacoin
 

Dernier

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Dernier (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

Class 37: Computability in Theory and Practice

  • 1. Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011
  • 2. Plan Questions for Exam 2 Computability Practice Universal Languages (including Java) Philosophical Discussion on Computability in Theory and Practice 2
  • 3. 3
  • 4. Inverse Problem Input: strings p, q that each define Python procedures Output: True if p and q are inverses (e.g., for all possible inputs x, p(q(x)) = x). Otherwise, False. 4
  • 5. Inverse Problem is Noncomputable If we had an algorithm, inverse(p, q) that solves the InverseProblem, we could use it to define an algorithm halts(s) that solves the HaltingProblem: 5
  • 6. Inverse Problem is Noncomputable If we had an algorithm, inverse(p, q) that solves the InverseProblem, we could use it to define an algorithm halts(s) that solves the HaltingProblem: def halts(s): inverse(“lambda x: x”, “lambda x: begin(eval(s), x)”) To make proof convincing: argue that this correctly defines halts If s doesn’t finish the inputs are not inverses, hence inverse returns false (correct) If s does finish, the inputs are inverses, hence inverse returns true (correct) 6
  • 7. Python-Scheme-Equivalence Problem Input: string s defines a Python program Output: if there exists a Scheme program the defines the same function as s, output True. Otherwise, False. 7
  • 8. Python-Scheme-Equivalence Problem Input: string s that defines a Python program Output: if there exists a Scheme program the defines the same function as s, output True. Otherwise, False. Python-Scheme-Equivalence is Computable. “Proof”: def pythonSchemeEquivalence(s): return True 8
  • 9. Universal Programming Language Definition: a programming language that can describe every algorithm. Equivalently: a programming language that can simulate every Turing Machine. Equivalently: a programming language in which you can implement a Universal Turing Machine.
  • 10. Are Python, Scheme, Charme, Java, and Aazda Universal Programming Languages? 10
  • 11. Yes! Proof: implement a Turing Machine simulator in the language. What do you need to simulate a TM? 11
  • 12. Simulating a Turing Machine z z z z z z z z z z z z z z z z z z z z ), #, R ), X, L (, #, L Read/Write Infinite Tape Lists 2: 1 look for ( Start (, X, R Finite State Machine #, 1, - HALT #, 0, - Numbers Finite State Machine Processing Way to make decisions (if) Way to keep going
  • 13. Can even simpler languages do this? 13
  • 14. Lambda Calculus Rules for manipulating strings of symbols term = variable | term term | (term) | variable . term Note: I have slightly altered One main rule: -reduction the traditional syntax to make it more like Scheme. (( x. M)N) M with all x’s in M replaced by N This is a lot like Scheme, without primitives, special forms, mutation!
  • 15. Church’s Computing Model: Lambda Calculus Developed in 1930s in attempt to formalize mathematics (similar to Bertrand Russell’s goals) Ran into similar paradoxes: solution: model computing not mathematics! Basis of LISP and Scheme Alonzo Church, 1903-1995
  • 16. Evaluating Lambda Expressions redex: Term of the form (( x. M)N) Something that can be -reduced An expression is in normal form if it contains no redexes. To evaluate a lambda expression, keep doing reductions until you get to normal form. Why does Scheme/Charme need special forms to be universal, but lambda calculus can do everything with “application”?
  • 17. Simulating a Turing Machine z z z z z z z z z z z z z z z z z z z z ), #, R ), X, L (, #, L Read/Write Infinite Tape Lists 2: 1 look for ( Start (, X, R Finite State Machine #, 1, - HALT #, 0, - Numbers Finite State Machine Processing Way to make decisions (if) Way to keep going
  • 18. Way to Keep Going: The Y-Combinator Y = λf (λx . (f (x x)) (λx . f (x x)) This finds the fixed point of any function! (Y G) = (G (Y G))
  • 19. Church-Turing Thesis All mechanical computers are equally powerful (except for practical limits like memory size, time, display, energy, etc.) There exists some Turing machine Alonzo Church, 1903-1995 that can simulate any mechanical computer Any computer that is powerful enough to simulate a Turing machine, can simulate any mechanical computer Alan Turing, 1912-1954
  • 20. All universal programming language are equivalent in power: they can all simulate a TM, which can carry out any mechanical algorithm.
  • 21. Why so many equally powerful programming languages?
  • 22. Proliferation of Universal PLs “Aesthetics” Some people like :=, others prefer =. Some people think whitespace shouldn’t matter (e.g., Java, Scheme), others think programs should be formatted like they mean (e.g., Python) Some people like goto (BASIC, C) others like throw (Java, Python) Expressiveness vs. Simplicity Python is more expressive than Scheme Expressiveness vs. “Truthiness” How much you can say with a little code vs. how likely it is your code means what you think it does
  • 23. high Programming Language x86 Design Space C Expressiveness Scheme (display “Hello!”) Python print ("Hello!") public class HelloWorld { strict typing, public static void main(String[] args) { Java static System.out.println ("Hello!"); } Ada low } Spec# more mistake prone less mistake prone “Truthiness”
  • 24. Leading Philosopher on Computability in Theory and Practice http://video.google.com/videoplay?docid=1623254076490030585# http://www.funny-videos.co.uk/videoAliGScienceVideo39.html
  • 26. Ali G Problem Input: whole numbers x and y with up to d digits each (mostly nines) Output: x y Theorist’s Question: Is the Ali G Problem computable?
  • 28. Ali G Problem Input: whole numbers x and y with up to d digits each (mostly nines) Output: x y Ali G’s Question: Can real computers solve it for a given d?
  • 29.
  • 30.
  • 31. Ali G was Right! Theory assumes ideal computers: Unlimited, perfect memory Unlimited (finite) time Real computers have: Limited memory, time, power outages, flaky programming languages, etc. There are many decidable problems we cannot solve with real computer: the actual inputs do matter (in practice, but not in theory!)
  • 32. Things Real Computers Can Do That Turing Machines Cannot Generate Heat Provide an adequate habitat for fish Stop a Door
  • 33. flickrcc: martha_chapa95 Happy Thanksgiving! Don’t spend your Thanksgiving doing Exam 2! If you are well prepared, it should only take a few hours. If you’re spending longer then that on it, you are doing something wrong, or grossly misinterpreting the questions. 33