🤖 AI Summary
This work addresses the challenge of static verification for higher-order programs in Constraint Logic Programming (C)LP. We present the first framework enabling compile-time verification of higher-order assertions. Our method extends the assertion language to formally specify higher-order parameters, establishes a predicate-based semantic model for higher-order assertions—defining a semantic ordering among properties to ensure consistency—and employs abstract interpretation combined with syntactic-semantic restructuring to safely reduce higher-order properties to first-order ones, thereby enabling decidable static analysis. Implemented as a prototype on the Ciao platform, our approach is validated on multiple real-world higher-order (C)LP programs. Results demonstrate both theoretical soundness and practical effectiveness, significantly enhancing correctness guarantees for higher-order (C)LP programs.
📝 Abstract
Higher-order constructs enable more expressive and concise code by allowing procedures to be parameterized by other procedures. Assertions allow expressing partial program specifications, which can be verified either at compile time (statically) or run time (dynamically). In higher-order programs, assertions can also describe higher-order arguments. While in the context of (C)LP, run-time verification of higher-order assertions has received some attention, compile-time verification remains relatively unexplored. We propose a novel approach for statically verifying higher-order (C)LP programs with higher-order assertions. Although we use the Ciao assertion language for illustration, our approach is quite general and we believe is applicable to similar contexts. Higher-order arguments are described using predicate properties -- a special kind of property which exploits the (Ciao) assertion language. We refine the syntax and semantics of these properties and introduce an abstract criterion to determine conformance to a predicate property at compile time, based on a semantic order relation comparing the predicate property with the predicate assertions. We then show how to handle these properties using an abstract interpretation-based static analyzer for programs with first-order assertions by reducing predicate properties to first-order properties. Finally, we report on a prototype implementation and evaluate it through various examples within the Ciao system.