Deterministic Second-order Patterns in Program Transformation

Tetsuo Yokoyama,Zhenjiang Hu,Masato Takeichi
2003-01-01
Abstract:Abstract. Higher-order patterns, together with higher-order matching, enable concise specification of program transformation, and have been implemented in several program transformation systems. However, higher-order matching generally generates nondeterministic matches, and the matching algorithm is so expensive that even second-order matching is NP-complete. It is orthodox to impose constraint on the form of pat-terns so as to obtain the desirable matches satisfying certain properties such as decidability and finiteness. In the context of unification, Miller's higher-order patterns have a single most general unifier, while unification of general patterns is nondeterministic (and even undecidable). We re-lax the restriction of his patterns without changing determinism in the context of matching instead of unification. As a consequence, our deter-ministic second-order pattern covers a wide class of useful patterns for program transformation. Our deterministic matching algorithm is as fast as the first-order matching algorithm, almost in proportion to the size of the term.
What problem does this paper attempt to address?