Class 36: The Meaning of Truth CS200: Computer Science

Slides:



Advertisements
Similar presentations
Computational Models The exam. Models of computation. –The Turing machine. –The Von Neumann machine. –The calculus. –The predicate calculus. Turing.
Advertisements

Elements of Lambda Calculus Functional Programming Academic Year Alessandro Cimatti
David Evans CS200: Computer Science University of Virginia Computer Science Class 30: Models of Computation.
Class 39: Universality cs1120 Fall 2009 David Evans University of Virginia.
David Evans CS200: Computer Science University of Virginia Computer Science Class 27: Modeling Computation.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 39: Lambda Calculus.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 40: Computing with Glue and Photons.
6. Introduction to the Lambda Calculus. © O. Nierstrasz PS — Introduction to the Lambda Calculus 6.2 Roadmap  What is Computability? — Church’s Thesis.
Turing Machines CS 105: Introduction to Computer Science.
Class 19: Undecidability in Theory and Practice David Evans cs302: Theory of Computation University of Virginia Computer.
David Evans CS200: Computer Science University of Virginia Computer Science Class 31: Universal Turing Machines.
Lecture 20: λ Calculus λ Calculus & Computability Yan Huang Dept. of Comp. Sci. University of Virginia.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
David Evans Turing Machines, Busy Beavers, and Big Questions about Computing.
Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011 cs1120 Fall 2011 David Evans 21 November 2011.
10/12/20151 GC16/3C11 Functional Programming Lecture 3 The Lambda Calculus A (slightly) deeper look.
CSE S. Tanimoto Lambda Calculus 1 Lambda Calculus What is the simplest functional language that is still Turing complete? Where do functional languages.
Lambda Calculus History and Syntax. History The lambda calculus is a formal system designed to investigate function definition, function application and.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 18: Think Globally, Mutate Locally.
David Evans CS200: Computer Science University of Virginia Computer Science Class 38: Fixed Points and Biological Computing.
Lecture 8: The Meaning of Life, Searching for Truth and The Stuff Primitives are Made Of (and a smattering of Quantum Physics) David Evans
David Evans CS150: Computer Science University of Virginia Computer Science Class 33: Computing with Photons From The.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 30: Laziness.
Cs3102: Theory of Computation Class 14: Turing Machines Spring 2010 University of Virginia David Evans.
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 36: Modeling Computing.
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
David Evans CS150: Computer Science University of Virginia Computer Science Class 32: Computability in Theory and Practice.
David Evans CS200: Computer Science University of Virginia Computer Science Class 26: Halting Problem It is plain at any.
Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L03-1 September 14, 2006http:// -calculus: A Basis for.
MA/CSSE 474 Theory of Computation Universal Turing Machine Church-Turing Thesis Delayed due dates for HWs See updated schedule page. No class meeting.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
A LISP interepreter for the Lambda Calculus Functional Programming
(Thunking about Thunks)
Introduction to Computing Science and Programming I
Unit – 3 :LAMBDA CALCULUS AND FUNCTIONAL PROGRAMMING
Lecture 6: Lambda Calculus
Lecture 4: Evaluation Rules Recursion CS200: Computer Science
Class 27: Universal Turing Machines CS150: Computer Science
Class 30: Models of Computation CS200: Computer Science
Selection—Making Decisions
More on Lambda Calculus
Lecture 37: A Universal Computer
CS 611: Lecture 9 More Lambda Calculus: Recursion, Scope, and Substitution September 17, 1999 Cornell University Computer Science Department Andrew Myers.
Lambda Calculus Revisited
Turing Machines, Busy Beavers, and Big Questions about Computing
Class 19: Think Globally, Mutate Locally CS150: Computer Science
Programming Languages and Compilers (CS 421)
Lecture 24: Metalinguistics CS200: Computer Science
Class 37: Making Lists, Numbers and Recursion from Glue Alone
Lecture 27: In Praise of Idleness CS200: Computer Science
CS 611: Lecture 10 More Lambda Calculus September 20, 1999
Class 33: Making Recursion M.C. Escher, Ascending and Descending
L Calculus.
Class 24: Computability Halting Problems Hockey Team Logo
Class 31: Universal Turing Machines CS200: Computer Science
Lecture 10: Fixed Points ad Infinitum M.C. Escher, Moebius Ants
Class 34: Models of Computation CS200: Computer Science
Language semantics Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Class 33: Learning to Count CS200: Computer Science
CSE S. Tanimoto Lambda Calculus
Class 26: Modeling Computing CS150: Computer Science
Lecture 14: Mocking Mockingbirds
CS 611: Lecture 10 More Lambda Calculus September 20, 1999
Lecture 15: Crazy Eddie and the Fixed Points Background
The Church-Turing Thesis and Turing-completeness
Lecture 23: Computability CS200: Computer Science
Evaluating an expression with two variable
Presentation transcript:

David Evans http://www.cs.virginia.edu/~evans Class 36: The Meaning of Truth CS200: Computer Science University of Virginia Computer Science David Evans http://www.cs.virginia.edu/~evans

Menu Lambda Calculus Review How to Prove Something is a Universal Computer Making “Primitives” 19 April 2002 CS 200 Spring 2002

Lambda Calculus -reduction (renaming) y. M  v. (M [y v]) term ::= variable |term term | (term)|  variable . term -reduction (renaming) y. M  v. (M [y v]) where v does not occur in M. -reduction (substitution) (x. M)N   M [ x N ] 19 April 2002 CS 200 Spring 2002

Some Simple Functions I  x.x C  xy.yx Abbreviation for x.(y. yx) CII = (x.(y. yx)) (x.x) (x.x)  (y. y (x.x)) (x.x)  x.x (x.x)  x.x = I 19 April 2002 CS 200 Spring 2002

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 (redices). To evaluate a lambda expression, keep doing reductions until you get to normal form. 19 April 2002 CS 200 Spring 2002

Example ( f. (( x.f (xx)) ( x. f (xx)))) (z.z) 19 April 2002 CS 200 Spring 2002

Alyssa P. Hacker’s Answer ( f. (( x.f (xx)) ( x. f (xx)))) (z.z)  (x.(z.z)(xx)) ( x. (z.z)(xx))  (z.z) ( x.(z.z)(xx)) ( x.(z.z)(xx))  (x.(z.z)(xx)) ( x.(z.z)(xx))  ... 19 April 2002 CS 200 Spring 2002

Ben Bitdiddle’s Answer ( f. (( x.f (xx)) ( x. f (xx)))) (z.z)  (x.(z.z)(xx)) ( x. (z.z)(xx))  (x.xx) (x.(z.z)(xx))  (x.xx) (x.xx)  ... 19 April 2002 CS 200 Spring 2002

Be Very Afraid! Some -calculus terms can be -reduced forever! The order in which you choose to do the reductions might change the result! 19 April 2002 CS 200 Spring 2002

Take on Faith (until CS655) All ways of choosing reductions that reduce a lambda expression to normal form will produce the same normal form (but some might never produce a normal form). If we always apply the outermost lambda first, we will find the normal form is there is one. This is normal order reduction – corresponds to normal order (lazy) evaluation 19 April 2002 CS 200 Spring 2002

Church-Turing Thesis Any mechanical computation can be performed by Lambda Calculus reduction rules There is a Lambda Calculus term equivalent to every Turing Machine 19 April 2002 CS 200 Spring 2002

Proof Show you can implement a Turing Machine using Lambda Calculus 19 April 2002 CS 200 Spring 2002

What do we need? Read/Write Infinite Tape Mutable Lists z z z z z z z z z z z z z z z z z z z z ), X, L ), #, R (, #, L 1 2: look for ( Read/Write Infinite Tape Mutable Lists Finite State Machine Numbers to keep track of state Processing Way of making decisions (if) Way to keep going Start (, X, R HALT #, 1, - #, 0, - Finite State Machine 19 April 2002 CS 200 Spring 2002

Lambda Calculus Summary so Far Rules for substitution Rules for reduction (only -reduction does real work: substitution) Normal form (no more reductions possible) On faith: if you do outermost -reduction first, you find the normal form if there is one 19 April 2002 CS 200 Spring 2002

Lambda Calculus Intuition Lambda expression corresponds to a computation Normal form is that value of that computation But...can we do useful computations without primitives? 19 April 2002 CS 200 Spring 2002

Making “Primitives” 19 April 2002 CS 200 Spring 2002

In search of the truth? What does true mean? True is something that when used as the first operand of if, makes the value of the if the value of its second operand: if T M N  M 19 April 2002 CS 200 Spring 2002

Don’t search for T, search for if T  x (y. x)  xy. x F  xy. y if  pca . pca 19 April 2002 CS 200 Spring 2002

Finding the Truth if T M N T  x . (y. x) F  x . (y. y) if  p . (c . (a . pca))) if T M N ((pca . pca) (xy. x)) M N  (ca . (x.(y. x)) ca)) M N   (x.(y. x)) M N  (y. M )) N  M Is the if necessary? 19 April 2002 CS 200 Spring 2002

Charge Schedule Progress Meetings Now! For your meeting be prepared To demonstrate and explain what you have done so far To explain your plans for finishing 19 April 2002 CS 200 Spring 2002