Traffic Scenario Logic: A Spatial-Temporal Logic for Modeling and Reasoning of Urban Traffic Scenarios

Ruolin Wang, Yuejiao Xu, Jianmin Ji · DOI

Introduction

Verifying the safety of autonomous vehicles (AVs) requires testing against a massive variety of traffic scenarios. Existing formal methods often fall into two traps: they are either restricted to simple highway stretches or rely on "discretization"—chopping the world into a grid. Grid-based methods suffer from a "Goldilocks" problem: if the grid is too coarse, critical "corner case" safety events are missed; if it's too fine, the state space explodes, making efficient reasoning mathematically impossible.

Traffic Scenario Logic (TSL) is introduced to address these challenges. By moving away from absolute coordinates and focusing on relative vehicle relationships, TSL enables the automated generation of diverse, high-coverage test cases for autonomous driving systems while remaining fully compatible with industry-standard OpenDRIVE maps.

Methodology

The core of TSL lies in its Spatial Representation. Instead of absolute $(x, y)$ coordinates, TSL describes the world through relative spatial relationships. Longitudinal positions are defined relative to other vehicles (e.g., ahead, behind, or covering), while lateral positions are based on lane occupancy.

Urban Extensions

To handle the messy reality of urban driving, TSL extends traditional highway logic to model complex topologies:

  • Intersections: Where lanes cross but do not connect.
  • Connection Points: Representing merges and forks.
  • Overlapping Segments: Where vehicles might travel in opposite directions on the same stretch of road.
Urban road network topologies modeled in TSL: (a) Intersection, (b) Connection, and (c) Overlap.

Reasoning via Answer Set Programming

TSL is implemented using Telingo, a solver for temporal programs based on Answer Set Programming (ASP). This allows the system to perform "model expansion": given a map and an initial state, it mathematically identifies every plausible sequence of events (scenarios) that follows the rules of physics and traffic law.

Scenario Generation and Evaluation

TSL adopts a "Keyframe" approach to time. Rather than treating time as a series of fixed-length ticks, a "step" represents a transition between meaningful logical states. This allows the logic to skip redundant moments and focus on critical changes like lane entries or overtakes.

The framework was evaluated using OpenDRIVE map data and synthetic urban layouts, including multi-lane highways, standard intersections, forks, and double-intersection sequences.

Examples of traffic scenarios generated by TSL across different road topologies.

Key Results

The researchers demonstrated that TSL can automatically generate complex, plausible traffic scenarios that traditional logics often miss:

  • Intersection Reasoning: Correctly modeling vehicles passing through intersections without mid-cross lane changes.
  • Complex Overtaking: Generating scenarios for overtaking on roads with overlapping opposite-direction traffic, identifying the necessity of waiting for oncoming traffic.
  • Scenario Generalization: A single logical scenario represents an entire family of concrete scenarios. For instance, one logical "overtake" covers any speed or exact distance, provided the relative order of vehicles remains consistent. This significantly improves the efficiency of test coverage.

Conclusion and Future Work

TSL provides a discretization-free approach to safety verification, ensuring that "between-the-grid" events are not overlooked. By grouping scenarios with identical vehicle relationships, the system avoids state-space explosion.

While currently "pedestrian-free," future work aims to incorporate unpredictable human walkers. Additionally, while TSL is currently used for offline test generation—with a workflow to translate output into OpenSCENARIO DSL for simulators—the authors see potential for real-time decision-making and control verification through further speed optimization.

Summary updated

BibTeX
@inproceedings{wang2025traffic,
  author = {Ruolin Wang and Yuejiao Xu and Jianmin Ji},
  title = {{Traffic Scenario Logic: A Spatial-Temporal Logic for Modeling and Reasoning of Urban Traffic Scenarios}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i14.33667},
}
Figure