Learning Disjunctions of Predicates

Nader H. Bshouty, Dana Drachsler-Cohen, Martin T. Vechev, Eran Yahav

Authors: Nader H. Bshouty, Dana Drachsler-Cohen, Martin Vechev, Eran Yahav

Abstract

This paper introduces SPEX (Specifications from Examples), an efficient algorithm designed to learn complex boolean formulas—specifically disjunctions or conjunctions of predicates—by interacting with a "teacher" through a limited number of membership queries. In the context of program synthesis, where user intent is often under-specified, SPEX provides a structured way to converge on a target function. The authors demonstrate that for significant predicate classes, such as halfspaces in constant dimensions and variable inequalities, SPEX operates in polynomial time, bridging the gap between theoretical learning models and practical interactive synthesis tools.

Introduction: The Under-specification Problem

Program synthesis aims to automatically generate code that satisfies a user's requirements. A common paradigm is Programming by Example (PBE), where users provide input-output pairs. However, a small set of examples is rarely sufficient to uniquely identify a complex target program, leading to the "under-specification" problem. To resolve this, synthesizers can employ membership queries, asking the user whether a specific input $X$ should produce output $Y$. The fundamental challenge is to minimize the number of such queries while ensuring the learned program is correct.

This research formalizes the task as learning a target function $F$ that is a disjunction (OR) of predicates from a predefined set $\mathcal{F}$. By framing the search space as a structured partial order, the authors develop an algorithm that efficiently prunes incorrect hypotheses.

The SPEX Algorithm

The core of the SPEX algorithm is its utilization of a Hasse diagram, which represents the partial ordering of boolean functions based on logical implication. The algorithm traverses this diagram from the most general function ("top") toward the zero function ("bottom").

The SPEX algorithm for learning a target function F using membership queries.

SPEX operates through several key mechanisms:

  • Partial Order Traversal: It starts with the most general hypothesis and iteratively refines it.
  • Witnesses: To distinguish between a function $G$ and its descendant $G'$, the algorithm finds a "witness" $a$—an input point where $G(a) \neq G'(a)$. This point is used for a membership query.
  • Pruning: If the user (teacher) indicates $F(a) = 0$, the algorithm knows the target function cannot be $G'$ or any of its descendants, allowing it to prune large sections of the search space.
  • Immediate Descendants: The efficiency of the traversal depends on finding "immediate descendants" in the Hasse diagram. The authors provide sub-procedures GetImmDe and GetAllImmDe to handle this task.
Sub-procedures GetImmDe and GetAllImmDe used by SPEX to navigate the Hasse diagram.

Theoretical Analysis and Complexity

The paper provides rigorous bounds on the query complexity and runtime of SPEX. The number of queries is bounded by $|\mathcal{F}| \cdot \text{OPT}(\mathcal{F}_\vee)$, where $\text{OPT}$ is the theoretical minimum number of queries required in the worst case.

Specific results for predicate classes include:

  • Halfspaces: For linear inequalities in a constant dimension $d$, SPEX runs in $|\mathcal{F}|^{O(d)}$ time. The authors prove that learning disjunctions of halfspaces in non-constant dimensions is NP-hard, establishing a clear theoretical boundary for efficiency.
  • Variable Inequalities: For acyclic sets of inequalities (e.g., $x_i > x_j$), SPEX learns the target function in polynomial time using at most $|I|$ queries, where $I$ is the set of possible inequalities.

Practical Application: AmiBroker Case Study

To demonstrate practical utility, SPEX was implemented within a synthesizer for the AmiBroker trading platform. The goal was to learn technical analysis patterns in financial time-series data, such as the "Head and Shoulders" pattern. In this setting, membership queries are visualized: the system presents a chart snippet to the user and asks if it contains the pattern of interest. This application highlights how abstract boolean learning can be translated into intuitive human-computer interaction.

Conclusion

SPEX offers a robust framework for interactive program synthesis by transforming the search for boolean formulas into a structured diagram traversal. While it faces challenges in high-dimensional spaces and with noisy user feedback, its polynomial-time guarantees for constant-dimensional halfspaces and variable inequalities make it a significant advancement in the field of automated specification discovery. Future research will likely focus on increasing robustness to human error and extending the algorithm to more complex predicate structures.

Summary updated

BibTeX
@inproceedings{bshouty2017learning,
  author = {Nader H. Bshouty and Dana Drachsler-Cohen and Martin T. Vechev and Eran Yahav},
  title = {{Learning Disjunctions of Predicates}},
  booktitle = {Conference on Learning Theory},
  year = {2017},
  url = {https://openreview.net/forum?id=9x4x4HlS40},
}
Figure