28 Pages

toplas95-po

Course: CS 232, Spring 2006
School: UCLA
Rating:
 
 
 
 
 

Word Count: 9018

Document Preview

Type A System Equivalent to Flow Analysis Jens Palsberg Patrick OKeefe Abstract Flow-based safety analysis of higher-order languages has been studied by Shivers, and Palsberg and Schwartzbach. Open until now is the problem of nding a type system that accepts exactly the same programs as safety analysis. In this paper we prove that Amadio and Cardellis type system with subtyping and recursive types accepts the...

Register Now

Unformatted Document Excerpt

Coursehero >> California >> UCLA >> CS 232

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Type A System Equivalent to Flow Analysis Jens Palsberg Patrick OKeefe Abstract Flow-based safety analysis of higher-order languages has been studied by Shivers, and Palsberg and Schwartzbach. Open until now is the problem of nding a type system that accepts exactly the same programs as safety analysis. In this paper we prove that Amadio and Cardellis type system with subtyping and recursive types accepts the same programs as a certain safety analysis. The proof involves mappings from types to ow information and back. As a result, we obtain an inference algorithm for the type system, thereby solving an open problem. 1 1.1 Introduction Background Many program analyses for higher-order languages are based on ow analysis, also known as closure analysis. Examples include the binding-time analyses for Scheme in the partial evaluators Schism [5] and Similix [3]. Such analyses have the advantage that they can be applied to untyped languages. This is in contrast to more traditional abstract interpretations which use types when dening the abstract domains. Recently, it has become popular to dene program analyses for typed languages by annotating the types with information about program behavior [10, 2]. This has lead to clear specications of a range of analyses, and often such an analysis can be eciently computed by a straightforward extension of a known type inference algorithm. The precision of a type-based analysis depends on the expressiveness of the underlying type system. Similarly, the precision of a ow-based analysis depends on the expressiveness of the underlying ow analysis. In this paper we address an instance of the following fundamental question: Fundamental question. What type-based analysis computes the same information as a given ow-based analysis? ACM Transactions on Programming Languages and Systems, 17(4):576599, July 1995. Preliminary version in Proc. POPL95. Computer Science Department, Aarhus University, DK-8000 Aarhus C, Denmark. E-mail: palsberg@daimi.aau.dk. 151 Coolidge Avenue #211, Watertown, MA 02172, USA. E-mail: pmo@world.std.com. 1 We consider the case of ow-based safety analysis, that is, an analysis which collects type information from for example constants and applications of primitive operations. Such an analysis was rst presented in 1991 by Shivers [18] who called it type recovery. Later, Palsberg and Schwartzbach [12, 15] proved that on the basis of the collected information, one can dene a predicate which accepts only programs which cannot go wrong. They called this safety analysis. They also proved that their safety analysis accepts more programs than simple type inference. In this paper, we consider the following instance of the above question: Which type system accepts the same programs as safety analysis? The particular safety analysis we consider is dened in Section 3. It is based on a ow analysis which in the terminology of Shivers [17] is a 0CFA, that is, a 0-level control-ow analysis. Intuitively, it is a ow analysis which for each function merges all environment information. Many program analyses are based on 0CFA-style analyses, see for example [16, 22, 7]. Our thesis is that the type system that answers the specic question will in many cases also be the answer to the fundamental question. Flow-based analyses have the reputation of tting poorly together with separate compilation because they deal with program points. In contrast, traditional type systems such as that of ML t well together with separate compilation because one can compute a principal type for each subterm. Our hope is that the type system that answers the specic question above will lead to a better understanding of how to create program analyses that are both modular and have the power of ow-based analyses. 1.2 Our result We prove that a natural type system with subtyping and recursive types accepts the same programs as safety analysis. The proof involves mappings from types to ow information and back. The type system has been studied by Amadio and Cardelli [1], and an O(n2 ) algorithm for deciding the subtyping relation has been presented by Kozen, Palsberg, Schwartzbach, [9]. Open until now is the question of type inference. As a corollary of our result we get a type inference algorithm which works by rst doing safety analysis and then mapping the ow information to types. The set of types can be presented by the following grammar: t ::= t1 t2 | Int | v | v.t | | The type system contains the following components: the binary function type constructor , the constant type Int, the possibility for creating recursive types, and two more constant types , and . Moreover, there is a subtype relation, written . In contrast, safety analysis uses an abstract domain containing sets of syntactic occurrences of abstractions and the constant Int. In slogan-form, our result reads: 2 Flow analysis + Safety checks = Simple types + Recursive types + + + Subtyping Each component of ...
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

UCLA - CS - 232
Stack Size Analysis for Interrupt-driven Programs 1Krishnendu Chatterjee a Di Ma c Rupak Majumdar e Tian Zhao d Thomas A. Henzinger a,b Jens Palsberg e,a Departmentof Electrical Engineering and Computer Sciences University of California, Berkeley
UCLA - M - 230
UCLA - MATH - 0202
The Bulletin of Symbolic Logic Volume 2, Number 2, June 1996THE DISCOVERY OF MY COMPLETENESS PROOFSLEON HENKINDedicated to my teacher, Alonzo Church, in his 91st year. 1. Introduction. This paper deals with aspects of my doctoral dissertation1
UCLA - MATH - 0203
The Bulletin of Symbolic Logic Volume 2, Number 3, Sept. 1996COMPUTABILITY AND RECURSIONROBERT I. SOAREAbstract. We consider the informal concept of computability or eective calculability and two of the formalisms commonly used to dene it, (Tur
UCLA - CS - 268
Lecture 1: IntroductionAdministrivia Why vision? Where are we at? What you need to know Quick review of linear algebra, optimizationStefano Soatto (c)UCLA Vision Lab1What is vision?From the 3-D world to 2-D images: image format
UCLA - CS - 268
CS268: MACHINE PERCEPTIONLab 2 Due according to schedule on websiteThis assignment is meant to help you familiarize with rigid, ane, projective transformations as well as with linear, least-squares estimation. Dowload from the class website the 6 p
UCLA - CS - 268
CS268: MACHINE PERCEPTIONLab 1 Due according to schedule on websiteThis assignment is meant for you to familiarize with the programming environment. We will assume by default that you have Matlab available. This is the case if you are using a CS de
UCLA - CS - 268
A PRIMER IN PROJECTIVE GEOMETRYProjective geometry can be approached in many ways.It can be conceived as an extension of Euclidean geometry, by adding points where lines that never meet (parallels) do meet (points at innity). The construction of pr
UCLA - CS - 268
Fundamentals of Image Processinghany.farid@dartmouth.edu http:/www.cs.dartmouth.edu/~farid0. Mathematical Foundations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 0.1: Vectors 0.2: Matrices 0.3: Vect
UCLA - EE - 103
UCLA Fall Quarter 2008-09Electrical Engineering 103 Applied Numerical ComputingProfessor L. VandenbergheNotes written in collaboration with S. Boyd (Stanford Univ.)Contents1 Vectors 1.1 Denitions and notation . . 1.2 Zero and unit vectors . .
UCLA - EE - 103
EE103 (Fall 2008-09)1. Vectors denition and notation inner products and norms linear functions angle between vectors11Vectorsn-vector x: x1 x2 x= . . xn set of n-vectors is denoted Rn also written as x = (x1, x2, . . . , xn) xi
UCLA - EE - 103
EE103 (Fall 2008-09)Vectorsn-vector x: x1 x x = .2 . xn 1. Vectors denition and notation inner products and norms linear functions angle between vectors set of n-vectors is denoted Rn also written as x = (x1, x2, . . . , xn) xi: i
UCLA - EE - 103
EE103 (Fall 2008-09)2. Matrices denition and notation matrix-vector product matrix-matrix product matrix inverse orthogonal matrices cost of matrix operations21Matricesm n-matrix A: a11 a12 a1n a21 a22 a2n A= . . . . . . . am1 a
UCLA - EE - 103
EE103 (Fall 2008-09)Matricesm n-matrix A:2. Matrices denition and notation matrix-vector product matrix-matrix product matrix inverse orthogonal matrices cost of matrix operations a11 a12 a1n a a22 a2n A = 21 . . . . . . . am1 am
UCLA - EE - 103
EE103 (Fall 2008-09)3. Linear equations linear equations example: polynomial interpolation applications geometrical interpretation left and right inverse range and nullspace31Linear equationsm equations in n variables x1, x2, . . . , xn:
UCLA - EE - 103
EE103 (Fall 2008-09)4. Triangular matrices terminology forward and backward substitution inverse41Terminologya square matrix A is lower triangular if aij = 0 for j > i a11 a21 . . 0 a22 . . 0 0 0 0 . 0 0 an1,n1 0 an,n1 ann
UCLA - EE - 103
EE103 (Fall 2008-09)Terminologya square matrix A is lower triangular if aij = 0 for j > i a11 a21 . . 0 a22 . . 0 0 0 0 . 0 0 an1,n1 0 an,n1 ann 4. Triangular matrices terminology forward and backward substitution inverse A=
UCLA - EE - 103
EE103 (Fall 2008-09)5. The Cholesky factorization positive (semi-)denite matrices examples the Cholesky factorization solving Ax = b with A positive denite inverse of a positive denite matrix permutation matrices sparse Cholesky factorizatio
UCLA - EE - 103
EE103 (Fall 2008-09)Positive (semi-)denite matrices A is positive denite if A is symmetric and xT Ax > 0 for all x = 0 A is positive semidenite if A is symmetric and xT Ax 0 for all x Note: if A is symmetric of order n, thenn n n5. The Choles
UCLA - EE - 103
EE103 (Fall 2008-09)6. The LU factorization factor-solve method nonsingular matrices LU factorization solving Ax = b with A nonsingular the inverse of a nonsingular matrix LU factorization algorithm eect of rounding error sparse LU factoriz
UCLA - EE - 103
EE103 (Fall 2008-09)Factor-solve approachto solve Ax = b, rst write A as a product of simple matrices A = A1 A2 Ak6. The LU factorization factor-solve method nonsingular matrices LU factorization solving Ax = b with A nonsingular the inv
UCLA - EE - 103
EE103 (Fall 2008-09)7. The condition number Ax = b when A is singular condition of a set of linear equations matrix norm condition number71Linear equations with singular coecient matrixif A is nonsingular, then Ax = b has a unique solutio
UCLA - EE - 103
EE103 (Fall 2008-09)Linear equations with singular coecient matrixif A is nonsingular, then Ax = b has a unique solution for every b if A is singular, then Ax = b has zero or innitely many solutions:7. The condition number Ax = b when A is sin
UCLA - EE - 103
EE103 (Fall 2008-09)8. Linear least-squares denition examples and applications81DenitionOverdetermined linear equations Ax = b for most b, cannot solve for x Least-squares formulation m n(A is m n with m > n)minimizeAx b = (i=1
UCLA - EE - 103
EE103 (Fall 2008-09)DenitionOverdetermined linear equations Ax = b for most b, cannot solve for x (A is m n with m > n)8. Linear least-squares denition examples and applicationsLeast-squares formulation m nminimizeAx b = (i=1 j=1
UCLA - EE - 103
EE103 (Fall 2008-09)9. The solution of a least-squares problem geometric interpretation left inverse of a zero nullspace matrix the solution of a least-squares problem the normal equations91Geometric interpretation of a LS problemminimiz
UCLA - EE - 103
EE103 (Fall 2008-09)Geometric interpretation of a LS problem9. The solution of a least-squares problemminimize A is m n with columns a1, . . . , an geometric interpretation left inverse of a zero nullspace matrix the solution of a least-squa
UCLA - EE - 103
EE103 (Fall 2008-09)10. The QR factorization solving the normal equations the QR factorization orthogonal matrices modied Gram-Schmidt algorithm Cholesky factorization versus QR factorization101Least-squares methodsminimize (A is m n w
UCLA - EE - 103
EE103 (Fall 2008-09)Least-squares methods10. The QR factorizationminimize solving the normal equations the QR factorization orthogonal matrices modied Gram-Schmidt algorithm Cholesky factorization versus QR factorization (A is m n with a z
UCLA - EE - 103
EE103 (Fall 2008-09)11. Least-norm problems denition and examples right inverse of a full range matrix the least-norm solution computing the least-norm solution111DenitionUnderdetermined linear equations Ax = b (A is m n with m < n) x
UCLA - EE - 103
EE103 (Fall 2008-09)12. Nonlinear equations with one variable denition and examples bisection method Newtons method secant method121Denition and examplesx is a zero (or root) of a function f if f (x) = 0 Examples f (x) = ex has no zeros
UCLA - EE - 103
EE103 (Fall 2008-09)Denition and examplesx is a zero (or root) of a function f if f (x) = 0 Examples12. Nonlinear equations with one variable denition and examples bisection method Newtons method secant method f (x) = ex has no zeros f (
UCLA - EE - 103
EE103 (Fall 2008-09)13. Newtons method for sets of nonlinear equations sets of nonlinear equations the derivative matrix and linearization Newtons method examples131Sets of nonlinear equationsn nonlinear equations in n variables f1(x1, .
UCLA - EE - 103
EE103 (Fall 2008-09)Sets of nonlinear equationsn nonlinear equations in n variables f1(x1, . . . , xn) = 0 f2(x1, . . . , xn) = 0 . . fn(x1, . . . , xn) = 0 in vector notation: f (x) = 0 where x Rn and f : Rn Rn are dened as f1(x1, . . . , xn)
UCLA - EE - 103
EE103 (Fall 2008-09)14. Unconstrained minimization terminology gradient and Hessian Newtons method141Unconstrained minimization problemminimize g(x1, x2, . . . , xn) g : Rn R (a function that maps n-vectors to scalars) x = (x1, x2, . .
UCLA - EE - 103
EE103 (Fall 2008-09)Unconstrained minimization problem14. Unconstrained minimizationminimize g(x1, x2, . . . , xn) g : Rn R (a function that maps n-vectors to scalars) terminology gradient and Hessian x = (x1, x2, . . . , xn) are the optimiz
UCLA - EE - 103
EE103 (Fall 2008-09)15. Nonlinear least-squares denition Newtons method Gauss-Newton method151Nonlinear least-squaresmminimizei=1ri(x)2 = r(x)2 ri is a nonlinear function of the n-vector of variables x r(x) = (r1(x), r2(x), . .
UCLA - EE - 103
EE103 (Fall 2008-09)15. Nonlinear least-squares denition Newtons method Gauss-Newton method151Nonlinear least-squaresmminimizei=1ri(x)2 = r(x)2 ri is a nonlinear function of the n-vector of variables x r(x) = (r1(x), r2(x), . .
UCLA - EE - 103
EE103 (Fall 2008-09)16. IEEE oating point numbers oating point numbers with base 10 oating point numbers with base 2 IEEE oating point standard machine precision rounding error161Floating point numbers with base 10x = (.d1d2 . . . dn)1
UCLA - EE - 103
EE103 (Fall 2008-09)Floating point numbers with base 1016. IEEE oating point numbersx = (.d1d2 . . . dn)10 10e oating point numbers with base 10 oating point numbers with base 2 IEEE oating point standard Interpretation: x = (d1101 + d2102
UCLA - EE - 103
EE103 (Fall 2008-09)17. Problem conditioning and stability of algorithms the conditioning of a problem the numerical stability of an algorithm cancellation171Sources of error in numerical computationExample: evaluate a function f : R R at
UCLA - EE - 103
EE103 (Fall 2008-09)Sources of error in numerical computationExample: evaluate a function f : R R at a given x (e.g., f (x) = sin x) sources of error in the result: x is not exactly known17. Problem conditioning and stability of algorithms t
UCLA - EE - 103
EE103 (Fall 2008-09)18. Ordinary dierential equations initial value problem examples forward and backward Euler method181Initial value problemFirst-order ordinary dierential equation (ODE) dx(t) = f (x(t), t), dt t usually represents time
UCLA - EE - 103
EE103 (Fall 2008-09)Initial value problemFirst-order ordinary dierential equation (ODE) dx(t) = f (x(t), t), dt x(0) = x018. Ordinary dierential equations initial value problem examples forward and backward Euler method t usually represent
UCLA - IPAM - 5
Institute for Pure and Applied Mathematics University of California, Los Angeles presentsMultiscale Geometry and Analysis in High Dimensions Workshop V: Math Analysis and Multiscale Geometric AnalysisNovember 15-19, 2004Members of the Organizing
UCLA - AAS - 116
A Truly American Experience By Jacqueline PonI would not be where I am today without the courage and hard work of my maternal and paternal grandparents. I was raised in an upper- middle class neighborhood in San Francisco and never felt like I was
UCLA - AAS - 116
My Struggles with Self and Society By Charito ViloriaMy name is Charito Viloria, and I am a 20-year-old first generation Pilipino-American, whose mother is a Registered Nurse and father is retired Navy. Born and raised in San Diego, California, Ive
UCLA - AAS - 116
Discoveries Terrible and Magnificent By Ali WongI was born in San Francisco April 19, 1982. While I lived in a neighborhood and went to school composed of predominantly wealthy white communities, I spent all of my summers and Friday nights at Donal
UCLA - AAS - 116
Try and Unite By Hanna KimMy name is Hanna Kim, and I had been a transfer student at Los Angeles City College. I wrote a grievance letter to LACC administrators because of an incident that occurred in my Asian American Studies class Monday night, 2
UCLA - AAS - 116
Learning from the Residents of Boston Chinatown By Katie LiHaaah? Tai dai sang ah! yelled an elderly Chinese woman wearing a set of earphones with the volume obviously turned up too loud. I rushed over to her, adjusted her walkman- looking machine,
UCLA - AAS - 116
My Life Is Connected to the Lives of My Ancestors By Karyn OkadaAs a fourth generation Japanese American, my life has intersected history in numerous ways. In this, I am speaking not only of my personal history, but also the histories of my ancesto
UCLA - AAS - 116
Walking the Same Streets as Carlos Bulosan By Marc LorestoThis essay will connect my life to history to the history of Filipino immigration to the United States and the racism experienced by them as well as other Asian minorities. I was born in Lo
UCLA - AAS - 116
Making a Difference in the World By Alejandro LopezThe journey began when my parents, my oldest brother and my two sisters left the state of Guanajuato in the country of Mexico in 1975. Like many others who have migrated, my father (who was a const
UCLA - AAS - 116
Stepping Stones towards a Successful Future By Sarah Marie P. MamarilI have always had assignments where I am to tell my whole life story, but this is the first time where I actually have to relate my life to the history that was happening around m
UCLA - AAS - 116
Kaoh 1 Immigration, Assimilation, and the Model Minority Myth By Christina KaohLyndon B. Johnsons signing of the Immigration Act of 1965 marked the shift in the demographics of America. According to Franklin Ngs The Taiwanese Americans, this act in
UCLA - AAS - 116
Why Did You Come to America? By Linda LamWhy did you come to America? I remember asking this question to my mother for a 4th grade project. My mother replied, Because of the Vietnam War, we decided to go to the United States. From her responses, I
UCLA - AAS - 116
How Do Race Relations in L.A. Koreatown Affect the Assi Workers Campaign? By Jacqueline PonIn class I thought about the possible effects of the Assi Market workers strike on the local community and came up with the question; how do race relations a
UCLA - AAS - 116
Mobilizing Students By Charito Viloria and Christine CorpusBefore we can discuss how students like us can mobilize support for the Assi workers, we must discuss the steps necessary in order to reach that stage of mobilizing. First, it is imperative
UCLA - AAS - 116
Why Care about Them? By Ali WongThe first day of Asian American Studies 116 was the first time I had ever heard about the ASSI boycott and KIWA as an organization. Since KIWA stands for Korean Immigrants Workers Advocate, specifically labeling thei
UCLA - AAS - 116
Life Lessons from Assi Workers By Hanna Kim and Katie LiThe initial goals and historical mission of Asian American Studies were to link students with the community. The students at San Francisco State who initiated the first Asian American Studies
UCLA - AAS - 116
How Does the Assi Workers Campaign Affect Race Relations in Koreatown? By Karyn OkadaAlthough immigrant worker struggles are rampant particularly in metropolitan cities such as Los Angeles there are many lessons that students and Asian Pacific Is