Hostname: page-component-74656f9884-6grmk Total loading time: 0 Render date: 2026-11-05T22:17:43.808Z Has data issue: false hasContentIssue false

A (machine-oriented) logic based on pattern matching

Published online by Cambridge University Press:  05 July 2023

Tim Lethen*
Affiliation:
Department of Philosophy, University of Helsinki, Helsinki, Finland
Rights & Permissions [Opens in a new window]

Abstract

Robinson’s unification algorithm can be identified as the underlying machinery of both C. Meredith’s rule D (condensed detachment) in propositional logic and of the construction of principal types in lambda calculus and combinatory logic. In combinatory logic, it also plays a crucial role in the construction of Meyer, Bunder & Powers’ Fool’s model. This paper now considers pattern matching, the unidirectional variant of unification, as a basis for logical inference, typing, and a very simple and natural model for untyped combinatory logic. An analysis of the new typing scheme will enable us to characterize a large class of terms of combinatory logic which do not change their principal type when being weakly reduced. We also consider the question whether the major or the minor premisse should be used as the fixed pattern.

Information

Type
Paper
Copyright
© The Author(s), 2023. Published by Cambridge University Press
Figure 0

Figure 1. Rule $\mathbf{D}$ applied to the major premise $\alpha \rightarrow \beta = (a \rightarrow (b \rightarrow c)) \rightarrow ((a \rightarrow b) \rightarrow (a \rightarrow c))$ and the minor premise $\gamma = {p \rightarrow p}$, both represented as binary trees. The resulting formula is $\sigma(\beta) = ((b \rightarrow c) \rightarrow b) \rightarrow ((b \rightarrow c) \rightarrow c)$.

Figure 1

Figure 2. Assigning principal types to terms in CL.

Figure 2

Figure 3. A tree assigning the principal type ${(a \rightarrow a)}$ to the CL-term $\mathsf{S}\mathsf{K}\mathsf{K}$, using two applications of rule (pt). The substitution in the first step is $\left\lbrace a \!\leadsto\! p, b\!\leadsto\! q, c\!\leadsto\! p\right\rbrace$ and in the second step $\left\lbrace p \!\leadsto\! a, q\!\leadsto\! (b \rightarrow a)\right\rbrace $.

Figure 3

Algorithm 1 unify(α, β, σ)

Figure 4

Algorithm 2 unify-var(var, β, σ)

Figure 5

Algorithm 3 match(α, β, σ)

Figure 6

Algorithm 4 match-var(var, β, σ)

Figure 7

Figure 4. Rule $\mathbf{P}$ applied to the major premise $\alpha \rightarrow \beta = (a \rightarrow (b \rightarrow c)) \rightarrow (b \rightarrow (a \rightarrow c))$ and the minor premise $\gamma = {(p \rightarrow q) \rightarrow (p \rightarrow q)}$, both represented as binary trees. The resulting formula is $\sigma(\beta) = p \rightarrow ((p \rightarrow q) \rightarrow q)$. Note that the minor premise $\gamma$ remains in its fixed shape.