Jul 14, 2018 [ICLP-2018] Constraint Answer Set Programming without Grounding J. Arias 1 , 2 M. Carro 1 , 2 E. Salazar 3 K. Marple 3 G. Gupta 3 1 IMDEA Software Institute, 2 Universidad Polit´ ecnica de Madrid, 3 University of Texas at Dallas madrid institute for advanced studies in software development technologies
www.software.imdea.org ASP + Constraints - Grounding = s(CASP) madrid institute for advanced studies in software development technologies 1 / 26
www.software.imdea.org Motivation ASP + constraints: grounding phase an issue since ranges of (constrained) variables may be infinite. • Unbound range: X #> 0 in N • Bound range, but dense domain: X #> 0 ∧ X #< 1 in Q Current CASP systems (e.g., EZCSP [Balduccini and Lierler 2017] and clingo[DL/LP] [Janhunen et al. 2017] ) limit (some of): • Admissible constraint domains. • Where constraints can appear. • Type / number of models computed. madrid institute for advanced studies in software development technologies 2 / 26
www.software.imdea.org s(CASP): Main Points • Adds constraints to s(ASP) [Marple et al. 2017] , a top-down execution model that avoids the grounding phase. • Is implemented with a goal-driven interpreter written in Ciao Prolog. • The execution of a program starts with a query . • Each answer provides the mgu of a successful derivation, its justification, and the relevant (partial) stable model. • Retains variables and constraints during the execution and in the model. https://ciao-lang.org https://gitlab.software.imdea.org/joaquin.arias/sCASP madrid institute for advanced studies in software development technologies 3 / 26
www.software.imdea.org Background madrid institute for advanced studies in software development technologies 4 / 26
www.software.imdea.org Background: s(ASP) [Marple et al. 2017] • s(ASP) computes constructive negation: not p(X) returns in X the values for which p(X) fails. • Negated atoms are resolved against dual rules synthesized applying De Morgan’s laws to Clark’s completion of the original program. • The construction of dual rules need two new operators: • Disequality (negation of the unification). • Universal quantifier (in the body of the clauses). • To ensure that global constraints and consistency rules hold, NMR-check rules are synthesized and executed. • The resulting program is executed by the s(ASP) interpreter which: • Carries around explicitly unification and disequality constraints. • Detects and handles different types of loops. madrid institute for advanced studies in software development technologies 5 / 26
www.software.imdea.org Background: Compilation of the Dual (Example) Given the predicate: Its dual rules are: p(0). not p(X) :- not p1(X), not p2(X). 1 1 p(X) :- q(X), not t(X,Y). not p1(X) :- X \= 0. 2 2 not p2(X) :- 3 forall(Y, not p2_(X,Y)). 4 not p2_(X,Y) :- not q(X). 5 not p2_(X,Y) :- q(X), t(X,Y). 6 Predicate to disjunction of calls ∀ x (( p ( x ) ← x = 0 ) ( p ( x ) ← ∃ y ( q ( x ) ∧¬ t ( x , y )))) ∧ ∀ x ( p ( x ) ←− p 1 ( x ) ∨ p 2 ( x )) ∀ x ( p 1 ( x ) ←− x = 0 ) ∀ x ( p 2 ( x ) ←− ∃ y ( q ( x ) ∧ ¬ t ( x , y ))) madrid institute for advanced studies in software development technologies 6 / 26
www.software.imdea.org Background: Compilation of the Dual (Example) Given the predicate: Its dual rules are: p(0). not p(X) :- not p1(X), not p2(X). 1 1 p(X) :- q(X), not t(X,Y). not p1(X) :- X \= 0. 2 2 not p2(X) :- 3 forall(Y, not p2_(X,Y)). 4 not p2_(X,Y) :- not q(X). 5 not p2_(X,Y) :- q(X), t(X,Y). 6 Clark’s Completion Construction of the dual program ∀ x ( p ( x ) ←→ p 1 ( x ) ∨ p 2 ( x )) ∀ x ( ¬ p ( x ) ←→ ¬ p 1 ( x ) ∧ ¬ p 2 ( x )) madrid institute for advanced studies in software development technologies 6 / 26
www.software.imdea.org Background: Compilation of the Dual (Example) Constructive Given the predicate: Its dual rules are: disequality p(0). not p(X) :- not p1(X), not p2(X). 1 1 p(X) :- q(X), not t(X,Y). not p1(X) :- X \= 0. 2 2 not p2(X) :- 3 forall(Y, not p2_(X,Y)). 4 not p2_(X,Y) :- not q(X). 5 not p2_(X,Y) :- q(X), t(X,Y). 6 Clark’s Completion Construction of the dual program ∀ x ( p ( x ) ←→ p 1 ( x ) ∨ p 2 ( x )) ∀ x ( ¬ p ( x ) ←→ ¬ p 1 ( x ) ∧ ¬ p 2 ( x )) ∀ x ( p 1 ( x ) ←→ x = 0 ) ∀ x ( ¬ p 1 ( x ) ←→ x � 0 ) madrid institute for advanced studies in software development technologies 6 / 26
www.software.imdea.org Background: Compilation of the Dual (Example) Given the predicate: Its dual rules are: p(0). not p(X) :- not p1(X), not p2(X). 1 1 p(X) :- q(X), not t(X,Y). not p1(X) :- X \= 0. 2 2 not p2(X) :- 3 forall(Y, not p2_(X,Y)). 4 not p2_(X,Y) :- not q(X). 5 not p2_(X,Y) :- q(X), t(X,Y). 6 Clark’s Completion Construction of the dual program ∀ x ( p ( x ) ←→ p 1 ( x ) ∨ p 2 ( x )) ∀ x ( ¬ p ( x ) ←→ ¬ p 1 ( x ) ∧ ¬ p 2 ( x )) ∀ x ( p 1 ( x ) ←→ x = 0 ) ∀ x ( ¬ p 1 ( x ) ←→ x � 0 ) ∀ x ( p 2 ( x ) ←→ ∃ y ( q ( x ) ∧ ¬ t ( x , y ))) madrid institute for advanced studies in software development technologies 6 / 26
www.software.imdea.org Background: Compilation of the Dual (Example) Given the predicate: Its dual rules are: p(0). not p(X) :- not p1(X), not p2(X). 1 1 Forall p(X) :- q(X), not t(X,Y). not p1(X) :- X \= 0. 2 2 not p2(X) :- 3 forall(Y, not p2_(X,Y)). 4 not p2_(X,Y) :- not q(X). 5 not p2_(X,Y) :- q(X), t(X,Y). 6 Clark’s Completion Construction of the dual program ∀ x ( p ( x ) ←→ p 1 ( x ) ∨ p 2 ( x )) ∀ x ( ¬ p ( x ) ←→ ¬ p 1 ( x ) ∧ ¬ p 2 ( x )) ∀ x ( p 1 ( x ) ←→ x = 0 ) ∀ x ( ¬ p 1 ( x ) ←→ x � 0 ) ∀ x ( p 2 ( x ) ←→ ∃ y ( q ( x ) ∧ ¬ t ( x , y ))) ∀ x ( p 2 ( x ) ←→ ∃ y B p 2 ( x , y )) ∀ x ( ¬ p 2 ( x ) ←→ ∀ y ¬ B p 2 ( x , y )) madrid institute for advanced studies in software development technologies 6 / 26
www.software.imdea.org Background: Compilation of the Dual (Example) Given the predicate: Its dual rules are: p(0). not p(X) :- not p1(X), not p2(X). 1 1 p(X) :- q(X), not t(X,Y). not p1(X) :- X \= 0. 2 2 not p2(X) :- 3 forall(Y, not p2_(X,Y)). 4 not p2_(X,Y) :- not q(X). 5 not p2_(X,Y) :- q(X), t(X,Y). 6 Clark’s Completion Construction of the dual program ∀ x ( p ( x ) ←→ p 1 ( x ) ∨ p 2 ( x )) ∀ x ( ¬ p ( x ) ←→ ¬ p 1 ( x ) ∧ ¬ p 2 ( x )) ∀ x ( p 1 ( x ) ←→ x = 0 ) ∀ x ( ¬ p 1 ( x ) ←→ x � 0 ) ∀ x ( p 2 ( x ) ←→ ∃ y ( q ( x ) ∧ ¬ t ( x , y ))) ∀ x ( p 2 ( x ) ←→ ∃ y B p 2 ( x , y )) ∀ x ( ¬ p 2 ( x ) ←→ ∀ y ¬ B p 2 ( x , y )) ∀ x ( ¬ B p 2 ( x , y ) ←→ ¬ q ( x )) madrid institute for advanced studies in software development technologies 6 / 26
www.software.imdea.org Background: Compilation of the Dual (Example) Given the predicate: Its dual rules are: p(0). not p(X) :- not p1(X), not p2(X). 1 1 p(X) :- q(X), not t(X,Y). not p1(X) :- X \= 0. 2 2 not p2(X) :- 3 forall(Y, not p2_(X,Y)). 4 not p2_(X,Y) :- not q(X). 5 not p2_(X,Y) :- q(X), t(X,Y). 6 Clark’s Completion Construction of the dual program For efficiency ∀ x ( p ( x ) ←→ p 1 ( x ) ∨ p 2 ( x )) ∀ x ( ¬ p ( x ) ←→ ¬ p 1 ( x ) ∧ ¬ p 2 ( x )) ∀ x ( p 1 ( x ) ←→ x = 0 ) ∀ x ( ¬ p 1 ( x ) ←→ x � 0 ) ∀ x ( p 2 ( x ) ←→ ∃ y ( q ( x ) ∧ ¬ t ( x , y ))) ∀ x ( p 2 ( x ) ←→ ∃ y B p 2 ( x , y )) ∀ x ( ¬ p 2 ( x ) ←→ ∀ y ¬ B p 2 ( x , y )) ∀ x ( ¬ B p 2 ( x , y ) ←→ ¬ q ( x )) ∀ x ( ¬ B p 2 ( x , y ) ←→ t ( x , y )) madrid institute for advanced studies in software development technologies 6 / 26
www.software.imdea.org Background: Compilation of the NMR-check (Example) Given the consistency rule: Any model should satisfy: ∀ � x ( p ( � x ) ← ∃ � y B ∧¬ p ( � x )) ∀ � x ∀ � y ( ¬ B ∨ p ( � x ))) madrid institute for advanced studies in software development technologies 7 / 26
www.software.imdea.org Background: Compilation of the NMR-check (Example) Given the consistency rule: Any model should satisfy: ∀ � x ( p ( � x ) ← ∃ � y B ∧¬ p ( � x )) ∀ � x ∀ � y ( ¬ B ∨ p ( � x ))) p(X) :- q(X,Y), ..., not p(X). chk_1(X) :- forall(Y, not chk_1_(X,Y)). 1 1 not chk_1_(X,Y) :- not q(X,Y). 2 ... 3 not chk_1_(X,Y) :- q(X,Y), ..., p(X). 4 madrid institute for advanced studies in software development technologies 7 / 26
www.software.imdea.org Background: Compilation of the NMR-check (Example) Given the consistency rule: Any model should satisfy: ∀ � x ( p ( � x ) ← ∃ � y B ∧¬ p ( � x )) ∀ � x ∀ � y ( ¬ B ∨ p ( � x ))) p(X) :- q(X,Y), ..., not p(X). chk_1(X) :- forall(Y, not chk_1_(X,Y)). 1 1 not chk_1_(X,Y) :- not q(X,Y). 2 ... 3 not chk_1_(X,Y) :- q(X,Y), ..., p(X). 4 ⊥ ← ∃ � x ¬ r ( � x ) ∀ � x r ( � x ) :- not r(X). chk_2 :- forall(X, r(X)). 1 1 madrid institute for advanced studies in software development technologies 7 / 26
Recommend
More recommend