Counterfactuals Modulo Temporal Logics

Bernd Finkbeiner, Julian Siber

Introduction

This research bridges the gap between causal reasoning and temporal logic by extending David Lewis’ classic theory of counterfactuals to infinite sequences. The authors introduce $QPTL_{cf}$, a new logic that allows researchers to formally ask "what if" questions about system behaviors over time, providing a decidable framework for identifying the minimal causes of errors in complex systems.

The Challenge of Temporal Counterfactuals

In causal analysis, we often use counterfactuals: "If event $A$ had not happened, would event $B$ still have occurred?" David Lewis pioneered the formal semantics for this in the 1970s, basing it on the idea of "closest possible worlds." However, applying this to modern computer science—specifically to infinite execution traces like those from a model checker or a reinforcement learning agent—presents two major hurdles:

  1. The Limit Assumption Failure: Lewis often assumed there is always a set of "closest" worlds. In temporal logic, this isn't always true. One can often find an infinite chain of traces that get closer and closer to the original without ever reaching a single "closest" one.
  2. Non-total Similarity: Lewis assumed you could always compare any two worlds to see which is closer. In reality, different changes to a system trace (e.g., changing an input at time step 1 vs. time step 10) might be incomparable.
Visualization of similarity relations between traces, where multiple incomparable paths of similarity may exist around a reference trace $W$.

Existing methods either oversimplify these issues or ignore the temporal dimension entirely. This paper seeks a mathematically rigorous way to reason about causality in infinite-state systems without these restrictive assumptions.

The $QPTL_{cf}$ Framework

The authors propose a new logic called Quantified Propositional Temporal Logic with Counterfactuals ($QPTL_{cf}$). Their approach involves several novel components designed to handle the complexities of temporal traces:

  • New Operators: To handle "incomparable" changes, they introduce "Universal Would" and "Existential Might" operators. These allow for more nuanced quantification over hypothetical scenarios when multiple "paths" of similarity exist.
  • Minimality Criterion: They introduce minimal counterfactual operators ($\to_{min}$). This is crucial for causal analysis because it helps identify the smallest possible change to an antecedent that would have prevented an effect, avoiding "overspecified" causes.
Illustration of the minimality criterion, identifying the smallest deviation from the actual trace $W$ to satisfy a counterfactual condition.
  • Decidability via Hyperproperties: The most significant technical contribution is proving that reasoning in this logic is computationally feasible. They show that $QPTL_{cf}$ can be encoded into HyperQPTL, a logic designed to reason about relationships between multiple traces (hyperproperties). By doing this, they demonstrate that the "satisfiability" and "trace-checking" problems are decidable.

Key Insights and Results

Hyperproperties as the "Secret Sauce"

Counterfactual reasoning is inherently relational—you aren't just looking at one trace; you are comparing the "actual" trace to a set of "hypothetical" traces. This makes hyperproperties the natural mathematical language for causality. The authors show it is possible to reason about counterfactuals even when there isn't a single "closest" world by using "threshold" worlds to define when a property starts holding as you move closer to the reference trace.

A Unifying Framework

$QPTL_{cf}$ acts as a "Rosetta Stone" for causality. The authors demonstrate they can express various existing (and sometimes conflicting) definitions of causality, such as Halpern’s "Actual Causality" and Coenen et al.’s "Temporal Causality," within their single logic. This allows for a formal comparison of different causal theories.

Core Results

  • Decidability: Despite the complexity of reasoning over infinite sequences and second-order quantifiers, the core problems of $QPTL_{cf}$ remain decidable.
  • Expressivity: The logic can successfully formalize complex statements like: "If the input 'i' at the first position had not been enabled, the system would not have reached error 'e'."
  • Minimal Cause Identification: The minimal operators effectively filter out irrelevant details, ensuring that the identified "cause" is the simplest one possible.

Limitations and Future Work

While decidable, the decision procedures are "non-elementary," meaning they could be slow for extremely complex formulas with many nested quantifiers. Future work may focus on fragments of the logic (like those based on LTL) for practical tool development. Additionally, the current logic does not allow for nested counterfactuals (e.g., "If $A$ had happened, then if $B$ had happened..."). The authors aim to move toward causal discovery—automatically synthesizing the "why" behind system failures without requiring a human-provided hypothesis.

Summary updated

BibTeX
@inproceedings{finkbeiner2023counterfactuals,
  author = {Bernd Finkbeiner and Julian Siber},
  title = {{Counterfactuals Modulo Temporal Logics}},
  booktitle = {LPAR},
  year = {2023},
  doi = {10.29007/qtw7},
}
Figure