Deontic Answer Set Programming (ASP) is a declarative logic programming paradigm that formalizes normative reasoning by encoding obligations, permissions, and prohibitions as logical rules, where the resulting stable models (answer sets) represent the complete, non-contradictory sets of normative conclusions that hold in a given scenario. It extends standard ASP with deontic operators to model what an agent ought to do rather than what is merely true.
Glossary
Deontic Answer Set Programming (ASP)

What is Deontic Answer Set Programming (ASP)?
A declarative programming paradigm that encodes normative knowledge as logic programs, where stable models represent valid, non-contradictory sets of obligations satisfying a given scenario.
Unlike classical Standard Deontic Logic (SDL), Deontic ASP inherently handles contrary-to-duty (CTD) obligations and normative conflicts through non-monotonic reasoning and default negation. By leveraging ASP's ability to generate multiple answer sets, it compactly represents alternative compliant states, making it particularly suited for legal reasoning systems that must resolve conflicting regulations through principles like lex specialis.
Key Features of Deontic ASP
Deontic Answer Set Programming (ASP) provides a robust computational framework for encoding and resolving normative knowledge. It translates obligations, permissions, and prohibitions into logic programs where stable models represent the valid, non-contradictory sets of norms that govern a given scenario.
Stable Model Semantics for Norms
The core mechanism of Deontic ASP is the computation of stable models (answer sets). Each stable model represents a distinct, logically coherent world that satisfies all encoded rules. In a deontic context, a stable model corresponds to a maximally consistent set of obligations and facts. If a scenario generates multiple stable models, it indicates the existence of multiple valid normative interpretations or unresolved conflicts, providing a transparent audit trail for legal reasoning.
Explicit Encoding of Contrary-to-Duty Obligations
A critical advantage of Deontic ASP is its native ability to handle Contrary-to-Duty (CTD) obligations without generating logical paradoxes. Unlike Standard Deontic Logic, which collapses under scenarios like Chisholm's Paradox, ASP uses default negation (not) and weak constraints to elegantly model fallback rules.
- Primary Rule: You ought not to cause damage.
- CTD Rule: If you cause damage, you ought to report it. ASP correctly yields a stable model where the reporting obligation is active precisely because the primary prohibition was violated.
Non-Monotonic Conflict Resolution
Legal systems are inherently defeasible—conclusions can be withdrawn in light of new evidence or higher-priority rules. Deontic ASP is a non-monotonic formalism, meaning adding new information can shrink the set of valid conclusions. This is implemented through:
- Default negation: A rule applies only if its contrary is not provable.
- Weak constraints: Penalize certain outcomes to minimize violations, effectively encoding preference hierarchies like lex superior (higher law prevails) or lex specialis (specific law prevails).
Declarative Knowledge Representation
Deontic ASP separates the representation of knowledge from the reasoning procedure. The user declares what the norms are, not how to compute them. This declarative approach allows a single set of rules to be queried for multiple purposes:
- Compliance Checking: Is a given action sequence compliant?
- Planning: What actions can an agent take to remain compliant?
- Explanation: Why is a specific obligation active or violated? This drastically reduces the engineering complexity of building normative reasoning engines.
Integration with Hohfeldian Analysis
Deontic ASP can formally model the complex jural relations identified in Hohfeldian Analysis. The framework moves beyond simple obligation/permission to represent:
- Power: The capacity to alter a legal relation.
- Liability: Being subject to another's power.
- Disability: The absence of power. By grounding these concepts in explicit predicates, ASP disambiguates complex legal positions, such as the distinction between a lack of permission and a lack of capacity, which is crucial for accurate contract analysis.
Temporal Reasoning with Event Calculus
Static norms are insufficient for real-world legal reasoning. Deontic ASP is often combined with the Deontic Event Calculus to track the lifecycle of obligations over time. This allows the system to reason about:
- Activation: When a contract signing triggers a duty.
- Fulfillment/Violation: When an action satisfies or breaches an obligation.
- Expiration: When a deadline passes and a duty terminates. This temporal extension enables automated monitoring of compliance in dynamic, event-driven systems.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about using Answer Set Programming to model obligations, permissions, and prohibitions in legal reasoning systems.
Deontic Answer Set Programming (ASP) is a declarative programming paradigm that encodes normative knowledge—obligations, permissions, and prohibitions—as logic programs, where the stable models (answer sets) represent the valid, non-contradictory sets of obligations that satisfy a given scenario. Unlike procedural code, you declare what the norms are, and the ASP solver computes which obligations hold. It is particularly powerful for modeling contrary-to-duty (CTD) obligations, normative conflicts, and defeasible rules because ASP's non-monotonic semantics naturally handle exceptions and retracted conclusions. A typical deontic ASP program includes facts (e.g., violation(speeding)), rules with default negation (e.g., obligation(pay_fine) :- violation(speeding), not exception), and integrity constraints to detect contradictions. The solver, such as clingo, grounds the program and searches for all stable models, each representing a coherent normative state.
Related Terms
Deontic Answer Set Programming integrates formal logic with normative reasoning. The following concepts are essential for understanding how obligations, permissions, and prohibitions are encoded and resolved within this declarative paradigm.
Stable Model Semantics
The foundational semantics of ASP that define the valid solutions (answer sets) of a logic program. A stable model is a minimal set of literals that satisfies all rules and is justified by the program itself. In deontic ASP, each stable model represents a non-contradictory set of obligations that satisfies the encoded normative scenario. The Gelfond-Lifschitz reduct is the formal mechanism used to verify stability, ensuring that every derived obligation has a non-circular justification rooted in the facts of the case.
Default Negation
The operator not in ASP, representing negation as failure. Unlike classical negation (-), default negation allows reasoning about what is not known to be true. In deontic contexts, this is critical for modeling:
- Negative permissions: An action is permitted if it is not explicitly prohibited.
- Defeasible obligations: A duty holds unless an exception is known to apply.
- Closed-world assumption: The legal code is treated as a complete specification of what is regulated.
Weak Constraints
A soft constraint mechanism in ASP that expresses preferences rather than hard requirements. Unlike strong constraints (which eliminate answer sets), weak constraints assign penalty points to solutions that violate them. The optimal answer sets minimize total penalty. In deontic ASP, weak constraints model:
- Normative hierarchies: Preferring higher-authority norms.
- Lex specialis: Minimizing violations of specific rules over general ones.
- Contrary-to-duty optimization: Selecting the least non-compliant resolution path when full compliance is impossible.
Choice Rules
ASP constructs using curly brace syntax {a; b; c} that allow the reasoner to non-deterministically include any subset of the listed atoms in an answer set. In deontic modeling, choice rules represent:
- Permissive norms: An agent may perform any of the listed actions.
- Discretionary powers: A judge may select from a range of applicable remedies.
- Multiple compliant states: Generating all possible sets of obligations that satisfy a regulatory framework, enabling exhaustive compliance analysis.
Deontic Conflict Resolution via ASP
ASP's native ability to generate multiple answer sets makes it uniquely suited for identifying and resolving normative conflicts. When a legal scenario admits contradictory obligations, each answer set represents a distinct resolution strategy. The solver can be guided by:
- Preference rules: Encoding lex superior and lex specialis.
- Cardinality constraints: Limiting the number of violated norms.
- Disjunctive rules: Explicitly enumerating mutually exclusive compliance paths. This produces a complete landscape of legally defensible outcomes rather than a single brittle conclusion.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us