Abstract
Flow typing is becoming a popular mechanism for typing existing programs written in untyped languages (e.g. JavaScript, Racket, Groovy). Such systems require intersections for the true-branch of a type test, negations for the false-branch, and unions to capture the flow of information at meet points. Type systems involving unions, intersections and negations require a subtype operator which is non-trivial to implement. Frisch et al. demonstrated that this problem was decidable. However, their proof was not constructive and does not lend itself naturally to an implementation. In this paper, we present a sound and complete algorithm for subtype testing in the presence of unions, intersections and negations.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Cartwright, R., Fagan, M.: Soft typing. In: Proceedings of the ACM Conference on Programming Language Design and Implementation (PLDI), pp. 278–292 (1991)
Ancona, D., Ancona, M., Cuni, A., Matsakis, N.D.: RPython: a step towards reconciling dynamically and statically typed OO languages. In: Proceedings of the Dynamic Languages Symposium (DLS), pp. 53–64 (2007)
Ousterhout, J.K.: Scripting: Higher-level programming for the 21st century. IEEE Computer 31(3), 23–30 (1998)
Spinellis, D.: Java makes scripting languages irrelevant? IEEE Software 22(3), 70–71 (2005)
Loui, R.P.: In praise of scripting: Real programming pragmatism. IEEE Computer 41(7), 22–26 (2008)
Bloom, B., Field, J., Nystrom, N., Östlund, J., Richards, G., Strnisa, R., Vitek, J., Wrigstad, T.: Thorn: robust, concurrent, extensible scripting on the JVM. In: Proceedings of the ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), pp. 117–136 (2009)
Hindley, J.R.: The principal type-scheme of an object in combinatory logic. Transactions of the AMS 146, 29–60 (1969)
Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)
The Scala programming language, http://lamp.epfl.ch/scala/
Bierman, G., Meijer, E., Torgersen, M.: Lost in translation: formalizing proposed extensions to C#. In: Proceedings of the ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), pp. 479–498 (2007)
Remy, D., Vouillon, J.: Objective ML: An effective object-oriented extension to ML. Theory And Practice of Object Systems 4(1), 27–50 (1998)
Foster, J.S., Terauchi, T., Aiken, A.: Flow-sensitive type qualifiers. In: Proceedings of the ACM Conference on Programming Language Design and Implementation (PLDI), pp. 1–12 (2002)
Ekman, T., Hedin, G.: Pluggable checking and inferencing of non-null types for Java. Journal of Object Technology 6(9), 455–475 (2007)
Male, C., Pearce, D.J., Potanin, A., Dymnikov, C.: Java bytecode verification for @NonNull types. In: Proceedings of the Confererence on Compiler Construction (CC), pp. 229–244 (2008)
Fähndrich, M., Leino, K.R.M.: Declaring and checking non-null types in an object-oriented language. In: Proceedings of the ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), pp. 302–312 (2003)
Myers, A.C.: JFlow: Practical mostly-static information flow control. In: Proceedings of the ACM symposium on the Principles Of Programming Languages (POPL), pp. 228–241 (1999)
Hunt, S., Sands, D.: On flow-sensitive security types. In: Proceedings of the ACM Symposium on the Principles Of Programming Languages (POPL), pp. 79–90 (2006)
Russo, A., Sabelfeld, A.: Dynamic vs. static flow-sensitive security analysis. In: Proc. CSF, pp. 186–199 (2010)
Pearce, D.J.: JPure: A Modular Purity System for Java. In: Knoop, J. (ed.) CC 2011. LNCS, vol. 6601, pp. 104–123. Springer, Heidelberg (2011)
Foster, J.S., Fähndrich, M., Aiken, A.: A theory of type qualifiers. In: Proceedings of the ACM conference on Programming Language Design and Implementation (PLDI), pp. 192–203 (1999)
Pominville, P., Qian, F., Vallée-Rai, R., Hendren, L., Verbrugge, C.: A Framework for Optimizing Java Using Attributes. In: Wilhelm, R. (ed.) CC 2001. LNCS, vol. 2027, pp. 334–554. Springer, Heidelberg (2001)
Andreae, C., Noble, J., Markstrum, S., Millstein, T.: A framework for implementing pluggable type systems. In: Proceedings of the ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), pp. 57–74 (2006)
Tobin-Hochstadt, S., Felleisen, M.: The design and implementation of typed Scheme. In: Proceedings of the ACM Symposium on the Principles Of Programming Languages (POPL), pp. 395–406 (2008)
Tobin-Hochstadt, S., Felleisen, M.: Logical types for untyped languages. In: Proceedings of the ACM International Conference on Functional Programming (ICFP), pp. 117–128 (2010)
Guha, A., Saftoiu, C., Krishnamurthi, S.: Typing Local Control and State Using Flow Analysis. In: Barthe, G. (ed.) ESOP 2011. LNCS, vol. 6602, pp. 256–275. Springer, Heidelberg (2011)
Winther, J.: Guarded type promotion: eliminating redundant casts in Java. In: Proceedings of the Workshop on Formal Techniques for Java-like Programs, pp. 6:1–6:8 (2011)
What’s new in Groovy 2.0?, http://www.infoq.com/articles/new-groovy-20
The Whiley programming language, http://whiley.org
Pearce, D., Noble, J.: Implementing a language with flow-sensitive and structural typing on the JVM. Electronic Notes in Computer Science 279(1), 47–59 (2011)
Pearce, D.J., Cameron, N., Noble, J.: Whiley: a language with flow-typing and updateable value semantics. Technical Report ECSTR12-09, Victoria University of Wellington (2012)
Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. Addison-Wesley (1999)
Leroy, X.: Java bytecode verification: algorithms and formalizations. Journal of Automated Reasoning 30(3/4), 235–269 (2003)
Frisch, A., Castagna, G., Benzaken, V.: Semantic subtyping: Dealing set-theoretically with function, union, intersection, and negation types. Journal of the ACM 55(4), 19:1–19:64 (2008)
Aiken, A., Wimmers, E.L.: Type inclusion constraints and type inference. In: Proc. FPCA, pp. 31–41 (1993)
Damm, F.M.: Subtyping with Union Types, Intersection Types and Recursive Types. In: Hagiya, M., Mitchell, J.C. (eds.) TACS 1994. LNCS, vol. 789, pp. 687–706. Springer, Heidelberg (1994)
Castagna, G., Frisch, A.: A Gentle Introduction to Semantic Subtyping. In: Caires, L., Italiano, G.F., Monteiro, L., Palamidessi, C., Yung, M. (eds.) ICALP 2005. LNCS, vol. 3580, pp. 30–34. Springer, Heidelberg (2005)
Frisch, A., Castagna, G., Benzaken, V.: Semantic subtyping. In: Proceedings of the ACM/IEEE Symposium on Logic In Computer Science (LICS), pp. 137–146 (2002)
Garey, M.R., Johnson, D.S.: Computers and intractability; a guide to the theory of NP-completeness. W.H. Freeman (1979)
Umans, C.: The minimum equivalent DNF problem and shortest implicants. Journal of Computer and System Sciences 63 (2001)
Buchfuhrer, D., Umans, C.: The complexity of boolean formula minimization. Journal of Computer and System Sciences 77(1), 142–153 (2011)
Pearce, D.J.: Sound and complete flow typing with unions, intersections and negations. Technical Report ECSTR12-20, Victoria University of Wellington (2012)
Goldberg, A.: A specification of Java loading and bytecode verification. In: Proc. CCS, pp. 49–58 (1998)
Pusch, C.: Proving the Soundness of a Java Bytecode Verifier Specification in Isabelle/HOL. In: Cleaveland, W.R. (ed.) TACAS 1999. LNCS, vol. 1579, pp. 89–103. Springer, Heidelberg (1999)
Büchi, M., Weck, W.: Compound types for java. In: Proceedings of the ACM conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), pp. 362–373 (1998)
Igarashi, A., Nagira, H.: Union types for object-oriented programming. In: Proceedings of the Symposium on Applied Computing (SAC), pp. 1435–1441 (2006)
Plümicke, M.: Intersection types in java. In: Proceedings of the Conference on Principles and Practices of Programming in Java (PPPJ), pp. 181–188. ACM, New York (2008)
Hosoya, H., Pierce, B.C.: XDuce: A statically typed XML processing language. ACM Transactions on Internet Technology 3(2), 117–148 (2003)
Benzaken, V., Castagna, G., Frisch, A.: CDuce: An XML-centric general-purpose language. In: Proceedings of the ACM International Conference on Functional Programming (ICFP), pp. 51–63 (2003)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Pearce, D.J. (2013). Sound and Complete Flow Typing with Unions, Intersections and Negations. In: Giacobazzi, R., Berdine, J., Mastroeni, I. (eds) Verification, Model Checking, and Abstract Interpretation. VMCAI 2013. Lecture Notes in Computer Science, vol 7737. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-35873-9_21
Download citation
DOI: https://doi.org/10.1007/978-3-642-35873-9_21
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-35872-2
Online ISBN: 978-3-642-35873-9
eBook Packages: Computer ScienceComputer Science (R0)