# Rethinking Answer Set Programming Templates

arXiv: https://arxiv.org/abs/2307.06382 · HTML: https://mlsanity.com/paper/2307.06382/

## Key facts

- Cited by 1 papers in the map (data through 14 Oct 2026).
- Builds on 8 of its 33 references that are in the map.
- First posted on arXiv 12 Jul 2023.

## Builds on (most cited first, 8 of 8)

- [ASP-Core-2 Input Language Format](https://mlsanity.com/paper/1911.04326/) (2019)
- [How to build your own ASP-based system?!](https://mlsanity.com/paper/2008.06692/) (2020)
- [Verifying Tight Logic Programs with anthem and Vampire](https://mlsanity.com/paper/2008.02025/) (2020)
- [Answer Set Planning: A Survey](https://mlsanity.com/paper/2202.05793/) (2022)
- [Modularity Aspects of Disjunctive Stable Models](https://mlsanity.com/paper/1401.3484/) (2014)
- [Modular Answer Set Programming as a Formal Specification Language](https://mlsanity.com/paper/2008.02015/) (2020)
- [Discovering and Proving Invariants in Answer Set Programming and Planning](https://mlsanity.com/paper/1905.03196/) (2019)
- [Refactoring for Reuse: An Empirical Study](https://mlsanity.com/paper/2111.07002/) (2021)

## Built on by (most cited first, 1 of 1)

- [Relating Answer Set Programming and Many-sorted Logics for Formal Verification](https://mlsanity.com/paper/2502.09230/) (2025)

## Abstract (arXiv)

In imperative programming, the Domain-Driven Design methodology helps in coping with the complexity of software development by materializing in code the invariants of a domain of interest. Code is cleaner and more secure because any implicit assumption is removed in favor of invariants, thus enabling a fail fast mindset and the immediate reporting of unexpected conditions. This article introduces a notion of template for Answer Set Programming that, in addition to the don't repeat yourself principle, enforces locality of some predicates by means of a simple naming convention. Local predicates are mapped to the usual global namespace adopted by mainstream engines, using universally unique identifiers to avoid name clashes. This way, local predicates can be used to enforce invariants on the expected outcome of a template in a possibly empty context of application, independently by other rules that can be added to such a context. Template applications transpiled this way can be processed by mainstream engines and safely shared with other knowledge designers, even when they have zero knowledge of templates.
