Abstract
This paper defines a new type system applied to the fully automatic verification of safety properties of tree-processing higher-order functional programs. We use term rewriting systems to model the program and its semantics and tree automata to model algebraic data types. We define the regular abstract interpretation of the input term rewriting system where the abstract domain is a set of regular languages. From the regular abstract interpretation we derive a type system where each type is a regular language. We define an inference procedure for this type system which allows us check the validity of safety properties. The inference mechanism is built on an invariant learning procedure based on the tree automata completion algorithm. This invariant learning procedure is regularly-complete and complete in refutation, meaning that if it is possible to give a regular type to a term then we will eventually find it, and if there is no possible type (regular or not) then we will eventually find a counter-example.
Supplemental Material
- Franz Baader and Tobias Nipkow. 1998. Term Rewriting and All That. Cambridge University Press.Google Scholar
Digital Library
- Achim Blumensath and Erich Grädel. 2000. Automatic Structures. In 15th Annual IEEE Symposium on Logic in Computer Science, Santa Barbara, California, USA, June 26-29, 2000. IEEE Computer Society, 51-62. https://doi.org/10.1109/LICS. 2000.855755 Google Scholar
Cross Ref
- Giuseppe Castagna, Kim Nguyen, Zhiwu Xu, Hyeonseung Im, Sergueï Lenglet, and Luca Padovani. 2014. Polymorphic functions with set-theoretic types: part 1: syntax, semantics, and evaluation. In The 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '14, San Diego, CA, USA, January 20-21, 2014, Suresh Jagannathan and Peter Sewell (Eds.). ACM, 5-18. https://doi.org/10.1145/2535838.2535840 Google Scholar
Digital Library
- Giuseppe Castagna, Tommaso Petrucciani, and Kim Nguyen. 2016. Set-theoretic types for polymorphic variants. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming, ICFP 2016, Nara, Japan, September 18-22, 2016, Jacques Garrigue, Gabriele Keller, and Eijiro Sumii (Eds.). ACM, 378-391. https://doi.org/10.1145/ 2951913.2951928 Google Scholar
Digital Library
- Adrien Champion, Tomoya Chiba, Naoki Kobayashi, and Ryosuke Sato. 2018. ICE-Based Refinement Type Discovery for Higher-Order Functional Programs. In Tools and Algorithms for the Construction and Analysis of Systems, Dirk Beyer and Marieke Huisman (Eds.). Springer International Publishing, Cham, 365-384.Google Scholar
- Koen Claessen, Moa Johansson, Dan Rosén, and Nicholas Smallbone. 2015. TIP: Tons of Inductive Problems. In Intelligent Computer Mathematics, Manfred Kerber, Jacques Carette, Cezary Kaliszyk, Florian Rabe, and Volker Sorge (Eds.). Springer International Publishing, Cham, 333-337.Google Scholar
- Edmund Clarke, Orna Grumberg, Somesh Jha, Yuan Lu, and Helmut Veith. 2000. Counterexample-Guided Abstraction Refinement. In Computer Aided Verification, E. Allen Emerson and Aravinda Prasad Sistla (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 154-169.Google Scholar
Cross Ref
- Hubert Comon, Max Dauchet, Rémi Gilleron, Christof Löding, Florent Jacquemard, Denis Lugiez, Sophie Tison, and Marc Tommasi. 2007. Tree Automata Techniques and Applications. Available on: http://tata.gforge.inria.fr/. release October, 12th 2007.Google Scholar
- Experiments. 2020. Experiments with Regular Language Type Inference. https://people.irisa.fr/Thomas.Genet/timbuk/ timbuk4/experiments.htmlGoogle Scholar
- Thomas Genet. 2016. Termination criteria for tree automata completion. J. Log. Algebraic Methods Program. 85, 1 ( 2016 ), 3-33. https://doi.org/10.1016/j.jlamp. 2015. 05.003 Google Scholar
Cross Ref
- Thomas Genet, Yohan Boichut, Benoît Boyer, Valérie Murat, and Yan Salmon. 2001. Reachability Analysis and Tree Automata Calculations. IRISA / Université de Rennes 1. http://people.irisa.fr/Thomas.Genet/timbuk/Google Scholar
- Thomas Genet, Timothée Haudebourg, and Thomas Jensen. 2018. Verifying Higher-Order Functions with Tree Automata. In Foundations of Software Science and Computation Structures, Christel Baier and Ugo Dal Lago (Eds.). Springer International Publishing, Cham, 565-582.Google Scholar
- Thomas Genet, Tristan Le Gall, Axel Legay, and Valérie Murat. 2013. A Completion Algorithm for Lattice Tree Automata. In Implementation and Application of Automata, Stavros Konstantinidis (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 134-145.Google Scholar
- Thomas Genet and Vlad Rusu. 2010. Equational approximations for tree automata completion. J. Symb. Comput. 45, 5 ( 2010 ), 574-597. https://doi.org/10.1016/j.jsc. 2010. 01.009 Google Scholar
Digital Library
- Timothée Haudebourg and Thomas Genet. 2020. Timbuk 4. https://gitlab.inria.fr/regular-pv/timbuk/timbukGoogle Scholar
- Timothée Haudebourg, Thomas Genet, and Thomas Jensen. 2020. Regular Language Type Inference with Term Rewriting-extended version. Technical Report. Univ Rennes, Inria, IRISA. https://hal.inria.fr/hal-02795484.Google Scholar
- J. Roger Hindley. 1969. The Principal Type-Scheme of an Object in Combinatory Logic. Trans. Amer. Math. Soc. 146 ( 1969 ), 29-60. http://www.jstor.org/stable/1995158Google Scholar
- Inria. 2016. The Coq proof assistant reference manual: Version 8.6. https://coq.inria.fr/distrib/current/files/ReferenceManual.pdfGoogle Scholar
- Thomas Johnsson. 1985. Lambda Lifting: Transforming Programs to Recursive Equations. In FPCA'85 (LNCS, Vol. 201 ). Springer, 190-203.Google Scholar
- Neil D. Jones. 1987. Flow analysis of lazy higher-order functional programs. In Abstract Interpretation of Declarative Languages, Samson Abramsky and Chris Hankin (Eds.). Ellis Horwood, 103-122.Google Scholar
- Neil D. Jones and Nils Andersen. 2007. Flow analysis of lazy higher-order functional programs. Theor. Comput. Sci. 375, 1-3 ( 2007 ), 120-136. https://doi.org/10.1016/j.tcs. 2006. 12.030 Google Scholar
Digital Library
- Richard Kennaway, Jan Willem Klop, M. Ronan Sleep, and Fer-Jan de Vries. 1996. Comparing Curried and Uncurried Rewriting. J. Symb. Comput. 21, 1 ( 1996 ), 15-39. https://doi.org/10.1006/jsco. 1996.0002 Google Scholar
Digital Library
- Bakhadyr Khoussainov and Anil Nerode. 1995. Automatic presentations of structures. In Logic and Computational Complexity, Daniel Leivant (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 367-392.Google Scholar
- Naoki Kobayashi. 2009. Types and higher-order recursion schemes for verification of higher-order programs. In Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, Savannah, GA, USA, January 21-23, 2009, Zhong Shao and Benjamin C. Pierce (Eds.). ACM, 416-428. https://doi.org/10.1145/1480881.1480933 Google Scholar
Digital Library
- Naoki Kobayashi, Ryosuke Sato, and Hiroshi Unno. 2011a. MoCHi: Model Checker for Higher-Order Programs. http://www-kb.is.s.u-tokyo.ac.jp/~ryosuke/mochi/Google Scholar
- Naoki Kobayashi, Ryosuke Sato, and Hiroshi Unno. 2011b. Predicate abstraction and CEGAR for higher-order model checking. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2011, San Jose, CA, USA, June 4-8, 2011, Mary W. Hall and David A. Padua (Eds.). ACM, 222-233. https://doi.org/10. 1145/1993498.1993525 Google Scholar
Digital Library
- Naoki Kobayashi, Naoshi Tabuchi, and Hiroshi Unno. 2010. Higher-order multi-parameter tree transducers and recursion schemes for program verification. In Proceedings of the 37th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2010, Madrid, Spain, January 17-23, 2010, Manuel V. Hermenegildo and Jens Palsberg (Eds.). ACM, 495-508. https://doi.org/10.1145/1706299.1706355 Google Scholar
Digital Library
- Tristan Le Gall and Bertrand Jeannet. 2007. Lattice Automata: A Representation for Languages on Infinite Alphabets, and Some Applications to Verification. In Static Analysis, Hanne Riis Nielson and Gilberto Filé (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 52-68.Google Scholar
- Yuma Matsumoto, Naoki Kobayashi, and Hiroshi Unno. 2015. Automata-Based Abstraction for Automated Verification of Higher-Order Tree-Processing Programs. In Programming Languages and Systems, Xinyu Feng and Sungwoo Park (Eds.). Springer International Publishing, Cham, 295-312.Google Scholar
- Microsoft Research and Inria. 2013. F*. https://www.fstar-lang.orgGoogle Scholar
- Robin Milner. 1978. A Theory of Type Polymorphism in Programming. J. Comput. Syst. Sci. 17, 3 ( 1978 ), 348-375. https://doi.org/10.1016/ 0022-0000 ( 78 ) 90014-4 Google Scholar
Cross Ref
- Tobias Nipkow, Lawrence C. Paulson, and Markus Wenzel. 2002. Isabelle/HOL-A Proof Assistant for Higher-Order Logic. LNCS, Vol. 2283. Springer.Google Scholar
- C.-H. Luke Ong. 2006. On Model-Checking Trees Generated by Higher-Order Recursion Schemes. In 21th IEEE Symposium on Logic in Computer Science (LICS 2006 ), 12-15 August 2006, Seattle, WA, USA, Proceedings. IEEE Computer Society, 81-90. https://doi.org/10.1109/LICS. 2006.38 Google Scholar
Digital Library
- C.-H. Luke Ong and Steven J. Ramsay. 2011. Verifying higher-order functional programs with pattern-matching algebraic data types. In Proceedings of the 38th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2011, Austin, TX, USA, January 26-28, 2011, Thomas Ball and Mooly Sagiv (Eds.). ACM, 587-598. https://doi.org/10.1145/ 1926385.1926453 Google Scholar
Digital Library
- John Reynolds. 1969. Automatic Computation of Data Set Definitions. Information Processing 68 ( 1969 ), 456-461.Google Scholar
- Simona Ronchi Della Rocca. 1988. Principal type scheme and unification for intersection type discipline. Theoretical Computer Science 59 ( 1988 ).Google Scholar
- Patrick Maxim Rondon, Ming Kawaguchi, and Ranjit Jhala. 2008. Liquid types. In Proceedings of the ACM SIGPLAN 2008 Conference on Programming Language Design and Implementation, Tucson, AZ, USA, June 7-13, 2008, Rajiv Gupta and Saman P. Amarasinghe (Eds.). ACM, 159-169. https://doi.org/10.1145/1375581.1375602 Google Scholar
Digital Library
- Ryosuke Sato and Naoki Kobayashi. 2017. Modular Verification of Higher-Order Functional Programs. In Programming Languages and Systems, Hongseok Yang (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 831-854.Google Scholar
- Niki Vazou. 2016. Liquid Haskell: Haskell as a Theorem Prover. Ph.D. Dissertation. University of California, San Diego, USA.Google Scholar
- Niki Vazou, Alexander Bakst, and Ranjit Jhala. 2015. Bounded refinement types. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming, ICFP 2015, Vancouver, BC, Canada, September 1-3, 2015, Kathleen Fisher and John H. Reppy (Eds.). ACM, 48-61. https://doi.org/10.1145/2784731.2784745 Google Scholar
Digital Library
- Niki Vazou, Patrick M. Rondon, and Ranjit Jhala. 2013. Abstract Refinement Types. In Programming Languages and Systems, Matthias Felleisen and Philippa Gardner (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 209-228.Google Scholar
- Niki Vazou, Eric L. Seidel, and Ranjit Jhala. 2014. LiquidHaskell: experience with refinement types in the real world. In Proceedings of the 2014 ACM SIGPLAN symposium on Haskell, Gothenburg, Sweden, September 4-5, 2014, Wouter Swierstra (Ed.). ACM, 39-51. https://doi.org/10.1145/2633357.2633366 Google Scholar
Digital Library
Index Terms
Regular language type inference with term rewriting
Recommendations
Regular Language Representations in the Constructive Type Theory of Coq
We explore the theory of regular language representations in the constructive type theory of Coq. We cover various forms of automata (deterministic, nondeterministic, one-way, two-way), regular expressions, and the logic WS1S. We give translations ...
Type checking and inference for polymorphic and existential types
CATS '09: Proceedings of the Fifteenth Australasian Symposium on Computing: The Australasian Theory - Volume 94This paper proves undecidability of type checking and type inference problems in some variants of typed lambda calculi with polymorphic and existential types. First, type inference in the domain-free polymorphic lambda calculus is proved to be ...
Type Inference for Recursive Definitions
LICS '99: Proceedings of the 14th Annual IEEE Symposium on Logic in Computer ScienceWe consider type systems that combine universal types, recursive types, and object types. We study type inference in these systems under a rank restriction, following Leivant's notion of rank. To motivate our work, we present several examples showing ...






Comments