Lambda calculus. Part II Lambda Calculi with Types

Μέγεθος: px
Εμφάνιση ξεκινά από τη σελίδα:

Download "Lambda calculus. Part II Lambda Calculi with Types"

Transcript

1 Lambda calculus Part II Lambda Calculi with Types Based on materials provided by H. Barendregt Types are certain objects, usually syntactic expressions (e.g. boolean, integer, Char), that may be assigned to terms denoting programs. Types serve to classify the (objects denoted by the) terms. Semantics. Each type has as semantics a set of objects of type. There are several systems of type assignment with different collections of types. For more complicated type systems the semantics D will in general be not a set, but an object in some category. D Lambda calculus II Lambda calculus II Type assignment is done for the following reasons. Firstly, the type of a term F gives partial specification of what the function F is supposed to do. Usually specification of this type is given before the term as program is constructed. Once this term has been constructed, the verification whether this term is indeed of the required type provides partial correctness proof for the program. Secondly, types play a role in efficiency. If it is known that a subterm S of a program has a certain type, then S may be executed more efficiently by making use of the type information. Lambda calculus II 3 To explain the idea of type assignment, we present type systems of various strengths. We start with the system λ of simply typed lambda calculus. We shall distinguish between typing a la Curry and a la Church by introducing λ in both ways. Several other systems of typed lambda calculus exist in a Curry and a Church version. However it is not so for all systems. For example, for the Curry system λ of intersection types it is not clear how to define its Church version and for the Church system λc (calculus of constructions) it is not clear how to define a Curry version. For the systems that exist in both styles there is a clear relation. Lambda calculus II 4

2 The system λ -Curry is assigning elements of a given set T of types to type free lambda terms. For this reason the calculi a la Curry are sometimes called systems of type assignement. The system λ -Curry consists of (i) the set of types of λ, notation Type( λ ). We write T= Type( λ ) for short. (ii) the finite set of rules. Definition.(The set of types of λ ) The set of types T=Type( λ ) is defined inductively, α, α, α, K T (type variables), τ T ( τ) T (function space types) or in abstract syntax T = V T where V is defined by T V = α V' (type variables) We shall start with a lot of definitions. Lambda calculus II 5 Lambda calculus II 6 Notation. (i) If,, T then K stands for n K n ( ( K ( ) K)), n n hence, we use association to the right. (ii) α,, γ, K denote arbitrary type variables. Definition ( λ -Curry). A statement : is derivable from a basis Γ, notation (or or Γ λ Curry : Γ λ : Γ : if there is no danger of confusion) if Γ : can be produced by the folowing rules Lambda calculus II 7 Lambda calculus II 8

3 λ -Curry (version ) ( x : ) Γ Γ x : Γ : ( τ), Γ N : Γ ( N ) : τ The rules given in Version are usually expressed as follows. λ -Curry (Version ) (axiom) Γ ( x : ) if (x : ) Γ Γ, x : : τ Γ ( ) : ( τ) Here Γ, x : stands for Γ { x : } and x Dom (Γ) in order to Γ { x : } be a basis. If Γ = { x :, K, xn : n} we can write instead of Γ : x :, K, xn : n :. If Γ is empty, we write :. ( -elimination) ( -introduction) Γ : ( τ) Γ N : Γ ( N) : τ Γ, x : : τ Γ ( ) : ( τ) We pronounce - as yields or is derivable. Lambda calculus II 9 Lambda calculus II The following is the natural deduction formulation λ -Curry (Version ) The basic axiom of Versions and is considered here as implicit and is not mentioned. The notation Elimination rule Introduction rule x /: x : : τ eans that from the assumption x : together with a set Γ of other statements, one can derive : τ. : ( τ) N : ( N) : τ : τ ( ) : ( τ) Lambda calculus II Lambda calculus II

4 The basic axiom of Versions and is considered here as implicit and is not mentioned. The notation x : : τ eans that from the assumption x : together with a set Γ of other statements, one can derive : τ. Example. (a) Using Version of the system the derivation x :, y : τ x : x : ( λy. x) : ( τ ) ( λxy. x) : ( τ ) Shows that ( λxy. x) : ( τ ) for all, τ T. The rule of -introduction in the table states that ( ) : ( τ) is derivable even without the assumption x : but still using Γ. This process is called cancellation of an assumption and is indicated by the striking through the statement x :. Lambda calculus II 3 Lambda calculus II 4 Example. (a) Using Version of the system the derivation x :, y : τ x : x : ( λy. x) : ( τ ) ( λxy. x) : ( τ ) (c) For all we have T ( x) : ( ) Shows that ( λxy. x) : ( τ ) for all, τ T. (b) Using Version, a natural deduction derivation of the same type assignment is x : y : τ x : ( λy. x) : ( τ ) ( λxy. x) : ( τ ) The indices and are bookkeeping devices that indicate at which application of a rule a particular assumption is being cancelled. Lambda calculus II 5 Lambda calculus II 6

5 (c) For all we have T ( x) : ( ) (c) For all we have T ( x) : ( ) Indeed x : x : ( x) : ( ) Indeed x : x : ( x) : ( ) (d) y : ( x) y : Lambda calculus II 7 Lambda calculus II 8 (c) For all we have T Properties of λ -Curry (d) Indeed ( x) : ( ) x : x : ( x) : ( ) y : ( x) y : Several properties of type assignment in λ are valid. First, we analyse how much of a basis is necessary in order to derive a type assignment. Definition. (i) Let Γ = { x :, K, xn : n } be a basis. We consider Γ as a partial function from the set of term variables to the set of types. It follows from (c) and Elimination rule that ( x) : ( ) y : ( x) y : (ii) Then dom(γ) = { x, K, xn} is the domain of Γ and we write Γ ( xi ) = i for the value of Γ i.e. The type which is assigned to the variable. x i (iii) Let V ' be a set of term variables, the restriction of Γ to is defined as follows Γ V ' = { x : x V '& = Γ( x)}. V' Lambda calculus II 9 Lambda calculus II

6 (iv) For types, τ T, and a type variable α, the substitution of τ for α in is denoted by [ α : = τ]. Basis lemma for -Curry λ Let Γ be a basis. (i) If Γ ', Γ Γ' is another basis, then Γ : Γ' :. (ii) Γ : FV ( ) dom( Γ). (iii) Γ : Γ FV ( ) :. Since such proofs will occur frequently, we produce it in full only for the first statement in order to be briefer later on. (i) We proceed by induction on the derivation of Γ :. Case. : is x : and this declaration is an element of Γ. Then also x : Γ' and thus Γ' :. Case. : is ( ) : and it follows directly from two assignments : ( τ ) and : τ for some τ. By the Induction Hypothesis one has Γ' : ( τ ) and ' : τ. Thus ' ( ) :. Γ Γ Lambda calculus II Lambda calculus II Case 3. : is ( ) : ( ) and it follows directly from Γ, x : :. by the convention concerning bounded variables, one may assume that the variable x does not occur in the domain of Γ'. Therefore by the Induction Hypothesis one has Γ ', x : : and thus Γ ' ( ) : ( (ii) By induction on derivation of :. We prove only the case that : is ( ) : ( ) and follows directly from the assumption Γ, x : :. Let y FV ( ), then y FV ( ) and y / x. By the Induction Hypothesis one has y dom( Γ, x : ) and hence y dom Γ. ). (iii) By induction on the derivation of :. We only treat the case that : is ( ) : and follows directly from Γ : ( τ ) and Γ : τ for some Γ, τ. By the Induction Hypothesis one has FV ( ) : ( τ ) and FV ( ) : τ. Γ Γ As FV ( ) = FV ( ) FV ( ), by (i) one has that Γ FV ( ) : ( τ ) and Γ FV ( ) : τ and hence FV ( ) ( ) :. Γ Lambda calculus II 3 Lambda calculus II 4

7 Now we show how terms of a certain form get typed. It gives us new insight, among other things we can show that certain terms have no types. Generation lemma for λ -Curry (i) Γ x : ( x : ) Γ (ii) Γ ( N ) : τ [ Γ : ( τ)& Γ N : ] (iii) Γ ( ) : ρ, τ [ Γ, x : : τ & ρ ( τ)] Typability of subterms in -Curry λ Let ' be a subterm of. Then for some Γ' and '. Γ : Γ' ': ' In other words: if has a type which means that for some Γ ` : then every subterm ' of has a type as well. Note that the subterm may be typed from a different basis. By induction on the complexity of. By induction on the length of derivation. Lambda calculus II 5 Lambda calculus II 6 Substitution lemma for λ -Curry. (i) Γ : Γ [ α : = τ] : [ α : = τ] where α is a type variable. (ii) If Γ, x : : τ and Γ N :, then Γ [ x : = N] : τ (i) By induction on derivation of Γ :. (ii) By induction on generation of Γ, x : : τ Subject reduction theorem for λ -Curry Let > '. Then Γ : Γ ':. By induction on generation of > using Generation lemma and Substitution lemma. We shall treat the prime case '. Assume that ( P) Q, ' P[ x : = Q] and Γ ( P) Q : Then it follows by the Generation lemma that for some τ one has Γ ( P) : ( τ ) and Γ Q : τ Lambda calculus II 7 Lambda calculus II 8

8 Using once more the Generation lemma, we get Γ, x : τ P : and Γ Q : τ And therefore by the Substitution lemma, we have Γ P[ x : = Q] : Using once more the Generation lemma, we get Γ, x : τ P : and Γ Q : τ and therefore by the Substitution lemma, we have Γ P[ x : = Q] : Exercises. Let I = ( x), K = ( λxy. x) and S = ( λxyz. xy( yz)). Show that for all, τ, ρ T, one has ( a) S : ( τ ρ) ( τ) ( ρ) ( b) SK : ( τ) ( c) KI : ( τ ) Lambda calculus II 9 Lambda calculus II 3 Type assignments. (b) SK ( λxyz. xz( yz))( λxy. x) ( λxyz. xz( yz))( λuv. u) (a) S λxyz. xz( yz) 3 x : ( τ ρ) y : ( τ) ( yz) : τ ( xz) : ( τ ρ) ( xz)( yz) : ρ λz.( xz)( yz) : ( ρ) λyz.( xz)( yz) : ( τ) ( ρ) λxyz.( xz)( yz) : ( τ ρ) ( τ) ( ρ) z : 3 We have Hence u : v : τ λv. u : ( τ ) λuv : ( τ ) -K λxy. x : ( τ ) It follows from (a) and elimination that -SK : ( τ). by introduction Lambda calculus II 3 Lambda calculus II 3

9 The set of Typable terms is not closed under expansion. We have I : ( ), but / KI( xx) : ( ). A stronger failure of subject expansion has shown van Bakel. Observation. (van Bakel 99) There are and but, ' Λ and, ' T such that > ' :, ': ', / ':. Take λxy. y, ' SK, α ( ) ' ( α) ( ). Then use the fact that / SK : α ( ). Exercises. Show that (a) / SK : ( τ ) for all, τ. (b) ( xx) and KI( xx) have no type in λ. and Lambda calculus II 33 Lambda calculus II 34 (a) If -SK ( λxyz. xz( yz))( λxy. x) : ( τ ) Then by the generation lemma ρ [ ( λxyz. xz( yz)) : ρ ( τ ) & ( λxy. x) : ρ] using the Generation lemma again, we obtain ρ µ, ν [ x : µ ( λyz. xz( yz)) : ν & ρ ( τ ) ( µ ν)& ( λxy. x) : ρ] It follows that µ ρ & υ ( τ ) hence ρ [ x : ρ ( λyz. xz( yz)) : ( τ )& -( λxy. x) : ρ]. using the Generation lemma repeatedly, we have ρ ε, ϕ [x : ρ, y : ε -( λz. xz( yz)) : ϕ & ( ε ϕ) ( τ )& ( λxy. x) : ρ] Lambda calculus II 35 Lambda calculus II 36

10 thus ε τ & ϕ hence, we have ρ [ x : ρ, y : τ ( λz. xz( yz)) : τ & ( λxy. x) : ρ] now ρ [ x : ρ, y : τ ( λz. xz( yzsnímek )) : τ & ( 4 λxy. x) : ( ρ τ ρ)] a contradiction. (b) Assume that for some Γ,, holds Γ ( xx) :. It follows from the Generation lemma that ρ, τ [ Γ, x : ρ xx : τ & ( ρ τ) ] then ρ, τ ζ [ Γ, x : ρ xx : τ & x : ( ζ τ) & x : ζ] hence ρ, τ ζ [ Γ, x : ρ x : ( ζ τ) & x : ζ & ( ρ τ) ] ρ, τ [ Γ, x : ρ x : ( ρ τ) & ( ρ τ) ] ρ, τ [ Γ, x : ρ x : ( ρ τ)] a contradiction. Thus ( xx) has no type in KI( xx) has no type by the Typability of λ Curry. subterms lemma. Lambda calculus II 37 Lambda calculus II 38 The system λ Church A digression. At the first sight, the main difference between the Curry systems of type assignment and Church typing systems consists in the fact that in the Curry system, the bounded variables are typed implicitely by the system while in the Church typing system, the bounded variables are typed explicitely. The term (x) is annotated in the Church sustem by :, in fact it is not a lambda term in the strict sense. The intuitive meaning is that (λx:.x) takes the argument x from the domain of the type. The explicit mention of types in terms make it possible the type checking i.e. to decide whether a term has a certain type. For some Curry systems this question is undecidable. But there is in it more than that: one has while Curry Church ( x) : ( ) ( λx :. x) : ( ). for every type, Definition. (pseudoterms) Let T be some set of types. The set of T-annotated λ-terms (also called pseudoterms), denoted by is defined as follows: Λ T, where V is the set of term variables. Λ T = V Λ Λ λx : TΛ T T T Lambda calculus II 39 Lambda calculus II 4

11 The same syntactic conventions are used for Λ as for Λ, e.g. λx : Lλx n : n. ( λx : ( λx : L( λx n : n. ) L)) r r λx :. Remark. Several systems of typed λ-calculi `a la Church resemble to the Curry systems of type assignments since they consist of a choice of the set T of types and of an assignment of types T to terms Λ T. However, this is not the case in all systems `a la Church. In some such systems the sets of terms and types are defined simultaneously. T Anyway, for λ Church the separate definition of the sets of types and and (pseudo)terms is possible and one may have the same set of types T = Type( λ ) as for λ Curry. Definition. The typed lambda calculus λ Church consists of (i) the set of types T = Type ( λ ) T = V T T where V is the set of type variables. defined by (ii) statements of the form : with Λ T and T. Lambda calculus II 4 Lambda calculus II 4 (iii) bases which are again sets of statements with only distinct (term) variables as subjects. (iv) axioms and rules (axiom) ( -elimination) ( -introduct ion) Definition. λ Church Γ x : if ( x : ) Γ Γ - : ( τ) Γ - N : Γ - (N) : τ Γ, x : - : τ Γ - ( λx :. ) : ( τ) A statement : is derivable from the basis Γ, notation Γ - :, if : can be produced using the above axioms and rules. Lambda calculus II 43 As we have seen, derivations can be given in several styles. We will not repeat it here, although we slightly prefere the Gentzen (natural deduction) style. Definition. The set of legal λ terms, denoted by Λ( λ ), Λ( λ ) = { Λ T Γ, Γ : }. is defined To refer specifically to λ Church, one uses the notation Γ :. λ Church If there is little danger of ambiguity one uses also, or. λ Church by Lambda calculus II 44

12 Exercises. (a) ( λx :. x) : ( ) (b) ( λx : λy : τ. x) : ( τ ) (c) ( λy : τ. x) : ( τ ) Similarly as for the type-free theory, one can define reduction and conversion on the set of pseudoterms. Λ T Definition. The binary relations,, > and = denoting one-step -reduction, many-steps -reduction and -convertibility on Λ T. respectively, are generated by the contraction rule ( λx :. ) N [ x : = N]. Examples. (a) ( λx :. x)( λy : τ. yy) ( λy : τ. yy) ( b) ( λx : λy : τ. xy)( λz : π. z) > ( λy : τ. y) (c) ( λx : λy : τ. zy)( λz : π. z) z > ( zz) Remarks. (i) It can be shown that the Church-Rosser theorem for > also holds on Λ T. (ii) The following results for λ Church are essentially the same as the corresponding propositions for λ Curry. Lambda calculus II 45 Lambda calculus II 46 Basis lemma for λ Church. Let Γ be a basis, we have (i) If Γ, Γ Γ is another basis, then Γ : Γ :. (ii) Γ : FV ( ) dom( Γ). (iii) Γ : Γ FV ( ) :. Generation lemma for (i) Γ x : ( x : ) Γ. λ Church. (ii) Γ N : τ [ Γ : ( τ)& Γ N : ]. (iii) Γ ( λx :. ) : ρ τ[ ρ = ( τ) & Γ, x : : τ]. Typability of subterms in λ Church. If is a subterm of and has a type i.e. if Γ Church : for some Γ and, then has a type as well, i.e. Γ Church : for some Γ and. Substitution lemma for λ Church. (i) Γ : Γ[ α : = τ] [ α : = τ]: [ α : = τ]. (ii) Suppose Γ, x : : τ and Γ N :. Then Γ [ x : = N]: τ, where α, x are a type and a term variable respectively and, τ are types. Lambda calculus II 47 Lambda calculus II 48

13 Subject reduction Theorem for λ Church. Let >. Then Γ : Γ :. Remark. This theorem implies that the set of legal expressions is closed under reduction. It is not closed under expansion and conversion. Take I = KIΩ annotated with appropriate types. It follows from the Typability of subterms lemma that KIΩ has no type. Lemma on uniqueness of types for λ Church. (i) Let Γ : and Γ :. Then. (ii) Let Γ :, Γ : and =. Then =. (i) By induction on the structure of. (ii) Use the Church-Rosser Theorem for Λ T, the subject reduction theorem for λ Church, and (i). On the other hand convertible legal terms have the same type with respect to a given basis. We have seen that this proposition does not hold for λ Curry. Lambda calculus II 49 Lambda calculus II 5 Relating the Curry and Church systems For typed lambda calculi that can be described in both ways á la Curry and á la Church, often a simple relations can be defined between the two versions. We shall show it for the simplest calculus λ. Definition There is a forgetful mapping. : Λ defined as follows x x N Λ T N λx :. The mapping just erases all annotations of a term in Λ T. Lambda calculus II 5 The following results show that legal pseudoterms in the Church version of λ project to legal terms in the Curry version of λ. On the other hand, legal terms in λ Curry can be lifted to legal terms in λ Church. Theorem. (i) (projection) Let Λ T. Then Γ : Γ :. Church (ii) (lifting) Let Then Λ. Curry Γ : Λ T[ Γ : & ]. Curry Church By induction on the derivation of the respective type assignment. Lambda calculus II 5

14 Bőhm trees and Approximation. A digression. Corollary. To the rule A we need to introduce Bőhm trees which are a kind of infinite normal forms. For an arbitrary type is inhabited in T, we have λ Curry is inhabited in λ -Church. Lemma. Each Λ is in one of the following forms. (i) λx Kxn. ynknm, with n, m, and y a variable. (ii) λx Kx.( λy. N ) N KN, with n, m. n m Lambda calculus II 53 Lambda calculus II 54 By the definition a λ-term is either a variable, or of the form of application PQ or an abstraction P. We have to analyze three cases: (a) if is a variable, then is of the form (i) with n = m =. (c) if P, where P λx and Q is not λx Kλxk. Q, k an abstraction. Then Q is a variable or an application and it follows from the Induction hypothesis that Q is in one of forms (i) or (ii) for n =. Adding the prefix λxλx does not change the λx Kλxk form. (b) if is an application, then P P KP m with not an application. Then with n =, depending on whether P giving (ii). P is of the form (i) or (ii) is a variable (giving (i)) or an abstraction Lambda calculus II 55 Lambda calculus II 56

15 The following definition deals with the two forms of λ-terms from the above lemma. Lemma. (convertibility of head normal forms) Definition. (head normal form, head redex) (i) A λ-term is in head normal form (hnf) if is in the form (i) of the above lemma. In that case y is called the head variable of. If = and has hnf λx Kx y N K, n. Nm has hnf λx Kx. y N K, n Nm (ii) We say that has an head normal form if there is N in hnf such that = N. (iii) If is in the form (ii), we call (λy. N ) N the head redex of. then n = n, y y, m = m and N = N, K, Nm = N m. Lambda calculus II 57 Lambda calculus II 58 By the Church-Rosser theorem and have a common reduct L. But then the only possibility is that L λx Kxn. y N K N m where n = n = n, y = y = y, m = m = m and N = N = N,K λ calculus a digression. Definition. λ calculus is the extension of the lambda calculus defined as follows. One of the (term) variables is selected for use as a constant and is given the name. (i) two contraction rules are added: (ii) A normal form is such that it cannot be reduced. Lambda calculus II 59 Lambda calculus II 6

16 We are going to introduce the notion of Böhm tree. The definition is not complete, because it does not specify the ordering of the direct successors of a node. However this ordering is displayed in the pictures of the trees. This suffices for our purposes. The precise definition of the order can be found in (Barendregt 984). Definition. Let Λ. The Böhm tree of, denoted by BT(), is the labelled tree defined as follows λx Kxn. y BT ) = BT( N) K BT( N ( m ) if the hnf of λx if is has no hnf Lambda calculus II 6 Kx. yn n KN m Böhm trees for λ calculus are defined under condition that a λ term λx K xn. ynknm is in head normal form only if y / or n = m =. Note that if has -hnf, then has a hnf, too. This is because an hnf λx K xn. ynknm is also hnf unless y =. If it is the case, then λx and hence has a K xn. ynkn m hnf. > Lambda calculus II 6 Examples. (a) BT ( λabc. ac( bc)) = λabc. a c b (c) Recall that the Fixed point operator Y is defined by Y λf.( f ( xx))( f ( xx)) ω f It follows that Y λf. ω ω = λf. f ( ω ω ) and we have BT(Y) = λf. f f f ω f f f c BT( ω f ω f ) Now ω f ω f = f ( ω f ω f ) thus BT( ω ω f f ) = f = f (b) BT (( λ x. xx)( xx)) = BT( ω ω f f ) f Lambda calculus II 63 Lambda calculus II 64 f

17 Hence BT ( Y) = λf. f f f f Lambda calculus II 65 Remark. The definition of the Böhm tree is not an inductive definition of BT(), although it seems to be according to presented examples. The terms N,K, Nm in the tail of an hnf of may be more complex than the term itself. [Barendregt 984, Chapter ] Lemma. (Correctnost of the definition of Böhm trees ) (i) Böhm trees are well defined, (ii) = N BT( ) = BT( N ). The definition is correct as it is independent of the choice of the head normal forms. This and (ii) follows from the lemma on convertibility of hnfs. Lambda calculus II 66 Definition. Approximate normal forms. (i) Let A and B be Böhm trees of some λ terms. We say that A is included in B and write A B, if A results from B by cutting of some subtrees, leaving an empty subtree. (ii) Let P, Q be λ terms. We say that P approximates Q and write P Q, if BT ( P) BT ( Q). (iii) Let P be a λ term. The set of approximate normal forms (anf s) of P, is defined as follows A( P ) = { Q P Q is a nf}. Example. λ abc. a λabc. a = BT( λabc. ac( bc)) b c The set of approximate normal forms for the fixed point operator Y is 3 A( Y) = {, λf. f, λf. f, λf. f, K c b c } Lambda calculus II 67 Lambda calculus II 68

18 Typing á la Curry The basic system λ Curry can be extended in various ways to stronger systems by adding new types and by adding new rules. Some of the new rules are related to combinatorial properties of the trees representing the terms. λ λ λµ λ + EQ + A The systems to be discussed are λ, λ, λµ and λ. To each of these can be added one of the extra derivation rules EQ and A. The systems á la Curry Lambda calculus II 69 Lambda calculus II 7 Definition. Rules of equality (EQ) and approximation (A). (i) The equality rule EQ : = N N : (ii) The approximation rules A Γ P : for all P A( ) Γ : Γ : Lambda calculus II 7 Remark. (Side conditions) Note that in these rules the assumptions = N and P A( ) are not type assignments. We call them side conditions. The last rule states that has any type. Notation. Let λ- be any of the systems We denote by (i) (ii) λ +, λ A, the system So for example the system λ + λ λ, λ, λµ or λ. extended by the rule EQ. λ extended by the rule A. = λ + EQ and λµ A = λµ + A. Lambda calculus II 7

19 Examples. (a) One has ( λpq.( λr. p)( qp)) : ( τ ) λ + It follows from the equality λpq.( λr. p)( qp) = λpq. p Note that this statement is not provable in general in λ itself. The term has in λ only types of the form ( τ), as follows from the generation lemma. (b) Let Y λf.( f ( xx))( f ( xx)) be the fixed point operator. Then Y : (( ) ) λ A Indeed, the set of approximate normal forms of Y is n {, λf. f, λf. f, K λf. f, K } And all these terms have type (( ) ). Again, this statement is not derivable in λ itself. (In λ all typable terms have a normal form as we shall see later on.) Lambda calculus II 73 Lambda calculus II 74 We are going to show that the rule A is stronger than the rule EQ. Proposition. Let λ- be one of the systems λ, λµ or λ of type assignments. In all systems λ-a, we have (i) (ii) Let (iii) Let Γ : and P A( ) Γ P : BT ( ) = BT( ). Then Γ : Γ : =. Then Γ : Γ : Note that (iii) is the rule EQ. Lambda calculus II 75 (i) If P is an approximate normal form of, then P results from BT() by replacing some subtrees by and writing the result as a λ-term by one of the rules A. Therefore P has the same type as. (see an Example below). (ii) Suppose BT ( ) = BT( ). Then A ( ) = A( ), consequently Γ : ( P A( ) = A( ))[ Γ P : ], by (i), Γ :, by rule A. and, Lambda calculus II 76

20 (iii) If =, then BT( ) = BT( ), by the lemma on the correctness of the definition of Böhm trees. The result then follows by (ii). Example. Let Y, the fixed point combinator and let P λf. f ( f ) be an approximant. We have Y : ( ) By choosing as a type for, P : ( ) one obtains System λ Polymorphic typed lambda calculus Second-order typed lambda calculus Second-order polymorphic typed λ-calculus System F Girard (97) Reynolds (974) Lambda calculus II 77 Lambda calculus II 78 otivation. (i) Usually these names refer to λ-church, we shall introduce the Curry version of λ to discuss the Church version later. (ii) The idea of polymorphism: while in λ we have ( x) : ( α α) for arbitrary (type) variable α (and for arbitrary type as well), one stipulates in λ ( x) : ( α.( α α)) to indicate that x has all types or that the type of x depends uniformly on α. As we shall see later, the mechanism is rather powerful. Lambda calculus II 79 Definition. The set of types of λ. The set T = Type( λ) is defined by the following abstract grammar T = V T T V T Notation. (i) The parentheses by quantifiers cumulate to the right, so we have α α. as a shorthand for ( α ( α K( α ( )) K )) (ii) If there are no parentheses, binds more strongly than. Hence K n α τ ( α ) τ, but α. τ α( τ). Lambda calculus II 8 n

21 Definition. Type assignment in λ-curry. λ ( x : ) Γ (start rule) Γ x : ( elimination) ( introduction) ( elimination) ( introduction) Γ : ( τ) Γ N : Γ ( N) : τ Γ, x : : τ Γ ( λ x. ) : ( τ) Γ : ( α ) Γ : ( [ α : = τ ]) Γ : Γ : ( α. ) Lambda calculus II 8 Exercises. (a) - ( x) : ( α. α α ) (b) - ( λxy. y) : ( α. α α ) n (c) ( λfx. f x) : ( α.( α α ) α α ) (d) - ( xx) (e) ( xx) : (. αα ) : (. αα ( )) (f) ( xx) : ( αα ) ( αα ) Lambda calculus II 8 Remarks. (i) Exercise (c) shows that the Church numerals n cn ( λfx. f x) have type ( α.( α α ) α α ) which is sometimes called polynat. (ii) One reason for the strength of λ is that the Church numerals may be used as iterators for functions of types for arbitrary and not only for functions of a fixed type α α. (iii) We shall show later that the typable terms in λ have a normal form, in fact they are strongly normalizing. The system λµ It is the system of recursive types. The recursive types come together with an equivalence relation. The type assignment rules consist of the rules of λ and the following rule Γ : Γ : Lambda calculus II 83 Lambda calculus II 84

22 otivation A typical example of a recursive type is a type This particular type can be used to type arbitrary terms As an example, we shall show that Ω ( xx)( xx) has as a type x : : x x : xx : xx : xx : ( xx)( xx) : Ω () Λ. Here is the proof of the same statement in a natural deduction setting x : x : x : ( xx) : ( xx) : ( xx) : ( xx) : ( xx)( xx) : Ω Lambda calculus II 85 Lambda calculus II 86 Remarks. (i) The equation () is similar to a recursive domain equation D [ D D] that enables to interpret elements of Λ in denotational semantics. (ii) In order to construct a type satisfying (), there is an operator µ such that putting µα. α α implies (). Definition. The set T=Type(λµ), trees of types of λµ. (i) The set of types of λµ, T = Type(λµ), is defined by the following abstract grammar. T = V T T µ V.T where V is the set of type variables. Lambda calculus II 87 Lambda calculus II 88

23 (ii) Let T be a type. The tree of, T() is defined by induction on the structure of as follows: (iii) The equivalence relation on trees is defined as follows: Exercises. τ T( ) = T( τ) T(α) = α if α is a type variable (a) Assume τ µα. α γ, then T( τ) = T( τ) = = T( µα. ) T( ) T( τ) = T( [ α : = µα. ]) If µ K n. α for some n else T( τ) γ K γ γ γ Lambda calculus II 89 Lambda calculus II 9 (b) Assume τ ( µα. α γ) µδµ., then (c) ( µα. α γ) ( µα ( α γ) γ). T( τ) = (d) µα. [ α : = µα. ] for all, even if µ. α. γ Definition. K γ The type assignment system λµ is defined by the natural deduction system presented in the following picture Lambda calculus II 9 Lambda calculus II 9

24 λµ (start rule) ( elimination) ( introduction) ( rule) ( x : ) Γ Γ x : Γ : ( τ) Γ N : Γ ( N) : τ Γ, x : : τ Γ ( ) : ( τ) Γ : τ Γ : τ Proposition. (Coppo 985) For an arbitrary type, we have in λµ (i) Y : ( ) (ii) Ω : (i) If we put τ µα. α α, then τ τ. We will derive Y λf.( f ( xx))( f ( xx)) : ( ) Lambda calculus II 93 Lambda calculus II 94 x : τ x : τ x : τ (ii) Note that YI > Ω the result follows from the fact that I ( λx. x) : ( ), ( elimination) and the subject reduction theorem. It is possible to prove (ii) directly. f : xx : f ( xx) : f ( xx) : τ f ( xx) : τ f ( xx) : τ ( f ( xx))( f ( xx)) : Y λf.( f ( xx))( f ( xx)) : ( ) Lambda calculus II 95 Lambda calculus II 96

25 The system λ The set of types of the system λ comes together with a preorder on the set of types. It is called the system of intersection types or Torino system. Barendregt, Coppo, Dezani, Honsell and Longo (98-987) The system makes it possible that a (term) variable x has exactly two types and τ at the same time. Definition. The set of types. (i) The set of types T = Type( λ ), is defined by an abstract grammar as follows: T = V T T T T where V is the set of type variables. (ii) We select one of the type variables as a constant and name it as ω. Lambda calculus II 97 Lambda calculus II 98 Definition. The preorder on T. (i) The relation is defined on T by the following axioms and rules τ, τ ρ ρ ω ω ω ω ( ρ) ( τ) ( ( ρ τ)) τ, τ τ τ, ρ τ, τ τ τ τ Exercises. (a) ω pf ( ω ω) (b) (( τ) ( τ)) (( ) τ) (ii) pf τ ( τ & τ ) Lambda calculus II 99 Lambda calculus II

26 Definition. The system of type assignment λ. Exercises. (a) ω pf ( ω ω) (b) (( τ) ( τ)) (( ) τ) (a) obvious (start rule) ( elimination) ( introduction) ( x : ) Γ Γ x : Γ : ( τ) Γ N : Γ ( N) : τ Γ, x : : τ Γ ( ) : ( τ) (b) We know trivially thus τ (( ) τ) () ( τ) ( τ) ( τ) () ( elimination) ( introduction) Γ : ( τ) Γ : Γ : τ Γ : Γ : τ Γ : ( τ) Then (b) follows from () and () by transitivity. Lambda calculus II (ω introduction) ( rule) Γ : ω Γ : τ Γ : τ Lambda calculus II Exercises. (a) xx : (( τ) ) τ (b) Ω : ω (c) ( λpq.( λr. p)( qp)) : ( ( τ )). (a) x : ( τ) x : τ x : ( xx) : τ ( xx) : (( τ) ) τ (b) Obvious, it can be shown that has no head normal form iff ω is the only possible type for. (Barendregt 983) q : τ p : 3 r : ω (c) ( λr. p) : ( ω ) ( λ r. p)( qp) : (qp) : ω ( λq.( λr. p)( qp)) : ( τ ) ( λpq.( λr. p)( qp)) : ( ( τ )) 3 Lambda calculus II 3 Lambda calculus II 4

27 Combining the systems á la Curry Basic properties. The Curry systems λ, λ, λµ and λ enjoy several properties (i) there are some variants of the system λ. in one of them the rule (axiom) that assigns ω to any term. (ii) The systems λ, λ, λµ and λ are all extensions of λ. They can be combined into other systems, an extreme case is λµ which includes all these systems. It can be extended by cartesian products and direct sums in order to fall into the cartesian closed category. Lambda calculus II 5 Common to all systems: Basis lemma Subterm lemma Substitution lemma Subject reduction Theorem Strong normalization does not hold for all Each system has a proper variant Generation lemma Lambda calculus II 6 In the following refers to one of Curry systems λ, λ, λµ and λ. The following three common properties are proved in the same way as we have done for λ. Basis lemma for the Curry systems. Let Γ be a basis. (i) If Γ, Γ Γ is another basis, then Γ : Γ : (ii) Γ : FV ( ) dom( Γ) (iii) Γ : Γ FV ( ) : Subterm lemma for the Curry systems. Let be a subterm of. Then Γ : Γ' ': ' For some Γ and. Substitution lemma for the Curry systems. (i) Γ : Γ[ α : = τ] : [ α : = τ] (ii)( Γ, x : : τ & Γ N : ) Γ [ x : = N] : τ Lambda calculus II 7 Lambda calculus II 8

28 Subject reduction and subject conversion. Subject reduction Γ : and > ' Γ ': Exercise. holds for the main systems of type assignment á la Curry, namely Show that for each of the systems one has / K : ( α α) in that system. λ, λ, λµ and λ λ, λ, λµ and λ, with or without the additional rules EQ and A. Subject conversion Γ : and = ' Γ ': Holds only for the systems including λ or rule A or if the rule EQ is included. Lambda calculus II 9 Lambda calculus II Subject reduction. We have already proved the Subject reduction theorem for the basic system λ and we are going to prove it for λ. We need some definitions and throughout the proof T = Type( λ ). Definition. (i) Write > τ if one of the following conditions is satisfied or τ α., α. & τ [ α : = π], for some, for some (ii) The relation is the reflexive and transitive closure of >. π Lambda calculus II (iii) A map o : is defined as follows T T Remark. α o ( τ) ( α. ) o o = α = τ = o if α is a type variable Note that the -introduction and -elimination rules are the only ones in which the subject does not change. Several instances of these rules may be applied consecutively, giving : : τ In this case τ. By this reasoning, one obtains the following: Lambda calculus II

29 Lemma. Let τ an assume that no free type variable in occurs in Γ. Then Γ : Γ : τ Suppose Γ : and τ. Then > L > n τ for some, L, n. if necessary, by renaming some bound type variables, we may assume that for i, i < n, we have i + α. α FV ( Γ) By the definition of the relation > and the rules of λ, it follows that we have Γ : Γ : i i+ for all i < n. Hence Γ : τ. n Generation lemma for λ-curry. (i) Γ x : (( x : ) Γ (ii) Γ ( N ) : τ τ τ [ Γ : τ & Γ N : ] (iii) Γ ( ) : ρ τ [ Γ, x : : τ & τ ρ] By induction on derivations. Lambda calculus II 3 Lambda calculus II 4 Lemma on preorder of types. (i) By induction on the structure of. (i) Given types, τ, there exists a type τ such that o o ( [ α : = τ]) [ α : = τ ] o o r (ii) r α τ ( [ α : = τ] r r r r (iii) ( ρ) ( ρ ) α τ ( ρ ) ( ρ)[ α : = τ] (ii) It suffices to prove it for. We have to consider two cases o o Case. α.. Then. Case. α. ρ and ρ[ α : = τ] o o o Then by (i) we have ρ [ α : = τ ] [ α : = τ ] (iii) By (ii), we have o o r r r r ( ρ ) ( ρ ) ( ρ) [ α : = τ] ( ρ)[ α τ] Lambda calculus II 5 Lambda calculus II 6

30 By induction on the derivation of > We will treat only. the case of -reduction i.e. the case that ( P) Q and P[ x : = Q]. Subject reduction theorem for λ-curry. If >, then we have Γ : Γ : By the generation lemma, we obtain Γ (( P) Q) : ρ [ Γ ( P) : ( ρ ) & Γ Q : ρ] ρ [ Γ, x : ρ P : & ( ρ ) ( ρ ) & Γ Q : ρ] From (iii) of the lemma on preorder of types, it follows r r ( ρ ) ( ρ )[ α : = τ] Lambda calculus II 7 Lambda calculus II 8 and hence by (i) of the the Substitution lemma Γ, x : ρ P :, Γ Q : ρ Γ P [ x : = Q]: and Γ P [ x : = Q]: and by (ii) of by the lemma stating that assignment of implies the assignment of the Substitution lemma a smaller type. a bigger type to a term Subject reduction theorem for λµ. Let >, then for λµ one has Γ : Γ : Lambda calculus II 9 Lambda calculus II

31 The proof of the subject reduction theorem for λµ is somewhat easier than that for λ. It follows similar steps but using the relation insted of. Remark. The subject reduction theorem holds also for λ. This system is also closed under the rule EQ as we will show later on. We will see that in the systems λ, λ and λµ. and λ-a the subject conversion theorem holds. This is not so for λ. Lambda calculus II Lambda calculus II Example. What makes closed under -expansion. λ Let ( P) Q be the redex and P[ x : = Q] its contractum. In λ, λ and λµ. it is not guaranteed that there is a common type for the different occurrences of Q. Note that the type ω is essential in case when Q has no occurrence in P[x:= Q]. To show that -expansion holds for this pair assume that Γ :. λ Now Q occurs n times in, each occurence having its proper type τ i n. Define i for τ L τn if n > τ ω if n = Then Γ Q : τ Γ, x : τ P : Subject conversion theorem for λ. Let =, then for λ one has Without proof Γ : Γ : Hence Γ ( λx. P) : ( τ ) and Γ ( λx : P) Q :. Lambda calculus II 3 Lambda calculus II 4

32 Strong normalization Definition A lambda term is called strongly normalizing iff all reduction sequences starting with terminate. KIK is strongly normalizing, while KIΩ is not. We start with the proof of strong normalization for λ. Definition. (i) SN = { Λ is strongly normalizing} (ii) Let A, B Λ. Define a subset A B of Λ as follows: A B = { F A a A( Fa B)} (iii) For every Type( λ ), we define a set Λ as follows We are going to show that every term typable in λ and λ is strongly normalizing. This is not true for λµ and λ since in these systems, all terms are typable. τ α = SN = τ if α is a type variable Lambda calculus II 5 Lambda calculus II 6 Definition. (i) We call a subset X SN saturated if r (a) ( n )( R, K, R SN )[ xr X ] n where x is any term variable. (b) ( n )( R, K, Rn SN )( Q SN ) r r [ P[ x : = Q] R X ( P) QR X ] Lemma on saturated sets. (i) SN SAT (ii) A, B SAT A B SAT (iii) Let { A } be a collection of members of SAT, then i i I I i I A SAT i (ii) SAT = { X Λ X is saturated } (iv) For all Type( λ ) one has SAT Note that saturated sets are non-empty, as they contain all term variables, and that they are closed under a particular type of expansion. Lambda calculus II 7 Lambda calculus II 8

33 (i) Obviously SN SN and it satisfies the condition (a). As to the condition (b), suppose r r P[ x : = Q] R SN & Q, R SN () We claim that also r ( P) QR SN () r Note that the reductions inside P, Q or the R must terminate since these terms are strongly normalising by assumption. The term P [ x : = Q] is a subterm of a term in SN by () hence it is itself in SN and, consequently, P is i n SN. So after finitely many reduction steps applied to the term in (), we obtain r ( P ) Q R & P > P etcetera Lambda calculus II 9 r Then the contraction of ( P ) Q R gives r P [ x : = Q ] R (3) r This is a reduct of P[ x : = Q] R and since this term is SN, then (3) and the term ( P) Q are SN. (ii) Let A, B SAT. Then by definition x A for all variables x. Hence F A B Fx B Fx SN F SN So indeed A B SN. We prove the condition (i) (a) of saturation, let R r We must show for a variable x that r SN.. xr A B which means Q A ( xrq B) which is true since A SN and B is saturated. Lambda calculus II 3 (iii) Similarly (iv) By induction on the generation of, using (i) and (ii). In order to prove the key Soundness Theorem, we need the folowing Definition. (i) A valuation in Λ is a map ρ : V Λ, where V is the set of term variables. (iii) Let ρ be a valuation in Λ. We say that ρ satisfies : and write ρ = :, if. ρ If Γ is a basis, we say that ρ satisfies Γ and write for all ( x : ) Γ. (iv) A basis Γ satisfies : and write Γ = :, if ρ [ ρ = Γ ρ = : ] ρ = Γ, if ρ = x : (ii) Let ρ be a valuation in Λ. We define ρ = [ x : = ρ( x), K, xn : = ρ( xn )] r where x = x,k, x n is the set of free variables in. Lambda calculus II 3 Lambda calculus II 3

34 (iii) Let ρ be a valuation in Λ. We say that ρ satisfies : and write ρ = :, if. ρ If Γ is a basis, we say that ρ satisfies Γ and write ρ = Γ, if ρ = x : for all ( x : ) Γ. By induction on derivation of :. Case. If x and Γ : follows from ( x : ) Γ, trivially Γ = x :. then (iv) A basis Γ satisfies : and write Γ = :, if ρ[ ρ = Γ ρ = : ] Soundness Theorem. Γ λ : Γ = : Case. If and Γ : is a direct consequence of Γ : τ and Γ : τ, In order to show ρ = :, We suppose ρ = Γ. Then ρ = : τ and ρ = : τ which means τ = τ and τ ρ ρ But then = which means ρ = ρ ρ ρ : Lambda calculus II 33 Lambda calculus II 34 Case 3. Let, Γ : and consequence of Γ x : :., By the induction hypothesis, we have let be a direct Since Γ, x : : () = In order to show ρ = :, suppose ρ = Γ. We have to show N for all ρ N ρ N r ( )[ y : = ρ( y v )] N r r [ y : = ρ( y), x = N] ρ( x: = N ) Let N. Then ρ( x : = N ) = Γ, x :, and hence ρ ( x: = N ) it follows from the saturation of that λx.. N ρ by (). Lambda calculus II 35 Lambda calculus II 36

35 Strong normalization theorem for λ -Curry Suppose Γ λ : Suppose Γ :. Then Γ = : according to the Soundness Theorem. If we put ρ ( x) = x for all x, then ρ = Γ. Note that x τ since τ is saturated. Therefore ρ = :, hence SN. ρ then is strongly normalizing. Lambda calculus II 37 Lambda calculus II 38 Suppose Γ :. Then Γ = : according to the Soundness Theorem. If we put ρ ( x) = x for all x, then ρ = Γ. Note that x τ since τ is saturated. Therefore ρ = :, hence Remark. SN. ρ A simple generalization of the method proves the Strong Normalization Theorem for λ. Definition. (i) A valuation in SAT is a map ξ : V SAT Where V is the set of type variables. (ii) Given a valuation ξ in SAT one defines a set ξ Λ for every type in λ as follows: α ξ τ α. = ξ( α), where α V ξ ξ = = I ξ τ ξ X SAT ξ( α: = X ) Lambda calculus II 39 Lambda calculus II 4

36 Lemma. Given a valuation ξ in SAT and a type in λ, then ξ SAT. Definition. Let ρ be a valuation in Λ and ξ be a valuation in SAT. (i) We write ρ, ξ = : iff ρ ξ As the proof of (iv) in lemma on saturated sets using the fact that SAT is closed under arbitrary intersections. (ii) If Γ is a basis, we write ρ, ξ = Γ iff ρ, ξ = x : for all x : in Γ (iii) We write Γ = : iff ρ, ξ [ ρ, ξ = Γ ρ, ξ = : ] Lambda calculus II 4 Lambda calculus II 4 Soundness Theorem for λ. Γ λ : Γ = : Soundness Theorem for λ. Γ λ : Γ = : Lambda calculus II 43 By induction on the derivation of Γ : as in the proof of Soundness Theorem for λ. There are two more cases corresponding to rules. Case 4. Γ : where [ α : = τ] is a direct consequence of Γ : α.. By the Induction Hypothesis, we have Γ = : α. () In order to show suppose ρ, ξ = : [ α : = τ] ρ, ξ = Γ. Lambda calculus II 44

37 It follows from () that Hence ρ α. ρ ξ = ξ( α: = I X SAT τ ξ ) ξ( α: = X ) By induction on Type(λ) (some care is needed in case ) we prove ξ( α: = τ ) ξ = [ α : = τ]. τ Case 5. Let Γ : with α. and α FV ( Γ) is a direct consequence of Γ :. By the Induction Hypothesis, we have In order to show we have Γ = : ρ, ξ = : α., we suppose ρ, ξ = Γ. Since α FV (Γ), ρ, ξ( α : = X ) = Γ for all X SAT. It follows from () that ρ Therefore for all X SAT ξ( α: = X ). α ρ ξ () which completes the proof of the Case 4. Hence ρ, ξ = : α. 3 Lambda calculus II 45 Lambda calculus II 46 Strong Normalization Theorem for λ-curry Strong Normalization Theorem for λ-curry Γ λ : is strongly normalizing Γ λ : is strongly normalizing Proof of the theorem is similar to the proof of Strong Normalizing Theorem for λ Curry. Lambda calculus II 47 Lambda calculus II 48

38 Decidability of type assignment. Note that for arbitrary base Γ = x :, K, : } one has { xn n Γ : ( λx Kλx. ) : ( K ) n Consequently, analysing the type assignment, we may assume that the base is always empty. Typical questions are Given and, does it hold :? Given, does there exist a such that :? Given, does there exist an such that :? These three problems are called type checking, typability and inhabitation respectively and we shall denote them :?, :?, and? :. Lambda calculus II 49 n We shall examine the decidability of these three problems for the various systems of type assignments. The results can be summarized in the following table :? :??: λ yes yes yes λ???? no λµ yes yes, always yes, always λ no yes, always?? + λ no no yes + λ no no no + λµ no yes,always yes, always λ A no no yes, always λa no no yes, always λµa no yes, always yes, always λ A no yes, always yes, always Lambda calculus II 5 We first show decidability of the three questions for λ Curry. In what follows T denotes Type( λ and denotes. ) λ Curry We define some operations on the set of types: substitutor, unifier, unification and some concepts concerning type assignments: pricipal pair and principal type. Definition. (i) A substitutor is an operation : T T on the set of types such that ( τ) ( ) ( τ) Notation. a) We write for (). b) In cases that are of interest for us, a substitutor has a finite support, which means that for all but finitely many type variables α one has α α, the support of being sup( ) = { α α / α}. In that case we write ( ) = [ α : = α, K, α n : = α Where α, K, } is the support of. We also write { α n n ] = [ α : = α, K, α n : = α n ]. Lambda calculus II 5 Lambda calculus II 5

39 Definition. Unifiers. (i) Let and τ be two types. A unifier for and τ is a substitutor such that τ. (ii) The substitutor is a most general unifier for and τ if (a) is a unifier for and τ (b) if an arbitrary unifier for and τ, then there is a substitutor such that o. (iii) Let E = { = τ, K, n = τn} be a finite set of equations between types. The equations do not need to be valid. A unifier for E is a substitutor such that = τ, K, n = τn. In that case one writes = E. Similarly one defines the notion of a most general unifier for E. Examples. The types have unfiers ( α ) ( γ γ) δ = [ : = γ γ, δ : = α ( γ γ)] = [ : = γ γ, α : = ε ε, δ : = ( ε ε) ( γ γ)] The unifier is most general, the unifier is not. Lambda calculus II 53 Lambda calculus II 54 Unification Theorem. Definition. Variants. The type is a variant of the type τ if there are substitutors, such that Examples. α α and = τ is not a and τ = γ δ δ variant of are variants of each other α α Note that if and are two most general unifiers of types and τ then and are variants of each other and similarly for τ. Lambda calculus II 55 (i) There is a recursive function U with input (after coding) a pair of types and with output which is either a substitutor or fail such that a most general unifier for and τ U(, τ) = if and τ have a unifier fail if and τ have no unifier (ii) There is a recursive function U with input (after coding) finite sets of equations between types and with output either a substitutor or fail such that a U(E) = fail most general unifier for E if if E has a unifier E has no unifier Lambda calculus II 56

40 Note that τ τ τ τ (i) Define U(, τ) by the following recursive loop with case distinction. [ α : = τ] U ( α, τ) = Id (the identity) fail U (, α) = U ( α, ) U & if α FV ( τ) if τ = α else U (, ) U (, ) (, ) U ( τ τ τ τ =, τ ) ou (, τ ) Where the last expression is considered to be fail if one of its parts is. Lambda calculus II 57 (i) By induction on the lexicografic order of pairs of natural numbers defined as follows: # var(, τ) = the number of variables in τ and # (, τ) = the number of arrows in τ. By induction on pairs (# var(, τ),# (, τ) ) ordered lexicographically, one can show that U(, τ) is always defined. oreover U satisfies the specification. (ii) If E = { = τ, K, n = τn} then define U( E) = U (, τ), Where = L and τ = τ L. n τ n Lambda calculus II 58 Proposition on substitutors and equations. Let Γ be a basis, Λ a term and T a type such that FV ( ) dom(γ). Then there is a finite set of equations E = E( Γ,, ) such that for all substitutors one has = E( Γ,, ) Γ : Γ : = E( Γ,, ) () () For some such that and have the same effect on type variables in Γ and. Define the set E( Γ,, ) by induction on the structure of : E( Γ, x, ) = { = Γ( x)} E( Γ, N, ) = E( Γ,, α ) E( Γ, N, α) where α is a fresh variable E( Γ,, ) = E( Γ { x : },, ) { α = } where α, are fresh variables By induction on one can show (using generation lemma) that () and () hold. Lambda calculus II 59 Lambda calculus II 6

41 Definition. Principal pair, principal type. (i) Let Λ. Then (Γ,) is a principal pair (pp) for if Remarks. ( ) ( ) Γ : Γ : [ Γ Γ & ] Note that if (Γ,) is a principal pair for, then every variant (Γ, ) of (Γ,), in the obvious sense, is a principal pair for. Here { x :, K, x : } = { x :, K, : }. n n xn (ii) Let Λ be closed. Then is a principal type (pt) for if n Conversely, if (Γ,) and (Γ, ) are both principal pairs for, then (Γ, ) is a variant of (Γ,). ( ) ( ) : : [ ] oreover, if (Γ,) is a principal pair for, then FV ( ) = dom(γ). Lambda calculus II 6 Lambda calculus II 6 Principal Type Theorem for Curry. λ (i) There exists (after coding) a recursive function pp such that ( Γ, ) pp( ) = fail a principal pair for if a type for exists if has no type (ii) There exists (after coding) a recursive function pt such that for closed terms one has a principal type for pt( ) = fail if a type for exists if has no type (i) Let FV ) = { x,, x } and define Γ = { x : α, K, : α }. ( K n xn n If we put =, we have Define has a type Γ Γ : Γ : = E( Γ,, ( Γ, ) if U( E( Γ,, )) = pp( ) = fail if U( E( Γ,, )) = fail Then pp() satisfies the statement (i) of the theorem. Indeed, if has a type, then U ( E( Γ,, )) = and Γ : follows from (i) in the proposition on substitutors and equations. ) Lambda calculus II 63 Lambda calculus II 64

42 To show that ( Γ, ) is a principal pair, suppose that also Γ :. Let Γ ~ = Γ FV ( ), write ~ Γ = Γ and =. Then also If has no type, then there is no substitutor satisfying E Γ,, ), ( Γ : Hence by (ii) in the proposition on substitutors and equations, there is, acting in the same way as on Γ, such that = E( Γ,, ). hence ( E( Γ,, )) = fail pp( ) U = By the Unification Theorem is a most general unifier, hence there is a such that = o. Now and ( Γ ) = Γ = Γ = Γ ~ = Γ ( ) = = = (ii) Let be closed and pp( ) = ( Γ, ). Then Γ = / and we can put pt( ) = This completes the case when has a type. Lambda calculus II 65 Lambda calculus II 66 (a) Type checking: given and, we have Decidability of the inhabitation problem for λ is shown equivalent to provability of in the minimal intuitionistic proposition calculus PROP with only as connective and considered as an element of PROP. Using finite Kripke models it can be shown that provability of is decidable. : [ = pt( ) This is decidable by a pattern matching algorithm similar to the unification algorithm. ] Theorem. the inhabitation problem for λ, that is is a decidable property of. Λ λ : (b) Typability: given, then has a type iff pt( ) =/ fail. Lambda calculus II 67 Lambda calculus II 68

43 Decidability of the inhabitation problem for λ is shown equivalent to provability of in the minimal intuitionistic proposition calculus PROP with only as connective and considered as an element of PROP. Using finite Kripke models it can be shown that provability of is decidable. Theorem. the inhabitation problem for λ, that is is a decidable property of. is inhabited in λ -Curry Λ is inhabited in is provable λ : in PROP Lambda calculus II 69 λ -Church Now, we consider λ. The question whether type checking and typability is open. There is only a result showing that the problem of typability in λ can be reduced to that of type checking. Proposition. {( : ) : } is decidable { : } is decidable λ λ One has : ( λxy. y) : ( α α) The implication is obvious, since ( λxy. y) : ( α α) for all The other implication follows from the lemma on typability of subterms. Lambda calculus II 7 Theorem. The inhabitation problem for λ is undecidable. As for λ, one can show the first equivalence is inhabited in λ Curry is inhabited in λ Church is provable in PROP where PROP is the constructive second-order propositional calculus. Löb (976) proved that the last property is undecidable. Theorem. For λµ one has the following: (i) Type checking is decidable. (ii) Typability is trivially decidable, we showed that every λ-term has a type. (iii) The inhabitation problem for λµ is trivially decidable: all types are inhabited. Lambda calculus II 7 Lambda calculus II 7

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

About these lecture notes. Simply Typed λ-calculus. Types About these lecture notes Simply Typed λ-calculus Akim Demaille akim@lrde.epita.fr EPITA École Pour l Informatique et les Techniques Avancées Many of these slides are largely inspired from Andrew D. Ker

Διαβάστε περισσότερα

C.S. 430 Assignment 6, Sample Solutions

C.S. 430 Assignment 6, Sample Solutions 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

Διαβάστε περισσότερα

2 Composition. Invertible Mappings

2 Composition. Invertible Mappings Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan Composition. Invertible Mappings In this section we discuss two procedures for creating new mappings from old ones, namely,

Διαβάστε περισσότερα

Lecture 2. Soundness and completeness of propositional logic

Lecture 2. Soundness and completeness of propositional logic Lecture 2 Soundness and completeness of propositional logic February 9, 2004 1 Overview Review of natural deduction. Soundness and completeness. Semantics of propositional formulas. Soundness proof. Completeness

Διαβάστε περισσότερα

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

Every set of first-order formulas is equivalent to an independent set Every set of first-order formulas is equivalent to an independent set May 6, 2008 Abstract A set of first-order formulas, whatever the cardinality of the set of symbols, is equivalent to an independent

Διαβάστε περισσότερα

The Simply Typed Lambda Calculus

The Simply Typed Lambda Calculus Type Inference Instead of writing type annotations, can we use an algorithm to infer what the type annotations should be? That depends on the type system. For simple type systems the answer is yes, and

Διαβάστε περισσότερα

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit Ting Zhang Stanford May 11, 2001 Stanford, 5/11/2001 1 Outline Ordinal Classification Ordinal Addition Ordinal Multiplication Ordinal

Διαβάστε περισσότερα

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

Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3 Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3 1 State vector space and the dual space Space of wavefunctions The space of wavefunctions is the set of all

Διαβάστε περισσότερα

EE512: Error Control Coding

EE512: Error Control Coding EE512: Error Control Coding Solution for Assignment on Finite Fields February 16, 2007 1. (a) Addition and Multiplication tables for GF (5) and GF (7) are shown in Tables 1 and 2. + 0 1 2 3 4 0 0 1 2 3

Διαβάστε περισσότερα

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

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

Διαβάστε περισσότερα

Uniform Convergence of Fourier Series Michael Taylor

Uniform Convergence of Fourier Series Michael Taylor Uniform Convergence of Fourier Series Michael Taylor Given f L 1 T 1 ), we consider the partial sums of the Fourier series of f: N 1) S N fθ) = ˆfk)e ikθ. k= N A calculation gives the Dirichlet formula

Διαβάστε περισσότερα

4.6 Autoregressive Moving Average Model ARMA(1,1)

4.6 Autoregressive Moving Average Model ARMA(1,1) 84 CHAPTER 4. STATIONARY TS MODELS 4.6 Autoregressive Moving Average Model ARMA(,) This section is an introduction to a wide class of models ARMA(p,q) which we will consider in more detail later in this

Διαβάστε περισσότερα

λρ-calculus 1. each λ-variable is a λρ-term, called an atom or atomic term; 2. if M and N are λρ-term then (MN) is a λρ-term called an application;

λρ-calculus 1. each λ-variable is a λρ-term, called an atom or atomic term; 2. if M and N are λρ-term then (MN) is a λρ-term called an application; λρ-calculus Yuichi Komori komori@math.s.chiba-u.ac.jp Department of Mathematics, Faculty of Sciences, Chiba University Arato Cho aratoc@g.math.s.chiba-u.ac.jp Department of Mathematics, Faculty of Sciences,

Διαβάστε περισσότερα

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

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch: HOMEWORK 4 Problem a For the fast loading case, we want to derive the relationship between P zz and λ z. We know that the nominal stress is expressed as: P zz = ψ λ z where λ z = λ λ z. Therefore, applying

Διαβάστε περισσότερα

Concrete Mathematics Exercises from 30 September 2016

Concrete Mathematics Exercises from 30 September 2016 Concrete Mathematics Exercises from 30 September 2016 Silvio Capobianco Exercise 1.7 Let H(n) = J(n + 1) J(n). Equation (1.8) tells us that H(2n) = 2, and H(2n+1) = J(2n+2) J(2n+1) = (2J(n+1) 1) (2J(n)+1)

Διαβάστε περισσότερα

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

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω 0 1 2 3 4 5 6 ω ω + 1 ω + 2 ω + 3 ω + 4 ω2 ω2 + 1 ω2 + 2 ω2 + 3 ω3 ω3 + 1 ω3 + 2 ω4 ω4 + 1 ω5 ω 2 ω 2 + 1 ω 2 + 2 ω 2 + ω ω 2 + ω + 1 ω 2 + ω2 ω 2 2 ω 2 2 + 1 ω 2 2 + ω ω 2 3 ω 3 ω 3 + 1 ω 3 + ω ω 3 +

Διαβάστε περισσότερα

derivation of the Laplacian from rectangular to spherical coordinates

derivation of the Laplacian from rectangular to spherical coordinates derivation of the Laplacian from rectangular to spherical coordinates swapnizzle 03-03- :5:43 We begin by recognizing the familiar conversion from rectangular to spherical coordinates (note that φ is used

Διαβάστε περισσότερα

Fractional Colorings and Zykov Products of graphs

Fractional Colorings and Zykov Products of graphs Fractional Colorings and Zykov Products of graphs Who? Nichole Schimanski When? July 27, 2011 Graphs A graph, G, consists of a vertex set, V (G), and an edge set, E(G). V (G) is any finite set E(G) is

Διαβάστε περισσότερα

Example Sheet 3 Solutions

Example Sheet 3 Solutions Example Sheet 3 Solutions. i Regular Sturm-Liouville. ii Singular Sturm-Liouville mixed boundary conditions. iii Not Sturm-Liouville ODE is not in Sturm-Liouville form. iv Regular Sturm-Liouville note

Διαβάστε περισσότερα

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

Partial Differential Equations in Biology The boundary element method. March 26, 2013 The boundary element method March 26, 203 Introduction and notation The problem: u = f in D R d u = ϕ in Γ D u n = g on Γ N, where D = Γ D Γ N, Γ D Γ N = (possibly, Γ D = [Neumann problem] or Γ N = [Dirichlet

Διαβάστε περισσότερα

Chapter 3: Ordinal Numbers

Chapter 3: Ordinal Numbers Chapter 3: Ordinal Numbers There are two kinds of number.. Ordinal numbers (0th), st, 2nd, 3rd, 4th, 5th,..., ω, ω +,... ω2, ω2+,... ω 2... answers to the question What position is... in a sequence? What

Διαβάστε περισσότερα

ST5224: Advanced Statistical Theory II

ST5224: Advanced Statistical Theory II ST5224: Advanced Statistical Theory II 2014/2015: Semester II Tutorial 7 1. Let X be a sample from a population P and consider testing hypotheses H 0 : P = P 0 versus H 1 : P = P 1, where P j is a known

Διαβάστε περισσότερα

A Note on Intuitionistic Fuzzy. Equivalence Relation

A Note on Intuitionistic Fuzzy. Equivalence Relation International Mathematical Forum, 5, 2010, no. 67, 3301-3307 A Note on Intuitionistic Fuzzy Equivalence Relation D. K. Basnet Dept. of Mathematics, Assam University Silchar-788011, Assam, India dkbasnet@rediffmail.com

Διαβάστε περισσότερα

A Lambda Model Characterizing Computational Behaviours of Terms

A Lambda Model Characterizing Computational Behaviours of Terms A Lambda Model Characterizing Computational Behaviours of Terms joint paper with Silvia Ghilezan RPC 01, Sendai, October 26, 2001 1 Plan of the talk normalization properties inverse limit model Stone dualities

Διαβάστε περισσότερα

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS CHAPTER 5 SOLVING EQUATIONS BY ITERATIVE METHODS EXERCISE 104 Page 8 1. Find the positive root of the equation x + 3x 5 = 0, correct to 3 significant figures, using the method of bisection. Let f(x) =

Διαβάστε περισσότερα

ORDINAL ARITHMETIC JULIAN J. SCHLÖDER

ORDINAL ARITHMETIC JULIAN J. SCHLÖDER ORDINAL ARITHMETIC JULIAN J. SCHLÖDER Abstract. We define ordinal arithmetic and show laws of Left- Monotonicity, Associativity, Distributivity, some minor related properties and the Cantor Normal Form.

Διαβάστε περισσότερα

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

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required) Phys460.nb 81 ψ n (t) is still the (same) eigenstate of H But for tdependent H. The answer is NO. 5.5.5. Solution for the tdependent Schrodinger s equation If we assume that at time t 0, the electron starts

Διαβάστε περισσότερα

Sequent Calculi for the Modal µ-calculus over S5. Luca Alberucci, University of Berne. Logic Colloquium Berne, July 4th 2008

Sequent Calculi for the Modal µ-calculus over S5. Luca Alberucci, University of Berne. Logic Colloquium Berne, July 4th 2008 Sequent Calculi for the Modal µ-calculus over S5 Luca Alberucci, University of Berne Logic Colloquium Berne, July 4th 2008 Introduction Koz: Axiomatisation for the modal µ-calculus over K Axioms: All classical

Διαβάστε περισσότερα

Matrices and Determinants

Matrices and Determinants Matrices and Determinants SUBJECTIVE PROBLEMS: Q 1. For what value of k do the following system of equations possess a non-trivial (i.e., not all zero) solution over the set of rationals Q? x + ky + 3z

Διαβάστε περισσότερα

6.3 Forecasting ARMA processes

6.3 Forecasting ARMA processes 122 CHAPTER 6. ARMA MODELS 6.3 Forecasting ARMA processes The purpose of forecasting is to predict future values of a TS based on the data collected to the present. In this section we will discuss a linear

Διαβάστε περισσότερα

Other Test Constructions: Likelihood Ratio & Bayes Tests

Other Test Constructions: Likelihood Ratio & Bayes Tests Other Test Constructions: Likelihood Ratio & Bayes Tests Side-Note: So far we have seen a few approaches for creating tests such as Neyman-Pearson Lemma ( most powerful tests of H 0 : θ = θ 0 vs H 1 :

Διαβάστε περισσότερα

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

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ. Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο The time integral of a force is referred to as impulse, is determined by and is obtained from: Newton s 2 nd Law of motion states that the action

Διαβάστε περισσότερα

Homework 3 Solutions

Homework 3 Solutions Homework 3 Solutions Igor Yanovsky (Math 151A TA) Problem 1: Compute the absolute error and relative error in approximations of p by p. (Use calculator!) a) p π, p 22/7; b) p π, p 3.141. Solution: For

Διαβάστε περισσότερα

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

6.1. Dirac Equation. Hamiltonian. Dirac Eq. 6.1. Dirac Equation Ref: M.Kaku, Quantum Field Theory, Oxford Univ Press (1993) η μν = η μν = diag(1, -1, -1, -1) p 0 = p 0 p = p i = -p i p μ p μ = p 0 p 0 + p i p i = E c 2 - p 2 = (m c) 2 H = c p 2

Διαβάστε περισσότερα

Section 8.3 Trigonometric Equations

Section 8.3 Trigonometric Equations 99 Section 8. Trigonometric Equations Objective 1: Solve Equations Involving One Trigonometric Function. In this section and the next, we will exple how to solving equations involving trigonometric functions.

Διαβάστε περισσότερα

Type Theory and Coq. Herman Geuvers. Principal Types and Type Checking

Type Theory and Coq. Herman Geuvers. Principal Types and Type Checking Type Theory and Coq Herman Geuvers Principal Types and Type Checking 1 Overview of todays lecture Simple Type Theory à la Curry (versus Simple Type Theory à la Church) Principal Types algorithm Type checking

Διαβάστε περισσότερα

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

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R + Chapter 3. Fuzzy Arithmetic 3- Fuzzy arithmetic: ~Addition(+) and subtraction (-): Let A = [a and B = [b, b in R If x [a and y [b, b than x+y [a +b +b Symbolically,we write A(+)B = [a (+)[b, b = [a +b

Διαβάστε περισσότερα

Problem Set 3: Solutions

Problem Set 3: Solutions CMPSCI 69GG Applied Information Theory Fall 006 Problem Set 3: Solutions. [Cover and Thomas 7.] a Define the following notation, C I p xx; Y max X; Y C I p xx; Ỹ max I X; Ỹ We would like to show that C

Διαβάστε περισσότερα

Proving with Computer Assistance Lecture 2. Herman Geuvers

Proving with Computer Assistance Lecture 2. Herman Geuvers Proving with Computer Assistance Lecture 2 Herman Geuvers 1 Typed λ calculus as the basis for a Proof Assistant (e.g. Coq) λ-term program proof type specification formula Integrated system for proving

Διαβάστε περισσότερα

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

Chapter 6: Systems of Linear Differential. be continuous functions on the interval Chapter 6: Systems of Linear Differential Equations Let a (t), a 2 (t),..., a nn (t), b (t), b 2 (t),..., b n (t) be continuous functions on the interval I. The system of n first-order differential equations

Διαβάστε περισσότερα

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

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation Overview Transition Semantics Configurations and the transition relation Executions and computation Inference rules for small-step structural operational semantics for the simple imperative language Transition

Διαβάστε περισσότερα

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

forms This gives Remark 1. How to remember the above formulas: Substituting these into the equation we obtain with Week 03: C lassification of S econd- Order L inear Equations In last week s lectures we have illustrated how to obtain the general solutions of first order PDEs using the method of characteristics. We

Διαβάστε περισσότερα

Commutative Monoids in Intuitionistic Fuzzy Sets

Commutative Monoids in Intuitionistic Fuzzy Sets Commutative Monoids in Intuitionistic Fuzzy Sets S K Mala #1, Dr. MM Shanmugapriya *2 1 PhD Scholar in Mathematics, Karpagam University, Coimbatore, Tamilnadu- 641021 Assistant Professor of Mathematics,

Διαβάστε περισσότερα

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.

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. Math 446 Homework 3 Solutions. (1). (i): Reverse triangle inequalit for metrics: Let (X, d) be a metric space and let x,, z X. Prove that d(x, z) d(, z) d(x, ). (ii): Reverse triangle inequalit for norms:

Διαβάστε περισσότερα

Homomorphism in Intuitionistic Fuzzy Automata

Homomorphism in Intuitionistic Fuzzy Automata International Journal of Fuzzy Mathematics Systems. ISSN 2248-9940 Volume 3, Number 1 (2013), pp. 39-45 Research India Publications http://www.ripublication.com/ijfms.htm Homomorphism in Intuitionistic

Διαβάστε περισσότερα

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

The λ-calculus. Lecturer: John Wickerson. Phil Wadler The λ-calculus Lecturer: John Wickerson Phil Wadler A tiny bit of Java expr ::= expr + expr expr < expr x n block ::= cmd { cmd... cmd } cmd ::= expr; if(cmd) block else block; if(cmd) block; try{cmd}

Διαβάστε περισσότερα

Statistical Inference I Locally most powerful tests

Statistical Inference I Locally most powerful tests Statistical Inference I Locally most powerful tests Shirsendu Mukherjee Department of Statistics, Asutosh College, Kolkata, India. shirsendu st@yahoo.co.in So far we have treated the testing of one-sided

Διαβάστε περισσότερα

Lecture 15 - Root System Axiomatics

Lecture 15 - Root System Axiomatics Lecture 15 - Root System Axiomatics Nov 1, 01 In this lecture we examine root systems from an axiomatic point of view. 1 Reflections If v R n, then it determines a hyperplane, denoted P v, through the

Διαβάστε περισσότερα

5. Choice under Uncertainty

5. Choice under Uncertainty 5. Choice under Uncertainty Daisuke Oyama Microeconomics I May 23, 2018 Formulations von Neumann-Morgenstern (1944/1947) X: Set of prizes Π: Set of probability distributions on X : Preference relation

Διαβάστε περισσότερα

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

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β 3.4 SUM AND DIFFERENCE FORMULAS Page Theorem cos(αβ cos α cos β -sin α cos(α-β cos α cos β sin α NOTE: cos(αβ cos α cos β cos(α-β cos α -cos β Proof of cos(α-β cos α cos β sin α Let s use a unit circle

Διαβάστε περισσότερα

Reminders: linear functions

Reminders: linear functions Reminders: linear functions Let U and V be vector spaces over the same field F. Definition A function f : U V is linear if for every u 1, u 2 U, f (u 1 + u 2 ) = f (u 1 ) + f (u 2 ), and for every u U

Διαβάστε περισσότερα

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

From the finite to the transfinite: Λµ-terms and streams From the finite to the transfinite: Λµ-terms and streams WIR 2014 Fanny He f.he@bath.ac.uk Alexis Saurin alexis.saurin@pps.univ-paris-diderot.fr 12 July 2014 The Λµ-calculus Syntax of Λµ t ::= x λx.t (t)u

Διαβάστε περισσότερα

Inverse trigonometric functions & General Solution of Trigonometric Equations. ------------------ ----------------------------- -----------------

Inverse trigonometric functions & General Solution of Trigonometric Equations. ------------------ ----------------------------- ----------------- Inverse trigonometric functions & General Solution of Trigonometric Equations. 1. Sin ( ) = a) b) c) d) Ans b. Solution : Method 1. Ans a: 17 > 1 a) is rejected. w.k.t Sin ( sin ) = d is rejected. If sin

Διαβάστε περισσότερα

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

ANSWERSHEET (TOPIC = DIFFERENTIAL CALCULUS) COLLECTION #2. h 0 h h 0 h h 0 ( ) g k = g 0 + g 1 + g g 2009 =? Teko Classes IITJEE/AIEEE Maths by SUHAAG SIR, Bhopal, Ph (0755) 3 00 000 www.tekoclasses.com ANSWERSHEET (TOPIC DIFFERENTIAL CALCULUS) COLLECTION # Question Type A.Single Correct Type Q. (A) Sol least

Διαβάστε περισσότερα

Abstract Storage Devices

Abstract Storage Devices Abstract Storage Devices Robert König Ueli Maurer Stefano Tessaro SOFSEM 2009 January 27, 2009 Outline 1. Motivation: Storage Devices 2. Abstract Storage Devices (ASD s) 3. Reducibility 4. Factoring ASD

Διαβάστε περισσότερα

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)

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) Uppsala Universitet Matematiska Institutionen Andreas Strömbergsson Prov i matematik Funktionalanalys Kurs: F3B, F4Sy, NVP 2005-03-08 Skrivtid: 9 14 Tillåtna hjälpmedel: Manuella skrivdon, Kreyszigs bok

Διαβάστε περισσότερα

Second Order Partial Differential Equations

Second Order Partial Differential Equations Chapter 7 Second Order Partial Differential Equations 7.1 Introduction A second order linear PDE in two independent variables (x, y Ω can be written as A(x, y u x + B(x, y u xy + C(x, y u u u + D(x, y

Διαβάστε περισσότερα

Finite Field Problems: Solutions

Finite Field Problems: Solutions Finite Field Problems: Solutions 1. Let f = x 2 +1 Z 11 [x] and let F = Z 11 [x]/(f), a field. Let Solution: F =11 2 = 121, so F = 121 1 = 120. The possible orders are the divisors of 120. Solution: The

Διαβάστε περισσότερα

Strain gauge and rosettes

Strain gauge and rosettes Strain gauge and rosettes Introduction A strain gauge is a device which is used to measure strain (deformation) on an object subjected to forces. Strain can be measured using various types of devices classified

Διαβάστε περισσότερα

SOME PROPERTIES OF FUZZY REAL NUMBERS

SOME PROPERTIES OF FUZZY REAL NUMBERS Sahand Communications in Mathematical Analysis (SCMA) Vol. 3 No. 1 (2016), 21-27 http://scma.maragheh.ac.ir SOME PROPERTIES OF FUZZY REAL NUMBERS BAYAZ DARABY 1 AND JAVAD JAFARI 2 Abstract. In the mathematical

Διαβάστε περισσότερα

Homework 8 Model Solution Section

Homework 8 Model Solution Section MATH 004 Homework Solution Homework 8 Model Solution Section 14.5 14.6. 14.5. Use the Chain Rule to find dz where z cosx + 4y), x 5t 4, y 1 t. dz dx + dy y sinx + 4y)0t + 4) sinx + 4y) 1t ) 0t + 4t ) sinx

Διαβάστε περισσότερα

CRASH COURSE IN PRECALCULUS

CRASH COURSE IN PRECALCULUS CRASH COURSE IN PRECALCULUS Shiah-Sen Wang The graphs are prepared by Chien-Lun Lai Based on : Precalculus: Mathematics for Calculus by J. Stuwart, L. Redin & S. Watson, 6th edition, 01, Brooks/Cole Chapter

Διαβάστε περισσότερα

MINIMAL CLOSED SETS AND MAXIMAL CLOSED SETS

MINIMAL CLOSED SETS AND MAXIMAL CLOSED SETS MINIMAL CLOSED SETS AND MAXIMAL CLOSED SETS FUMIE NAKAOKA AND NOBUYUKI ODA Received 20 December 2005; Revised 28 May 2006; Accepted 6 August 2006 Some properties of minimal closed sets and maximal closed

Διαβάστε περισσότερα

Bounding Nonsplitting Enumeration Degrees

Bounding Nonsplitting Enumeration Degrees Bounding Nonsplitting Enumeration Degrees Thomas F. Kent Andrea Sorbi Università degli Studi di Siena Italia July 18, 2007 Goal: Introduce a form of Σ 0 2-permitting for the enumeration degrees. Till now,

Διαβάστε περισσότερα

Solutions to Exercise Sheet 5

Solutions to Exercise Sheet 5 Solutions to Eercise Sheet 5 jacques@ucsd.edu. Let X and Y be random variables with joint pdf f(, y) = 3y( + y) where and y. Determine each of the following probabilities. Solutions. a. P (X ). b. P (X

Διαβάστε περισσότερα

Congruence Classes of Invertible Matrices of Order 3 over F 2

Congruence Classes of Invertible Matrices of Order 3 over F 2 International Journal of Algebra, Vol. 8, 24, no. 5, 239-246 HIKARI Ltd, www.m-hikari.com http://dx.doi.org/.2988/ija.24.422 Congruence Classes of Invertible Matrices of Order 3 over F 2 Ligong An and

Διαβάστε περισσότερα

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

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8  questions or comments to Dan Fetter 1 Eon : Fall 8 Suggested Solutions to Problem Set 8 Email questions or omments to Dan Fetter Problem. Let X be a salar with density f(x, θ) (θx + θ) [ x ] with θ. (a) Find the most powerful level α test

Διαβάστε περισσότερα

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

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016 Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Dynamic types, Lambda calculus machines Apr 21 22, 2016 1 Dynamic types and contracts (a) To make sure you understand the

Διαβάστε περισσότερα

Quadratic Expressions

Quadratic Expressions Quadratic Expressions. The standard form of a quadratic equation is ax + bx + c = 0 where a, b, c R and a 0. The roots of ax + bx + c = 0 are b ± b a 4ac. 3. For the equation ax +bx+c = 0, sum of the roots

Διαβάστε περισσότερα

Lecture 34 Bootstrap confidence intervals

Lecture 34 Bootstrap confidence intervals Lecture 34 Bootstrap confidence intervals Confidence Intervals θ: an unknown parameter of interest We want to find limits θ and θ such that Gt = P nˆθ θ t If G 1 1 α is known, then P θ θ = P θ θ = 1 α

Διαβάστε περισσότερα

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS EXERCISE 01 Page 545 1. Use matrices to solve: 3x + 4y x + 5y + 7 3x + 4y x + 5y 7 Hence, 3 4 x 0 5 y 7 The inverse of 3 4 5 is: 1 5 4 1 5 4 15 8 3

Διαβάστε περισσότερα

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

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics Fourier Series MATH 211, Calculus II J. Robert Buchanan Department of Mathematics Spring 2018 Introduction Not all functions can be represented by Taylor series. f (k) (c) A Taylor series f (x) = (x c)

Διαβάστε περισσότερα

A Conception of Inductive Logic: Example

A Conception of Inductive Logic: Example A Conception of Inductive Logic: Example Patrick Maher Department of Philosophy, University of Illinois at Urbana-Champaign This paper presents a simple example of inductive logic done according to the

Διαβάστε περισσότερα

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions SCHOOL OF MATHEMATICAL SCIENCES GLMA Linear Mathematics 00- Examination Solutions. (a) i. ( + 5i)( i) = (6 + 5) + (5 )i = + i. Real part is, imaginary part is. (b) ii. + 5i i ( + 5i)( + i) = ( i)( + i)

Διαβάστε περισσότερα

Section 9.2 Polar Equations and Graphs

Section 9.2 Polar Equations and Graphs 180 Section 9. Polar Equations and Graphs In this section, we will be graphing polar equations on a polar grid. In the first few examples, we will write the polar equation in rectangular form to help identify

Διαβάστε περισσότερα

Math221: HW# 1 solutions

Math221: HW# 1 solutions Math: HW# solutions Andy Royston October, 5 7.5.7, 3 rd Ed. We have a n = b n = a = fxdx = xdx =, x cos nxdx = x sin nx n sin nxdx n = cos nx n = n n, x sin nxdx = x cos nx n + cos nxdx n cos n = + sin

Διαβάστε περισσότερα

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013 Notes on Average Scattering imes and Hall Factors Jesse Maassen and Mar Lundstrom Purdue University November 5, 13 I. Introduction 1 II. Solution of the BE 1 III. Exercises: Woring out average scattering

Διαβάστε περισσότερα

DIRECT PRODUCT AND WREATH PRODUCT OF TRANSFORMATION SEMIGROUPS

DIRECT PRODUCT AND WREATH PRODUCT OF TRANSFORMATION SEMIGROUPS GANIT J. Bangladesh Math. oc. IN 606-694) 0) -7 DIRECT PRODUCT AND WREATH PRODUCT OF TRANFORMATION EMIGROUP ubrata Majumdar, * Kalyan Kumar Dey and Mohd. Altab Hossain Department of Mathematics University

Διαβάστε περισσότερα

New bounds for spherical two-distance sets and equiangular lines

New bounds for spherical two-distance sets and equiangular lines New bounds for spherical two-distance sets and equiangular lines Michigan State University Oct 8-31, 016 Anhui University Definition If X = {x 1, x,, x N } S n 1 (unit sphere in R n ) and x i, x j = a

Διαβάστε περισσότερα

Lecture 13 - Root Space Decomposition II

Lecture 13 - Root Space Decomposition II Lecture 13 - Root Space Decomposition II October 18, 2012 1 Review First let us recall the situation. Let g be a simple algebra, with maximal toral subalgebra h (which we are calling a CSA, or Cartan Subalgebra).

Διαβάστε περισσότερα

Finitary proof systems for Kozen s µ

Finitary proof systems for Kozen s µ Finitary proof systems for Kozen s µ Bahareh Afshari Graham Leigh TU Wien University of Gothenburg homc & cdps 16, Singapore 1 / 17 Modal µ-calculus Syntax: p p φ ψ φ ψ φ φ x µx φ νx φ Semantics: For Kripke

Διαβάστε περισσότερα

Srednicki Chapter 55

Srednicki Chapter 55 Srednicki Chapter 55 QFT Problems & Solutions A. George August 3, 03 Srednicki 55.. Use equations 55.3-55.0 and A i, A j ] = Π i, Π j ] = 0 (at equal times) to verify equations 55.-55.3. This is our third

Διαβάστε περισσότερα

Generating Set of the Complete Semigroups of Binary Relations

Generating Set of the Complete Semigroups of Binary Relations Applied Mathematics 06 7 98-07 Published Online January 06 in SciRes http://wwwscirporg/journal/am http://dxdoiorg/036/am067009 Generating Set of the Complete Semigroups of Binary Relations Yasha iasamidze

Διαβάστε περισσότερα

PARTIAL NOTES for 6.1 Trigonometric Identities

PARTIAL NOTES for 6.1 Trigonometric Identities PARTIAL NOTES for 6.1 Trigonometric Identities tanθ = sinθ cosθ cotθ = cosθ sinθ BASIC IDENTITIES cscθ = 1 sinθ secθ = 1 cosθ cotθ = 1 tanθ PYTHAGOREAN IDENTITIES sin θ + cos θ =1 tan θ +1= sec θ 1 + cot

Διαβάστε περισσότερα

Coefficient Inequalities for a New Subclass of K-uniformly Convex Functions

Coefficient Inequalities for a New Subclass of K-uniformly Convex Functions International Journal of Computational Science and Mathematics. ISSN 0974-89 Volume, Number (00), pp. 67--75 International Research Publication House http://www.irphouse.com Coefficient Inequalities for

Διαβάστε περισσότερα

Instruction Execution Times

Instruction Execution Times 1 C Execution Times InThisAppendix... Introduction DL330 Execution Times DL330P Execution Times DL340 Execution Times C-2 Execution Times Introduction Data Registers This appendix contains several tables

Διαβάστε περισσότερα

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

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007 Οδηγίες: Να απαντηθούν όλες οι ερωτήσεις. Αν κάπου κάνετε κάποιες υποθέσεις να αναφερθούν στη σχετική ερώτηση. Όλα τα αρχεία που αναφέρονται στα προβλήματα βρίσκονται στον ίδιο φάκελο με το εκτελέσιμο

Διαβάστε περισσότερα

Homomorphism of Intuitionistic Fuzzy Groups

Homomorphism of Intuitionistic Fuzzy Groups International Mathematical Forum, Vol. 6, 20, no. 64, 369-378 Homomorphism o Intuitionistic Fuzz Groups P. K. Sharma Department o Mathematics, D..V. College Jalandhar Cit, Punjab, India pksharma@davjalandhar.com

Διαβάστε περισσότερα

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

Approximation of distance between locations on earth given by latitude and longitude Approximation of distance between locations on earth given by latitude and longitude Jan Behrens 2012-12-31 In this paper we shall provide a method to approximate distances between two points on earth

Διαβάστε περισσότερα

LTL to Buchi. Overview. Buchi Model Checking LTL Translating LTL into Buchi. Ralf Huuck. Buchi Automata. Example

LTL to Buchi. Overview. Buchi Model Checking LTL Translating LTL into Buchi. Ralf Huuck. Buchi Automata. Example Overview LTL to Buchi Buchi Model Checking LTL Translating LTL into Buchi Ralf Huuck Buchi Automata Example Automaton which accepts infinite traces δ A Buchi automaton is 5-tuple Σ, Q, Q 0,δ, F Σ is a

Διαβάστε περισσότερα

Αλγόριθμοι και πολυπλοκότητα NP-Completeness (2)

Αλγόριθμοι και πολυπλοκότητα NP-Completeness (2) ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ Αλγόριθμοι και πολυπλοκότητα NP-Completeness (2) Ιωάννης Τόλλης Τμήμα Επιστήμης Υπολογιστών NP-Completeness (2) x 1 x 1 x 2 x 2 x 3 x 3 x 4 x 4 12 22 32 11 13 21

Διαβάστε περισσότερα

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

Chapter 6: Systems of Linear Differential. be continuous functions on the interval Chapter 6: Systems of Linear Differential Equations Let a (t), a 2 (t),..., a nn (t), b (t), b 2 (t),..., b n (t) be continuous functions on the interval I. The system of n first-order differential equations

Διαβάστε περισσότερα

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

Foundations of Computer Science ENGR 3520 Fall 2013 Thursday, Nov 21, 2013 Foundations of Computer Science Lecture Notes ENGR 3520 Fall 2013 Thursday, Nov 21, 2013 λ-calculus λ-terms. A λ-term is either: A variable x, y, z,... λx.m M N (M) (where x is a variable and M a λ-term)

Διαβάστε περισσότερα

( ) 2 and compare to M.

( ) 2 and compare to M. Problems and Solutions for Section 4.2 4.9 through 4.33) 4.9 Calculate the square root of the matrix 3!0 M!0 8 Hint: Let M / 2 a!b ; calculate M / 2!b c ) 2 and compare to M. Solution: Given: 3!0 M!0 8

Διαβάστε περισσότερα

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

Exercises 10. Find a fundamental matrix of the given system of equations. Also find the fundamental matrix Φ(t) satisfying Φ(0) = I. 1. Exercises 0 More exercises are available in Elementary Differential Equations. If you have a problem to solve any of them, feel free to come to office hour. Problem Find a fundamental matrix of the given

Διαβάστε περισσότερα

Some new generalized topologies via hereditary classes. Key Words:hereditary generalized topological space, A κ(h,µ)-sets, κµ -topology.

Some new generalized topologies via hereditary classes. Key Words:hereditary generalized topological space, A κ(h,µ)-sets, κµ -topology. Bol. Soc. Paran. Mat. (3s.) v. 30 2 (2012): 71 77. c SPM ISSN-2175-1188 on line ISSN-00378712 in press SPM: www.spm.uem.br/bspm doi:10.5269/bspm.v30i2.13793 Some new generalized topologies via hereditary

Διαβάστε περισσότερα

The challenges of non-stable predicates

The challenges of non-stable predicates The challenges of non-stable predicates Consider a non-stable predicate Φ encoding, say, a safety property. We want to determine whether Φ holds for our program. The challenges of non-stable predicates

Διαβάστε περισσότερα

Lecture 21: Properties and robustness of LSE

Lecture 21: Properties and robustness of LSE Lecture 21: Properties and robustness of LSE BLUE: Robustness of LSE against normality We now study properties of l τ β and σ 2 under assumption A2, i.e., without the normality assumption on ε. From Theorem

Διαβάστε περισσότερα

Areas and Lengths in Polar Coordinates

Areas and Lengths in Polar Coordinates Kiryl Tsishchanka Areas and Lengths in Polar Coordinates In this section we develop the formula for the area of a region whose boundary is given by a polar equation. We need to use the formula for the

Διαβάστε περισσότερα

Finite difference method for 2-D heat equation

Finite difference method for 2-D heat equation Finite difference method for 2-D heat equation Praveen. C praveen@math.tifrbng.res.in Tata Institute of Fundamental Research Center for Applicable Mathematics Bangalore 560065 http://math.tifrbng.res.in/~praveen

Διαβάστε περισσότερα