Software Engineering Methods For AI-Driven Deductive Legal Reasoning
Rohan Padhye
TL;DR
This paper reframes AI-driven deductive legal reasoning as a software-execution problem, proposing that LLMs act as interpreters of natural-language statutes and contracts. It introduces a software-engineering toolkit—substitution inlining, code-coverage guided example generation, mutation testing, and metamorphic property-based testing—to improve interpretability, reliability, and edge-case analysis in legal reasoning. The work also extends these ideas to practical applications such as delta debugging for input minimization and amendment validation/composition, illustrating how AI and software analysis methods can jointly support lawmakers, drafters, and ordinary citizens. Collectively, the approach aims to augment rather than replace legal experts by providing transparent, testable reasoning tools that reveal how complex statutes apply across diverse hypothetical scenarios.
Abstract
The recent proliferation of generative artificial intelligence (AI) technologies such as pre-trained large language models (LLMs) has opened up new frontiers in computational law. An exciting area of development is the use of AI to automate the deductive rule-based reasoning inherent in statutory and contract law. This paper argues that such automated deductive legal reasoning can now be viewed from the lens of software engineering, treating LLMs as interpreters of natural-language programs with natural-language inputs. We show how it is possible to apply principled software engineering techniques to enhance AI-driven legal reasoning of complex statutes and to unlock new applications in automated meta-reasoning such as mutation-guided example generation and metamorphic property-based testing.
