WikiProject Computer science (Rated Start-class, Low-importance)
This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start  This article has been rated as Start-Class on the project's quality scale.
Low  This article has been rated as Low-importance on the project's importance scale.

## Article is completely opaque for anyone who isn't already an expert

Can someone attempt to rewrite this article for benefit of people who aren't already 100% aware of answer set programming is? Relevant examples would be a huge help. — Preceding unsigned comment added by 38.99.133.121 (talk) 18:56, 3 October 2012 (UTC)

## tail/body

"An answer set program is composed of a set of rules, each rules being composed of an head and a tail: 'head <-- body'" is that supposed to be "head <-- tail"?

Actually, it's "body" the correct term; "tail" was my mistake. Changed. - Liberatore(T) 23:03, 12 May 2006 (UTC)

Afaik there are no negations allowed in the head, so my guess is that these examples are wrong Kermesbeere 16:05, 8 January 2007 (UTC)

V. Lifschitz (2002) disagrees with you: "The negation as failure symbol is allowed to occur in the head of a rule, and not only in the body as in traditional logic programming." (page 41, lines 8-9). If don't have access to that article see [1]. Tizio 17:00, 8 January 2007 (UTC)
Negation as failure in the head may well be permissible in the language discussed in that paper, but that should be considered as an extension -- and not part of the usual syntax for answer set programs Zootalures 17:59, 18 February 2007 (UTC)

Either way, negation as failure is currently not defined in the article at all. The "not" symbol is used in some of the examples, but is nowhere defined. See Stable model semantics. 141.157.47.37 (talk) 11:59, 26 May 2009 (UTC)

## Start of Clean up

I've made a go at cleaning up the article a bit, although it's still not perfect. The Math sections which were in the syntax section before looked messy (and IMHO the example rules given were not representative of the "standard" ASP syntax (see for instance [2] for a good overview of the "basic" syntax and a number of extensions).

I'd prefer it if the rule sections that i've added were in math blocks using the "formal" syntax (i.e. ${\displaystyle \neg }$ and ${\displaystyle \leftarrow }$instead of `-` and `:-` , but the latex converter was a bit fickle and it was hard to get a given program to look consistent (parts seemed to be translated to png, and others to HTML, which looked ugly).

It would be nice to see some coverage of disjunction and choice in the head (i.e. dlv head choice and smodels choice rules), also something about variable expansion, and function symbols (and possibly how they are considered in relation to predicates in prolog)

Also there should probably be some context and history relating to Datalog but I'm not well enough versed to provide this.

There should also be a link to or merge with Stable model semantics.

Zootalures 00:41, 19 February 2007 (UTC)

From stable model semantics you get both ASP (credulous reasoning) and Well-founded Semantics as implemented e.g. by XSB using the SLG-WAM which are two competing ways to represent knowledge. ASP is not synonymous with stable models. --anon user

Hello! Ricardo.6ik 01:39, 19 June 2007 (UTC)

I have significantly extended Stable model semantics, and I plan to add a few more sections about constructs used in ASP -- classical negation, constraints, disjunctive rules, choice rules and aggregates. Then that article will completely supersede the current version of Answer set programming. Here is my proposal: let's rewrite Answer set programming from scratch, with a different emphasis. It will be about ASP as a programming methodology, about applications of stable models and answer set solvers, such as smodels, to knowledge representation and search. For theoretical background related to stable models, the reader will be referred to Stable model semantics.

That would require that we replace the current version of Answer set programming by a new stub. If there are no objections then I'll try to do that. Vlifschitz 20:54, 7 September 2007 (UTC)

The earlier version is replaced by a new stub, with apologies to the editors who have invested their time in cleaning up the original text. Vlifschitz 19:03, 3 October 2007 (UTC)

can this be disambiguated vs. asp.net? Thanks!Highland8410 (talk) 19:51, 2 June 2016 (UTC)

## The computational process

It would be useful to have more information in the article about the computational process. Otherwise, it is hard to be sure that answer set programs are really declarative. The link to the DPLL algorithm does not give enough information about the treatment of negation.136.187.112.90 (talk) 02:22, 25 March 2008 (UTC)

## confused!

The article says:

```1{p,q,r}2.
```

This rule says: choose at least 1 of the atoms ${\displaystyle p,q,r}$, but not more than 2. The meaning of this rule under the stable model semantics is represented by the propositional formula

${\displaystyle (p\lor \neg p)\land (q\lor \neg q)\land (r\lor \neg r)}$
${\displaystyle \land \,(p\lor q\lor r)\land \neg (p\land q\land r).}$

Yet the answer contains p,q, and r in at least 2 of the clauses! Please clarify. Perhaps an example of 1{p,q,r}3 or something would help.

72.48.91.117 (talk) 15:32, 21 April 2010 (UTC)

It is not the number or size of clauses that matters but the assignment of true or false to p, q and r such that the formula is satisfied. Let's consider satisfying none of p, q and r: for the first three clauses, that works but then we can't satisfy the fourth clause. Let's consider each of p, q and r: for the first four clauses, that works but then we can't satisfy the last clause. Satisfying the formula with 1 or 2 of p, q and r is possible however. - Simeon (talk) 01:45, 9 June 2010 (UTC)
Another remark on this example: the first line of the formula does not make any difference, since that part is a tautology, i.e. it evaluates always to true. Only the second part is needed:
${\displaystyle (p\lor q\lor r)\land \neg (p\land q\land r).}$
Eray (talk) 08:22, 16 July 2013 (UTC)

## Relationship to QBF ?

This is a naive or stupid question or both: but what exactly is the relationship to QBF? I noticed, just from hands-on experience writing some ASP programs, that most clauses/sentences that one writes are of the form "there exists" (i.e. if this is true(i.e. exists) then that is true (i.e. exists)), while aggregates tend to have a "for-all" flavor to them. Now, one can't nest these arbitrarily (clasp/clingo spews an error about "unstratified predicates" or something like that), but still, ASP seems to somehow have a there-exists/for-all-like structure, nested to (no more than) one level. Can this be expressed formally? Or perhaps in the stable model semantics article? linas (talk) 04:38, 25 April 2012 (UTC)

Hello fellow Wikipedians,

I have just modified one external link on Answer set programming. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, please set the checked parameter below to true or failed to let others know (documentation at `{{Sourcecheck}}`).

You may set the `|checked=`, on this template, to true or failed to let other editors know you reviewed the change. If you find any errors, please use the tools below to fix them or call an editor by setting `|needhelp=` to your help request.

• If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
• If you found an error with any archives or the URLs themselves, you can fix them with this tool.

If you are unable to use these tools, you may set `|needhelp=<your help request>` on this template to request help from an experienced user. Please include details about your problem, to help other editors.

Cheers.—InternetArchiveBot 04:42, 15 October 2016 (UTC)