Third Order Matching is Decidable

Gilles Dowek
2023-06-02
Abstract:The higher order matching problem is the problem of determining whether a term is an instance of another in the simply typed $\lambda$-calculus, i.e. to solve the equation a = b where a and b are simply typed $\lambda$-terms and b is ground. The decidability of this problem is still open. We prove the decidability of the particular case in which the variables occurring in the problem are at most third order.
Logic in Computer Science
What problem does this paper attempt to address?
The problem that this paper attempts to solve is about a specific situation in high - order matching problems, namely the decidability of the third - order matching problem. Specifically: - **High - order matching problem** refers to determining whether a term is an instance of another term in simple type lambda calculus, that is, solving the equation \(a = b\), where \(a\) and \(b\) are lambda terms of simple types, and \(b\) is a ground term. - **Second - order matching problem** has been proven to be decidable, that is, there are algorithms that can determine whether there is a matching solution within a finite time. - The decidability of the **third - order matching problem** has not been proven before. ### Main contributions of the paper The author Gilles Dowek proved in this paper that the third - order matching problem is decidable, that is, provided an algorithm to determine whether a matching problem (where all variables are at most third - order) has a solution. Specifically, the author proved that if a matching problem \(a = b\) has a solution, then there also exists a solution whose depth is bounded by an integer \(s\) that only depends on the problem \(a = b\). By enumerating substitutions with a depth not exceeding \(s\), a decision algorithm can be designed. ### Key ideas 1. **Depth limitation**: If a matching problem \(a = b\) has a solution, then there also exists a solution whose depth is bounded by an integer \(s\) that only depends on the problem \(a = b\). 2. **Enumerating substitutions**: By enumerating substitutions with a depth not exceeding \(s\), a decision algorithm can be designed. 3. **Application to Huet's semi - decision algorithm**: This result can also be used to limit the depth of the search tree of Huet's semi - decision algorithm, thereby converting it into a decision algorithm that always terminates. 4. **Enumeration of the complete solution set**: An algorithm can be designed to enumerate the complete solution set of the third - order matching problem. If the problem has a finite complete solution set, it terminates; otherwise, it continues to enumerate. ### Main theorems and lemmas - **Key lemma**: When a variable \(y\) in a term \(u\) is replaced by a second - order term \(c\) and reduced, the depth of the new term is not less than the depth of the original term, unless \(c\) is an irrelevant term or \(|c| = 0\). - **Interpolation problem**: Consider equations of the form \((x\ c_1\...\ c_n)=b\), where \(x\) is an instantiable variable, and \(c_1,\...,\ c_n\) and \(b\) are ground terms. By dealing with these interpolation problems, a complete solution can be gradually constructed. ### Conclusion Through the above methods, the author successfully proved that the third - order matching problem is decidable and provided an effective algorithm for this problem. This result lays the foundation for further research on higher - order matching problems.