Semantics of templates in a compositional framework for building logics

Ingmar Dasseville , Matthias van der Hallen, Gerda Janssens, Marc Denecker

ICLP 2015

FO(·)-KBS project

  • a purely declarative KR language

  • an integration of classical logic with (extended) logic programs

  • based on the thesis :

rule set under
well-founded semantics

=
 inductive definition as found in mathematical text

FO(·)-KBS project in practice

  • Closely connected with ASP and abductive LP

  • IDP: a knowledge base system 

            + applications in software engineering

Observations

  1. KR-languages are repetitive (e.g. reachability)
  2. No abstractions with semantics

With a meaning which is embedded in the language

Existing approaches

ASP+Templates

 

  • Very usable in practice (resulted in DLT)
  • Template = Macro
  • Recursion?

HILOG

  • Better abstractions
  • Procedural execution
  • Template = second order definition
  • First order semantics

GOAL

A logical view of templates: second order definitions
 

Treat templates as
(rule based) definitions

GOAL

Extend the semantics

of an arbitrary KR-language with templates 

{transitiveClosure(P,Q) ← 
    {Q(x,y) ← P(x,y).
     Q(x,y) ← (∃ z: Q(x,z)∧Q(z,y)).
    }. 
}

The Challenge

Well Founded Semantics + 

  • Second order predicates
  • Nested definitions

⇒Recursive templates

  • Previously unsolved problem

new language constructs are hard

Adding aggregates is done in a 1000 ways

New framework for adding language constructs and building logics

A COMPOSITIONAL FRAMEWORK
FOR BUILDING LOGICS

Define rule formalism
for an existing logic L

Lift two-valued semantics
to three-valued ones

Nested logics with a recursive syntax

TEMPLATES

A COMPOSITIONAL FRAMEWORK
FOR BUILDING LOGICS

Define rule formalism
for an existing logic L

Lift two-valued semantics
to three-valued ones

Nested logics with a recursive syntax

TEMPLATES

Rule formalsim for a logic L?

When can we define well-founded and stable semantics 

for sets of rules of the form:
       ∀x: P(x)  <- φ[x]
where φ is an expression of L?

When L has a

3-valued truth assignment:
        (Partial Structure, φ) -> Three

3-valued truth assignment of logics

1) \leq_p\text{-monotone: } x\leq_p y \Rightarrow \overline{F}(x)\leq_p \overline{F}(y)
1)p-monotone: xpyF(x)pF(y)1) \leq_p\text{-monotone: } x\leq_p y \Rightarrow \overline{F}(x)\leq_p \overline{F}(y)
\text{Requirements for an evaluation function }
Requirements for an evaluation function \text{Requirements for an evaluation function }
\text{extending } (F : X \rightarrow Two) \text{ to } (\overline{F} : \overline{X} \rightarrow Three)
extending (F:XTwo) to (F:XThree)\text{extending } (F : X \rightarrow Two) \text{ to } (\overline{F} : \overline{X} \rightarrow Three)
2) \text{exact and extending: } x\in X : \overline{F}(x) = F(x)
2)exact and extending: xX:F(x)=F(x)2) \text{exact and extending: } x\in X : \overline{F}(x) = F(x)
unknown \leq_p true
unknownptrueunknown \leq_p true
unknown \leq_p false
unknownpfalseunknown \leq_p false

Rule formalsim for a logic L?

R_w(L)
Rw(L)R_w(L)

= The logic of well-founded rulesets over L

R^I = true
RI=trueR^I = true

if I is a well-founded model of rule set R

R_{st}(L)
Rst(L)R_{st}(L)

= The logic of stable rulesets over L

Results obtained through Approximation Fixpoint Theory

L can already contain definitions!

Rule formalsim for a logic L

A COMPOSITIONAL FRAMEWORK
FOR BUILDING LOGICS

Define rule formalism
for an existing logic L

Lift two-valued semantics
to three-valued ones

Nested logics with a recursive syntax

TEMPLATES

3-valued evaluation of logics

\text{An evaluation function } \text{extending } (F : X \rightarrow Two)
An evaluation function extending (F:XTwo)\text{An evaluation function } \text{extending } (F : X \rightarrow Two)
\text{ to } (\overline{F} : \overline{X} \rightarrow Three)
 to (F:XThree)\text{ to } (\overline{F} : \overline{X} \rightarrow Three)
\overline{F}(\overline{x}) = glb_{\leq_p}\{F(x) | \overline{x} \leq_p x\}
F(x)=glbp{F(x)xpx}\overline{F}(\overline{x}) = glb_{\leq_p}\{F(x) | \overline{x} \leq_p x\}

∧: (Two²   Two)

 u = u
 u = f
 t = u
 f = f

A COMPOSITIONAL FRAMEWORK
FOR BUILDING LOGICS

Define rule formalism
for an existing logic L

Lift two-valued semantics
to three-valued ones

Nested logics with a recursive syntax

TEMPLATES

Logic =

Syntax + Semantics

Logic =

Set of Language Constructs

 

Language Construct =

Syntax + Semantics

Compositional framework

Syntax

Semantics:

 

(\phi \land \psi) ^I = \&(\phi^I,\psi^I)
(ϕψ)I=&(ϕI,ψI)(\phi \land \psi) ^I = \&(\phi^I,\psi^I)

&: (Three²   Three)

&(t , u) = u
&(f , u) = f
&(u , t) = u
&(u , f) = f

Also works for rulesets!

(\phi \land \psi)
(ϕψ)(\phi \land \psi)

COMPOSITIONAL FRAMEWORK

FO(ID^*) =\{Atom^1 ,\land,\lor,\lnot,\forall, \exists, R_w \}^*
FO(ID)={Atom1,,,¬,,,Rw}FO(ID^*) =\{Atom^1 ,\land,\lor,\lnot,\forall, \exists, R_w \}^*
FO =\{Atom^1 ,\land,\lor,\lnot,\forall, \exists \}
FO={Atom1,,,¬,,}FO =\{Atom^1 ,\land,\lor,\lnot,\forall, \exists \}
FO(ID) = FO \bigcup R_w(FO)
FO(ID)=FORw(FO)FO(ID) = FO \bigcup R_w(FO)
SO(ID^*) =\{Atom^1 ,Atom^2 ,\land,\lor,\lnot,\forall, \exists, R_w \}^*
SO(ID)={Atom1,Atom2,,,¬,,,Rw}SO(ID^*) =\{Atom^1 ,Atom^2 ,\land,\lor,\lnot,\forall, \exists, R_w \}^*

*

A COMPOSITIONAL FRAMEWORK
FOR BUILDING LOGICS

Define rule formalism
for an existing logic L

Lift two-valued semantics
to three-valued ones

Nested logics with a recursive syntax

TEMPLATES

What is a Template?

A second order, (well-founded) definition.

 

(Which we now can define over any logic L!)

Library of templates

Further results

  • Theorem: Using templates as macros is a sound and complete transformational semantics for templates as higher order definitions

DLT is consistent with our work

Conclusion

  • Define rulesets of an arbitrary logic 
  • Use these in a compositional framework
  • Write libraries for arbitrary logics

ToDo:

  • Better support for functions
  • Typed Logics
  • Use this compositional framework to develop a real system (IDP4)

Semantics of templates in a compositional framework for building logics

By Ingmar Dasseville

Semantics of templates in a compositional framework for building logics

  • 1,117