Counterexample Classification for Signal Temporal Logic Specifications

Zhenya Zhang, Parv Kapoor, Jie An, Eunsuk KangarXiv 2026

TL;DR

Engineers debugging cyber-physical systems are often overwhelmed by hundreds of repetitive counterexamples generated by automated testing tools. This paper introduces a formal framework that automatically categorizes these failures into distinct behavioral patterns using Parametric Signal Temporal Logic (PSTL). By exploiting a mathematical partial order between failure classes, the proposed algorithms dramatically speed up classification, helping engineers quickly pinpoint diverse root causes.

What Problem Does This Paper Address?

Hybrid systems—such as autonomous vehicles, medical devices, and robotics—combine discrete software logic with continuous physical dynamics. Ensuring their safety is notoriously difficult. Engineers frequently use falsification tools to automatically find "counterexamples," which are system trajectories (signals) that violate safety specifications written in Signal Temporal Logic (STL).

The catch? These automated tools rely on stochastic optimization and tend to find the exact same bug over and over again, flooding engineers with thousands of nearly identical counterexamples. Manually sorting through this repetitive data to find the actual distinct root causes is a massive, labor-intensive bottleneck. This paper addresses the lack of automated, semantic classification methods to group these failures by their underlying behavioral patterns.

Fig. 1: A “reach-avoid” task for a robot

Methods

The authors establish a systematic pipeline to automatically group counterexamples into semantic classes:

Fig. 2: Workflow of counterexample classification
  1. PSTL as Class Templates: Instead of hardcoding rigid time bounds, the framework uses Parametric Signal Temporal Logic (PSTL). By leaving time intervals as parameters, a single PSTL formula can act as a template representing a whole family of similar failure behaviors.
  2. Interval Splitting ($k$-segments): To capture fine-grained temporal patterns (like the order of events), the framework splits the time intervals of temporal operators (such as "Always" $\Box$ or "Eventually" $\diamond$) into $k$ sub-intervals.
  3. The Partial Order Breakthrough: The core mathematical insight is that these failure classes exhibit an inclusion relation (a partial order). If a signal violates a highly specific, strict class, it logically also violates a broader, more general class. This allows the space of all possible failure classes to be structured as a Directed Acyclic Graph (DAG).
  4. Efficient Pruning Algorithms (AlwMid and LongBS): Rather than naively checking every single class template (which scales exponentially), the authors propose binary-search-style algorithms over the DAG paths. By testing a counterexample against a midpoint class, they can instantly prune away half of the remaining graph, saving expensive computation.

Datasets

The method was evaluated using three widely recognized hybrid system benchmarks:

  • Automatic Transmission (AT): A MATLAB/Simulink model tracking speed, gear position, and engine RPM under various safety and liveness constraints.
  • Abstract Fuel Control (AFC): An industrial powertrain control model from Toyota designed to keep the air-to-fuel ratio close to a strict reference point.
  • Robot Navigation (Rob): The motion planning model illustrated in Figure 1, where a robot must navigate to two goal regions in a specific sequence while avoiding a dangerous obstacle.

Key Insights and Ideas

  • Failures Have Logical Structure: Violations are rarely random; they follow distinct temporal orderings. For instance, a system might fail because event $A$ happened before event $B$, or vice versa. The framework elegantly captures these "happens-before" relationships by tuning the interval-splitting hyperparameter $k$.
Fig. 3: Two example signals that exhibit different orders of events that lead to specification violation
  • Leveraging "Free" Information: Because of the partial order structure, a single membership query provides cascading information about neighboring classes. This turns what would be an intractable search space into a highly optimized graph-pruning problem.
  • Preferential Falsification: Standard testing tools naturally take the path of least resistance, finding the "easiest" bug repeatedly. The authors show that their classification templates can be flipped to guide falsification tools, intentionally steering them away from known failure modes to discover rare, hidden bugs.

Key Results

  • Massive Computational Speedups: The optimized search algorithms (AlwMid and LongBS) drastically outperformed the baseline exhaustive search. For the Automatic Transmission benchmark at a fine granularity ($k=6$), the LongBS algorithm reduced the classification time cost by 96.2%.
  • Uncovering Hidden Bugs: In the preferential falsification experiments, standard testing completely missed a critical class of engine RPM violations across 60 trials because it kept getting distracted by easier speed violations. The guided approach successfully forced the tool to find counterexamples across all diverse failure modes.

Limitations and Future Work

  • Timing Parameters Only: The current framework focuses exclusively on parameterizing timing intervals (e.g., when a failure occurs). It does not yet account for magnitude parameters (e.g., by how much a safety threshold was breached), which the authors note is an important extension for multi-granularity analysis.
  • Offline Bottleneck: Currently, classification happens post-hoc after a batch of counterexamples has already been generated. A compelling future direction is integrating this classification directly online inside the falsification loop to dynamically maximize bug diversity on the fly.

Summary updated

BibTeX
@misc{zhang2026counterexample,
  author = {Zhenya Zhang and Parv Kapoor and Jie An and Eunsuk Kang},
  title = {{Counterexample Classification for Signal Temporal Logic Specifications}},
  year = {2026},
  eprint = {2601.13743},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.13743},
}
Figure