User:Joaquin.Arias.Herrero/sandbox

s(CASP) is the name of a query-driven non-monotonic reasoner that evaluates Answer Set Programming with Constraint_programming (CASP) following a top-down execution strategy that avoids the grounding phase of standard ASP systems. Its implementation developed at IMDEA Software Institute in collaboration with the University of Texas at Dallas, and Universidad Rey Juan Carlos.

s(CASP), by Joaquín Arias, extends s(ASP) , by Kyle Marple, with constraints, XAI, and others. They avoid grounding altogether by using a combination of resolution and coinduction.

The open source s(CASP), available at is a non-monotonic reasoner, implemented in Ciao Prolog, of CASP over first-order predicates which combines ASP and constraints. It features predicates, constraints among non-ground variables, uninterpreted functions, and, most importantly, a top-down, query-driven execution strategy. These features make it possible to return answers with non-ground variables (possibly including constraints among them) and to compute partial models by returning only the fragment of a stable model that is necessary to support the answer to a given query. Thanks to its interface with constraint solvers, sound non-monotonic reasoning with constraints are possible. In addition to default negation, s(CASP) supports classical negation to capture the explicit evidence that a literal is false.

History
s(CASP) was originally developed at IMDEA Software Institute by Joaquín Arias. It extends s(ASP), developed at the University of Texas at Dallas by Kyle Marple in 2014. s(ASP) was based on adding negation as failure to logic programming under the stable model semantics regime using constructive negation.

The implementation of s(CASP) started in 2017 in collaboration with the University of Texas at Dallas. It is a logic programming language.

Applications
s(CASP) has been used in complex (real) applications that exploit its expressiveness.
 * 1) We implemented an automated reasoner that uses Event Calculus (EC) to model commonsense reasoning with a sound, logical basis (Arias et al. 2019) . Previous attempts to mechanize reasoning using EC faced difficulties in treating continuous change in dense domains (e.g., time and other physical quantities), constraints between variables, default negation, and the uniform application of different inference methods, among others. We show how EC scenarios can be elegantly modeled using the goal-directed execution model of s(CASP) and how its expressiveness makes it possible to perform deductive reasoning tasks in domains featuring constraints involving dense time and fluents with continuous properties.
 * 2) * The Event Calculus and its realization through s(CASP) is being used to model real-world avionics systems in the ARCOS DARPA project (DARPA 2019). Avionics systems are cyber-physical systems consisting of sensors and actuators. Sensors are modeled as fluents while actuator actions correspond to events. The goal is to use the s(CASP) EC model to verify (timed) properties of these avionics systems as well as to identify gaps with respect to system requirements. Abductive capabilities of s(CASP) are being used to troubleshoot the system as well as to find gaps in system design.
 * 3) s(CASP) generates justifications for Constraint Answer Set programs (Arias et al. 2020), preventing generating excessively many justifications thanks to its ground-free, top-down evaluation strategy and the use of constraints. It can also justify negated literals and integrity constraints. To the best of the authors’ knowledge, this approach is the only one that can provide full justifications in natural language for ASP programs, including constraints and negated literals.
 * 4) * As part of future work, s(CASP) justifications can be used to bring Explainable Artificial Intelligence (XAI) principles to a class of knowledge representation and reasoning systems, namely those based on non-monotonic logic with a stable model semantics. These can range from rule-based systems capturing expert knowledge (Chen et al. 2016) to ILP systems that generate ASP programs (Shakerin and Gupta 2019) or concurrent imperative programs based on behavioral, observable specifications (Varanasi et al. 2019).
 * 5) A novel semantics-driven English text to answer set program generator, developed by Kinjal Basu et al. at UT-Dallas, has been presented at the 35th AAAI Conference in 2021. They showed how commonsense reasoning coded in ASP can be leveraged to develop advanced NLU applications, such as SQuARE and StaCACK, using the s(CASP) engine to perform reasoning while generating a natural language explanation for any computed answer.
 * 6) * As part of future work, Kinjal is leading one of the nine teams selected to participate in Amazon Alexa Socialbot Grand Challenge 41. His team is developing an open-domain conversational AI chatbot based on automated commonsense reasoning that can “converse” with a human-based on “truly understanding” that person’s dialog.
 * 7) An expert system2 in been developed at the SMU Centre for Computational Law in Singapore by Jason Morris’s team. They encoded rule 34 of Singapore’s Legal Profession (Professional Conduct) Rules 2015. The front-end of the system is a web interview that will collect information from a user, run the query on s(CASP), and display the results with the corresponding explanation in English.

In addition, HackReason (https://hackreason.aisutd.org/), a hackathon around s(CASP), was organized by the UT Dallas AI Society and Dr. Gopal Gupta’s research group in Jan 2021. During the hackathon, 17 teams joined us and developed applications that rely on simulating human-style common sense reasoning using s(CASP).

Syntax
s(CASP) supports constraint answer set programming including constraint domains over dense domains, e.g., rational and/or real numbers.

An s(CASP) program is a set of clauses of the following form:

""

where a and b1, ..., bn are atoms. An atom is either a propositional variable or the expression p(t1, ..., tn) if p is an n-ary predicate symbol and t1, ..., tn are terms.

A term is either a variable xi or a function symbol f of arity n, denoted as f/n, applied to n terms, e.g., f(t1, t2, ..., tn), where each ti is in turn a term. A function symbol of arity 0 is called a constant. Program variables are usually written starting with an uppercase letter, while function and predicate symbols start with a lowercase letter. Numerical constants are written solely with digits. Therefore, s(CASP) accepts terms with the same conventions as Prolog: f(a,b) is a term, and so are f(g(X),Y) and [f(a)|Rest] (to denote a list with head f(a) and tail Rest).

A note on terminology ASP literature uses the term constraint to denote constructions such as. It means that the conjunction of atoms  cannot be true, i.e., that either p or q, or both, have to be false in any stable model. In our language, we will use as well a special class of predicates that restrict the domains of variables. The semantics of these predicates comes from the structure and domain of an underlying constraint system. Their implementation can be provided by an external library that provides suitable operations through an interface to the answer set solver. In Constraint Logic Programming (CLP), these predicates are called “constraints” as well. In order to distinguish between these two concepts, we will keep the name “constraints” for the latter (predicates restricting variable domains) and we will use the name “integrity constraints” for the former (constructions in the style of  which restrict which atoms can be true in a model).

ca is a simple constraint or a conjunction of constraints: an expression establishing relations among variables in some constraint system, as described by Marriott and Stuckey. Similar to CLP, s(CASP) is parametrized on the constraint system, from which it inherits its semantics. Since the execution of an s(CASP) program needs negating constraints, we require that the constraint system can negate constraints using a finite disjunction of basic constraints.