DMN-Prolog Bidirectional Converter
A Python tool for bidirectional conversion between Prolog code and DMN (Decision Model and Notation) for legal/business rule management.
Overview
This tool enables a powerful workflow for converting legal documents into executable decision logic:
Legal Document → LLM → Prolog → DMN → Review → Deploy (Prolog or DMN)
↑ ↓
└────────────────┘
(Bidirectional)
Why this approach?
- LLM-Friendly Input: Prolog syntax is simpler and more reliable for LLMs to generate than verbose DMN XML
- Human-Friendly Review: DMN provides visual decision tables that legal/business specialists can review
- Flexible Deployment: Deploy as either Prolog (for Prolog engines) or DMN (for DMN engines)
- Quality Control: Bidirectional conversion ensures consistency and reduces hallucination
Supported Prolog Subset
To ensure DMN compatibility, the converter supports a restricted Prolog subset:
- ✓ Horn clauses only (no negation-as-failure, no cuts)
- ✓ Deterministic rules (single output per input combination)
- ✓ Simple data types (atoms, numbers, strings, booleans)
- ✓ Decision table structure (pattern-matching rules)
- ✓ Limited recursion (≤ 3 levels)
- ✓ FEEL expression compatibility (comparison operators:
>=,=<,>,<,==,\=)
Installation
# Basic installation (conversion only)
pip install dmn-prolog-converter
# With validation support
pip install dmn-prolog-converter[validation]
# With all optional features
pip install dmn-prolog-converter[execution]
See CDMN_INTEGRATION.md for details.
Quick Start
Command Line
After installation, you'll have these commands available:
dmn-prolog # Main CLI tool with subcommands
prolog2dmn # Quick shortcut: Prolog → DMN
dmn2prolog # Quick shortcut: DMN → Prolog
z32dmn # Quick shortcut: Z3 → DMN
dmn2z3 # Quick shortcut: DMN → Z3
Example usage
# Convert Prolog to DMN
dmn-prolog convert rules.pl rules.dmn
# Convert DMN to Prolog
dmn-prolog convert rules.dmn rules.pl
# Validate DMN
dmn-prolog validate rules.dmn
# Show file info
dmn-prolog info rules.pl
dmn-prolog info rules.smt2
# Quick shortcuts
prolog2dmn input.pl output.dmn
dmn2prolog input.dmn output.pl
z32dmn input.smt2 output.dmn
dmn2z3 input.dmn output.smt2
See CLI_GUIDE.md for complete CLI documentation.
Limitations & Future Work
Current Limitations:
- No support for complex Prolog features (cuts, negation-as-failure, DCGs)
- Limited to decision tables (no decision requirement diagrams)
- No support for DMN business knowledge models or contexts
- Arithmetic expressions are basic
Future Enhancements:
- Support for DMN FEEL functions
- Decision requirement diagram generation
- Semantic validation of business logic
- Integration with LLM for natural language descriptions
- Support for more complex Prolog constructs (via approximation)
- Visual DMN table editor integration
Use Cases
- Legal Document Automation: Convert legal rules to executable format
- Business Rule Management: Maintain rules in both technical and business-friendly formats
- Legacy Migration: Migrate Prolog expert systems to DMN standard
- LLM-Powered Rule Generation: Let LLMs generate Prolog, convert to DMN for review
- Dual Deployment: Maintain single source, deploy to both Prolog and DMN engines
Contributing
Contributions welcome! Areas for improvement:
- Additional test cases
- Support for more Prolog patterns
- Enhanced FEEL expression generation
- Documentation improvements
License
MIT License - see LICENSE file for details
References
Metadata
Release files for dmn-prolog-converter 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dmn_prolog_converter-1.0.1.tar.gz | 31.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dmn_prolog_converter-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.2 kB
Release files / dmn_prolog_converter-1.0.1.tar.gz
| Download URL | dmn_prolog_converter-1.0.1.tar.gz |
|---|---|
| Size | 31.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83ae4100bdba041cd095d5976164d0b3145747acba68ac4a2a9d4b140fa6feae
|
|
BLAKE2b-256 checksum How to use checksums |
fad21bfd2219d170a725701e3df4754a1d265489fd9b203d5f0ac509f0f5354f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / dmn_prolog_converter-1.0.1-py3-none-any.whl
| Download URL | dmn_prolog_converter-1.0.1-py3-none-any.whl |
|---|---|
| Size | 32.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46ce95bc5f5a174d350b0124ad061acdfbf99ce496c9f234197c1af5fca94148
|
|
BLAKE2b-256 checksum How to use checksums |
5f89544397f98d7eb93775da536b4fba1880d13090931ffb17b61c1e0c2780c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency log