Declarative Solver Development:
Case Studies

Bart Bogaerts, Tomi Janhunen, Shahab Tasharrofi
(Aalto University)

Get the slides: slides.com/krr/2016/live

Knowledge Representation (and Reasoning): Status

  • Many interesting KR formalisms
  • Often without solvers
  • Users cannot readily benefit from the formalism

Abstract Argumentation

  • 1995: +/- 4 semantics (Dung)
  • Later: many more semantics
  • Now: solver development

KR 2016

Many new formalisms without solver

Why is no-one building solvers?

Take-home message

  • Building a solver should not be hard (anno 2016)

  • A high-level description of semantics should suffice


If you can describe your semantics in second-order logic,

you get a solver for free

Second-order logic

  • Well-known
  • Clear informal semantics
  • Not an end target

What's next

  1. Applications
    • Abstract argumentation
    • Logic programming
    • Propositional logics
  2. Efficiency
  3. Under the hood
  4. Conclusion & future work

1. Applications

Abstract argumentation

Abstract argumentation

  • Argumentation framework: graph (A,R)
  • R represents an attack relation between arguments

Abstract argumentation

  • We implemented four semantics:
    • grounded semantics
    • stable semantics
    • complete semantics
    • preferred semantics
  • For each semantics, we implemented four inference methods:
    • Finding some extension
    • Enumerating extensions
    • Credulous inference
    • Skeptical inference

Abstract argumentation

An interpretation S is conflict-free if S attacks no argument in S

Abstract argumentation

An interpretation S is conflict-free if S attacks no argument in S



\mathcal{T}_{CF} = \left\{ \lnot \exists N, M: r(N,M) \land s(N) \land s(M).\right\}
TCF={¬N,M:r(N,M)s(N)s(M).}\mathcal{T}_{CF} = \left\{ \lnot \exists N, M: r(N,M) \land s(N) \land s(M).\right\}

Abstract argumentation

  • A node x is attacked by S if S contains at least one of x's attackers
  • A node x is defended by S if S attacks all x's attackers

With S={b,d}:

Abstract argumentation

  • A node x is attacked by S if S contains at least one of x's attackers
  • A node x is defended by S if S attacks all x's attackers




\begin{array}{l}\mathcal{T}_{AD} =\\ \left\{\begin{array}{l} \forall N: att(N) {\Leftrightarrow} ( a(N) \wedge \exists M: r(M,N) \wedge s(M) ). \\ \forall N: def(N) {\Leftrightarrow} ( a(N) \wedge \forall M: r(M,N) {\Rightarrow} att(M) ). \end{array} \right\} \end{array}
TAD={N:att(N)(a(N)M:r(M,N)s(M)).N:def(N)(a(N)M:r(M,N)att(M)).}\begin{array}{l}\mathcal{T}_{AD} =\\ \left\{\begin{array}{l} \forall N: att(N) {\Leftrightarrow} ( a(N) \wedge \exists M: r(M,N) \wedge s(M) ). \\ \forall N: def(N) {\Leftrightarrow} ( a(N) \wedge \forall M: r(M,N) {\Rightarrow} att(M) ). \end{array} \right\} \end{array}

Abstract argumentation

Stable semantics: An interpretation S is a  stable extension if S consists exactly of all arguments not attacked by S

Abstract argumentation

Stable semantics An interpretation S is a stable extension if S consists exactly of all arguments not attacked by S




\mathcal{T}_{ST} = \left\{\begin{array}{l} \mathcal{T}_{AD}. \\ \forall N: a(N)\Rightarrow (s(N)\Leftrightarrow \lnot att(N)). \end{array} \right\}
TST={TAD.N:a(N)(s(N)¬att(N)).} \mathcal{T}_{ST} = \left\{\begin{array}{l} \mathcal{T}_{AD}. \\ \forall N: a(N)\Rightarrow (s(N)\Leftrightarrow \lnot att(N)). \end{array} \right\}

Abstract argumentation

Similar theories for:

  • Grounded extensions
  • Preferred extensions
  • Complete extensions

Abstract argumentation

Different reasoning modes:

  • Finding an extension
  • Finding all extensions
  • Credulous inference: Does x hold in some extension
  • Skeptical inference: Does x hold in all extensions

Abstract argumentation

Different reasoning modes:

  • Credulous inference: Does x hold in some extension
  • Skeptical inference: Does x hold in all extensions





\begin{array}{l} \mathcal{T}_{ST}^{cred} = \{\exists s:\, \mathcal{T}_{ST}\, \wedge\, s(x).\} \\ \mathcal{T}_{ST}^{skep} = \{\forall s:\, \mathcal{T}_{ST} \,\Rightarrow \,s(x).\} \end{array}
TSTcred={s:TSTs(x).}TSTskep={s:TSTs(x).}\begin{array}{l} \mathcal{T}_{ST}^{cred} = \{\exists s:\, \mathcal{T}_{ST}\, \wedge\, s(x).\} \\ \mathcal{T}_{ST}^{skep} = \{\forall s:\, \mathcal{T}_{ST} \,\Rightarrow \,s(x).\} \end{array}

Abstract argumentation

Implementation: We only give the solver an ASCII representation of the second-order theory






\begin{array}{l} \mathcal{T}_{ST}^{cred} = \{\exists s:\, \mathcal{T}_{ST}\, \wedge\, s(x).\} \end{array}
TSTcred={s:TSTs(x).}\begin{array}{l} \mathcal{T}_{ST}^{cred} = \{\exists s:\, \mathcal{T}_{ST}\, \wedge\, s(x).\} \end{array}
? s: 
    (?N: in_test(N) & s(N)) & 
     ! N: in_node(N) => (~s(N) <=> ( ? M: in_attack(M,N) & s(M) ) ).

Logic Programming

Logic Programming

Second-order theories for 

  • Stable semantics of disjunctive logic programs
  • Grounded fixpoint semantics of normal logic programs

Logic Programming

Disjunctive logic program: set of  rules of the form

h_1\vee \cdots \vee h_l \leftarrow a_1\wedge \cdots \wedge a_n \wedge \neg b_1\wedge \cdots \wedge \neg b_m
h1hla1an¬b1¬bmh_1\vee \cdots \vee h_l \leftarrow a_1\wedge \cdots \wedge a_n \wedge \neg b_1\wedge \cdots \wedge \neg b_m

An interpretation I (a set of atoms) is a  stable model if it is a (subset)minimal model of the reduct

\left\{\begin{array}{l} h_1\vee \cdots \vee h_l \leftarrow a_1\wedge \cdots \wedge a_n \mid\\ \quad h_1\vee \cdots \vee h_l \leftarrow a_1\wedge \cdots \wedge a_n \wedge \neg b_1\wedge \cdots \wedge \neg b_m \in \mathcal{P} \\ \qquad\wedge\, b_i \notin I \text{ for all } 1\leq i\leq m \end{array}\right\}
{h1hla1anh1hla1an¬b1¬bmPbiI for all 1im} \left\{\begin{array}{l} h_1\vee \cdots \vee h_l \leftarrow a_1\wedge \cdots \wedge a_n \mid\\ \quad h_1\vee \cdots \vee h_l \leftarrow a_1\wedge \cdots \wedge a_n \wedge \neg b_1\wedge \cdots \wedge \neg b_m \in \mathcal{P} \\ \qquad\wedge\, b_i \notin I \text{ for all } 1\leq i\leq m \end{array}\right\}

Logic Programming

An interpretation I (a set of atoms) is a stable model if it is a (subset)minimal model of the reduct

\left\{ \begin{array}{l} \forall A: i(A)\Rightarrow a(A).\\ \forall R: r(R) \wedge \\\quad (\forall A: pb(R,A)\Rightarrow i(A)) \wedge (\forall B: nb(R,B)\Rightarrow \neg i(B)) \\ \qquad\Rightarrow (\exists H: h(R,H)\wedge i(H)). \\ \neg \exists i':\\ \quad (\forall A: i'(A)\Rightarrow i(A))\wedge (\exists A: i(A)\wedge \neg i'(A))\,\wedge\\ \quad\forall R: r(R)\wedge\\ \qquad (\forall A: pb(R,A)\Rightarrow i'(A)) \wedge (\forall B: nb(R,B)\Rightarrow \neg i(B)) \\ \quad\qquad\Rightarrow (\exists H: h(R,H)\wedge i'(H)). \end{array} \right\}
{A:i(A)a(A).R:r(R)(A:pb(R,A)i(A))(B:nb(R,B)¬i(B))(H:h(R,H)i(H)).¬i:(A:i(A)i(A))(A:i(A)¬i(A))R:r(R)(A:pb(R,A)i(A))(B:nb(R,B)¬i(B))(H:h(R,H)i(H)).} \left\{ \begin{array}{l} \forall A: i(A)\Rightarrow a(A).\\ \forall R: r(R) \wedge \\\quad (\forall A: pb(R,A)\Rightarrow i(A)) \wedge (\forall B: nb(R,B)\Rightarrow \neg i(B)) \\ \qquad\Rightarrow (\exists H: h(R,H)\wedge i(H)). \\ \neg \exists i':\\ \quad (\forall A: i'(A)\Rightarrow i(A))\wedge (\exists A: i(A)\wedge \neg i'(A))\,\wedge\\ \quad\forall R: r(R)\wedge\\ \qquad (\forall A: pb(R,A)\Rightarrow i'(A)) \wedge (\forall B: nb(R,B)\Rightarrow \neg i(B)) \\ \quad\qquad\Rightarrow (\exists H: h(R,H)\wedge i'(H)). \end{array} \right\}

Logic Programming

  • In the paper, generalised for parametrised programs
  • From the second-order theories, we obtain a solver for 
    • Stable semantics
    • Grounded fixpoint semantics

Propositional logics

Propositional logics

Second-order theories for:

  • Monotone logics
    • Classical propositional logic
    • The logic of here and there
  • Non-monotone logics
    • Equilibrium logic
    • Supported models
    • Parallel Circumscription

Obtained a solver for each of these semantics

2. Efficiency

Efficiency

  • All good and well but... how does it scale
  • Is it good enough for prototyping?
  • Experiments: only for argumentation
    • Reran last year's competition
      • 8 * 192 + 8 * 576 instances
      • 600 second time limit
      • Intel Xeon E5-4652
    • Compared with CoQuiAAS (last year's winner)
S2S-CoQuiAAS Some Ext All Ext Cred Skep
Complete 192 - 192 191 - 191 576 - 575 576 - 576
Preferred 192 - 191 190 - 189 576 - 576 576 - 576
Grounded 192 - 192 192 - 192 576 - 576 576 - 576
Stable 192 - 192 192 - 191 576 - 576 576 - 576

3. Under the Hood

Under the Hood

  • SAT-to-SAT: QBF-like solver based on nested SAT solvers + lazy clause generation
  • We extended it with a grounder for second-order logic

SAT-to-SAT

\begin{array}{l} \exists \sigma: \varphi\\ \quad \wedge \neg \exists \tau: \psi \end{array}
σ:φ¬τ:ψ\begin{array}{l} \exists \sigma: \varphi\\ \quad \wedge \neg \exists \tau: \psi \end{array}

Grounding to SAT-to-SAT

4. Conclusion & Future Work

Declarative solver development is feasable

  • Wide variety of logics

  • Reasonably efficient

Language should be extended

  • Second-order logic: not always sufficient
  • Types
  • Arithmetic
  • Aggregates
  • Recursive definitions
  • ...

Giving the user more control

  • Control in the grounding process
  • Control in the  solver
    • Heuristics
    • Clause learning/explanation mechanism
    • ...
paper webpage slides
Made with Slides.com