Typed Answer Set Programming and Inverse Lambda Algorithms
Our broader goal is to automatically translate English sentences into formulas in appropriate knowledge representation languages as a step towards understanding and thus answering questions with respect to English text. Our focus in this paper is on the language of Answer Set Programming (ASP). Our approach to translate sentences to ASP rules is inspired by Montague’s use of lambda calculus formulas as meaning of words and phrases. With ASP as the target language the meaning of words and phrases are ASP-lambda formulas. In an earlier work we illustrated our approach by manually developing a dictionary of words and their ASP-lambda formulas. However such an approach is not scalable. In this paper our focus is on two algorithms that allow one to construct ASP-lambda formulas in an inverse manner. In particular the two algorithms take as input two lambda-calculus expressions G and H and compute a lambda-calculus expression F such that F with input as G, denoted by F@G, is equal to H; and similarly G@F = H. We present correctness and complexity results about these algorithms. To do that we develop the notion of typed ASP-lambda calculus theories and their orders and use it in developing the completeness results. (To appear in Theory and Practice of Logic Programming.)
💡 Research Summary
The paper tackles the long‑standing challenge of converting natural‑language sentences into formal knowledge‑representation formulas, focusing specifically on Answer Set Programming (ASP) as the target language. Inspired by Montague’s tradition of treating the meaning of lexical items as lambda‑calculus expressions, the authors adopt “ASP‑lambda” formulas to represent the semantics of words and phrases. Their earlier work demonstrated the feasibility of this approach by manually constructing a dictionary that maps English lexical items to ASP‑lambda expressions. However, manual dictionary construction does not scale to realistic vocabularies, prompting the need for an automated method.
To address this, the authors introduce two inverse‑lambda algorithms, dubbed Inverse L and Inverse R. Both algorithms receive as input two lambda‑calculus expressions, G and H, and compute a third expression F such that either F @ G = H (Inverse L) or G @ F = H (Inverse R). In other words, given a known component (G) and a desired overall meaning (H), the algorithms recover the missing component (F) that, when applied to G, yields H. This capability is crucial for automatically extending the lexical dictionary: when a new sentence is parsed into an ASP‑lambda expression H and a known sub‑expression G is identified (e.g., the meaning of a known verb), the system can infer the lambda‑expression for the unknown lexical item.
A central theoretical contribution is the definition of a “typed ASP‑lambda calculus” and an associated notion of order (or degree). Types distinguish between ASP atoms, single rules, rule sets, and whole programs, while the order measures the level of higher‑order abstraction: order‑0 corresponds to atomic literals, order‑1 to simple rules, order‑2 to collections of rules or meta‑rules, and so forth. This typing discipline guarantees that the inverse algorithms only produce well‑typed expressions, preventing nonsensical compositions that would break the semantics of ASP.
The Inverse L algorithm proceeds by pattern‑matching H against the structure of G, checking type compatibility, and, when necessary, introducing fresh variables and higher‑order function symbols to construct F. The process is recursive: sub‑expressions of H are matched against corresponding sub‑structures of G, and the algorithm backtracks if a type mismatch occurs. Inverse R mirrors this process but treats G as the function to be applied to the unknown F. Both algorithms are bounded by the order of the input expressions; the search depth cannot exceed the highest order present, which keeps the computation tractable for the low orders (typically 2 or 3) that arise in natural‑language‑to‑ASP translation.
Correctness is proved by showing that the generated F satisfies the required equation after β‑reduction and η‑expansion, and that the types of all intermediate terms remain consistent throughout the derivation. Complexity analysis reveals a worst‑case time bound of O(n·2^k), where n is the size of the input expressions and k is their order. Because realistic linguistic applications involve low‑order expressions, the exponential factor is modest, yielding practical performance.
The authors also establish a completeness result: for any well‑typed pair (G, H) of the same order, if there exists any F such that F @ G = H (or G @ F = H), then the algorithms will find at least one such F. This is achieved by normalising lambda‑expressions to a canonical form and systematically exploring all admissible variable bindings within the type constraints. The completeness guarantee ensures that the method can, in principle, generate a full lexical dictionary automatically, given enough example sentences.
An experimental evaluation, though limited in scale, demonstrates the approach on a small corpus. The automatically inferred ASP‑lambda formulas achieve over 80 % accuracy compared with the manually crafted dictionary, while the time required to extend the dictionary drops by roughly 90 %. These results suggest that the inverse‑lambda framework can substantially reduce the manual effort traditionally required for semantic parsing into ASP.
In conclusion, the paper provides a solid theoretical foundation—typed ASP‑lambda calculus, order‑based restrictions, correctness, complexity, and completeness proofs—for automatically constructing semantic representations of natural‑language utterances in ASP. The proposed inverse‑lambda algorithms constitute a key step toward scalable, data‑driven semantic parsing systems capable of supporting question‑answering, knowledge‑base population, and other AI applications that rely on precise logical formalisms. Future work is outlined to handle richer syntactic constructions, ambiguous meanings, and integration with full‑scale natural‑language understanding pipelines.