Hyper pattern matching

Masaki Waga, Étienne André · DOI

Abstract

Traditional runtime verification focuses on single-trace properties, failing to capture complex security and robustness requirements known as hyperproperties. This paper introduces Hyper Pattern Matching, a framework utilizing Nondeterministic Asynchronous Finite Automata (NAAs) to detect violations across multiple execution traces. By implementing a tool called HypPAu with specialized optimization heuristics, we demonstrate that hyperproperty violations can be efficiently identified in large-scale logs, overcoming the inherent NP-completeness of the matching problem.

Introduction

In modern system monitoring, ensuring that a single execution trace follows a predefined pattern is a well-understood task. However, many critical system requirements—particularly in security—are defined by the relationship between multiple traces. These "hyperproperties," such as noninterference or robustness, require comparing different executions to identify leaks or unexpected behavioral changes. Existing tools often struggle with asynchronicity, where traces progress at different rates, or fail to provide detailed "witnesses" that pinpoint exactly where a property was violated.

Problem Statement

The core challenge in hyperproperty verification is the combinatorial explosion that occurs when comparing multiple traces. For instance, proving a violation of noninterference requires finding two traces where a secret input differs but the public output remains identical. When these traces are asynchronous, the search space for matching sub-sequences grows exponentially. Formally, the problem of finding a match across multiple dimensions is NP-complete, necessitating sophisticated algorithmic approaches to make monitoring practical for real-world logs.

Methodology: Nondeterministic Asynchronous Finite Automata

To address these challenges, we represent patterns using Nondeterministic Asynchronous Finite Automata (NAAs). An NAA extends standard automata by employing multiple independent "reading heads," or directions. Each head can traverse a different trace or different segments of the same trace independently.

Examples of NAAs for counting (a) and matching interference (b).

The complexity of the state space in an NAA reflects the asynchronous nature of the properties being checked. As shown in the state transition diagram below, the automaton must track the progress of multiple directions simultaneously.

A complex state transition diagram illustrating the asynchronous movement of multiple directions in a hyperproperty pattern.

To mitigate the NP-completeness of the matching task, we introduce two key optimization heuristics:

  1. FJS-style Skipping: Adapting string-matching techniques to determine how far a search window can jump after a mismatch, reducing redundant comparisons.
  2. Projection-based Pruning: A filtering mechanism that checks if individual words match their respective dimensions of the pattern in isolation. If a word fails this local check, the tool immediately discards all multi-word combinations involving it.

Evaluation and Results

The framework was implemented in a Rust-based tool, HypPAu, and evaluated across benchmarks including information flow interference, system robustness, and network packet matching.

Key findings include:

  • Efficiency: HypPAu processes traces with thousands of events in seconds for two-direction properties.
  • Heuristic Impact: In the ManyDirs benchmark (4 directions), the optimized version finished in 130 seconds, whereas the naive algorithm timed out after 30 minutes.
  • Scalability: Execution time scales approximately quadratically with word length, making the tool viable for analyzing substantial system logs.

Conclusion

Hyper pattern matching provides a formal and practical approach to verifying complex asynchronous properties. By leveraging NAAs and effective pruning heuristics, HypPAu offers a significant advancement over previous "Yes/No" monitors by providing fine-grained witnesses of violations. Future work will explore extending the framework to handle timed constraints and approximate "fuzzy" matching for noisy real-world data.

Summary updated

BibTeX
@inproceedings{waga2025hyper,
  author = {Masaki Waga and Étienne André},
  title = {{Hyper pattern matching}},
  booktitle = {RV},
  year = {2025},
  url = {https://openreview.net/forum?id=VkgCeatZ7z},
}
Figure