Published: 19th September 2020 DOI: 10.4204/EPTCS.325 ISSN: 2075-2180

# Proceedings 36th International Conference onLogic Programming (Technical Communications) UNICAL, Rende (CS), Italy, 18-24th September 2020

Edited by: Francesco Ricca, Alessandra Russo, Sergio Greco, Nicola Leone, Alexander Artikis, Gerhard Friedrich, Paul Fodor, Angelika Kimmig, Francesca Lisi, Marco Maratea, Alessandra Mileo and Fabrizio Riguzzi

 Preface Francesco Ricca, Alessandra Russo, Sergio Greco, Nicola Leone, Alexander Artikis, Gerhard Friedrich, Paul Fodor, Angelika Kimmig, Francesca Lisi, Marco Maratea, Alessandra Mileo and Fabrizio Riguzzi Invited talks (Main Conference) Applications of Answer Set Programming where Theory meets Practice Esra Erdem 1 When Is It Morally Acceptable to Break the Rules? A Preference-Based Approach Francesca Rossi 2 Formal Reasoning Methods for Explainability in Machine Learning Joao Marquez-Silva 3 From Probabilistic Logics to Neuro-Symbolic Artificial Intelligence Luc De Readt 4 Invited talk (Women in Logic Prorgramming Track) Norms, Policy and Laws: Modelling, Compliance and Violation Marina De Vos 5 Panel in Machine Ethics (Invited Paper) Logic Programming and Machine Ethics Abeer Dyoub, Stefania Costantini and Francesca A. Lisi 6 Main Track Datalog-Based Systems Can Use Incremental SMT Solving (Extended Abstract) Aaron Bembenek, Michael Ballantyne, Michael Greenberg and Nada Amin 18 Splitting a Hybrid ASP Program Alex Brik 21 Formal Semantics and Scalability for Datalog with Aggregates: A Cardinality-Based Solution (Extended Abstract) Carlo Zaniolo, Ariyam Das, Youfu Li, Mingda Li and Jin Wang 35 Variant-based Equational Unification under Constructor Symbols Damián Aparicio-Sánchez, Santiago Escobar and Julia Sapiña 38 Solving Gossip Problems using Answer Set Programming: An Epistemic Planning Approach Esra Erdem and Andreas Herzig 52 Justifications for Goal-Directed Constraint Answer Set Programming Joaquín Arias, Manuel Carro, Zhuo Chen and Gopal Gupta 59 SQuARE: Semantics-based Question Answering and Reasoning Engine Kinjal Basu, Sarat Chandra Varanasi, Farhad Shakerin and Gopal Gupta 73 A Logic Programming Approach to Regression Based Repair of Incorrect Initial Belief States (Extended Abstract) Loc Pham, Enrico Pontelli, Fabio Tardivo and Tran Cao Son 87 A Hybrid Neuro-Symbolic Approach for Complex Event Processing (Extended Abstract) Marc Roig Vilamala, Harrison Taylor, Tianwei Xing, Luis Garcia, Mani Srivastava, Lance Kaplan, Alun Preece, Angelika Kimming and Federico Cerutti 90 Data validation for Answer Set Programming (Extended Abstract) Mario Alviano and Carmine Dodaro 93 Automated Aggregator - Rewriting with the Counting Aggregate Michael Dingess and Miroslaw Truszczynski 96 Deriving Theorems in Implicational Linear Logic, Declaratively Paul Tarau and Valeria de Paiva 110 A System for Explainable Answer Set Programming Pedro Cabalar, Jorge Fandinno and Brais Muñiz 124 Tabling Optimization for Contextual Abduction Ridhwan Dewoprabowo and Ari Saptawijaya 137 Burden of Persuasion in Argumentation Roberta Calegari and Giovanni Sartor 151 Continuous Reasoning for Managing Next-Gen Distributed Applications Stefano Forti and Antonio Brogi 164 Sequent-Type Calculi for Systems of Nonmonotonic Paraconsistent Logics Tobias Geibinger and Hans Tompits 178 Enhancing Linear Algebraic Computation of Logic Programs Using Sparse Representation Tuan Nguyen Quoc, Katsumi Inoue and Chiaki Sakama 192 LP2PB: Translating Answer Set Programs into Pseudo-Boolean Theories Wolf De Wulf and Bart Bogaerts 206 Recursive Rules with Aggregation: A Simple Unified Semantics (Extended Abstract) Yanhong A. Liu and Scott D. Stoller 220 Applications Track Dynamic Multi-Agent Path Finding based on Conflict Resolution using Answer Set Programming Basem Atiq, Volkan Patoglu and Esra Erdem 223 An application of Answer Set Programming in Distributed Architectures: ASP Microservices Stefania Costantini and Lorenzo De Lauretis 230 Less Manual Work for Safety Engineers: Towards an Automated Safety Reasoning with Safety Patterns Yuri Gil Dantas, Antoaneta Kondeva and Vivek Nigam 244 Women in Logic Programming Track Modeling Bitcoin Lightning Network by Logic Programming (Extended Abstract) Damiano Azzolini, Elena Bellodi, Alessandro Brancaleoni, Fabrizio Riguzzi and Evelina Lamma 258 A Machine Learning guided Rewriting Approach for ASP Logic Programs Elena Mastria, Jessica Zangari, Simona Perri and Francesco Calimeri 261 Logical Judges Challenge Human Judges on the Strange Case of B.C.-Valjean Viviana Mascardi and Domenico Pellegrini 268 Sister Conferences and Journal Presentation Track Accountable Protocols in Abductive Logic Programming (Extended Abstract) Marco Gavanelli, Marco Alberti and Evelina Lamma 276 Sampling-Based SAT/ASP Multi-Model Optimization as a Framework for Probabilistic Inference (Extended Abstract) Matthias Nickles 278 Report: Datalog with Recursive Aggregation for Incremental Program Analyses (Extended Abstract) Tamás Szabó, Gabór Bergmann, Sebastian Erdweg and Markus Voelter 280 Knowledge of Uncertain Worlds: Programming with Logical Constraints (Extended Abstract) Yanhong A. Liu and Scott D. Stoller 282 A Simple Extension of Answer Set Programs to Embrace Neural Networks (Extended Abstract) Zhun Yang, Adam Ishay and Joohyung Lee 284 Doctoral Consortium Constraint Programming Algorithms for Route Planning Exploiting Geometrical Information Alessandro Bertagnon 286 Research Summary on Implementing Functional Patterns by Synthesizing Inverse Functions Finn Teegen 296 A Low-Level Index for Distributed Logic Programming Thomas Prokosch 303 Extending Answer Set Programs with Neural Networks Zhun Yang 313

# Preface

This volume contains the Technical Communications and the Doctoral Consortium papers of the 36th International Conference on Logic Programming (ICLP 2020), held virtually in Rende (CS), Italy, from September 20th to 25th, 2020. This is the first time that ICLP is run remotely together with all co-located events due to the COVID pandemic.

Since the first conference held in Marseille in 1982, ICLP has been the premier international event for presenting research in logic programming. The scope of the conference covers all areas of logic programming including, but not restricted to:

Foundations:
Semantics, Formalisms, Answer-Set Programming, Non-monotonic Reasoning, Knowledge Representation.
Declarative Programming:
Inference engines, Analysis, Type and mode inference, Partial evaluation, Abstract interpretation, Transformation, Validation, Verification, Debugging, Profiling, Testing, Logic-based domain-specific languages, constraint handling rules.
Inductive and Co-inductive Logic Programming, Constraint Logic Programming, Interaction with SAT, SMT and CSP solvers, Logic programming techniques for type inference and theorem proving, Argumentation, Probabilistic Logic Programming, Relations to object-oriented and Functional programming, Description logics, Neural-Symbolic Machine Learning, Hybrid Deep Learning and Symbolic Reasoning.
Implementation:
Concurrency and distribution, Objects, Coordination, Mobility, Virtual machines, Compilation, Higher Order, Type systems, Modules, Constraint handling rules, Meta-programming, Foreign interfaces, User interfaces.
Applications:
Databases, Big Data, Data Integration and Federation, Software Engineering, Natural Language Processing, Web and Semantic Web, Agents, Artificial Intelligence, Bioinformatics, Education, Computational life sciences, Education, Cybersecurity, and Robotics.

Besides the main track, ICLP 2020 included the following additional tracks and special sessions:

Applications Track: This track invites submissions of papers on emerging and deployed applications of LP, describing all aspects of the development, deployment, and evaluation of logic programming systems to solve real-world problems, including interesting case studies and benchmarks, and discussing lessons learned.

Sister Conferences and Journal Presentation Track: This track provides a forum to discuss important results related to logic programming that appeared recently (from January 2018 onwards) in selective journals and conferences but have not been previously presented at ICLP.

Research Challenges in Logic Programming Track: This track invites submissions of papers describing research challenges that an individual researcher or a research group is currently attacking. The goal of the track is to promote discussions, exchange of ideas, and possibly stimulate new collaborations. Papers submitted to this track do not go through the usual review and will not be published in the proceedings they will be distributed at the conference as a technical report.

Special Session. Women in Logic Programming: This track aims to increase the visibility and impact of women in LP. It invites submissions of papers in all areas of logic programming co-authored by at least one woman and includes invited talks and presentations by women in logic programming.

The organizers of ICLP 2020 were:

General Chairs
• Sergio Greco, University of Calabria, Italy
• Nicola Leone, University of Calabria, Italy
Program Chairs
• Francesco Ricca, University of Calabria, Italy
• Alessandra Russo, Imperial College London, UK
Organizing Chairs
• Marco Calautti, University of Calabria, Italy
• Carmine Dodaro, University of Calabria, Italy
Publicity Chair
• Laura Pandolfo, Universitá degli Studi di Sassari, Italy
Applications Track Chairs
• Alexander Artikis, University of Piraeus & NCSR Demokritos, Greece
• Angelika Kimmig, Cardiff University, UK
Research Challenges in Logic Programming Track Chairs
• Gerhard Friedrich, Universität Klagenfurt, Austria
• Fabrizio Riguzzi, Universitá di Ferrara, Italy
Sister Conferences and Journal Presentation Track Chairs
• Paul Fodor, Stony Brook University, USA
• Marco Maratea, University of Genova, Italy
Women in Logic Programming Special Session Chairs
• Francesca Alessandra Lisi, University of Bari Aldo Moro, Italy
• Alessandra Mileo, INSIGHT Centre for Data Analytics, Dublin City University, Irland
Workshops Chair
• Martin Gebser, University of Potsdam, Germany
Doctoral Consortium Chairs
• Daniela Inclezan, Miami University, USA
• Bart Bogaerts, Vrije Universiteit Brussel, Belgium
Programming Competition Chairs
• Jessica Zangari, University of Calabria, Italy
• Markus Hecher, Vienna University of Technology, Austria

Three kinds of submissions were accepted:

• Technical papers for technically sound, innovative ideas that can advance the state of logic programming;
• Application papers that impact interesting application domains;
• System and tool papers which emphasize novelty, practicality, usability, and availability of the systems and tools described.

ICLP implemented the hybrid publication model used in all recent editions of the conference, with journal papers and Technical Communications (TCs), following a decision made in 2010 by the Association for Logic Programming. Papers of the highest quality were selected to be published as rapid publications in this special issue of TPLP. The TCs comprise papers which the Program Committee (PC) judged of good quality but not yet of the standard required to be accepted and published in TPLP as well as extended abstracts from the different tracks and dissertation project descriptions stemming from the Doctoral Program (DP) held with ICLP.

We have received 88 submissions of abstracts, of which 77 resulted in paper submissions, distributed as follows: ICLP main track (53), Applications track (7 full papers and 1 short papers), Sister Conferences and Journal Presentation track (6), Women in Logic Programming session (5 full papers and 3 short papers) and Research Challenge Track (2 short papers). The Program Chairs organized the refereeing process, which was undertaken by the PC with the support of external reviewers. Each technical paper was reviewed by at least three referees who provided detailed written evaluations. This yielded submissions short-listed as candidates for rapid communication. The authors of these papers revised their submissions in light of the reviewers suggestions, and all these papers were subject to a second round of reviewing. Of these candidates papers, 27 were accepted as rapid communications, to appear in the special issue. In addition, the PC recommended 40 papers to be accepted as technical communications, to appear at Electronic Proceedings in Theoretical Computer Science (EPTCS) either as full papers or extended abstracts, of which 38 were also presented at the conference (2 were withdrawn).

We are deeply indebted to the Program Committee members and external reviewers, as the conference would not have been possible without their dedicated, enthusiastic and outstanding work. The Program Committee members of ICLP 2020 were:

 Mario Alviano Michael Gelfond Ricardo Rocha Nicos Angelopoulos Laura Giordano Chiaki Sakama Marcello Balduccini Gopal Gupta Torsten Schaub Mutsunori Banbara Michael Hanus Konstantin Schekotihin Chitta Baral Manuel V. Hermenegildo Tom Schrijvers Roman Barták Katsumi Inoue Guillermo R. Simari Christoph Benzmüller Tomi Janhunen Tran Cao Son Alex Brik Jianmin Ji Mohan Sridharan François Bry Nikos Katzouris Theresa Swift Pedro Cabalar Michael Kifer Paul Tarau Francesco Calimeri Zeynep Kiziltan Hans Tompits Manuel Carro Ekaterina Komendantskaya Francesca Toni Angelos Charalambidis Evelina Lamma Irina Trubitsyna Michael Codish Michael Leuschel Mirek Truszczynski Stefania Costantini Vladimir Lifschitz German Vidal Marc Denecker Francesca Alessandra Lisi Alicia Villanueva Martín Diéguez Yanhong A. Liu David Warren Carmine Dodaro Marco Maratea Jan Wielemaker Agostino Dovier Viviana Mascardi Stefan Woltran Thomas Eiter Yunsong Meng Jia-Huai You Wolfgang Faber Emilia Oikarinen Shiqi Zhang Thom Fruehwirth Magdalena Ortiz Neng-Fa Zhou Marco Gavanelli Simona Perri Martin Gebser Enrico Pontelli

The Program Committee members of the Applications track were:

 Nicos Angelopoulos Gopal Gupta Mohan Sridharan Chitta Baral Jianmin Ji Paul Tarau Alex Brik Nikos Katzouris David Warren François Bry Zeynep Kiziltan Jan Wielemaker Francesco Calimeri Marco Maratea Shiqi Zhang Angelos Charalambidis Yunsong Meng Neng-Fa Zhou Martín Diéguez Konstantin Schekotihin Martin Gebser Tom Schrijvers

The external reviewers were:

 Gianvincenzo Alfano Rafael Kiesel Francesco Parisi Elena Bellodi Vladimir Komendantskiy Sascha Rechenberger Pierre Carbonnelle François Laferriere Javier Romero Matthew Castellana Pedro Lopez-Garcia Elmer Salazar Wolfgang Dvořák Julio Mariño Mantas Simkus Serdar Erbatur Elena Mastria Takehide Soh Francesco Fabiano Djordje Markovich Fabio Tardivo Jorge Fandinno Simon Marynissen Yi Tong Andrea Formisano Jose F. Morales David Tuckey David Fuenmayor Johannes Oetsch Sarat Chandra Varanasi Tobias Geibinger

The 16th Doctoral Consortium (DC) on Logic Programming was held in conjunction with ICLP 2020. It attracts Ph.D. students in the area of Logic Programming Languages from different backgrounds (e.g. theoretical, implementation, application) and encourages a constructive and fruitful advising. Topics included: theoretical foundations of logic and constraint logic programming, sequential and parallel implementation technologies, static and dynamic analysis, abstract interpretation, compilation technology, verification, logic-based paradigms (e.g., answer set programming, concurrent logic programming, inductive logic programming) and innovative applications of logic programming. This year the Doctoral Consortium accepted 4 papers in the areas described above. We warmly thank all student authors, supervisors, referees, co-chairs, members of the program committee and the organizing team that made the Doctoral Consortium greatly successful.

The DC Program Committee members were:

 Carmine Dodaro Martin Gebser Jorge Fandinno Jose F. Moralesr Fabio Fioravanti Zeynep G. Saribatur Paul Fodor Frank Valencia

We would also like to express our gratitude to the full ICLP 2020 organization committee. Our gratitude must be extended to Torsten Schaub as current President and Thomas Eiter as incoming President of the Association of Logic Programming (ALP), to Marco Gavanelli in the role of conference-coordinator for ALP, to all the members of the ALP Executive Committee and to Mirek Truszczynski, Editor-in-Chief of TPLP. Also, to the staff at Cambridge University Press for their assistance. We would also like to thank Rob van Glabbeek, Editor-in-Chief of EPTCS, for helping the Program Chairs with their prompt support. Finally, we wish to thank each author of every submitted paper, since their efforts keep the conference alive and the participants to ICLP for bringing and sharing their ideas and latest developments. This is particularly appreciated in this 36th edition of the conference which has run during the unprecedented time of the COVID pandemic.

 Francesco Ricca, Alessandra Russo, Sergio Greco, Nicola Leone, Alexander Artikis, Angelika Kimmig, Gerhard Friedrich, Fabrizio Riguzzi, Paul Fodor, Marco Maratea, Francesca Alessandra Lisi, Alessandra Mileo (Eds.)

# Applications of Answer Set Programming where Theory meets Practice

Esra Erdem (Sabanci University, Turkey)

We have been investigating applications of Answer Set Programming (ASP) in various domains, ranging from historical linguistics and bioinformatics to economics and robotics. In these applications, theory meets practice around challenging computational problems, and they all start a journey towards benefiting science and life. ASP plays an important role in this journey, sometimes as a declarative programming paradigm to solve hard combinatorial search problems (e.g., phylogeny reconstruction for Indo-European languages, multi-agent path finding in autonomous warehouses, matching problems in economics), and sometimes as a knowledge representation paradigm to allow deep reasoning and inferences over incomplete heterogeneous knowledge and beliefs of agents (e.g., hybrid planning for robotic manipulation, diagnostic reasoning in cognitive factories, explanation generation for biomedical queries). In this talk, we will share our experiences from such different applications of ASP, and discuss its role and usefulness from different perspectives.

# When Is It Morally Acceptable to Break the Rules? A Preference-Based Approach

Francesca Rossi (IBM Research, T.J. Watson Research Center, USA)

Humans make moral judgements about their own actions and the actions of others. Sometimes they make these judgements by following a utilitarian approach, other times they follow simple deontological rules, and yet at other times they find (or simulate) an agreement among the relevant parties. To build machines that behave similarly to humans, or that can work effectively with humans, we must understand how humans make moral judgements. This includes when to use a specific moral approach and how to appropriately switch among the various approaches. We investigate how, why, and when humans decide to break some rules. We study a suite of hypothetical scenarios that describes a person who might break a well established norm and/or rule, and asked human participants to provide a moral judgement of this action.
In order to effectively embed moral reasoning capabilities into a machine we model the human moral judgments made in these experiments via a generalization of CP-nets, a common preference formalism in computer science. We describe what is needed to both model the scenarios and the moral decisions, which requires an extension of existing computational models. We discuss how this leads to future research directions in the areas of preference reasoning, planning, and value alignment.

# Formal Reasoning Methods for Explainability in Machine Learning

Joao Marquez-Silva (ANITI, University of Toulouse, France)

The forecasted success of machine learning (ML) hinges on systems that are robust in their operation and that can be trusted. This talk overviews recent efforts on applying automated reasoning tools in explaining non-interpretable (black-box) ML models, for assessing heuristic explanations, but also for learning interpretable ML models. Concretely, the talk overviews existing approaches for producing rigorous explanations of black-box models, and assesses the quality of widely used heuristic approaches for computing explanations. In addition, the talk discusses properties of rigorous explanations. Finally, the talk briefly overviews ongoing work on learning interpretable ML models.

# From Probabilistic Logics to Neuro-Symbolic Artificial Intelligence

Luc De Readt (KU Leuven, Belgium)

A central challenge to contemporary AI is to integrate learning and reasoning. The integration of learning and reasoning has been studied for decades already in the fields of statistical relational artificial intelligence and probabilistic programming. StarAI has focussed on unifying logic and probability, the two key frameworks for reasoning, and has extended this probabilistic logics machine learning principles. I will argue that StarAI and Probabilistic Logics form an ideal basis for developing neuro-symbolic artificial intelligence techniques. Thus neuro-symbolic computation = StarAI + Neural Networks. Many parallels will be drawn between these two fields and will be illustrated using the Deep Probabilistic Logic Programming language DeepProbLog.

# Norms, Policy and Laws: Modelling, Compliance and Violation

Marina De Vos (University of Bath, United Kingdom)

Norms, policy and laws all focus on describing desired behaviour of actors, whether they are humans, agents or processes. The actual behaviour of the actor can then be checked against this and compliance or violation potentially respectively rewarded or penalised. This talk explores the use of answer set programming in modelling the modelling, verification and compliance of these norms, policy and laws, both at the modelling stage but also in a running system. We demonstrate how this technology can be used to detect inconsistencies between sets of norms/policies/norms and how they could possibly be resolved

# Datalog-Based Systems Can Use Incremental SMT Solving (Extended Abstract)

Aaron Bembenek (Harvard University Cambridge, MA USA)
Michael Ballantyne (Northeastern University Boston, MA USA)
Michael Greenberg (Pomona College Claremont, CA USA)
Nada Amin (Harvard University Cambridge, MA USA)

### Introduction

Satisfiability modulo theories (SMT) solving is a powerful tool. However, any client of an SMT solver faces the challenge of using the solver efficiently. In particular, modern SMT solvers support incremental solving, so there is often an advantage to asking queries in an order that lets the solver reuse work from earlier queries when answering new ones. Thus, clients are incentivized to pose queries in a way that has good "solver locality" and is amenable to effective incremental solving.

Because they are both used for automated reasoning tasks, there is a natural appeal to augmenting logic programming systems with the capabilities of SMT solving. One such hybrid system, Formulog [3], does this by extending Datalog with terms that represent SMT formulas and an interface to an external SMT solver. However, the notion of "solver locality" raises a potential problem for Formulog and other logic programming systems that embrace Kowalski's principle [8] of separating the logic of a computation from its control: The programmer cannot easily control the order of computations, and the language runtime might perform them in an order that has low solver locality.

For example, consider using Formulog to explore simple paths in a directed graph whose edges are labeled with SMT propositions. A path is explored only if the conjunction of its edge labels is satisfiable. This computation would have clearly good solver locality if it consecutively checked the satisfiability of similar paths (e.g., paths with a large common prefix); such a result might be achieved by using a sequential depth-first search (DFS) of the graph, starting at each node in turn. However, the same is not obviously the case for Formulog: because of its parallelized bottom-up evaluation algorithm, it effectively performs a breadth-first search of the graph starting from each node of the graph in parallel. Thus, paths discovered around the same time might not share a very large common prefix; in fact, they might be completely disjoint! Given the lack of obvious solver locality, it is not clear if this Formulog program should expect any advantage from incremental SMT solving.

We show empirically that, even in this setting, incremental SMT solving can in fact speed up logic programs that make SMT queries. We do so by evaluating the effectiveness of two lightweight encoding mechanisms that mediate between Formulog and an external SMT solver. The mechanisms use different capabilities defined in the SMT-LIB standard [2]: the first explicitly manages a solver's assertion stack, while the second checks satisfiability under retractable assumptions. The latter strategy consistently leads to speedups over a non-incremental baseline across a variety of benchmarks involving different SMT solvers and SMT-LIB logics, suggesting that logic programming systems can indeed take advantage of incremental, black-box SMT solving.

### Making incremental SMT calls

A Formulog user builds complex terms representing SMT formulas and reasons about them with built-in operators like is_sat and get_model. When an SMT operator is invoked, the Formulog runtime takes the SMT query, serializes it into the SMT-LIB format, ships it off to an external solver, and returns the result. The serialization code takes a list of conjuncts as input; its job is to assert these conjuncts to the SMT solver in a way that leads to efficient solving. We evaluate three different strategies for SMT clients: a baseline non-incremental strategy and two incremental strategies.

First, some background: SMT-LIB-compatible solvers maintain a stack of assertion frames. Frames can be pushed on and popped off the stack using the commands push and pop. When a frame is popped, the solver's state is reset to the state it had before that frame was added, forgetting any assertions made since the corresponding push command along with any consequences derived from those assertions.

Our baseline, non-incremental strategy clears the solver's assertion state between every satisfiability check: When it serializes an SMT query, it generates code that pushes a fresh frame on the stack, asserts each conjunct, checks for satisfiability, and then pops the frame it added.

Our second strategy (PP) explicitly pushes and pops the solver's stack to enable incremental solving. When serializing a query, PP pops off frames until the solver's assertion stack is a prefix of the current list of conjuncts, pushes assertions for each of the remaining conjuncts of the query, and then checks for satisfiability. PP provides incremental solving when adjacent queries share large common prefixes. PP works well for clients who explore a constraint space using DFS (since the stack disciplines match up), but penalizes clients who use search techniques that align less well with using a stack (breadth-first search, heuristic searches, etc.).

Our final strategy (CSA) uses the check-sat-assuming SMT-LIB command, which checks the satisfiability of the solver's assertion state assuming particular truth values for some given boolean variables. CSA uses a layer of indirection to treat the solver's assertion state as a cache of assertions that can be enabled or disabled for a particular query [6]: instead of asserting a conjunct $\phi$ directly, CSA asserts the implication $x \implies \phi$, where $x$ is a fresh boolean variable. To check the satisfiability of a query including $\phi$, we include $x$ in the list of literals provided to the check-sat-assuming command. Formulog's CSA client maintains a map from conjuncts to boolean variables to keep track of which variables should be enabled for a particular query and to ensure that no conjunct is ever asserted more than once.

SMT clients using CSA need not manage an explicit stack of assertions; there is no penalty for exploring the constraint space in a way that does not align well with using a stack. Intuitively, CSA should be a boon for logic programming systems like Formulog that do not use a DFS-based search.

### Results

We empirically evaluated two hypotheses: (H1) Formulog should be able to take advantage of incremental SMT solving; i.e., either PP or CSA should outperform the non-incremental baseline strategy on most benchmarks; (H2) CSA should deliver more consistent and more substantial speedups than PP. To evaluate these hypotheses, we tested the relative performance of the three strategies on three Formulog programs given a variety of inputs.

The first program performs symbolic execution [7] over a simple imperative language. We ran the tool on six different input programs. We tried the solvers Z3 (v4.8.8) [9], CVC4 (v1.7) [1], and Boolector (v3.2.1) [10] (all set to use the logic QF_ABV). In all 18 cases, the baseline was bested by an incremental strategy (H1); CSA achieved the best speedup in 12 of these cases (H2).

The second program type checks programs written in Dminor [4], a language with refinement types that are encoded as SMT formulas. We ran the type checker on three input programs, using the solver Z3 with the logic ALL. CSA had the best improvement over the baseline in all three cases (H1, H2).

The third program computes reachability on graphs with edges labeled by propositions; a path is feasible only if the conjunction of the propositions along that path is satisfiable. We computed reachability on 24 random graphs in various bit vector and linear integer arithmetic (LIA) logics. We used the solvers Z3, CVC4, and Yices (v2.6.2) [5], and additionally Boolector for the graphs with bit vector formulas. The incremental strategies were better than the baseline on 60 of 84 experiments (H1), and CSA had the best improvement in 59 cases (H2). Of the cases where there was no gain by using incremental solving, 14 were clustered in the experiments with logics combining LIA and arrays.

Overall, out of 105 experiments, either PP or CSA beat the non-incremental baseline in 81 cases (H1✓). CSA provided a speedup in 79 cases, compared to 39 for PP; there were only two cases where PP provided a speedup and CSA did not, and only five where both strategies led to speedups but PP was faster than CSA (H2✓). Thus, our evaluation confirms our hypotheses: CSA is an effective, lightweight mechanism for integrating a logic programming system with an incremental SMT solver.

### Acknowledgments

This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Contract No. FA8750-19-C-0004. Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the Defense Advanced Research Projects Agency (DARPA). We thank Arlen Cox for his perspective on incremental SMT solving and his pointers on the origins of checking satisfiability with assumptions. William E. Byrd also provided valuable feedback and guidance.

### References

1. Clark Barrett, Christopher L. Conway, Morgan Deters, Liana Hadarean, Dejan Jovanović, Tim King, Andrew Reynolds & Cesare Tinelli (2011): CVC4. In: Proc. 23rd Int. Conf. on Computer Aided Verification, pp. 171–177, doi:10.1007/978-3-642-22110-1_14.
2. Clark Barrett, Pascal Fontaine & Cesare Tinelli (2016): The Satisfiability Modulo Theories Library (SMT-LIB). www.SMT-LIB.org.
3. Aaron Bembenek, Michael Greenberg & Stephen Chong (2020): Formulog: Datalog for SMT-Based Static Analysis. In submission.
4. Gavin M. Bierman, Andrew D. Gordon, Cătălin Hriţcu & David Langworthy (2012): Semantic Subtyping with an SMT Solver. Journal of Functional Programming 22(1), pp. 31–105, doi:10.1017/S0956796812000032.
5. Bruno Dutertre (2014): Yices 2.2. In: Proc. 26th Int. Conf. on Computer Aided Verification, pp. 737–744, doi:10.1007/978-3-319-08867-9_49.
6. Niklas Eén & Niklas Sörensson (2003): Temporal induction by incremental SAT solving. Electronic Notes in Theoretical Computer Science 89(4), pp. 543–560, doi:10.1016/S1571-0661(05)82542-3.
7. James C. King (1976): Symbolic Execution and Program Testing. Commun. ACM 19(7), pp. 385–394, doi:10.1145/360248.360252.
8. Robert Kowalski (1979): Algorithm = Logic + Control. Commun. ACM 22(7), pp. 424–436, doi:10.1145/359131.359136.
9. Leonardo de Moura & Nikolaj Bjørner (2008): Z3: An Efficient SMT Solver. In: Proc. 14th Int. Conf. on Tools and Algs. for the Construction and Analysis of Systems, pp. 337–340, doi:10.1007/978-3-540-78800-3_24.
10. Aina Niemetz, Mathias Preiner & Armin Biere (2014 (published 2015)): Boolector 2.0 System Description. Journal on Satisfiability, Boolean Modeling and Computation 9, pp. 53–58, doi:10.3233/SAT190101.

# Formal Semantics and Scalability for Datalog with Aggregates: A Cardinality-Based Solution (Extended Abstract)

Carlo Zaniolo (University of California)
Ariyam Das (University of California)
Youfu Li (University of California)
Mingda Li (University of California)
Jin Wang (University of California)

A growing body of recent research is showing that the use of aggregates in recursive Datalog programs allows a concise declarative formulation for algorithms that support with superior performance and scalability a wide range of Big Data applications, including graph and ML applications [2, 3, 4, 5, 6,7]. Yet the full deployment of this potentially disruptive logic programming technology requires a formal semantics which is simple enough to be used with confidence by everyday programmers in writing their applications. To address this need, we propose a cardinality-based approach that; identify the class of programs that use the count aggregate in recursion; and combine (i) Stable-Model (SM)semantics with (ii) very efficient; operational semantics that is also conducive to scalability via parallelization.

On objective (i) we seek to provide criteria and techniques which allow users to; prove that their programs have a Stable Model semantics,without having to rely on the formal definition of this semantics. However, for certain programs, their SM semantics is not conducive to an efficient and scalable implementation. We provide a simple criterion to identify programs along; with some hints on how to re-express such applications by program that is free of this problem. However, for a majority of programs of practical interest, an efficient and scalable computation of their SM semantics is at hand immediately using the notions of pre-mappability of extrema [8] and stale-synchronous parallelism. In fact the programs described in the above references fall in this second category that combine formal semantics with efficient and scalable implementation.

Moreover, as we deal with the other aggregates, we realize that they can all be defined by adding to the basic definition of count simple monotonic extensions needed to express the specific aggregate. In all cases, the value of the aggregate is returned when all the members of the set have been counted, i.e., when the computation of count reaches its max value.Thus the SM and fixpoint properties of programs containing arbitrary aggregates and their combinations remain those we have derived for count. Indeed, this approach has allowed us to express with formal SM and superior performance and scalability a wide range of algorithms used in graph, ML and KDD applications [1, 2, 4, 5, 6, 7]. Furthermore, query languages, such as SQL, can greatly benefit from these advances [2,7].

### References

1. A. Das and C. Zaniolo. A case for stale synchronous distributed model for declarative recursive computation. In 35th International Conference on Logic Programming, ICLP 2019..
2.  J. Gu, Y. Watanabe, W. Mazza, A. Shkapsky, M. Yang, L. Ding, and C. Zaniolo. RSQL: Greater power and performance for big data analytics with recursive-aggregate-sql on spark. In ACM SIGMOD Int. Conference on Management of Data, SIGMOD 2019, 2019.
3. M.Mazuran,E.Serra,and C.Zaniolo. A declarative extension of Horn clauses, and its significance for Datalog and its applications. TPLP, 13(4-5):609-623, 2013.
4. J. Seo, J. Park, J. Shin, and M. S. Lam. Distributed socialite: a Datalog-based language for large-scale graph analysis. PVLDB, 6(14):1906-1917, 2013
5. A. Shkapsky, M. Yang, M. Interlandi, H. Chiu, T. Condie, and C. Zaniolo. Big data analytics with Datalog queries on Spark. In SIGMOD, pages 1135-1149. ACM, 2016.
6.  J. Wang, M. Balazinska, and D. Halperin. Asynchronous and fault-tolerant recursive datalog evaluation in shared-nothing engines. PVLDB, 8(12):1542-1553, 2015..
7. J. Wang, G. Xiao, J. Gu, J. Wu, and C. Zaniolo. RASQL: A powerful language and its system for big data applications. In SIGMOD 2020 Int. Conference on Management of Data, pages 2673-2676. ACM, 2020.
8. C.Zaniolo,M.Yang,M.Interlandi,A.Das,A.Shkapsky,and T.Condie. Fixpoint semantics and optimization of recursive Datalog programs with aggregates. TPLP, 17(5-6):1048-1065, 2017.

# A Logic Programming Approach to Regression Based Repair of Incorrect Initial Belief States (Extended Abstract)

Loc Pham (New Mexico State University)
Enrico Pontelli (New Mexico State University)
Fabio Tardivo (New Mexico State University)
Tran Cao Son (New Mexico State University)

### Abstract

This paper introduces a combination of regression and belief revision to allow agents to deal with inconsistencies while executing plans. Starting from an inconsistent history consisting of actions and observations, the proposed framework (1) computes the initial belief states that support the actions and observations and (2) uses a belief revision operator to repair the false initial belief state. The framework operates on domains with static causal laws and supports arbitrary sequences of actions. The paper illustrates how logic programming can be effectively used to support these processes.

## Introduction

In reasoning about actions and change, sensing actions have been considered as the mean for agents to refine their knowledge in presence of incomplete knowledge. A sensing action helps an agent to determine the truth value of an unknown fluent. For example, the action look helps the agent to determine whether the light in the kitchen is $on$ or off ($\neg on$). Initially, the agent's knowledge about the state of the world is described by the set $\{\{on\}, \{\neg on\}\}$, which represents the set of possible states that she thinks she might be in. The execution of the look action will help the agent to decide whether the current state of the world is $\{on\}$ or $\{\neg on\}$. A sensing action does not change the world and its effect is about the knowledge of the agent. Current approaches to dealing with sensing actions in action languages or situation calculus, such as those proposed in [4,7], often make a fundamental implicit assumption: the reasoning agent has correct information. This also means that these approaches cannot be directly applied to situations in which the reasoning agent has completely incorrect information (or beliefs) about the world. For example, when the agent believes that the light is $on$, but after executed action $look$, she observes that the light is actually off ($\neg on$). In this case, the agent has to correct her initial belief that the light is off. Generally, it means that agents need to be able to incorporate observations and update their beliefs while executing a plan. In this paper, we propose an approach that combines regression and belief revision to allow agents to correct their initial belief state.

## Background: The Action Language ${\cal B}_S$

We adopt the language ${\cal B}_S$ introduced in [2]. An action theory in ${\cal B}_S$ is defined over two disjoint sets, a set of actions A and a set of fluents F. A fluent literal is either a fluent $f \in \mathbf{F}$ or its negation $\neg f$. A fluent formula is a propositional formula constructed from fluent literals. An action theory is composed of statements of the following forms:

 $\displaystyle \textbf{$e$if$\{p_1,\dots,p_n\}$}$ (1) $\displaystyle \textbf{$a$causes$\{e_1,\dots,e_n\}$if$\{p_1,\dots,p_m\}$}$ (2) $\displaystyle \textbf{$a$executable_if$\{p_1,\dots,p_n\}$}$ (3) $\displaystyle \textbf{$a$determines$f$}$ (4)

where $a$ is an action, $f$ is a fluent, $e$,$e_i$ are literals representing effects and $p_i$ are literals indicating preconditions. (1) represents a static causal law. (2) represents a dynamic causal law. (3) encodes an executability condition. (4) is called a knowledge producing law. We assume that sensing actions do not occur in dynamic causal laws. An action theory is a pair $(D,\Psi_0)$ where $\Psi_0$ is a fluent formula, describing the initial state, and $D$, called action domain, consists of laws of the form (1)–(4). The notions of a state, a belief state, entailment between states or belief states and formula, etc. are defined as usual. For a fluent formula $\psi$, $\Sigma_\psi = \{s \mid s$ is a state in $D$ s.t. $s \models \psi\}$, i.e., $\Sigma_\psi$ is the belief state satisfying $\psi$. A domain $D$ defines a transition function $\Phi_D$ between belief states (see, e.g., [2]). This function is extended to define $\widehat{\Phi}_D$ for reasoning about the effects of action sequences in the usual way.

Definition 1 Let $T = (D,\Psi_0)$ be an action theory. A history of $T$ is a sequence of pairs of actions and observations $\alpha = [(a_1, \psi_1), \ldots, (a_n,\psi_n)]$ where $a_i$ is an action and $\psi_i$ is a fluent formula. We assume that if $a_i$ is a sensing action for the fluent $f$, then either $\Psi_i\models f$ or $\Psi_i \models \neg f$. We say that the history $\alpha$ is inconsistent with $T$ if there exists some $k$, $1 \le k \le n$, such that $\widehat{\Phi}([a_1,\ldots,a_k], \{\Sigma_{\Psi_0}\}) \not\models \psi_k$.

Given an inconsistent history $\alpha$, we are interested in the problem of identifying the correct initial belief state of the agent, say $\Psi_0'$, such that for every $k$, $1 \le k \le n$, such that $\widehat{\Phi}([a_1,\ldots,a_k], \{\Sigma_{\Psi_0'}\}) \models \psi_k$.

## Recovering from Inconsistent Histories

We propose a method that combines regression and belief revision for recovering from inconsistent histories. We start with the definition of a regression function. This function is different for sensing and non-sensing actions.

Regression by non-sensing actions. Let $a$ be a non-sensing action and $\psi$ and $\varphi$ be conjunctions of fluent literals. We say $\varphi$ is a result of the regression of $a$ from $\psi$, denoted by $\varphi \stackrel{a}{\rightarrow} \psi$, if $\forall s \in \Sigma_\varphi.(\Phi(a,s)\models\psi)$.

Regression by sensing actions. Let $a$ be a sensing action and $\psi$ and $\varphi$ be conjunctions of fluent literals. We say $\varphi$ is a result of the regression of $a$ from $\psi$, denoted by $\varphi \stackrel{a}{\rightarrow} \psi$, if there exists some $\Sigma \in \Phi(a, \Sigma_\varphi)$ such that $\Sigma \models \psi$.

We define the regression of action $a$ from $\psi$, denoted by $\mathcal{R}(a, \psi)$, as follows:
 $\displaystyle \mathcal{R}(a, \psi) = \bigvee_{ \varphi\stackrel{a}{\rightarrow} \psi } \varphi$ (5) $\displaystyle \mathcal{R}(a, \psi) = \bigvee_{i=1}^k \mathcal{R}(a, \psi_i)$ (6)
where $\psi$ is a conjunction of literal in (5) and in (6) it is a DNF formula. We also extend the regression function in order to deal with a history $\alpha = [(a_1, \psi_1), \ldots, (a_n,\psi_n)]$ for $n \ge 1$ as $\widehat{\mathcal{R}}(\alpha)$.

Definition 2 Let $(D,\Psi_0)$ be an action theory. Let $\alpha = [(a_1, \psi_1), \ldots, (a_n,\psi_n)]$ be a history and $\widehat{\Phi}(\alpha, \{\Sigma_{\Psi_0}\}) \not\models \psi_n$.The corrected initial belief state of $(D,\Psi_0)$ is defined by $\Psi_0 \star \widehat{\mathcal{R}}(\alpha)$.

There are several proposals for the operator $\star$, and as pointed out in [1], only the operator proposed in [3] satisfies all AGM postulates. In this paper, we make use of the following two operators.
• Satoh's revision operator [5]
• Dalal's belief revision operator [3]

## A Logic Programming Implementation and Results

The main purpose of the Prolog implementation is to guide the development of the definitions in the previous section and validate our ideas as we proceeded. Moreover it gives an overview of strengths and weakness of the theory from a pragmatic point of view. We modified the robot-rooms example from [6] to test our code, it is described as follows.

Example 1  Initially, the robot is in the room $n$ and believes that all lights are on. It makes a tour, from room $n$ to $1, \ldots, n-1$. In each room, the robot looks at the light. At the end of the tour, it realizes that its initial belief is incorrect ($\neg on(n-1)$ is observed and it supposed to be $on(n-1)$).

We tested with $n=1,\ldots,10$ and the system returns the result within 30 minutes. We observe that the size of the domain, in terms of the number of fluents and the number of actions, plays a significant role in the performance of the system. For $n=10$, we have 20 fluents and the number of potential regression results for a non-sensing action (e.g., $leave(k)$) is small but checking whether or not a potential regression result is a computed regression result involves checking the number of possible states given a set of formulae, which could range from $2^1$ to $2^{19}$. We observe that the system spends most of the time doing just that.

## Conclusions

In this paper, we explore the problem of correcting the initial beliefs of an agent who, after executing a sequence of actions and making observations along the history, realizes that her initial beliefs are incorrect. Given an inconsistent history, the approach starts by regressing from the final to the first observation and revising the initial beliefs using the result of the regression. Unlike similar approaches explored in the literature, we consider sensing actions in the presence of static causal laws and propose algorithms for computing the correctinitial beliefs.

### References

1. Theofanis I. Aravanis, Pavlos Peppas &Mary-Anne Williams (2018): Iterated Belief Revision and Dalal's Operator. In: Hellenic Conference on Artificial Intelligence, pp. 26:1–26:4, doi: 10.1145/3200947.3201038.
2. Chitta Baral, Sheila McIlraith & Tran Cao Son (2000): Formulating diagnostic problem solving using an action language with narratives and sensing. In: Int. Conf. Principles of Knowledge and Representation and Reasoning, pp. 311–322.
3. M. Dalal (1988): Investigations into theory of knowledge base revision.
In: Proc. AAAI, pp. 449–479.
4. J. Lobo, G. Mendez &S. Taylor (1997): Adding knowledge to the action description language A.
In: AAAI 97, pp. 454–459.
5. K. Satoh (1988): Nonmonotonic reasoning by minimal belief revision.
In: Proc. FGCS, Springer, pp. 455–462.
6. Steven Shapiro, Maurice Pagnucco, Yves Lespérance & Hector J. Levesque (2011): Iterated belief change in the situation calculus. In: Artif. Intell. 175(1), pp. 165–192, doi: 10.1016/j.artint.2010.04.003.
7. Tran Cao Son & Chitta Baral (2001): Formalizing sensing actions - a transition function based approach.
In: Artificial Intelligence 125(1-2), pp. 19–91, doi: /10.1016/S0004-3702(00)00080-1.

# A Hybrid Neuro-Symbolic Approach for Complex Event Processing (Extended Abstract)

Marc Roig Vilamala (Cardiff University)
Harrison Taylor (Cardiff University)
Tianwei Xing (University of California, Los Angeles)
Luis Garcia (University of California, Los Angeles)
Mani Srivastava (University of California, Los Angeles)
Lance Kaplan (CCDC Army Research Laboratory)
Alun Preece (Cardiff University)
Angelika Kimming (Cardiff University)
Federico Cerutti (University of Brescia)

Training a model to detect patterns of interrelated events that form situations of interest can be a complex problem: such situations tend to be uncommon, and only sparse data is available. We propose a hybrid neuro-symbolic architecture based on Event Calculus that can perform Complex Event Processing (CEP). It leverages both a neural network to interpret inputs and logical rules that express the pattern of the complex event. Our approach is capable of training with much fewer labelled data than a pure neural network approach, and to learn to classify individual events even when training in an end-to-end manner. We demonstrate this comparing our approach against a pure neural network approach on a dataset based on Urban Sounds 8K.

The autoritative version of this extended abstract is available at https://arxiv.org/abs/2009.03420v1.

### Introduction

Imagine a scenario where we are trying to detect a shooting using microphones deployed in a city: shooting is a situation of interest that we want to identify from a high-throughput (audio) data stream. Complex Event Processing (CEP) is a type of approach aimed at detecting such situations of interest, called complex events, from a data stream using a set of rules. These rules are defined on atomic pieces of information from the data stream, which we call events – or simple events, for clarity. Complex events can be formed from multiple simple events. For instance, shooting might start when multiple instances of the simple event gunshot occur. For simplicity, we can assume that when we start to detect siren events, authorities have arrived and the situation is being dealt with, which would conclude the complex event.

Using the raw data stream implies that usually we cannot directly write declarative rules on that data, as it would imply that we need to process that raw data using symbolic rules; though theoretically possible, this is hardly recommended.

Using a machine learning algorithm such a neural network trained with back-propagation is also infeasible, as it will need to simultaneously learn to understand the simple events within the data stream, and the interrelationship between such events to compose a complex event. While possible, the sparsity of data makes this a hard problem to solve.

The architecture we propose is a hybrid neuro-symbolic approach that allows us to combine the advantages of both approaches. Our approach is capable of performing CEP on raw data after training in an end-to-end manner. Among other advantages, our approach is better at training with sparse data than pure neural network approaches, as we will demonstrate. Code is available at https://github.com/MarcRoigVilamala/DeepProbCEP

### Background

ProbEC ([5]) is an approach for complex event processing using probabilistic logic programming. ProbEC takes an input stream of simple events – each of which has a probability of happening attached. From there, it is capable of outputting how likely it is for a complex event to be happening at a given point in time based on some manually-defined rules that describe the pattern for the complex event.

In a previous paper, we built on top of ProbEC proposing a system that made use of pre-trained neural networks to detect complex events from CCTV feeds ([3]). However this approach required access to pre-trained neural networks to process the simple events, which are not always available. To solve this issue, we moved towards end-to-end training, which is able to train these neural networks from just the input data and labels on when the complex events are happening.

In order to implement an end-to-end training with a hybrid neuro-symbolic approach, we made use of DeepProbLog ([2]), which incorporates deep learning into a probabilistic programming language. This allowed us to train the neural networks as part of the system in an end-to-end manner.

DeepProbLog allows users to make use of the outputs of a neural network as part of the knowledge database in a ProbLog program. DeepProbLog also allows users to train those neural networks in an end-to-end manner by calculating the gradient required to perform the gradient descent based on the true value of the performed query and the outputs provided by the neural network. This allows us to implement a hybrid neuro-symbolic architecture that is able to learn in an end-to-end manner.

### Our Approach

In this paper, we are proposing a hybrid neuro-symbolic architecture that performs CEP. As a proof of concept, we have implemented our architecture to perform CEP on audio data. In our implementation, each audio second is processed by a PyTorch implementation of VGGish (available at https://github.com/harritaylor/torchvggish), a feature embedding frontend for audio classification models ([1]) which outputs a feature vector for each second of the original audio file. We use these features as input of a multi-layer perceptron (MLP, AudioNN in the figure) that classifies the audio into a pre-defined set of classes.

The output of this neural network is then used in the logic layer, which contains the rules required to perform CEP. Here, the user can define which patterns of simple events constitute the starts and ends of which complex events.

DeepProbLog is used to integrate the different parts, which allows us to train the neural network within the system in an end-to-end manner, which heavily reduces the cost of labelling; it is practically infeasible to label each second of large collections of audio tracks, while it is much easier to identify the beginning and the end of complex events as situations of interest. As such the system is provided with raw audio data and, for training, labels on when the complex events start and end.

We experimentally compare our approach against a pure statistical learning approach using a neural network (Pure NN). Pure NN exchanges the logical layer for an MLP, which will learn the rules that define complex events. We engineered a synthetic dataset based on Urban Sounds 8K ([4]). We consider two repetitions of the same start event – or end event – within a certain time window as the signal of the beginning – or termination – of a fluent. Then, to test the efficacy of the approach, we varied the size of the time window for repetitions, from 2 to 5 seconds. The information on when a complex event begins or ends is used as training data. The goal of our sysntetic dataset is to be able to detect when a complex event is happening from raw data.

For all the reported results, the corresponding system has been trained on a sequence generated from randomly-ordering the files from 9 of the 10 pre-sorted folds from Urban Sounds 8K, with the remaining fold being used for testing. As recommended by the creators of the dataset, 10-fold cross validation has been used for evaluation. Before each evaluation, both systems have been trained for 10 epochs with 750 training points on each epoch. This allows for both approaches to converge according to our experiments.

 Approach Window size 2 3 4 5 Sound Accuracy Hybrid (Our approach) 0.6425 0.5957 0.6157 0.6076 Pure NN 0.0725 0.1155 0.0845 0.0833 Pattern Accuracy Hybrid (Our approach) 0.5180 0.4172 0.4624 0.4506 Pure NN 0.1843 0.2034 0.2289 0.1927

The table above shows the results of our approach and Pure NN with different window sizes. It shows both the performance for detecting the starts and ends of complex events (Pattern Accuracy) and for classifying the simple events in the sequence (Sound Accuracy). As we can see in the table, our approach is clearly superior, as Pure NN has a performance only marginally better than a random classifier, which would archive a performance of about 10%. Therefore our approach is very efficient at learning from sparse data, and, as a byproduct, can also train the neural network to classify simple events.

### Conclusions

In this paper we demonstrated the superiority of our approach against a feedforward neural architecture. Further investigations that consider recurrent networks (RNNs) particularly long-short term memory (LSTM) networks are ongoing; we thank an anonymous reviewer for this suggestion. Further research could also include rule learning, which could be used to remove the necessity of knowing which patterns of simple events form which complex events.

### Acknowledgement

This research was sponsored by the U.S. Army Research Laboratory and the U.K. Ministry of Defence under Agreement Number W911NF-16-3-0001. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the U.S. Army Research Laboratory, the U.S. Government, the U.K. Ministry of Defence or the U.K. Government. The U.S. and U.K. Governments are authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation hereon.

# Data validation for Answer Set Programming (Extended Abstract)

Mario Alviano (University of Calabria)
Carmine Dodaro (University of Calabria)

 Abstract. Data validation may save the day of computer programmers, whatever programming language they use. Answer Set Programming is not an exception, but the quest for better and better performance resulted in systems that essentially do not validate data in any way. VALASP is a tool to inject data validation in ordinary programs, so to promote fail-fast techniques at coding time without imposing any lag on the deployed system if data are pretended to be valid.

Data validation is the process of ensuring that data conform to some specification, so that any process in which they are involved can safely work under all of the assumptions guaranteed by the specification. In particular, immutable objects are usually expected to be validated on creation, so that their consistency can be safely assumed anywhere in the system - this way, in fact, an invalid immutable object simply cannot exist because its construction would fail. Answer Set Programming (ASP) gained popularity thanks to efficient systems [1, 10, 11, 13] implementing optimized algorithms for solution search [2, 4, 8, 14] and query answering [3, 5]. On the other hand, ASP offers very little in terms of protection mechanisms. No static or dynamic type checking are available, and programmers can rely on a very limited set of primitive types, namely integers, strings and alphanumeric constants, with no idiomatic way to enforce that the values of an argument must be of one of these types only. More structured data types are usually represented by uninterpreted function symbols [6, 7, 9, 12, 15], but again there is no idiomatic way to really validate such structures. Even integrity constraints may be insufficient to achieve a reliable data validation, as they are cheerfully satisfied if at least one of their literals is false; in fact, this is a very convenient property to discard unwanted solutions, but not very effective in guaranteeing data integrity - invalid data in this case may lead to discard some wanted solution among thousands or more equally acceptable solutions, a very hard to spot unexpected outcome. VALASP (https://github.com/alviano/valasp) is a framework for data validation. The format of some data of interest is specified in YAML, and a fail-fast approach is achieved by injecting constraints that are guaranteed to be immediately satisfied when grounded, unless data are found to be invalid and some exception is raised. For example, if birthdays are represented by instances of bday(NAME,DATE), where NAME is an alphanumeric ID and DATE is a term of the form date(YEAR,MONTH,DAY), data validation can be specified as follows:

Lines 1-2 are used to import a Python module that can validate dates. Lines 3-8 specify how to validate terms of the form date(YEAR,MONTH,DAY): the arguments must be integers (lines 4-6) and represent a valid date (line 8). Similarly, lines 9-11 dictate the format of bday referring the specification of date given in lines 3-8. The YAML specification is mapped to Python code and ASP constraints:

An atom like bday(bigel, date(1982,123)) triggers the @-term in line 21, whose implementation in line 20 tries to construct an instance of Bday. However, an exception is raised during the construction of Date (line 19) because of a wrong number of arguments detected at line 6. VALASP produces the following error message:

### References

1. Weronika T. Adrian, Mario Alviano, Francesco Calimeri, Bernardo Cuteri, Carmine Dodaro, Wolfgang Faber, Davide Fuscà, Nicola Leone, Marco Manna, Simona Perri, Francesco Ricca, Pierfrancesco Veltri & Jessica Zangari (2018): The ASP System DLV: Advancements and Applications. Künstliche Intell. 32(2-3), pp. 177-179, doi:10.1007/s13218-018-0533-0.
2. Mario Alviano & Carmine Dodaro (2016): Anytime answer set optimization via unsatisfiable core shrinking. Theory Pract. Log. Program. 16(5-6), pp. 533-551, doi:10.1017/S147106841600020X
3. Mario Alviano, Carmine Dodaro, Matti Järvisalo, Marco Maratea & Alessandro Previti (2018): Cautious reasoning in ASP via minimal models and unsatisfiable cores. Theory Pract. Log. Program. 18(3-4), pp. 319-336, doi:10.1017/S1471068418000145
4. Mario Alviano, Carmine Dodaro & Francesco Ricca (2014): Anytime Computation of Cautious Consequences in Answer Set Programming. Theory Pract. Log. Program. 14(4-5), pp. 755-770, doi:10.1017/S1471068414000325.
5. Mario Alviano & Wolfgang Faber (2011): Dynamic Magic Sets and super-coherent answer set programs. AI Commun. 24(2), pp. 125-145, doi:10.3233/AIC-2011-0492.
6. Mario Alviano, Wolfgang Faber & Nicola Leone (2010): Disjunctive ASP with functions: Decidable queries and effective computation. Theory Pract. Log. Program. 10(4-6), pp. 497-512, doi:10.1017/S1471068410000244.
7. Sabrina Baselice & Piero A. Bonatti (2010): A decidable subclass of finitary programs. Theory Pract. Log. Program. 10(4-6), pp. 481-496, doi:10.1017/S1471068410000232.
8. Bart Bogaerts, Joachim Jansen, Broes De Cat, Gerda Janssens, Maurice Bruynooghe & Marc Denecker (2016): Bootstrapping Inference in the IDP Knowledge Base System. New Gener. Comput. 34(3), pp. 193- 220, doi:10.1007/s00354-016-0301-3
9. Francesco Calimeri, Susanna Cozza, Giovambattista Ianni & Nicola Leone (2011): Finitely recursive programs: Decidability and bottom-up computation. AI Commun. 24(4), pp. 311-334, doi:10.3233/AIC-2011-0509
10. Broes De Cat, Bart Bogaerts, Maurice Bruynooghe, Gerda Janssens & Marc Denecker (2018): Predicate logic as a modeling language: the IDP system. In Michael Kifer & Yanhong Annie Liu, editors: Declarative Logic Programming: Theory, Systems, and Applications, ACM/Morgan & Claypool, pp. 279-323, doi:10.1145/3191315.3191321
11. Carmine Dodaro, Mario Alviano, Wolfgang Faber, Nicola Leone, Francesco Ricca & Marco Sirianni (2011): The Birth of a WASP: Preliminary Report on a New ASP Solver. In Fabio Fioravanti, editor: Proceedings of the 26th Italian Conference on Computational Logic, Pescara, Italy, August 31 - September 2, 2011, CEUR Workshop Proceedings 810, CEUR-WS.org, pp. 99-113. URL.
12. Thomas Eiter & Mantas Simkus (2009): Bidirectional Answer Set Programs with Function Symbols. In Craig Boutilier, editor: IJCAI 2009, Proceedings of the 21st International Joint Conference on Artificial Intelligence, Pasadena, California, USA, July 11-17, 2009, pp. 765-771. URL.
13. Martin Gebser, Benjamin Kaufmann, Roland Kaminski, Max Ostrowski, Torsten Schaub & Marius Schneider (2011): Potassco: The Potsdam Answer Set Solving Collection. AI Commun. 24(2), pp. 107-124, doi:10.3233/AIC-2011-0491.
14. Martin Gebser, Max Ostrowski & Torsten Schaub (2009): Constraint Answer Set Solving. In Patricia M. Hill & David Scott Warren, editors: Logic Programming, 25th International Conference, ICLP 2009, Pasadena, CA, USA, July 14-17, 2009. Proceedings, Lecture Notes in Computer Science 5649, Springer, pp. 235-249, doi:10.1007/978-3-642-02846-5_22.
15. Yuliya Lierler & Vladimir Lifschitz (2009): One More Decidable Class of Finitely Ground Programs. In Patricia M. Hill & David Scott Warren, editors: Logic Programming, 25th International Conference, ICLP 2009, Pasadena, CA, USA, July 14-17, 2009. Proceedings, Lecture Notes in Computer Science 5649, Springer, pp. 489-493, doi:10.1007/978-3-642-02846-5_40.

# Recursive Rules with Aggregation: A Simple Unified Semantics (Extended Abstract)

Yanhong A. Liu (Computer Science Department, Stony Brook University)
Scott D. Stoller (Computer Science Department, Stony Brook University)

Abstract. Complex reasoning problems are most clearly and easily specified using logical rules, especially recursive rules with aggregation such as counts and sums for practical applications. Unfortunately, the meaning of such rules has been a significant challenge, leading to many different conflicting semantics.

This extended abstract gives an overview of a unified semantics for recursive rules with aggregation, extending the unified founded semantics and constraint semantics for recursive rules with negation. The key idea is to support simple expression of the different assumptions underlying different semantics, and orthogonally interpret aggregation operations straightforwardly using their simple usual meaning.

Introduction. Many computation problems, including complex reasoning problems in particular, are most clearly and easily specified using logical rules. However, such reasoning problems in practical applications, especially for large applications and when faced with uncertain situations, require the use of recursive rules with aggregation such as counts and sums. Unfortunately, even the meaning of such rules has been challenging and remains a subject with significant complication and disagreement by experts.

As a simple example, consider a single rule for Tom to attend the logic seminar: Tom will attend the logic seminar if the number of people who will attend it is at least 20. What does the rule mean? If 20 or more other people will attend, then surely Tom will attend. If only 10 others will attend, then Tom clearly will not attend. What if only 19 other people will attend? Will Tom attend, or not? Although simple, this example already shows that, when aggregation is used in a recursive rule, the semantics can be subtle.

Semantics of recursive rules with aggregation has been studied continuously since about 30 years ago, and intensively in the last several years, especially as they are needed in graph analysis and machine learning applications. However, the different semantics proposed, e.g., [7, 2], are complex and tricky, including having some experts changing their own minds about the desired semantics, e.g., [1, 2]. With such complex semantics, aggregation would be too challenging for non-experts to use correctly.

This extended abstract gives an overview of a simple unified semantics for recursive rules with aggregation, as well as negation and quantification, as described in the full paper [6]. The key idea is to support simple expression of the different assumptions underlying different semantics, and orthogonally interpret aggregation operations straightforwardly using their simple usual meaning. The unified semantics is built on and extends the founded semantics and constraint semantics of logical rules with negation and quantification developed recently by Liu and Stoller [3, 4], which has been used in a new language to support the power and ease of programming with logical constraints [5].

We applied the unified semantics to a variety of different examples, as described in detail in the full paper [6], including the longest and most sophisticated ones from dozens of previously studied examples [2]. For those from previously studied examples, instead of computing answer sets using naive guesses followed by sophisticated reducts, all of the results can be computed with a simple default assumption and a simple least fixed-point computation, as is used for formal inductive definitions and for commonsense reasoning. In all cases, we show that the resulting semantics match the desired semantics.

Overview of the Unified Semantics. Our simple and unified semantics for rules with aggregation as well as negation and quantification builds on founded semantics and constraint semantics [3, 4] for rules with negation and quantification. The founded semantics gives a single 3-valued model (i.e., the possible truth values of an assertion are true, false, and undefined) from simply a least fixed-point computation, and the constraint semantics gives a set of 2-valued models (i.e., the possible truth values of an assertion are true and false) from simply constraint solving.

The key insight is that disagreeing complex semantics for rules with aggregation are because of different underlying assumptions, and these assumptions can be captured using the same simple binary declarations about predicates as in founded semantics and constraint semantics but generalized to include the meaning of aggregation.

• First, if there is no aggregation or no potential non-monotonicity—that is, adding new facts used in the hypotheses of a rule may make the conclusion of a rule from true to false—in recursion, then the predicate in the conclusion can be declared "certain".

Being certain means that assertions of the predicate are given true or inferred true by simply following rules whose hypotheses are given or inferred true, and the remaining assertions of the predicate are false. This is both the founded semantics and constraint semantics.

For the example of Tom attending the logic seminar, there is no potential non-monotonicity; with this declaration, when given that only 19 others will attend, the hypothesis of the rule is not true, so the conclusion cannot be inferred. Thus Tom will not attend.

• Regardless of monotonicity, a predicate can be declared "uncertain". It means that assertions of the predicate can be given or inferred true or false using what is given, and any remaining assertions of the predicate are undefined. This is the founded semantics.

If there are undefined assertions from founded semantics, all combinations of true and false values are checked against the rules as constraints, yielding a set of possible satisfying combinations. This is the constraint semantics.

• An uncertain predicate can be further declared "complete" or not. Being complete means that all rules that can conclude assertions of the predicate are given. Thus a new rule, called completion rule, can be created to infer negative assertions of the predicate when none of the given rules apply.

Being not complete means that negative assertions cannot be inferred using completion rules, and thus all assertions of the predicate that were not inferred to be true are undefined.

For the example of Tom attending the logic seminar, the completion rule essentially says: Tom will not attend the logic seminar if the number of people who will attend it is less than 20.

When given that only 19 others will attend, due to the uncertainty of whether Tom will attend, neither the given rule nor the completion rule will fire. So whether one uses the declaration of complete or not, there is no way to infer that Tom will attend, or Tom will not attend. So, founded semantics says it is undefined.

Then constraint semantics tries both for it to be true, and for it to be false; both satisfy the rule, so there are two models: one that Tom will attend, and one that Tom will not attend.

• Finally, an uncertain complete predicate can be further declared "closed", meaning that an assertion of the predicate is made false if inferring it to be true requires itself to be true.

For the example of Tom attending the logic seminar, with this declaration, if there are only 19 others attending, then Tom will not attend in both founded semantics and constraint semantics. This is because inferring that Tom will attend requires Tom himself to attend to make the count to be 20, so it should be made false, meaning that Tom will not attend.

Overview of Language and Formal Semantics. Formal definitions of the language and semantics, and proofs of consistency and correctness of the semantics, appear in the full paper [6]. We give a brief overview here.

Our language supports Datalog rules extended with unrestricted negation, universal and existential quantification, aggregations, and comparisons. An aggregation has the form agg S, where agg is an aggregation operator (count, min, max, or sum), and S is a set expression of the form { X1, ... ,Xa : B }, where B is a conjunction of assertions or negated assertions. A comparison is an equality (=) or inequality (≠, ≤, <, ≥, or >), with an aggregation on the left and a variable or constant on the right. Additional aggregation and comparison functions, including summing only the first component of a set of tuples and using orders on characters and strings, can be supported in the same principled way as we support those above. A program is a set of rules, facts, and declarations.

The key idea for extending the semantics is to identify conditions under which a comparison is definitely true or false in a 3-valued interpretation for the predicates, and to leave the comparison's truth value as undefined if those conditions don't hold. For example, consider the comparison count { X : p(X) } ≤ k and its complement (i.e., its negation) count { X : p(X) } > k. The former is true in an interpretation I if the number of ground instances of p(X) that are true or undefined in I is at most k. The latter is true in I if the number of ground instances of p that are true in I is greater than k. Considering the complement eliminates the need to explicitly define when a comparison is false or undefined. Instead, we derive those conditions as follows: a comparison is false in I if its complement is true in I, and a comparison is undefined in I if neither it nor its complement is true in I.

Acknowledgments. This work was supported in part by ONR under grant N00014-20-1-2751 and NSF under grants CCF-1954837, CCF-1414078, and IIS-1447549.

## References

1. Michael Gelfond (2002): Representing Knowledge in A-Prolog. In: Computational Logic: Logic Programming and Beyond. Springer, pp. 413–451, doi:10.1007/3-540-45632-5_16.
2. Michael Gelfond & Yuanlin Zhang (2019): Vicious Circle Principle, Aggregates, and Formation of Sets in ASP Based Languages. Artificial Intelligence 275, pp. 28–77, doi:10.1016/j.artint.2019.04.004.
3. Yanhong A. Liu & Scott D. Stoller (2018): Founded Semantics and Constraint Semantics of Logic Rules. In: Proceedings of the International Symposium on Logical Foundations of Computer Science (LFCS 2018), Lecture Notes in Computer Science 10703. Springer, pp. 221–241, doi:10.1007/978-3-319-72056-2_14.
4. Yanhong A. Liu & Scott D. Stoller (2020): Founded Semantics and Constraint Semantics of Logic Rules. Journal of Logic and Computation 30(8). To appear. Preprint available at https://arxiv.org/abs/1606.06269.
5. Yanhong A. Liu & Scott D. Stoller (2020): Knowledge of Uncertain Worlds: Programming with Logical Constraints. In: Proceedings of the International Symposium on Logical Foundations of Computer Science (LFCS 2020), Lecture Notes in Computer Science 11972. Springer, pp. 111–127, doi:10.1007/978-3-030-36755-8_8. Also https://arxiv.org/abs/1910.10346.
6. Yanhong A. Liu & Scott D. Stoller (2020): Recursive Rules with Aggregation: A Simple Unified Semantics. Computing Research Repository arXiv:2007.13053 [cs.DB]. http://arxiv.org/abs/2007.13053.
7. Allen Van Gelder (1992): The Well-Founded Semantics of Aggregation. In: Proceedings of the 11th ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, pp. 127–138, doi:10.1145/137097.137854.

# Modeling Bitcoin Lightning Network by Logic Programming (Extended Abstract)

Damiano Azzolini (University of Ferrara)
Elena Bellodi (University of Ferrara)
Alessandro Brancaleoni (University of Ferrara)
Fabrizio Riguzzi (University of Ferrara)
Evelina Lamma (University of Ferrara)

Bitcoin is one of the first decentralized, peer to peer, payment systems based on the Proof-of-Work consensus algorithm. The network suffers from a scalability issue due to several limitations such as the restriction imposed on the blocks' size. For this reason, several approaches have been proposed, among which the so-called "Layer 2 solutions", where a layer of channels is built on top of a blockchain. This allows users to send transactions through these channels, without broadcasting them on the blockchain, increasing the number of transactions per second that can be managed. One of the main examples of this last approach is the Lightning Network: in this paper we propose to represent this network and to query its properties by means of Logic Programming, in order to study its evolution over time.

Bitcoin [3] is one of the most famous decentralized payment system based on a blockchain. The algorithm used to append block to the blockchain, Proof of Work (POW) for Bitcoin, ensures that blocks, once discovered, cannot be easily tampered with. However, it also represents one of the main bottlenecks since only few transactions per second can be supported in the network. Currently, one of the main approaches to increase Bitcoin capacity is represented by the so-called "Layer 2 solutions". This type of systems creates a layer of channels on top of a blockchain. With these channels, users can overcome some blockchain limitations by issuing off-chain transactions. One of the most famous systems is the Lightning Network (LN) [4]. Here, we encode the Lightning Network by means of Logic Programming, since it has been proved effective in several Bitcoin scenarios [1,2]. The use of Prolog both as the representation language of the Lightning Network and as the query language allows us to easily analyse its characteristics requiring a minimal effort in the code implementation.

The Lightning Network can be represented as a graph $G = (V,E)$ where $V$ is the set of vertices (nodes) and $E$ is the set of edges (payment channels). The degree of a node is defined as the number of edges incident to the node. A path of length $n$ between two nodes $v_a, v_b \in V$ is a sequence of payment channels $e_1,\ldots,e_n \in E$ such that $e_1 = (x_1,x_2)$, $e_2 = (x_2,x_3), \dots, e_n = (x_{n-1},x_n)$ where $x_1 = v_a$ and $x_n = v_b$. The distance between two nodes is defined as the shortest path that connects those nodes. The capacity of an edge is defined as the maximum payment that can be routed through it. One of the problem of routing in LN is that the capacity of a channel between two nodes is known but the distribution of the capacity in each direction is unknown, since it is a feature introduced to increase the security of the system: this makes routing a complicated task, since several attempts may be required to send a payment.

We represent a channel of capacity Amount between two nodes Source and Dest with a Prolog fact of the form edge(Source,Dest,Amount). The channels in the network are also characterized by other values (i.e., fee base and fee rate), but we ignore them since they are not needed in our experiments. Theoretically, the amount locked in a channel is split between the two connected nodes, so a payment channel should be represented by two directed edges. However, the amount distribution is unknown, so we suppose that nodes are connected by only one undirected edge. The Prolog representation of this situation, between a source node $a$ and a destination node $b$, is given by a single fact edge(a,b,8). The whole network is a set of ground facts edge/3.

Starting from the dataset related to [6], we trace the LN evolution along the months of February, March and April 2020 and how its properties and connections vary over time, through a series of experiments. We analyze the structure of the network in terms of node degree distribution: the majority of the nodes of the network (more than 65% for all three datasets) has degree between 1 and 5. Then, we compute how the total network capacity varies by removing the edges with the top capacity values and the nodes with the highest associated degree. The goal of this experiment is to show how much the capacity of the network is centralized in the hands of few. By removing the edges, the network capacity substantially reduces after 50 removals. Instead, removing the top 100 nodes decreases the total network capacity approximately by 90%. We analyse the rebalancing operation (i.e., a node sends a payment to itself) and, as expected, as the node degree increases, the maximum rebalancing amount increases as well. Finally, we compute the number of paths of length 2 and 3 among equal degree nodes, with the degree varying between 1 and 10. We focus on short paths since, in practice, the average length of the shortest path is 2.8 [7]. Moreover, longer paths also imply higher fees to pay. We discover that the number of paths drops after the 3rd or 4th degree for all networks in both cases. As a future work, we plan to extend our analysis using Probabilistic Logic Programming [5].

### References

1. Damiano Azzolini, Fabrizio Riguzzi & Evelina Lamma (2019): Studying Transaction Fees in the Bitcoin Blockchain with Probabilistic Logic Programming. Information10(11), p. 335, doi:10.3390/info10110335.
2. Damiano Azzolini, Fabrizio Riguzzi, Evelina Lamma, Elena Bellodi & Riccardo Zese (2018): Modeling Bitcoin Protocols with Probabilistic Logic Programming. In Elena Bellodi & Tom Schrijvers, editors: Proceedings of the 5th International Workshop on Probabilistic Logic Programming, PLP 2018, co-located with the 28th International Conference on Inductive Logic Programming (ILP 2018), Ferrara, Italy, September 1, 2018,CEUR Workshop Proceedings2219, CEUR-WS.org, pp. 49–61. Available at http://ceur-ws.org/Vol-2219/paper6.pdf.
3. Satoshi Nakamoto (2008): Bitcoin: A peer-to-peer electronic cash system.
4. Joseph Poon & Thaddeus Dryja (2016): The bitcoin lightning network: Scalable off-chain instant payments.
5. Fabrizio Riguzzi (2018): Foundations of Probabilistic Logic Programming. River Publishers, Gistrup, Denmark.
6. Elias Rohrer, Julian Malliaris & Florian Tschorsch (2019): Discharged Payment Channels: Quantifying theLightning Network's Resilience to Topology-Based Attacks. In: 2019 IEEE European Symposium on Security and Privacy Workshops (EuroS&PW), IEEE, pp. 347–356, doi:10.1109/EuroSPW.2019.00045.
7. István András Seres, László Gulyás, Dániel A Nagy & Péter Burcsi (2020): Topological analysis of bitcoin's lightning network. In: Mathematical Research for Blockchain Economy, Springer, pp. 1–12.

# Accountable Protocols in Abductive Logic Programming (Extended Abstract)

Marco Gavanelli (University of Ferrara)
Marco Alberti (University of Ferrara)
Evelina Lamma (University of Ferrara)

## Abstract

Finding the responsible of an unpleasant situation is often difficult, especially in artificial agent societies.

SCIFF is a language to define formal rules and protocols in agent societies, and an abductive proof-procedure for compliance checking. However, how to identify the responsible for a violation is not always clear.

In this work, a definition of accountability for artificial societies is formalized in SCIFF. Two tools are provided for the designer of interaction protocols: a guideline, in terms of syntactic features that ensure accountability of the protocol, and an algorithm (implemented in a software tool) to investigate if, for a given protocol, non-accountability issues could arise.

## 1  Introduction

The current economic world is strongly based on large corporations, that have been able to provide large economic benefits, such as cheaper prices for everyday goods and better employment rates, but that also represented large problems in case of failure. Every person can list problems in his/her own country in which a large firm misbehaved, e.g., polluting the environment, or by failing in a disastrous way causing huge losses for small investors. In many cases, the firm itself cannot be punished for its misbehavior, because a company cannot be sent to jail. One hopes that the culprit of the misbehavior (e.g., the CEO) is punished, but in many cases the complex behavior of an organization depends on the policies established by previous members (that might even be dead), by common practices, or by the fact that many individuals contributed to the disaster each for an inconceivably small amount.

In the literature of moral responsibility, there exist different notions of responsibility. Van de Poel et al. [3] distinguish five moral meanings of responsibility: accountability, blameworthiness, liability, obligation and virtue.

The ascription of responsibility-as-accountability has the following implication: i is responsible-as-accountable for φ implies that i should account for (the occurrence of) φ, in particular for i's role in doing, or bringing about φ, or for i's role in failing to prevent φ from happening, where i is some agent, and φ an action or a state-of-affairs.
and
Accountability implies blameworthiness unless the accountable agent can show that a reasonable excuse applies that frees her from blameworthiness. So holding an agent i accountable shifts the burden of proof for showing that i is not blameworthy to the agent i: the agent is now to show - by giving an account - that she is not blameworthy.

In this work, we focus on the SCIFF system [1], a complete system for defining and checking the compliance of agents to interaction protocols. It includes a language to define agent interaction protocols and to relate a current state of affairs with one or more expected behaviors of the agents, formalized as a set of expectations. The language was designed to leave freedom to agents, not overconstraining them to follow statically pre-defined paths, but, instead, to assert explicitly the obligatory actions and those that are forbidden, while leaving everything not explicitly stated as a possible action that an agent can perform if it is convenient. An abductive proof-procedure accepts asynchronous events and reasons about them through the protocol definition, generates the expected behavior of the agents, and checks if the actual behavior matches with the expectations.

SCIFF lacks a concept of responsibility, because expectations, unlike commitments, are not characterized by a debtor, due to different language design objectives: while SCIFF is able to detect violations of the protocols, it is not always clear which agent is responsible for the wrong state of affairs.

In this work, we address the problem by adopting the accountability version of responsibility. Accountability in the proposed setting stands for the possibility to account for the wrong state of affairs of an agent that is the one that performed (or did not perform) the action in its expected behavior. The agent might then, by reasoning on the protocol and the state of affairs (again, using the SCIFF proof procedure), be able to account for its own behavior. The agent might be able to find an explanation in which its expected behavior is fulfilled, and in such a case it cannot be held responsible for the violation. In some cases, this might happen because another agent is actually responsible for the violation, but in other cases it might be due to a wrong design of the interaction protocol.

For this reason, we define formally a notion of accountability of the interaction protocol. The idea is that a protocol is accountable if it allows to identify the agent (or agents) responsible for each possible violation. If the interactions in an organization or society are ruled by an accountable protocol, then, for each possible undesirable state of affairs, one or more agents will be unambiguously held responsible.

The formal definition allows us to provide guidelines and tools for the developer of interaction protocols. The guidelines are syntactic conditions that ensure a-priori the accountability of a protocol. We identify a syntactic characterization of a fairly large class of protocols and prove that protocols in such class are accountable. Various protocols taken from the list of SCIFF applications belong to this class.

However, even protocols that do not belong to the identified class may be accountable. For existing protocols, the user might not want to completely re-design the protocol, and in this case a tool that checks the protocol for accountability might be more suitable. We propose a tool to detect if a protocol has non-accountability issues. If there exists such an issue, the tool also provides a counterexample, i.e., a course of events with protocol violation, but for which no agent can be held responsible. We tested, through such tool, protocols modeled in the past with SCIFF, and we were able to identify non-accountability of two protocols that were completely reasonable for the task for which they were designed. Thanks to the tool and the provided counterexample, it was then easy for the designer to fix the protocol.

### References

1. Marco Alberti, Federico Chesani, Marco Gavanelli, Evelina Lamma, Paola Mello & Paolo Torroni (2008): Verifiable Agent Interaction in Abductive Logic Programming: the SCIFF Framework. ACM Transactions on Computational Logic 9(4), pp. 29:1-29:43, doi:10.1145/1380572.1380578.
2. Marco Gavanelli, Marco Alberti & Evelina Lamma (2018): Accountable Protocols in Abductive Logic Programming. ACM Transactions on Internet Technology 18(4), pp. 46:1-46:20, doi:10.1145/3107936.
3. Ibo Van de Poel, Lambèr Royakkers & Sjoerd D. Zwart (2015): Moral Responsibility and the Problem of Many Hands. Routledge Studies in Ethics and Moral Theory, Routledge, doi:10.4324/9781315734217.

### Footnotes:

1The full version of this extended abstract can be found in [2].

# Sampling-Based SAT/ASP Multi-Model Optimization as a Framework for Probabilistic Inference (Extended Abstract)

Matthias Nickles (School of Computer Science, National University of Ireland, Galway)

Email: matthias.nickles@nuigalway.ie

This extended abstract reports an earlier work [8] which introduced multi-model optimization through SAT witness or answer set sampling where the sampling process is controlled by a user-provided differentiable loss function over the multiset of sampled models. Probabilistic reasoning tasks are the primary use cases, including deduction-style probabilistic inference and hypothesis weight learning. Technically, our approach enhances a CDCL-based SAT and ASP solving algorithm to differentiable satisfiability solving (respectively differentiable answer set programming), by using a form of Gradient Descent as branching literal decision approach, and optionally a cost backtracking mechanism. Sampling of models using these methods minimizes a task-specific, user-provided multi-model loss function while adhering to given logical background knowledge (background knowledge being either a Boolean formula in CNF or a logic program under stable model semantics). Features of the framework include its relative simplicity and high degree of expressiveness, since arbitrary differentiable cost functions and background knowledge can be provided.

Keywords: Boolean Satisfiability Problem, Probabilistic Logic Programming, Answer Set Programming, Differentiable Satisfiability, Weighted Sampling, PSAT, Optimization

With this extended abstract, we report and summarize an earlier publication [8] which introduced an approach to finding an optimal multiset of satisfying Boolean variable assignments or answer sets by means of loss function gradient-steered sampling. The sampling process minimizes a user-defined objective function using a new optimization method which we call Differentiable Satisfiability Solving respectively Differentiable Answer Set Programming [7] (∂SAT/∂ASP).

In contrast to existing approaches to ASP- or SAT-based optimization such as MaxWalkSAT [5], a differentiable cost function evaluates statistics over an entire multi-set of models (“worldview”). Logical knowledge is provided either as a Boolean formula in CNF or as a logic program in Answer Set Programming (ASP) syntax (which is similar to Prolog and Datalog syntax). ASP is a form of logic programming oriented primarily towards NP-hard search and combinatorial problems [4].

Use cases of our framework include basically all probabilistic reasoning tasks where the input is either a logic program or a propositional formula (in CNF) with clauses or rules optionally weighted with probabilities. With appropriate cost functions, we can also determine probabilities of logical hypotheses.

More far reaching, it allows for a new type of ASP and satisfiability solving where an optimal multi-solution (list of models, i.e., stable models in the the answer set case or witnesses in the SAT case) is specified by arbitrary differentiable cost functions.

Features of our framework are its relative conceptual simplicity and high degree of expressiveness. In contrast to most existing probabilistic logic programming frameworks, no assumption of probabilistic independence needs to be made and arbitrary differentiable cost functions can be specified. Over most probabilistic FOL frameworks (including Markov Logic Networks), our approach allows for inductive definitions and allows for non-monotonic logic programming. Experimental results [8] indicate that our approach is competitive with major probabilistic reasoning approaches for standard benchmark tasks.

Technically, multi-model optimization is implemented as an enhancement of the Conflict-Driven Nogood Learning (CDNL) [3] state-of-the-art SAT/ASP solving algorithm, a variant of Conflict-Driven Clause Learning (CDCL). We have enhanced CDNL with iterative model sampling capabilities using a Gradient Descent step in the branching literal heuristics of the partial Boolean variable assignment loop (this enhancement already suffices for performing probabilistic deductive inference), and additionally an optional cost backtracking mechanism, to cover non-deductive probabilistic inference (weight finding).

Sampled models are added to the multi-model sample until a task-specific cost function is sufficiently minimized (down to a specified error threshold) while ensuring that all sampled models adhere to the given logical background knowledge. After sampling, a counting and normalization step over the sampled models can be used to compute probabilities of queries or hypotheses.

This work is related mainly to other probabilistic answer set and SAT frameworks such as [10,2,9,6] and to weighted and constrained sampling approaches such as [1] - details can be found in [8].

An open source implementation of our framework and some examples can be found at https://github.com/MatthiasNickles/delSAT

### References

1. Supratik Chakraborty, Daniel J. Fremont, Kuldeep S. Meel, Sanjit A. Seshia & Moshe Y. Vardi (2014): Distribution-Aware Sampling and Weighted Model Counting for SAT. In Carla E. Brodley & Peter Stone, editors: Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence, July 27 -31, 2014, Quebec City, Quebec, Canada, AAAI Press, pp. 1722−1730, doi:10.1.1.685.9243.
2. Nelson Rushton, Chitta Baral, Michael Gelfond (2009): Probabilistic reasoning with answer sets. Theory and Practice of Logic Programming 9(1), p. 57−144, doi:10.1017/S1471068408003645.
3. Martin Gebser, Benjamin Kaufmann & Torsten Schaub (2012): Conflict−driven answer set solving: From theory to practice. 187-188, pp. 52−89, doi:https://doi.org/10.1016/j.artint.2012.04.001.
4. M. Gelfond & V. Lifschitz (1988): The stable model semantics for logic programming. In: Proc. of the 5th Int. Conference on Logic Programming, 161, doi:10.1.1.24.6050.
5. Henry Kautz, Bart Selman & Yueyen Jiang (1996): A General Stochastic Approach to Solving Problems with Hard and Soft Constraints. In: The Satisfiability Problem: Theory and Applications, American Mathematical Society, pp. 573−586, doi: 10.1.1.21.2218.
6. Joohyung Lee & Yi Wang (2015): A Probabilistic Extension of the Stable Model Semantics. In: 2015 AAAI Spring Symposia, Stanford University, Palo Alto, California, USA, March 22-25, 2015, AAAI Press.
7. Matthias Nickles (2018): Differentiable Satisfiability and Differentiable Answer Set Programming for Sampling-Based Multi-Model Optimization. CoRR abs/1812.11948. Available at http://arxiv.org/abs/1812.11948.
8. Matthias Nickles (2018): Sampling-Based SAT/ASP Multi-model Optimization as a Framework for Probabilistic Inference. In Fabrizio Riguzzi, Elena Bellodi & Riccardo Zese, editors: Inductive Logic Program- ming - 28th International Conference, ILP 2018, Ferrara, Italy, September 2-4, 2018, Proceedings, Lecture Notes in Computer Science 11105, Springer, pp. 88−104, doi:10.1007/978-3-319-99960-9 6.
9. Matthias Nickles & Alessandra Mileo (2015): A Hybrid Approach to Inference in Probabilistic Non- Monotonic Logic Programming. In Fabrizio Riguzzi & Joost Vennekens, editors: Proceedings of the 2nd International Workshop on Probabilistic Logic Programming co-located with 31st International Conference on Logic Programming (ICLP 2015), Cork, Ireland, August 31st, 2015, CEUR Workshop Proceedings 1413, CEUR-WS.org, pp. 57−68.
10. Daniele Pretolani (2005): Probability logic and optimization SAT: The PSAT and CPA models. Annals of Mathematics and Artificial Intelligence 43(1), pp. 211−221, doi:10.1007/s10472-005-0430-8.

# Report: Datalog with Recursive Aggregation for Incremental Program Analyses (Extended Abstract)

Tamás Szabó (itemis AG / JGU Mainz)
Gabór Bergmann (Budapest University of Technology and Economics)
Sebastian Erdweg (JGU Mainz)
Markus Voelter (independent / itemis AG)

This abstract is a summary of our OOPSLA'18 paper "Incrementalizing Lattice-Based Program Analyses in Datalog". Original download URL: https://dl.acm.org/doi/10.1145/3276509.

### Extended Abstract

A static analysis is a tool that reasons about the runtime behavior of a computer program without actually running it. This way static analyses can help to catch runtime errors already at development time before the code goes to production, thereby saving significant costs on maintenance and the mitigation of potential software failures. To this end, static analyses are widely used in many areas of software development. For example, Integrated Development Environments (IDEs) use type checkers or data-flow analyses to provide continuous feedback to developers as they modify their code.

Datalog is a logic programming language that sees a resurgence in the static analysis community. There are many examples of static analyses specified in Datalog; ranging from network analysis on Amazon-scale systems to inter-procedural points-to analysis of large Java projects. The benefit of using Datalog for static analyses is that the declarative nature of the language allows quick prototyping of modular and succinct analysis implementations. Moreover, the execution details of a Datalog program is left to a solver, and solvers are free to optimize the execution in many ways. Our goal is to incrementalize the Datalog solver, in order to provide continuous feedback with analyses in IDEs.

In response to a program change, an incremental analysis reuses the previously computed results and updates them based on the changed code parts. In many applications, incrementality has been shown to bring significant performance improvements over from-scratch re-computation. There also exist incremental Datalog solvers, but they are limited in expressive power: They only support standard Datalog with powersets, and there is no support for recursive aggregation over custom lattices. This is a problem because static analyses routinely use custom lattices and aggregation (under monotonic aggregation semantics), e.g. when analyzing a subject program with a loop and computing a fixpoint over a lattice using the least upper bound operator. Incrementalizing such computations is challenging, as aggregate results may recursively depend on themselves. It is true that certain finite lattices are expressible with powersets, so incrementalization techniques for standard Datalog may seemingly apply, but Madsen et al. explain that such encodings often incur prohibitive computational cost, while infinite lattices cannot even be expressed with powersets.

In this paper, we present an incremental analysis framework called IncA that supports recursive aggregation over custom lattices. IncA uses Datalog extended with lattices for analysis specification. IncA shields analysis developers from the details of efficient execution, as it automatically incrementalizes program analyses in the face of program changes. We develop a novel incremental solver called DRedL. DRedL extends the well-known DRed algorithm to support the standard semantics introduced by Ross and Sagiv for recursive monotonic aggregation. Our key idea is that instead of decomposing a program change into deleted and inserted tuples, DRedL works with antimonotonic and monotonic changes according to the partial order of the chosen lattice. We have formally proven that DRedL is correct and yields the exact same result as running a Datalog program from scratch. Although we apply DRedL to incrementalize program analyses, our contributions are generally applicable to any Datalog program using recursive aggregation over custom lattices.

We evaluate the applicability and performance of IncA with real-world static analyses. We implement a lattice-based points-to analysis that reasons about the potential target heap objects of variables, and we implement a number of static analyses that reason about the potential values of string-typed variables. We benchmark the analyses on open-source code bases with sizes up to 70 KLoC, and we synthesize program changes. We find that IncA consistently delivers good performance: After an initial analysis that takes a few tens of seconds, the incremental updates times are on the millisecond ballpark. The price of incrementalization is the extra memory use. We find that the memory consumption of IncA can grow large (up to 5GB), but it is not prohibitive for applications in IDEs.

# Knowledge of Uncertain Worlds: Programming with Logical Constraints (Extended Abstract)

Yanhong A. Liu (Stony Brook University)
Scott D. Stoller (Stony Brook University)

Programming with logic has allowed many design and analysis problems to be expressed more easily and clearly at a high level. Examples include problems in program analysis, network management, security frameworks, and decision support. However, when sophisticated problems require reasoning with negation and recursion, possibly causing contradiction in cyclic reasoning, programming with logic has been a challenge. Many languages and semantics have been proposed, but they have different underlying assumptions that are conflicting and subtle, and each is suitable for only certain kinds of problems.

Liu and Stoller [3] describes a unified language, DA logic, which stands for Design and Analysis logic, for programming with logic using logical constraints. It supports logic rules with unrestricted negation in recursion, as well as unrestricted universal and existential quantification. It is based on the unifying founded semantics and constraint semantics [1, 2], which give a single three-valued model and a set of two-valued models, respectively, and it supports the power and ease of programming with different intended semantics without causing contradictions in cyclic reasoning.
1. The language provides meta-constraints on predicates. These meta-constraints capture the different underlying assumptions of different logic language semantics. They indicate whether: (1) a predicate is certain (assertions of P are two-valued: true or false) or uncertain (assertions of P are three-valued: true, false, or undefined); (2) the set of rules specifying a predicate is complete (hence negative facts ¬P can be inferred using the negations of the hypotheses of those rules) or not; (3) a predicate is closed (specified assertions of the predicate are considered false if inferring any of them to be true requires assuming that some of them are true) or not.

2. The language supports the use of uncertain information in the results of different semantics, in the form of either undefined values or possible combinations of values. The assertions for which P is true, false, and undefined in founded semantics are captured using three automatically derived predicates, P.T, P.F, and P.U, respectively. The constraint semantics of a set of rules, facts, and meta-constraints is captured using an automatically derived predicate CS. For each model m in CS, the assertion CS(m) holds, and m.P captures the truth values of predicate P in m. All of these predicates can be used explicitly and directly for further reasoning, unlike with the truth values in well-founded semantics, stable model semantics, founded semantics, and constraint semantics.

3. The language further supports the use of knowledge units that can be instantiated by any new predicates, including predicates with additional arguments. A knowledge unit, abbreviated as kunit, is a set of rules, facts, and meta-constraints. A kunit K can be used in another kunit with an instantiation of the form use K (P1 = Q1(Y1,1,...,Y1,bi), ..., Pn = Qn(Yn,1,...,Yn,bn)), which replaces each occurrence Pi in K with Qi and passes Yi,1,...,Yi,bi as additional arguments to Qi. This powerful form of instantiation allows knowledge in a kunit to be re-used in any contexts.

Together, the language allows complex problems to be expressed clearly and easily, where different assumptions can be easily used, combined, and compared for expressing and solving a problem modularly, unit by unit. We discuss one example below. The paper presents additional examples for different games that show the power and ease of programming with DA logic.

Example: Unique undefined positions. In an uncertain world, among the most critical information is assertions that have a unique true or false value in all possible ways of satisfying given constraints but cannot be determined to be true by just following founded reasoning. Having both founded semantics and constraint semantics at the same time allows one to find such information.

Consider the following kunits. With default meta-constraints, win, prolog, and asp are complete, move is certain in win_unit, and unique is certain in cmp_unit. First, win_unit defines winx is a winning position if there is a move from x to y and y is not a winning position. Then, pa_unit defines prolog, asp, and move and uses win_unit. Finally, cmp_unit uses pa_unit and defines unique(x) to be true if (1) win(x) is undefined in founded semantics, (2) a constraint model of pa_unit exists, and (3) win(x) is true in all models in the constraint semantics.

    kunit win_unit:
win(x) ← move(x,y) ∧ ¬ win(y)
kunit pa_unit:
prolog ← ¬ asp
asp ← ¬ prolog
move(1,0) ← prolog
move(1,0) ← asp
closed(move)
use win_unit ()
kunit cmp_unit:
use pa_unit ()
unique(x) ← win.U(x) ∧ ∃ m ∈ pa_unit.CS ∧ ∀ m ∈ pa_unit.CS | m.win(x)


In pa_unit, founded semantics gives move.U(1,0) (because prolog and asp are undefined), win.F(0) (because there is no move from 0}, and win.U(1) (because win(1) cannot be true or false). Constraint semantics pa_unit.CS has two models: {prolog, move(1,0), win(1)} and {asp, move(1,0), win(1)}. We see that win(1) is true in all two models. So win.U(1) from founded semantics is imprecise.

In cmp_unit, by definition, unique(1) is true. That is, win(1) is undefined in founded semantics, the constraint semantics is not empty, and win(1) is true in all models of the constraint semantics. ∎

Overall, DA logic is essential for general knowledge representation and reasoning, because not only rules but also different assumptions must be captured, and these rules and different inference results must be used modularly for scaled up applications.

Acknowledgments. This work was supported in part by ONR under grant N00014-20-1-2751 and NSF under grants CCF-1954837, CCF-1414078, CNS-1421893, and IIS-1447549.

## References

1. Yanhong A. Liu & Scott D. Stoller (2018): Founded Semantics and Constraint Semantics of Logic Rules. In: Proceedings of the International Symposium on Logical Foundations of Computer Science (LFCS 2018), Lecture Notes in Computer Science 10703. Springer, pp. 221–241, doi:10.1007/978-3-319-72056-2_14.
2. Yanhong A. Liu & Scott D. Stoller (2020): Founded Semantics and Constraint Semantics of Logic Rules. Journal of Logic and Computation 30(8). To appear. Preprint available at https://arxiv.org/abs/1606.06269.
3. Yanhong A. Liu & Scott D. Stoller (2020): Knowledge of Uncertain Worlds: Programming with Logical Constraints. In: Proceedings of the International Symposium on Logical Foundations of Computer Science (LFCS 2020), Lecture Notes in Computer Science 11972. Springer, pp. 111–127, doi:10.1007/978-3-030-36755-8_8. Also https://arxiv.org/abs/1910.10346.

# A Simple Extension of Answer Set Programs to Embrace Neural Networks (Extended Abstract)

Zhun Yang (Arizona State University)
Joohyung Lee (Arizona State University; Samsung Research, S. Korea)

The integration of low-level perception with high-level reasoning is one of the oldest problems in Artificial Intelligence. Today, the topic is revisited with the recent rise of deep neural networks. However, it is still not clear how complex and high-level reasoning, such as default reasoning, ontology reasoning, and causal reasoning, can be successfully computed by these approaches. The latter subject has been well-studied in the area of knowledge representation (KR), but many KR formalisms, including answer set programming (ASP), are logic-oriented and do not incorporate high-dimensional feature space as in deep learning, which limits the applicability of KR in many practical applications.

In ([2]), we present a simple extension of answer set programs by embracing neural networks. Following the idea of DeepProbLog ([1]), by treating the neural network output as the probability distribution over atomic facts in answer set programs, the proposed formalism called NeurASP provides a simple and effective way to integrate sub-symbolic and symbolic computation.

In NeurASP, a neural network $M$ is represented by a neural atom of the form

$nn(m(e, t), \left[v_1, \dots, v_n \right])$
where
• $nn$ is a reserved keyword to denote a neural atom;
• $m$ is an identifier (symbolic name) of the neural network $M$;
• $t$ is a list of terms that serves as a "pointer" to an input tensor; related to it, there is a mapping ${\bf D}$ (implemented by an external Python code) that turns $t$ into an input tensor;
• $v_1, \dots, v_n$ represent all $n$ possible outcomes of each of the $e$ random events.

Each neural atom $~~~nn(m(e, t), \left[v_1, \dots, v_n \right])~~~$ introduces propositional atoms of the form $c= v$, where $c\in\{m_1(t), \dots, m_e(t)\}$ and $v\in\{v_1,\dots,v_n\}$. The output of the neural network provides the probabilities of the introduced atoms.

Example. $~~$ Let $M_{digit}$ be a neural network that classifies an MNIST digit image. The input of $M_{digit}$ is (a tensor representation of) an image and the output is a matrix in $\mathbb{R}^{1\times 10}$. This neural network can be represented by the neural atom "$nn( digit(1,d),\ [0,1,2,3,4,5,6,7,8,9]),$" which introduces propositional atoms "$digit_1(d)= 0$, $digit_1(d)= 1$, $\dots$, $digit_1(d)= 9$."

A NeurASP program $\Pi$ is the union of $\Pi^{asp}$ and $\Pi^{nn}$, where $\Pi^{asp}$ is a set of propositional ASP rules and $\Pi^{nn}$ is a set of neural atoms. Let $\sigma^{nn}$ be the set of all atoms $m_i(t) = v_j$ that is obtained from the neural atoms in $\Pi^{nn}$ as described above. We require that, in each rule $Head \leftarrow Body$ in $\Pi^{asp}$, no atoms in $\sigma^{nn}$ appear in $Head$.

The semantics of NeurASP defines a stable model and its associated probability originating from the neural network output. For any NeurASP program $\Pi$, we first obtain its ASP counterpart $\Pi'$ where each neural atom $~~~nn(m(e, t), \left[v_1, \dots, v_n \right])~~~$ is replaced with the set of "choice" rules

$\{m_i(t) = v_1;~ \dots ~; m_i(t) = v_n\} = 1 \hspace{2cm} \text{for } i\in \{1,\dots e\}.$

The stable models of $\Pi$ are defined as the stable models of $\Pi'$.

To define the probability of a stable model, we first define the probability $P_\Pi(m_i(t)=v_j)$ of an atom $m_i(t)= v_j$ in $\sigma^{nn}$ as the probability of the $j$-th outcome of the $i$-th event outputted by the neural network $M$ upon the input tensor pointed by ${t}$. Based on this, the probability of an interpretation $I$ is defined as follows.

$P_{\Pi}(I) = \begin{cases} \frac{\displaystyle \prod_{i, j\ :\ m_i(t)=v_j \in I|_{\sigma^{nn}}} P_{\Pi}(m_i(t)=v_j)}{Num(I|_{\sigma^{nn}}, \Pi)} & \text{if$I$is a stable model of$\Pi$;}\\ 0 & \text{otherwise} \end{cases}$

where $I|_{\sigma^{nn}}$ denotes the projection of $I$ onto $\sigma^{nn}$ and $Num(I|_{\sigma^{nn}},\Pi)$ denotes the number of stable models of $\Pi$ that agree with $I|_{\sigma^{nn}}$ on $\sigma^{nn}$.

The paper ([2]) illustrates how NeurASP can be useful for some tasks where both perception and reasoning are required. Reasoning can help identify perception mistakes that violate semantic constraints, which in turn can make perception more robust. For example, a neural network for object detection may return a bounding box and its classification "car," but it may not be clear whether it is a real car or a toy car. The distinction can be made by applying reasoning about the relations with the surrounding objects and using commonsense knowledge. In the case of a neural network that recognizes digits in a given Sudoku board, the neural network may get confused if a digit next to 1 in the same row is 1 or 2, but NeurASP could conclude that it cannot be 1 by applying the constraints for Sudoku.

NeurASP also alleviates the burden of neural networks when the constraints/knowledge are already given. Instead of building a large end-to-end neural network that learns to solve a Sudoku puzzle given as an image, we can let a neural network only do digit recognition and use ASP to find the solution of the recognized board. This makes the design of the neural network simpler and the required training dataset much smaller. Also, when we need to solve some variation of Sudoku, such as Anti-knight or Offset Sudoku, the modification is simpler than training another large neural network from scratch to solve the new puzzle.

Since NeurASP is a simple integration of ASP with neural networks, it retains each of ASP and neural networks in individual forms, and can directly utilize the advances in each of them. The current implementation is a prototype and not highly scalable due to a naive computation of enumerating stable models. The future work is to improve computational methods.

Acknowledgements. $~~$ This work was supported in part by NSF under grants IIS-1815337 and IIS-2006747.

### References

1. Robin Manhaeve, Sebastijan Dumancic, Angelika Kimmig, Thomas Demeester & Luc De Raedt (2018): DeepProblog: Neural probabilistic logic programming. In: Proceedings of Advances in Neural InformationProcessing Systems, pp. 3749 – 3759.
2. Zhun Yang, Adam Ishay & Joohyung Lee (2020): NeurASP: Embracing Neural Networks into Answer Set Programming. In: Proceedings of International Joint Conference on Artificial Intelligence (IJCAI), pp. 1755 – 1762, doi:10.24963/ijcai.2020/243.