Building on the successes of satisfiability modulo theories (SMT), Bj{\o}rner et al. initiated a research programme advocating Horn constraints as a suitable basis for automatic program verification. The notion of first-order constrained Horn clauses has recently been extended to higher-order logic by Cathcart Burn et al. To exploit the remarkable efficiency of SMT solving, a natural approach to solve systems of higher-order Horn constraints is to reduce them to systems of first-order Horn constraints. This paper presents a defunctionalization algorithm to achieve the reduction. Given a well-sorted higher-order constrained Horn clause (HoCHC) problem instance, the defunctionalization algorithm constructs a first-order well-sorted constrained Horn clause problem. In addition to well-sortedness of the algorithm's output, we prove that if an input HoCHC is solvable, then the result of its defunctionalization is solvable. The converse also holds, which we prove using a recent result on the continuous semantics of HoCHC. To our knowledge, this defunctionalization algorithm is the first sound and complete reduction from systems of higher-order Horn constraints to systems of first-order Horn constraints. We have constructed DefMono, a prototype implementation of the defunctionalization algorithm. It first defunctionalizes an input HoCHC problem and then feeds the result into a backend SMT solver. We have evaluated the performance of DefMono empirically by comparison with two other higher-order verification tools.
[1]
François Pottier,et al.
Polymorphic typed defunctionalization
,
2004,
POPL.
[2]
Nikolaj Bjørner,et al.
Program Verification as Satisfiability Modulo Theories
,
2013,
SMT@IJCAR.
[3]
Nikolaj Bjørner,et al.
Higher-order Program Verification as Satisfiability Modulo Theories with Algebraic Data-types
,
2013,
ArXiv.
[4]
Andrew William Roscoe,et al.
The Theory and Practice of Concurrency
,
1997
.
[5]
John C. Reynolds,et al.
Definitional Interpreters for Higher-Order Programming Languages
,
1972,
ACM '72.
[6]
James Hook,et al.
Type-driven defunctionalization
,
1997,
ICFP '97.
[7]
John Wylie Lloyd,et al.
Foundations of Logic Programming
,
1987,
Symbolic Computation.
[8]
Naoki Kobayashi,et al.
Predicate abstraction and CEGAR for higher-order model checking
,
2011,
PLDI '11.
[9]
C.-H. Luke Ong,et al.
Higher-order constrained horn clauses for verification
,
2018,
Proc. ACM Program. Lang..
[10]
Christopher John Hogger,et al.
Essentials of logic programming
,
1990
.
[11]
Bernhard Beckert,et al.
Reasoning and Verification: State of the Art and Current Trends
,
2014,
IEEE Intelligent Systems.
[12]
Nikolaj Bjørner,et al.
Horn Clause Solvers for Program Verification
,
2015,
Fields of Logic and Computation II.
[13]
Naoki Kobayashi,et al.
Automating relatively complete verification of higher-order functional programs
,
2013,
POPL.