Type-Checked Compliance: Deterministic Guardrails for Agentic Financial Systems Using Lean 4 Theorem Proving
Devakh Rashie, Veda Rashi · 2026
Read Type-Checked Compliance: Deterministic Guardrails for Agentic Financial Systems Using Lean 4 Theorem Proving by Devakh Rashie, Veda Rashi (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2604-01483.txt.
Introduction
Rashie and Rashi present the Lean-Agent Protocol, a guardrail platform that turns firm policies into Lean 4 code. It uses the Aristotle model from Harmonic AI. Every planned agentic action is treated as a math claim. Execution is allowed only if the Lean 4 kernel proves the action meets pre-set regulatory axioms. This design gives compliance certainty at a cryptographic level with microsecond latency, meeting SEC Rule 15c3-5, OCC Bulletin 2011-12, FINRA Rule 3110, and CFPB explainability mandates. A three-phase roadmap runs from shadow verification to enterprise-scale deployment.
Catalog record
| CREATOR | Devakh Rashie, Veda Rashi |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 37914 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2604.01483
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Type-Checked Compliance: Deterministic Guardrails for Agentic Financial Systems Using Lean 4 Theorem Proving Thanks: Code, implementation, and live demo available at https://github.com/arkanemystic/lean-agent-protocol and https://axiom.devrashie.space . Thanks: Suggested Citation: Devakh Rashie, Veda Rashi. 2026. Type-Checked Compliance: Deterministic Guardrails for Agentic Financial Systems Using Lean 4 Theorem Proving. Preprint available at https://devrashie.space . Devakh Rashie, Veda Rashi Abstract . The rapid evolution of autonomous, agentic artificial intelligence within financial services has introduced an existential architectural crisis: large language models (LLMs) are probabilistic, non-deterministic systems operating in domains that demand absolute, mathematically verifiable compliance guarantees. Existing guardrail solutions—including NVIDIA NeMo Guardrails and Guardrails AI—rely on probabilistic classifiers and syntactic validators that are fundamentally inadequate for enforcing complex multi-variable regulatory constraints mandated by the SEC, FINRA, and OCC. This paper presents the Lean-Agent Protocol , a formal-verification-based AI guardrail platform that leverages the Aristotle neural-symbolic model developed by Harmonic AI to auto-formalize institutional policies into Lean 4 code. Every proposed agentic action is treated as a mathematical conjecture: execution is permitted if and only if the Lean 4 kernel proves that the action satisfies pre-compiled regulatory axioms. This architecture provides cryptographic-level compliance certainty at microsecond latency, directly satisfying SEC Rule 15c3-5, OCC Bulletin 2011-12, FINRA Rule 3110, and CFPB explainability mandates. A three-phase implementation roadmap from shadow verification through enterprise-scale deployment is provided. 1. Introduction: Deterministic Governance in Agentic AI The rapid evolution of artificial intelligence within the financial services sector has catalyzed a transition from isolated, predictive analytics and generative text models to fully autonomous, agentic systems. These frameworks possess the capability to interpret complex user intent, dynamically synthesize contextual data, formulate multi-step execution plans, and autonomously interact with external environments through application programming interfaces (APIs) and tool-calling mechanisms ( 26 ) . While this paradigm shift offers massive operational efficiencies in algorithmic trading, dynamic risk assessment, and autonomous portfolio management, it simultaneously introduces an existential architectural crisis regarding systemic reliability and regulatory compliance ( 19 ) . Traditional enterprise automation relies on deterministic systems—such as robotic process automation (RPA) bots and hard-coded workflow engines—that execute predefined logical paths with mathematical precision ( 26 ) . If a condition is not explicitly defined, execution halts, bounding operational risk. Conversely, LLMs and the agentic architectures built upon them operate probabilistically ( 46 ) . They navigate continuous, high-dimensional vector spaces to generate responses that are statistically likely rather than mathematically certain ( 48 ) . This stochastic nature renders them highly adaptable to ambiguous inputs but inherently susceptible to hallucinations, context drift, and adversarial prompt injections ( 46 ) . In highly regulated domains such as global financial markets—where a single algorithmic deviation can precipitate catastrophic capital depletion or systemic market instability—probabilistic execution without rigid constraints is architecturally and legally untenable ( 16 ) . The contemporary industry response has been the deployment of AI Guardrails —secondary software layers designed to filter, monitor, and control LLM inputs and outputs ( 52 ) . However, the vast majority of existing guardrail solutions rely heavily on probabilistic classifiers, vector similarity searches, or syntactic schema validation ( 38 ) . While these tools excel at content moderation, they are fundamentally inadequate for enforcing the complex, multi-variable regulatory constraints demanded by the SEC, FINRA, and OCC ( 19 ) . To reconcile the agility of agentic AI with the uncompromising mandates of financial regulation, a paradigm shift toward formal verification is required. This paper delineates the technical blueprint, regulatory feasibility, and implementation roadmap for the Lean-Agent Protocol . By leveraging the Aristotle model ( 23 ) developed by Harmonic AI, this platform translates natural language institutional policies into the dependently typed formal programming language Lean 4 ( 29 ) . Acting as a deterministic gateway, the Lean-Agent Protocol treats every proposed agentic action as a mathematical conjecture: execution is permitted if and only if the Lean 4 kernel can definitively prove that the action satisfies the pre-compiled regulatory axioms. V. Rashi led the formal mapping of SEC Rule 15c3-5 and FINRA Rule 3110 regulatory mandates into the Lean-Agent logical framework. 2. Technical Integration and Workflow Dynamics 2.1. The Aristotle Model: Neural-Symbolic Architecture At the foundational core of the Lean-Agent Protocol is the Aristotle model, engineered by the Silicon Valley-based startup Harmonic AI ( 24 ) . Aristotle represents a structural departure from purely autoregressive LLMs by pioneering a neural-symbolic methodology designed specifically for automated theorem proving and the generation of formally verified, hallucination-free reasoning ( 24 ) . The system gained international prominence by achieving gold-medal-equivalent performance on the 2025 International Mathematical Olympiad (IMO), successfully generating machine-verifiable solutions in Lean 4 for five out of the six competition problems ( 23 ) . The architecture of Aristotle integrates three distinct but synergistic components: (1) a continuous Lean proof search system, (2) an informal reasoning engine dedicated to generating and formalizing intermediary lemmas, and (3) a specialized geometry solver ( 23 ) . Unlike traditional models that predict the next token in isolation, Aristotle utilizes the Lean 4 compiler as an infallible, high-speed reward signal within a reinforcement learning loop ( 23 ) . This mathematical grounding forces the model to continuously validate its internal reasoning against the strict rules of the Calculus of Inductive Constructions (CIC) ( 7 ) . The primary capability that enables the Lean-Agent Protocol is Aristotle’s proficiency in auto-formalization —the automated translation of unstructured, natural language concepts into rigorous formal code ( 32 ) . During its training and deployment, Aristotle has made novel contributions to Mathlib (Lean’s comprehensive mathematical library), formalized proofs for long-standing open conjectures including Erdős Problems 1026 and 728, and identified subtle logical errors within established academic textbooks ( 24 ) . Crucially, Aristotle is engineered to handle “epistemic gaps” and incomplete proof skeletons. When translating a complex financial policy, the initial mapping may leave certain logical steps unproven—denoted in Lean by the sorry tactic ( 24 ) . Aristotle possesses the capability to autonomously deduce and fill multiple sorry markers within a single theorem, effectively bridging the gap between high-level regulatory directives and the granular logic gates required for machine execution ( 24 ) . 2.2. Translation Error Rates and Handling of Complex Logical Constraints A critical concern when translating natural language policies into executable code is the fidelity of the translation. The Aristotle model mitigates this risk not by achieving perfect initial generation, but by leveraging the deterministic constraints of the Lean environment to execute autonomous self-repair ( 23 ) . In the formalization of complex theorems, Aristotle’s informal reasoning engine occasionally generates text containing subtle semantic confusions—for example, conflating the mathematical definitions of “strictly decreasing sequences,” “weakly decreasing sequences,” and sequences that merely decrease at some point ( 23 ) . In a standard generative AI pipeline, this semantic error would pass through unnoticed. However, within the Aristotle architecture, the informal proof is immediately submitted to the Lean 4 kernel for formalization ( 23 ) . The Lean compiler deterministically rejects the flawed logic and generates a highly specific compiler error, often including explicit counterexamples ( 24 ) . Aristotle ingests this error state and autonomously repairs the logical gaps, adjusting its approach until the Lean compiler returns a successful verification ( 23 ) . The final