A Formalization of the Semantics of Functional-Logic Programming in Isabelle
Modern functional-logic programming languages like Toy or Curry feature non-strict non-deterministic functions that behave under call-time choice semantics. A standard formulation for this semantics is the CRWL logic, that specifies a proof calculus for computing the set of possible results for each expression. In this paper we present a formalization of that calculus in the Isabelle/HOL proof assistant. We have proved some basic properties of CRWL: closedness under c-substitutions, polarity and compositionality. We also discuss some insights that have been gained, such as the fact that left linearity of program rules is not needed for any of these results to hold.
💡 Research Summary
The paper presents a rigorous formalization of the CRWL (Constructive ReWriting Logic) semantics for functional‑logic programming languages such as Toy and Curry within the Isabelle/HOL proof assistant. Functional‑logic languages combine higher‑order functions with non‑deterministic logic programming features, and they typically adopt a call‑time choice evaluation strategy: when a non‑deterministic function argument is shared, the same choice must be used throughout the computation. CRWL provides a proof calculus that captures exactly the set of possible results for any expression under this strategy.
The authors first translate the syntactic components of CRWL—expressions, program rules, and the special notion of c‑substitutions (substitutions that may map variables to partial values)—into Isabelle’s type system. They then encode the three core inference rules of CRWL (basic values, rewriting, and choice) as Isabelle definitions and develop proof tactics that automate reasoning about them.
With this formal foundation, the paper proves three fundamental meta‑properties of CRWL inside Isabelle:
-
Closedness under c‑substitutions – applying a c‑substitution to an expression and then performing CRWL derivations yields exactly the same result set as first deriving the original expression’s results and then applying the substitution. This guarantees that shared non‑deterministic choices remain consistent after substitution.
-
Polarity – if expression e₁ is more instantiated (i.e., a refinement) of expression e₂, then the set of results derivable from e₁ is a subset of those derivable from e₂. This monotonicity property underpins partial evaluation and various optimisation techniques.
-
Compositionality – the meaning of a compound expression built from a context C and sub‑expressions e₁,…,eₙ is completely determined by the meanings of the sub‑expressions. Consequently, the semantics of a whole program can be assembled from the semantics of its modules, supporting modular reasoning and reuse.
A notable insight emerges during the Isabelle proofs: the usual assumption of left‑linearity (no variable appears more than once on the left‑hand side of a rule) is unnecessary for any of the above properties. By removing this restriction, the authors show that CRWL’s meta‑theory holds for non‑linear rules as well, thereby broadening the class of admissible program specifications.
The paper also reflects on practical lessons learned while encoding CRWL in Isabelle. Precise modelling of substitution propagation proved essential, and structuring proof scripts into reusable tactics greatly improved maintainability and facilitated future extensions. The authors suggest that the formalisation can serve as a solid basis for further work such as automated verification of functional‑logic programs, static analysis tools, or the design of new languages that extend CRWL with additional features (e.g., concurrency or probabilistic choice).
In summary, the work delivers a complete Isabelle/HOL formalisation of CRWL, validates its key semantic properties mechanically, and demonstrates that left‑linearity is not a prerequisite for these results. This contribution strengthens the theoretical foundations of functional‑logic programming and provides a practical, machine‑checked framework for future research and tool development in the area.
Comments & Academic Discussion
Loading comments...
Leave a Comment