Published: 12th September 2023
DOI: 10.4204/EPTCS.385
ISSN: 2075-2180

EPTCS 385

Proceedings 39th International Conference on
Logic Programming
Imperial College London, UK, 9th July 2023 - 15th July 2023

Edited by: Enrico Pontelli, Stefania Costantini, Carmine Dodaro, Sarah Gaggl, Roberta Calegari, Artur D'Avila Garcez, Francesco Fabiano, Alessandra Mileo, Alessandra Russo and Francesca Toni

Preface
Stefania Costantini, Enrico Pontelli, Roberta Calegari, Carmine Dodaro, Francesco Fabiano, Sarah Gaggl, Artur Garcez, Alessandra Mileo, Alessandra Russo and Francesca Toni

Main Track

ABA Learning via ASP
Emanuele De Angelis, Maurizio Proietti and Francesca Toni
1
Complexity and Scalability of Reasoning in many-valued Weighted Knowledge Bases with Typicality - Extended Abstract
Mario Alviano, Laura Giordano and Daniele Theseider Dupré
9
Benchmarking for Integrating Logic Rules with Everything Else
Yanhong A. Liu, Scott D. Stoller, Yi Tong and K. Tuncay Tekle
12
Explanations for Answer Set Programming
Mario Alviano, Ly Ly Trieu, Tran Cao Son and Marcello Balduccini
27
A Dataflow Analysis for Comparing and Reordering Predicate Arguments
Gonzague Yernaux and Wim Vanhoof
41
Towards a Rule-Based Approach for Deriving Abstract Domains (Extended Abstract).
Daniel Jurjo, Jose F. Morales, Pedro López-García and Manuel V. Hermenegildo
55
"Would life be more interesting if I were in AI?" Answering Counterfactuals based on Probabilistic Inductive Logic Programming
Kilian Rückschloß and Felix Weitkämper
58
Multiple Query Satisfiability of Constrained Horn Clauses
Emanuele De Angelis, Fabio Fioravanti, Alberto Pettorossi and Maurizio Proietti
65
Towards One-Shot Learning for Text Classification using Inductive Logic Programming
Ghazal Afroozi Milani, Daniel Cyrus and Alireza Tamaddoni-Nezhad
69
On the Potential of CLIP for Compositional Logical Reasoning
Justin Brody
80
Bottom-Up Stratified Probabilistic Logic Programming with Fusemate
Peter Baumgartner and Elena Tartaglia
87
Generalizing Level Ranking Constraints for Monotone and Convex Aggregates
Tomi Janhunen
101
Sorting Strategies for Interactive Conflict Resolution in ASP
Andre Thevapalan and Gabriele Kern-Isberner
116
Inductive Learning of Declarative Domain-Specific Heuristics for ASP
Richard Comploi-Taupe
129
Natlog: Embedding Logic Programming into the Python Deep-Learning Ecosystem
Paul Tarau
141
Solving Recurrence Relations using Machine Learning, with Application to Cost Analysis
Maximiliano Klemen, Miguel Á. Carreira-Perpiñán and Pedro Lopez-Garcia
155
On the Independencies Hidden in the Structure of a Probabilistic Logic Program
Kilian Rückschloß and Felix Weitkämper
169
Understanding ProbLog as Probabilistic Argumentation
Francesca Toni, Nico Potyka, Markus Ulbricht and Pietro Totis
183
Towards a Representation of Decision Theory Problems with Probabilistic Answer Set Programs
Damiano Azzolini, Elena Bellodi and Fabrizio Riguzzi
190
On Feasibility of Declarative Diagnosis
Włodzimierz Drabent
193
Explainable and Trustworthy Traffic Sign Detection for Safe Autonomous Driving: An Inductive Logic Programming Approach
Zahra Chaghazardi, Saber Fallah and Alireza Tamaddoni-Nezhad
201
Quantification and Aggregation over Concepts of the Ontology
Pierre Carbonnelle, Matthias Van der Hallen and Marc Denecker
213
A Logic Programming Approach to Global Logistics in a Co-Design Environment
Emmanuelle Dietz, Tobias Philipp, Gerrit Schramm and Andreas Zindel
227
The Janus System: Multi-paradigm Programming in Prolog and Python
Theresa Swift and Carl Andersen
241
The ICARUS-System for Interactive Coherence Establishment in Logic Programs
Andre Thevapalan and Jesse Heyninck
256

Application, System, and Demo Track

Inferring Compensatory Kinase Networks in Yeast using Prolog
George A. Elder and Conrad Bessant
260
Reliable Natural Language Understanding with Large Language Models and Answer Set Programming
Abhiramon Rajasekharan, Yankai Zeng, Parth Padalkar and Gopal Gupta
274
Leasing the Cloud-Edge Continuum, à la Carte
Stefano Forti, Ahmad Ibrahim and Antonio Brogi
288
Assessing Drivers' Situation Awareness in Semi-Autonomous Vehicles: ASP based Characterisations of Driving Dynamics for Modelling Scene Interpretation and Projection
Jakob Suchan and Jan-Patrick Osterloh
300
On the Development of PASTA: Inference in Probabilistic Answer Set Programming under the Credal Semantics
Damiano Azzolini
314
Logical English Demonstration
Robert Kowalski and Jacinto Dávila
317
ForgettingWeb
Matti Berthold, Matthias Knorr and Daphne Odekerken
321
Demonstrating (Hybrid) Active Logic Documents and the Ciao Prolog Playground, and an Application to Verification Tutorials
Daniela Ferreiro, José F. Morales, Salvador Abreu and Manuel V. Hermenegildo
324
Anthem-P2P: Automatically Verifying the Equivalent External Behavior of ASP Programs
Zachary Hansen
330
Nemo: First Glimpse of a New Rule Engine
Alex Ivliev, Stefan Ellmauthaler, Lukas Gerlach, Maximilian Marx, Matthias Meißner, Simon Meusel and Markus Krötzsch
333
PySpArX - A Python Library for Generating Sparse Argumentative Explanations for Neural Networks
Ioana Mihailescu, Alan Weng, Siddharth Sharma, Mihnea Ghitu, Dilshaan Grewal, Khemi Chew, Hamed Ayoobi, Nico Potyka and Francesca Toni
336

Machine Learning Track

Deep Inductive Logic Programming meets Reinforcement Learning
Andreas Bueff and Vaishak Belle
339

Explainability, Ethics, and Trustworthiness Track

An xAI Approach for Data-to-Text Processing with ASP
Alessandro Dal Palù, Agostino Dovier and Andrea Formisano
353
Deontic Paradoxes in ASP with Weak Constraints
Christian Hatschka, Agata Ciabattoni and Thomas Eiter
367

Recently Published Research Track

Alternating Fixpoint Operator for Hybrid MKNF Knowledge Bases as an Approximator of AFT (Extended Abstract)
Fangfang Liu and Jia-Huai You
381
Summary of Statistical Statements in Probabilistic Logic Programming
Damiano Azzolini, Elena Bellodi and Fabrizio Riguzzi
384
Error-free Smart Legal Contracts without Programmers
Kevin Purnell and Rolf Schwitter
387
Axiomatization of Aggregates: Extended Abstract
Jorge Fandinno, Zachary Hansen and Yuliya Lierler
390
Visual Sensemaking Needs Both Vision and Semantics: On Logic-Based Declarative Neurosymbolism for Reasoning about Space and Motion
Jakob Suchan, Mehul Bhatt and Srikrishna Varadarajan
393
Flexible Job-shop Scheduling for Semiconductor Manufacturing with Hybrid Answer Set Programming (Extended Abstract)
Ramsha Ali, Mohammed M. S. El-Kholany and Martin Gebser
396
Body-Decoupled Grounding via Solving: A Novel Approach on the ASP Bottleneck (Extended Abstract)
Viktor Besin, Markus Hecher and Stefan Woltran
399
Tackling the DM Challenges with cDMN: A Tight Integration of DMN and Constraint Reasoning (Extended Abstract)
Simon Vandevelde, Bram Aerts and Joost Vennekens
402
FOLL-E: Teaching First Order Logic to Children (Extended Abstract)
Simon Vandevelde and Joost Vennekens
405
Learning to Break Symmetries for Efficient Optimization in Answer Set Programming (Extended Abstract)
Alice Tarzariol, Martin Gebser, Konstantin Schekotihin and Mark Law
408

Doctoral Consortium

Penalization Framework For Autonomous Agents Using Answer Set Programming
Vineel S. K. Tummala
411
Beyond Traditional Neural Networks: Toward adding Reasoning and Learning Capabilities through Computational Logic Techniques
Andrea Rafanelli
416
Explainable Answer-set Programming
Tobias Geibinger
423

Preface

Stefania Costantini - University of L'Aquila, Italy
Enrico Pontelli - New Mexico State University, USA
Roberta Calegari - University of Bologna, Italy
Carmine Dodaro - University of Calabria, Italy
Francesco Fabiano - University of Udine, Italy
Sarah Gaggl - TU Dresden, Germany
Artur Garcez - City University of London, UK
Alessandra Mileo - DCU, Ireland
Alessandra Russo - Imperial College London, UK
Francesca Toni - Imperial College London, UK

Introduction

This volume contains the Technical Communications presented at the 39th International Conference on Logic Programming (ICLP 2023), held at Imperial College London, UK from July 9 to July 15, 2023. Technical Communications included here concern the Main Track, the Doctoral Consortium, the Application and Systems/Demo track, the Recently Published Research Track, the Thematic Tracks on Logic Programming and Machine Learning, and Logic Programming and Explainability, Ethics, and Trustworthiness.

The International Conference on Logic Programming (ICLP) is the premiere international scientific venue for presenting, discussing, and disseminating fundamental and applied research in the field of logic programming and in related interdisciplinary areas. The conference was launched in 1982, with its first edition in Marseille, France, and continues to serve the broad international logic programming community.

ICLP 2023 was a special edition of the conference as it represented the closing event of the "Year of Prolog" a year-long celebration of the 50th anniversary of the introduction of the Prolog programming language. The conference included a dedicated session to discuss the achievements accomplished throughout the year and the assignment of the 2023 Alan Colmerauer Prize, as well as an event on "Teaching Prolog: the Next 50 Years."

ICLP 2023 also included an Industry Event, with the participation of representatives of several for-profit organizations engaged in the use of logic programming technologies. The event consisted of a panel discussion on the role of symbolic AI in today's AI industrial landscape. The Conference featured Invited Speakers: Marco Maratea (University of Calabria, Italy), presenting on applications of answer set programming; Jan Wielemaker (Centrum Wiskunde & Informatica, The Netherlands), presenting on the rise, fall, and future of Prolog; Keith Stenning (The University of Edinburgh, Scotland) for the special track on Logic Programming and Machine Learning; Gopal Gupta (University of Texas at Dallas, USA) for the special track on Logic Programming and Explainability, Ethics and Trustworthiness; Mehul Bhatt (Orebro University, Sweden), tutorialist speaking on Cognitive Vision; and Joseph Townsend (Fujitsu Research of Europe, UK), tutorialist speaking on medical applications of neuro symbolic AI.

TCs also include accepted short papers, summaries of system presentations, and accepted extended abstracts from the Recently Published Research Track. In particular: 26 papers have been accepted for regular TC publication; 5 papers have been accepted as short papers in the TC category; 8 papers have been accepted as system demonstrations. In addition, we received and accepted 11 abstracts for the Recently Published Research track. All of them received an allocation of time in the conference program for presentation. In order to foster the engagement of students and their precious contribution to the research community, ICLP also hosted a doctoral consortium with 9 accepted submissions, two of which by women. A mentoring lunch event with a dedicated panel session were specifically held in order to facilitate exchange of ideas and networking.

ICLP 2023 gratefully received generous funding from the following sponsors.

The organizers of ICLP 2023 are listed below. We heartily thank the ICLP program committee members and additional reviewers for their valuable work. We express our gratitude to Thomas Eiter, the current President of the Association of Logic Programming (ALP), Marco Gavanelli, in the role of conference coordinator for ALP, and all the members of the ALP Executive Committee. We would like to recognize the outstanding work of the editorial team of EPTCS for their support Last but not least, we are deeply indebted to all the authors of any submission to ICLP 2023, we thank you for choosing ICLP as the venue for sharing your ideas, your hard work, and your expertise.

Complexity and Scalability of Reasoning in many-valued Weighted Knowledge Bases with Typicality - Extended Abstract

Mario Alviano (University of Calabria, Italy)
Laura Giordano (University of Piemonte Orientale, Italy)
Daniele Theseider Dupré (University of Piemonte Orientale, Italy)

In this extended abstract we report about new results about reasoning on weighted knowledge bases for Description Logics (DLs) with typicality under a ``concept-wise'' multi-preferential semantics, which have been shown to provide a logical interpretation of MultiLayer Perceptrons [18]. In particular, we provided a completeness result for the complexity of the problem, and new Answer Set Programming encodings in the same complexity class, that are shown to be able to deal with weighted knowledge bases with large search spaces. A detailed description in available in the full paper [1].

Description logics are widely used for knowledge representation, often to verify and discover properties of individuals in a concept by means of DLs inference services [2, 22]. Many properties of real world concepts, however, are defeasible, that is, they are not universally true, but have exceptions, and actually hold only for some prototypical individuals in the concept. This led to research on defeasible DLs [8,15,10,16]. Specifically, to represent the defeasible properties of a concept, DLs have been extended with a typicality operator $\bf{T}$ that is applied to concepts to obtain typicality inclusions of the form ${\bf{T}}(C) \sqsubseteq D$ [15,16}]. Intuitively, ${\bf{T}}(C) \sqsubseteq D$ means that the typical individuals in the concept $C$ also belong to concept $D$ (that, normally C's are D's), and corresponds to a conditional implication $C {\mathrel{{\scriptstyle\mid\!\sim}}} D$ in KLM preferential logics [24, 25]. From the semantic point of view a preference relation is considered as in KLM preferential semantics, to select the most typical individuals in a class (concept). A (conditional) knowledge base (KB) comprising typicality inclusions enables defeasible reasoning, as in fact properties holding for typical individuals in $C$ are not necessarily enforced on all individuals in $C$.

Based on the idea that each concept $C$ can be associated a set of prototypical properties, ranked DL knowledge bases [17] --- reminiscent of ranked KBs by Brewka [6] --- and weighted DL KBs with typicality [18] have been proposed. In particular, in weighted knowledge bases, a set ${\cal T}_C$ of weighted typicality inclusions $({\bf{T}}(C) \sqsubseteq D_1, \ w_1),$ $\ldots,$ $( {\bf{T}}(C) \sqsubseteq D_k, \ w_k)$ is associated to a concept $C$ to describe the prototypical properties of C-elements. For each property, the associated weight $w_i$ is a real number, representing the plausibility/implausibility of the property $D_i$ for $C$-elements.

Semantically, these formalisms have led to a concept-wise multi-preferential semantics, as the relative typicality of two domain individuals usually depends on the aspects we are considering for comparison [20, 17]: Bob may be a more typical as sport lover than Jim ($\mathit{bob <_{SportLover} jim}$), but Jim may be a more typical than Bob as a swimmer ($\mathit{jim <_{Swimmer} bob}$). It has been proven that this semantics has interesting properties in both the two-valued and in the fuzzy case (e.g., it is able to deal with specificity, irrelevance and satisfies the KLM properties).

The concept-wise multi-preferential semantics has been used to provide a logical interpretation to some neural network models, such as Self-Organising Maps [23], psychologically and biologically plausible neural network models, and for MultiLayer Perceptrons (MLPs) [21]. In both cases, a preferential interpretation can be constructed from a trained network (see [14] and [18]) and exploited for verification of typicality properties of the network through model checking. For MLPs a trained network can as well be regarded as a weighted knowledge base by encoding synaptic connections as weighted typicality inclusions under a fuzzy semantics [18, 13]. This concrete application and the widespread interest in neural networks strongly motivates the development of proof methods for reasoning with weighted KBs.

Entailment for fuzzy DLs is in general undecidable [11,4], and this motivates the investigation of many-valued approximations of fuzzy multi-preferential entailment. In particular, the finitely many-valued case is widely studied [12,3,5], and has been recently considered in the context of weighted DL KBs [19] by means of the notions of coherent, faithful and $\varphi$-coherent models of such KBs, previously considered in the fuzzy case [18, 13]. A proof-of-concept implementation in Answer Set Programming (ASP) and asprin [7] has been provided for the $\cal{LC}$ fragment of $\cal{ALC}$, which is obtained by disabling roles, and universal and existential restrictions. The approach adopts Gödel (alternatively, Łukasiewicz) connectives and addresses $\varphi$-coherent entailment, a form of defeasible reasoning based on canonical $\varphi$-coherent models. The $\varphi$-coherence condition makes weighted KBs correspond to MLPs with $\varphi$ as activation function; here a finitely many-valued approximation of such a function is used. As concerns the complexity of the problem, a $\Pi^p_2$ upper bound was given [19], but the exact complexity was unknown.

We briefly describe here two significant advancements with respect to the earlier work [19], from a theoretical point of view and on the practical side, for the $\varphi$-coherent entailment of typicality inclusions [1]. The complexity upper bound can be improved to ${ P}^{ NP[log]}$ by showing an algorithm running in polynomial time and performing parallel queries to an NP oracle ($ P^{||NP}$). As $ P^{||NP}$ is known to coincide with $ P^{NP[log]}$ [9], while $\Pi^p_2 = P^{NP[log]}$ is unlikely to hold (unless the polynomial hierarchy collapses to $ P^{NP[log]}$), there was space for improving the proof-of-concept implementation.

Different ASP encodings have been considered. For the enforcement of $\varphi$-coherence (where grounding explosion should be avoided) the best results are obtained using weight constraints. Weak constraints are used to encode the preferential semantics, relying on an order encoding to stay in the $P^{NP[log]}$ class. Further improvements at an asymptotic level are unlikely, as the problem is shown to be ${ P}^{ NP[log]}$-complete by giving a polynomial-time reduction of the MAX SAT ODD problem [26], which amounts to determining whether the maximum number of jointly satisfiable clauses among a given set is an odd number.

The scalability of the ASP encodings has been assessed empirically on defeasible entailment queries over synthetic weighted DL KBs to show that the redesigned ASP encoding can go beyond the small KBs and search spaces processable by the earlier proof-of-concept implementation [1].

Acknowledgments

This work was partially supported by GNCS-INdAM. Mario Alviano was partially supported by Italian Ministry of Research (MUR) under PNRR project FAIR ``Future AI Research'', CUP H23C22000860006 and by the LAIA lab (part of the SILA labs).

References

  1. M. Alviano, L. Giordano & D. Theseider Dupré (2023): Complexity and scalability of defeasible reasoning in many-valued weighted knowledge bases. CoRR abs/2303.04534, doi:10.48550/arXiv.2303.04534.
  2. F. Baader, D. Calvanese, D.L. McGuinness, D. Nardi & P.F. Patel-Schneider (2007): The Description Logic Handbook - Theory, Implementation, and Applications. Cambridge.
  3. F. Bobillo, M. Delgado, J. Gómez-Romero & U. Straccia (2012): Joining Gödel and Zadeh Fuzzy Logics in Fuzzy Description Logics. Int. J. Uncertain. Fuzziness Knowl. Based Syst. 20(4), pp. 475-508, doi:10.1142/S0218488512500249.
  4. S. Borgwardt & R. Peñaloza (2012): Undecidability of Fuzzy Description Logics. In Gerhard Brewka, Thomas Eiter & Sheila A. McIlraith, editors: Proc. KR 2012, Rome, Italy, June 10-14, 2012.
  5. S. Borgwardt & R. Peñaloza (2013): The Complexity of Lattice-Based Fuzzy Description Logics. J. Data Semant. 2(1), pp. 1-19, doi:10.1007/s13740-012-0013-x.
  6. G. Brewka (2004): A Rank Based Description Language for Qualitative Preferences. In: 6th Europ. Conf. on Artificial Intelligence, ECAI 2004, Valencia, Spain, August 22-27, 2004, pp. 303-307.
  7. G. Brewka, J. P. Delgrande, J. Romero & T. Schaub (2015): asprin: Customizing Answer Set Preferences without a Headache. In: Proc. AAAI 2015, pp. 1467-1474.
  8. K. Britz, J. Heidema & T. Meyer (2008): Semantic Preferential Subsumption. In G. Brewka & J. Lang, editors: KR 2008, AAAI Press, Sidney, Australia, pp. 476-484.
  9. S. R. Buss & L. Hay (1991): On Truth-Table Reducibility to SAT. Inf. Comput. 91(1), pp. 86-102, doi:10.1016/0890-5401(91)90075-D.
  10. G. Casini & U. Straccia (2010): Rational Closure for Defeasible Description Logics. In T. Janhunen & I. Niemelä, editors: JELIA 2010, LNCS 6341, Springer, Helsinki, pp. 77-90, doi:10.1007/978-3-642-15675-5_9.
  11. M. Cerami & U. Straccia (2011): On the Undecidability of Fuzzy Description Logics with GCIs with Lukasiewicz t-norm. CoRR abs/1107.4212. Available at http://arxiv.org/abs/1107.4212.
  12. A. García-Cerdaña, E. Armengol & F. Esteva (2010): Fuzzy Description Logics and t-norm based fuzzy logics. Int. J. Approx. Reason. 51(6), pp. 632-655, doi:10.1016/j.ijar.2010.01.001.
  13. L. Giordano (2021): On the KLM properties of a fuzzy DL with Typicality. In: Proc. ECSQARU 2021, Prague, Sept. 21-24, 2021, LNCS 12897, Springer, pp. 557-571, doi:10.1007/978-3-030-86772-0_40.
  14. L. Giordano, V. Gliozzi & D. Theseider Dupré (2022): A conditional, a fuzzy and a probabilistic interpretation of self-organizing maps. J. Log. Comput. 32(2), pp. 178-205, doi:10.1093/logcom/exab082.
  15. L.Giordano,V.Gliozzi,N.Olivetti&G.L.Pozzato(2009): ALC+T:aPreferentialExtensionofDescription Logics. Fundamenta Informaticae 96, pp. 1-32, doi:10.3233/FI-2009-182.
  16. L. Giordano, V. Gliozzi, N. Olivetti & G. L. Pozzato (2015): Semantic characterization of rational closure: From propositional logic to description logics. Art. Int. 226, pp. 1-33, doi:10.1016/j.artint.2015.05.001.
  17. L. Giordano & D. Theseider Dupré (2020): An ASP approach for reasoning in a concept-aware multiprefer- ential lightweight DL. Theory Pract. Log. Program. (TPLP) 10(5), pp. 751-766, doi:10.1017/S1471068420000381.
  18. L. Giordano & D. Theseider Dupré (2021): Weighted defeasible knowledge bases and a multipreference semantics for a deep neural network model. In: Proc. JELIA 2021, May 17-20, LNCS 12678, pp. 225-242, doi:10.1007/978-3-030-75775-5_16.
  19. L. Giordano & D. Theseider Dupré (2022): An ASP approach for reasoning on neural networks under a finitely many-valued semantics for weighted conditional knowledge bases. TPLP 22(4), pp. 589-605, doi:10.1017/S1471068422000163.
  20. V.Gliozzi(2016): Reasoning about Multiple Aspects in Rational Closure for DLs. In: Proc.AI*IA2016, pp. 392-405, doi:10.1007/978-3-319-49130-1_29.
  21. S. Haykin (1999): Neural Networks - A Comprehensive Foundation. Pearson.
  22. Pascal Hitzler, Markus Krötzsch & Sebastian Rudolph (2010): Foundations of Semantic Web Technologies. Chapman and Hall/CRC Press. Available at http://www.semantic-web-book.org/.
  23. T. Kohonen, M.R. Schroeder & T.S. Huang, editors (2001): Self-Organizing Maps, Third Edition. Series in Information Sciences, Springer.
  24. S. Kraus, D. Lehmann & M. Magidor (1990): Nonmonotonic Reasoning, Preferential Models and Cumulative Logics. Artificial Intelligence 44(1-2), pp. 167-207, doi:10.1016/0004-3702(90)90101-5.
  25. D. Lehmann & M. Magidor (1992): What does a conditional knowledge base entail? Artificial Intelligence 55(1), pp. 1-60, doi:10.1016/0004-3702(92)90041-U.
  26. Klaus W. Wagner (1990): Bounded Query Classes. SIAM J. Comput. 19(5), pp. 833-846, doi:10.1137/0219058.

Towards a Rule-Based Approach for Deriving Abstract Domains (Extended Abstract).

Daniel Jurjo (Universidad Politécnica de Madrid (UPM) & IMDEA Software Institute)
Jose F. Morales (Universidad Politécnica de Madrid (UPM) & IMDEA Software Institute)
Pedro López-García (Spanish Council for Scientific Research & IMDEA Software Institute)
Manuel V. Hermenegildo (Universidad Politécnica de Madrid (UPM) & IMDEA Software Institute)

Abstract interpretation [3] allows constructing sound program analysis tools which can extract properties of a program by safely approximating its semantics. Static analysis tools are a crucial component of the development environments for many programming languages. Abstract interpretation proved practical and effective in the context of (Constraint) Logic Programming ((C)LP) [15,12,14,13,1,10,9] which was one of its first application areas (see[6]), and the techniques developed in this context have also been applied to the analysis and verification of other programming paradigms by using semantic translation to Horn Clauses (see the recent survey [4]). Unfortunately, the implementation of (sound, precise, efficient) abstract domains usually requires coding from scratch a large number of domain-related operations. Moreover, due to undecidability, a loss of precision is inevitable, which makes the design (and implementation) of more domains, as well as their combinations, eventually necessary to successfully prove arbitrary program properties. In this paper we focus on the latter problem by proposing a rule-based methodology for the design and rapid prototyping of new domains for logic programs, as well as composing and combining existing ones. Our techniques are inspired by those used in logic-based languages for implementing constraint domains at different abstraction levels.

Proposal. The construction of analyses based on abstract interpretation requires the defintion of some basic domain operations ($\subseteq$,$\sqcap$,$\sqcup$ and, optionally, the widening $\nabla$ operator); the abstract semantics of the primitive constraints (representing the built-ins, or basic operations of the source language) via transfer functions ($f(\alpha)$); and possibly some other additional instrumental operations over abstract substitutions. In addition, the classical top-down analysis approach requires a number of additional definitions of derived operations used by the analysis framework to implement procedure call, return, recursion, etc. Detailed descriptions of all these operations can be found in[12,11,2,7,5]. We propose a rule language inspired in rewriting to derive, script, and combine abstract domains. The objective is to reduce the time and effort required to write new abstract domains, both from scratch and as combinations of other domains

The proposed rule-based language. Given $s+1$ sets of constraints, $\mathcal{L}, \mathcal{C}_{1},\ldots, \mathcal{C}_{s}$, we define $AND(\mathcal{L}, \mathcal{C}_{1},\ldots, \mathcal{C}_{s})$ as the set of rules of the form $l_{1},\dots,l_{n} \,\, | \,\, g_{1},\ldots,g_{l} \,\, \Rightarrow \,\, r_{1},\ldots,r_{m} \,\, \# \,\, label$, where $s$, $n$, $m$, and $l$ are arbitrary positive integers, and the rule meets the following condition: \begin{equation*} \forall i, j, k \text{ s.t. } i \in \{1,\ldots,n\}, j \in \{1,\ldots,m\} \text{ and } k \in \{1,\ldots,l\} : (l_{i}, r_{j} \in \mathcal{L} \text{ and } \exists u \in \{1,\ldots,s\} \text{ s.t. } g_{k} \in \mathcal{C}_{u}) \end{equation*} The elements $l_{1},\dots,l_{n}$ constitute the left side of the rule; $r_{1},\ldots,r_{m}$ the right side; and $g_{1},\ldots,g_{l}$ the guards. Given $t+s$ sets of constraints $\mathcal{L}_{1}, \ldots, \mathcal{L}_{t}, \mathcal{C}_{1}, \ldots, \mathcal{C}_{s}$ such that $\forall v \in \{1,\ldots,t\} : \mathcal{L}_{v} \subseteq \mathcal{L}$, we define $OR(\mathcal{L}, \mathcal{C}_{1}, \ldots, \mathcal{C}_{n})$ as the set of rules of the form $ l_{1};\ldots;l_{n} \,\, | \,\, g_{1},\dots,g_{l} \,\, \Rightarrow \,\, r_{1},\ldots,r_{m} \,\, \# \,\, label$, where s, t, n, m, and l are arbitrary positive integers, and the rule meets the following condition: $ \begin{array}{ll} \forall i, j, k & \text{ s.t. } i \in \{1,\ldots,n\}, j \in \{1,\ldots,m\} \text{ and } k \in \{1,\ldots,l\} : \\ % & \exists v \in \{1,\ldots,t\} \: \exists u \in \{1,\ldots,s\} % : \text{ s.t. } (l_{i} \in \mathcal{L}_{v}, r_{j} \in \mathcal{L} \text{ and } g_{k} \in \mathcal{C}_{u}) \end{array} $

Notice that while in $\mathit{AND}$-rules all the elements $l_{i}$ belong to the same set of constraints $\mathcal{L}$ in the $\mathit{OR}$-rules they belong to (possibly) different subsets of a set of constraints $\mathcal{L}$. The operational meaning of $\mathit{AND}$-rules is similar to that of rewriting rules. If the left side holds in the set where the rule is being applied to, and the guards also hold, then the left-side elements are replaced by the right-side elements. The operational meaning of $\mathit{OR}$-rules is similar, but instead of rewriting over the "same" set the right-side elements are written in a "new" set. When no more rules can be applied, different strategies can be followed. In general we can rewrite the pending elements to a given element or simply delete them.

In the context of abstract interpretation the sets of constraints that we have mentioned have to be seen as abstract domains being the rules applied then over abstract substitutions/constraints. AND-rules are intended to capture the behaviour of operations over one abstract substitution with the knowledge that can be inferred from other substitutions that meet the guards. This is useful for example when defining the greatest lower bound. Moreover, these rules are also useful for refining abstract substitutions, performing abstractions, combining different abstract domains, etc. On the other hand, OR-rules are intended to capture the behaviour of operations applied over multiple abstract substitutions of an abstract domain, such as the least upper bound or the widening.


partition([], _, [], []).
partition([E|R], C, Left, [E|Right1]) :-
    E >= C,
    partition(R, C, Left, Right1).
partition([E|R], C, [E|Left1], Right) :-
    E < C,
    partition(R, C, Left,1 Right).
Figure1: A Prolog program.

An example. Fig.1 shows a classic Prolog predicate for partitioning a list. A call partition(L, X, L1, L2) is expected to satisfy some properties; for example, that $\forall v \in L2, X \leq v$, which we can express as inf(L2, X). With the help of two auxiliary domains to deal with structures containing variables and with constraints (resp. $\mathit{depth-k}$ and $\mathit{polyhedra}$) we can derive an abstract domain for the inf/2 property. A subset of the rules can be seen in Fig.2. These rules allow, when connected with the abstract domain operations, to exploit the information gathered from the previous domains and use it to infer inf(L2, X). Similarly, we can also capture the equivalent sup(L1, X), or multiset properties capturing that $L \subseteq L1 \cup L2$ and $L1 \cup L2 \subseteq L$. Moreover, we can infer the sortedness property for the classical quicksort implementation.

inf(X, top) | X = [] ==> inf(X, 0.Inf). # empty
inf(L, X) | L = [H|T] ==> inf(T, X). # list_const1
inf(T, X) | L = [H|T], H =< X ==> inf(L, H). # list_const2
inf(L, X) | L = S ==> inf(S, X). # unif_prop
inf(L, X) | Y =< X ==> inf(L, Y). # reduction
inf(X, A) ; inf(X, B) | A =< B ==> inf(X, A). # lub_1
inf(X, A) ; inf(X, B) | A >= B ==> inf(X, B). # lub_2
Figure2: A subset of the inf-domain rules.

Conclusions & future work. We have presented a framework for simplifying the development of abstract domains for logic programs in the context of abstract interpretation frameworks, and concretely that ofCiaoPP. While some domains are easier to specify with a rule-based language, keeping a constraint-based representation for abstract substitutions may not be efficient compared with specialized representations and operations. In this respect, we plan to explore as future work the use of rules both as an input language for abstract domain compilation and as a specification language for debugging or verifying properties of hand-written domains. In our experience so far, the proposed approach seems promising for prototyping and experimenting with new domains, enhancing the precision for particular programs, and adding domain combination rules, without the need for understanding the analysis framework internals.

References

[1]M.García de la Banda, M.Hermenegildo, M.Bruynooghe, V.Dumortier, G.Janssens & W.Simoens (1996): Global Analysis of Constraint Logic Programs. ACM Transactions on Programming Languages and Systems 18(5), pp. 564−615.

[2]M.Bruynooghe (1991): A Practical Framework for the Abstract Interpretation of Logic Programs. Journal of Logic Programming 10, pp. 91 −124.

[3]P.Cousot & R.Cousot (1977): Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In: ACM Symposium on Principles of Programming Languages (POPL'77), ACM Press, pp. 238−252, doi:10.1145/512950.512973.

[4]Emanuele De Angelis, Fabio Fioravanti, JohnP. Gallagher, ManuelV. Hermenegildo, Alberto Pettorossi & Maurizio Proietti (2021): Analysis and Transformation of Constrained Horn Clauses for Program Verification. Theory and Practice of Logic Programming FirstView, pp. 1−69, doi:10.1017/S1471068421000211. Available at http://arxiv.org/abs/2108.00739.

[5]I.Garcia-Contreras, J.F. Morales & M.V. Hermenegildo (2021): Incremental and Modular Context-sensitive Analysis. Theory and Practice of Logic Programming 21(2), pp. 196−243, doi:10.1017/S1471068420000496. Available at https://arxiv.org/abs/1804.01839.

[6]R.Giacobazzi & F.Ranzato (2022): History of Abstract Interpretation. IEEE Ann. Hist. Comput. 44(2), pp. 33−43. Available at https://doi.org/10.1109/MAHC.2021.3133136.

[7]M.V. Hermenegildo, G.Puebla, K.Marriott & P.Stuckey (2000): Incremental Analysis of Constraint Logic Programs. ACM Transactions on Programming Languages and Systems 22(2), pp. 187−223.

[8]D.Jurjo, J.F. Morales, P.Lopez-Garcia & M.V. Hermenegildo (2022): A Rule-based Approach for Designing and Composing Abstract Domains. Technical Report, CLIP Lab, IMDEA Software Institute. Available at https://cliplab.org/papers/jurjo-domcons-tr.pdf.

[9]A.Kelly, K.Marriott, H.Søndergaard & P.J. Stuckey (1998): A Practical Object-Oriented Analysis Engine for CLP. Software: Practice and Experience 28(2), pp. 188−224.

[10]B.Le Charlier & P.Van Hentenryck (1994): Experimental Evaluation of a Generic Abstract Interpretation Algorithm for Prolog. ACM Transactions on Programming Languages and Systems 16(1), pp. 35−101.

[11]K.Muthukumar & M.Hermenegildo (1989): Determination of Variable Dependence Information at Compile-Time Through Abstract Interpretation. In: 1989 North American Conference on Logic Programming, MIT Press, pp. 166−189.

[12]K.Muthukumar & M.Hermenegildo (1990): Deriving A Fixpoint Computation Algorithm for Top-down Abstract Interpretation of Logic Programs. Technical Report ACT-DC-153-90, Microelectronics and Computer Technology Corporation (MCC), Austin, TX 78759. Available at http://cliplab.org/papers/mcctr-fixpt.pdf.

[13]K.Muthukumar & M.Hermenegildo (1992): Compile-time Derivation of Variable Dependency Using Abstract Interpretation. Journal of Logic Programming 13(2/3), pp. 315−347.

[14]P.Van Roy & A.M. Despain (1990): The Benefits of Global Dataflow Analysis for an Optimizing Prolog Compiler. In: North American Conference on Logic Programming, MIT Press, pp. 501−515.

[15]R.Warren, M.Hermenegildo & S.K. Debray (1988): On the Practicality of Global Flow Analysis of Logic Programs. In: Fifth International Conference and Symposium on Logic Programming, MIT Press, pp. 684−699.


Multiple Query Satisfiability of Constrained Horn Clauses

Emanuele De Angelis (IASI-CNR, Rome, Italy)
Fabio Fioravanti (DEc, University ''G.d'Annunzio'', Chieti-Pescara, Italy)
Alberto Pettorossi (DICII, University of Rome ''Tor Vergata'', Italy)
Maurizio Proietti (IASI-CNR, Rome, Italy)

Abstract

We address the problem of checking the satisfiability of a set of constrained Horn clauses (CHCs) possibly including more than one query. We propose a transformation technique that takes as input a set of CHCs, including a set of queries, and returns as output a new set of CHCs such that the transformed CHCs are satisfiable if and only if so are the original ones. The transformed CHCs incorporate in each new query suitable information coming from the other ones so that the CHC satisfiability algorithm is able to exploit the relationships among all queries. We show that our proposed technique is effective on a non trivial benchmark of sets of CHCs that encode many verification problems for programs manipulating algebraic data types such as lists and trees.

Introduction

Constrained Horn Clauses (CHCs) are a logical formalism very well suited for automatic program verification and analysis [1]. Indeed, many verification problems can be reduced to problems of checking satisfiability of CHCs and several effective CHC solvers are currently available as back-end tools for program verification purposes [5,6].

Following the CHC-based verification approach, a program is translated into a set of definite CHCs (that is, clauses whose head is different from $\mathit{false}$), which capture the semantics of the program, together with a set of queries (that is, clauses whose head is $\mathit{false}$), which specify the program properties to be verified. Very often the program includes several functions, each one having its own contract (that is, a pair of a pre-condition and a post-condition) and the CHC translation of the verification problem generates several queries.

CHC solvers try to show the satisfiability of a set of CHCs of the form: $P \cup \{\mathit{false}\!\leftarrow\! G_1,\,\ldots,\, \mathit{false}\!\leftarrow\! G_n\}$, where $P$ is a set of definite CHCs, and $\mathit{false}\!\leftarrow\! G_1,\,\ldots,\,\mathit{false}\!\leftarrow\! G_n$ are queries, by trying to show in a separate way the satisfiability of each set $P\cup\{\mathit{false}\!\leftarrow\! G_i\}$, for $i\!=\!1,\ldots,n$. This approach may not always be effective, as the solver may not be able to exploit, possibly mutual, dependencies among the various queries.

The Transformation Algorithm

In this paper we propose a CHC transformation technique that, given a set $P\cup\{\mbox{$\mathit{false} \!\leftarrow\! G_1,$}$ $\ldots,\,\mathit{false}\!\leftarrow\! G_n\}$ of CHCs, derives an equisatisfiable set $P'\cup\{\mathit{false}\!\leftarrow\! G'_1,\ldots,$ $\mathit{false}\!\leftarrow\! G'_n\}$, for whose satisfiability proof a CHC solver may exploit the mutual interactions among the $n$ satisfiability proofs, one for each query.

The CHC transformation algorithm ${\mathit T}_{\mathit{mq}}$ we present here, is based on adaptations of the usual unfold/fold transformation rules for CHCs (and CLP programs), and on a novel rule, called Query-based Strengthening, specifically designed for incorporating into the clauses relative to a particular query $Q$ some additional properties and constraints derived from other queries that are relative to predicates on which the predicates occurring in $Q$ depend.

Algorithm ${\mathit T}_{\mathit{mq}}$ is both sound and complete, that is, the transformed clauses are satisfiable if and only if so are the original ones. The completeness of ${\mathit T}_{\mathit{mq}}$ is very important because if a property does not hold, it allows us to infer the unsatisfiability of the original clauses, and hence to deduce the invalidity of the property to be verified.

The proposed algorithm improves over the ${\mathit T}_{\mathit{cata}}$ algorithm presented in a previous paper [4] which works by eliminating ADTs from sets of CHCs. ${\mathit T}_{\mathit{cata}}$ is only sound (indeed, it can be understood as computing an abstraction over the initial clauses), and thus if the transformed clauses are unsatisfiable we cannot infer anything about the satisfiability of the initial CHCs. The new algorithm ${\mathit T}_{\mathit{mq}}$ does not eliminate ADT variables, but the additional constraints it discovers are often very beneficial to the CHC solvers when trying to check the satisfiability of a given set of clauses, thereby enhancing their ability to verify program properties.

In order to define a class of CHCs for which our transformation algorithm always terminates, we have considered predicates for expressing properties that are catamorphisms, that is, predicates that are total and functional with respect to some of their arguments, and have a somewhat restricted recursive structure.

Experimental Evaluation

We have implemented algorithm ${\mathit T}_{\mathit{mq}}$ in a tool, called VeriCaT$_{mq}$, which extends VeriCaT [4] by guaranteeing a sound and complete transformation. VeriCaT$_{mq}$ is based on: (i) VeriMAP [2] for transforming CHCs, and (ii) SPACER [6] (with Z3 4.11.2) to check the satisfiability of the transformed CHCs.

We have considered 170 problems, as sets of CHCs, with 470 queries in total, equally divided between the class of satisfiable (sat) problems and unsatisfiable (unsat) problems (for each class we have 85 problems and 235 queries).

The problems we considered refer to programs that manipulate: (i) lists of integers by performing concatenation, permutation, reversal, and sorting, and (ii) binary search trees, by inserting and deleting elements. For list manipulating programs, we have considered properties encoded by catamorphisms such as: list length, minimum and maximum element, sum of elements, list content as sets or multisets of elements, and list sortedness (in ascending or descending order). For trees, we have considered tree size, tree height, minimum and maximum element, tree content and the binary search tree property.

In addition to satisfiable problems, we have also considered unsatisfiable problems that have been obtained from their satisfiable counterparts by introducing bugs in the programs: for instance, by not inserting an element in a list, or adding an extra constraint, or replacing a non-empty tree by an empty one.

In summary, VeriCaT$_{mq}$ was able to prove all the 170 considered problems whereas SPACER was able to prove the properties of 84 'unsat' problems out of 85, and none of the 'sat' problems. The total time needed for transforming the CHCs was 275 seconds (1.62 s per problem, on average), and checking the satisfiability of the transformed CHCs took about 174 s in total (about 1s average time, 0.10 s median time). For comparison, SPACER took 30.27 s for checking the unsatisfiability of 84 problems (0.36 s average time, 0.15 s median time). The benchmark and the tool are available at https://fmlab.unich.it/vericatmq.
Table 1: Programs and problems proved by SPACER and VeriCaT$_{mq}$.
Program Problems Queries Spacer VeriCaT$_{mq}$
sat unsat sat unsat
List Membership 2 60 1 1 1
List Permutation 8 240 4 4 4
List Concatenation 18 180 8 9 9
Reverse 20 400101010
Double Reverse 4 120 2 2 2
Reverse w/Accumulator 6 180 3 3 3
Bubblesort 12 360 6 6 6
Heapsort 8 480 4 4 4
Insertionsort 12 240 6 6 6
Mergesort 18 840 9 9 9
Quicksort (version 1)12 380 6 6 6
Quicksort (version 2)12 360 6 6 6
Selectionsort 14 420 7 7 7
Treesort 4 200 2 2 2
Binary Search Tree 20 240101010
Total1704700848585

For instance, for all the list sorting programs we have considered (Bubblesort, Heapsort, Insertionsort, Mergesort, Quicksort, Selectionsort and Treesort), VeriCaT$_{mq}$ was able to prove properties stating that the output list is sorted and has the same multiset of elements of the input list. Similarly, VeriCaT$_{mq}$ was able to prove that those properties do not hold, if extra elements are added to the output list, or some elements are not copied from the input list to the output list, or a wrong comparison operator is used.

The results obtained by the prototype implementation of our method are encouraging and show that, when used in combination with state-of-the-art CHC solvers, it can greatly improve their effectiveness to prove satisfiability of sets of CHCs with multiple queries, while it does not inhibit their remarkable ability to prove unsatisfiability, although some extra time due to the transformation process may be required.

Full details about the contributions of this paper can be found in the original publication [3].

Bibliography

  1. E. De Angelis, F. Fioravanti, J. P. Gallagher, M. V. Hermenegildo, A. Pettorossi & M. Proietti (2022): Analysis and Transformation of Constrained Horn Clauses for Program Verification. Theory and Practice of Logic Programming 22(6), pp. 974–1042, doi:10.1017/S1471068421000211.
  2. E. De Angelis, F. Fioravanti, A. Pettorossi & M. Proietti (2014): VeriMAP: A Tool for Verifying Programs through Transformations. In: Tools and Algorithms for the Construction and Analysis of Systems, TACAS '14, Lecture Notes in Computer Science 8413, Springer, pp. 568–574, doi:10.1007/978-3-642-54862-8_47.
  3. E. De Angelis, F. Fioravanti, A. Pettorossi & M. Proietti (2023): Multiple Query Satisfiability of Constrained Horn Clauses. In M. Hanus & D. Inclezan, editors: Practical Aspects of Declarative Languages - 25th International Symposium, PADL 2023, Boston, MA, USA, Proceedings, Lecture Notes in Computer Science 13880, Springer, pp. 125-143, doi:10.1007/978-3-031-24841-2_9.
  4. E. De Angelis, M. Proietti, F. Fioravanti & A. Pettorossi (2022): Verifying Catamorphism-Based Contracts using Constrained Horn Clauses. Theory and Practice of Logic Programming 22(4), pp. 555–572, doi:10.1017/S1471068422000175.
  5. H. Hojjat & Ph. Rümmer (2018): The ELDARICA Horn Solver. In: Formal Methods in Computer Aided Design, FMCAD '18, IEEE, pp. 1–7, doi:10.23919/FMCAD.2018.8603013.
  6. A. Komuravelli, A. Gurfinkel & S. Chaki (2016): SMT-Based Model Checking for Recursive Programs. Formal Methods in System Design 48(3), pp. 175–205, doi:10.1007/s10703-016-0249-4.

Towards a Representation of Decision Theory Problems with Probabilistic Answer Set Programs

Damiano Azzolini (University of Ferrara)
Elena Bellodi (University of Ferrara)
Fabrizio Riguzzi (University of Ferrara)

Abstract

Probabilistic Answer Set Programming under the Credal Semantics is a recently introduced formalism to express uncertainty with answer set programming where the probability of a query is described by a range. We propose to extend it to encode decision theory problems.

Encoding

Probabilistic Answer Set Programming under the Credal Semantics [5] extends answer set programming [3] with ProbLog [6] probabilistic facts of the form \(\Pi::f\), where \(\Pi\) is a floating point value (between 0 and 1) representing the probability of \(f\) of being true. A selection of a truth value for every probabilistic fact identifies a world whose probability is the product of the probabilities of the probabilistic facts true times the product of one minus the probability of every probability fact false. In formula: $$ P(w) = \prod_{f_i \ \text{true} \in w} \Pi_i \cdot \prod_{f_i \ \text{false} \in w} (1-\Pi_i). $$ In Probabilistic Logic Programming [6] (PLP), a world is a Prolog program, so it has exactly one model. In Probabilistic Answer Set Programming under the credal semantics (PASP), every world is an answer set program [8], so it has zero or more (stable) models. Every world is required to have at least one stable model. In PASP, the probability of a query (i.e., a conjunction of ground atoms) is represented with a probability range, composed of a lower and upper bound. A world contributes to both the lower and upper bounds if the query is true in every answer set while it contributes only to the upper bound if it is true in some of the answer sets. That is, \(P(q) = [\underline{P}(q), \overline{P}(q)]\) where $$ \underline{P}(q) = \sum_{w_i \mid \forall m \in AS(w_i), \ m \models q} P(w_i),\ \overline{P}(q) = \sum_{w_i \mid \exists m \in AS(w_i), \ m \models q} P(w_i). $$ The probability bounds can be computed with, for example, the tool described in [1]. The DTProbLog framework [4] allows to express decision theory problems with a ProbLog [6] program. It introduces a set \(U\) of utility atoms of the form \(utility(a,r)\) where \(r\) is the reward obtained to satisfy \(a\) (i.e., when \(a\) is true) and a set of decision atoms \(D\). Every subset of decision atoms defines a strategy \(\sigma\) (a ProbLog program) and its utility is computed as $$ Util(\sigma) = \sum_{(a,r) \in U} r \cdot P_{\sigma}(a) $$ where \(P_{\sigma}(a)\) is the probability of \(a\) computed in the ProbLog program identified by fixing the decision atoms in \(\sigma\) to true. The goal is to find the strategy \(\sigma^*\) that maximizes the utility, i.e., \(\sigma^* = argmax_{\sigma}Util(\sigma)\).

We apply this framework to PASP, where every world has one or more stable models. Thus, the utility is described by a lower and an upper bound: $$ Util(\mathcal{\sigma}) = \left[\underline{Util}(\mathcal{\sigma}), \overline{Util}(\mathcal{\sigma})\right] = \left[ \sum_{(a,r) \in U} r \cdot \underline{P}_{\sigma}(a),\sum_{(a,r) \in U} r \cdot \overline{P}_{\sigma}(a) \right] $$ We have now to select whether to optimize the lower or upper utility, and so there are two possible goals: $$ \sigma^{*} = argmax_{\sigma}(\underline{Util}(\sigma)). $$ or $$ \sigma^{*} = argmax_{\sigma}(\overline{Util}(\sigma)). $$ depending on the considered target probability. Note that with this representation the lower utility can be greater than the upper utility, when, for example, there are both positive and negative rewards. We consider here only the strategies where the lower utility is less or equal than the upper utility. To clarify, consider this simple program:
0.7::pa. 0.2::pb.
decision da. decision db.
utility(r0,3). utility(r1,-11).
r0:- pa, da.
r0;r1:- pb, db.
\(pa\) and \(pb\) are two probabilistic facts and \(da\) and \(db\) two decision atoms. The rewards we get to satisfy \(r0\) and \(r1\) are respectively 3 and -11. There are 4 possible strategies (no decision atoms selected, only one decision atom selected, and both decision atoms selected). Each of these have 4 worlds (no probabilistic facts true, only one probabilistic fact true, and both probabilistic facts true). If we consider the strategy \(\sigma_{da} = \{da\}\), we have \(P_{\sigma_{da}}(r0) = [0.7,0.7]\) and \(P_{\sigma_{da}}(r1) = [0,0]\) (only the first rule is considered), and \(Util(\sigma_{da}) = [3 \cdot 0.7 + (-11) \cdot 0,3 \cdot 0.7 + (-11) \cdot 0] = [2.1,2.1]\). If we repeat this process for all the strategies and we consider the upper utility as target, we get that \(\sigma_{da} = \{da\}\) is the one that maximizes the upper utility.

A naive algorithm consists in enumerating all the possible strategies and then computing the lower and upper probability for every decision atom [1]. However, this clearly cannot scale, since the number of possible strategies is \(2^{|D|}\). Moreover, the algorithm of [1] adopts enumeration of stable models and projection on probabilistic facts [7], that also requires the generation of an exponential number of answer sets. Thus, a practical solution should adopt both approximate methods for the generation of the possible strategies and for inference. For the former, greedy algorithms such as genetic algorithms [9] can be a possible solution. For inference, approximate methods based on sampling, such as the one proposed in [2] can be of interest.

Acknowledgements

This research was partly supported by TAILOR, a project funded by EU Horizon 2020 research and innovation programme under GA No. 952215.

References

  1. Damiano Azzolini, Elena Bellodi, and Fabrizio Riguzzi (2022): Statistical Statements in Probabilistic Logic Programming. In Georg Gottlob, Daniela Inclezan, and Marco Maratea, editors: Logic Programming and Non-monotonic Reasoning, Springer International Publishing, Cham, pp. 43-55, doi:10.1007/978-3-031-15707-3_4.
  2. Damiano Azzolini, Elena Bellodi, and Fabrizio Riguzzi (2023): Approximate Inference in Probabilistic Answer Set Programming for Statistical Probabilities. In Agostino Dovier, Angelo Montanari, and Andrea Orlandini, editors: AIxIA 2022 - Advances in Artificial Intelligence, Springer International Publishing, Cham, pp. 33-46, doi:10.1007/978-3-031-27181-6_3.
  3. Gerhard Brewka, Thomas Eiter, and Miroslaw Truszczynski (2011): Answer Set Programming at a Glance. Communications of the ACM 54(12), pp. 92-103, doi:10.1145/2043174.2043195.
  4. Guy Van den Broeck, Ingo Thon, Martijn van Otterlo, and Luc De Raedt (2010): DTProbLog: A Decision-Theoretic Probabilistic Prolog. In Maria Fox and David Poole, editors: Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, AAAI Press, pp. 1217-1222.
  5. Fabio Gagliardi Cozman and Denis Deratani Mauá (2020): The joy of Probabilistic Answer Set Programming: Semantics, complexity, expressivity, inference. International Journal of Approximate Reasoning 125, pp. 218-239, doi:10.1016/j.ijar.2020.07.004.
  6. Luc De Raedt, Angelika Kimmig, and Hannu Toivonen (2007): ProbLog: A Probabilistic Prolog and Its Application in Link Discovery. In Manuela M. Veloso, editor: 20th International Joint Conference on Artificial Intelligence (IJCAI 2007), 7, AAAI Press, pp. 2462-2467.
  7. Martin Gebser, Benjamin Kaufmann, and Torsten Schaub (2009): Solution Enumeration for Projected Boolean Search Problems. In Willem-Jan van Hoeve and John Hooker, editors: Integration of AI and OR Techniques in Constraint Programming for Combinatorial Optimization Problems, Springer Berlin Heidelberg, pp. 71-86, doi:10.1007/978-3-642-01929-6_7.
  8. Michael Gelfond and Vladimir Lifschitz (1988): The stable model semantics for logic programming. In: 5th International Conference and Symposium on Logic Programming (ICLP/SLP 1988), 88, MIT Press, pp. 1070-1080.
  9. Xin-She Yang (2021): Chapter 6 - Genetic Algorithms. In Xin-She Yang, editor: Nature-Inspired Optimization Algorithms (Second Edition), second edition edition, Academic Press, pp. 91-100, doi:10.1016/B978-0-12-821986-7.00013-5.

The ICARUS-System for Interactive Coherence Establishment in Logic Programs

Andre Thevapalan (TU Dortmund, Germany)
Jesse Heyninck (Open Universiteit, the Netherlands)

When modelling expert knowledge as logic programs, default negation is very useful, but might lead to there being no stable models. Detecting the exact causes of the incoherence in the logic program manually can become quite cumbersome, especially in larger programs. Moreover, establishing coherence requires expertise regarding the modelled knowledge as well as technical knowledge about the program and its rules. In this demo, we present the implementation of a workflow that enables knowledge experts to obtain a coherent logic program by modifying it in interaction with a system that explains the causes of the incoherence and provides possible solutions to choose from.

Introduction

Due to its declarative nature, and with the availability of both strong and default negation, answer set programming offers valuable features for the usage in real-world applications. But often knowledge bases are subject to change. Adding rules to a logic program is not as straightforward as it might seem. Due to its declarative nature, adding new information can easily lead to contradictory knowledge. Such contradictions can result from rules whose conclusions are contradictory while both their premises can potentially hold simultaneously. However, by using default negation, another form of inconsistency can appear which is called incoherence. Incoherent answer set programs do not possess answer sets. In many cases, though, the cause of the incoherence generally comprises only one or a couple of rules. Several approaches show how these causes can be found and which part of the programs are affected and thus have to be revised in order to restore the coherence of a program ([4][5][10]). These approaches do not describe, however, how to establish coherence. In recent work ([11]), we have defined a method that offers strategies for computing suitable solutions without the need for additional information from the user and which in turn can be used to enable implementations where coherence can be interactively established in collaboration with an expert. This method is based on results on coherence in argumentation graphs ([10]) for normal logic programs which in turn enables us to locate those parts of the program that are responsible for the incoherence.

Figure 1: Amendment Workflow
Figure 1: Amendment Workflow

The ICARUS-System

We implemented the framework from ([11]) in a prototype system1. In this section, we describe and illustrate this implementation.

Figure 1 shows the general workflow that is implemented in this prototype for establishing the coherence in a given incoherent program $\cal{P}$.

In the following, we will describe the general workflow for this application, and how it helps the knowledge expert to gradually restore coherence. For this consider the following program $\cal{P^1}$ inspired by the medical domain will be used as a running example2:

$r_1 : fever \leftarrow highTemp, {\sim}sunstrk.$
$r_2 : fatigue \leftarrow lowEnergy, {\sim}stress, {\sim}sports.$
$r_3 : highTemp \leftarrow temp > 37.$
$r_4 : sunstrk \leftarrow highTemp, {\sim}fever.$
$r_5 : allrg \leftarrow pollenSeason, fatigue, {\sim}flu, {\sim}cold.$
$r_6 : cold \leftarrow fatigue, soreThroat, {\sim}migrn.$
$r_7 : flu \leftarrow fatigue, {\sim}migrn.$
$r_8 : migrn \leftarrow headache, {\sim}allrg.$
$r_9 : soreThroat.$
$r_{10} : headache.$
$r_{11} : pollenSeason.$
$r_{12} : lowEnergy.$
$r_{13} : temp > 37.$

Figure 2: SCUP Visualisation
Figure 2: SCUP visualisation

Figure 3: Amendment selection         
Figure 3: Amendment selection

Figure 4: Explanation component
Figure 4: Explanation component

The process starts with the knowledge expert providing an extended logic program ([7]), e.g. $P^1$, via the interface3. For each $P^i$, the regular models are computed using an ASP encoding for abstract argumentation frameworks presented in ([8]). If the program is already coherent, the total stable interpretations are shown accordingly. If not, the user can choose the regular model $M^i$ that is closest to an intended total stable interpretation of $P$ (see Figure 2 (1)). On the basis of the labelling that corresponds to $M^i$, the argumentation graph for $P^i$ is computed and shown to the user alongside the subgraphs responsible for incoherence (called SCUPS) (see Figure 2 (2)). The system then displays the argumentation graph, where nodes are coloured according to their label where gray nodes stand for undefined atoms, green ones for true atoms, and red nodes for false atoms. Likewise, nodes that are part of a SCUP have red dashed border. Figure 2 shows that $P^1$ contains a SCUP involving the atoms $allrg$, $cold$, $flu$, and $migrn$. The user is then shown the list of SCUPs and can choose the SCUP they want to resolve (first) (see Figure 2 (3)). For the chosen SCUP, the interface shows all involved atoms and rules (see Figure 2 (4)). Advantage is taken of the high explanatory potential of computational argumentation by implementing explanation methods inspired by the dialogue games for argumentation ([2][3]) to explain (non-)acceptability of atoms in a regular model, via the explanation of the (non-)acceptability of an argument for that atom w.r.t. the corresponding preferred labelling of the argumentation framework. This component contains explanations for the label of each atom (set) in ${\tt AF}(\cal{P}^i)$. It uses an approach derived from argumentative dialogue games to tackle the following explanation task: Given the regular interpretation $\langle I, I'\rangle$ of $\cal{P}$ and $A\in\cal{A}$, explain ${\tt Int2Lab}(\langle I, I'\rangle)({\sim}A)$. If the user wishes to see explanations for the labels of certain atom sets, they can choose the respective set in this component (see Figure 4 (1)). For the chosen atom set, the application will present the list of their attackers and explain each of their labels. It furthermore shows the rules that are associated with the atom set and their labelling. Figure 4 (2) shows the explanation why the assumption ${\sim}allrg$ is labelled undecided in the chosen model. If an explanation for an attacker is additionally available, the user can analyze these as well. In Figure 4 (3) the presented explanation is illustrated if the user decides to inspect the attackers of ${\sim}cold$.

In a next step, on the basis of the explanations for the labelling of ${\tt AF}(\cal{P}^i )$, the user can explore the amendments that are suitable for resolving for resolution of the chosen SCUP. The amendments are computed using the approach defined in ([11]). The list of amendments can additionally be filtered by a strategy as even relatively small programs can have a vast amount of possible amendments (see Figure 3). For each amendment, its used strategy, the amended rule and amendment are shown. The chosen amendment is directly applied on the given input program $P^i$ and the modified program $\cal{P}^{i+1}$ is solved. In our running example, applying the first suggested amendment that is shown in Figure 3 would replace $r_7$ in $\cal{P}^1$ by a fact ${\sim}migrn.$, which results in a coherent program as this modification dissolves the unique SCUP in $\cal{P}^1$. If otherwise $\cal{P}^{i+1}$ is still incoherent, the remaining SCUPs can be resolved by starting a new iteration of this process again with the modified program $\cal{P}^{i+1}$. The result of this workflow is a coherent program $\cal{P}^n$ that represents professionally adequate knowledge.

The presented system was implemented using Python 3.10 and clingo 5.6 ([6]) with asprin 3.1.2beta ([9]).

1The implementation is available on icarus.cs.tu-dortmund.de.
2Here, the atoms $sunstrk$, $migrn$ and $allrg$ denote that a person suffers from a sunstroke, migraine, or allergies, respectively.
3Future work will include the support of ASP extensions such as aggregates and cardinality atoms ([1]).

14th of August, 2023 Andre Thevapalan
Jesse Heyninck

References

  1. Gerhard Brewka & Thomas Eiter (1999): Preferred Answer Sets for Extended Logic Programs. In: Artif. Intell. 109(1-2), pp. 297-356, doi:10.1016/S0004-3702(99)00015-6.
  2. Martin Caminada (2017): Argumentation semantics as formal discussion. In: Journal of Applied Logics 4(8), pp. 2457-2492.
  3. Martin WA Caminada, Wolfgang Dvořák & Srdjan Vesic (2014): Preferred semantics as socratic discussion. In: Journal of Logic and Computation 26(4), pp. 1257-1292, doi:10.1093/logcom/exu005.
  4. Stefania Costantini (2006): On the existence of stable models of non-stratified logic programs. In: Theory Pract. Log. Program. 6(1-2), pp. 169-212, doi:10.1017/S1471068405002589.
  5. Stefania Costantini, Benedetto Intrigila & Alessandro Provetti (2003): Coherence of updates in answer set programming. In: Proc. of the IJCAI-2003 Workshop on Nonmonotonic Reasoning, Action and Change, pp. 66-72.
  6. Martin Gebser, Roland Kaminski, Benjamin Kaufmann & Torsten Schaub (2019): Multi-shot ASP solving with clingo. In: Theory Pract. Log. Program. 19(1), pp. 27-82, doi:10.1017/S1471068418000054.
  7. Michael Gelfond & Vladimir Lifschitz (1991): Classical Negation in Logic Programs and Disjunctive Databases. In: New Gener. Comput. 9(3/4), pp. 365-386, doi:10.1007/BF03037169.
  8. Tuomo Lehtonen, Johannes Peter Wallner & Matti Järvisalo (2021): Declarative Algorithms and Complexity Results for Assumption-Based Argumentation. In: J. Artif. Intell. Res. 71, pp. 265-318, doi:10.1613/jair.1.12479.
  9. Javier Romero (2017): asprin: Answer Set Programming with Preferences. In: In Bernhard Mitschang, Norbert Ritter, Holger Schwarz, Meike Klettke, Andreas Thor, Oliver Kopp & Matthias Wieland, editors: Datenbanksysteme für Business, Technologie und Web (BTW 2017), 17. Fachtagung des GI-Fachbereichs "Datenbanken und Informationssysteme" (DBIS), 6.-10. März 2017, Stuttgart, Germany, Workshopband, LNI P-266, GI, pp. 159-162. Available at dl.gi.de/20.500.12116/910.
  10. Claudia Schulz & Francesca Toni (2018): On the responsibility for undecisiveness in preferred and stable labellings in abstract argumentation. In: Artif. Intell. 262, pp. 301-335, doi:10.1016/j.artint.2018.07.001.
  11. Andre Thevapalan, Jesse Heyninck & Gabriele Kern-Isberner (2021): Establish Coherence in Logic Programs Modelling Expert Knowledge via Argumentation. In: Joaquín Arias, Fabio Aurelio D'Asaro, Abeer Dyoub, Gopal Gupta, Markus Hecher, Emily LeBlanc, Rafael Peñaloza, Elmer Salazar, Ari Saptawijaya, Felix Weitkämper & Jessica Zangari, editors: Proceedings of the International Conference on Logic Programming 2021 Workshops co-located with the 37th International Conference on Logic Programming (ICLP 2021), Porto, Portugal (virtual), September 20th-21st, 2021, CEUR Workshop Proceedings 2970, CEUR-WS.org. Available at ceur-ws.org/Vol-2970/causalpaper4.pdf.

On the Development of PASTA: Inference in Probabilistic Answer Set Programming under the Credal Semantics

Damiano Azzolini (University of Ferrara)

Abstract

PASTA is a novel framework to perform inference, both exact and approximate, in Probabilistic Answer Set Programming under the Credal Semantics and to solve other related tasks, such as abduction, decision theory, maximum a posteriori inference, and parameter learning. Moreover, it also allows the expression of statistical statements. This paper shows the overall structure of the PASTA tool as well as some of the main options.

Description

Answer Set Programming (ASP) is a logic-based language useful in describing complex combinatorial domains. Most of ASP research focuses on deterministic programs. There are some semantics that extend ASP and allow uncertainty on data, mainly LPMLN [15], P-log [7], and the credal semantics [9]. The PASTA tool considers the last.

A probabilistic answer set program under the credal semantics is an answer set program extended with probabilistic facts [10], i.e., constructs of the form \(\Pi::a.\) where \(a\) is an atom and \(\Pi \in [0,1]\) is its probability value. The intuitive meaning is that \(a\) is true with probability \(\Pi\). We assume that probabilistic facts cannot appear as head of rules. The following is an example of a program:
0.4:: a.
0.7:: b.
qr : - a.
qr ; nqr : - b.

A selection of a truth value for every probabilistic fact defines a world \(w\), i.e., an answer set program, whose probability can be computed as \(P(w) = \prod_{f_i \ \text{selected}} \Pi_i \cdot \prod_{f_i \ \text{not selected}} (1-\Pi_i)\). The previously shown program has \(2^2 = 4\) worlds. The probability of the world, for example, where both \(a\) and \(b\) are true is \(0.4 \cdot 0.7 = 0.28\). Since every world is an answer set program [14], every world has zero or more answer sets. The credal semantics requires that every world has at least one answer set. The probability of a query (conjunction of ground atoms) \(P(q)\) is defined by a range, with a lower and upper probability, i.e., \(P(q) = [\underline{P}(q),\overline{P}(q)]\). A world contributes to the upper probability if it has at least one answer set where the query is true and it contributes to both the lower and upper probability if the query is true in all the answer sets. That is, the lower probability is the sum of the probabilities of the worlds where the query is true in all the answer sets while the upper probability is the sum of the probabilities of the worlds where the query is true in at least one answer set. In formula \begin{equation} \underline{P}(q) = \sum_{w_i \mid \forall m \in AS(w_i), \ m \models q} P(w_i),\ \overline{P}(q) = \sum_{w_i \mid \exists m \in AS(w_i), \ m \models q} P(w_i). \end{equation} Consider the query \(qr\) in the previous program. The world where both \(a\) and \(b\) are false has one empty answer set, so it does not contribute to the probability. The world where \(a\) is false and \(b\) is true has two answer sets, \(\{\{b \ qr\}, \{b \ nqr\}\}\). The query is true in only one of the two, so we have a contribution only to the upper probability of \(0.6 \cdot 0.7 = 0.42\). The world where \(a\) is true and \(b\) is false has one answer set, \(\{\{a \ qr\}\}\). The query is true in all the answer sets, so we have a contribution of \(0.4 \cdot 0.3 = 0.12\) to both the lower and upper probability. Lastly, the world where both \(a\) and \(b\) are true has one answer set, \(\{\{a \ b \ qr\}\}\). The query is true in all the answer sets, so we have a contribution of \(0.4 \cdot 0.7 = 0.28\) to both the lower and upper probability. Overall, \(P(q) = [0.12 + 0.28, 0.42 + 0.12 + 0.28] = [0.4, 0.82]\).

Currently, the PASTA tool performs exact inference [2], whose algorithm is based on projected answer set enumeration [13], approximate inference via sampling [3], abduction [1] (i.e., computing the minimal set, in terms of set inclusion, of abducible facts such that the probability of the query is maximized), MAP/MPE [5] (finding an assignment to a subset of probabilistic facts that maximizes the sum of the probabilities of the identified worlds while evidence is satisfied), decision theory [6] (finding a subset of decision atoms that maximizes a reward), and parameter learning [4] (learning the probability of the probabilistic facts such that the likelihood of the examples is maximized). It allows to express statistical statements of the form [2] \((C | A)[\Pi_l, \Pi_u]\) meaning that the fraction of \(A\)s that are also \(C\)s is between \(\Pi_l\) and \(\Pi_u\). Moreover, it adopts normalization [11] to perform inference in probabilistic answer set programs where some worlds have no answer sets. That is, the lower and upper probability bounds are divided by the sum of the probabilities of the worlds with no answer sets.

The system is written in Python, is open source, and is available on GitHub. It can be installed via the Python package installer pip and provides a command line interface with several options to select the task to solve. Moreover, a web interface exposes some of the most relevant options in a more intuitive way. It is also possible to use the system as a Python library. PASTA leverages the clingo ASP solver [12] to compute answer sets. The system is structured in multiple modules: the pasta module parses the command line arguments and selects the subsequent functions and methods to call. The generator module parses the program into an ASP version that can be interpreted by the clingo solver. The interface with clingo is managed by the asp_interface module and the resulting answer sets are analyzed with the models_handler module which also computes the various probabilities. There are some reserved keywords: \(abducible\), that denotes abducible facts in the context of abduction (for example, \(abducible\ a\) states that the atom \(a\) is an abducible); \(map\), that denotes facts to be considered for the MAP/MPE task (for example, \(map\ 0.4::a\) states that \(a\) is a probabilistic fact whose probability is 0.4 and that can be selected to be included in the solution set for the MAP/MPE task); and \(decision\) and \(utility\), that mark decision facts and utility attributes [8] for the decision theory task (for example, \(decision\ a\) states that \(a\) is a decision atom and \(utility(f,2.3)\) states that the reward obtained when \(f\) is true is 2.3).

Acknowledgements

This research was partly supported by TAILOR, a project funded by EU Horizon 2020 research and innovation programme under GA No. 952215.

References

  1. Damiano Azzolini, Elena Bellodi, Stefano Ferilli, Fabrizio Riguzzi, and Riccardo Zese (2022): Abduction with probabilistic logic programming under the distribution semantics. International Journal of Approximate Reasoning 142, pp. 41-63, doi:10.1016/j.ijar.2021.11.003.
  2. Damiano Azzolini, Elena Bellodi, and Fabrizio Riguzzi (2022): Statistical Statements in Probabilistic Logic Programming. In Georg Gottlob, Daniela Inclezan, and Marco Maratea, editors: Logic Programming and Non-monotonic Reasoning, Springer International Publishing, Cham, pp. 43-55, doi:10.1007/978-3-031-15707-3_4.
  3. Damiano Azzolini, Elena Bellodi, and Fabrizio Riguzzi (2023): Approximate Inference in Probabilistic Answer Set Programming for Statistical Probabilities. In Agostino Dovier, Angelo Montanari, and Andrea Orlandini, editors: AIxIA 2022 - Advances in Artificial Intelligence, Springer International Publishing, Cham, pp. 33-46, doi:10.1007/978-3-031-27181-6_3.
  4. Damiano Azzolini, Elena Bellodi, and Fabrizio Riguzzi (2023): Learning the Parameters of Probabilistic Answer Set Programs.
  5. Damiano Azzolini, Elena Bellodi, and Fabrizio Riguzzi (2023): MAP Inference in Probabilistic Answer Set Programs. In Agostino Dovier, Angelo Montanari, and Andrea Orlandini, editors: AIxIA 2022 - Advances in Artificial Intelligence, Springer International Publishing, Cham, pp. 413-426, doi:10.1007/978-3-031-27181-6_29.
  6. Damiano Azzolini, Elena Bellodi, and Fabrizio Riguzzi (2023): Towards a Representation of Decision Theory Problems with Probabilistic Answer Set Programs.
  7. Chitta Baral, Michael Gelfond, and Nelson Rushton (2009): Probabilistic reasoning with answer sets. Theory and Practice of Logic Programming 9(1), pp. 57-144, doi:10.1017/S1471068408003645.
  8. Guy Van den Broeck, Ingo Thon, Martijn van Otterlo, and Luc De Raedt (2010): DTProbLog: A Decision-Theoretic Probabilistic Prolog. In Maria Fox and David Poole, editors: Proceedings of the Twenty-Fourth AAAI Conference on Artificial Intelligence, AAAI Press, pp. 1217-1222.
  9. Fabio Gagliardi Cozman and Denis Deratani Mauá (2020): The joy of Probabilistic Answer Set Programming: Semantics, complexity, expressivity, inference. International Journal of Approximate Reasoning 125, pp. 218-239, doi:10.1016/j.ijar.2020.07.004.
  10. Luc De Raedt, Angelika Kimmig, and Hannu Toivonen (2007): ProbLog: A Probabilistic Prolog and Its Application in Link Discovery. In Manuela M. Veloso, editor: 20th International Joint Conference on Artificial Intelligence (IJCAI 2007), 7, AAAI Press, pp. 2462-2467.
  11. Daan Fierens, Guy Van den Broeck, Maurice Bruynooghe, and Luc De Raedt (2012): Constraints for probabilistic logic programming. In Daniel M. Roy, Vikash K. Mansinghka, and Noah D. Goodman, editors: Proceedings of the NIPS Probabilistic Programming Workshop.
  12. Martin Gebser, Roland Kaminski, Benjamin Kaufmann, and Torsten Schaub (2019): Multi-shot ASP solving with clingo. Theory and Practice of Logic Programming 19(1), pp. 27-82, doi:10.1017/S1471068418000054.
  13. Martin Gebser, Benjamin Kaufmann, and Torsten Schaub (2009): Solution Enumeration for Projected Boolean Search Problems. In Willem-Jan van Hoeve, and John Hooker, editors: Integration of AI and OR Techniques in Constraint Programming for Combinatorial Optimization Problems, Springer Berlin Heidelberg, pp. 71-86, doi:10.1007/978-3-642-01929-6_7.
  14. Michael Gelfond and Vladimir Lifschitz (1988): The stable model semantics for logic programming. In: 5th International Conference and Symposium on Logic Programming (ICLP/SLP 1988), 88, MIT Press, pp. 1070-1080.
  15. Joohyung Lee and Yi Wang (2016): Weighted Rules under the Stable Model Semantics. In Chitta Baral, James P. Delgrande and Frank Wolter, editors: Principles of Knowledge Representation and Reasoning: Proceedings of the Fifteenth International Conference, KR 2016, Cape Town, South Africa, April 25-29, 2016, AAAI Press, pp. 145-154.

Logical English Demonstration

Robert Kowalski (Department of Computing, Imperial College, London, UK)
Jacinto Dávila (Universidad de Los Andes, Merida, Venezuela)

Abstract:

Logical English (LE) is a natural language syntax for pure Prolog and other logic programming languages, such as ASP and s(CASP). Its main applications until now have been to explore the representation of a wide range of legal texts, helping to identify ambiguities, explore alternative representations of the same text, and compare the logical consequences of the alternatives. The texts include portions of loan agreements, accountancy law, Italian citizenship, EU law on criminal rights, International Swaps and Derivative contracts, and insurance contracts. The current implementation in SWI Prolog can be accessed at https://logicalenglish.logicalcontracts.com.

Introduction to Logical English

The basic form of LE is simply syntactic sugar for pure Prolog[2], with predicates written in infix form and declared by means of templates, as in:

*a borrower* defaults on *a date*

where asterisks delimit the argument places of the predicate. Variables are signalled by the use of one of the determiners "a", "an" or "the". An indefinite determiner, "a" or "an", introduces the first occurrence of a variable in a sentence. All later occurrences of the same variable in the same sentence are prefixed by the definite determiner "the".

LE has only minimal linguistic knowledge of English. Its knowledge of English vocabulary is restricted to the determiners; the logical connectives "if", "and", "or" and "it is not the case that"; the logical pattern "for all cases in which — it is the case that —"; and the logical keyword "that". The keyword "that" identifies the use of a meta-predicate, for representing such "propositional attitudes as prohibition, obligation, belief, desire, fear, notification, etc. Indentation, rather than parentheses, is used to indicate the relative strength of binding of the logical connectives. LE has virtually no knowledge of English grammar. In particular, it does not distinguish between singular and plural nouns and verbs, and it does not know about the relationship between the different tenses of verbs. Despite these restrictions, and because it has the same expressiveness as pure Prolog, it can be used to represent a broad range of knowledge, as shown by its application to the representation of legal texts [3,4,5,6,7]. Here is an example based on the loan agreement in [1]. The SWISH implementation of the example can be found at https://logicalenglish.logicalcontracts.com/p/new_loan_with_cure.pl.

Ordinary English:
The Borrower will be in default under this agreement upon the failure of the Borrower to fulfil any obligation of this agreement, provided the failure shall remain uncured within a period of two days after notice is given to the Borrower by the Lender of the failure (such an uncured event an "Event of Default'').

Logical English:

the borrower defaults on a date D2
if the borrower has the obligation that an eventuality
and the borrower fails to satisfy the obligation that the eventuality 
and the lender notifies the borrower on a date D1 that 
    the borrower fails to satisfy the obligation that the eventuality
and D2 is 2 days after D1
and it is not the case that
the borrower cures on or before D2 the failure to satisfy the obligation that 
    the eventuality.
Prolog:
defaults_on(the_borrower, A) :-
    has_the_obligation_that(the_borrower, B),
    fails_to_satisfy_the_obligation_that(the_borrower, B),
    notifies_on_that(the_lender,  the_borrower, C, 
        fails_to_satisfy_the_obligation_that(the_borrower, B)),
    is_days_after(A, 2, C),
    not cures_on_or_before_the_failure_to_satisfy_the_obligation_that(the_borrower, A, B).
Notice that the original English suggests that an Event of Default occurs retroactively on the date D0 of the failure to fulfil an obligation. However, elsewhere the loan agreement states that "upon the occurrence of an Event of Default all outstanding payments under this agreement will become immediately due and payable". To avoid inconsistency, the LE version represents the intended interpretation as being that the default occurs on the date D2, two days after the notification of the failure on date D1.

Image the-borrower-has-the-obligation%  WIDTH=652 HEIGHT=428

Figure 1: Rules and payment scenario

Figure 1 illustrates a scenario, called "payment", in which the borrower fails to satisfy the obligations, on lines 22 and 23, to pay the lender 550 on 2015-06-01 and 525 on 2016-06-01. The lender does not notice the first failure, but notices the second failure, and gives notice to the borrower of the second failure on 2016-06-04. The borrower attempts to cure the failure, by paying the correct amount 525 and by notifying the lender of the payment within the two day period of grace. But unfortunately, the borrower notifies the lender incorrectly that the payment was made on the date of notification rather than on the date of payment.

Image answer-defaults-with-payment%  WIDTH=372 HEIGHT=96
Figure 2: Querying LE

Figure 2 illustrates the result of answering the combination of the stored query, called "defaults" with the scenario. An LE document can contain several stored scenarios and several stored queries, which can be combined in the SWISH query pane.

The SWISH implementation also generates explanations in response to commands of the form answer(defaults, with(payment), le(E), R) as shown in figure 3. For VSC users there exist extensions for syntax highlighting and remote execution on a SWISH server. It is also possible to call the LE parser without the SWISH environment, as a standalone Prolog application. All the sources and further information are available at https://github.com/LogicalContracts/LogicalEnglish/.

Image explanation%  WIDTH=652 HEIGHT=223 Figure 3: Explanations in LE

Acknowledgements

Many thanks to Miguel Calejo, Galileo Sartor, Andrew Noble, John Cummins, Fariba Sadri and Nilokai Merritt for their support and contributions to this work.

References

  1. Flood, M.D. and Goodenough, O.R., 2017. Contract as automaton: The computational representation of financial agreements. Office of Financial Research Working Paper, (15-04). doi:10.1007/s10506-021-09300-9
  2. Kowalski, R.: Logical English, In Proceedings of Logic and Practice of Programming (LPOP) (2020). http://www.info.ucl.ac.be/~pvr/LPOP_2020_proceedings.pdf.
  3. Kowalski, R., Datoo, A.: Logical English meets legal English for swaps and derivatives. Artificial Intelligence and Law, 30(2), 163-197 (2022). doi:10.1007/s10506-021-09295-3.
  4. Kowalski, R., Dávila, J., Calejo, M., Logical English for legal applications. XAIF, Virtual Workshop on Explainable AI in Finance (2021).
  5. Kowalski, R., Dávila, J., Sartor, G., Calejo, M.: Logical English for Law. In Proceedings of the Workshop on Methodologies for Translating Legal Norms into Formal Representations (LN2FR), JURIX, (2022). https://research.nii.ac.jp/~ksatoh/LN2FRproceedings.pdf
  6. Kowalski, R., Sadri, F., Calejo, M., Dávila, J.: Combining Logic Programming and Imperative Programming in LPS. In: Warren, D., Dahl, V., Eiter, T., Hermenegildo, M., Kowalski, R., Rossi, F. (eds.) Prolog - The Next 50 Years. LNCS, vol. 13900. Springer, Heidelberg (2023).
  7. Sartor, G., Dávila, J., Billi, M., Contissa, G., Pisano, G., Kowalski, R.: Integration of Logical English and s(CASP), 2nd Workshop on Goal-directed Execution of Answer Set Programs (GDE'22) (2022). https://ceur-ws.org/Vol-3193/paper5GDE.pdf

ForgettingWeb

Matti Berthold (Universität Leipzig)
Matthias Knorr (NOVA LINCS)
Daphne Odekerken (Utrecht University)

Abstract

The relatively young area of forgetting is concerned with the removal of selective information, while preserving other knowledge. This might be useful or even necessary, for example, to simplify a knowledge base or to tend legal requests. In the last few years, there has been an ample amount of research in the field, in particular with respect to logic programs, spanning from theoretical considerations to more practical applications, starting at the conceptual proposal of forgetting, to suggestions of properties that should be satisfied, followed by characterizations of abstract classes of operators that satisfy these properties, and finally the definition of concrete forgetting procedures.

In this work we present novel Python implementations of all the forgetting procedures that have been proposed to date on logic programs. We provide them in a web interface, and hope to thereby give anybody who is interested a low-barrier overview of the landscape.

An Overview

While dynamics in knowledge representation are often examined with respect to the addition of new information, there is an increasing amount of research on how it may be removed. Forgetting, or variable elimination, seeks to make a knowledge base independent of elements of the underlying formal language, while keeping as many logical connections between the remaining elements as possible. Though it was initially proposed as a semantical notion over classical formulas [13], in the context of logic programming forgotten atoms are usually also required to be removed syntactically. More broadly, there have been several suggestions for properties that a plausible forgetting procedure should satisfy [5,6,12,14,15,16], cf. [10] for an extensive overview.

Along the way, there have also been a number of suggestions for concrete syntactical transformations to forget atoms from a program [1,2,3,4,6,8,12,15] that satisfy some of the proposed properties, or at least satisfy them whenever possible [9]. The hope for such operators is to produce forgetting results that in some way resemble their origin, while avoiding a computational blow-up as much as possible. Given a semantic definition of a class of forgetting operators, e.g. [7,11], the construction of a program from the desired HT-models remains a baseline that can be employed to confirm the existence of a concrete forgetting operator [5].

The definitions of the syntactic forgetting procedures are rather involved, sometimes spanning over several pages of text. In order to make them more accessible, we compiled encodings as well as short explanations, of the operators (those that are defined over logic programs) and the construction of canonical programs into a web interface. We hope to thereby give anybody who is interested a good overview of the material.

ForgettingWeb can be accessed here. Its source code is available here.


Figure 1 Screenshot of ForgettingWeb.

A screenshot of the interface is shown in Figure 1. In the leftmost column, users can specify a logic program and the atoms to be forgotten, or select a predefined sample input. Subsequently, they select the forgetting operator of their choice from the dropdown in the middle column. These are implementations from operators proposed in the literature. For more details, the user presses the "Operator Explanation" button: this triggers a pop-up with an explanation of the operator and a reference to the paper in which it was proposed. After pressing the "Forget it!" button, the result program appears in the rightmost column.

An input program P is specified by one rule per line, where the head atoms are separated by `;', the head and the body are separated by `:-', and the body literals are separated by commas. As negation signs both the traditional `not' and the shorter `~' can be used. No dot at the end of a rule is required.

The atoms of the forgetting set V are separated by commas.

In the ``Result'' column on the right side, the new program has the same syntax as the input program.

The input of the counter-models construction aux_{cm} are tuples with delimiters `<' and `>', e.g.:

<ab,ab><a,ab><b,ab><,ab>
<a,a><,>

Each character within an element of a tuple is assumed to be a single element of a set.

Acknowledgements

The authors have been arranged alphabetically. The authors acknowledge the financial support by the Federal Ministry of Education and Research of Germany and by the Sächsische Staatsministerium für Wissenschaft Kultur und Tourismus in the program Center of Excellence for AI-research "Center for Scalable Data Analytics and Artificial Intelligence Dresden/Leipzig", project identification number: ScaDS.AI. This work was partially supported by FCT project FORGET (PTDC/CCI-INF/32219/2017) and by FCT project NOVA LINCS (UIDB/04516/2020).

References

  1. F. Aguado, P. Cabalar, J. Fandinno, D. Pearce, G. Pérez & C. Vidal (2022): A polynomial reduction of forks into logic programs. Artif. Intell. 308, pp. 103712, doi:10.1016/j.artint.2022.103712.
  2. F. Aguado, P. Cabalar, J. Fandinno, D. Pearce, G. Pérez & C. Vidal (2022): Syntactic ASP Forgetting with Forks. In: Proceedings of (LPNMR-22), Lecture Notes in Computer Science 13416. Springer, pp. 3–15, doi:10.1007/978-3-031-15707-3_1.
  3. M. Berthold (2022): On Syntactic Forgetting with Strong Persistence. In: Proceedings of (KR-22), doi:10.24963/kr.2022/5.
  4. M. Berthold, R. Gonçalves, M. Knorr & J. Leite (2019): A Syntactic Operator for Forgetting that Satisfies Strong Persistence. Theory and Practice of Logic Programming 19(5-6), pp. 1038-1055, doi:10.1017/S1471068419000346.
  5. P. Cabalar & P. Ferraris (2007): Propositional theories are strongly equivalent to logic programs. Theory and Practice of Logic Programming 7(6), pp. 745–759, doi:10.1017/S1471068407003110.
  6. J.P. Delgrande & K. Wang (2015): A Syntax-Independent Approach to Forgetting in Disjunctive Logic Programs. In: Proceedings of (AAAI-15), pp. 1482–1488, doi:10.1609/aaai.v29i1.9402.
  7. T. Eiter & K. Wang (2008): Semantic forgetting in answer set programming. Artificial Intelligence 172(14), pp. 1644–1672, doi:10.1016/j.artint.2008.05.002.
  8. R. Gonçalves, T. Janhunen, M. Knorr, J. Leite & S. Woltran (2019): Forgetting in Modular Answer Set Programming. In: Proceedings of (AAAI-19). AAAI Press, pp. 2843–2850, doi:10.1609/aaai.v33i01.33012843.
  9. R. Gonçalves, T. Janhunen, M. Knorr & J. Leite (2021): On Syntactic Forgetting Under Uniform Equivalence. In: Proceedings of (JELIA-21), Lecture Notes in Computer Science 12678. Springer, pp. 297–312, doi:10.1007/978-3-030-75775-5_20.
  10. R. Gonçalves, M. Knorr & J. Leite (2016): The Ultimate Guide to Forgetting in Answer Set Programming. In: Proceedings of (KR-16), pp. 135–144.
  11. R. Gonçalves, M. Knorr & J. Leite (2016): You Can't Always Forget What You Want: On the Limits of Forgetting in Answer Set Programming. In: Proceedings of (ECAI-16), pp. 957–965, doi:10.3233/978-1-61499-672-9-957.
  12. R. Gonçalves, M. Knorr, J. Leite & S. Woltran (2017): When you must forget: Beyond strong persistence when forgetting in answer set programming. Theory and Practice of Logic Programming 17(5-6), pp. 837–854, doi:10.1017/S1471068417000382.
  13. M. Knorr & J.J. Alferes (2014): Preserving Strong Equivalence while Forgetting. In: Proceedings of (JELIA-14), LNCS 8761. Springer, pp. 412–425, doi:10.1007/978-3-319-11558-0_29.
  14. F. Lin & R. Reiter (1994): Forget it. In: Working Notes of AAAI Fall Symposium on Relevance, pp. 154–159.
  15. Y. Wang, K. Wang & M. Zhang (2013): Forgetting for Answer Set Programs Revisited. In: Proceedings of (IJCAI-13). IJCAI/AAAI, pp. 1162–1168. Available at http://www.aaai.org/ocs/index.php/IJCAI/IJCAI13/paper/view/6807.
  16. Y. Wang, Y. Zhang, Y. Zhou & M. Zhang (2012): Forgetting in Logic Programs under Strong Equivalence. In: Proceedings of (KR-12). AAAI Press.
  17. Y. Zhang & N.Y. Foo (2006): Solving logic program conflict through strong and weak forgettings. Artificial Intelligence 170(8-9), pp. 739–778, doi:10.1016/j.artint.2006.02.002.
  18. Y. Zhang & Y. Zhou (2009): Knowledge forgetting: Properties and applications. Artificial Intelligence 173(16), pp. 1525–1537, doi:10.1016/j.artint.2009.07.005.

Anthem-P2P: Automatically Verifying the Equivalent External Behavior of ASP Programs

Zachary Hansen (University of Nebraska Omaha)

Answer Set Programming (ASP) enables the solving of challenging search and optimization problems with concise, declarative programs. However, the most human-readable encoding does not always coincide with the most efficient encoding from the standpoint of grounding and solving. In the process of making a program more efficient the programmer may substantially refactor the initial program. The system presented here can automatically provide guarantees that the new versions adhere to the original "specification" version of the program. While refactoring is the primary intended use of this system, it can in general be used to confirm that certain pairs of ASP programs share the same external behavior under a given set of assumptions.

Introduction

The tool presented here is designed to support the development of correct logic programs under the stable model semantics. For a broad class of "tight" programs, Anthem-P2P can automatically provide a formal guarantee that a pair of programs have the same "external behavior". A precise definition of this concept may be found in [3]. Broadly speaking, two logic programs have equivalent external behavior if the extents of their output/shown predicates coincide for any inputs that conform to the intended use of the program.

The Anthem-P2P system assists in the process of refactoring (modifying a program while preserving its external behavior), which is an important strategy in the construction of provably correct programs. One of the envisioned uses of this system is the following methodology. First, a highly declarative, human-readable program is shown to be correct via a meta-level proof (see, for instance [1,2]). Next, subsequent refactorings improving the program's efficiency at the expense of clarity can be proven to be equivalent via object-level proofs constructed by Anthem-P2P. The remainder of this paper presents the implementation details behind Anthem-P2P, the theoretical foundations and key concepts of which are studied in [3].

Using Anthem-P2P

To get started with program-to-program verification, readers may wish to first visit the AP2P website. This website allows users to experiment with the Anthem-P2P system without installing its software sub-components such as Vampire ([5]) and Anthem ([4]) on their personal computers. The tool is also available for download. Figure 1 shows the text editing portion of the AP2P homepage, which is populated by default with an example showcasing equivalent prime numbers programs. Users may enter a time limit for the proof search process (one direction of which derives the original program from the alternative, the other direction derives the alternative from the original). The "Verify Equivalence of Programs" button invokes the Anthem-P2P system on a UNO server (Oracle Linux 8, 4 Intel(R) Xeon(R) Gold 6248 CPUs, 4 GB RAM) and displays the result.

The GitHub repository contains a number of examples, which may be tested using variations of the following command:

python3 anthem-p2p (program file) (program file) (user guide file)

The preceding command may be optionally extended with the following arguments:

-l (lemmas file) -t (time limit, seconds) -c (number of cores)

Red dot

System Design

Red dot The system design of Anthem-P2P is summarized above. Given two logic programs written in the mini-GRINGO (Section 2, [4]) subset of the input language of Clingo, and a user guide written in a custom specification language (Section 5, [4]), Anthem-P2P will verify that the programs have equivalent external behavior under the assumptions of the user guide. This is accomplished by transforming the problem into an input (consisting of a logic program and a specification) to the system Anthem ([4]). This transformation is justified by the theory presented in [3]. Similarly, Anthem transforms the task of proving that a logic program implements a specification into a theorem-proving task for Vampire [5]. The proof search can often be accelerated by providing helper lemmas (optional) that direct the search. We now describe how the example shown in Figure 1 is processed by the system depicted in Figure 2.

The first task of Anthem-P2P is to identify the public (input and output) predicates occurring in "User Guide" (in this case just "prime/1"). Any predicates occurring in "Original" ("Alternative") that are not public are considered private to that program. The pre-processing step creates new programs where private predicate constants are replaced with fresh predicate constants obtained by appending an "_1" to constants from Original and an "_2" to constants from Alternative. We will call the lists of such new predicates $\mathbf{p}$ and $\mathbf{q}$, respectively. In this example, $\mathbf{p} = \{composite\_1/1\}$ and $\mathbf{q} = \{composite\_2/1\}$. Next, Anthem is used to generate the formula representations of rules from "New Original". Specifically, we obtain the completed definitions ([4]) of predicates from $\mathbf{p}$ (call this list of formulas $\mathbf{a}$), and the completed definitions of public predicates from New Original (call this list of formulas $\mathbf{s}$). To $\mathbf{s}$ we also add the formula representations of constraints from New Original. "Final specification" is generated by extending the user guide with predicate symbols from $\mathbf{p}$ as input symbols, formulas from $\mathbf{a}$ as assumptions, and formulas from $\mathbf{s}$ as specs (conjectures that must be proven). The Anthem system is invoked a second time to verify that New Alternative implements Final Specification, which is equivalent to proving that Original and Alternative have the same external behavior under the assumptions of User Guide.

Acknowledgements

Thanks go to Yuliya Lierler and Vladimir Lifschitz for their feedback on this draft, and on this system as it was being developed. Thanks also to Nathan Temple for reporting the bugs he encountered while using early versions, and the College of IS&T for sponsoring the AP2P server.

References

  1. Pedro Cabalar, Jorge Fandinno & Yuliya Lierler (2020): Modular Answer Set Programming as a Formal Specification Language. Theory and Practice of Logic Programming, doi:10.1017/S1471068420000265.
  2. Jorge Fandinno, Zachary Hansen & Yuliya Lierler (2022): Arguing Correctness of ASP Programs with Aggregates. In: Georg Gottlob, Daniela Inclezan & Marco Maratea: Logic Programming and Nonmonotonic Reasoning, Lecture Notes in Computer Science. Springer International Publishing, Cham, pp. 190-202, doi:10.1007/978-3-031-15707-3_15.
  3. Jorge Fandinno, Zachary Hansen, Yuliya Lierler, Vladimir Lifschitz & Nathan Temple (2023): External Behavior of a Logic Program and Verification of Refactoring. Theory and Practice of Logic Programming. Available at http://www.cs.utexas.edu/users/ai-labpub-view.php?PubID=127994.
  4. Jorge Fandinno, Vladimir Lifschitz, Patrick Lühne & Torsten Schaub (2020): Verifying Tight Logic Programs with Anthem and Vampire. Theory and Practice of Logic Programming 20(5), pp. 735-750, doi:10.1017/S1471068420000344.
  5. Laura Kovács & Andrei Voronkov (2013): First-Order Theorem Proving and Vampire. In: Natasha Sharygina & Helmut Veith: Computer Aided Verification, Lecture Notes in Computer Science. Springer, Berlin, Heidelberg, pp. 1-35, doi:10.1007/978-3-642-39799-8_1.

PySpArX - A Python Library for Generating Sparse Argumentative Explanations for Neural Networks

Ioana Mihailescu (Imperial College London)
Alan Weng (Imperial College London)
Siddharth Sharma (Imperial College London)
Mihnea Ghitu (Imperial College London)
Dilshaan Grewal (Imperial College London)
Khemi Chew (Imperial College London)
Hamed Ayoobi (Imperial College London)
Nico Potyka (Imperial College London)
Francesca Toni (Imperial College London)

Introduction

The increasing use of data-centric techniques in autonomous intelligent systems in areas such as healthcare, automotive, and finance raises concerns about their predictions' reliability, fairness, and transparency. In the case of systems empowered by black-box machine learning models, the user has no access to the inner mechanics of the systems, thus making it essential to obtain a human-readable interface providing explanations of the models' operations.
Explainable Artificial Intelligence (XAI) techniques aim to provide user-friendly explanations for models. SpArX (Sparse Argumentative Explanations for Neural Networks [2]) is an XAI method that faithfully explains the mechanics of neural networks in the form of Multi-Layer Perceptrons (MLPs) by exploiting the correspondence between MLPs and Quantitative Argumentation Frameworks (QAF) [11]. Intuitively, QAFs are a form of argumentation framework amounting to weighted graphs that hold arguments as their nodes and relations (of attack or support) between arguments as their edges. To provide an explainable interface of MLPs using QAFs, the MLPs are first sparsified, through a per-layer clustering of neurons based on output-similarity. The sparsified MLPs are then transformed into QAFs and then global (input-independent) and local (within the vicinity of a target input) explanations are generated, while faithfully preserving the mechanics of the original MLPs.
Building upon SpArX, we have provided users with tools that help them prove and understand how MLPs, trained on specific datasets, work. The tools allow users to customize explanations to their needs.

System Overview

The architecture comprises of three primary components, namely a Python library, a GUI for generating models, and a web-based application for visualization. We have provided technical users with a Python Pip package [7] in which a modular implementation of SpArX can be found, as well as a GUI [5] in which they can input their own dataset, and generate a customizable MLP. This is forwarded to our framework pipeline, which performs the aforementioned transformations (sparsification and mapping onto a QAF). The final QAF is then stored in a database and made available online to other users via a shareable link [10] where it can be visualised.

sparx-lib

The Python Pip package, sparx-lib [7], is a custom library developed to handle the heavy computations required for generating SpArX explanations. It is designed with a modular architecture that allows for the flexible integration of different components of the SpArX algorithm. It enables users to generate explanations for a variety of models, which can be either user-specified, with a dataset, or imported. Tensorflow and Keras are utilized to develop and train custom models. Users can generate two types of visualisations: pure JSON, which can be viewed as text or parsed, or a GUI using NetworkX and Bokeh. We used a documentation generation tool called Sphinx to create documentation for the sparx-lib pip package [6].

Model generation GUI

The model generation GUI [5] is a tool developed using the React framework. It provides a platform for administrators or technical users to design MLPs for a selected dataset, generate explanations, and store visualizations in a remote database for access by other users. The model generation process is currently performed locally due to the computational demands involved in training the model and calculating explanations. The requirements and instructions for its execution are provided in the SpArX-GUI repository [5].

Visualisation

Figure 1: Web app visualisation [10] for the Iris dataset [3]

Visualisation

The customizable visualization component [9] provides features such as:

We have utilised React with React Flow to create interactive graphs that can be easily modified (See Figure [1]). Our server has been deployed on the web to enhance accessibility to the app. Administrators can simply share a link to the dedicated visualisation page with other non-technical users.

Demo requirements

To run the project, follow the instructions in the README file from the SpArX-GUI repository [5]. The model generation GUI accepts datasets in CSV format where the first line represents the name of the parameter/column. A test dataset is provided in the SpArX-GUI repository under data/iris.data. For demo purposes, an already generated visualisation of a SpArX explanation can be found online [10]. A demonstration video can be found at [4].

Acknowledgments

This research was partially funded by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No. 101020934, ADIX) and by J.P. Morgan and by the Royal Academy of Engineering under the Research Chairs and Senior Research Fellowships scheme. Any views or opinions expressed herein are solely those of the authors.

References

  1. H. Ayoobi, N. Potyka & F. Toni (2022): SpArX legacy code. Available at https://github.com/H-Ayoobi/SpArX.
  2. H. Ayoobi, N. Potyka & F. Toni (2023): SpArX: Sparse Argumentative Explanations for Neural Networks, doi:10.48550/ARXIV.2301.09559. Available at https://arxiv.org/abs/2301.09559.
  3. D. Dua & C." Graff (2017): UCI Machine Learning Repository. Available at http://archive.ics.uci.edu/ml.
  4. I. Mihailescu (2023): PySpArX - A library for SpArX explanations of Neural Networks - Demo. Available at https://youtu.be/OJHl4zegFvU.
  5. I. Mihailescu, K. Chew, M. Ghitu, S. Sharma, D. Grewal & A. Weng (2022): SpArX-GUI. Available at https://github.com/SpArX-Group-10/SpArX-GUI.
  6. I. Mihailescu, K. Chew, M. Ghitu, S. Sharma, D. Grewal & A. Weng (2022): Sparx-lib documentation. Available at https://sparx-group-10.github.io/SpArX/.
  7. I. Mihailescu, K. Chew, M. Ghitu, S. Sharma, D. Grewal & A. Weng (2022): Sparx-lib pip package. Available at https://pypi.org/project/sparx-lib/.
  8. I. Mihailescu, K. Chew, M. Ghitu, S. Sharma, D. Grewal & A. Weng (2022): SpArX-lib Repository. Available at https://github.com/SpArX-Group-10/SpArX.
  9. I. Mihailescu, K. Chew, M. Ghitu, S. Sharma, D. Grewal & A. Weng (2022): SpArX-Visualisation. Available at https://github.com/SpArX-Group-10/SpArX-Visualisation.
  10. I. Mihailescu, K. Chew, M. Ghitu, S. Sharma, D. Grewal & A. Weng (2022): SpArX-Visualisation Web app example. Available at https://sparx-vis.herokuapp.com/63ac3bd37963d9af247d8102.
  11. N. Potyka (2021): Interpreting Neural Networks as Quantitative Argumentation Frameworks. In: AAAI Conference on Artificial Intelligence, (AAAI). AAAI Press, pp. 6463–6470, doi:10.1609/aaai.v35i7.16801.

Alternating Fixpoint Operator for Hybrid MKNF Knowledge Bases as an Approximator of AFT (Extended Abstract)

Fangfang Liu (Shanghai University)
Jia-Huai You (University of Alberta)

Abstract

Approximation fixpoint theory (AFT) provides an algebraic framework for the study of fixpoints of operators on bilattices and has found its applications in characterizing semantics for various nonmonotonic languages. Here, we show that the alternating fixpoint operator by Knorr et al. for the study of the well-founded semantics for hybrid MKNF is in fact an approximator of AFT in disguise, which, thanks to the abstraction power of AFT, characterizes all two-valued and three-valued semantics for hybrid MKNF. Furthermore, we show an improved approximator for these knowledge bases, of which the least stable fixpoint is information richer than the one formulated from Knorr et al.'s construction, which leads to an improved computation for the well-founded semantics. This work is built on an extension of AFT that supports consistent as well as inconsistent pairs in the induced product bilattice, to deal with inconsistencies that arise in the context of hybrid MKNF. This part of the work generalizes the original AFT from symmetric approximators to arbitrary approximators.

1 Generalization of AFT

Given a complete lattice \( \langle L, \leq\rangle \), AFT is built on the induced product bilattice \( \langle L^2, \leq_p\rangle \), where \( \leq_p \) is the precision order and defined as: for all \( x, y, x', y' \in L \), \( (x, y) \leq_p (x', y')\) if \(x \leq x'\) and \(y' \leq y\). A pair \( (x,y) \in L^2 \) is consistent if \(x \leq y \) and inconsistent otherwise, and a pair \( (x,x) \) is called exact . We denote the set of consistent pairs by \( L^c \). Since the \( \leq_p \) ordering is a complete lattice ordering on \( L^2 \), \( \leq_p \)-monotone operators on \(L^2\) possess fixpoints and a least fixpoint. The original AFT is restricted to consistent and symmetric approximators [1],[2], and we generalize it to all \(\leq_p\)-monotone operators on \(L^2\).

Definition: An operator $A: {L}^2\rightarrow {L}^2$ is an approximator if $A$ is $\leq_p$-monotone on $L^2$ and for all $x \in {L}$, whenever ${A}(x,x)$ is consistent, $A$ maps $(x,x)$ to an exact pair.

The original definition of an approximator requires an $\leq$-monotone operator $A: L^2 \rightarrow L^2$ to map an exact pair to an exact pair. For example, consider a complete lattice where ${L}= \{\bot, \top\}$ and $\leq$ is defined as usual. Let ${A}$ be an identity function on ${L}^2$ everywhere except ${A}(\top,\top) = (\top, \bot)$. Thus, ${A}(\top,\top)$ is inconsistent. But it is easy to check that ${A}$ is $\leq_p$-monotone. Thus, while the operator $A$ is an approximator by our definition, it is not by the original definition.

For the study of semantics, the main focus has been on the stable revision operator, which is defined as: Given any pair $(u,v) \in L^2$ and an approximator $A$, we define $St_A(u,v) = ({\sf {lfp}}({A}( \cdot , v)_1), {\sf{lfp}}(A(u, \cdot)_2))$, where ${A}( \cdot , v)_1$ denotes the operator $L \rightarrow L: z \mapsto A(z, v)_1$ and $A(u,\cdot)_2$ denotes the operator $L \rightarrow L: z \mapsto A(u, z)_2$. That is, both ${A}( \cdot , v)_1$ and $A(u,\cdot)_2$ are projection operators on $L$. Since $A$ is $\leq_p$-monotone on $L^2$, both projection operators ${A}( \cdot , v)_1$ a nd $A(u,\cdot)_2$ are $\leq$-monotone on $L$ for any pair $(u,v) \in L^2$, and thus the least fixpoint exists for each. The stable revision operator is therefore well-defined, and furthermore, it is $\leq_p$-monotone as well. The fixpoints of the stable revision operator $St_{A}$ are called stable fixpoints of $A$.

In general, however, there is no guarantee that under the above notion of stable revision consistent stable fixpoints under consistent AFT are preserved. One can argue that a desirable approximator should not exhibit this ``anomaly'' so that accommodating inconsistent pairs does not have to sacrifice the preservation of consistent stable fixpoints.

Definition Let $A$ be an approximator on $L^2$ and $(u,v) \in L^c$ such that $(u,v) = ({\sf {lfp}}(A(\cdot, v)_1), {\sf {lfp}}(A(u,\cdot)_2))$, where $A(\cdot,v)_1$ is an operator on $[\bot,v]$ and $A(u,\cdot)_2$ is an operator on $[u,\top]$. (This is the original definition of stable revision for consistent AFT.) Approximator $A$ is called strong for $(u,v)$ if $(u,v) = ({\sf {lfp}}(A(\cdot, v)_1), {\sf {lfp}}(A(u,\cdot)_2))$, where both $A(\cdot,v)_1$ and $A(u,\cdot)_2$ are operators on $L$. Approximator $A$ is called strong if it is strong for every $(u,v) \in L^c$ that satisfies the above condition.

2 Alternating Fixpoint Operator for Hybrid MKNF as an Approximator

The logic of MKNF consists of a first-order language with two modal operators, ${\bf {K}}$, for minimal knowledge, and ${\bf {not}}$, for negation-as-failure. Motik and Rosati [5] propose hybrid MKNF for integrating nonmonotonic rules with description logics (DLs) under two-valued logic, and Knorr et al. [3] generalize it to three-valued semantics where the information-minimum three-valued MKNF model of an MKNF formulat ${\varphi}$, when it exists, is call the well-founded MKNF model of ${\varphi}$.

In three-valued MKNF, formulas are evaluated by three-valued MKNF structures in the form of $(I, {\cal M}, {\cal N} )$, which consists of a first-order interpretation, $I$, and two pairs, ${\cal M} = \langle M, M_1 \rangle$ and ${\cal N} = \langle N, N_1 \rangle$, of sets of first-order interpretations, where $M_1 \subseteq M$ and $N_1 \subseteq N$. $I$ is to evaluate object formulas, ${\cal M}$ is to evaluate ${\bf K}$-atoms, and ${\cal N}$ to evaluate ${\bf not}$-atoms. From the two component sets in ${\cal M} =\langle M,M_1 \rangle$, three truth values for modal ${\bf K}$-atoms are defined as: ${\bf K} \varphi$ is true w.r.t. ${\cal M} =\langle M, M_1\rangle$ if $\varphi$ is true in all interpretations of $M$; it is false if it is false in at least one interpretation of $M_1$; and it is undefined otherwise. For ${\bf {not}}$-atoms, a symmetric treatment w.r.t. ${\cal N}=\langle N,N_1 \rangle$ is adopted. A three-valued MKNF model $(M,N)$ of an MKNF formula ${\varphi}$ is a three MKNF structure $(I, (M,N), (M,N))$ that satisfies ${\varphi}$ and a condition that guarantees minimal knowledge and ``minimal undefinedness''.

A hybrid MKNF knowledge base ${\cal K} = (\cal O,\cal P) $ consists of a decidable description logic (DL) knowledge base $\cal O$, translatable into first-order logic and a rule base ${\cal P}$, which is a finite set of rules with modal atoms. Following [3] our focus here is on nondisjunctive rules.

A (normal MKNF) rule $r$ is of the form: ${\bf K} H \leftarrow {{\bf K}} A_1,\ldots, {\bf K} A_m, {\bf not} B_1, \ldots, {\bf not} B_n$, where $H, A_i,$ and $B_j$ are function-free first-order atoms. Given a rule $r$, we let ${\textit{hd}}(r) ={{\bf K}} H$, ${\textit{bd}}^+ (r) = \{{{\bf K}} A_i\,|\, i = 1 .. m\}$, and ${\textit{bd}}^-(r) = \{B_i\,|\,i= 1.. n\}$. We use the notation ${\bf K}({\textit{bd}}^-(r)) = \{{\bf K} B_1, \ldots, {\bf K} B_n\}$.

For the interpretation of a hybrid MKNF knowledge base ${\cal K}= (\cal O, \cal P)$, a transformation $\pi ({\cal K}) = {\bf K} \pi(\cal O) \wedge \pi(\cal P)$ is performed to transform $\cal O$ into a first-order formula and rules $r \in {\cal P}$ into a conjunction of first-order implications to make each of them coincide syntactically with an MKNF formula, i.e., $$ \begin{array}{ll} \pi(r) = \forall \vec{x}: ({{\bf K}} H \subset {\bf K} A_1 \wedge \ldots \wedge {\bf K} A_m \wedge {{\bf not}} B_1 \wedge \ldots \wedge {{\bf not}} B_n)\\ \pi({\cal P})= \bigwedge_{r \in {\cal P}} \pi(r) \\ \pi({\cal K}) = {\bf K} \pi({\cal O}) \wedge \pi({\cal P}) \end{array} $$ where $\vec{x}$ is the vector of free variables in $r$.

Under the additional assumption of DL-safety a first-order rule base is semantically equivalent to a finite ground rule base under both two-valued [5] and three-valued semantics [3]; hence decidability is guaranteed. In the following, we assume that a given rule base is DL-safe and already grounded.

Given a hybrid MKNF knowledge base ${\cal K}= (\cal O, \cal P)$, let ${{\sf KA} (\cal K)}$ be the set of all (ground) ${\bf K}$-atoms ${\bf K} {\varphi}$ such that either ${\bf K} {\varphi}$ occurs in ${\cal P}$ or ${\bf not} {\varphi}$ occurs in ${\cal P}$. A partition of ${{\sf KA} (\cal K)}$ is a pair $(T, P)$ such that $T, P \subseteq {\sf KA} ({\cal K})$; if $T \subseteq P$, then $(T,P)$ is said to be consistent, otherwise it is inconsistent.

Knorr et al. [3] define an alternating fixpoint construction to compute the well-founded MKNF model. Their construction can be equivalently formulated by stable revisions with the following approximator.

Definition Let ${\cal K}= (\cal O, \cal P)$ be a normal hybrid MKNF knowledge base. Define an operator ${\varPhi}_{\cal K}$ on $(2^{{\sf KA} (\cal K)})^2$ as follows: ${\varPhi}_{\cal K}(T,P) = ({\varPhi}_{\cal K} (T,P)_1 , {\varPhi}_{\cal K}(T,P)_2)$, where $$ \begin{array}{ll} {\varPhi}_{\cal K} (T,P)_1 = \{{{\bf K}} a\in {{\sf KA}}({\cal K}) \mid {\sf OB}_{{\cal O}, T}\models a\} \cup \\~~~~~~~~~~~~~~~~~~~~~~~~~~~\{ {{\bf K}} a \mid r \in {\cal P}: {\textit{hd}}(r) = \{{{\bf K}} a \}, {\textit{bd}}^+(r) \subseteq T, {{\bf K}}({\textit{bd}}^-(r)) \cap P = \emptyset\} \\ {\varPhi}_{\cal K} (T,P)_2 = \{{{\bf K}} a\in {\sf KA}({\cal K}) \mid {\sf OB}_{{\cal O}, P}\models a\} \cup \\~~~~~~~~~~~~~~~~~~~~~~~~~~~\{ {{\bf K}} a \mid r \in {\cal P}: {\textit{hd}}(r) = \{{{\bf K}} a \}, \, {\sf OB}_{{\cal O}, T} \not \models \neg a, {\textit{bd}}^+(r) \subseteq P, {{\bf K}}({\textit{bd}}^-(r)) \cap T = \emptyset\} \end{array} $$

Stable revision computes the least fixpoints of the projection operators ${\varPhi}_{\cal K}(\cdot,P)_1$ and ${\varPhi}_{\cal K}(T,\cdot)_2$, respectively. Intuitively, given a partition $(T,P)$, the operator ${\varPhi}_{\cal K}(\cdot,P)_1$, with $P$ fixed, computes the set of true ${\bf K}$-atoms w.r.t. $(T,P)$ and operator ${\varPhi}_{\cal K}(T,\cdot)_2$, with $T$ fixed, computes the set of ${\bf K}$-atoms that are possibly true w.r.t. $(T,P)$. The condition ${\sf OB}_{{\cal O}, T} \not \models \neg a$ attempts to avoid the generation of a contradiction. We can show that ${\varPhi}_{\cal K}$ is an approximator on the bilattice $(2^{{\sf KA} (\cal K)})^2$ and preserves all consistent stable fixpoints (and is thus a strong approximator). Note that operator ${{\varPhi}}_{\cal K}$ is not symmetric and it can map a consistent pair to an inconsistent one. A major advantage of AFT is that the stable fixpoints of ${\varPhi}_{\cal K}$ satisfying a consistency condition characterize all three-valued MKNF models.

Theorem Let ${\cal K}= (\cal O,\cal P)$ be a normal hybrid MKNF knowledge base and $(T,P)$ be a partition. Also let $( M , N ) = (\{ I\, |\, I \models {\sf OB}_{{\cal O} , T}\},\{I\,|\,I \models {\sf OB}_{{\cal O},P}\})$. Then, $(M,N)$ is a three-valued MKNF model of ${\cal K}$ iff $(T,P)$ is a consistent stable fixpoint of ${\varPhi}_{\cal K}$ and ${\sf OB}_{{\cal O}, {\sf {lfp}}({\varPhi}_{\cal K}(\cdot,T)_1)}$ is satisfiable.

Thus, given a hybrid MKNF KB ${\cal K}$, we can compute the least stable fixpoint of ${\varPhi}_{\cal K}$ and check if ${\sf OB}_{{\cal O}, {{\sf lfp}}({\varPhi}_{\cal K}(\cdot,T)_1)}$ is satisfiable to determine the existence of a well-founded MKNF model. The process is polynomial if so is the underlying DL. Since the problem of computing the well-founded MKNF model is in general intractable, even for normal hybrid MKNF KBs [4], a question is whether we can enlarge the class of hybrid MKNF KBs whose well-founded MKNF model can be tractably computed this way. We answer this question positively by formulating a strictly more precise approximator.

References

  1. Marc Denecker, Victor Marek & Miroslaw Truszczynski (2000): Approximations, stable operators, wellfounded fixpoints and applications in nonmonotonic reasoning. In: Logic-Based Artificial Intelligence, Springer, pp. 127–144, doi: 10.1007/978-1-4615-1567-8_6.
  2. Marc Denecker, Victor W. Marek & Miroslaw Truszczynski (2004): Ultimate approximation and its application in nonmonotonic knowledge representation systems. Information and Computation 192(1), pp. 84–121, doi: 10.1016/j.ic.2004.02.004.
  3. Matthias Knorr, Jose Julio Alferes & Pascal Hitzler (2011): Local closed world reasoning with description logics under the well-founded semantics. Artificial Intelligence 175(9–10), pp. 1528–1554, doi:10.1016/j.artint.2011.01.007.
  4. Fangfang Liu & Jia-Huai You (2017): Three-valued semantics for hybrid MKNF knowledge bases revisited. Artificial Intelligence 252, pp. 123–138, doi:10.1016/j.artint.2017.08.003.
  5. Boris Motik & Riccardo Rosati (2010): Reconciling Description Logics and Rules. Journal of the ACM 57(5), pp. 1–62, doi:10.1145/1754399.1754403.

Summary of Statistical Statements in Probabilistic Logic Programming

Damiano Azzolini (University of Ferrara)
Elena Bellodi (University of Ferrara)
Fabrizio Riguzzi (University of Ferrara)

Abstract

Statistical statements, also called Type 1 statements by Halpern, have a new representation in terms of Probabilistic Answer Set Programming under the credal semantics. In this extended abstract we summarize that contribution.

Contribution

This is a summary of the paper "Statistical Statements in Probabilistic Logic Programming" [1] presented at LPNMR2022. In First-Order knowledge bases, we can adopt statistical statements, also known as Type 1 statements [6], to represent statistical information about the domain, such as "40% of the elements have a particular property". The authors of [7] propose to encode probabilistic conditionals (i.e., statistical statements) with formulas of the form \((C \mid A)[\Pi]\), where \(C\) and \(A\) are First-Order formulas and \(\Pi \in [0,1]\) with the meaning that \(100\cdot\Pi\%\) of elements that satisfy formula \(A\) also satisfy \(C\), and compute the probability of a query by adopting the maximum entropy principle [8].

Differently, in [1] the authors propose to encode statistical statements with the syntax $$ (C \mid A)[\Pi_l, \Pi_u] $$ with the meaning that at least \(100\cdot\Pi_l\%\) and at most \(100\cdot\Pi_u\%\) of the elements that satisfy formula \(A\) also satisfy \(C\). To assign a semantics to these and to perform inference, the authors propose to adopt the credal semantics of probabilistic answer set programs [3] and encode statements with answer set rules and constraints [2]. Probabilistic answer set programming under the credal semantics represents uncertainty with answer set programming extended with ProbLog probabilistic facts [4] \(\Pi::f\), with the meaning that the probability of \(f\) of being true if \(\Pi\) (\(\Pi \in [0,1]\)). A world is a selection of a truth value for every probabilistic fact and is an answer set program with one or more answer sets (the semantics requires that every world has at least one answer set). A world is associated with a probability value computed as $$ P(w) = \prod_{f_i \ \text{selected}} \Pi_i \cdot \prod_{f_i \ \text{not selected}} (1-\Pi_i). $$ Since every world has one or more stable models, the probability of a query \(P(q)\) is defined by a range: a world contributes to the upper bound if the query is true in at least one answer set and also contributes to the lower bound if it is true in every answer set. It is required that every world has at least one answer set.

The meaning of a statistical statement is given in terms of models for every world. That is, the models of a world where the constraint $$ \Pi_l \leq \frac{\# count\{\mathbf{X}:C(\mathbf{X}),A(\mathbf{X})\}}{\# count\{\mathbf{X}:A(\mathbf{X})\}} \leq \Pi_u $$ is false should be excluded. Practically speaking, consider the following small knowledge base:
0.4::bird(1). 0.4::bird(2). 0.4::bird(3). 0.4::bird(4).
(fly(X)|bird(X))[0.6,1].
The first line contains four probabilistic facts stating that each of the four elements (indexed with 1, ..., 4) can be birds with probability 0.4. The statistical statement states that at least 60\% (and at most 100\%) of the birds fly. The statement is converted into two answer set rules:
fly(X) ; not_fly(X) :- bird(X).
:- #count{X:bird(X)}=H, #count{X:fly(X),bird(X)}=FH, 100*FH<60*H.
Only two rules suffice, since \(\Pi_u=1\). From this, we can compute the probability of a query, such as \(fly(1)\). This requires checking its validity in the answer sets of each world. Since we are interested only in knowing if it holds in all the answer sets of a world or in at least one, and not in the number of answer sets, we can adopt projection [5] : every probabilistic fact \(\Pi::f\) is converted into three rules \(f(PT):- f.\), \(nf(PF):- not \ f.\), \(\{f\}.\), where \(PT=\Pi \cdot 10^n\) and \(PF=(1-\Pi) \cdot 10^n\) (where \(n\) can be selected and is needed since ASP cannot deal with floating point values), and then we can compute the projective solutions on the query, \(f/1\) and, \(nf/1\) atoms. For the previous program, we get \(P(fly(1))=[0.2592, 0.4]\).

Acknowledgements

This research was partly supported by TAILOR, a project funded by EU Horizon 2020 research and innovation programme under GA No. 952215.

References

  1. Damiano Azzolini, Elena Bellodi, and Fabrizio Riguzzi (2022): Statistical Statements in Probabilistic Logic Programming. In Georg Gottlob, Daniela Inclezan, and Marco Maratea, editors: Logic Programming and Non-monotonic Reasoning, Springer International Publishing, Cham, pp. 43-55, doi:10.1007/978-3-031-15707-3_4.
  2. Gerhard Brewka, Thomas Eiter, and Miroslaw Truszczynski (2011): Answer Set Programming at a Glance. Communications of the ACM 54(12), pp. 92-103, doi:10.1145/2043174.2043195.
  3. Fabio Gagliardi Cozman and Denis Deratani Mauá (2020): The joy of Probabilistic Answer Set Programming: Semantics, complexity, expressivity, inference. International Journal of Approximate Reasoning 125, pp. 218-239, doi:10.1016/j.ijar.2020.07.004.
  4. Luc De Raedt, Angelika Kimmig, and Hannu Toivonen (2007): ProbLog: A Probabilistic Prolog and Its Application in Link Discovery. In Manuela M. Veloso, editor: 20th International Joint Conference on Artificial Intelligence (IJCAI 2007), 7, AAAI Press, pp. 2462-2467.
  5. Martin Gebser, Benjamin Kaufmann, and Torsten Schaub (2009): Solution Enumeration for Projected Boolean Search Problems. In Willem-Jan van Hoeve and John Hooker, editors: Integration of AI and OR Techniques in Constraint Programming for Combinatorial Optimization Problems, Springer Berlin Heidelberg, pp. 71-86, doi:10.1007/978-3-642-01929-6_7.
  6. Joseph Y. Halpern (1990): An Analysis of First-Order Logics of Probability. Artificial Intelligence 46(3), pp. 311-350, doi:10.1016/0004-3702(90)90019-V.
  7. Gabriele Kern-Isberner and Matthias Thimm (2010): Novel Semantical Approaches to Relational Probabilistic Conditionals. In: Proceedings of the Twelfth International Conference on Principles of Knowledge Representation and Reasoning, AAAI Press, pp. 382-392.
  8. Marco Wilhelm, Gabriele Kern-Isberner, Marc Finthammer, and Christoph Beierle (2019): Integrating Typed Model Counting into First-Order Maximum Entropy Computations and the Connection to Markov Logic Networks. In Roman Barták and Keith W. Brawner, editors: Proceedings of the Thirty-Second International Florida Artificial Intelligence Research Society Conference, AAAI Press, pp. 494-499

Error-free Smart Legal Contracts without Programmers

Kevin Purnell (Macquarie University)
Rolf Schwitter (Macquarie University)

1 Introduction

This research investigates the potential of declarative languages to advance what can be achieved by domain experts producing their own automation. We illustrate this potential by exploring the issue of domain experts implementing their own executable legal documents as both human- and machine-readable smart legal contracts deployable on a blockchain [7,11]. Smart contracts have the potential to enable automation in previously automation-resistant areas (e.g., legal contracts and contract management). While some legal documents can probably never be fully automated (e.g., subjective performance criteria), many legal documents and contracts use forms of logic that are computable, can be agreed by electronic signature, have performance that can be delivered and administered electronically and use money as the consideration. The current reality; however, is that this type of automation is usually impractical because of: an inability to build custom smart contracts economically; the risk of errors and security breaches; and, inflexibility in regard to implementing contract modifications. These hurdles motivate the research question that we answer: Is it possible for domain experts to design, build, test and deploy their own custom legal documents as smart contracts which are free from errors and security exploits and can also support contract modifications? After pure first-order logic was shown to be inadequate for expressing legal concepts [4], non-monotonic declarative languages like Answer Set Programming (ASP), TOAST, SPINdle [1], Turnip [2], and a controlled natural language, Logical English [6] were developed and used to model legal logic. Following this stream of research, we investigate the use of ASP for modelling legal logic by iteratively developing a proof-of-concept smart document editor (SDE editor) which reads an existing legal document (in HTML) and transforms it in five domain expert-guided steps into an error-free executable logic program [8,9,10]. Domain experts model the ontology, legal logic, generate the assertional data, and perform all testing tasks for amenable legal documents. The editor communicates visually and verbally in domain familiar concepts; a feature made possible by the formal correspondences achieved between graphics, text and declarative representations, and automation of steps not requiring domain knowledge. Our approach allows automatic construction of ASP code and enables highly automated testing.

2 System Description

The SDE editor uses ASP to represent the ontology and the legal processes derived from a legal document. Firstly, the artefacts in the document and their relationships are captured in representations by a process where three different notations (a term, a graphic and an ASP-like string) are allocated the same meaning by the user. This formal correspondence and the use of a grammar facilitates the automatic generation of representations, rules and the automation of model validation and program verification. The user sees the ontology being built up as they work through the legal document, and can use ontology elements in rules which are then tested in dynamic visualisations. Other formal correspondences ease translation into structured English sentences that use the correct verb tense and correctly describe both general and instance descriptions of artefacts.



Legal documents have evolved from paper documents filled out and signed by hand, into documents signed digitally and managed by tools like document automation systems [5] which provide support for drafting through to the administration of active contracts. The SDE editor (see Figure 1) adds the ability to first understand the closed world of a legal document, then assist in the modelling and testing of the embedded logic, resulting in an exhaustively tested logic program that can be deployed as a smart contract. This approach offers the potential of broader applicability and more comprehensive automation than current approaches. The workflow of the SDE editor can be split into two phases: 1) document understanding; and, 2) smart contract creation. Document understanding involves: (i) modelling the ontology (ontology discovery); (ii) modelling the legal logic (logic modelling); and, (iii) validating these models against the designer’s understanding (model validation). Smart contract creation involves: (i) entering actual data (assertional data); and, (ii) testing that the output is what is expected across all possible inputs (program verification). These processes accumulate knowledge in representations that are consistent across the workflow due to auto-generation from ontology representations. The result is a tested ASP program embedded in the original completed legal document (i.e., a Ricardian Contract [3] ).

3 Evaluation and Results

If the components of the research question are used as evaluation criteria then the SDE editor achieves most criteria. The SDE editor enables: 1) design, build and testing of suitable legal documents as smart contracts by domain experts; 2) practical custom smart legal contracts; 3) smart legal contracts that are free from errors from the perspective of the designer; 4) reduction in security risk by reducing unproven components in the toolchain; and, 5) practical smart legal contract modifications. By using an executable declarative language to represent and reason over business/legal logic, the SDE editor overcomes most of the hurdles experienced with smart contracts coded in an imperative programming language like Solidity, and extends what practical automation is achievable for legal documents. The approach promises smart contracts that: 1) are designed, built and tested by domain experts; 2) are error-free (designer perspective); 3) explain their automatic decisions in controlled English in an audit log; 4) achieve practical customisation due to the ontology discovery step; 5) achieve practical contract modifications (legal sense) due to the use of an elaboration tolerant declarative language; 6) are flexible in regard to fitting with current practice and partial automation (uses existing legal documents and supports human-in-the-loop processes); 7) achieve user interaction in structured English and via visualisation with optional visual interaction; 8) encode business/legal logic in a declarative language with formal semantics, then verbalises the computed responses back into English; an approach that opens the way to achieving error-free smart legal contracts; 9) use a smart assistant to reduce user workload; and, 10) achieve simplified representations of complex logic and legal reasoning (defeasible logic); a capability beyond current smart contract programming languages, and which extends applicability.

4 Future Work

Recent machine learning advances allow a more fluent user-interface experience than achieved by the SDE editor; however, these approaches struggle to produce explainable solutions and generate error-free programs. Enhancing the current smart assistant with machine learning capabilities could further simplify the user interface and extend maximum practical program size by automating tedious user interactions. We also believe that the proof-of-concept system is ready to be applied to a difficult problem of significance; however, two open questions remain: the degree to which ASP can express the full spectrum of deontic logic; and, the percentage of legal documents that contain logic inexpressible in ASP.

References

  1. Batsakis et al. (2018): Legal Representation and Reasoning in Practice: A Critical Comparison. In: Proceedings of JURIX 2018, pp. 31–40, doi:10.3233/978-1-61499-935-5-31.
  2. Governatori et al. (2020): On the Formal Representation of the Australian Spent Conviction Scheme. In: Proceedings of RuleML+RR 2020, pp. 117–185, doi:10.1007/978-3-030-57977-7_14.
  3. Grigg (2004): The Ricardian Contract. In: Proceedings of IEEE WEC, doi:10.1109/WEC.2004.1319505.
  4. Herrestad (1991): Norms and Formalization. In: Proceedings of ICAIL '91, doi:10.1145/112646.112667.
  5. HighQ (2022): Document Automation. url: https://legal.thomsonreuters.com/en/products/highq/.
  6. Kowalski and Datoo (2022): Logical English meets legal English for swaps and derivatives. AI Law, doi:10.1007/s10506-021-09295-3.
  7. Nakamoto (2008): Bitcoin. url: https://bitcoin.org/bitcoin.pdf.
  8. Purnell and Schwitter (2021): User-Defined Smart Contracts Using Answer Set Programming. In: LNCS, Advances in AI, AI 2021, 13151, Springer, pp. 291–303, doi:10.1007/978-3-030-97546-3_24.
  9. Purnell and Schwitter (2021): User-Guided Machine Understanding of Legal Documents. In: LNCS, New Frontiers in AI, JURISIN 2021, 13856, Springer, pp. 16–32, doi:10.1007/978-3-031-36190-6.
  10. Purnell and Schwitter (2022): Declarative Smart Contract Testing by Domain Experts. In: CEUR Workshop Proceedings, RuleML+RR DC, volume 3229, url: https://dblp.org/db/conf/ruleml/ruleml2022c.html.
  11. Wood (2014): Ethereum. url: https://gavwood.com/paper.pdf.

Axiomatization of Aggregates: Extended Abstract

Jorge Fandinno (University of Nebraska Omaha)
Zachary Hansen (University of Nebraska Omaha)
Yuliya Lierler (University of Nebraska Omaha)

This paper presents semantics for logic programs with aggregates that refer to neither fixpoints nor grounding, relying instead on transformations into first and second-order theories. This characterization introduces new function symbols to represent aggregates, whose meaning can be fixed by adding appropriate axioms to the result of the proposed transformations. These semantics provide a foundation for reasoning formally about non-ground programs with aggregates in a direct manner. This is useful for the task of formally verifying logic programs, and represents a first step towards using first-order theorem provers to automatically verify properties of programs with aggregates. For programs without positive recursion through aggregates our semantics coincide with the semantics of the answer set solver Clingo.

Introduction

Answer set programming (ASP) is a widely-utilized logic programming paradigm encompassing a number of highly expressive modeling languages and efficient solvers. Aggregates are one of the most useful ASP language constructs, and one of the most well-studied. This is due, in part, to the difficulty of defining a universally accepted semantics for aggregates ([6]). Most approaches to defining aggregate semantics rely upon grounding, a process by which programs with variables are transformed into propositional programs. There are also several approaches to describe the semantics of aggregates that bypass the need for grounding. However, these approaches either only allow a restricted class of aggregates ([7,8]) or extend the language of classical logic with new constructs to deal with aggregates ([1,2,3]). Our approach uses only the language of classical logic as in [7,8], but it is applicable to all programs with aggregates that fit within the restrictions of the ASP-Core-2 semantics, namely, that aggregates are non-recursive. Exclusively using the language of classical logic opens the door for automated verification with tools such as Anthem ([4]).

In the following section, we summarize our translation from logic programs with aggregates to second-order logic formulas. We restrict our attention to a simple subset of the Gringo input language which forbids nested aggregates and positive recursion through aggregates. We then show how the addition of second-order axioms can fix the interpretation of aggregate function symbols in a way that conforms to their behavior under the semantics implemented by the answer set solver Clingo. Finally, we demonstrate that this second-order characterization can be replaced with a first-order one when we consider only programs with finite aggregates. It is worth noting that this is not a practical restriction due to the inability of solvers to process infinite sets.

Syntax of Logic Programs With Aggregates

We consider a basic fragment of the Gringo input language, with program terms ranging over symbolic constants, program variables, special terms "inf" and "sup", and numerals (which have a one-to-one correspondence with integers). Atoms and comparisons are defined as usual in ASP. Basic literals are atoms and comparisons, optionally preceded by one or two occurrences of "not". An aggregate element has the form \begin{gather} t_1,\dots,t_k : l_1,\dots,l_m \label{eq:agel} \end{gather} where each $t_i$ ($1\leq i\leq k$) is a program term and each $l_i$ ($1\leq i\leq m$) is a basic literal. An aggregate element can be informally understood as representing the set of tuples of program terms $\langle t_1,\dots,t_k \rangle$ satisfying the list of conditions $l_1,\dots,l_m$. An aggregate atom is of form $\#\texttt{op}\{E\} \prec u$ where $\texttt{op}$ is an operation name, $E$ is an aggregate element, $\prec$ is a comparison symbol, and $u$ is a program term, called the "guard". We consider operation names $\texttt{count}$, $\texttt{sum}$, $\texttt{sum+}$, $\texttt{min}$, and $\texttt{max}$. Our task in this work is to formalize the intuition that these operations characterize functions on the sets of tuples represented by aggregate elements. Finally, programs are defined as a collection of basic rules (containing a single atom in the head) and constraints.

Semantics of Logic Programs With Aggregates

For each rule $R$ in a program $\Pi$, we obtain its many-sorted first-order formula representation by applying a translation $\tau^*_{\mathbf{Z} }$, where $\mathbf{Z} $ is the list of global variables (variables occurring in basic literals or the guards of aggregates) in $R$. Broadly speaking, this is a syntactic transformation that maps default negation into classical negation, commas into conjunctions, and the rule operator $\;\hbox{:-}\;$ into an implication from the body of the rule to the head. For an aggregate atom $A$ of form $\texttt{#op}\{E\} \prec u$, its translation $\tau^*_\mathbf{Z} $ is the atom $\mathit{op}(\mathit{set}_{|E/\mathbf{X} |}(\mathbf{X} )) \prec u$, where $\mathbf{X} $ is the list of variables in $\mathbf{Z} $ occurring in $E$. For every rule $R$, its translation $\tau^* R$ is the universal closure of the implication $$ \tau^*_\mathbf{Z} B_1 \wedge \dots \wedge \tau^*_\mathbf{Z} B_n \to \tau^*_\mathbf{Z} H, $$ where $\mathbf{Z} $ is the list of the global variables of $R$. For example, given an aggregate symbol $Y : r(X,Y,Z)/X$ named $e1$, $$\tau^*\left({s(X)} {\;\hbox{:-}\; q(X),\texttt{#sum}\{ Y : r(X,Y,Z)\}} \geq 1.\right) \quad\text{is}\quad \forall X \left(q(X) \wedge \mathit{sum}(\mathit{set}_{e1}(X)) \geq 1 \ \to \ s(X)\right).$$ Note that this is a formula over a signature of many sorts. Specifically, we consider separate domains (universes) for program terms, integers, tuples (of program terms), and sets of tuples. The second domain is a subset of the first, and the fourth domain is the powerset of the third. Assumptions about the forms of these domains and the behavior of fundamental functions and predicates such as addition and set membership are defined in our notion of standard interpretations. These assumptions do not fix the interpretation of aggregate elements or the function symbols corresponding to aggregate operations. To properly characterize the behavior of aggregates, we require our standard interpretations to additionally satisfy a set of second-order axioms $\Delta$ (introduced in the next section). Finally, we define the semantics of logic programs with aggregates using a many-sorted generalization of the SM operator ([5]). We say that a standard interpretation $I$ is a stable model of program $\Pi$ if it satisfies the second-order sentence $SM_{\mathbf{p}}[\tau^*\Pi] \wedge \Delta$ with $\mathbf{p}$ being the list of all predicate symbols occurring in $\Pi$.

Axiomatization of Aggregates

In this section, we will highlight a few representative axioms in set $\Delta$. In general, this set contains second-order axioms; however, assuming our aggregates are finite allows us to replace the second-order axioms with first-order ones. First, we introduce the class of "set formation axioms", which formally relate aggregate elements to sets of tuples. An aggregate symbol $E/\mathbf{X} $, where $E$ is an aggregate element, is associated with a unique set characterized by the sentence $$ \forall \mathbf{X} \ T \big(T \in \mathit{set}_{|E/\mathbf{X} |}(\mathbf{X} ) \leftrightarrow \exists \mathbf{Y}\ \big(T = \mathit{tuple}_{k}(t_1,\dots,t_k) \wedge l_1\wedge\cdots\wedge l_m \big)\big), $$ where $\mathbf{Y}$ is the list of all the variables occurring in $E$ that are not in $\mathbf{X} $. All variables in $\mathbf{Y}$ are of the sort program. $T$ is a variable of the sort tuple. For instance, recall the aggregate symbol $e1$ introduced earlier. The set formation axiom for this symbol has the form $$ \forall X T \big(T \in \mathit{set}_{e1}(X) \leftrightarrow \exists YZ\, \big(T = \mathit{tuple}_{2}(Y,Z) \wedge r(X,Y,Z) \big) \big) $$ Similarly, we can characterize the removal of an element from a set with function symbol "rem": $$ \forall S T S'\big( \mathit{rem}(S,T)=S'\leftrightarrow \forall T' \big( T' \in S' \leftrightarrow (T' \in S \wedge T' \not = T )\big)\big) $$ The $\texttt{sum}$ aggregate can be formalized for finite aggregates with the axiom $$ \forall \mathbf{X} \ S \big( \left(\forall T \left(T \in S \to T \in \mathit{set}_{|E/\mathbf{X} |}(\mathbf{X} )\right)\right) \to \mathit{FiniteSum}(S) \big) $$ where $\mathit{FiniteSum}(S)$ is shorthand for $$ \forall T \big( T \in t_{\mathit{set}} \to \exists N ( \mathit{sum}(\mathit{rem}(t_{\mathit{set}},T)) = N \wedge \mathit{sum}(t_{\mathit{set}})=N+\mathit{weight}(T))\big) $$ Finally, when $\Pi$ is tight, we can replace the second-order sentence $SM_{\mathbf{p}}[\tau^*\Pi]$ with a first-order sentence using program completion. This gives us a fully first-order characterization.

Final Remarks

The proposed semantics characterize logic programs with aggregates in terms of classical logic, allowing us to reason directly about the meaning of non-ground programs. This approach is highly general: the restrictions prohibiting nested aggregates and positive recursion through aggregates are less restrictive than those imposed by existing solvers and the ASP-Core-2 standard. Additionally, the assumptions made by standard interpretations, such as the assumption that the $+$ symbol behaves as addition, are relatively modest. Nevertheless, the task of encoding such assumptions within automated theorem provers is a non-trivial task, and a direction for future work.

References

  1. Vernon Asuncion, Yin Chen, Yan Zhang & Yi Zhou (2015): Ordered completion for logic programs with aggregates. Artificial Intelligence 224, pp. 72-102, doi:https://doi.org/10.1016/j.artint.2015.03.007.
  2. Michael Bartholomew, Joohyung Lee & Yunsong Meng (2011): First-Order Semantics of Aggregates in Answer Set Programming Via Modified Circumscription. In: E. Davis, P. Doherty & E. Erdem: Proceedings of the AAAI Spring Symposium on Logical Formalizations of Commonsense Reasoning. AAAI Press, pp. 16–22.
  3. Pedro Cabalar, Jorge Fandinno, Luis Farinas Del Cerro & David Pearce (2018): Functional ASP with Intensional Sets: Application to Gelfond-Zhang Aggregates. Theory and Practice of Logic Programming 18(3-4), pp. 390-405, doi:10.1017/S1471068418000169.
  4. Jorge Fandinno, Vladimir Lifschitz, Patrick Luhne & Torsten Schaub (2020): Verifying Tight Logic Programs with Anthem and Vampire. Theory and Practice of Logic Programming 20(5), pp. 735-750, doi:10.1017/S1471068420000344.
  5. Paolo Ferraris, Joohyung Lee & Vladimir Lifschitz (2011): Stable models and circumscription. Artificial Intelligence 175(1), pp. 236-263, doi:10.1016/j.artint.2010.04.011.
  6. Michael Gelfond & Yuanlin Zhang (2019): Vicious circle principle, aggregates, and formation of sets in ASP based languages. Artificial Intelligence 275, pp. 28-77, doi:https://doi.org/10.1016/j.artint.2019.04.004.
  7. Joohyung Lee, Vladimir Lifschitz & Ravi Palla (2008): A Reductive Semantics for Counting and Choice in Answer Set Programming. In: D. Fox & C. Gomes: Proceedings of the Twenty-third National Conference on Artificial Intelligence (AAAI'08). AAAI Press, pp. 472–479.
  8. Vladimir Lifschitz (2022): Strong Equivalence of Logic Programs with Counting. Theory and Practice of Logic Programming 22(4), pp. 573-588, doi:10.1017/S1471068422000278.

Visual Sensemaking Needs Both Vision and Semantics: On Logic-Based Declarative Neurosymbolism for Reasoning about Space and Motion

Jakob Suchan (DLR, Germany)
Mehul Bhatt (Örebro University, Sweden - CoDesign Lab EU)
Srikrishna Varadarajan (CoDesign Lab EU, Europe)

Contemporary artificial vision systems lack abilities for high-level, human-scale mental simulation, e.g., concerning perceived everyday multimodal interactions. Cognitively driven sensemaking functions such as embodied grounding for active vision, visuospatial concept formation, commonsense explanation, diagnostic introspection all remain fertile ground. We posit that developing high-level visual sensemaking capabilities requires a systematic, tight yet modular integration of (neural) visual processing techniques with high-level commonsense knowledge representation and reasoning methods pertaining to space, motion, actions, events, conceptual knowledge etc. As an exemplar of this thinking, we position recent work on deeply semantic, explainable, neurosymbolic visuospatial reasoning driven by an integration of methods in (deep learning based) vision and (KR based) semantics. The positioned work is general, but its significance is demonstrated and empirically benchmarked in the context of (active, realtime) visual sensemaking for self-driving vehicles.

Visual Sensemaking: A Human-Centred Cognitive Perspective

Artificial visual intelligence [5] denotes the computational capability to semantically process, interpret, and explain diverse forms of visual stimuli (typically) emanating from sensing embodied multimodal interaction of/amongst humans and other artefacts in diverse naturalistic situations of everyday life and profession. Through semantic processing, interpretation, and explanation, alluded here are a wide-spectrum of high-level human-centred sensemaking capabilities. These capabilities encompass functions such as visuospatial conception formation, commonsense/qualitative generalisation, hypothetical reasoning, analogical inference, argumentation, event based episodic maintenance & retrieval for perceptual narrativisation, counterfactual reasoning and explanation etc. In essence, in scope are all high-level commonsense visuospatial sensemaking capabilities —be it mundane, analytical, or creative in nature— that humans acquire developmentally or through specialised training, and are routinely adept at performing seamlessly in their everyday life and work.

The Need for Integrated "Vision and Semantics".      Computational visual sensemaking requires a systematically developed general and modular integration of high-level techniques concerned with "commonsense and semantics" with low-level neural methods capable of computing primitive features of interest in visual data. Realising computational visual sensemaking —be it realtime or post-hoc— in view of human-centred AI concerns pertaining to explainability, ethics, regulation and requires a systematic (neurosymbolic) integration of Vision and Semantics, i.e., robust commonsense representation & inference about spacetime dynamics on the one hand, and powerful low-level visual computing capabilities, e.g., pertaining to object detection and tracking on the other. It is also critical that the semantics of formal representations, e.g., of space and motion, be rooted to counterparts in natural language [4]. Towards this, the positioned research [11] demonstrates the significance of semantically-driven methods rooted in knowledge representation and reasoning (KR) in addressing research questions pertaining to explainability and human-centred AI particularly from the viewpoint of (perceptual) sensemaking of dynamic visual imagery. This goal is pursued within the larger agenda of cognitive vision and perception [5], which is an emerging line of research bringing together a novel & unique combination of methodologies from Artificial Intelligence, Vision and Machine Learning, Cognitive Science and Psychology, Visual Perception, and Spatial Cognition and Computation (also, [11, 12,10, 9], and [7]). Research in cognitive vision and perception addresses visual, visuospatial and visuo-locomotive perception and interaction from the viewpoints of language, logic, spatial cognition and artificial intelligence [4].

 

Application Scenarios
Figure 1: Application Scenarios: Autonomous Systems, Minds and Media Studies, Behavioural Research in Multimodality Interaction [5].

 

Visuospatial Commonsense, Driven by Answer Set Programming

Answer Set Programming (ASP) is now widely used as a foundational declarative language and robust methodology for a range of (non-monotonic) knowledge representation and reasoning tasks [6, 8]. With ASP as a foundation, and motivated by requirements of semantics, commonsense and explainability, our work bridges the gap between high-level formalisms for logical visual reasoning (e.g., by abduction) and low-level visual processing1. by tightly integrating semantic abstractions of space and motion with their underlying numerical representations within the declarative framework of ASP. Furthermore, directly within ASP, we also address several challenges concerning epistemological and phenomenological aspects relevant to a wide range of dynamic spatial systems [3, 2, 1]: projection and interpolation, object identity maintenance at a semantic level, ability to make default assumptions, maintaining consistent beliefs etc.

Although the work positioned herein [11, 10] selectively focusses on the needs and challenges of active / online sensemaking in autonomous driving, the generality and modularly of the developed ASP-based neurosymbolic framework ensures foundational applicability in diverse applied contexts requiring perceptual interpretation, interaction and control functions. Of at least equal importance are the modularity and elaboration tolerance of the framework, enabling seamless integration and experimentation with advances in (fast evolving) computer vision methods, as well as experimenting with different forms of formal methods for (declarative) reasoning about space, actions, and change [1].


1 Visual processing encompasses capabilities including but not limited to motion analysis, object detection, pose estimation, semantic segmentation, image classification. A detailed review is available in [5].

 

References

  1. Mehul Bhatt (2012): Reasoning about Space, Actions and Change: A Paradigm for Applications of Spatial Reasoning. In: Qualitative Spatial Representation and Reasoning: Trends and Future Directions, IGI Global, USA} doi:10.4018/978-1-4666-4607-0.ch016.
  2. Mehul Bhatt, Hans W. Guesgen, Stefan Wölfl & Shyamanta M. Hazarika (2011): Qualitative Spatial and Temporal Reasoning: Emerging Applications, Trends, and Directions. Spatial Cognition & Computation 11(1), pp. 1--14, doi:10.1080/13875868.2010.548568.
  3. Mehul Bhatt & Seng W. Loke (2008): Modelling Dynamic Spatial Systems in the Situation Calculus. Spatial Cognition & Computation 8(1-2), pp. 86--130, doi:10.1080/13875860801926884.
  4. Mehul Bhatt, Carl Schultz & Christian Freksa (2012): The `Space' in Spatial Assistance Systems: Conception, Formalisation and Computation. In Thora Tenbrink, Jan Wiener & Christophe Claramunt, editors: Representing space in cognition: Interrelations of behavior, language, and formal models. Series: Explorations in Language and Space, Oxford University Press, doi:10.1093/acprof:oso/9780199679911.003.0009.
  5. Mehul Bhatt & Jakob Suchan (2023): Artificial Visual Intelligence: Perceptual Commonsense for Human-Centred Cognitive Technologies, pp. 216--242. Springer International Publishing, Cham, doi:10.1007/978-3-031-24349-3_12.
  6. Gerhard Brewka, Thomas Eiter & Miroslaw Truszczyński (2011): Answer Set Programming at a Glance. Commun. ACM 54(12), pp. 92--103, doi:10.1145/2043174.2043195.
  7. David Marr(1982): Vision: A Computational Investigation into the Human Representation and Processing of Visual Information. Henry Holt and Co., Inc., New York, NY, USA. (Republished 2010, MIT Press, doi: 10.7551/mitpress/9780262514620.001.0001.
  8. Torsten Schaub & Stefan Woltran (2018): Special Issue on Answer Set Programming. KI 32(2-3), pp. 101--103, doi: 10.1007/s13218-018-0554-8.
  9. Jakob Suchan & Mehul Bhatt (2016): Semantic Question-Answering with Video and Eye-Tracking Data: AI Foundations for Human Visual Perception Driven Cognitive Film Studies. In Subbarao Kambhampati, editor: Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, IJCAI/AAAI Press, pp. 2633--2639. doi: http://www.ijcai.org/Abstract/16/374.
  10. Jakob Suchan, Mehul Bhatt & Srikrishna Varadarajan (2019): Out of Sight But Not Out of Mind: An Answer Set Programming Based Online Abduction Framework for Visual Sensemaking in Autonomous Driving. In Sarit Kraus, editor: Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, ijcai.org, pp. 1879--1885, doi: 10.24963/ijcai.2019/260.
  11. Jakob Suchan, Mehul Bhatt & Srikrishna Varadarajan(2021): Commonsense visual sensemaking for autonomous driving - On generalised neurosymbolic online abduction integrating vision and semantics. Artif. Intell. 299, p. 103522, doi: 10.1016/j.artint.2021.103522.
  12. Jakob Suchan, Mehul Bhatt, Przemyslaw Andrzej Walega & Carl Schultz (2018): Visual Explanation by High-Level Abduction: On Answer-Set Programming Driven Reasoning About Moving Objects. In Sheila A. McIlraith & Kilian Q. Weinberger, editors: Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, AAAI Press, pp. 1965--1972, doi: 10.1609/aaai.v32i1.11569.

Flexible Job-shop Scheduling for Semiconductor Manufacturing with Hybrid Answer Set Programming (Extended Abstract)

Ramsha Ali (University of Klagenfurt)
Mohammed M. S. El-Kholany (University of Klagenfurt, Cairo University)
Martin Gebser (University of Klagenfurt, Graz University of Technology)

Modern semiconductor manufacturing involves complex production processes with hundreds of operations from lot release to completion, which often takes several months. In contrast to abstract job-shop scheduling benchmarks, our work addresses the scheduling of realistic semiconductor manufacturing processes. We model their sophisticated requirements by hybrid Answer Set Programming and take advantage of difference logic for expressing machine processing, setup, and maintenance times. Unlike existing approaches that schedule semiconductor manufacturing processes locally by greedy heuristics or isolated optimization of specific machine groups, we explore the potential and limits of large-scale semiconductor fab scheduling.

Introduction

Classical and Flexible Job-shop Scheduling Problems (FJSPs) [17,6], focusing on the allocation of production tasks and resource planning, have been targeted bibliographystyle various local and exact search methods (see [7] for an overview). The importance of optimization in production and supply chain management has grown due to diversified technologies, product customization, quality-of-service targets, and ecological footprint. However, abstract scheduling benchmarks do not adequately represent the complex production processes found in semiconductor manufacturing, facing long production routes, product-specific machine setups, dedicated maintenance procedures, and stochastic factors. These challenges have led to the development of the recent SMT2020 simulation scenario [14], modeling modern semiconductor manufacturing processes and facilities. Currently, production management is performed locally using preconfigured dispatching rules [12] or machine-learned decision making policies [19]. Exact search and optimization frameworks like Constraint, Integer and Answer Set Programming (ASP) [15] at least in principle enable global approaches to resource allocation and operation scheduling that take the entire range of viable schedules into account and guarantee optimality to the extent feasible. For instance, ASP has been successfully applied for scheduling printing devices [4], specialist teams [16], work shifts [2], course timetables [5], medical treatments [8], and aircraft routes [18]. In particular, the hybrid framework of ASP modulo difference logic [13] specifically supports a compact representation and reasoning with quantitative resources like time, which has been exploited in domains such as lab resource [10], train connection [1], and classical job-shop [9] scheduling.

In our work [3], we use ASP modulo difference logic to model the scheduling of semiconductor manufacturing processes, particularly accounting for machine processing, setup, and maintenance times present in the SMT2020 scenario. Although long-term, global optimization of production routes with hundreds of operations is prohibitive due to problem size and unpredictable stochastic factors, we lay the ground for a future integration of more informed exact scheduling techniques with simulation and reactive decision making methods, enabling globally optimized (re)scheduling for a certain time in advance.

Application Scenario

The recent SMT2020 simulation scenario specifies two kinds of semiconductor fab settings, one denoted High-Volume/Low-Mix (HV/LM) with two types of products and the other Low-Volume/High-Mix (LV/HM) with ten kinds of products. Both have in common that, depending on the product type, the production route of each lot includes many operations, i.e., between 300 and 600 of them. Each operation needs some machine in a given tool group to be performed, which may have to be equipped with a product-specific setup before processing the operation. Moreover, periodic maintenance procedures must be applied after a certain number of operations or accumulating some amount of processing time. The overall objective is to minimize the completion time of lots by making effective use of fab resources.

We represent problem instances in terms of specific facts along with a general ASP modulo difference logic encoding. Our problem encoding supports two assignment strategies: fully flexible or fixed, the latter based on the lexicographic order of operations requiring machines in the same tool group. Setup times and maintenance procedures are also taken into account in scheduling the processing of operations.

Experimental Evaluation and Conclusion

We extracted test instances for scheduling from the STM2020 scenario by considering a part of the available tool groups along with their setups and maintenances. Our comparison includes the fixed and flexible machine assignment strategies, for which Table 1 reports the obtained makespan, solving time, conflicts and constraints, where `TO' stands for more than 600 seconds solving time of clingo[DL] [13].

With the fixed machine assignment, we observe that the transition from trivial runs taking less than a second to aborts is sharp when increasing the number of operations, as the number of search conflicts goes up. A similar behavior is encountered even earlier, i.e., on smaller instances, with the flexible machine assignment, where the up to one order of magnitude greater number of constraints also yields a significantly increased problem size. Our hybrid ASP encoding for semiconductor fab scheduling reflects work in progress. As future work, we target the improvement of space and search efficiency, addition of yet missing capabilities like batch processing and operation pipelining, and integration with simulation.

Table 1: Results for scheduling instances with fixed and flexible machine assignment
Fixed Machine Assignment Flexible Machine Assignment
OxM Makespan Time Conflicts Constraints Makespan Time Conflicts Constraints
10x2 120 <1 44 2249 120 <1 44 2258
15x3 169 <1 7910 8980 169 <1 16562 12916
20x3 224 TO 6091128 23751 204 TO 5869538 33682
20x4 120 <1 88 4569 105 15 162085 45364
25x4 171 <1 16303 15862 160 TO 2656812 89214
30x4 219 405 2626786 32872 227 TO 2868459 157258
30x5 191 93 1027764 26460 169 TO 2702824 159548
30x6 120 <1 128 6828 153 TO 2250537 158243
35x6 142 <1 925 11526 123 TO 2947938 181867
40x6 192 18 189240 30657 210 TO 1711929 387488
45x6 226 TO 3553153 49191 300 TO 1226970 554625

Acknowledgments

This work, providing an extended abstract of our PADL 2023 paper [3], was partially funded by FFG project 894072 (SwarmIn) as well as KWF project 28472, cms electronics GmbH, FunderMax GmbH, Hirsch Armbänder GmbH, incubed IT GmbH, Infineon Technologies Austria AG, Isovolta AG, Kostwein Holding GmbH, and Privatstiftung Kärntner Sparkasse.

References

  1. D. Abels, J. Jordi, M. Ostrowski, T. Schaub, A. Toletti & P. Wanko (2021): Train scheduling with hybrid answer set programming. TPLP 21(3), pp. 317–347, doi:10.1017/S1471068420000046.
  2. M. Abseher, M. Gebser, N. Musliu, T. Schaub & S. Woltran (2016): Shift design with answer set programming. Fundam. Informaticae 147(1), pp. 1–25, doi:10.3233/FI-2016-1396.
  3. R. Ali, M. M. S. El-Kholany & M. Gebser (2023): Flexible job-shop scheduling for semiconductor manufacturing with hybrid answer set programming (application paper). In: PADL. Springer, pp. 85–95, doi:10.1007/978-3-031-24841-2_6.
  4. M. Balduccini (2011): Industrial-size scheduling with ASP+CP. In: LPNMR. Springer, pp. 284–296, doi:10.1007/978-3-642-20895-9_33.
  5. M. Banbara, K. Inoue, B. Kaufmann, T. Okimoto, T. Schaub, T. Soh, N. Tamura & P. Wanko (2019): teaspoon: Solving the curriculum-based course timetabling problems with answer set programming. Ann. Oper. Res. 275(1), pp. 3–37, doi:10.1007/s10479-018-2757-7.
  6. P. Brucker & R. Schlie (1990): Job-shop scheduling with multi-purpose machines. Computing 45(4), pp. 369–375, doi:10.1007/BF02238804.
  7. I. A. Chaudhry & A. A. Khan (2016): A research survey: Review of flexible job shop scheduling techniques. ITOR 23(3), pp. 551–591, doi:10.1111/itor.12199.
  8. C. Dodaro, G. Galatà, A. Grioni, M. Maratea, M. Mochi & I. Porro (2021): An ASP-based solution to the chemotherapy treatment scheduling problem. TPLP 21(6), pp. 835–851, doi:10.1017/S1471068421000363.
  9. M. M. S. El-Kholany, M. Gebser & K. Schekotihin (2022): Problem decomposition and multi-shot ASP solving for job-shop scheduling. TPLP 22(4), pp. 623–639, doi:10.1017/S1471068422000217.
  10. G. Francescutto, K. Schekotihin & M. M. S. El-Kholany (2021): Solving a multi-resource partial-ordering flexible variant of the job-shop scheduling problem with hybrid ASP. In: JELIA. Springer, pp. 313–328, doi:10.1007/978-3-030-75775-5_21.
  11. M. Gebser, R. Kaminski, B. Kaufmann, M. Lindauer, M. Ostrowski, J. Romero, T. Schaub, S. Thiele & P. Wanko (2019): Potassco user guide. https://potassco.org.
  12. O. Holthaus & C. Rajendran (1997): Efficient dispatching rules for scheduling in a job shop. Int. J. Production Economics 48(1), pp. 87–105, doi:10.1016/S0925-5273(96)00068-0.
  13. T. Janhunen, R. Kaminski, M. Ostrowski, S. Schellhorn, P. Wanko & T. Schaub (2017): Clingo goes linear constraints over reals and integers. TPLP 17(5-6), pp. 872–888, doi:10.1017/S1471068417000242.
  14. D. Kopp, M. Hassoun, A. Kalir & L. Mönch (2020): SMT2020—A semiconductor manufacturing testbed. T-SCM 33(4), pp. 522–531, doi:10.1109/TSM.2020.3001933.
  15. V. Lifschitz (2019): Answer set programming. Springer, doi:10.1007/978-3-030-24658-7.
  16. F. Ricca, G. Grasso, M. Alviano, M. Manna, V. Lio, S. Iiritano & N. Leone (2012): Team-building with answer set programming in the Gioia-Tauro seaport. TPLP 12(3), pp. 361–381, doi:10.1017/S147106841100007X.
  17. E. Taillard (1993): Benchmarks for basic scheduling problems. Eur. J. Oper. Res. 64(2), pp. 278–285, doi:10.1016/0377-2217(93)90182-M.
  18. P. Tassel & M. Rbaia (2021): A multi-shot ASP encoding for the aircraft routing and maintenance planning problem. In: JELIA. Springer, pp. 442–457, doi:10.1007/978-3-030-75775-5_30.
  19. B. Waschneck, A. Reichstaller, L. Belzner, T. Altenmüller, T. Bauernhansl, A. Knapp & A. Kyek (2018): Optimization of global production scheduling with deep reinforcement learning. Procedia CIRP 72, pp. 1264–1269, doi:10.1016/j.procir.2018.03.212.

Body-Decoupled Grounding via Solving: A Novel Approach on the ASP Bottleneck (Extended Abstract)

Viktor Besin (TU Wien)
Markus Hecher (Massachusetts Institute of Technology)
Stefan Woltran (TU Wien)

This is an extended abstract of [1] that appeared at IJCAI’22. Research was funded by Vienna Science and Technology Fund (WWTF) grant ICT19-065 and Austrian Science Fund (FWF) grants J 4656 and P 32830.

Answer-Set Programming (ASP) has seen tremendous progress over the last two decades and is nowadays successfully applied in many real-world domains. However, for certain problems, the well-known ASP grounding bottleneck still causes severe problems. This becomes virulent when grounding of rules, where the variables have to be replaced by constants, leads to a ground program that is too huge to be processed by the ASP solver. In this work, we tackle this problem by a novel method that decouples non-ground atoms in rules in order to delegate the evaluation of rule bodies to the solving process. Our procedure translates a non-ground normal program into a ground disjunctive program that is exponential only in the maximum predicate arity, and thus polynomial if this arity is bounded by a constant. We demonstrate the feasibility of this new method experimentally by comparing it to standard ASP technology in terms of grounding size, grounding time and runtime.

1 Body-Decoupled Grounding

Motivated by the ASP [36], the problem of traditional grounding systems resulting in exponentially large programs when instantiating non-ground rules (even for programs with bounded predicate arities), we briefly tease the concept of body-decoupled grounding. The idea of this approach is to reduce the grounding size and grounding time by decoupling dependencies between different predicates of rule bodies. The potential of this is motivated by the following example.

Example 1. Assume the following non-ground program Π that decides in (1) for each edge (e) of a given graph, whether to pick it (pp). Then, in (2) it is ensured that the choice of edges does not form triangles.
p(A,B)p(A,B) e(A,B) (1)
p(X,Y),p(Y,Z),p(X,Z),XY,YZ,XZ. (2)

The typical grounding effort of (2) is in O(|dom (Π )|3). Our approach grounds body predicates of (2) individually, yielding groundings that are linear in the size of the ground atoms. In our example, this corresponds to O(|dom (Π )|2) due to arity 2.

[254], we introduce a reduction-based translation from non-ground, tight (and normal) programs to ground, disjunctive programs, resulting in an alternative grounding procedure. Our encodings translate a non-ground rule by (i) guessing whether the head atom is part of the answer set, (ii) ensuring satisfiabilty of the rule and (iii) preventing unfoundedness of the guessed head atom. To lift this idea to normal programs, one can rely on encoding (iv) orderings. Since every step of the procedure instantiates at most one body predicate at a time, we intuitively deploy body-decoupling, which keeps the grounding size polynomial when assuming bounded predicate arity. Notably, our results imply that body-decoupled grounding blends-in well with existing approaches, enabling us to interleave different grounding approaches.

2 Experimental Results

We implemented a software tool, called newground (The system including supplemental material is available at https://github.com/viktorbesin/newground), realizing body-decoupled grounding via search as described above. The system newground is written in Python3 and uses, among others, the API of clingo 5.5 and its ability to efficiently parse logic programs via syntax trees. In our implementation, we opted for partial reducability, allowing users to select program parts that shall be reduced and those being (traditionally) grounded, thereby internally relying on gringo.

PIC PIC

Figure 1: Grounding profile of S1 for gringo (left) and newground (right). The x-axis refers to the instance size; the y-axis indicates density. Circles mark instances grounded < 1800s; the left (right) half depicts grounding time (size), respectively. Mind the different color scales (e.g., 10000MB vs. 1600MB).

PIC PIC

Figure 2: (Left): Scatter plot of grounding size over Scenarios S1–S4 of newground (x-axis) compared to both gringo (blue) and idlv (green) on the y-axis. Those instances that could be solved are highlighted in orange. (Right): Cactus plot of overall (grounding and solving) time over Scenarios S1-S4.

In order to evaluate newground, we design a series of benchmarks. Clearly, we cannot beat highly optimized grounders in all imaginable scenarios. Instead, we discuss potential use cases, where body-decoupled grounding is preferrable, since this approach can be incorporated into every grounder. We consider these (directed) graph scenarios: (S1) 3-coloring, (S2) reachable paths, (S3) cliques, (S4) non-partition-removal colorings [8] and (S5) stable marriages (ASP comp. 2014), and compared to gringo and idlv while measuring grounding size, grounding time as well as overall time.

From our experiments we crafted grounding profiles for each tool. Figure 1 depicts the grounding profile of S1 for gringo (left) and newground (right), showing grounding times and sizes, depending on the instance size (x-axis) and density (y-axis). Interestingly, for newground grounding times and sizes for a fixed instance size (column) of Figure 1 (right) are quite similar, which is in contrast to Figure 1 (left), suggesting that compared to gringo, newground is not that sensitive to instance density.

In terms of pure grounding time, our experiments show that newground in fact outperforms in four of five scenarios. Interestingly, while doing so, newground also massively reduces the grounding size (cf., Figure 2 (left), almost all dots above diagonal), while keeping instances solvable where gringo and idlv output groundings beyond 30GB. For the overall (solving) performance we refer to Figure 2 (right). While newground performs best, we still see a clear difference between solving and grounding performance, which reveals that only a small amount of those grounded instances can then actually be solved by [1].

3 Conclusion

This work introduces a grounding-approach based on a reduction suggesting the body-decoupling of grounding-intense ASP rules. The reduction translates tight (normal) non-ground rules into disjunctive ground rules, thereby being exponential only in the maximum predicate arity. While our evaluation shows that body-decoupled grounding applied on crucial (tight) program parts reduces grounding size compared to state-of-the-art exact grounders, we are currently working on evaluating and tuning of an implementation for normal programs [7].

References

   Viktor Besin, Markus Hecher & Stefan Woltran (2022): Body-Decoupled Grounding via Solving: A Novel Approach on the ASP Bottleneck. In: IJCAI’22, ijcai.org, pp. 2546–2552. Available at https://doi.org/10.24963/ijcai.2022/353.

   Nicole Bidoít & Christine Froidevaux (1991): Negation by default and unstratifiable logic programs. Theoretical Computer Science 78(1), pp. 85–112, doi:10.H.B1016/H.B0304-3975(51)90004-7H.B.

   Bernardo Cuteri, Carmine Dodaro, Francesco Ricca & Peter Schüller (2020): Overcoming the Grounding Bottleneck Due to Constraints in ASP Solving: Constraints Become Propagators. In: IJCAI, ijcai.org, pp. 1688–1694.

   Thomas Eiter, Wolfgang Faber, Michael Fink & Stefan Woltran (2007): Complexity results for answer set programming with bounded predicate arities and implications. Annals of Mathematics and Artificial Intelligence 51(2-4), pp. 123–165.

   Wiktor Marek & Mirosław Truszczyński (1991): Autoepistemic logic. Journal of the ACM 38(3), pp. 588–619, doi:10.H.B1145/H.B116825.H.B116836H.B.

   Efthymia Tsamoura, Víctor Gutiérrez-Basulto & Angelika Kimmig (2020): Beyond the Grounding Bottleneck: Datalog Techniques for Inference in Probabilistic Logic Programs. In: AAAI’20, AAAI Press, pp. 10284–10291.

   Kaan Unalan (2022): Body-Decoupled Grounding in Normal Answer Set Programs. Bachelor’s Thesis, TU Wien, Austria.

   Antonius Weinzierl, Richard Taupe & Gerhard Friedrich (2020): Advancing Lazy-Grounding ASP Solving Techniques - Restarts, Phase Saving, Heuristics, and More. Theory Pract. Log. Program. 20(5), pp. 609–624.


Tackling the DM Challenges with cDMN: A Tight Integration of DMN and Constraint Reasoning (Extended Abstract)

Simon Vandevelde (DTAI KU Leuven)
Bram Aerts (DTAI KU Leuven)
Joost Vennekens (DTAI KU Leuven)

This extended abstract summarizes work published in Theory and Practice of Logic Programming [5].

Introduction

The Decision Model and Notation (DMN) [4] standard, maintained by the Object Management Group, allows to represent data and decision logic in an intuitive, table-based way. It is meant to be used directly by business experts, and as such, aims to be user-friendly and low in complexity. Decisions in DMN are modelled in decision tables, which contain the in-depth business logic of the model. As an example, Fig 1 shows a table to decide a patient's BMI Level. The meaning of such a decision table is straightforward: the value of the output variable (right, in light blue) is defined by the value of the input variable(s) (left, in green). Each row of the table corresponds to a decision rule. We say that a rule fires whenever the actual value of the input variables match the values listed in its cells. The way in which the inputs define the output depends on the hit policy, denoted in the top-left corner. In the example, the U(nique) hit policy denotes that the rules may not overlap.

Example of decision table

cDMN: Extending DMN with constraints

While DMN allows modellers to elegantly represent a deterministic decision process, it lacks the ability to specify constraints on the solution space. To address this, we present "Constraint Decision Model and Notation" (cDMN), an extension of DMN with constraints. It also allows for representations that are independent of domain size by supporting types, functions, relations and quantifications. Importantly, it does so in a way that retains the ease of use for domain experts.

To illustrate cDMN, we will now briefly go over each type of table, and illustrate them using the graph colouring example in Fig.2.

Glossary

In logical terms, the "variables" of standard DMN correspond to constants (i.e., 0-ary functions). cDMN extends these by adding n-ary functions and predicates. Modellers must declare their vocabulary by means of a glossary, which consists of at most five glossary tables: Type, Function, Relation, Boolean and Constant.

Logic in cDMN is typed: modellers must define types in the Type table together with a set of domain elements. For example, the types Country and Colour respectively represent the domain of countries and colours. In the Function table, symbols can be declared as functions of one or more types to another. All types that appear in the description are interpreted as arguments, and the remainder constitutes the name of the function itself. As such, colour of Country in our example corresponds to colour_of: Country -> Colour. In a similar manner, we can declare n-ary predicates in the Relation table, such as Country borders Country. This predicate corresponds to the 2-ary predicate borders: Country * Country -> Bool. The last two glossary tables are used to introduce boolean symbols (i.e., propositions) and constants, and are not demonstrated in the example.

Decision tables and constraint tables

Where DMN decision tables must precisely define a symbol, our constraint tables do not have this property. Instead, each row of the table expresses a logical implication: if the conditions on the inputs are satisfied, the condition on the output must hold as well. We introduce a new hit policy, denoted as "E*" (Every), because it expresses that every implication must be satisfied.

cDMN also extends the expressions that are allowed in the column headers. Columns of the form "Type called var" introduce a universally quantified variable var over the domain of Type. Each subsequent column may use this variable in the header or the cells. In this way, we introduce universal quantification in decision and constraint tables. To illustrate, the constraint table in the example introduces two variables, c1 and c2, both of type Country. It can be read as: "For every country c1 and c2, it must hold that if the two countries border, they do not have the same colour". The table corresponds to the following FO formula:

!c1, c2[Country] : border(c1,c2) => colour_of(c1) ~= colour_of(c2).

Data tables

Typically, problems can be split up into two parts: (1) the general logic of the problem, and (2) the specific problem instance to solve. In the map colouring example, the general logic consists of the constraint that two bordering countries cannot share a colour, whereas the instance of the problem is the specific map (e.g., Western Europe) to colour. cDMN extends DMN with data tables, which are used to represent the problem instances, separating them from the general logic. In terms of classical logic, a data table corresponds to the interpretation of a symbol.

Goal table

A standard DMN model defines a deterministic decision procedure. In cDMN, this is no longer the case: cDMN models instead have a solution space. By including a goal table, modellers can state what the specification is to be used for: generating x solutions, generating the solution with an optimal value for a variable, or deriving the consequences.

Example of a cDMN model for the map colouring problem

cDMN models can be executed using the cDMN solver [1]. It translates the model to First Order Logic, and then runs the IDP-Z3 reasoning engine [3] to generate solutions.

Results

We evaluated cDMN by implementing DM Community challenges [2], which are challenges set forth by the decision management community to test the boundaries of DMN. Of the 24 challenges we considered, cDMN could model 22, whereas state-of-the-art DMN engines could model 12. We find that our models are more robust to domain changes due to the introduction of types, quantification and data tables. Moreover, cDMN implementations are typically more concise, and do not need to rely on unconventional workarounds (as is the case in some of the DMN implementations). We feel that these benefits make cDMN models more readable and maintainable compared to the other solutions due to its increased expressiveness.

References

  1. cDMN documentation. http://www.cdmn.be.
  2. DMCommunity Challenge. https://dmcommunity.org/challenge/.
  3. Pierre Carbonnelle, Simon Vandevelde, Joost Vennekens & Marc Denecker (2023): Interactive Configurator with FO(.) and IDP-Z3. ArXiv:2202.00343.
  4. Object Management Group (2021-02, 2021): Decision Model and Notation v1.3.
  5. Simon Vandevelde, Bram Aerts & Joost Vennekens (2021): Tackling the DM Challenges with cDMN: A Tight Integration of DMN and Constraint Reasoning. Theory and Practice of Logic Programming, pp. 1–24, doi:10.1017/S1471068421000491.

FOLL-E: Teaching First Order Logic to Children (Extended Abstract)

Simon Vandevelde (DTAI KU Leuven)
Joost Vennekens (DTAI KU Leuven)

This abstract summarizes work presented at the Thirteenth AAAI Symposium on Educational Advances in Artificial Intelligence [6]

Introduction

First-order logic (FO) is an important foundation of many domains, such as mathematics, philosophy, computer science and artificial intelligence. Currently, there is a growing interest in teaching computer science concepts and computational thinking to children, such as through Scratch [5], Blockly [3] or CS Unplugged [1]. One topic which appears to be curiously understudied, however, is that of teaching of FO. Indeed, FO is not only important in CS and AI, but learning FO can also help children in a variety of other disciplines by sharpening their reasoning skills. While Kowalski and colleagues already saw the potential of teaching Prolog in 1980 [4], not many tools or applications have been published for teaching any form of logic since then. This is due to a number of issues that may make teaching FO difficult: (1) logic has a steep learning curve, (2) it does not "do" anything, and (3) it is not fun due to the lack of graphics, animations and sounds. In our work, we overcome these objections by designing an appropriate learning environment. The focus of this environment is twofold: a child-friendly representation for FO, combined with a fun and engaging task to solve.

Goals and Approach

Representation of FO:

The traditional way of writing logic is hard for children to understand. Our goal is therefore to introduce an alternative notation that meets four goals: (G1) avoid discouraging children with finicky syntax, (G2) make the structure of formulas clear, (G3) encourage experimentation, and (G4) encourage collaboration.

To meet these goals, we designed a block-based representation for FO, inspired by languages such as Scratch and Blockly. It was designed according to a pegs-and-slots approach, in which blocks physically fit together if the connection is syntactically correct and the formulas are correctly typed. This representation, of which an example is shown in Fig. 1, effectively eliminates syntax errors (G1), and provides a clear overview of the structure of the formulas (G2).

Blocks expressing "All blocks are red"
Laser-cut blocks (Engraving in Dutch)
Block-based notation for FO

Instead of implementing these blocks in a GUI, we laser cut physical blocks out of 3mm plywood, engraved with their intended meaning and, when possible, a relevant icon (Fig. 3). Blocks representing a colour were also painted in that colour. In this way, the bocks are low on text, with much visual stimulation. This results in a tactile, playful and almost puzzle-like experience, which stimulates experimentation (G3) and encourages experimentation between children (G4).

Task to solve:

Our system asks children to construct formulas in order to solve certain tasks. In designing these tasks, we focus on teaching the models-relation (R1). In addition, we also aim to: (R2) provide clear and immediate feedback, (R3) offer a gradual increase in difficulty, and (R4) make learning fun and engaging.

As an application domain, we have chosen the design of simple robots, as shown on the monitor in Fig. 4. A robot consists of six body parts, called components, which can be individually coloured in one of three colours. Additionally, a robot may also wear a hard hat. In the application, children are shown three "good" robots and three "bad" robots, and must devise a rule that distinguishes between them. In other words, they must create a formula for which the three good robots are models and the three bad ones are not (R1).

By puzzling together blocks, the children can express sentences of increasing difficulty, such as "The left leg is blue", "If the robot wears a helmet, it has a green body" and "Every component that is a limb must be coloured green" (R3). A Raspberry Pi mini-computer continually scans the playing area, and, as soon as it detects a complete sentence, will run the IDP-Z3 reasoning system [2] to verify which robots satisfy the formula, which is shown visually on the screen. FOLL-E is "always live": in this way, it gives immediate feedback (R2). Moreover, the feedback is entirely visual, which makes the application more intuitive, enticing and engaging (R4).

Photos taken at a FOLL-E workshop

Results

As a preliminary evaluation, we tested FOLL-E in workshops aimed at 8-13 year old children. During the workshop, the children are given a 5 minute introduction on FOLL-E, after which they are free to play through the levels in pairs. All students were able to complete all ten levels, but the time required varied with age: children near the upper age limit (13) finished about 15 minutes ahead of the others.

The children reported that in general (a) they enjoyed their time with FOLL-E, (b) found the puzzle-like nature inviting and (c) liked the assignment. One of the older children remarked "It's satisfying to puzzle the pieces together and see the result, especially if it's correct."

In future work, we will be teaming up with cognitive psychology researchers to measure the effectiveness of the tool. Furthermore, we will be looking at what changes can be made to make the tool more effective, such as introducing more levels, experimenting with applications besides robot design, and adding automated error explanation.

References

  1. Tim Bell & Jan Vahrenhold (2018): CS UnpluggedHow Is It Used, and Does It Work?. In: Hans-Joachim Böckenhauer, Dennis Komm & Walter Unger: Adventures Between Lower Bounds and Higher Altitudes: Essays Dedicated to Juraj Hromkovič on the Occasion of His 60th Birthday. Springer International Publishing, Cham, pp. 497–521, doi:10.1007/978-3-319-98355-4_29.
  2. Pierre Carbonnelle, Simon Vandevelde, Joost Vennekens & Marc Denecker (2023): Interactive Configurator with FO(.) and IDP-Z3. ArXiv:2202.00343.
  3. Neil Fraser (2015): Ten Things We've Learned from Blockly. In: 2015 IEEE Blocks and beyond Workshop (Blocks and Beyond), pp. 49–50, doi:10.1109/BLOCKS.2015.7369000.
  4. Robert A Kowalski (1982): Logic as a Computer Language for Children. In: ECAI, pp. 2–10.
  5. Mitchel Resnick, John Maloney, Andrés Monroy-Hernández, Natalie Rusk, Evelyn Eastmond, Karen Brennan, Amon Millner, Eric Rosenbaum, Jay Silver, Brian Silverman & Yasmin Kafai (2009): Scratch: Programming for All. Communications of The Acm 52(11), pp. 60–67, doi:10.1145/1592761.1592779.
  6. Simon Vandevelde & Joost Vennekens (2023): FOLL-E: Teaching First Order Logic to Children. In: Proceedings of the Thirteenth AAAI Symposium on Educational Advances in Artificial Intelligence, Washington, USA.

Learning to Break Symmetries for Efficient Optimization in Answer Set Programming (Extended Abstract)

Alice Tarzariol (University of Klagenfurt)
Martin Gebser (University of Klagenfurt and Graz University of Technology)
Konstantin Schekotihin (University of Klagenfurt )
Mark Law (ILASP Limited)

Abstract

The ability to efficiently solve hard combinatorial optimization problems is a key prerequisite to various applications of declarative programming paradigms. Symmetries in solution candidates pose a significant challenge to modern optimization algorithms since the enumeration of such candidates might substantially reduce their optimization performance. The full version of this paper proposes a novel approach using Inductive Logic Programming (ILP) to lift symmetry-breaking constraints for optimization problems modeled in Answer Set Programming (ASP). Given an ASP encoding with optimization statements and a set of representative instances, our method augments ground ASP programs with auxiliary normal rules enabling the identification of symmetries by existing tools, like sbass. Then, the obtained symmetries are lifted to first-order constraints with ILP. We show the correctness of our method and evaluate it on optimization problems from the domain of automated configuration. Our experiments show significant improvements of optimization performance due to the learned first-order constraints. The full version of this paper was presented at AAAI 2023.

Introduction

Combinatorial optimization problems appear in various practical applications, including transportation, manufacturing, healthcare, or power generation and distribution. An efficient and elegant approach to tackle these problems is to model them in a declarative programming paradigm such as Answer Set Programming (ASP) [6]. However, finding optimal solutions to the vast majority of real-world problems is challenging since their search spaces include many symmetric solution candidates, i.e., an isomorphic candidate can be obtained by permuting elements of a known solution. To be effective, the problem encoding must thus include Symmetry-Breaking Constraints (SBCs) that prune the search space of solution candidates by removing symmetric ones. Hence, several techniques to automatically identify and discard redundant solutions have been designed in the recent decades [7,8,13], based on embedding symmetry breaking in search algorithms or adding SBCs to a given problem encoding or instance, respectively.

In the context of ASP, the system sbass [5] was designed to provide an instance-specific approach to symmetry breaking. To this end, sbass identifies symmetries of a ground ASP program by (i) representing the input program as a colored graph, (ii) finding symmetric vertex permutations in the graph using saucy [1,3], and (iii) constructing ground SBCs from the permutations. In previous work [9], we introduced an approach that learns first-order constraints by lifting ground SBCs of sbass by means of Inductive Logic Programming (ILP) [2]. Our method applies sbass to a set of representative problem instances and then uses the obtained permutations to define an ILP task. The subsequent learning phase determines first-order constraints that remove symmetric solutions (classified as negative examples) while preserving the representative solutions (positive examples).

The main shortcoming of previously introduced methods [10,12] to learn constraints from SBCs of ASP programs is their inability to deal with optimization statements. That is, if a suboptimal solution happens to be lexicographically smallest and is taken as representative to discard symmetric solutions, the learned constraints might eliminate (all) optimal solutions from the search space.

Example 1 Let us consider the (ground) ASP program $P_1$:
1 {a;b;c} 1.
:~ a. [3]
:~ b. [2]
:~ c. [3]

The choice rule in the first line gives rise to three answer sets: $\mathit{AS}(P_1)$ = {{a}, {b}, {c}}. Three weak constraints in the second line attribute the weight $3$ to answer sets including a or c, and $2$ to the answer set comprising b, so that the optimal answer set is {b}. When sbass is run to analyze $P_1$, i.e., the choice rule in the first line, it classifies the answer sets in $\mathit{AS}(P_1)$ as symmetric. Thus, applying the previous approach [12] yields the lexicographically smallest answer set {a} as representative solution to preserve, while {b} and {c} are considered redundant. As a consequence, the framework will learn some constraint(s), e.g., :- not a., eliminating the optimal answer set {b} with the smallest weight $2$.

Contributions

In our AAAI 2023 paper [11], we extend the learning approaches of [10,12] to optimization problems and make the following contributions:

Conclusion

Our AAAI 2023 paper extends the previous framework [9,10,12] to support the learning of effective first-order constraints for optimization problems. The introduced auxiliary rules are crucial for sbass to identify symmetries applicable to ASP programs with optimization statements. We have shown the correctness of this approach and devised suitable methods to generate ILP tasks for optimization problems. Experiments with the new framework on optimization versions of the combinatorial problems addressed in [10,12] as well as on the fastfood problem [4] show that the learned constraints can help to significantly speed up the computation of (representative) optimal solutions. The implementation, benchmarks as well as settings for reproducing our experiments can be found at https://github.com/prosysscience/Symmetry_Breaking_with_ILP/tree/optimization.

Acknowledgment

This work was funded by KWF project 28472, cms electronics GmbH, FunderMax GmbH, Hirsch Armbänder GmbH, incubed IT GmbH, Infineon Technologies Austria AG, Isovolta AG, Kostwein Holding GmbH, and Privatstiftung Kärntner Sparkasse.

References

  1. P. Codenotti, H. Katebi, K. Sakallah & I. Markov (2013): Conflict Analysis and Branching Heuristics in the Search for Graph Automorphisms. In: IEEE 25th International Conference on Tools with Artificial Intelligence. IEEE Computer Society, pp. 907–914, doi:10.1109/ICTAI.2013.139.
  2. A. Cropper, S. Dumančić & S. Muggleton (2020): Turning 30: New ideas in Inductive Logic Programming. In: International Joint Conference on Artificial Intelligence. ijcai.org, pp. 4833–4839, doi:10.24963/ijcai.2020/673.
  3. P. Darga, H. Katebi, M. Liffiton, I. Markov & K. Sakallah (2004): Saucy. http://vlsicad.eecs.umich.edu/BK/SAUCY/. Accessed: 2021-05-21.
  4. M. Denecker, J. Vennekens, S. Bond, M. Gebser & M. Truszczyński (2009): The Second Answer Set Programming Competition. In: E. Erdem, F. Lin & T. Schaub: Proceedings of the Tenth International Conference on Logic Programming and Nonmonotonic Reasoning (LPNMR'09), Lecture Notes in Artificial Intelligence 5753. Springer, pp. 637–654, doi:10.1007/978-3-642-04238-6_75.
  5. C. Drescher, O. Tifrea & T. Walsh (2011): Symmetry-breaking answer set solving. AI Communications 24(2), pp. 177–194, doi:10.3233/AIC-2011-0495.
  6. V. Lifschitz (2019): Answer Set Programming. Springer, doi:10.1007/978-3-030-24658-7.
  7. F. Margot (2010): Symmetry in integer linear programming. In: 50 Years of Integer Programming 1958-2008. Springer, pp. 647–686, doi:10.1007/978-3-540-68279-0_17.
  8. K. Sakallah (2009): Symmetry and Satisfiability. In: A. Biere, M. Heule, H. van Maaren & T. Walsh: Handbook of Satisfiability, chapter 10, Frontiers in Artificial Intelligence and Applications 185. IOS Press, pp. 289–338, doi:10.3233/978-1-58603-929-5-289.
  9. A. Tarzariol, M. Gebser & K. Schekotihin (2021): Lifting Symmetry Breaking Constraints with Inductive Logic Programming. In: International Joint Conference on Artificial Intelligence. ijcai.org, pp. 2062–2068, doi:10.24963/ijcai.2021/284.
  10. A. Tarzariol, M. Gebser & K. Schekotihin (2022): Lifting Symmetry Breaking Constraints with Inductive Logic Programming. Machine Learning 111(4), pp. 1303 – 1326, doi:10.1007/s10994-022-06146-3.
  11. A. Tarzariol, M. Gebser, K. Schekotihin & M. Law (2023): Learning to Break Symmetries for Efficient Optimization in Answer Set Programming. In: Proceedings of the Thirty-seventh National Conference on Artificial Intelligence (AAAI'23). AAAI Press. To appear.
  12. A. Tarzariol, K. Schekotihin, M. Gebser & M. Law (2022): Efficient Lifting of Symmetry Breaking Constraints for Complex Combinatorial Problems. Theory and Practice of Logic Programming, doi:10.1017/S1471068422000151.
  13. T. Walsh (2012): Symmetry breaking constraints: Recent results. In: 26th AAAI Conference on Artificial Intelligence. AAAI Press, pp. 2192–2198, doi:10.1609/aaai.v26i1.8437.