Abstract
The precision of a static analysis can be improved by increasing the context-sensitivity of the analysis. In a type-based formulation of static analysis for functional languages this can be achieved by, e.g., introducing let-polyvariance or subtyping. In this paper we go one step further by defining a higher-ranked polyvariant type system so that even properties of lambda-bound identifiers can be generalized over. We do this for dependency analysis, a generic analysis that can be instantiated to a range of different analyses that in this way all can profit.
We prove that our analysis is sound with respect to a call-by-name semantics and that it satisfies a so-called noninterference property. We provide a type reconstruction algorithm that we have proven to be terminating, and sound and complete with respect to its declarative specification. Our principled description can serve as a blueprint for making other analyses higher-ranked.
Contributor Information
Peter Müller, Email: peter.mueller@inf.ethz.ch.
Fabian Thorand, Email: f.thorand@gmail.com.
Jurriaan Hage, Email: j.hage@uu.nl.
References
- 1.Abadi, M., Banerjee, A., Heintze, N., Riecke, J.G.: A core calculus of dependency. In: Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL ’99. Association for Computing Machinery (ACM) (1999). 10.1145/292540.292555
- 2.Algehed, M., Russo, A.: Encoding dcc in haskell. In: Proceedings of the 2017 Workshop on Programming Languages and Analysis for Security. pp. 77–89. PLAS ’17, ACM, New York, NY, USA (2017). 10.1145/3139337.3139338
- 3.Damas, L., Milner, R.: Principal type-schemes for functional programs. In: Proceedings of the 9th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL ’82. Association for Computing Machinery (ACM) (1982). 10.1145/582153.582176
- 4.Dowek, G.: Handbook of automated reasoning. chap. Higher-order Unification and Matching, pp. 1009–1062. Elsevier Science Publishers B. V., Amsterdam, The Netherlands (2001), http://dl.acm.org/citation.cfm?id=778522.778525
- 5.Dussart, D., Henglein, F., Mossin, C.: Polymorphic recursion and subtype qualifications: Polymorphic binding-time analysis in polynomial time. In: Static Analysis, pp. 118–135. Springer Nature (1995). 10.1007/3-540-60360-3_36
- 6.Foster, J.N., Greenwald, M.B., Moore, J.T., Pierce, B.C., Schmitt, A.: Combinators for bidirectional tree transformations: A linguistic approach to the view-update problem. ACM Trans. Program. Lang. Syst. 29(3) (May 2007). 10.1145/1232420.1232424
- 7.Glynn, K., Stuckey, P.J., Sulzmann, M., Söndergaard, H.: Boolean constraints for binding-time analysis. In: PADO ’01: Proceedings of the Second Symposium on Programs as Data Objects. pp. 39–62. Springer-Verlag, London, UK (2001)
- 8.Goguen, J.A., Meseguer, J.: Security policies and security models. In: 1982 IEEE Symposium on Security and Privacy. pp. 11–11 (April 1982). 10.1109/SP.1982.10014
- 9.Heintze, N., Riecke, J.G.: The SLam calculus. In: Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL ’98. Association for Computing Machinery (ACM) (1998). 10.1145/268946.268976
- 10.Henglein, F.: Type inference with polymorphic recursion. ACM Transactions on Programming Languages and Systems 15(2), 253–289 (4 1993). 10.1145/169701.169692
- 11.Hoffmann, J., Das, A., Weng, S.C.: Towards automatic resource bound analysis for ocaml. In: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. pp. 359–373. POPL 2017, ACM, New York, NY, USA (2017). 10.1145/3009837.3009842
- 12.Holdermans, S., Hage, J.: Polyvariant flow analysis with higher-ranked polymorphic types and higher-order effect operators. In: Proceedings of the 15th ACM SIGPLAN international conference on Functional programming - ICFP ’10. Association for Computing Machinery (ACM) (2010). 10.1145/1863543.1863554
- 13.Jones, S.P., Vytiniotis, D., Weirich, S., Shields, M.: Practical type inference for arbitrary-rank types. Journal of Functional Programming 17(1), 1–82 (2007). 10.1017/S0956796806006034
- 14.Kfoury, A., Tiuryn, J.: Type reconstruction in finite rank fragments of the second-order -calculus. Information and Computation 98(2), 228–257 (6 1992). 10.1016/0890-5401(92)90020-g
- 15.Kmett, E.: The lens library (2018), http://lens.github.io/, consulted 9/7/2018
- 16.Koot, R.: Higher-ranked exception types (2015), https://github.com/ruudkoot/phd/tree/master/higher-ranked-exception-types, accessed 2018–03-09
- 17.Koot, R., Hage, J.: Type-based exception analysis for non-strict higher-order functional languages with imprecise exception semantics. In: Proceedings of the 2015 Workshop on Partial Evaluation and Program Manipulation - PEPM ’15. Association for Computing Machinery (ACM) (2015). 10.1145/2678015.2682542
- 18.Lourenço, L., Caires, L.: Dependent information flow types. In: Proceedings of the 42Nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. pp. 317–328. POPL ’15, ACM, New York, NY, USA (2015). 10.1145/2676726.2676994
- 19.Lucassen, J.M., Gifford, D.K.: Polymorphic effect systems. In: POPL ’88: Proceedings of the 15th ACM SIGPLAN-SIGACT symposium on Principles of programming languages. pp. 47–57. ACM, New York, NY, USA (1988). 10.1145/73560.73564
- 20.McLean, J.: Security Models. Wiley Press (1994). 10.1002/0471028959
- 21.Miller, D.: A logic programming language with lambda-abstraction, function variables, and simple unification. In: Extensions of Logic Programming, pp. 253–281. Springer Nature (1991). 10.1007/bfb0038698
- 22.Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17(3), 348–375 (12 1978). 10.1016/0022-0000(78)90014-4
- 23.Mycroft, A.: Polymorphic type schemes and recursive definitions. In: Lecture Notes in Computer Science, pp. 217–228. Springer Nature (1984). 10.1007/3-540-12925-1_41
- 24.Nielson, F., Nielson, H., Hankin, C.: Principles of Program Analysis. Springer Verlag, second printing edn. (2005)
- 25.Pottier, F., Simonet, V.: Information flow inference for ml. ACM Trans. Program. Lang. Syst. 25(1), 117–158 (2003). 10.1145/596980.596983
- 26.Thorand, F., Hage, J.: Addendum with proofs, definitions and examples for the esop 2020 paper, higher-ranked annotation polymorphic dependency analysis, http://www.staff.science.uu.nl/~hage0101/downloads/hrp-addendum.pdf
- 27.Tip, F.: A survey of program slicing techniques. Tech. rep., Amsterdam, The Netherlands, The Netherlands (1994)
- 28.Wansbrough, K., Jones, S.P.: Once upon a polymorphic type. In: Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL ’99. Association for Computing Machinery (ACM) (1999). 10.1145/292540.292545
- 29.Zhang, G.: Binding-Time Analysis: Subtyping versus Subeffecting. Msc thesis (2008), http://people.cs.uu.nl/jur/downloads/guangyuzhang-msc.pdf
