Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Potassco: The Answer Set Solving Collection (potassco.org)
50 points by todsacerdoti on Dec 20, 2022 | hide | past | favorite | 17 comments


>> Answer Set Programming (ASP) offers a simple and powerful modeling language to solve combinatorial problems.

I wonder if this isn't the completely wrong way to explain what ASP is for. I'm saying this because until recently I used to think of ASP just like that, a logic programming language that's good for optimisation problems and that is "more declarative" because it implements classical negation (a.k.a. default negation) and not just negation-as-failure as in Prolog (a.k.a. the closed-world assumption).

To be honest, I never though that's particularly interesting. But it turns out that there is a much more interesting motivation for ASP: nomonotonic reasoning, and the ability to represent uncertainty in a purely logical framework, a kind of proof-theoretical framework of reasoning with uncertainty.

This paper is what changed my mind:

Automating commonsense reasoning with ASP and s(CASP)

https://personal.utdallas.edu/~gupta/csr-scasp.pdf

And while I cringe a bit whenever anyone says the words "commonsense reasoning" (because it's typically neither common sense, nor much reasoning; in humans, let alone modelled by machines) the first few sections in the paper are a simple, plain-worded, straight-forward explanation of what ASP is really about that I think will speak to the heart of every logician who has ever looked at Baye's rule, looked at a gigantic, noisy dataset, and couldn't help thinking of the Mogwai and how you should never feed them after midnight lest they turn into Gremlins (like probabilities turn to statistics when you try to instantiate those random variables with actual, you know, numbers).


ASP has both classical negation and negation-as-failure, but that is not quite why I'd say it is "more declarative". Prolog is capable of performing "imperative" tasks (by this I really mean side effects), while ASP solvers exclusively find stable models (answer sets) that may (or may not) exist for a given logic program. In ASP you can only declare a model with your input, and the output is either one or more stable model(s), or the knowledge that the model was unsatisfiable.

You are right about it being more than just a "modeling language to solve combinatorial problems", I agree that description sells it a bit short. As you pointed out, it is well suited for problems involving non-monotonic reasoning and uncertainty. You can encode reasoning that is more reality-hardened, with logical rules to deal with imperfect information.


>> ASP has both classical negation and negation-as-failure, but that is not quite why I'd say it is "more declarative". Prolog is capable of performing "imperative" tasks (by this I really mean side effects), while ASP solvers exclusively find stable models (answer sets) that may (or may not) exist for a given logic program. In ASP you can only declare a model with your input, and the output is either one or more stable model(s), or the knowledge that the model was unsatisfiable.

Thanks for the insight. I must confess I still don't have a lot of experience with ASP, mainly because of my initial misunderstanding of it.

To clarify, I'm not interested in the declarative aspect of logic programming so Prolog's side-effect-ness doesn't bother me. I prefer it in fact that Prolog is pragmatic that way and allows itself to be used to do practical work, that would otherwise have to be delegated to another language or tool. Prolog is a big, dirty ball of cheating but I've kind of made my home in it and I'm comfortable there.

But my research interest is in machine learning of logic programs (Inductive Logic Programming, ILP). A big part of that is dealing with noise and uncertainty, which traditional approaches to ILP aren't very good at. In recent years there has been a flurry of work in learning either ASP, or with ASP, and I guess I feel a bit like an idiot to finally realise why. My hope now is that I can find a way to reuse the ideas in ASP with the learning framework I studied in my PhD, where first-order programs are learned by a form of higher-order SLD-Resolution. I think the combination of a sound and refutation-complete inductive algorithm with an elegant treatment of uncertainty could produce something really unique.


You can do cool stuff with s(CASP).

See https://swish.swi-prolog.org/p/non-monotonic_ilp.swinb

For an example. The potential hypothesis here are pre generated, but you can imagine an algorithm or adapt an existing one with a tight generalise/specialise loop.

But the scasp finds the two potential rules that cover both positive examples but not the negative example.

i.e.

flies(X,h8):-not penguin(X).

and

flies(X,h17):-bird(X),not penguin(X).

Which is cool.


Thanks, that's a nice example.

>> For an example. The potential hypothesis here are pre generated, but you can imagine an algorithm or adapt an existing one with a tight generalise/specialise loop.

Yes! I'm thinking of how to adapt Louise (https://github.com/stassa/louise) to do that. The fact that s(CASP) is basically a Prolog-y version of ASP (with constraints) could make it a very natural sort of modification. Or, of course, there's always Well-Founded Semantics (https://www.swi-prolog.org/pldoc/man?section=WFS).

What's hyp_gen.pl?


I don't have a working hyp_gen.pl anymore I think but it was just a simple search given the atoms to add to a rule and its negations.


And adapting Louise would be an interesting thing to work on for sure. Why is it called Louise?


There was an earlier system called Thelma (https://github.com/stassa/thelma), an acronym for "Theory Learning Machine". Then I created a new system and, well, I couldn't resist a bad pun. They're a bit of a tradition in ILP.


Thank you. You convinced me to read the paper, and so far I’m loving it.


Potassco is a wonderful collection of software. I have used clingo recently to prototype some puzzle ideas that I had. After encoding the rules in ASP I could quickly produce a single model through clingo to see if the puzzle design was feasible or not. (I also decided to use clingo to enumerate the solution space, but it turned out to be much bigger than I anticipated and after ten days I terminated the process with just shy of a billion solutions found...)

Since then I have been dreaming of using it to actually power puzzle software, where a single logic program could be used for both puzzle generation and validation. But that's not even the only "power couple" I can think of with respect to clingo/ASP integration. There are a number of hard problems that benefit from the declarative approach and could leverage the power and speed of a solver like clingo. And with libclingo this is now a feasible option to transform your problem into an ASP program, call clingo, then transform the answer set into your solution.


I used generic programming to automatically generate puzzles for a puzzle game. It worked really well. I still needed to play each generated puzzle to see if it was interesting/fun. But most of them were great. I can imagine that ASP would be really good for that kind of thing.


This is a recent paper I thought was really intriguing using Answer Set Programming for a synthesis problem with some very promising sounding results compared to an SMT based approach. http://www.weaselhat.com/2022/11/07/asp/


I don't see it. All the examples in this thread are trivial. I looked up the paper. All it does is answer trivial logic puzzles.

penguin(pingu).

bird(X):-penguin(X).

that kind of thing. I downloaded the examples.zip from the website. It is a long list of undocumented examples. I sampled a few, but they are all of this nature. So I guess my question is:

Why is this impressive?


It scales to much bigger problems, that's the impressive part. You can solve a small SAT problem with simple backtracking search, but try to solve a problem with millions of variables and tens of millions of constraints and suddenly your backtracking search is laughably slow.

This is like that but at a higher level of expressivity. Having both classical negation and negation as failure allows for easy modelling of uncertainty for example.

We don't know if P=NP but with how efficient these tools are in practice, maybe it doesn't matter that much x)


Still trying to understand exactly what this is. It seems like its like a declarative DSL for interacting with an SMT solver? Is this supposed to be for different use cases than an SMT solver? Does it solve different classes of problems, or is it just a different "interface" to the same basic capabilities?


It's its own brand of constraint solving, distinct from SAT/CP/SMT/MIP. Like the others it is particularly good at certain classes of problems, despite theoretically them all being "equivalent" and most of them just using a SAT solver underneath.

ASP is best viewed as Datalog++, in that it's a fully declarative logic programming language with some restrictions to allow for efficient solving. It is more expressive than datalog but in turn the solving tech required is a lot more computationally expensive.


What are the odds of this appearing today in HN? I was only looking yesterday about the current status of Potassco, after an entire decade. I then checked if there was anything recently written about it in HN. And behold, today there is a post.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: