Abstract
We present PCFTL (Probabilistic CounterFactual Temporal Logic), a new probabilistic temporal logic for the verification of Markov Decision Processes (MDP). PCFTL introduces operators for causal inference, allowing us to express interventional and counterfactual queries. Given a path formula $\phi$, an interventional property is concerned with the satisfaction probability of $\phi$ if we apply a particular change $I$ to the MDP (e.g., switching to a different policy); a counterfactual formula allows us to compute, given an observed MDP path $\tau$, what the outcome of $\phi$ would have been had we applied $I$ in the past and under the same random factors that led to observing $\tau$. Our approach represents a departure from existing probabilistic temporal logics that do not support such counterfactual reasoning. From a syntactic viewpoint, we introduce a counterfactual operator that subsumes both interventional and counterfactual probabilities as well as the traditional probabilistic operator. This makes our logic strictly more expressive than PCTL*. The semantics of PCFTL rely on a structural causal model translation of the MDP, which provides a representation amenable to counterfactual inference. We evaluate PCFTL in the context of safe reinforcement learning using a benchmark of grid-world models.
Introduction: The Need for Retrospective Reasoning
In the development of autonomous systems and reinforcement learning, safety is a primary concern. Traditional probabilistic temporal logics, such as PCTL*, are effective for prospective reasoning—asking, for instance, "What is the probability that this robot hits a wall under its current policy?" However, these logics lack the capacity for retrospective, or counterfactual, reasoning. If a robot crashes, a developer might need to know: "Given the specific slippery floor conditions encountered, would the robot have crashed if it had used a more conservative braking policy?"
Standard logics cannot answer such queries because they evaluate properties on fixed system configurations and cannot account for the specific random noise (exogenous variables) of a past event. This paper introduces PCFTL (Probabilistic CounterFactual Temporal Logic), bridging the gap between Pearl’s Causal Hierarchy and formal verification by allowing researchers to quantify not just what will happen, but what would have happened under different circumstances.
The PCFTL Framework
The authors propose three main technical contributions to enable causal temporal reasoning:
- Syntax and Semantics: PCFTL extends PCTL* with a new counterfactual operator $I_{@t}.P_{\bowtie p}(\phi)$, enabling reasoning about an intervention $I$ applied $t$ steps in the past. It also introduces "Causal Effect" operators ($\Delta$) to measure differences in outcomes between policies.
- Gumbel-Max SCM Encoding: To perform counterfactual reasoning, the system requires a Structural Causal Model (SCM). While MDPs are typically defined by transition probabilities, the authors translate them into SCMs using the Gumbel-Max trick. This allows for the "abduction" (inference) of specific random factors from an observed path, keeping them fixed while simulating alternative policies.
- Statistical Model Checking (SMC): Due to the complexity of counterfactual distributions in discrete MDPs, the authors employ SMC with a sequential hypothesis testing scheme (SPRT) to sample counterfactual paths efficiently.
Experimental Evaluation
The framework was evaluated using several benchmarks:
- Grid-world Reach-Avoid: A $4 \times 4$ environment used to analyze the accuracy of counterfactual inference.
- MiniGrid Benchmark: A suite of 2D environments (e.g., DoorKey, Fetch) requiring complex tasks like finding keys.
- Neural Network Policies: Policies trained via Proximal Policy Optimization (PPO) were compared to measure causal effects between "optimal" and "undertrained" agents.
Key Insights and Results
A central finding is the importance of Counterfactual Stability. By using Gumbel-Max SCMs, the logic ensures that if an intervention does not fundamentally alter the likelihood of an outcome, the outcome remains consistent, making "what if" reasoning intuitive. The paper also highlights that to correctly evaluate a counterfactual safety property, one must reason about the future evolution of the system starting from the counterfactual past.
The results demonstrate that PCFTL is strictly more expressive than PCTL*, as it can recover standard probabilities by setting the time offset to zero. Furthermore, SMC allowed for verification with as few as 25 to 125 realizations in complex environments. In safety analysis, PCFTL successfully quantified the "performance gap," proving that while an undertrained policy might fail, an optimal policy would have succeeded under identical environmental conditions.
Conclusion and Future Work
While PCFTL represents a significant step forward, several challenges remain. The current reliance on sampling (SMC) suggests a need for numerical or symbolic model-checking algorithms. Additionally, the complexity of nesting counterfactual operators and scaling to continuous-state or high-dimensional systems are key areas for future research.
Summary updated