Inferring Non-Failure Conditions for Declarative Programs
Abstract: Unintended failures during a computation are painful but frequent during software development. Failures due to external reasons (e.g., missing files, no permissions) can be caught by exception handlers. Programming failures, such as calling a partially defined operation with unintended arguments, are often not caught due to the assumption that the software is correct. This paper presents an approach to verify such assumptions. For this purpose, non-failure conditions for operations are inferred and then checked in all uses of partially defined operations. In the positive case, the absence of such failures is ensured. In the negative case, the programmer could adapt the program to handle possibly failing situations and check the program again. Our method is fully automatic and can be applied to larger declarative programs. The results of an implementation for functional logic Curry programs are presented.
- Operational semantics for declarative multi-paradigm languages. Journal of Symbolic Computation, 40(1):795–829, 2005.
- Abstract diagnosis of functional programs. In Proc. of the 12th Int’l Workshop on Logic-Based Program Synthesis and Transformation (LOPSTR 2002), pages 1–16. Springer LNCS 2664, 2002.
- S. Antoy. Constructor-based conditional narrowing. In Proc. of the 3rd International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP 2001), pages 199–206. ACM Press, 2001.
- A needed narrowing strategy. Journal of the ACM, 47(4):776–822, 2000.
- S. Antoy and M. Hanus. Set functions for functional logic programming. In Proceedings of the 11th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP’09), pages 73–82. ACM Press, 2009.
- S. Antoy and M. Hanus. Functional logic programming. Communications of the ACM, 53(4):74–85, 2010.
- ICurry. In Declarative Programming and Knowledge Management - Conference on Declarative Programming (DECLARE 2019), pages 286–307. Springer LNCS 12057, 2020.
- D. Bert and R. Echahed. Abstraction of conditional term rewriting systems. In Proc. of the 1995 International Logic Programming Symposium, pages 147–161. MIT Press, 1995.
- Abstract rewriting. In Proc. Third International Workshop on Static Analysis, pages 178–192. Springer LNCS 724, 1993.
- Y. Bertot and P. Castéran. Interactive Theorem Proving and Program Development - Coq’Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2004.
- E. Brady. Idris, a general-purpose dependently typed programming language: Design and implementation. Journal of Functional Programming, 23(5):552–593, 2013.
- Encapsulating non-determinism in functional logic computations. Journal of Functional and Logic Programming, 2004(6), 2004.
- Multivariant non-failure analysis via standard abstract interpretation. In 7th International Symposium on Functional and Logic Programming (FLOPS 2004), pages 100–116. Springer LNCS 2998, 2004.
- P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction of approximation of fixpoints. In Proc. of the 4th ACM Symposium on Principles of Programming Languages, pages 238–252, 1977.
- P.W. Dart and J. Zobel. A regular type language for logic programs. In F. Pfenning, editor, Types in Logic Programming, pages 157–187. MIT Press, 1992.
- L. de Moura and N. Bjørner. Z3: An efficient SMT solver. In Proc. of the 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS 2008), pages 337–340. Springer LNCS 4963, 2008.
- Non-failure analysis for logic programs. In 14th International Conference on Logic Programming (ICLP’97), pages 48–62. MIT Press, 1997.
- Abstract domains based on regular types. In 20th International Conference on Logic Programming (ICLP 2004), pages 27–42. Springer LNCS 3132, 2004.
- An approach to declarative programming based on a rewriting logic. Journal of Logic Programming, 40:47–87, 1999.
- M. Hanus. Functional logic programming: From theory to Curry. In Programming Logics - Essays in Memory of Harald Ganzinger, pages 123–168. Springer LNCS 7797, 2013.
- M. Hanus. Verifying fail-free declarative programs. In Proceedings of the 20th International Symposium on Principles and Practice of Declarative Programming(PPDP 2018), pages 12:1–12:13. ACM Press, 2018.
- M. Hanus. Combining static and dynamic contract checking for Curry. Fundamenta Informaticae, 173(4):285–314, 2020.
- M. Hanus. From logic to functional logic programs. Theory and Practice of Logic Programming, 22(4):538–554, 2022.
- M. Hanus and F. Skrlac. A modular and generic analysis server system for functional logic programs. In Proc. of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation (PEPM’14), pages 181–188. ACM Press, 2014.
- M. Hanus (ed.). Curry: An integrated functional logic language (vers. 0.9.0). Available at http://www.curry-lang.org, 2016.
- HMC: verifying functional programs using abstract interpreters. In 23rd International Conference on Computer Aided Verification (CAV 2011), pages 470–485. Springer LNCS 6806, 2011.
- T. Lindahl and K. Sagonas. Practical type inference based on success typings. In Proceedings of the 8th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP 2006), pages 167–178. ACM Press, 2006.
- F.J. López-Fraguas and J. Sánchez-Hernández. A proof theoretic approach to failure in functional logic programming. Theory and Practice of Logic Programming, 4(1):41–74, 2004.
- W. Lux. Implementing encapsulated search for a lazy functional logic language. In Proc. 4th Fuji International Symposium on Functional and Logic Programming (FLOPS’99), pages 100–113. Springer LNCS 1722, 1999.
- B. Meyer. Ending null pointer crashes. Communications of the ACM, 60(5):8–9, 2017.
- R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348–375, 1978.
- N. Mitchell and C. Runciman. A static checker for safe pattern matching in Haskell. In Trends in Functional Programming, volume 6, pages 15–30. Intellect, 2007.
- N. Mitchell and C. Runciman. Not all patterns, but enough: an automatic verifier for partial but sufficient pattern matching. In Proc. of the 1st ACM SIGPLAN Symposium on Haskell (Haskell 2008), pages 49–60. ACM, 2008.
- U. Norell. Dependently typed programming in Agda. In Proceedings of the 6th International School on Advanced Functional Programming (AFP’08), pages 230–266. Springer LNCS 5832, 2008.
- S. Peyton Jones, editor. Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press, 2003.
- T. Sato and H. Tamaki. Enumeration of success patterns in logic programs. Theoretical Computer Science, 34:227–240, 1984.
- A. Stump. Verified Functional Programming in Agda. ACM and Morgan & Claypool, 2016.
- LiquidHaskell: Experience with refinement types in the real world. In Proceedings of the 2014 ACM SIGPLAN Symposium on Haskell, pages 39–51. ACM Press, 2014.
- Refinement types for Haskell. In Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming (ICFP), pages 269–282. ACM Press, 2014.
Paper Prompts
Sign up for free to create and run prompts on this paper using GPT-5.
Top Community Prompts
Collections
Sign up for free to add this paper to one or more collections.