neural-lex is a neuro-symbolic prototype for extracting legal rules from text and checking logical consistency with a SAT/SMT-style backend.
It is specifically tuned for Finnish traffic law (Tieliikennelaki 729/2018) using hierarchical decomposition and recursive querying inspired by Recursive Language Models.
- Hierarchical Extraction: Parses laws into sections and extracts normative logic atoms.
- Recursive Reasoning: Resolves cross-references (§) between sections recursively.
- Symbolic Verification: Detects pairwise conflicts and checks scenario satisfiability using Z3.
- Agentic Extractor: Optional LLM-based recursive extraction layer (OpenAI/Gemini).
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev,solver,llm]"# Run on an example excerpt
python -m neural_lex.cli --text-file examples/tll_ch2_excerpt.txt --chapter 2python -m neural_lex.cli --text-file examples/tll_ch2_excerpt.txt --use-llm --gemini --google-key YOUR_KEY- AGENTS.md: The "Context-as-State" recursive architecture.
- TECHNICAL.md: Logic atom schemas, reasoning internals, and CLI reference.
- neural_lex/README.md: Core module implementation details.
pytestNote
This is a technical prototype and not legal advice.
