Constraint Answer Set Programming (CASP)
- Constraint Answer Set Programming (CASP) is a hybrid approach that fuses nonmonotonic, rule-based reasoning with numerical constraint solving to model problems with symbolic and numeric dimensions.
- Integrational and translational architectures in CASP allow effective coupling of ASP solvers with constraint or SMT/FlatZinc backends, enhancing performance in planning, scheduling, and optimization tasks.
- Goal-directed execution models like s(CASP) improve explainability and efficiency by interleaving backward chaining with constraint checks, yielding minimal justifications for query results.
Constraint Answer Set Programming (CASP) is a hybrid approach that combines Answer Set Programming (ASP) with constraint processing or numerical constraint solving. In CASP, ASP provides the nonmonotonic, rule-based, combinatorial layer, while the constraint layer handles arithmetic or other non-Boolean relations. Across the literature, CASP is presented both as ASP extended with numerical constraints and as a broader family of architectures that combine ASP, constraint processing, and, in translational lines of work, satisfiability modulo theories (SMT) (Lierler, 2021, Lierler et al., 2017).
1. Semantic foundations
A standard formal view treats a constraint answer set program as a triple
where is a logic program over regular and irregular atoms, is a set of constraints, and is an injective mapping from irregular atoms to constraints, with the restriction (Lierler et al., 2017). In this setting, a set is an answer set of the CAS program if is an input answer set of relative to the irregular atoms and the constraints selected by the irregular atoms in are jointly satisfiable (Lierler et al., 2017). A closely related formulation, used in planning-oriented work, states that
This makes explicit that ASP chooses the discrete structure while the constraint component checks the associated numeric feasibility (Balduccini et al., 2017, Balduccini et al., 2016).
The same semantic pattern appears in newer linear-constraint formulations. In asp-fzn, a CASP answer set is based on an e-interpretation 0, where 1 is a set of atoms and 2 maps linear variables to integers; the ASP part is evaluated by treating linear atoms as ordinary atoms, while 3 must satisfy all domain restrictions and all reified linear constraints of the form
4
with 5 (Eiter et al., 30 Jul 2025). This suggests a stable common core across CASP variants: answer-set semantics governs the logical structure, and a valuation or constraint solution supplies the theory side.
The motivation for this combination is likewise stable across the literature. CASP is used when a problem has both symbolic and numeric structure: ASP handles defaults, choices, and combinatorial dependencies; the constraint component handles large numeric domains, dense domains, linear integer constraints, mixed integer-real constraints, or nonlinear relations more naturally than a fully grounded Boolean encoding (Lierler, 2021, Shen et al., 2019, Balduccini et al., 2017).
2. Architectures and the relation to SMT
A central distinction in CASP is between integrational and translational approaches. Integrational systems directly combine an ASP solver with a constraint solver: preprocessing and grounding produce a propositional ASP abstraction, the ASP solver enumerates candidate answer sets, and a constraint solver checks whether the associated constraint problem is satisfiable (Lierler, 2021). EZCSP is a canonical case study of this line. Its formalization is built around logic programs with constraint atoms and an ASP abstraction 6, and its solver architecture combines a pre-processor, a grounder, an ASP solver, a CLP translator, and a CP solver (Balduccini et al., 2017). The same case study emphasizes that solver coupling is not a secondary implementation detail: black-box integration, grey-box integration, and clear-box integration can differ by orders of magnitude on different benchmarks, and no single integration schema is universally best (Balduccini et al., 2017, Balduccini et al., 2013).
Translational systems instead compile CASP into another formalism whose models correspond to answer sets. The precise formal bridge to SMT is made explicit through uniform theories: for a uniform theory 7, a valuation 8 is a solution to a GCSP 9 iff the corresponding interpretation in 0 satisfies the restriction formula 1; therefore, the GCSP has a solution iff the restriction formula is 2-satisfiable (Lierler et al., 2017). For tight programs, input completion is sufficient; for non-tight programs, level-ranking constraints are added to recover stable-model minimality (Lierler et al., 2017). EZSMT+ pushes this line to arbitrary CASP programs, including non-tight ones and programs with choice rules and aggregates. Its pipeline grounds the input, computes completion, adds generalized level-ranking formulas for non-tight programs, translates the result to SMT-LIB, and delegates search to an off-the-shelf SMT solver such as CVC4, Z3, or Yices (Shen et al., 2019). The theoretical basis is the generalized level-ranking characterization of answer sets, extending Niemelä’s original construction and the later generalizations by Lierler and Susman; the paper states that the models of the constructed 3 theory are in one-to-one correspondence with answer sets of the program (Shen et al., 2019).
A more recent translational line targets FlatZinc rather than SMT-LIB. asp-fzn translates CASP programs with linear constraints into solver-independent FlatZinc and can use CP-SAT, Chuffed, or Gurobi as backend solvers (Eiter et al., 30 Jul 2025). Its translation 4 combines ranking constraints, body constraints, head constraints, and supportedness constraints, and for head-cycle-free programs the paper proves soundness, completeness, and a one-to-one correspondence when strict correspondence constraints are used (Eiter et al., 30 Jul 2025). This suggests that translational CASP is no longer tied to SMT alone: FlatZinc provides access to CP and MIP backends, especially for optimization-heavy instances (Eiter et al., 30 Jul 2025).
3. Grounding-free and goal-directed CASP
A distinct line of CASP rejects grounding as the basic execution discipline. s(CASP) is a top-down, goal-driven ASP system based on s(ASP) that can evaluate CASP programs without grounding them either before or during execution (Arias et al., 2020, Arias et al., 2018). Its rule form is
5
or, equivalently in the more abstract presentation,
6
where the 7 or 8 are constraints from an underlying constraint system (Arias et al., 2020, Arias et al., 2018). The operational semantics is query-driven and relies on backward chaining, a meta-interpreter, loop handling, and a dual program for constructive negation (Arias et al., 2020, Arias et al., 2018). Negative goals are not treated as simple failure tests: the dual program is synthesized from Clark’s completion and De Morgan’s laws, and a generalized forall mechanism, C-forall, handles the universal quantification introduced in dualization (Arias et al., 2020, Arias et al., 2018). The result of a successful query is a partial stable model containing only the literals necessary to support that query together with the relevant constraints (Arias et al., 2020).
This goal-directed execution model is closely tied to explainability. The formal object introduced in the justification work is the Minimal s(CASP) Justification Tree, defined as the ordered list of literals in the path of the successful goal-directed proof of the query, conjoined with that of the proof of the global constraint under the operational semantics of s(CASP) (Arias et al., 2020). The emphasis is on relevance: the tree is minimal for the returned derivation, preserves variable relationships and dense-domain constraints, and can justify positive literals, negative literals, and global constraints (Arias et al., 2020). The system can render justifications in plain text, expandable HTML, and natural language; #pred directives provide domain-specific explanations (Arias et al., 2020). On the PAS example, justification generation with --tree and different rendering options slows execution by at most about 15%, the baseline execution without justifications takes about 340 ms, and for the query ?- chose(ace_inhibitors) s(CASP) takes about 0.35 seconds while xclingo takes about 1 minute 53 seconds because the program has 1024 models and s(CASP) generates only the single relevant partial model (Arias et al., 2020).
Performance work on the same line replaces generate-and-test consistency checking with Dynamic Consistency Checking (DCC). Standard s(CASP) collects denials into nmr_check/0 and runs them after model generation; DCC interleaves model generation and consistency checking by generating specialized dcc rules and calling eval_dcc/2 when a ground goal is about to be added to the tentative model (Arias et al., 2021). The paper reports speedups of about 10× for Hamiltonian with 4 vertices, about 41.1× for Hamiltonian with 7 vertices, about 4.3× for 9-queens with 0, about 4.9× for 1-queens with 2, and about 90.8× for 3-queens with 4 (Arias et al., 2021). A plausible implication is that, in the goal-directed CASP line, denials increasingly function as propagating constraints rather than as post hoc tests.
4. Constraint languages, expressiveness, and compilation techniques
The language layer of CASP is itself a research topic. In clingcon-style syntax, a typical linear constraint atom has the form
5
with integer variables and a comparison operator such as 6 (Fandinno et al., 10 Feb 2026). FLINGO extends this setting by restoring ASP-style expressiveness inside numerical constraints. Its key design choices are that integer variables are undefined by default, a defined integer variable must be founded by a rule or constraint, and the language supports default values, undefinedness, choice-like generation of values, aggregates over integer variables, assignment rules, and strict versus non-strict numerical aggregation (Fandinno et al., 10 Feb 2026). The new constraint forms include
7
where &sum is non-strict, &sus is strict, and \{x\} talks about definedness (Fandinno et al., 10 Feb 2026). The semantic translation is given in Here-and-There with constraints and compiled to regular CASP programs following the clingcon input format (Fandinno et al., 10 Feb 2026).
Constraint languages also increasingly expose global constraints and backend-neutral intermediate representations. asp-fzn supports linear constraints over integer variables together with distinct, cumulative, and disjoint, and its FlatZinc theory includes &sum, &minimize, &dom, &disjoint, &cumulative, and &distinct (Eiter et al., 30 Jul 2025). This is particularly relevant for scheduling-style and optimization-style applications because the same CASP model can be sent to CP or MIP backends (Eiter et al., 30 Jul 2025). By contrast, earlier compiler-style work such as aspartame translated finite linear CSPs into ASP facts plus an ASP encoding, reusing sugar for parsing and normalization and using order encoding with gringo and clasp as the computational backend (Banbara et al., 2013). In that line, CSP structure is represented explicitly by facts such as var(x,range(1,3)). and constraint(CId, Expr)., and static analysis computes relevant thresholds for order variables and structural subexpressions (Banbara et al., 2013).
Translation-based CASP also enabled systematic symmetry handling. In the symmetry-breaking work, multi-valued variables are encoded by atoms 8, symmetry detection is reduced to graph automorphism on a 3-colored graph, and lex-leader symmetry-breaking constraints are generated from permutation generators (Drescher, 2010). For value symmetry, the paper gives a decomposition of the global value precedence constraint using DFA-style state atoms and proves that unit-propagation on the encoding enforces domain consistency on the original constraint (Drescher, 2010). This suggests that CASP is not only a way to combine rules with constraints; it is also a platform for importing CSP techniques such as global-constraint propagation and symmetry breaking into ASP-oriented solving workflows.
5. Application domains
Hybrid planning is a major CASP application. PDDL+ planning via CASP translates mixed discrete-continuous planning domains into logic rules plus numerical constraints, with Boolean fluents represented by atoms such as 9, numerical fluents represented by 0 and 1, and time represented by 2 and 3 (Balduccini et al., 2016, Balduccini et al., 2017). The encoding handles instantaneous actions, durative actions, processes, and events; represents continuous effects by additive contributions; and captures PDDL+ must semantics by choice rules plus complementary is_false atoms for numerical preconditions (Balduccini et al., 2016, Balduccini et al., 2017). The later work adds a discretize-and-validate loop with VAL and intermediate-point refinement when invariants are violated between state boundaries (Balduccini et al., 2017). Both papers emphasize that the approach can handle linear and non-linear hybrid domains and that CASP naturally combines symbolic planning with arithmetic constraints (Balduccini et al., 2016, Balduccini et al., 2017).
Event Calculus is another major domain, especially on the grounding-free side. Modeling and reasoning in Event Calculus using s(CASP) relies on dense time, CLP(4), constructive negation, and direct encodings of BEC axioms such as holdsAt, stoppedIn, and startedIn (Arias et al., 2021). The same execution model has been used for early validation of high-level requirements in cyber-physical systems. In the PCA pump study, a real requirements specification is transformed into an Event Calculus model and evaluated with s(CASP), enabling deductive as well as abductive reasoning and leading to fully-automatically detected nuanced violations of critical safety properties (Vašíček et al., 2024). The paper reports a subtle overdose scenario in the original model, identifies it as a missing requirement, and discusses non-termination and scalability issues together with mitigation techniques such as specialized axiomatization, incremental abduction, prototype caching with up to 95% speedup on individual test narratives and about 66% average improvement overall, and multi-run reasoning that reduced one example from 6.3 hours to about 12 seconds (Vašíček et al., 2024).
Compliance checking and optimization applications illustrate other CASP modeling styles. The AMA UAV flight-readiness checker uses s(CASP) through a SWI-Prolog SWISH REST service, encodes questionnaire answers as propositional facts, derives violation predicates, returns a justification tree in human-readable natural language, and computes a minimal set of conditions that must be changed to regain compliance by treating questionnaire literals as abducibles and selecting the partial model with the smallest difference from the violating condition set (Varanasi et al., 2022). The same paper explicitly says the rules are simple enough to be coded as propositional answer set programs and that the concrete encoding is not a numeric CASP encoding (Varanasi et al., 2022). By contrast, traffic signal optimisation uses clingcon 3 on a bounded-horizon corridor model with 6 junctions and 34 road links, linear theory atoms for occupancy and cumulative counters, and an explicit optimization statement
&maximize{counter(horizon,L) : initial_count(L)}. (Tarzariol et al., 25 Jul 2025). On real historical data from Huddersfield, the decision version improved the PDDL+ baseline on the successfully solved instances; 27 instances were solved under the 900-second horizon and 43 instances timed out at 900 seconds, which the paper presents as evidence both of practical potential and of current scalability limits (Tarzariol et al., 25 Jul 2025).
6. Conceptual issues, misconceptions, and open directions
A recurring conceptual issue is whether constraints should be understood as mere filters on a pre-existing solution set. The epistemic note argues that, for constrained settings, this intuition can be too strong: a constraint added to a program should not automatically be understood as something that merely filters a pre-existing set of answer sets or world views, because in the examples the constraint participates in the generation of the intended model (Shen et al., 2020). The paper’s broader implication for CASP is explicit: constraints can be constructive, not merely filtering, and strong monotonicity or foundedness requirements may exclude legitimate solutions supported only in the presence of the constraint machinery (Shen et al., 2020).
Another misconception is that CASP has a single canonical architecture or a single canonical notion of constraint. The literature instead shows several orthogonal design choices: loose or tight integration, translation to SMT-LIB or FlatZinc, non-ground goal-directed execution, and language designs that range from propositional violation rules with abduction to linear integer constraints with global scheduling constraints (Balduccini et al., 2017, Eiter et al., 30 Jul 2025, Varanasi et al., 2022). The same applies to performance claims. EZCSP and the clear-box/grey-box study show that no single integration schema is universally best (Balduccini et al., 2017, Balduccini et al., 2013). EZSMT+ shows that a full SMT compilation can be exact for arbitrary CASP programs through completion plus generalized level rankings (Shen et al., 2019). s(CASP) shows that avoiding grounding can restore variable links and enable relevance-based explanations, while DCC shows that interleaving consistency checking can yield speedups of up to 90x on combinatorial benchmarks (Arias et al., 2018, Arias et al., 2021).
Open directions follow directly from these lines of work. EZSMT+ points to optimization via partial weighted maxSMT and to alternative intermediate formats like MiniZinc (Shen et al., 2019). The integrational-versus-translational overview emphasizes the need for a standard input language for CASP solvers, analogous to ASP-Core-2, SMT-LIB, and MiniZinc, together with better front ends, richer optimization support, and deeper understanding of the relationship among SMT, CSP/CLP, and mixed integer programming (Lierler, 2021). FLINGO extends numeric expressiveness inside constraints, asp-fzn widens backend support through FlatZinc, and the s(CASP)-based requirements work proposes improved abduction, more systematic caching and tabling, and an Event-Calculus-specialized meta-reasoner to overcome persistent evaluation limitations (Fandinno et al., 10 Feb 2026, Eiter et al., 30 Jul 2025, Vašíček et al., 2024). Taken together, these directions indicate that CASP is best understood not as a fixed formalism but as a family of semantic, architectural, and language designs for combining stable-model reasoning with theory-rich constraint processing.