• Keine Ergebnisse gefunden

Task 1: Simply typed lambda calculus

N/A
N/A
Protected

Academic year: 2022

Aktie "Task 1: Simply typed lambda calculus"

Copied!
2
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Fachbereich Informatik

Programmiersprachen und Softwaretechnik

Prof. Dr. Klaus Ostermann

Responsible for the lab Philipp Schuster

philipp.schuster@uni-tuebingen.de

Programming Languages 2

Homework 6 – WS 18

Tübingen, 29. November 2018

In order to be admitted to the exam, you have to successfully submit your homework every week, except for 2 weeks. A successful submission is one where you get at least 1 point.

Handin Please submit this homework until Thursday, December 06, either via email to Philipp Schuster (philipp.schuster@uni-tuebingen.de) before 12:00, or on paper at the beginning of the lab.

Groups You can work in groups of up to 2 people. Please include the names and Matrikelnummern of all group members in your submission.

Points For each of the Tasks you get between 0 and 2 points for a total of 6 points. You get:

1 point, if your submission shows that you tried to solve the task.

2 points, if your submission is mostly correct.

Task 1: Simply typed lambda calculus

We consider the simply typed lambda calculus from the lecture, extended with unit and let. Show that the following terms are well typed in the given contexts by drawing a derivation tree for the typing relation:

1. y:T `(λx:T. x)y : T

2. `letf = (λu: Unit. u) in (λx: Unit. f unit) : Unit

Task 2: Pairs, Tuples, and Records

We consider the simply typed lambda calculus with all extensions presented in the lecture. For which of the following termstdoes a contextΓ and a typeT exist, such that they are well typed. In other wordsΓ`t:T? If they exist, please write downΓandT. If not, a short note is enough.

1. λb: Bool. ifbthen(iszerop.1) else(p.2) 2. x.4

3. iszero(r.age)

(2)

Task 3: Substitution Lemma

We extend the simply typed lambda calculus with false,true and ift0thent1elset2 with typing rules from the lecture. We extend the definition of substitution by the following three cases:

...

[x7→s] false = false [x7→s] true = true

[x7→s] ift0thent1elset2 = if[x7→s]t0then[x7→s]t1else[x7→s]t2

Show that ifΓ, x : S ` t : T and Γ ` s : S then Γ ` [x 7→ s]t : T. Hint: try induction on the typing derivationΓ, x:S`t:T.

Seite 2/2

Referenzen

ÄHNLICHE DOKUMENTE

For the definition of the normal order reduction strategy of the calculus L need we use the labeling algorithm in Figure 2, which detects the position to which a reduction rule

This paper shows equivalence of several versions of applicative similarity and contextual approximation, and hence also of applicative bisimilarity and contextual equiv- alence, in

The encoding of the handled future using lazy threads ensures that the possibility that a handle is not used in a successful reduction is translated into a successful reduction in

Given a base program in the ς-calculus readily labelled with aspect labels and given some aspects, the weaving function now only has to step through the term while applying the

Other proofs of strong normalization for systems with permutative conversion have been studied by Joachimski and Matthes in [55] for a generalisation of the simply typed

A significant difference between the instance based methods (we are aware of) and the ME calculus is that the former maintain a growing set of instances of input clauses, while ME

Second, formal proofs in natural deduction are closely related (via the Curry-Howard correspondence) to terms in typed lambda calculus.. This provides us not only with a

#"%$'&(')+*-,#.. ÜgùBùBÍ #,~JÙÖK\L/LON @ juì?ÜgùBùBÍcÖZªìÚíËBËuɉØöσÖ/juì