T λx. (λy. x) F λx. (λy. y) if λpca. pca

Σχετικά έγγραφα
The Simply Typed Lambda Calculus

About these lecture notes. Simply Typed λ-calculus. Types

Models for Probabilistic Programs with an Adversary

2 Composition. Invertible Mappings

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016

ΑΓΓΛΙΚΗ ΓΛΩΣΣΑ ΣΕ ΕΙΔΙΚΑ ΘΕΜΑΤΑ ΔΙΕΘΝΩΝ ΣΧΕΣΕΩΝ & ΟΙΚΟΝΟΜΙΑΣ

Fractional Colorings and Zykov Products of graphs

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

derivation of the Laplacian from rectangular to spherical coordinates

Homework 3 Solutions

Finite Field Problems: Solutions

Example Sheet 3 Solutions

Foundations of Computer Science ENGR 3520 Fall 2013 Thursday, Nov 21, 2013

[1] P Q. Fig. 3.1

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

Section 7.6 Double and Half Angle Formulas

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

Στεγαστική δήλωση: Σχετικά με τις στεγαστικές υπηρεσίες που λαμβάνετε (Residential statement: About the residential services you get)

SUPERPOSITION, MEASUREMENT, NORMALIZATION, EXPECTATION VALUES. Reading: QM course packet Ch 5 up to 5.6

Writing for A class. Describe yourself Topic 1: Write your name, your nationality, your hobby, your pet. Write where you live.

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation

Section 8.3 Trigonometric Equations

Statistical Inference I Locally most powerful tests

BECAUSE WE REALLY WANT TO KNOW WHAT YOU THINK ABOUT SCHOOL AND YOUR GARDEN. Fairly true If I decide to learn something hard, I can.

C.S. 430 Assignment 6, Sample Solutions

LESSON 14 (ΜΑΘΗΜΑ ΔΕΚΑΤΕΣΣΕΡΑ) REF : 202/057/34-ADV. 18 February 2014

department listing department name αχχουντσ ϕανε βαλικτ δδσϕηασδδη σδηφγ ασκϕηλκ τεχηνιχαλ αλαν ϕουν διξ τεχηνιχαλ ϕοην µαριανι

TMA4115 Matematikk 3

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

Matrices and Determinants

Lecture 2. Soundness and completeness of propositional logic

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ. Ψηφιακή Οικονομία. Διάλεξη 7η: Consumer Behavior Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών

Instruction Execution Times

Πώς μπορεί κανείς να έχει έναν διερμηνέα κατά την επίσκεψή του στον Οικογενειακό του Γιατρό στο Ίσλινγκτον Getting an interpreter when you visit your

EE512: Error Control Coding

Mean bond enthalpy Standard enthalpy of formation Bond N H N N N N H O O O

ΤΕΧΝΟΛΟΓΙΚΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ ΤΜΗΜΑ ΝΟΣΗΛΕΥΤΙΚΗΣ

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

«ΨΥΧΙΚΗ ΥΓΕΙΑ ΚΑΙ ΣΕΞΟΥΑΛΙΚΗ» ΠΑΝΕΥΡΩΠΑΪΚΗ ΕΡΕΥΝΑ ΤΗΣ GAMIAN- EUROPE

From the finite to the transfinite: Λµ-terms and streams

Approximation of distance between locations on earth given by latitude and longitude

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

Εγκατάσταση λογισμικού και αναβάθμιση συσκευής Device software installation and software upgrade

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

ST5224: Advanced Statistical Theory II

Potential Dividers. 46 minutes. 46 marks. Page 1 of 11

Δημιουργία Λογαριασμού Διαχείρισης Business Telephony Create a Management Account for Business Telephony

Solutions to the Schrodinger equation atomic orbitals. Ψ 1 s Ψ 2 s Ψ 2 px Ψ 2 py Ψ 2 pz

9.09. # 1. Area inside the oval limaçon r = cos θ. To graph, start with θ = 0 so r = 6. Compute dr

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

Problem Set 3: Solutions

Παρουσίαση Διακήρυξης Αρναουτάκη & υποψηφίων περιφερειακών συμβούλων στο Ρέθυμνο σελίδα 18 ΡΕΘΕΜΝΙΩΤΙΚΗ. ÓÏÊ! H ÇìéóÝëçíïò èá êõìáôßæåé óôçν...

UNIVERSITY OF CALIFORNIA. EECS 150 Fall ) You are implementing an 4:1 Multiplexer that has the following specifications:

ΕΙΣΑΓΩΓΗ ΣΤΟN ΠΡΟΓΡΑΜΜΑΤΙΣΜΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΠΑΤΡΩΝ ΠΟΛΥΤΕΧΝΙΚΗ ΣΧΟΛΗ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ Η/Υ ΚΑΙ ΠΛΗΡΟΦΟΡΙΚΗΣ

7 Present PERFECT Simple. 8 Present PERFECT Continuous. 9 Past PERFECT Simple. 10 Past PERFECT Continuous. 11 Future PERFECT Simple

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

the total number of electrons passing through the lamp.

Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1

Ερώτηση και Αίτηση Κατάθεσης Εγγράφων Προς τον κ. Υπουργό Ανάπτυξης και Ανταγωνιστικότητας

Κατανοώντας και στηρίζοντας τα παιδιά που πενθούν στο σχολικό πλαίσιο

Ενότητα 2 Εργαλεία για την αναζήτηση εργασίας: Το Βιογραφικό Σημείωμα

ίκτυο προστασίας για τα Ελληνικά αγροτικά και οικόσιτα ζώα on.net e-foundatio // itute: toring Insti SAVE-Monit

Chapter 3: Ordinal Numbers

Code Breaker. TEACHER s NOTES

Chapter 29. Adjectival Participle

Math221: HW# 1 solutions

Πτυχιακή Εργασία. Παραδοσιακά Προϊόντα Διατροφική Αξία και η Πιστοποίηση τους

ΑΓΓΛΙΚΑ Ι. Ενότητα 7α: Impact of the Internet on Economic Education. Ζωή Κανταρίδου Τμήμα Εφαρμοσμένης Πληροφορικής

LESSON 12 (ΜΑΘΗΜΑ ΔΩΔΕΚΑ) REF : 202/055/32-ADV. 4 February 2014

PARTIAL NOTES for 6.1 Trigonometric Identities

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ - ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΕΠΛ 133: ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΕΦΗΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΕΡΓΑΣΤΗΡΙΟ 3 Javadoc Tutorial

( ) 2 and compare to M.

Congruence Classes of Invertible Matrices of Order 3 over F 2

Right Rear Door. Let's now finish the door hinge saga with the right rear door

Final Test Grammar. Term C'

The λ-calculus. Lecturer: John Wickerson. Phil Wadler

2. Let H 1 and H 2 be Hilbert spaces and let T : H 1 H 2 be a bounded linear operator. Prove that [T (H 1 )] = N (T ). (6p)

Customer Validation. Masterclass Μέρος 2. Πως διεξάγουμε «Πειράματα» για επιβεβαίωση των υποθέσεων του Επιχειρηματικού Μοντέλου. OK!

HISTOGRAMS AND PERCENTILES What is the 25 th percentile of a histogram? What is the 50 th percentile for the cigarette histogram?

ΑΛΕΞΑΝΔΡΟΣ ΠΑΛΛΗΣ SCHOOLTIME E-BOOKS

ΠΑΝΕΠΙΣΤΗΜΙΟ ΠΑΤΡΩΝ ΠΟΛΥΤΕΧΝΙΚΗ ΣΧΟΛΗ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ Η/Υ & ΠΛΗΡΟΦΟΡΙΚΗΣ. του Γεράσιμου Τουλιάτου ΑΜ: 697

ANSWERSHEET (TOPIC = DIFFERENTIAL CALCULUS) COLLECTION #2. h 0 h h 0 h h 0 ( ) g k = g 0 + g 1 + g g 2009 =?

Ψηφιακή ανάπτυξη. Course Unit #1 : Κατανοώντας τις βασικές σύγχρονες ψηφιακές αρχές Thematic Unit #1 : Τεχνολογίες Web και CMS

IPSJ SIG Technical Report Vol.2014-CE-127 No /12/6 CS Activity 1,a) CS Computer Science Activity Activity Actvity Activity Dining Eight-He

Exercises 10. Find a fundamental matrix of the given system of equations. Also find the fundamental matrix Φ(t) satisfying Φ(0) = I. 1.

LESSON 28 (ΜΑΘΗΜΑ ΕΙΚΟΣΙ ΟΚΤΩ) REF : 201/033/28. 2 December 2014

ECE 308 SIGNALS AND SYSTEMS FALL 2017 Answers to selected problems on prior years examinations

Types and Logics. Programming Languages CS442. David Toman. School of Computer Science University of Waterloo

Living and Nonliving Created by: Maria Okraska

Συστήματα Διαχείρισης Βάσεων Δεδομένων

Μετανάστευση Σπουδές. Σπουδές - Πανεπιστήμιο. Για να δηλώσετε ότι θέλετε να εγγραφείτε

ΦΥΛΛΟ ΕΡΓΑΣΙΑΣ Α. Διαβάστε τις ειδήσεις και εν συνεχεία σημειώστε. Οπτική γωνία είδησης 1:.

FINAL TEST B TERM-JUNIOR B STARTING STEPS IN GRAMMAR UNITS 8-17

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

Transcript:

#,, - Class 32: Computability in Theory and Practice Menu Lambda Calculus Review Computability in Theory and Practice Learning to Count CS50: Computer Science University of Virginia Computer Science David Evans http://www.cs.virginia.edu/evans 2 Universal Computation Read/Write Infinite Tape Mutable Lists Numbers to keep track of state Processing Way of making decisions (if) Way to keep going To prove Lambda Calculus is as powerful as a UTM, we must show we can make everything we need to simulate any TM. Don t search for T, search for if T λx (λy. x) λxy. x F λx (λ y. y)) if λpca. pca 3 4 Finding the Truth T λx. (λy. x) F λx. (λy. y) if λp. (λc. (λa. pca))) Is the if necessary? 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 and and or? and λx (λy. if x y F)) or λx (λy. if x T y)) 5 6

#,, - Lambda Calculus is a Universal Computer? Computability in Theory and Practice? Mutable Lists? Numbers to keep track of state? Way to keep going (Intellectual Computability Discussion on TV Video) 7 8 Ali G Multiplication Problem Input: a list of 2 numbers with up to d digits each Output: the product of the 2 numbers Is it decidable? Yes a straightforward algorithm solves it. Is it tractable? (how much work?) Yes it using elementary multiplication techniques it is O(d 2 ) Can real computers solve it? 9 What about C++? int main (void) { int alig = 999999999; alig = alig * 99; alig = alig * 99; alig = alig * 99; } Results from SunOS 5.8: Value: 999999999 Value: 25752093 Value: -5379273 Value: 46235386 2 2

#,, - Ali G was Right! Theory assumes ideal computers: Unlimited, perfect memory Unlimited (finite) time Lambda Calculus is a Universal Computer? Real computers have: Limited memory, time, power outages, flaky programming languages, etc. There are many decidable problems we cannot solve with real computer: the numbers do matter? Mutable Lists? Numbers to keep track of state? Way to keep going 3 4 42 XLII What is 42? forty-two cuarenta y dos Meaning of Numbers 42-ness is something who s successor is 43-ness 42-ness is something who s predecessor is 4-ness Zero is special. It has a successor one-ness, but no predecessor. 5 6 Meaning of Numbers pred (succ N) N succ (pred N) N succ (pred (succ N)) succ N zero? zero T Meaning of Zero zero? (succ zero) F zero? (pred (succ zero)) T 7 8 3

Is this enough? Can we define add with pred, succ, zero? and zero? Can we define lambda terms that behave like zero, zero?, pred and succ? add λxy.if (zero? x) y (add (pred x) (succ y)) Hint: what if we had cons, car and cdr? 9 20 Numbers are Lists... zero? null? pred cdr succ λ x. cons F x Making Pairs (define (make-pair x y) (lambda (selector) (if selector x y))) (define (car-of-pair p) (p #t)) (define (cdr-of-pair p) (p #f)) 2 22 cons and car cons λx.λy.λz.zxy cons M N = (λx.λy.λz.zxy) M N β (λy.λz.zmy) N β λz.zmn car λp.p T T λx. λy. x car (cons M N) car (λz.zmn) (λp.p T) (λz.zmn) β (λz.zmn) T β TMN β (λx. λy. x) MN β (λy. M)N β M cdr too! cons λxyz.zxy car λp.p T cdr λp.p F cdr cons M N cdr λz.zmn = (λp.p F) λz.zmn β (λz.zmn) F β FMN β N 23 24 4

#,, - null λx.t null? λx.(x λy.λz.f) Null and null? null? null λx.(x λy.λz.f) (λx. T) β (λx. T)(λy.λz.F) β T null λx.t null? λx.(x λy.λz.f) Null and null? null? (cons M N) λx.(x λy.λz.f) λz.zmn β (λz.z MN)(λy.λz.F) β (λy.λz.f) MN β F 25 26 0 null cons F 0 2 cons F 3 cons F 2... succ λx.cons F x pred λx.cdr x Counting 42 = λxy.(λz.z xy) λxy. y λxy.(λz.z xy) λxy. y λxy.(λz.z xy) λxy. y λx.t 27 28 Arithmetic zero? null? succ λx. cons F x pred λx.x F pred = (λx.x F) cons F null β (cons F null) F (λxyz.zxy F null) F β (λz.z F null) F β F F null β null 0 Lambda Calculus is a Universal Computer We have this, but we cheated using to make recursive definitions! Mutable Lists Numbers to keep track of state Way to keep going 29 30 5

#,, - Way to Keep Going (λ 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)) β (λz.z) (λ x.(λz.z)(xx)) (λ x.(λz.z)(xx)) β (λx.(λz.z)(xx)) (λ x.(λz.z)(xx)) β... This should give you some belief that we might be able to do it. We won t cover the details of why this works in this class. (CS655 sometimes does.) Lambda Calculus is a Universal Computer Mutable Lists Numbers to keep track of state Way to keep going 3 32 Universal Computer Lambda Calculus can simulate a Turing Machine Everytime a Turing Machine can compute, Lambda Calculus can compute also Turing Machine can simulate Lambda Calculus (we didn t prove this) Everything Lambda Calculus can compute, a Turing Machine can compute also Church-Turing Thesis: this is true for any other mechanical computer also Charge Exam 2 out Friday Covers through today Links to example exams on the web Review session Wednesday, 7pm PS8 Project Ideas due tomorrow (:59pm) Short email is fine, just explain who your team is and what you plan to do 33 34 6