Constrained LTL Specification Learning from Examples

Changjian Zhang, Parv Kapoor, Ian Dardik, Leyi Cui, Romulo Meira-Goes, David Garlan, Eunsuk KangarXiv 2024

Writing formal specifications is hard. Even for experts, capturing the intricate temporal requirements of a system in Linear Temporal Logic (LTL) is a notoriously error-prone process. While researchers have developed tools to "learn" these specifications automatically from example execution traces, these tools often struggle. They might produce a formula that technically fits the examples but completely misses the developer's actual intent.

A new paper, "Constrained LTL Specification Learning from Examples," introduces a powerful way to bridge this gap. The authors present ATLAS, a tool that allows users to guide the learning process using custom constraints and optimization goals.

TL;DR

ATLAS introduces "constrained LTL learning," allowing users to steer specification synthesis using first-order logic constraints and optimization objectives. By reducing the learning problem to a Maximal Satisfiability (MaxSAT) problem, ATLAS generates formulas that are not only consistent with examples but also aligned with developer intent, outperforming existing tools in both speed and success rate.

What Problem Does This Paper Address?

LTL is essential for tasks like model checking and automated synthesis, but it's difficult to write manually. Traditional LTL learning tools try to solve this by taking a set of "positive" traces (how the system should behave) and "negative" traces (how it shouldn't) and finding a formula that separates them.

The challenge is that traces are almost always an incomplete specification. A learner might find a technically valid formula that is practically useless—for example, a complex liveness property when the developer actually wanted a simple safety invariant. Existing "template-based" learners try to fix this but are often too rigid, unable to express nuanced requirements like "minimize the use of specific variables" or "ensure the formula follows a specific logical pattern."

Methods

The core innovation is the formulation of the Constrained LTL Learning Problem. Instead of just traces, ATLAS accepts:

  1. Syntactic Constraints ($\Phi$): Written in First-Order Logic (FOL), these define the structure of the desired formula (e.g., "the formula must start with a 'Globally' operator").
  2. Optimization Objectives ($\Psi$): These tell the learner what to prioritize, such as minimizing the total formula size or maximizing the use of specific important propositions.
Fig. 1: Overview of a constrained LTL learning problem in ATLAS.

ATLAS implements this by encoding the LTL learning problem into AlloyMax, an extension of the Alloy relational logic language. It models LTL syntax as a Directed Acyclic Graph (DAG) to allow for efficient sub-formula reuse and represents execution traces as "lasso traces" (paths that eventually loop). The entire problem is then reduced to a MaxSAT instance, allowing ATLAS to find the "best" formula that satisfies all hard constraints while maximizing the user's optimization goals.

Datasets

The authors evaluated ATLAS on two main fronts:

  • Unconstrained Benchmark: 485 standard LTL learning problems from prior literature, ranging from 6 to 5,000 examples per problem.
  • New Constrained Benchmarks: 138 new problems derived from four diverse case studies:
  • Peterson’s Algorithm: Learning mutual exclusion and deadlock-free properties for a multi-processing algorithm.
  • Voting Machine: Mining safety invariants for a secure voting system (see Figure 7).
  • Robot Arm Repair: Refining a robot's specification to include new tasks while minimizing changes to the original formula.
  • Radiation Therapy: Weakening a safety invariant for a medical machine to handle new environmental conditions.
Fig. 7: A state machine representing the voting machine [33].

Key Insights and Ideas

  • Constraints as Intent: Traces provide the "what," but FOL constraints provide the "why." By allowing users to specify structural preferences, ATLAS can find the "intuitive" formula that traces alone cannot pinpoint.
  • MaxSAT for Optimization: While standard SAT solvers just find any valid solution, MaxSAT is perfectly suited for LTL learning because it naturally handles the "minimality" requirement (finding the smallest possible formula) alongside custom user objectives.
  • DAG-based Syntax: Modeling LTL formulas as DAGs rather than simple trees allows the solver to identify and reuse common sub-formulas, significantly reducing the search space and improving performance.

Key Results

ATLAS demonstrated significant improvements over state-of-the-art tools like Flie and LTLSketcher:

  • Speed: On unconstrained problems, ATLAS was faster than Flie in 86% of cases, with an average speedup of 1.45x.
  • Effectiveness: In constrained scenarios, ATLAS solved 3.2x more problems than Flie and 8.7x more than LTLSketcher.
  • Efficiency: In the constrained benchmarks, ATLAS was roughly 3x faster than the competing tools while consistently finding the "ideal" formulas defined in the case studies.

Limitations and Future Work

The primary limitation is scalability; as the number of traces or the complexity of the desired formula grows, the underlying MaxSAT solver can become a bottleneck. Furthermore, writing FOL constraints still requires a high degree of expertise in formal logic.

The authors suggest several promising future directions:

  • Improved Usability: Developing a domain-specific language (DSL) or using Large Language Models (LLMs) to translate natural language requirements into FOL constraints.
  • Automated Examples: Integrating ATLAS with model checkers to automatically generate the positive and negative traces needed for learning.
  • New Learning Engines: Exploring alternative learning methods, such as those based on machine learning, to improve scalability beyond what pure MaxSAT can achieve.

Summary updated

BibTeX
@misc{zhang2024constrained,
  author = {Changjian Zhang and Parv Kapoor and Ian Dardik and Leyi Cui and Romulo Meira-Goes and David Garlan and Eunsuk Kang},
  title = {{Constrained LTL Specification Learning from Examples}},
  year = {2024},
  eprint = {2412.02905},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.02905},
}
Figure