Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types
|
|
- Αγαθάγγελος Αποστολίδης
- 8 χρόνια πριν
- Προβολές:
Transcript
1 Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types Amal Ahmed Harvard University March 2006 Abstract We present a proof technique, based on syntactic logical relations, for showing contextual equivalence of expressions in a λ-calculus with recursive types and impredicative universal and existential types. We show that for recursive and polymorphic types, the method is both sound and complete with respect to contextual equivalence, while for existential types, it is sound but incomplete. Our development builds on the step-indexed PER model of recursive types presented by Appel and McAllester. We have discovered that a direct proof of transitivity of that model does not go through, leaving the PER status of the model in question. We show how to extend the Appel-McAllester model to obtain a logical relation that we can prove is transitive, as well as sound and complete with respect to contextual equivalence. We then augment this model to support relational reasoning in the presence of quantified types. Step-indexed relations are indexed not just by types, but also by the number of steps available for future evaluation. This stratification is essential for handling various circularities, from recursive functions, to recursive types, to impredicative polymorphism. The resulting construction is more elementary than existing logical relations which require complex machinery such as domain theory, admissibility, syntactic minimal invariance, and -closure. Contents 1 Introduction 3 2 Recursive Types λ rec : Contextual Equivalence λ rec : Logical Relation Transitivity and the Appel-McAllester Model λ rec : Soundness λ rec : Completeness Type Abstraction λ : Contextual Equivalence λ : Logical Relation and Soundness Example: Simple Existential Packages λ : Completeness Related Work and Conclusion 14 1
2 A Appel-McAllester Indexed PER Model (Equi-Recursive Types) 17 A.1 Appel-McAllester: of Transitivity Fails B Iso-Recursive Types 21 B.1 λ rec Unary Model B.2 λ rec Relational (PER) Model B.3 λ rec Contexts and Contextual Equivalence B.4 λ rec Evaluation Contexts and Ciu Equivalence B.5 λ rec s: Type Soundness and Substitution B.6 λ rec s: Validity of Pers B.7 λ rec s: Per Type Substitution B.8 λ rec s: Fundamental Property of the Logical Relation B.9 λ rec s: Reflexivity B.10 λ rec s: Transitivity B.11 λ rec s: Soundness w.r.t. Contextual Equivalence B.12 λ rec s: Completeness w.r.t. Contextual Equivalence C Quantified Types 75 C.1 λ Unary Model C.2 λ Relational (PER) Model C.3 λ Contexts and Contextual Equivalence C.4 λ Evaluation Contexts and Ciu Equivalence C.5 λ s: Type Soundness and Substitution C.6 λ s: Validity of Pers C.7 λ s: Per Type Substitution C.8 λ s: Fundamental Property of the Logical Relation C.9 λ s: Reflexivity C.10 λ s: Soundness w.r.t. Contextual Equivalence D Examples 131 D.1 Simple Existential Packages D.2 Functions Generating Packages D.3 Higher-Order Functions I D.4 Recursive Types D.5 Higher-Order Functions II E Completeness and Quantified Types 148 E.1 λ Relational (PER) Model E.2 λ s: Validity of Pers E.3 λ s: Completeness w.r.t. Contextual Equivalence E.4 λ Example
3 1 Introduction Proving equivalence of programs is important for verifying the correctness of compiler optimizations and other program transformations, as well as for establishing that program behavior is independent of the representation of an abstract type. This representation independence principle guarantees that if one implementation of an abstraction is exchanged for another, client modules will not be able to detect a difference. Program equivalence is generally defined in terms of contextual equivalence. We say that two programs are contextually equivalent if they have the same observable behavior when placed in any program context C. Unfortunately, proving contextual equivalence is difficult in general, since it involves quantification over all possible contexts. As a result, there s been much work on finding tractable techniques for proving contextual equivalence. Many of these are based on the method of logical relations. Logical relations specify relations on well-typed terms via structural induction on the syntax of types. Thus, for instance, logically related functions take logically related arguments to related results, while logically related pairs consist of components that are related pairwise. Logical relations may be based on denotational models (e.g. [1, 2, 3]) or on the operational semantics of a language [4, 5, 6, 7]. The latter are also known as syntactic logical relations [8] and it is this flavor that is the focus of this paper. To prove the soundness of a logical relation, one must prove the Fundamental Property (also called the Basic Lemma) which says that any well-typed term is related to itself. For simple type systems, it is fairly straightforward to prove the Fundamental Property in the absence of nontermination. The addition of recursive functions, however, complicates matters: establishing the Fundamental Property now requires proving additional unwinding lemmas [9, 6, 7, 10] which show that in any terminating computation a recursively defined function is approximated by its finite unrollings. More challenging still is the addition of recursive types and impredicative quantified types 1 since the logical relation can no longer be defined by induction on types. Thus, showing the existence of a relational interpretation of recursive types requires proving a nontrivial minimal invariance property [3, 10, 8, 11, 12]. Appel and McAllester [13] proposed a radically different solution to the problem of recursive types. They defined intensional types, based on the operational semantics of the language, that are indexed by the number of available (future) execution steps. This extra information is sufficient to solve recursive equations on types. Appel and McAllester also presented a PER (relational) model of recursive types, which we build on in this paper. The advantage of step-indexed logical relations is that they avoid complex machinery like domain theory, admissibility, and syntactic minimal invariance. The approach is promising since unary step-indexed models have scaled well to advanced features like impredicative quantified types and general references (i.e., mutable references that can store functions, recursive types, other references, and even impredicative quantified types) [14, 15]. Appel and McAllester proved the Fundamental Property for their PER model of equi-recursive types, and conjectured that their model was sound with respect to contextual equivalence. We show that their claim is correct to be precise, we show soundness for a calculus with iso-recursive types, but the essence of the model is the same. We discovered, however, that the expected proof of transitivity for the Appel-McAllester model does not go through. To definitively show that their model is not transitive we tried to find a counterexample, but could not. Thus, we note that the transitivity of the Appel-McAllester model remains an open problem. In Section 2 we consider a λ-calculus with iso-recursive types and present a sound and complete logical relation for the language. We also show how a direct proof of transitivity of the Appel-McAllester model fails, and discuss some of the peculiarities of the step-indexed approach. In Section 3 we extend the logical relation to support quantified types. Specifically, we present a logical relation for a language with recursive and polymorphic types that is both sound and complete with respect to contextual equivalence, while for a language that also has existential types, we show a logical relation that is sound but incomplete. s of all lemmas in the paper and several examples to illustrate the use of our logical relation are given in the appendix. 1 A quantified type such as α. τ is impredicative if α may be instantiated with any type, including α. τ itself. 3
4 Types τ ::= bool τ 1 τ 2 τ 1 τ 2 α µα. τ Expressions e ::= x tt ff if e 0, e 1, e 2 e 1, e 2 let x 1, x 2 = e 1 in e 2 λx. e e 1 e 2 fold e unfold e Values v ::= tt ff v 1, v 2 λx. e fold v Eval Ctxts E ::= [ ] if E, e 1, e 2 let x 1, x 2 = E in e E e v E fold E unfold E (iftrue) if tt, e 1, e 2 e 1 (iffalse) if ff, e 1, e 2 e 2 (letpair) let x 1, x 2 = v 1, v 2 in e e[v 1 /x 1 ][v 2 /x 2 ] (app) (λx. e) v e[v/x] (unfold) unfold (fold v) v (ctxt) e e E[e] E[e ] Figure 1: λ rec Syntax and Operational Semantics Γ e : τ (Var) Γ x : Γ(x) (Fn) Γ, x:τ 1 e : τ 2 Γ λx. e : τ 1 τ 2 (App) Γ e 1 : τ 1 τ 2 Γ e 2 : τ 1 Γ e 1 e 2 : τ 2 (Fold) Γ e : τ[µα. τ/α] Γ fold e : µα. τ (Unfold) Γ e : µα. τ Γ unfold e : τ[µα. τ/α] 2 Recursive Types Figure 2: λ rec Static Semantics (Selected Rules) We consider a call-by-value λ-calculus with iso-recursive types (dubbed the λ rec -calculus). Figure 1 presents the syntax and small-step operational semantics for the language, which supports booleans and pairs in addition to recursive types. We define the operational semantics for λ rec as a relation between closed terms e. We use evaluation contexts to lift the primitive rewriting rules to a standard, left-to-right, innermost-tooutermost, call-by-value interpretation of the language. We say that a term e is irreducible (irred(e)) if e is a value (val(e)) or if e is a stuck expression to which no operational rule applies. We also use e as an abbreviation for e. e e val(e ). Typing judgments in λ rec have the form Γ e : τ where the context Γ is defined as follows: Value Context Γ ::= Γ, x:τ. Thus, Γ is used to track the set of variables in scope, along with their (closed) types. There may be at most one occurrence of a variable x in Γ. The λ rec static semantics is entirely conventional (see, e.g., [17]) so we only show selected rules in Figure 2. We use the abbreviated judgment e : τ when the value context is empty. Theorem 2.1 (λ rec Safety) If e : τ and e e, then either e is a value, or there exists an e such that e e. 2.1 λ rec : Contextual Equivalence A context C is an expression with a single hole [ ] in it. Typing judgments for contexts have the form Γ 1 C : (Γ τ) τ 1, where (Γ τ) indicates the type of the hole that is, if Γ e : τ, then Γ 1 C[e] : τ 1. 4
5 Definition 2.2 (λ rec Contextual Approximation ctx & Equivalence ctx ) If Γ e : τ and Γ e : τ, we write Γ e ctx e : τ to mean C, τ 1. C : (Γ τ) τ 1 C[e] = C[e ]. Two terms are contextually equivalent if they contextually approximate one another: Γ e ctx e : τ def = Γ e ctx e : τ Γ e ctx e : τ. 2.2 λ rec : Logical Relation Our step-indexed logical relation for λ rec is based on the PER model for equi-recursive types presented by Appel and McAllester [13] (henceforth AM). The latter claimed, but did not prove, that their PER model was sound with respect to contextual equivalence. We have proved that this is indeed the case. However, PER may be somewhat of misnomer for the AM model since the status of transitivity is unclear, as we shall show. Rel τ χ k def = {χ 2 Nat CValues CValues (j, v, v ) χ. v : τ i j. (i, v, v ) χ} def = {(j, v, v ) j < k (j, v, v ) χ} RV α ρ = ρ sem (α) RV bool ρ = {(k, v, v ) v : bool (v = v = tt v = v = ff)} RV τ 1 τ 2 ρ = {(k, v 1, v 2, v 1, v 2 ) v 1, v 2 : (τ 1 τ 2) [ρ] (k, v 1, v 1) RV τ 1 ρ (k, v 2, v 2) RV τ 2 ρ} RV τ 1 τ 2 ρ = {(k, λx. e, λx. e ) λx. e : (τ 1 τ 2) [ρ] j < k, v, v. (j, v, v ) RV τ 1 ρ = (j, e[v/x], e [v /x]) RC τ 2 ρ} RV µα. τ ρ = {(k, fold v, fold v ) fold v : (µα. τ) [ρ] j < k. let χ = RV µα. τ ρ j+1 in (j, v, v ) RV τ ρ[α (χ, (µα. τ) [ρ] )]} RC τ ρ = {(k, e, e ) j < k, e f. e j e f irred(e f ) = e f. e e f (k j, e f, e f ) RV τ ρ} RG = {(k,, )} RG Γ, x:τ = {(k, γ[x v], γ [x v ]) (k, γ, γ ) RG Γ (k, v, v ) RV τ } Γ e e : τ Γ e e : τ def = Γ e : τ Γ e : τ k 0. γ, γ. (k, γ, γ ) RG Γ = (k, γ(e), γ (e )) RC τ def = Γ e e : τ Γ e e : τ Figure 3: λ rec Relational Model (Shaded Appel-McAllester) In both models, the relational interpretation RV τ of a type τ is a set of triples of the form (k, v, v ) where k is a natural number (called the approximation index or step index), and v and v are (closed) values. Intuitively, (k, v, v ) RV τ says that in any computation running for no more than k steps, v approximates v at the type τ. Our model differs from the AM model in that whenever (k, v, v ) RV τ, we additionally 5
6 require that v : τ. This additional constraint enables us to prove the transitivity of our logical relation. Moreover, restricting the model to terms that are well-typed seems essential for completeness with respect to contextual equivalence, as others have also noted [12]. We defer an explanation of why we don t also require v : τ till Section 2.3. Figure 3 gives the definition of our logical relation; shaded parts of the definitions have no analog in the AM model. We use the meta-variable χ to denote sets of tuples of the form (k, v, v ), where v and v are closed values (v, v CValues). For any set χ, we define the k-approximation of the set (written χ k ) as the subset of its elements whose indices are less than k. We define Rel τ (where τ is a closed syntactic type) as the set of those sets χ 2 Nat CValues CValues that have the following two properties: if (k, v, v ) χ, then v must be well-typed with type τ, and χ must be closed with respect to a decreasing step-index. We use the meta-variable ρ to denote type substitutions. These are partial maps from type variables α to pairs (χ, τ) where χ is the semantic substitution for α and τ (a closed syntactic type) is the syntactic substitution for α. We note that our definitions ensure that if ρ(α) = (χ, τ) then χ Rel τ. Since types in λ rec may contain free type variables, the interpretation of a type τ is parametrized by a type substitution ρ such that FTV (τ) dom(ρ). We use the following abbreviations: Let ρ(α) = (χ, τ). Then ρ sem (α) = χ and ρ syn (α) = τ. Let ρ = {α 1 (χ 1, τ 1 ),..., α n (χ n, τ n )}. Then τ [ρ] is an abbreviation for τ[τ 1 /α 1, τ 2 /α 2,..., τ n /α n ]. Next, we consider the relational interpretation RV τ ρ of each type τ. (k, v, v ) RV τ ρ then v : (τ) [ρ]. In each case, note that if Booleans. both ff. Two values are related at the type bool for any number of steps k 0, if they are both tt or Pairs. The pairs v 1, v 2 and v 1, v 2 are related at type τ 1 τ 1 for k steps if v i and v i steps at the type τ i (for i {1, 2}). are related for k Functions. Since functions are suspended computations, their interpretation is given in terms of the interpretation of types as computations (see below). Two functions are related if they map related arguments to related results. Specifically, λx. e and λx. e are related at the type τ 1 τ 2 for k steps if, at some point in the future, when there are j < k steps left to execute, and there are arguments v a and v a that are related at the type τ 1 for j steps, then e[v a /x] and e [v a/x] are related as computations of type τ 2 for j steps. Recursive Types. One would expect the values fold v and fold v to be related at the type µα. τ for k steps if v and v are related at the type τ[µα. τ/α] for j < k steps. We show that the latter is equivalent to what is required by the definition in Figure 3. Note that by the definition of k (j, v, v ) RV τ[µα. τ/α]] ρ (j, v, v ) RV τ[µα. τ/α] ρ j+1. We prove a type substitution lemma (see Appendix B.7) that allows us to conclude that if χ = RV µα. τ ρ j+1 then: RV τ[µα. τ/α] ρ j+1 = RV τ ρ[α (χ, (µα. τ) [ρ] )] j+1. Hence, (j, v, v ) RV τ[µα. τ/α] ρ (j, v, v ) RV τ[µα. τ/α] ρ j+1 (j, v, v ) RV τ ρ[α (χ, (µα. τ) [ρ] )] j+1 (j, v, v ) RV τ ρ[α (χ, (µα. τ) [ρ] )] which is exactly what is required by the definition of RV µα. τ ρ. by k by type subst by k 6
7 Computations. Two closed expressions e and e are related as computations of type τ for k steps as follows. If e steps to an irreducible term e f in j < k steps, then e must also step to some irreducible e f. Furthermore, both e f and e f must be values that are related for the remaining k j steps. What is surprising about this definition is that e must terminate in j < k steps, while e may terminate in any number of steps, say i. Hence, i may be greater than k. This has ramifications for transitivity in the AM model and we shall return to this point shortly. Logical Relation. If Γ e : τ and Γ e : τ, then we write Γ e e : τ to mean that for all k 0, if γ and γ are mappings from variables x to closed values that are related for k steps at Γ, then γ(e) and γ (e ) are related for k steps as computations of type τ. We say e and e are logically equivalent, written Γ e e : τ, if they logically approximate one another. We now have to prove that each type τ is a valid type that is, that the relational interpretation of τ belongs to Rel τ (i.e., RV τ ρ Rel τ [ρ]). This involves showing well-typedness and closure under decreasing step-index (see Appendix B.6). Next, we prove a number of nontrivial lemmas (see Appendix B.7 and B.8). Specifically, we prove that the logical relation defined in Figure 3 has the compatibility and substitutivity properties (see e.g., [9]). These allow us to show that the λ rec typing rules preserve the logical relation, and hence prove the following lemma. Lemma 2.3 (λ rec Fundamental Property / Reflexivity) If Γ e : τ, then Γ e e : τ. 2.3 Transitivity and the Appel-McAllester Model Let us ignore the shaded parts of Figure 3 and try to prove the following lemma with the resulting definitions. Proposed Lemma (Transitivity: Appel-McAllester) If Γ e 1 e 2 : τ and Γ e 2 e 3 : τ, then Γ e 1 e 3 : τ. Attempt: Suppose k 0 and (k, γ, γ ) RG Γ. Show (k, γ(e 1 ), γ (e 3 )) RC τ. Suppose j < k, γ(e 1 ) j e f1, and irred(e f1 ). Show e f3.γ (e 3 ) e f3 (k j, e f1, e f3 ) RV τ. Instantiate Γ e 1 e 2 : τ with k 0 and (k, γ, γ ) RG Γ. Hence, (k, γ(e 1 ), γ (e 2 )) RC τ. Instantiate this with j < k, γ(e 1 ) j e f1, and irred(e f1 ). Hence, e f2, i such that i 0, γ (e 2 ) i e f2, and (k j, e f1, e f2 ) RV τ. Now we need to use the premise Γ e 2 e 3 : τ. But what should we instantiate this with? We consider two ways we could proceed. (i) Instantiate Γ e 2 e 3 : τ with k, γ, γ. Note that k 0 and (k, γ, γ ) RG Γ. Hence, (k, γ(e 2 ), γ (e 3 )) RC τ. Problem: We could instantiate this with i and e f2, but at that point we are stuck since we cannot show i < k (since i may be greater than k), and we cannot show γ(e 2 ) i e f2 (we only have γ (e 2 ) i e f2 ). (ii) Instantiate Γ e 2 e 3 :τ with i + 1, γ, γ. Problem: We cannot show (i + 1, γ, γ ) RG Γ. All we know is that (k, γ, γ ) Γ, where i may be greater than k. We note that if we restrict our attention to closed terms e 1, e 2, e 3, then the above lemma can be proved. In the case of open terms, however, the status of transitivity of the AM model is unclear as we have been unable to find a counterexample. There are several things one could attempt in order to rectify the above problem with the AM model (unshaded parts of Figure 3). One problem we encountered was that i may be greater than k. To get around 7
8 this, we could change the definition of (k, e, e ) RC τ to require that e must terminate in less than k steps. Unfortunately, if we step back and examine the resulting meaning of Γ e 1 e 2 : τ, we see that the latter now requires that both e 1 and e 2 must terminate in exactly the same number of steps. Clearly such a logical relation would not be very useful (unless we are concerned with reasoning about timing leaks in an information-flow setting). Other formulations involving the use of not one, but two step-indices (where the second bounds the number of steps in which e must terminate) also lead to models where both terms are required to terminate in exactly the same number of steps. Since we want a logical relation that considers programs equivalent modulo the number of steps they take, we will not change the definition of RC τ. Instead we fix the problem with transitivity by moving to a typed setting where (k, v, v ) RV τ implies v : τ. Assuming the definitions in Figure 3, including the shaded parts, let us again try to prove transitivity. Lemma 2.4 (λ rec : Transitivity) (Our model: Figure 3, including shaded parts) If Γ e 1 e 2 : τ and Γ e 2 e 3 : τ, then Γ e 1 e 3 : τ. We start at the point where we got stuck before. Now from (k, γ, γ ) RG Γ we can conclude that γ : Γ. By reflexivity (Fundamental Property, Lemma 2.3) it follows that γ γ : Γ. Hence, we can show that for all z 0, (z, γ, γ ) RG Γ holds. Now we may instantiate Γ e 2 e 3 : τ above with i + 1 since we know that (i + 1, γ, γ ) RG Γ. The rest of the proof is relatively straightforward and is given in Appendix B.10. Seemingly Asymmetric Well-Typedness Requirement. The definitions in Figure 3 may have left the reader with the impression that we only require terms on one side of our logical relation to be well-typed. This, however, is not the case. In particular, notice that in the definition of Γ e e : τ, we require that both e and e be well-typed. However, once we have picked a step-index k (i.e., once we have moved under the k quantifier), there is an asymmetry in the model in that when (k, e, e ) RC τ, k pertains (as a bound) only to e and not to e. As a result of this asymmetry, when working with a specific k (in the definition of RV τ ) we do not need to know that v has type τ in the limit, while the converse is true of v. Hence, at the value interpretation level RV τ, we chose only to require v : τ. One could add the requirement v : τ in the interest of symmetry, but it would simply lead to additional proof obligations being shuffled around. It would also complicate definitions when we get to quantified types as Rel τ would have to be replaced by Rel τ1,τ 2 (since in the presence of quantified types we wish to relate values of different types). 2.4 λ rec : Soundness To prove that our logical relation is sound with respect to contextual equivalence, we first define what it means for two contexts to be logically related. Definition 2.5 (λ rec Logical Relation: Contexts) Γ 1 C C : (Γ τ) τ 1 def = e, e. Γ e e : τ = Γ 1 C[e] C [e ] : τ 1 Next, we prove the compatibility lemmas for contexts, which allows us to prove the following. Lemma 2.6 (λ rec Reflexivity: Contexts) If Γ 1 C : (Γ τ) τ 1, then Γ 1 C C : (Γ τ) τ 1. Theorem 2.7 (λ rec Soundness: ctx ) If Γ e e : τ then Γ e ctx e : τ. 8
9 Suppose C : (Γ τ) τ 1 and C[e]. Hence, there exist v f, k such that C[e] k v f. We must show C[e ]. Applying Lemma 2.6 to C : (Γ τ) τ 1, we have C C : (Γ τ) τ 1. Instantiate this with Γ e e : τ. Hence, C[e] C[e ]: τ 1. Instantiate this with k and (k + 1,, ) RG. Hence, (k + 1, C[e], C[e ]) RC τ 1. Instantiate this with k < k + 1, C[e] k v f, and irred(v f ). Hence, exists v f such that C[e ] v f. Hence, C[e ]. 2.5 λ rec : Completeness To show that our logical relation is complete with respect to contextual equivalence, we make use of the notion of ciu-equivalence introduced by Mason and Talcott [18]. Two closed terms of the same closed type are said to be ciu-equivalent if they have the same termination behavior in any evaluation context E (a use of the term). The relation is extended to open terms via closing substitutions (i.e., closed i nstantiations). We note that evaluation contexts E are a simply a subset of general contexts C and that only closed terms can be placed in an evaluation context. Definition 2.8 (λ rec Ciu Approximation ciu & Equivalence ciu ) Let Γ e : τ and Γ e : τ. Γ e ciu e : τ Γ e ciu e : τ def = γ, E, τ 1. γ : Γ E : ( τ) τ 1 E[γ(e)] = E[γ(e )] def = Γ e ciu e : τ Γ e ciu e : τ Theorem 2.9 (λ rec : ctx ciu ) If Γ e ctx e : τ then Γ e ciu e : τ. To prove that two ciu-equivalent terms are logically related, we will need the following lemma which shows that our logical relation respects ciu equivalence. Pitts [9] proves a similar property which he calls equivalence-respecting. Lemma 2.10 (λ rec Equivalence-Respecting: Closed Values) If (k, v 1, v 2 ) RV τ and v 2 ciu v 3 : τ, then (k, v 1, v 3 ) RV τ. By induction on k and nested induction on the structure of the (closed) type τ. Theorem 2.11 (λ rec : ciu ) If Γ e ciu e : τ then Γ e e : τ. Suppose k 0 and (k, γ, γ ) RG Γ. Show (k, γ(e), γ (e )) RC τ. Suppose j < k, γ(e) j e f, and irred(e f ). Show e f. γ (e ) e f (k j, e f, e f ) RV τ. From Γ e ciu e : τ, we have Γ e : τ. Applying Lemma 2.3 to Γ e : τ, we have Γ e e : τ. Instantiate this with k 0 and (k, γ, γ ) RG Γ. Hence, (k, γ(e), γ (e)) RC τ. Instantiate this 9
10 with j < k, γ(e) j e f, and irred(e f ). Hence, e f such that γ (e) e f and (k j, e f, e f ) RV τ. Hence, e f v f and e f v f. Hence, γ (e) v f. Instantiate Γ e ciu e : τ with γ : Γ (follows from (k, γ, γ ) RG Γ ), and [ ] : ( τ) τ, and γ (e). Hence, v f such that γ (e ) v f. Remains to show: (k j, v f, v f ) RV τ. This follows from Lemma 2.10 applied to (k j, v f, v f ) RV τ and v f ciu v f from Γ e ciu e : τ and γ (e) v f and γ (e ) v f ). 3 Type Abstraction : τ (which follows We now extend λ rec with impredicative universal and existential types; we call the extended language the λ -calculus. (Note that in Section 3.4 we will consider the λ -calculus which is the extension of λ rec with only universal types.) The syntactic extensions to support quantified types are as follows: Types τ ::=... α. τ α. τ Values v ::=... Λ. e pack v Expressions e ::=... e [ ] unpack e 1 as x in e 2 Note that terms are not decorated with types (which was also the case for λ rec ). Here we let the vestigial operators remain in the untyped syntax in order to preserve the operational semantics. For instance, the term Λ. e is a suspended computation (normally written Λα.e); e [ ] runs the suspended computation. We extend the λ rec operational semantics as follows: Evaluation Contexts E ::=... E [ ] unpack E as x in e (inst) (Λ. e) [ ] e (unpack) unpack (pack v) as x in e e[v/x] ; Γ e : τ (All), α; Γ e : τ ; Γ Λ. e : α. τ (Inst) ; Γ e : α. τ τ 1 ; Γ e [ ] : τ[τ 1 /α] (Pack) τ 1 ; Γ e : τ[τ 1 /α] ; Γ pack e : α. τ (Unpack) ; Γ e 1 : α. τ 1 τ 2, α; Γ, x : τ 1 e 2 : τ 2 ; Γ unpack e 1 as x in e 2 : τ 2 Figure 4: λ Static Semantics λ typing judgments have the form ; Γ e : τ, where the context Γ is as before, and the context is defined as follows: Type Context ::=, α. The type context is used to track the set of type variables in scope. We modify the typing rules in Figure 2 by adding to each typing judgment. Figure 4 gives the typing rules for the additional terms in λ. We prove soundness of the λ typing rules, show that value and type substitution hold, and prove type safety. Theorem 3.1 (λ Safety) If ; e : τ and e e, then either e is a value, or there exists an e such that e e. 10
11 3.1 λ : Contextual Equivalence Typing judgments for contexts C now have the form 1 ; Γ 1 C : ( ; Γ τ) τ 1 (where ( ; Γ τ) represents the type of the hole) indicating that whenever ; Γ e : τ, then 1 ; Γ 1 C[e] : τ 1. Definition 3.2 (λ Contextual Approximation ctx ) If ; Γ e : τ and ; Γ e : τ, then we write ; Γ e ctx e : τ to mean 3.2 λ : Logical Relation and Soundness C, τ 1. ; C : ( ; Γ τ) τ 1 C[e] = C[e ]. In this section, we present a logical relation for λ and prove it sound with respect to contextual equivalence. (Note, however, that this logical relation is not complete with respect to contextual equivalence. We will discuss properties required for completeness in Section 3.4.) As in the case of λ rec, the relational interpretation of a type RV τ ρ in λ is a set of triples of the form (k, v, v ). We define Rel τ as before (see Figure 3), so that every set χ in Rel τ must be closed under decreasing step index, and the second value of each tuple in χ must be well-typed with type τ. The relational interpretation of universal and existential types is given in Figure 5. Two values pack v and pack v are related at the type α. τ for k steps if there exists a syntactic type τ 2 and a semantic interpretation χ Rel τ2 such that for all j < k, (j, v, v ) RV τ ρ[α (χ, τ 2 )]. Here we only pick a type τ 2 for the second value v while the type of v is left unrestricted. Intuitively, this suffices because when showing logical equivalence of two terms ( ; Γ e e :τ), we pick a type for v while proving ; Γ e e :τ and we pick a type for v while proving ; Γ e e:τ. The relational interpretation of universal types is the dual of existential types. RV α. τ ρ = {(k, Λ. e, Λ. e ) Λ. e : ( α. τ) [ρ] τ 2, χ. χ Rel τ2 = j < k. (j, e, e ) RC τ ρ[α (χ, τ 2)]} RV α. τ ρ = {(k, pack v, pack v ) pack v : ( α. τ) [ρ] τ 2, χ. χ Rel τ2 j < k. (j, v, v ) RV τ ρ[α (χ, τ 2)]} RD = { } RD, α = {ρ[α (χ, τ 2)]) ρ RD χ Rel τ2 } RG ρ = {(k,, )} RG Γ, x:τ ρ = {(k, γ[x v], γ [x v ]) (k, γ, γ ) RG Γ ρ (k, v, v ) RV τ ρ} ; Γ e e : τ def = ; Γ e : τ ; Γ e : τ k 0. ρ, γ, γ. ρ RD (k, γ, γ ) RG Γ ρ = (k, γ(e), γ (e )) RC τ ρ Figure 5: λ Relational Model The relational interpretation of types as computations RC τ is defined exactly as before (see Figure 3). The definition of the logical relation ; Γ e e : τ appears in Figure 5. We prove that each type τ is a valid type: RV τ ρ Rel τ [ρ]. Specifically, we have to show well-typedness and closure under decreasing step-index. To show the Fundamental Property of the logical relation, we prove the new set of compatibility lemmas, as well as value and type substitutivity. Thus, we can prove the following lemma. 11
12 Lemma 3.3 (λ Fundamental Property / Reflexivity) If ; Γ e : τ then ; Γ e e : τ. Next, we prove that the logical relation in Figure 5 is sound with respect to contextual equivalence. The overall proof structure is the same as for λ rec. Theorem 3.4 (λ : ctx ) If ; Γ e e : τ then ; Γ e ctx e : τ. 3.3 Example: Simple Existential Packages For lack of space, we present only one simple example (from Sumii and Pierce[19]) to illustrate the use of our logical relation to prove contextual equivalence. Additional examples involving existential packages, recursive types, and higher-order functions are given in Appendix D. Example: Consider the following existential packages e and e of type τ: e = pack 1, λx. x int = 0 e = pack tt, λx. x τ = α. α (α bool) Show ; e e :τ. We only show ; e e :τ. ; e e:τ is symmetric. Suppose k 0. Unwinding definitions, we must show (k, e, e ) RV τ (k, pack 1, λx. x int = 0, pack tt, λx. x ) RV α. α (α bool). Take τ 2 = bool and χ = {(k, 1, tt) k 0}. Note that χ Rel bool (from defn of χ). Suppose j < k. Show (j, 1, λx. x int = 0, tt, λx. x ) RV α (α bool) [α (χ, bool)], which follows from: tt, λx. x : (α (α bool))[bool/α] (j, 1, tt) RV α [α (χ, bool)] (j, 1, tt) χ (by defn of RV α ρ) which follows from defn of χ. (j, (λx. x int = 0), (λx. x)) RV α bool [α (χ, bool)], which follows from: First, note that λx. x : (α bool)[bool/α] λx. x : bool bool. Next, suppose i < j, and (i, v 1, v 1) RV α [α (χ, bool)]. Note that RV α [α (χ, bool)] χ by defn of RV α ρ. Hence, (i, v 1, v 1) χ. Then, from defn of χ, v 1 = 1 and v 1 = tt. Show: (i, (x int = 0)[v 1 /x], ( x)[v 1/x]) RC bool [α (χ, bool)] int (i, v 1 = 0, v 1) RC bool [α (χ, bool)] (i, 1 int = 0, tt) RC bool [α (χ, bool)]. Note that (1 int = 0) 1 ff and ( tt) ff. Hence, remains to show: (i 1, ff, ff) RV bool [α (χ, bool)], which is immediate. 3.4 λ : Completeness The λ logical relation presented in Section 3.2 is sound but not complete with respect to contextual equivalence. In this section, we present an outline of the desired completeness proof in order to illustrate where the proof gets stuck and to motivate changes to the earlier logical relation that might make it complete with respect to contextual equivalence. With a minor modification to the logical relation from Section 3.2, we are able to show completeness in the presence of recursive and polymorphic types, but not for existential types (i.e., for the language λ, which extends λ rec with only universal types). We start by trying to establish completeness for λ in a manner similar to that for λ rec. As for λ rec, we rely on the notion of ciu-equivalence, which we define for λ as follows. 12
13 Definition 3.5 (λ Ciu Approximation ciu ) Let ; Γ e : τ and ; Γ e : τ. If δ is a mapping from type variables α to closed syntactic types τ, we write δ = whenever dom(δ) =. ; Γ e ciu e : τ def = δ, γ, E, τ 1. δ = γ : δ(γ) ; E : ( ; δ(τ)) τ 1 E[γ(e)] = E[γ(e )] To prove completeness as before, we must show (1) that two contextually equivalent terms are ciu equivalent, and (2) that two ciu equivalent terms are logically related. It is straightforward to prove the first lemma: Theorem 3.6 (λ : ctx ciu ) If ; Γ e ctx e : τ then ; Γ e ciu e : τ. However, the proof of the second lemma (which states that two ciu equivalent terms are logically related) fails to go through. To see why, let us return to the proof of completeness of λ rec, specifically to Lemma 2.10 which establishes that the relational value interpretation RV τ is equivalence-respecting: if (k, v 1, v 2 ) RV τ and v 2 ciu v 3 : τ, then (k, v 1, v 3 ) RV τ. The proof of that lemma requires induction on k and nested induction on the structure of the closed type τ. In the case of λ, when we get to the proof of the corresponding lemma, τ may have free type variables. Thus, one of the cases we must consider for the inner induction is τ = α. Assuming that ρ(α) = (χ, τ α ), we will be required to show that if (k, v 1, v 2 ) RV α ρ ρ sem (α) χ and v 2 ciu v 3 : α [ρ] (where α [ρ] τ α ), then (k, v 1, v 3 ) χ. This is where the proof for λ gets stuck. Note, however, that χ Rel τα. Thus, for the above proof to go through for λ, we must add this requirement directly to the definition of Rel τ. Hence, every set χ in Rel τ must satisfy the equivalence-respecting property (in addition to closure under decreasing step-index and well-typedness of the second value of each tuple in χ). A more informal justification for this change is that in the presence of quantified types, we can instantiate a type variable with a relational interpretation of our own choosing. Thus, we have to show that the relation we pick satisfies certain properties, one of which is that it must be equivalence-respecting. The modified definition of Rel τ is given below. It makes use of a notion of ciu-equivalence restricted to closed values. With the exception of the definition of Rel τ, the logical relation is now defined exactly as in Figure 5. v ciu v def : τ = E, τ 1. ; E : ( ; τ) τ 1 E[v] = E[v ] Rel τ def = {χ 2 Nat CValues CValues (j, v, v ) χ. v : τ i j. (i, v, v ) χ ( v. v ciu v : τ = (j, v, v ) χ)} As before, we now prove that each type τ is a valid type (RV τ ρ Rel τ [ρ]), but now in addition to showing well-typedness and closure under decreasing step-index, we must also show that RV τ ρ is equivalence-respecting. Unfortunately, this property does not hold for existential types. (For details of how the proof fails, see Appendix E.2, proof of Lemma E.1, the case for existential types.) Thus, the following lemma holds for the λ -calculus (λ rec extended with universal types), but not for λ. Lemma 3.7 (λ Equivalence-Respecting) Let ρ RD and τ. If (k, v 1, v 2 ) RV τ ρ and v 2 ciu v 3 : τ [ρ], then (k, v 1, v 3 ) RV τ ρ. Note that the change in the definition of Rel τ does not affect the proof of the fundamental theorem (for λ ) or the proof of soundness with respect to contextual equivalence, which are proved exactly as before. Since our relational interpretation of existential types fails to be equivalence-respecting, our logical relation is incomplete with respect to contextual equivalence in the presence of existential types. However, the relational interpretations of all the other types in λ (i.e., all types in λ ) are equivalence-respecting. Thus, we are able to prove completeness with respect to contextual equivalence for the language λ. 13
14 Theorem 3.8 (λ : ctx ciu ) If ; Γ e ctx e : τ then ; Γ e ciu e : τ. If ; Γ e ciu e : τ then ; Γ e e : τ. 4 Related Work and Conclusion Logical relations were first developed for denotational semantics of typed λ-calculi (e.g., [1, 2]). Early examples of the use of logical relations based on operational semantics include Tait s [4] proof of strong normalization of the simply typed λ-calculus, and Girard s method of reducibility candidates [5] used to prove normalization for System F. Pitts [7, 6, 9] developed syntactic logical relations for a λ-calculus with recursive functions and quantified types (but no recursive types). To support recursive functions without using denotational techniques, Pitts makes use of -closure (or biorthogonality [12]). Relations that are -closed can be immediately shown to be equivalence-respecting and admissible [9]. We note that Pitts logical relations do not support recursive types; at the end of [9], he poses syntactic logical relations for recursive types as an open problem in need of a fresh idea for further progress. In this paper, we have shown that it is possible to construct a logical relation that is sound and complete with respect to contextual equivalence for a language with recursive functions, recursive types, and polymorphism, without the use of biorthogonality or -closure. For existential types, however, our logical relation is sound but not complete. We conjecture that it should be possible to combine the -closure and step-indexing techniques to obtain a sound and complete logical relation for a language with recursive and polymorphic types as well as existential types. Birkedal and Harper [10] and Crary and Harper [8] extended syntactic logical relations with recursive types (the latter also support polymorphic types, but not existential types) by adapting Pitts minimal invariance [3] technique for use in a purely syntactic setting. Melliès and Vouillon [12, 11] construct a realizability model of a language with recursive types and polymorphism based on intuitions from the ideal model of types [20]. They also present a relational model based on an orthogonality relation between quadruples of terms and contexts [12]. We note that to show completeness, they too must move to a typed setting. An issue that merits further investigation is the relationship between the different notions of approximation i.e., syntactic projections [8], interval types [12], and step counts. Contextual equivalence may also be proved using bisimulations. Sumii and Pierce [19] present a bisimulation for recursive and quantified types. Using their examples as a point of comparison (see Appendix D) we show that our logical relations are somewhat easier to use when proving contextual equivalence. Also, unlike logical relations, Sumii and Pierce note that their bisimulation cannot be used to derive free theorems [21] based only on types. We have presented a step-indexed logical relation for recursive and impredicative quantified types. The construction is far more elementary than that of existing logical relations for such types. In future work, we intend to investigate the combination of -closure with step-indexing to obtain a logical relation for λ that is sound as well as complete with respect to contextual equivalence. We also hope to scale these techniques up to support dynamically allocated (ML-style) mutable references. References [1] Plotkin, G.D.: Lambda-definability and logical relations. Memorandum SAI RM 4, University of Edinburgh, Edinburgh, Scotland (1973) [2] Statman, R.: Logical relations and the typed λ-calculus. Information and Control 65(2 3) (1985) [3] Pitts, A.M.: Relational properties of domains. Information and Computation 127(2) (1996)
15 [4] Tait, W.W.: Intensional interpretations of functionals of finite type i. Journal of Symbolic Logic 32(2) (1967) [5] Girard, J.Y.: Interprétation Fonctionnelle et Élimination des Coupures de l Arithmétique d Ordre Supérieur. Thèse de doctorat d état, Université Paris VII, Paris, France (1972) [6] Pitts, A.M.: Parametric polymorphism and operational equivalence. Mathematical Structures in Computer Science 10 (2000) [7] Pitts, A.M.: Existential types: Logical relations and operational equivalence. Lecture Notes in Computer Science 1443 (1998) [8] Crary, K., Harper, R.: Syntactic logical relations over polymorphic and recursive types. Draft (2000) [9] Pitts, A.M.: Typed operational reasoning. In Pierce, B.C., ed.: Advanced Topics in Types and Programming Languages. MIT Press (2005) [10] Birkedal, L., Harper, R.: Relational interpretations of recursive types in an operational setting. In: Theoretical Aspects of Computer Software (TACS). (1997) [11] Melliès, P.A., Vouillon, J.: Semantic types: A fresh look at the ideal model for types. In: POPL, Venice, Italy. (2004) [12] Melliès, P.A., Vouillon, J.: Recursive polymorphic types and parametricity in an operational framework. In: LICS, Chicago, Illinois. (2005) [13] Appel, A.W., McAllester, D.: An indexed model of recursive types for foundational proof-carrying code. ACM TOPLAS 23(5) (2001) [14] Ahmed, A., Appel, A.W., Virga, R.: An indexed model of impredicative polymorphism and mutable references. Available at appel/papers/impred.pdf (2003) [15] Ahmed, A.J.: Semantics of Types for Mutable State. PhD thesis, Princeton University (2004) [16] Ahmed, A.: Step-indexed syntactic logical relations for recursive and quantified types. Technical Report TR-01-06, Harvard University (2006) [17] Pierce, B.C.: Types and Programming Languages. MIT Press (2002) [18] Mason, I.A., Talcott, C.L.: Equivalence in functional languages with effects. Journal of Functional Programming 1(3) (1991) [19] Sumii, E., Pierce, B.C.: A bisimulation for type abstraction and recursion. In: POPL, Long Beach, California. (2005) [20] MacQueen, D., Plotkin, G., Sethi, R.: An ideal model for recursive polymophic types. Information and Computation 71(1/2) (1986) [21] Wadler, P.: Theorems for free! In: ACM Symposium on Functional Programming Languages and Computer Architecture (FPCA), London (1989) 15
16 Appendix: Formal Development The following appendices present a formal development of the calculi, relational models, and proofs described in the main body of this technical report, as well as additional examples. In Appendix A, we present the Appel-McAllester model [13] and show how a direct proof of transitivity fails to go through. In Appendix B, we present a logical relation for (iso-)recursive types and show that the relation is transitive, as well as sound and complete with respect to contextual equivalence. In Appendix C, we present a logical relation for a language with recursive, polymorphic, and existential types that is sound but incomplete with respect to contextual equivalence. Appendix D presents a number of examples involving existential packages, higher-order functions, universal types and contravariant recursive types. In Appendix E we present a slight modification of the logical relation from Appendix C and show that in the absence of existential types it is sound and complete with respect to contextual equivalence. 16
17 A Appel-McAllester Indexed PER Model (Equi-Recursive Types) This section gives all the relevant definitions for the Appel-McAllester model (using notational conventions from [13]) and summarizes the lemmas that should hold of the model. Section A.1 illustrates how a direct proof of transitivity fails to go through. Expressions e ::= x 0 e 1, e 2 π 1(e) π 2(e) λx. e e 1 e 2 Values v ::= x 0 v 1, v 2 λx. e Types τ ::= int τ 1 τ 2 τ 1 τ 2 µf Figure 6: Appel-McAllester: Syntax e 1 e 1 e 2 e 2 e 1 e 2 e 1 e 2 (λx. e 1) e 2 λx. e 1 e 2 (λx. e) v e[v/x] e 1 e 1 e 1, e 2 e 1, e 2 e 2 e 2 v 1, e 2 v 1, e 2 π 1 v 1, v 2 v 1 π 2 v 1, v 2 v 2 Figure 7: Appel-McAllester: Operational Semantics Γ e : τ (Var) Γ x : Γ(x) (Zero) Γ 0 : int (Fun) Γ, x:τ 1 e : τ 2 Γ λx. e : τ 1 τ 2 (App) Γ e1 : τ1 τ2 Γ e2 : τ1 Γ e 1 e 2 : τ 2 (Pair) Γ e1 : τ1 Γ e2 : τ2 (Proj1) Γ e : τ1 τ2 (Proj2) Γ e : τ1 τ2 Γ e 1, e 2 : τ 1 τ 2 Γ π 1(e) : τ 1 Γ π 2(e) : τ 2 (Fold) Γ e : F (µf ) Γ e : µf (Unfold) Γ e : µf Γ e : F (µf ) Figure 8: Appel-McAllester: Static Semantics 17
18 {} int {(k, 0, 0)} τ 1 τ 2 {(k, v 1, v 2, v 1, v 2 ) j < k. (j, v 1, v 1) τ 1 (j, v 2, v 2) τ 2} τ 1 τ 2 {(k, λx. e, λx. e ) j < k, v, v. (j, v, v ) τ 1 = e[v/x] e [v /x] : j τ 2} µf {(k, v, v ) (k, v, v ) F k+1 ( )} e e : k τ j < k, e f. e j e f irred(e f ) = e f. e e f (k j, e f, e f ) τ γ γ : k Γ dom(γ) = dom(γ ) = dom(γ) x dom(γ). γ(x) γ (x) : k Γ(x) Γ e e : τ k 0. γ, γ. γ γ : k Γ = γ(e) γ (e ) : k τ Γ e e : τ Γ e e : τ Γ e e : τ Figure 9: Appel-McAllester: Indexed PER Model [13] Γ e e : τ (Reflexivity) Γ e : τ Γ e e : τ (Symmetry) Γ e e : τ Γ e e : τ (Transitivity) Γ e1 e2 : τ Γ e 1 e 3 : τ Γ e2 e3 : τ (Substitutivity) Γ v v : τ 1 Γ, x:τ 1 e e : τ 2 Γ e[v/x] e [v /x] : τ 2 (Compatibility Properties) (Var) Γ(x) = τ Γ x x : τ (Zero) Γ 0 0 : int (Fun) Γ, x:τ 1 e e : τ 2 Γ λx. e λx. e : τ 1 τ 2 (App) Γ e1 e 1 : τ 1 τ 2 Γ e 2 e 2 : τ 1 Γ e 1 e 2 e 1 e 2 : τ 2 (Pair) Γ e1 e 1 : τ 1 Γ e 2 e 2 : τ 2 Γ e 1, e 2 e 1, e 2 : τ 1 τ 2 (Proj1) Γ e e : τ 1 τ 2 Γ π 1(e) π 1(e ) : τ 1 (Proj2) Γ e e : τ 1 τ 2 Γ π 2(e) π 2(e ) : τ 2 (Fold) Γ e e : F (µf ) Γ e e : µf (Unfold) Γ e e : µf Γ e e : F (µf ) Note: is an equivalence relation if it satisfies the reflexivity, symmetry and transitivity properties. It is a congruence relation if it satisfies the substitutivity and compatibility properties. Figure 10: Appel-McAllester: Properties Required of 18
19 A.1 Appel-McAllester: of Transitivity Fails With the exception of transitivity, all of the lemmas shown in Figure 10 are directly provable in the Appel-McAllester model [13]. A direct proof of transitivity, however, does not go through. Proposed Lemma (Transitivity) If Γ e 1 e 2 : τ and Γ e 2 e 3 : τ then Γ e 1 e 3 : τ. Attempt: We are required to show Γ e 1 e 3 : τ. Consider arbitrary k, γ, γ such that k 0, and γ γ : k Γ. We are required to show that γ(e 1 ) γ (e 3 ) : k τ. Consider arbitrary j, e f1 such that j < k, γ(e 1 ) j e f1, and irred(e f1 ). We are required to show that e f3. γ (e 3 ) e f3 (k j, e f1, e f3 ) τ. Instantiate Γ e 1 e 2 : τ with k, γ, γ. Note that k 0, and γ γ : k Γ. Hence, γ(e 1 ) γ (e 2 ) : k τ. Instantiate this with j, e f1. Note that j < k, γ(e 1 ) j e f1, and irred(e f1 ). Hence, there exist e f2, i, such that i 0, γ (e 2 ) i e f2, and irred(e f2 ). Now we would like to use the second hypothesis Γ e 2 e 3 : τ. But what index should we instantiate this with? There are two possible ways to proceed. (i) Instantiate Γ e 2 e 3 : τ with k, γ, and γ. Note that k 0, and γ γ : k Γ. Hence, γ(e 2 ) γ (e 3 ) : k τ. Problem: We could instantiate this with i and e f2. But at that point we are stuck since: 19
20 we cannot show i < k, as i may be greater than k, and we cannot show γ(e 2 ) i e f2, as we only have γ (e 2 ) i e f2. (ii) Instantiate Γ e 2 e 3 : τ with some z such that z > i, γ, and γ. Problem: We cannot show γ γ : z Γ. All we know is that γ γ : k Γ, where z > i and i may be greater than k. 20
21 B Iso-Recursive Types Types τ ::= bool τ 1 τ 2 α µα. τ Expressions e ::= x tt ff if e 0, e 1, e 2 λx. e e 1 e 2 fold e unfold e Values v ::= x tt ff λx. e fold v Figure 1: λ rec Syntax Evaluation Contexts E ::= [ ] if E, e 1, e 2 E e v E fold E unfold E (iftrue) if tt, e 1, e 2 e 1 (iffalse) if ff, e 1, e 2 e 2 (app) (λx. e) v e[v/x] (unfold) unfold (fold v) v (ctxt) e e E[e] E[e ] Figure 2: λ rec Operational Semantics Notation The notation e e denotes a single operational step. We write e j e to denote that there exists a chain of j steps of the form e e 1... e j where e j is e. A term e is irreducible (written irred(e)) if it has no successor in the step relation that is, if e is a value (written val(e)) or if e is a stuck expression (such as tt(e )) to which no operational rule applies. We also use the following abbreviations. e e e e e e def = k 0. e k e def = e e val(e ) def = e. e e def = k 0. e. e k e 21
22 Type Context ::=, α τ (VarTy) α α (BoolTy) bool (FnTy) τ1 τ2 τ 1 τ 2 (RecTy), α τ µα. τ Figure 3: λ rec Static Semantics I Value Context Γ ::= Γ, x:τ where τ Γ e : τ (True) Γ tt : bool (False) Γ ff : bool (If) Γ e0 : bool Γ e1 : τ Γ e2 : τ Γ if e 0, e 1, e 2 : τ (Var) Γ x : Γ(x) (Fn) Γ, x:τ 1 e : τ 2 Γ λx. e : τ 1 τ 2 (App) Γ e1 : τ1 τ2 Γ e2 : τ1 Γ e 1 e 2 : τ 2 (Fold) Γ e : τ[µα. τ/α] Γ fold e : µα. τ (Unfold) Γ e : µα. τ Γ unfold e : τ[µα. τ/α] Figure 4: λ rec Static Semantics II 22
23 B.1 λ rec Unary Model Notation We write V τ for the semantic interpretation of types as values, C τ for the interpretation of types as computations, and G Γ for the interpretation of contexts as substitutions (Figure 5). We use the metavariable σ to range over sets of tuples of the form (k, v) where k is a natural number and v is a closed value i.e., k Nat and v CValues. We use δ for mappings from type variables α to sets σ 2 Nat CValues. Type σ k def = {σ 2 Nat CValues (j, v) σ. i j. (i, v) σ} def = {(j, v) j < k (j, v) σ} V α δ = δ(α) V bool δ = {(k, v) v = tt v = ff} V τ 1 τ 2 δ = {(k, λx. e) j < k, v. (j, v) V τ 1 δ = (j, e[v/x]) C τ 2 δ} V µα. τ δ = {(k, fold v) j < k. let σ = V µα. τ δ j+1 in (j, v) V τ δ[α σ]} C τ δ = {(k, e) j < k, e f. e j e f irred(e f ) = (k j, e f ) V τ δ} G = {(k, )} G Γ, x : τ = {(k, γ[x v]) (k, γ) G Γ (k, v) V τ } Γ e : τ = k 0. γ. (k, γ) G Γ = (k, γ(e)) C τ Figure 5: λ rec Step-Indexed Unary Model D = { True} D, α = {δ[α σ] δ D σ Type} Figure 6: λ rec Step-Indexed Unary Model (Additional Notation for s) 23
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,
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
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) =
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
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.
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
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.
Math 6 SL Probability Distributions Practice Test Mark Scheme
Math 6 SL Probability Distributions Practice Test Mark Scheme. (a) Note: Award A for vertical line to right of mean, A for shading to right of their vertical line. AA N (b) evidence of recognizing symmetry
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
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
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
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
Απόκριση σε Μοναδιαία Ωστική Δύναμη (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
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
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
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
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
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,
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 :
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
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
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
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
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
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
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
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
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,
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
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
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
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
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
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
ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007
Οδηγίες: Να απαντηθούν όλες οι ερωτήσεις. Αν κάπου κάνετε κάποιες υποθέσεις να αναφερθούν στη σχετική ερώτηση. Όλα τα αρχεία που αναφέρονται στα προβλήματα βρίσκονται στον ίδιο φάκελο με το εκτελέσιμο
CS-XXX: Graduate Programming Languages. Lecture 27 Higher-Order Polymorphism. Matthew Fluet 2012
CS-XXX: Graduate Programming Languages Lecture 27 Higher-Order Polymorphism Matthew Fluet 2012 Looking back, looking forward Have defined System F. Metatheory (what properties does it have) What (else)
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
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 α
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
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
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
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
Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1
Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1 A Brief History of Sampling Research 1915 - Edmund Taylor Whittaker (1873-1956) devised a
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
SCITECH Volume 13, Issue 2 RESEARCH ORGANISATION Published online: March 29, 2018
Journal of rogressive Research in Mathematics(JRM) ISSN: 2395-028 SCITECH Volume 3, Issue 2 RESEARCH ORGANISATION ublished online: March 29, 208 Journal of rogressive Research in Mathematics www.scitecresearch.com/journals
Section 7.6 Double and Half Angle Formulas
09 Section 7. Double and Half Angle Fmulas To derive the double-angles fmulas, we will use the sum of two angles fmulas that we developed in the last section. We will let α θ and β θ: cos(θ) cos(θ + θ)
ω ω ω ω ω ω+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 +
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
Démographie spatiale/spatial Demography
ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΙΑΣ Démographie spatiale/spatial Demography Session 1: Introduction to spatial demography Basic concepts Michail Agorastakis Department of Planning & Regional Development Άδειες Χρήσης
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
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
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
Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1
Conceptual Questions. State a Basic identity and then verify it. a) Identity: Solution: One identity is cscθ) = sinθ) Practice Exam b) Verification: Solution: Given the point of intersection x, y) of the
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)
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
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
( ) 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
Example of the Baum-Welch Algorithm
Example of the Baum-Welch Algorithm Larry Moss Q520, Spring 2008 1 Our corpus c We start with a very simple corpus. We take the set Y of unanalyzed words to be {ABBA, BAB}, and c to be given by c(abba)
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)
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
λρ-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,
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
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
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
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:
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}
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
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
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
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
9.09. # 1. Area inside the oval limaçon r = cos θ. To graph, start with θ = 0 so r = 6. Compute dr
9.9 #. Area inside the oval limaçon r = + cos. To graph, start with = so r =. Compute d = sin. Interesting points are where d vanishes, or at =,,, etc. For these values of we compute r:,,, and the values
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
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
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
TMA4115 Matematikk 3
TMA4115 Matematikk 3 Andrew Stacey Norges Teknisk-Naturvitenskapelige Universitet Trondheim Spring 2010 Lecture 12: Mathematics Marvellous Matrices Andrew Stacey Norges Teknisk-Naturvitenskapelige Universitet
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
DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.
DESIGN OF MACHINERY SOLUTION MANUAL -7-1! PROBLEM -7 Statement: Design a double-dwell cam to move a follower from to 25 6, dwell for 12, fall 25 and dwell for the remader The total cycle must take 4 sec
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
Συστήματα Διαχείρισης Βάσεων Δεδομένων
ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ Συστήματα Διαχείρισης Βάσεων Δεδομένων Φροντιστήριο 9: Transactions - part 1 Δημήτρης Πλεξουσάκης Τμήμα Επιστήμης Υπολογιστών Tutorial on Undo, Redo and Undo/Redo
Models for Probabilistic Programs with an Adversary
Models for Probabilistic Programs with an Adversary Robert Rand, Steve Zdancewic University of Pennsylvania Probabilistic Programming Semantics 2016 Interactive Proofs 2/47 Interactive Proofs 2/47 Interactive
Tridiagonal matrices. Gérard MEURANT. October, 2008
Tridiagonal matrices Gérard MEURANT October, 2008 1 Similarity 2 Cholesy factorizations 3 Eigenvalues 4 Inverse Similarity Let α 1 ω 1 β 1 α 2 ω 2 T =......... β 2 α 1 ω 1 β 1 α and β i ω i, i = 1,...,