Explainable Reinforcement Learning Achieved via Prolog Expert Systems

Eduardo C. Garrido-Merch\'an· July 20, 2026 View original

Summary

This research presents a three-stage post-hoc transformation that converts a trained deep reinforcement learning (RL) policy into an executable Prolog logic program. This program reproduces the original policy's behavior, offering explainability, editability, and provable guarantees, and empirically achieves optimal or near-optimal returns on various tasks.

Deep reinforcement learning (RL) policies are typically opaque "black boxes," making their decisions difficult to understand or trust. This research introduces a method to transform such policies into explainable, executable logic programs using Prolog expert systems. The process involves three post-hoc stages: first, extracting a frozen Proximal Policy Optimization (PPO) teacher; second, inducing an ordered rule list from its decisions using classical relational learning techniques; and third, emitting the result as a Prolog program. This program's decisions can be executed by an off-the-shelf logic engine, and it can be edited, with changes accepted only if policy evaluation certifies a return increase. The paper provides four key guarantees, including a return-loss bound that makes the distilled program a machine-checkable certificate in finite Markov Decision Processes, and a monotonically improving, terminating expansion loop. For continuous-observation settings, it proves that conversion to arbitrary fidelity is possible, with disagreement and return gaps closing at a rate of O(1/B) as resolution B grows. Empirically, the expanded Prolog program achieved exact optimal return on a two-room key-and-door task and matched or recovered a significant portion of the neural teacher's return on continuous-control tasks like Acrobot and CartPole, demonstrating its practical viability and explainability benefits.

Why it matters

This breakthrough offers a way to make complex reinforcement learning agents transparent and auditable, which is critical for deploying AI in high-stakes environments where understanding and trust are paramount.

How to implement this in your domain

  1. 1Investigate methods for converting existing black-box RL policies into explainable logic programs for critical applications.
  2. 2Explore using Prolog or similar logic programming languages to represent and execute distilled AI policies.
  3. 3Implement post-hoc analysis techniques to extract rules from trained neural networks for greater transparency.
  4. 4Develop mechanisms for human-in-the-loop editing of AI policies, with automated verification of performance improvements.
  5. 5Apply this approach to RL agents operating in regulated or safety-critical domains to enhance auditability and trust.

Who benefits

RoboticsAutonomous SystemsHealthcareFinanceRegulatory Compliance

Key takeaways

  • Deep RL policies can be transformed into explainable Prolog logic programs.
  • This process provides transparency, editability, and provable guarantees.
  • The distilled programs can achieve optimal or near-optimal returns.
  • It addresses the "black box" problem in reinforcement learning.

Original post by Eduardo C. Garrido-Merch\'an

"arXiv:2607.15459v1 Announce Type: new Abstract: A trained deep reinforcement learning policy is a black box, and we ask whether it can be made explainable by rewriting it as an executable logic program that reproduces its behaviour and that a person can read, a logic engine can r…"

View on X

Originally posted by Eduardo C. Garrido-Merch\'an on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses