Nagoya Termination Tool
This paper describes the implementation and techniques of the Nagoya Termination Tool, a termination prover for term rewrite systems. The main features of the tool are: the first implementation of the weighted path order which subsumes most of the existing reduction pairs, and the efficiency due to the strong cooperation with external SMT solvers. We present some new ideas that contribute to the efficiency and power of the tool.
💡 Research Summary
The paper presents NaTT (Nagoya Termination Tool), a termination prover for term rewrite systems (TRSs) that combines a novel implementation of the Weighted Path Order (WPO) with tight integration of external SMT solvers. NaTT is built on the Dependency Pair (DP) framework, a well‑established method for proving termination by translating a TRS into a set of dependency pairs and then analyzing these pairs component‑wise. The tool implements four main processors: (1) an Estimated Dependency Graph (EDG) processor that approximates the dependency graph to obtain strongly connected components (SCCs); (2) a Reduction Pair processor that forms the core of the system; (3) a Rule Removal processor that eliminates weakly decreasing rules before DP construction; and (4) an Uncurrying processor that flattens higher‑order applications.
The Reduction Pair processor is the most innovative part. Instead of providing many separate reduction pairs (KBO, LPO, POLO, matrix interpretations, etc.), NaTT implements a single, highly configurable order: the Weighted Path Order. WPO is parameterised by three components: a weight algebra, a precedence function, and a status function. The weight algebra can be instantiated as a linear polynomial (POL), a max‑based interpretation (Max), or a hybrid (MPOL) that chooses between them based on the shape of the constraints. Templates introduce symbolic variables for coefficients, constants, and max‑offsets; these variables are solved by an SMT solver. The precedence can be strict or quasi, and the status can be total, partial, or empty, allowing fine‑grained control over argument filtering and permutation. By appropriately fixing template parameters, NaTT can emulate all classical reduction pairs, which means that implementing WPO automatically gives access to the other methods without extra code.
SMT interaction is a key performance driver. NaTT works with any SMT‑LIB 2.0‑compliant solver supporting at least quantifier‑free linear integer arithmetic (QF‑LIA); Z3 is the default. Constraints generated from the reduction‑pair conditions are encoded as SMT formulas of the form “for each rule l→r, l % r holds; for each dependency pair s→t, s % t holds; and for each strict pair s→t, s ≻ t holds.” Rather than rebuilding the whole formula for each SCC, NaTT uses the push/pop/reset commands to add or remove constraints incrementally. The solver is initialised once with the rule‑level constraints, then each SCC’s constraints are pushed, solved, and popped. If many rules become unusable, a reset is issued to keep the solver’s internal state manageable.
Because the POL and Max templates are inherently non‑linear (they involve products of coefficient variables and term weights), NaTT linearises them by restricting coefficients to {0,1} and replacing each coefficient with a Boolean variable via ite‑expressions. This transformation yields purely linear arithmetic, allowing fast solving with QF‑LIA solvers. The tool also offers an option to keep the non‑linear formulation and delegate it to solvers that support QF‑NIA, but experiments showed this to be impractical for the benchmark set.
Implementation details: NaTT consists of roughly 6 000 lines of OCaml code. About 40 % of the code implements the WPO engine, 23 % handles the SMT interface, 17 % deals with command‑line parsing and TRS input, and the remaining parts implement the auxiliary processors, each of which consumes less than 3 % of the total. SCC computation relies on the external ocamlgraph library.
The default strategy, used when no explicit processors are supplied, proceeds as follows: (1) apply POLO with coefficients {1,2} and natural‑number constants as a rule‑removal processor; (2) perform uncurrying; (3) sequentially apply POLO (coefficients {0,1}), Max, LPO with quasi‑precedence and argument filtering, MPOL, WPO (quasi‑precedence, partial status, MPOL), and finally matrix interpretations. This pipeline was evaluated on the Termination Problem Database (TPDB) and the 2014 Termination Competition. NaTT achieved higher success rates and lower runtimes than competing tools, demonstrating that a single, well‑tuned WPO implementation can subsume many traditional techniques while benefiting from efficient SMT solving.
In conclusion, the Nagoya Termination Tool showcases how a unified, parameterised order (WPO) combined with sophisticated SMT‑based constraint solving yields a powerful and efficient termination prover. The paper suggests future work on richer non‑linear algebras, more expressive precedence/status combinations, and deeper solver cooperation to further improve scalability for large‑scale rewrite systems.
Comments & Academic Discussion
Loading comments...
Leave a Comment