A normal ASP rule head :- pos.., not neg... head == 0 encodes an integrity
constraint :- pos.., not neg.. (admits no atom; prunes models satisfying the body).
Outcome of an answer-set computation — distinguishes “no model” (an over-constrained /
inconsistent program) from genuine results, so the caller can route the former to
paraconsistent reasoning instead of treating absence-of-model as plain falsity.
Compute answer sets; if NONE exist, return AspOutcome::NoStableModel so the caller routes
the (inconsistent) program to modalities::paraconsistent::route_paraconsistent rather than
silently concluding falsity. This is the tight integration with paraconsistent routing.
Compute the stable models (answer sets) of rules over atoms. Each answer set is
written to out as a bitmask over atom indices (bit i ⇔ atoms[i] is in the set).
Returns the number found. Zero-heap; bounded to ASP_MAX_ATOMS atoms.
Returns number of stable models found (max MAX_STABLE_MODELS = 8)
Worlds are encoded as context-hash variants: world_i_context = base_context ^ (i as u64)
Ground a rule TEMPLATE by substituting variable var with each element of domain, writing
the ground instances into out. Returns the count. Apply repeatedly (over the partially-ground
output) for multiple variables. Zero-heap — bounded by out.len() (the “millions of
constraints” ceiling is the caller’s buffer, not a heap allocation here).
The optimal answer set: the stable model minimising total weak-constraint penalty. Returns
(model_bitmask, penalty), or None if the program has no stable model. buf is scratch for
the enumerated answer sets.