C.S. 430 Assignment 6, Sample Solutions

Σχετικά έγγραφα
Lecture 2. Soundness and completeness of propositional logic

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

The Simply Typed Lambda Calculus

Example Sheet 3 Solutions

Finite Field Problems: Solutions

2 Composition. Invertible Mappings

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

Every set of first-order formulas is equivalent to an independent set

ST5224: Advanced Statistical Theory II

EE512: Error Control Coding

Nowhere-zero flows Let be a digraph, Abelian group. A Γ-circulation in is a mapping : such that, where, and : tail in X, head in

Homework 3 Solutions

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

Math 446 Homework 3 Solutions. (1). (i): Reverse triangle inequality for metrics: Let (X, d) be a metric space and let x, y, z X.

CRASH COURSE IN PRECALCULUS

Inverse trigonometric functions & General Solution of Trigonometric Equations

Homework 8 Model Solution Section

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

Concrete Mathematics Exercises from 30 September 2016

Matrices and Determinants

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

Math221: HW# 1 solutions

derivation of the Laplacian from rectangular to spherical coordinates

Section 8.3 Trigonometric Equations

Other Test Constructions: Likelihood Ratio & Bayes Tests

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

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

Areas and Lengths in Polar Coordinates

MATH423 String Theory Solutions 4. = 0 τ = f(s). (1) dτ ds = dxµ dτ f (s) (2) dτ 2 [f (s)] 2 + dxµ. dτ f (s) (3)

Fractional Colorings and Zykov Products of graphs

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)

Section 7.6 Double and Half Angle Formulas

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

5. Choice under Uncertainty

Srednicki Chapter 55

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

Uniform Convergence of Fourier Series Michael Taylor

Areas and Lengths in Polar Coordinates

Tridiagonal matrices. Gérard MEURANT. October, 2008

Chapter 6: Systems of Linear Differential. be continuous functions on the interval

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

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

Solution Series 9. i=1 x i and i=1 x i.

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

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

PARTIAL NOTES for 6.1 Trigonometric Identities

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

Pg The perimeter is P = 3x The area of a triangle is. where b is the base, h is the height. In our case b = x, then the area is

Statistical Inference I Locally most powerful tests

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

Reminders: linear functions

forms This gives Remark 1. How to remember the above formulas: Substituting these into the equation we obtain with

A Note on Intuitionistic Fuzzy. Equivalence Relation

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

4.6 Autoregressive Moving Average Model ARMA(1,1)

Partial Differential Equations in Biology The boundary element method. March 26, 2013

Solutions to Exercise Sheet 5

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

Second Order Partial Differential Equations

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

Lecture 34 Bootstrap confidence intervals

Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3

Trigonometric Formula Sheet

6.3 Forecasting ARMA processes

Physical DB Design. B-Trees Index files can become quite large for large main files Indices on index files are possible.

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

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

CHAPTER 101 FOURIER SERIES FOR PERIODIC FUNCTIONS OF PERIOD

The challenges of non-stable predicates

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

Mock Exam 7. 1 Hong Kong Educational Publishing Company. Section A 1. Reference: HKDSE Math M Q2 (a) (1 + kx) n 1M + 1A = (1) =

ORDINAL ARITHMETIC JULIAN J. SCHLÖDER

Bounding Nonsplitting Enumeration Degrees

A Two-Sided Laplace Inversion Algorithm with Computable Error Bounds and Its Applications in Financial Engineering

2. THEORY OF EQUATIONS. PREVIOUS EAMCET Bits.

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

Quadratic Expressions

Second Order RLC Filters

= {{D α, D α }, D α }. = [D α, 4iσ µ α α D α µ ] = 4iσ µ α α [Dα, D α ] µ.

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

Lecture 15 - Root System Axiomatics

ENGR 691/692 Section 66 (Fall 06): Machine Learning Assigned: August 30 Homework 1: Bayesian Decision Theory (solutions) Due: September 13

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

( ) 2 and compare to M.

Generating Set of the Complete Semigroups of Binary Relations

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

Problem Set 3: Solutions

Section 9.2 Polar Equations and Graphs

Math 6 SL Probability Distributions Practice Test Mark Scheme

= λ 1 1 e. = λ 1 =12. has the properties e 1. e 3,V(Y

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

F19MC2 Solutions 9 Complex Analysis

Congruence Classes of Invertible Matrices of Order 3 over F 2

Εγχειρίδια Μαθηµατικών και Χταποδάκι στα Κάρβουνα

On a four-dimensional hyperbolic manifold with finite volume

A Lambda Model Characterizing Computational Behaviours of Terms

Homomorphism in Intuitionistic Fuzzy Automata

Transcript:

C.S. 430 Assignment 6, Sample Solutions Paul Liu November 15, 2007 Note that these are sample solutions only; in many cases there were many acceptable answers. 1 Reynolds Problem 10.1 1.1 Normal-order Reductions (λf. λx. f (f x)) (λb. λx. λy. b y x) (λz. λw. z) (λx. (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) x)) (λz. λw. z) (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) (λz. λw. z)) λx. λy. ((λb. λx. λy. b y x ) (λz. λw. z)) y x (canonical form) λx. λy. (λx. λy. (λz. λw. z) y x ) y x λx. λy. (λy. (λz. λw. z) y y ) x λx. λy. (λz. λw. z) x y λx. λy. (λw. x ) y λx. λy. x = T RUE 1.2 Eager Reductions (λf. λx. f (f x)) (λb. λx. λy. b y x) (λz. λw. z) (λx. (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) x)) (λz. λw. z) (λb. λx. λy. b y x) ((λb. λx. λy. b y x) (λz. λw. z)) (λb. λx. λy. b y x) (λx. λy. (λz. λw. z) y x) λx. λy. (λx. λy. (λz. λw. z) y x ) y x) (canonical form) λx. λy. (λy. (λz. λw. z) y y) x λx. λy. (λz. λw. z) x y λx. λy. (λw. x) y λx. λy. x = T RUE 1

1.3 Proofs of Normal-order Evaluations We use the indented proof style. (λf. λx. f (f x)) (λb. λx. λy. b y x) (λz. λw. z) (λf. λx. f (f x)) (λb. λx. λy. b y x) λf. λx. f (f x) λf. λx. f (f x) (λx. (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) x)) (λx. (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) x)) (λx. (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) x)) (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) (λz. λw. z)) λb. λx. λy. b y x λb. λx. λy. b y x λx. λy. ((λb. λx. λy. b y x ) (λz. λw. z)) y x λx. λy. ((λb. λx. λy. b y x ) (λz. λw. z)) y x λx. λy. ((λb. λx. λy. b y x ) (λz. λw. z)) y x λx. λy. ((λb. λx. λy. b y x ) (λz. λw. z)) y x 1.4 Proofs of Eager Evaluations We use the indented proof style. (λf. λx. f (f x)) (λb. λx. λy. b y x) (λz. λw. z) (λf. λx. f (f x)) (λb. λx. λy. b y x) λf. λx. f (f x) λf. λx. f (f x) λb. λx. λy. b y x λb. λx. λy. b y x (λx. (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) x)) (λx. (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) x)) (λx. (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) x)) λz. λw. z λz. λw. z (λb. λx. λy. b y x ) ((λb. λx. λy. b y x ) (λz. λw. z)) λb. λx. λy. b y x λb. λx. λy. b y x (λb. λx. λy. b y x ) (λz. λw. z) λb. λx. λy. b y x λb. λx. λy. b y x λz. λw. z λz. λw. z λx. λy. (λz. λw. z) y x λx. λy. (λz. λw. z) y x λx. λy. (λz. λw. z) y x λx. λy. (λx. λy. (λz. λw. z) y x ) y x) λx. λy. (λx. λy. (λz. λw. z) y x ) y x) λx. λy. (λx. λy. (λz. λw. z) y x ) y x) λx. λy. (λx. λy. (λz. λw. z) y x ) y x) 2

2 Reynolds Problem 10.2 Prove that, for any clased expression e and canonical form z, the expression e evaluates eagerly to z if and only if there is a proof of e E z from the inference rules in Section 10.4. 2.1 Soundness We first prove the if half of the proposition, which is that the rules for eager evaluation are sound. If the last line of the proof is obtained by the rule for termination, it has the form λv. e λv. e, which holds because λv. e is a canonical form. Otherwise, suppose the last line of the proof is obtained by the rule for beta-evaluation. Then it has the form ee E z, and there are shorter proofs of the premisses e E λv. ê, e E z and (ê/v z ) E z, which by the induction hypothesis must be true. From the first premiss, there is an eager reduction sequence e λv. ê where the last term is the first canonical form. For the second premiss, there is an eager reduction sequence e z where the last term is the first canonical form. In other words, This implies that ee (λv. ê)e (λv. ê)z is a reduction sequence where each term is contracted on the leftmost redex that s not a subexpression of a canonical form. Now we can complete this sequence with a beta-contraction and the sequence whose existence is asserted by the third premiss: ee (λv. ê)e (λv. ê)z (ê/v z ) z This is an eager reduction sequence in which z is the first canonical form; thus ee E z. 2.2 Completeness Next, we prove the only if half of the proposition, which is that the eager evaluation rules are complete. Here we assume that we have a eager reduction sequence e z in which only the last term is a canonical form, and we show, by induction on the length of the reduction sequence, the existence of the corresponding prooof of e E z. If the reduction sequence begins with an abstraction, it must consist of the single term λv. e, whithout any constractions, and the rcorresponding proof is a single use of the rule for termination. 3

Otherwise, if the reduction sequence begins with an application, let n 0 be the index of the first term in this reduction sequence that is not an application whose left subterm is also an application. (Such a term must exist since z does not have this form.) Then the reduction sequence has the form e 0 e 0 e n 1 e n 1... where e 0,..., e n 1 are all applications, and therefore, by Proposition 10.5, contain redices. Moreover, the fact that this reduction sequence is eager implies that it has the form where e 0 e 0 e n 1 e 0 e n e 0... e 0 e n 1 e n is also an eager reduction sequence. This is because eager reduction always contracts the leftmost redex that s not a subexpression of a canonical form. Further more, since e n e becomes an application, let m 0 be the index of the second term in this reduction sequence that is an application whose right subterm is not an application. (Such a term must exist since z does not have this form.) Then the reduction sequence has the form where e 0 e 0 e n e 0 e n e m e 0 e m 1 e m is also an eager reduction sequence. This is because e n is already in canonical form, and eager evaluation may only contracts the right term after n steps. Since e n = λv. ê, and e m = z, the term e n e m is a redex, and the rest of the original reduction sequence must have the form (λv. ê)z (ê/v z ) z where only the last term is a canonical form. Then the induction hypothesis implies that there is a proof of ee E z. Finally, from the proofs of e 0 E λv. ê, e 0 E z, and (ê/v z ) E z, one can use the rule for beta evaluation to construct a proof of e 0 e 0 E z. 4

3 Reynolds Problem 10.5 Given ((ab f) x) y = f <x, y>, and a continuous function f from P P to P 3.1 1. Prove (ab f) x is a continuous function from P to P. 2. Prove ab f is a continuation function from P to P P We can rewrite the function (ab f) x as (ab f) x = f g where g y =<x, y> We ll first show that g is a continuous function, and then by by Proposition 2.3 Part (c), (ab f)x is continuous. 3.1.1 g is monotone For any y 1 y 2 P, we have g y 1 =<x, y 1 > <x, y 2 >= g y 2 due to the ordering on the product of pre-domain P P. 3.1.2 g is continuous For any interesting chain y i P, we have g( y i ) =<x, y i >= <x, y i >= (g y i ) Therefore by Proposition 2.3 Part (c), (ab f) x = f g is a continuous function from P to P. 5

3.2 3.2.1 ab f is monotone For any x 1 x 2 P, let h 1 = (ab f) x 1 and h 2 = (ab f) x 2. We want to show h 1 h 2, i.e., forall y P, h 1 y h 2 y. This is true because h 1 y = f <x 1, y> f <x 2, y>= h 2 y due to the ordering on the product of pre-domain P P, and the continuity of f. Therefore (ab f) x 1 (ab f) x 2 and ab f is monotone. 3.2.2 ab f is continuous for any interesting chain x i P, and any y P, then F i = (ab f)x i also forms a chain of functions in the pre-domain P P. Because we have proved that ((ab f)x) is continuous, by Proposition 2.2 we have: Or in another word ( F i )y = (F i y) ( ((ab f)x i ))y = (((ab f)x i )y) = (f <x i, y>) = f( <x i, y>) because f is continuous. Furthermore f( <x i, y>) = f < x i, y>= (ab f)( x i )y So we have effective proved that for any y P Therefore and ab f is continuous. (ab f)( x i )y = ( ((ab f)x i ))y (ab f)( x i ) = ((ab f)x i ) 6