This document provides an introduction and overview of Answer Set Programming (ASP). It begins by explaining that ASP is a declarative problem solving approach based on logic programming and deductive databases. It then gives examples of how ASP can be used to model problems like the knapsack problem and Sudoku. The document outlines the key concepts of ASP, including positive logic programs, minimal model semantics, stable models, and extensions like disjunction and integrity constraints. It also discusses applications of ASP to semantic web problems using DL-programs and HEX-programs. The document concludes by mentioning future directions for ASP.
An overview of the intertwined history of artificial intelligence and neuroscience, with a focus on reinforcement learning.
Many suggestions for further reading are provided.
In section 2 I elaborate on the core parallel between RL and neuroscience i.e. correspondences of Temporal Difference error and dopamine response.
In section 3 I provide an example of why neuroscience is extremely useful to reinforcement learning right now. The example concerns the work from the Deep Mind team that utilizes several concepts from neuroscience to develop exceptionally effective and efficient agents performing navigation in challengeable environments.
Memetic Algorithms have become one of the key methodologies behind solvers that are capable of tackling very large, real-world, optimisation problems. They are being actively investigated in research institutions as well as broadly applied in industry. In this talk we provide a pragmatic guide on the key design issues underpinning Memetic Algorithms (MA) engineering. We begin with a brief contextual introduction to Memetic Algorithms and then move on to define a Pattern Language for MAs. For each pattern, an associated design issue is tackled and illustrated with examples from the literature. We then fast forward to the future and mention what, in our mind, are the key challenges that scientistis and practitioner will need to face if Memetic Algorithms are to remain a relevant technology in the next 20 years.
Lecture slides by Mustafa Jarrar at Birzeit University, Palestine.
See the course webpage at: http://jarrar-courses.blogspot.com/2011/12/description-logic.html
The lecture covers: Description Logic & Business Rules, In Artificial Intelligence Course, Birzeit University, Spring 2013
Lasers, Landscapes and Muddy Boots: Visualizing Laser Scanning Data Using Gam...Keith Challis
Methods of survey have developed dramatically in the recent past with the advent of new digital survey techniques, global positioning airborne and terrestrial laser scanning. The volume of data collected to record monuments and landscapes may now be vast, and levels of accuracy and precision unprecedented. This growth in data quality and volume has to some extent been accompanied by a reluctant theoretical debate, largely about method and meaning in the practice of survey. Less well explored is the area of visualisation of survey results, which has tended to remain rooted in traditional approaches, albeit facilitated by new digital media. The ability of modern digital survey to engage with others areas of archaeological debate, for example discussions of sense of place, meaning and interpretation in landscape, as embodied by for example the phenomenological approach to landscape has largely been ignored as it is poorly addressed using conventional static visualisation techniques. This paper explores the potential of computer game software to produce accurate, immersive and interactive visualisations of digital survey data of archaeological monuments.
GDSC SSN - solution Challenge : Fundamentals of Decision MakingGDSCSSN
This session aims to provide participants with a comprehensive understanding of decision-making fundamentals in AI/ML, covering key concepts like reinforcement learning, different representations, and an exploration of current state-of-the-art methodologies.
An overview of the intertwined history of artificial intelligence and neuroscience, with a focus on reinforcement learning.
Many suggestions for further reading are provided.
In section 2 I elaborate on the core parallel between RL and neuroscience i.e. correspondences of Temporal Difference error and dopamine response.
In section 3 I provide an example of why neuroscience is extremely useful to reinforcement learning right now. The example concerns the work from the Deep Mind team that utilizes several concepts from neuroscience to develop exceptionally effective and efficient agents performing navigation in challengeable environments.
Memetic Algorithms have become one of the key methodologies behind solvers that are capable of tackling very large, real-world, optimisation problems. They are being actively investigated in research institutions as well as broadly applied in industry. In this talk we provide a pragmatic guide on the key design issues underpinning Memetic Algorithms (MA) engineering. We begin with a brief contextual introduction to Memetic Algorithms and then move on to define a Pattern Language for MAs. For each pattern, an associated design issue is tackled and illustrated with examples from the literature. We then fast forward to the future and mention what, in our mind, are the key challenges that scientistis and practitioner will need to face if Memetic Algorithms are to remain a relevant technology in the next 20 years.
Lecture slides by Mustafa Jarrar at Birzeit University, Palestine.
See the course webpage at: http://jarrar-courses.blogspot.com/2011/12/description-logic.html
The lecture covers: Description Logic & Business Rules, In Artificial Intelligence Course, Birzeit University, Spring 2013
Lasers, Landscapes and Muddy Boots: Visualizing Laser Scanning Data Using Gam...Keith Challis
Methods of survey have developed dramatically in the recent past with the advent of new digital survey techniques, global positioning airborne and terrestrial laser scanning. The volume of data collected to record monuments and landscapes may now be vast, and levels of accuracy and precision unprecedented. This growth in data quality and volume has to some extent been accompanied by a reluctant theoretical debate, largely about method and meaning in the practice of survey. Less well explored is the area of visualisation of survey results, which has tended to remain rooted in traditional approaches, albeit facilitated by new digital media. The ability of modern digital survey to engage with others areas of archaeological debate, for example discussions of sense of place, meaning and interpretation in landscape, as embodied by for example the phenomenological approach to landscape has largely been ignored as it is poorly addressed using conventional static visualisation techniques. This paper explores the potential of computer game software to produce accurate, immersive and interactive visualisations of digital survey data of archaeological monuments.
GDSC SSN - solution Challenge : Fundamentals of Decision MakingGDSCSSN
This session aims to provide participants with a comprehensive understanding of decision-making fundamentals in AI/ML, covering key concepts like reinforcement learning, different representations, and an exploration of current state-of-the-art methodologies.
Slides for a Course Based on the Text Discrete Mathematics & Its Applications (5th Edition) by Kenneth H. Rosen
Slides for a Course Based on the Text Discrete Mathematics & Its Applications (5th Edition) by Kenneth H. Rosen
The NLP muppets revolution! @ Data Science London 2019
video: https://skillsmatter.com/skillscasts/13940-a-deep-dive-into-contextual-word-embeddings-and-understanding-what-nlp-models-learn
event: https://www.meetup.com/Data-Science-London/events/261483332/
I am Simon M. I am a Stochastic Processes Assignment Expert at statisticshomeworkhelper.com. I hold a Ph.D. in Stochastic Processes, from Texas, USA. I have been helping students with their homework for the past 7 years. I solve assignments related to Stochastic Processes. Visit statisticshomeworkhelper.com or email info@statisticshomeworkhelper.com. You can also call on +1 678 648 4277 for any assistance with Stochastic Processes Assignments.
Vector space models (VSMs) are mathematically
well-defined frameworks that have been widely used in text processing. This paper introduces a new method, called Random Manhattan Indexing (RMI), for the construction of l1 normed VSMs at reduced dimensionality. RMI combines the construction of a VSM and dimension reduction into an incremental, and thus scalable, procedure. In order to attain its goal, RMI employs the sparse Cauchy random projections.
Extracting Information for Context-aware Meeting Preparationnet2-project
People working in an office environment suffer from large volumes of information that they need to manage and access. Frequently, the problem is due to machines not being able to recognise the many implicit relationships between office artefacts, and also due to them not being aware of the context surrounding them. In order to expose these relationships and enrich artefact context, text analytics can be employed over semi-structured and unstructured content, including free text. In this paper, we explain how this strategy is applied together with for a specific use-case: supporting the attendees of a calendar event to prepare for the meeting.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
UiPath Test Automation using UiPath Test Suite series, part 4
Exchanging More than Complete Data
1. An Answer Set Programming Tutorial
Minh Dao-Tran
Institut für Informationsysteme, TU Wien
Supported by Austrian Science Fund (FWF) project P20841, and the Marie Curie action IRSES
under Grant No. 2476
Based on slides from Thomas Eiter, Giovambattista Ianni, Thomas Krennwallner in the Reasoning Web Summer School 2009
and slides from Torsten Schaub
DERI, July 2011
2. An Answer Set Programming Tutorial
Outline
1. Introduction
2. Horn Logic Programming
2.1 Positive Logic Programs
2.2 Minimal Model Semantics
3. Stable Logic Programming
4. Extensions
4.1 Disjunction
4.2 Integrity Constraints
5. Answer Set for the Semantic Web
5.1 DL-Programs
5.2 HEX-Programs
6. Future Directions of ASP
Minh Dao-Tran DERI, July 2011 1/33
3. An Answer Set Programming Tutorial 1. Introduction
Introduction
Answer Set Programming (ASP) is a recent problem solving
approach
ASP has its roots in:
• (logic-based) knowledge representation and reasoning
• (deductive) databases
• constraint solving, SAT solving
• logic programming (with negation)
ASP allows for solving all search problems in NP (and NPNP ) in a
uniform way
Minh Dao-Tran DERI, July 2011 2/33
4. An Answer Set Programming Tutorial 1. Introduction
Knapsack Problem
Minh Dao-Tran DERI, July 2011 3/33
5. An Answer Set Programming Tutorial 1. Introduction
Sudoku
6 1 4 5
8 3 5 6
2 1
8 4 7 6
6 3
7 9 1 4
5 2
7 2 6 9
4 5 8 7
Task:
Fill in the grid so that every row, every column, and every 3x3 box
contains the digits 1 through 9.
Minh Dao-Tran DERI, July 2011 4/33
6. An Answer Set Programming Tutorial 1. Introduction
Wanted!
A general-purpose, declarative approach for modeling and solving
these and many other problems.
Declarative:
• “What is the problem?”
instead of
• “How to solve the problem?”
Minh Dao-Tran DERI, July 2011 5/33
7. An Answer Set Programming Tutorial 1. Introduction
Wanted!
A general-purpose, declarative approach for modeling and solving
these and many other problems.
Declarative:
• “What is the problem?”
instead of
• “How to solve the problem?”
Proposal:
Answer Set Programming (ASP) paradigm!
Minh Dao-Tran DERI, July 2011 5/33
8. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Positive Logic Programs
Definition (Positive Logic Program)
A positive logic program P is a finite set of clauses (rules) in the form
a ← b1 , . . . , bm
where a, b1 , . . . , bm are atoms of a first-order language L.
a is the head of the rule
b1 , . . . , bm is the body of the rule.
If m = 0, the rule is a fact (written shortly a)
Minh Dao-Tran DERI, July 2011 6/33
9. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Positive Logic Programs
Definition (Positive Logic Program)
A positive logic program P is a finite set of clauses (rules) in the form
a ← b1 , . . . , bm
where a, b1 , . . . , bm are atoms of a first-order language L.
a is the head of the rule
b1 , . . . , bm is the body of the rule.
If m = 0, the rule is a fact (written shortly a)
Example
prof (supervisor(X)) ← phd_student(X).
poor(X) ← phd_student(X).
phd_student(Y) ← phd_student(X), couple(X, Y).
Minh Dao-Tran DERI, July 2011 6/33
10. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Herbrand Semantics by an Example
A logic program P:
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
Constant symbols: peter, jane; Function symbols: supervisor.
Minh Dao-Tran DERI, July 2011 7/33
11. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Herbrand Semantics by an Example
A logic program P:
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
Constant symbols: peter, jane; Function symbols: supervisor.
Herbrand Universe
peter, supervisor(peter), supervisor(supervisor(peter)), . . . ,
HU(P) =
jane, supervisor(jane), supervisor(supervisor(jane)), . . .
Minh Dao-Tran DERI, July 2011 7/33
14. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Grounding
Grounding a rule
r = poor(X) ← phd_student(X).
A ground instance of r is obtained by replacing its variables by terms from HU P .
poor(peter) ← phd_student(peter).
poor(jane) ← phd_student(jane).
grnd(r) = poor(supervisor(peter)) ← phd_student(supervisor(peter)).
.
.
.
Grounding a program
grnd(P) = r∈P grnd(r)
Minh Dao-Tran DERI, July 2011 8/33
15. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Herbrand Models
Definition (Model, satisfaction)
An interpretation I is a (Herbrand) model of a
a ground (variable-free) rule r = a ← b1 , . . . , bm , if either
{b1 , . . . , bm } I or a ∈ I ; (I |= r)
a rule r, if I |= r for every r ∈ grnd(r); (I |= r)
a program P, if I |= r for every rule r in P. (I |= P)
Minh Dao-Tran DERI, July 2011 9/33
16. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Example (Program P)
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
Which of the following interpretations are models of P?
I1 = ∅
I2 = HB(P)
phd_student(peter), couple(peter, jane), phd_student(jane),
I3 =
poor(peter), poor(jane), prof (supervisor(peter))
Minh Dao-Tran DERI, July 2011 10/33
17. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Example (Program P)
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
Which of the following interpretations are models of P?
I1 = ∅ no
I2 = HB(P)
phd_student(peter), couple(peter, jane), phd_student(jane),
I3 =
poor(peter), poor(jane), prof (supervisor(peter))
Minh Dao-Tran DERI, July 2011 10/33
18. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Example (Program P)
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
Which of the following interpretations are models of P?
I1 = ∅ no
I2 = HB(P) yes
phd_student(peter), couple(peter, jane), phd_student(jane),
I3 =
poor(peter), poor(jane), prof (supervisor(peter))
Minh Dao-Tran DERI, July 2011 10/33
19. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.1 Positive Logic Programs
Example (Program P)
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
Which of the following interpretations are models of P?
I1 = ∅ no
I2 = HB(P) yes
phd_student(peter), couple(peter, jane), phd_student(jane),
I3 = no
poor(peter), poor(jane), prof (supervisor(peter))
Minh Dao-Tran DERI, July 2011 10/33
20. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.2 Minimal Model Semantics
Minimal Model Semantics
Prefer models with true-part as small as possible.
Definition
A model I of P is minimal, if there exists no model J of P such that J ⊂ I .
Minh Dao-Tran DERI, July 2011 11/33
21. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.2 Minimal Model Semantics
Minimal Model Semantics
Prefer models with true-part as small as possible.
Definition
A model I of P is minimal, if there exists no model J of P such that J ⊂ I .
Theorem
Every logic program P has a single minimal model (called the least
model), denoted LM(P).
Minh Dao-Tran DERI, July 2011 11/33
22. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.2 Minimal Model Semantics
Computation
The minimal model can be computed via fixpoint iteration.
Example
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
0
TP = ∅
Minh Dao-Tran DERI, July 2011 12/33
23. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.2 Minimal Model Semantics
Computation
The minimal model can be computed via fixpoint iteration.
Example
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
0
TP = ∅
1
TP = {phd_student(peter), couple(peter, jane)}
Minh Dao-Tran DERI, July 2011 12/33
24. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.2 Minimal Model Semantics
Computation
The minimal model can be computed via fixpoint iteration.
Example
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
0
TP = ∅
1
TP = {phd_student(peter), couple(peter, jane)}
2 phd_student(peter), couple(peter, jane), phd_student(jane),
TP =
poor(peter), prof (supervisor(peter))
Minh Dao-Tran DERI, July 2011 12/33
25. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.2 Minimal Model Semantics
Computation
The minimal model can be computed via fixpoint iteration.
Example
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
0
TP = ∅
1
TP = {phd_student(peter), couple(peter, jane)}
2 phd_student(peter), couple(peter, jane), phd_student(jane),
TP =
poor(peter), prof (supervisor(peter))
phd_student(peter), couple(peter, jane), phd_student(jane),
3
TP = poor(peter), prof (supervisor(peter)), poor(jane),
prof (supervisor(jane))
Minh Dao-Tran DERI, July 2011 12/33
26. An Answer Set Programming Tutorial 2. Horn Logic Programming 2.2 Minimal Model Semantics
Computation
The minimal model can be computed via fixpoint iteration.
Example
prof (supervisor(X)) ← phd_student(X). phd_student(peter).
poor(X) ← phd_student(X). couple(peter, jane).
phd_student(Y) ← phd_student(X), couple(X, Y).
0
TP = ∅
1
TP = {phd_student(peter), couple(peter, jane)}
2 phd_student(peter), couple(peter, jane), phd_student(jane),
TP =
poor(peter), prof (supervisor(peter))
phd_student(peter), couple(peter, jane), phd_student(jane),
3
TP = poor(peter), prof (supervisor(peter)), poor(jane),
prof (supervisor(jane))
4 3
TP = TP
Minh Dao-Tran DERI, July 2011 12/33
27. An Answer Set Programming Tutorial 3. Stable Logic Programming
Negation in Logic Programs
Why negation?
Natural linguistic concept
Facilitates convenient, declarative descriptions (definitions)
E.g., "Men who are not husbands are singles.”
Minh Dao-Tran DERI, July 2011 13/33
28. An Answer Set Programming Tutorial 3. Stable Logic Programming
Negation in Logic Programs
Why negation?
Natural linguistic concept
Facilitates convenient, declarative descriptions (definitions)
E.g., "Men who are not husbands are singles.”
Definition
A normal logic program is a set of rules of the form
a ← b1 , . . . , bm , not c1 , . . . , not cn (n, m ≥ 0) (1)
where a and all bi , cj are atoms in a first-order language L.
not is called “negation as failure”, “default negation”, or “weak negation”
Things get more complex!
Minh Dao-Tran DERI, July 2011 13/33
29. An Answer Set Programming Tutorial 3. Stable Logic Programming
Stable model semantics
First, for variable-free (ground) programs P
Treat “not ” specially
Intuitively, literals not a are a source of “contradiction” or “unstability”.
Minh Dao-Tran DERI, July 2011 14/33
30. An Answer Set Programming Tutorial 3. Stable Logic Programming
Stable model semantics
First, for variable-free (ground) programs P
Treat “not ” specially
Intuitively, literals not a are a source of “contradiction” or “unstability”.
Example (Dilbert, program P2 )
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
Minh Dao-Tran DERI, July 2011 14/33
31. An Answer Set Programming Tutorial 3. Stable Logic Programming
Stable model semantics
First, for variable-free (ground) programs P
Treat “not ” specially
Intuitively, literals not a are a source of “contradiction” or “unstability”.
Example (Dilbert, program P2 )
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
M = {man(dilbert)}, get {man(dilbert), single(dilbert), husband(dilbert)}
Minh Dao-Tran DERI, July 2011 14/33
32. An Answer Set Programming Tutorial 3. Stable Logic Programming
Stable model semantics
First, for variable-free (ground) programs P
Treat “not ” specially
Intuitively, literals not a are a source of “contradiction” or “unstability”.
Example (Dilbert, program P2 )
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
M = {man(dilbert), single(dilbert), husband(dilbert)}, get {man(dilbert)}.
Minh Dao-Tran DERI, July 2011 14/33
33. An Answer Set Programming Tutorial 3. Stable Logic Programming
Stable Models
Definition (Gelfond-Lifschitz Reduct PM 1988)
The GL-reduct (simply reduct) of a ground program P w.r.t. an
interpretation M , denoted PM , is the program obtained from P by
1 removing rules with not a in the body for each a ∈ M ; and
2 removing literals not a from all other rules.
Minh Dao-Tran DERI, July 2011 15/33
34. An Answer Set Programming Tutorial 3. Stable Logic Programming
Stable Models
Definition (Gelfond-Lifschitz Reduct PM 1988)
The GL-reduct (simply reduct) of a ground program P w.r.t. an
interpretation M , denoted PM , is the program obtained from P by
1 removing rules with not a in the body for each a ∈ M ; and
2 removing literals not a from all other rules.
Intuition:
M makes an assumption about what is true and what is false.
The reduct PM incorporates this assumptions.
As a “not ”-free program, PM derives positive facts, given by LM(PM ).
If this coincides with M , then the assumption of M is “stable”.
Minh Dao-Tran DERI, July 2011 15/33
35. An Answer Set Programming Tutorial 3. Stable Logic Programming
Stable Models
Definition (Gelfond-Lifschitz Reduct PM 1988)
The GL-reduct (simply reduct) of a ground program P w.r.t. an
interpretation M , denoted PM , is the program obtained from P by
1 removing rules with not a in the body for each a ∈ M ; and
2 removing literals not a from all other rules.
Intuition:
M makes an assumption about what is true and what is false.
The reduct PM incorporates this assumptions.
As a “not ”-free program, PM derives positive facts, given by LM(PM ).
If this coincides with M , then the assumption of M is “stable”.
Definition (stable model)
An interpretation M of P is a stable model of P, if M = LM(PM ).
Minh Dao-Tran DERI, July 2011 15/33
36. An Answer Set Programming Tutorial 3. Stable Logic Programming
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
Candidate interpretations:
M1 = {man(dilbert), single(dilbert)},
M2 = {man(dilbert), husband(dilbert)},
M3 = {man(dilbert), single(dilbert), husband(dilbert)},
M4 = {man(dilbert)}
Minh Dao-Tran DERI, July 2011 16/33
37. An Answer Set Programming Tutorial 3. Stable Logic Programming
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
Candidate interpretations:
M1 = {man(dilbert), single(dilbert)},
M2 = {man(dilbert), husband(dilbert)},
M3 = {man(dilbert), single(dilbert), husband(dilbert)},
M4 = {man(dilbert)}
M1 and M2 are stable models.
Minh Dao-Tran DERI, July 2011 16/33
38. An Answer Set Programming Tutorial 3. Stable Logic Programming
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
M1 = {man(dilbert), single(dilbert)}:
Minh Dao-Tran DERI, July 2011 17/33
39. An Answer Set Programming Tutorial 3. Stable Logic Programming
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
M1 = {man(dilbert), single(dilbert)}:
reduct PM1 :
2
man(dilbert).
single(dilbert) ← man(dilbert).
The least model of PM1 is {man(dilbert), single(dilbert)} = M1 .
2
Minh Dao-Tran DERI, July 2011 17/33
40. An Answer Set Programming Tutorial 3. Stable Logic Programming
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
M1 = {man(dilbert), single(dilbert)}:
reduct PM1 :
2
man(dilbert).
single(dilbert) ← man(dilbert).
The least model of PM1 is {man(dilbert), single(dilbert)} = M1 .
2
M2 = {man(dilbert), husband(dilbert)}: by symmetry of husband and
single, also M2 is stable.
Minh Dao-Tran DERI, July 2011 17/33
41. An Answer Set Programming Tutorial 3. Stable Logic Programming
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
M3 = {man(dilbert), single(dilbert), husband(dilbert)}:
Minh Dao-Tran DERI, July 2011 18/33
42. An Answer Set Programming Tutorial 3. Stable Logic Programming
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
M3 = {man(dilbert), single(dilbert), husband(dilbert)}:
PM3 is
2
man(dilbert).
LM(PM3 ) = {man(dilbert)} = M3 .
2
Minh Dao-Tran DERI, July 2011 18/33
43. An Answer Set Programming Tutorial 3. Stable Logic Programming
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
M3 = {man(dilbert), single(dilbert), husband(dilbert)}:
PM3 is
2
man(dilbert).
LM(PM3 ) = {man(dilbert)} = M3 .
2
M4 = {man(dilbert)}:
Minh Dao-Tran DERI, July 2011 18/33
44. An Answer Set Programming Tutorial 3. Stable Logic Programming
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ← man(dilbert), not husband(dilbert). (r1 )
husband(dilbert) ← man(dilbert), not single(dilbert). (r2 )
M3 = {man(dilbert), single(dilbert), husband(dilbert)}:
PM3 is
2
man(dilbert).
LM(PM3 ) = {man(dilbert)} = M3 .
2
M4 = {man(dilbert)}:
PM4 is
2
man(dilbert).
single(dilbert) ← man(dilbert).
husband(dilbert) ← man(dilbert).
LM(PM4 ) = {man(dilbert), single(dilbert), husband(dilbert)} = M4 .
2
Minh Dao-Tran DERI, July 2011 18/33
45. An Answer Set Programming Tutorial 3. Stable Logic Programming
Programs with Variables
As for positive programs, view a program rule as a shorthand for all
its ground instances.
Recall: grnd(P) is the grounding of program P.
Definition (stable model, general case)
An interpretation M of P is a stable model of P, if M is a stable model of
grnd(P).
Minh Dao-Tran DERI, July 2011 19/33
48. An Answer Set Programming Tutorial 4. Extensions 4.1 Disjunction
Disjunction
The use of disjunction is natural to express indefinite knowledge.
Minh Dao-Tran DERI, July 2011 21/33
49. An Answer Set Programming Tutorial 4. Extensions 4.1 Disjunction
Disjunction
The use of disjunction is natural to express indefinite knowledge.
Example
female(X) ∨ male(X) ← person(X).
single(dilbert) ∨ husband(dilbert) ← man(dilbert).
Minh Dao-Tran DERI, July 2011 21/33
50. An Answer Set Programming Tutorial 4. Extensions 4.1 Disjunction
Disjunction
The use of disjunction is natural to express indefinite knowledge.
Example
female(X) ∨ male(X) ← person(X).
single(dilbert) ∨ husband(dilbert) ← man(dilbert).
Disjunction is natural for expressing a “guess” and to create
non-determinism
Minh Dao-Tran DERI, July 2011 21/33
51. An Answer Set Programming Tutorial 4. Extensions 4.1 Disjunction
Disjunction
The use of disjunction is natural to express indefinite knowledge.
Example
female(X) ∨ male(X) ← person(X).
single(dilbert) ∨ husband(dilbert) ← man(dilbert).
Disjunction is natural for expressing a “guess” and to create
non-determinism
Example
ok(C) ∨ notok(C) ← component(C).
Minh Dao-Tran DERI, July 2011 21/33
52. An Answer Set Programming Tutorial 4. Extensions 4.2 Integrity Constraints
Integrity Constraints
Adding
fail ← b1 , . . . , bm , not c1 , . . . , not cn , not fail.
to P “kills” all stable models of P that
• contain b1 , . . . , bm , and
• do not contain c1 , . . . , cn
This is convenient to eliminate scenarios which does not satisfy
integrity constraints.
Minh Dao-Tran DERI, July 2011 22/33
53. An Answer Set Programming Tutorial 4. Extensions 4.2 Integrity Constraints
Integrity Constraints
Adding
fail ← b1 , . . . , bm , not c1 , . . . , not cn , not fail.
to P “kills” all stable models of P that
• contain b1 , . . . , bm , and
• do not contain c1 , . . . , cn
This is convenient to eliminate scenarios which does not satisfy
integrity constraints.
Short:
Integrity Constraint
← b1 , . . . , bm , not c1 , . . . , not cn .
Minh Dao-Tran DERI, July 2011 22/33
54. An Answer Set Programming Tutorial 4. Extensions 4.2 Integrity Constraints
Example (P2 cont’d)
man(dilbert). (f1 )
single(dilbert) ∨ husband(dilbert) ← man(dilbert). (r1 )
← husband(X), not wedding_ring(X). (c1 )
The constraint c1 eliminates models in which there is no evidence for
a husband having a wedding ring.
Single stable model: M1 = {man(dilbert), single(dilbert)}
Minh Dao-Tran DERI, July 2011 23/33
55. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web
Answer Set Solvers
DLV1 http://www.dbai.tuwien.ac.at/proj/dlv/
Smodels2 http://www.tcs.hut.fi/Software/smodels/
GnT http://www.tcs.hut.fi/Software/gnt/
Cmodels http://www.cs.utexas.edu/users/tag/cmodels/
ASSAT http://assat.cs.ust.hk/
NoMore(++) http://www.cs.uni-potsdam.de/~linke/nomore/
Platypus http://www.cs.uni-potsdam.de/platypus/
clasp http://www.cs.uni-potsdam.de/clasp/
XASP http://xsb.sourceforge.net/, distributed with XSB
aspps http://www.cs.engr.uky.edu/ai/aspps/
ccalc http://www.cs.utexas.edu/users/tag/cc/
1
+ many extensions, e.g., DLVEX, DLVHEX, DLVDB , DLT, DLV-Complex
2
+ Smodels_cc
Minh Dao-Tran DERI, July 2011 24/33
56. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web
Answer Set Programming Systems for Debian/Ubuntu
Easy to install:
• $ sudo add-apt-repository ppa:tkren/asp
• $ sudo apt-get update
• $ sudo apt-get install clasp gringo potassco-guide
dlv-installer
With the next version of Ubuntu in October 2011, clasp and gringo
will be built in
More details at
http://www.kr.tuwien.ac.at/staff/tkren/deb.html
Minh Dao-Tran DERI, July 2011 25/33
57. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.1 DL-Programs
DL-Programs
A clean approach to combine description logics and logic programs
under answer set semantics
A dl-program consists of two parts:
a logic program P,
a description logic knowledge base L
L is accessible from P by means of dl-atoms.
ASP Solver ? DL Engine
Minh Dao-Tran DERI, July 2011 26/33
58. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.1 DL-Programs
The famous tweety example
Flier ¬NonFlier, Penguin Bird,
L= Penguin NonFlier, —————–
Bird Flier
Bird(tweety), Penguin(joe)
Minh Dao-Tran DERI, July 2011 27/33
59. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.1 DL-Programs
The famous tweety example
Flier ¬NonFlier, Penguin Bird,
L= Penguin NonFlier, —————–
Bird Flier
Bird(tweety), Penguin(joe)
flies(X) ← DL[Flier flies; Bird](X),
P=
not DL[Flier flies; ¬Flier](X).
Minh Dao-Tran DERI, July 2011 27/33
60. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.1 DL-Programs
The famous tweety example
Flier ¬NonFlier, Penguin Bird,
L= Penguin NonFlier, —————–
Bird Flier
Bird(tweety), Penguin(joe)
flies(X) ← DL[Flier flies; Bird](X),
P=
not DL[Flier flies; ¬Flier](X).
The dl-atom device
Can specify a query to L:
DL[Bird](X)
DL[Bird](tweety) true for y s.t. L |= Bird(tweety).
Minh Dao-Tran DERI, July 2011 27/33
61. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.1 DL-Programs
The famous tweety example
Flier ¬NonFlier, Penguin Bird,
L= Penguin NonFlier, —————–
Bird Flier
Bird(tweety), Penguin(joe)
flies(X) ← DL[Flier flies; Bird](X),
P=
not DL[Flier flies; ¬Flier](X).
The dl-atom device
Can specify a query to L:
DL[Bird](X)
DL[Bird](tweety) true for y s.t. L |= Bird(tweety).
Can push knowledge to L before querying:
DL[Flier flies; ¬Flier](X).
Minh Dao-Tran DERI, July 2011 27/33
62. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
HEX-programs
Extends dl-programs from one-to-one coupling to many-one.
• Outer Knowledge sources are not constrained to DL knowledge
bases only.
Minh Dao-Tran DERI, July 2011 28/33
63. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
HEX-programs
Extends dl-programs from one-to-one coupling to many-one.
• Outer Knowledge sources are not constrained to DL knowledge
bases only.
P can interface multiple external sources of knowledge of any sort
via so called external atoms
Minh Dao-Tran DERI, July 2011 28/33
64. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
HEX-programs
Extends dl-programs from one-to-one coupling to many-one.
• Outer Knowledge sources are not constrained to DL knowledge
bases only.
P can interface multiple external sources of knowledge of any sort
via so called external atoms
P has higher order atoms
Minh Dao-Tran DERI, July 2011 28/33
65. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
An example
subRelation(brotherOf , relativeOf ).
brotherOf (john, al).
relativeOf (john, joe).
brotherOf (al, mick).
invites(john, X) ∨ skip(X) ← X = john, &reach[relativeOf , john](X).
R(X, Y) ← subRelation(P, R), P(X, Y).
someInvited ← invites(john, X).
← not someInvited.
← °s[invites](Min, Max), Max > 2.
Example
Input: Some data about John’s neighborhood
Output: Possible picks for persons John might want to invite, according to some
constraints
Minh Dao-Tran DERI, July 2011 29/33
66. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
An example
subRelation(brotherOf , relativeOf ).
brotherOf (john, al).
relativeOf (john, joe).
brotherOf (al, mick).
invites(john, X) ∨ skip(X) ← X = john, &reach[relativeOf , john](X).
R(X, Y) ← subRelation(P, R), P(X, Y).
someInvited ← invites(john, X).
← not someInvited.
← °s[invites](Min, Max), Max > 2.
Example
Input: Some data about John’s neighborhood
Output: Possible picks for persons John might want to invite, according to some
constraints
Minh Dao-Tran DERI, July 2011 29/33
67. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
An example
subRelation(brotherOf , relativeOf ).
brotherOf (john, al).
relativeOf (john, joe).
brotherOf (al, mick).
invites(john, X) ∨ skip(X) ← X = john, &reach[relativeOf , john](X).
R(X, Y) ← subRelation(P, R), P(X, Y).
someInvited ← invites(john, X).
← not someInvited.
← °s[invites](Min, Max), Max > 2.
Example
Input: Some data about John’s neighborhood
Output: Possible picks for persons John might want to invite, according to some
constraints
Minh Dao-Tran DERI, July 2011 29/33
68. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
An example
subRelation(brotherOf , relativeOf ).
brotherOf (john, al).
relativeOf (john, joe).
brotherOf (al, mick).
invites(john, X) ∨ skip(X) ← X = john, &reach[relativeOf , john](X).
R(X, Y) ← subRelation(P, R), P(X, Y).
someInvited ← invites(john, X).
← not someInvited.
← °s[invites](Min, Max), Max > 2.
Example
Input: Some data about John’s neighborhood
Output: Possible picks for persons John might want to invite, according to some
constraints
Minh Dao-Tran DERI, July 2011 29/33
69. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
Higher order atoms
subRelation(brotherOf , relativeOf ).
R(X, Y) ← subRelation(P, R), P(X, Y).
brotherOf (john, al).
relativeOf (john, joe).
brotherOf (al, mick).
The device of higher order atoms
Predicate names can be variables
Constants can appear both as terms values or as predicate values
Minh Dao-Tran DERI, July 2011 30/33
70. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
Higher order atoms
subRelation(brotherOf , relativeOf ).
R(X, Y) ← subRelation(P, R), P(X, Y).
brotherOf (john, al).
relativeOf (john, joe).
brotherOf (al, mick).
The device of higher order atoms
Predicate names can be variables
Constants can appear both as terms values or as predicate values
Minh Dao-Tran DERI, July 2011 30/33
71. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
Higher order atoms
subRelation(brotherOf , relativeOf ).
R(X, Y) ← subRelation(P, R), P(X, Y).
brotherOf (john, al).
relativeOf (john, joe).
brotherOf (al, mick).
The device of higher order atoms
Predicate names can be variables
Constants can appear both as terms values or as predicate values
Minh Dao-Tran DERI, July 2011 30/33
72. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
Higher order atoms
subRelation(brotherOf , relativeOf ).
R(X, Y) ← subRelation(P, R), P(X, Y).
brotherOf (john, al).
relativeOf (john, joe).
brotherOf (al, mick).
The device of higher order atoms
Predicate names can be variables
Constants can appear both as terms values or as predicate values
Allows (comfortable) meta-reasoning
subRelation(brotherOf , relativeOf ).
R(X, Y) ← subRelation(P, R), P(X, Y).
Minh Dao-Tran DERI, July 2011 30/33
73. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
Higher order atoms
subRelation(brotherOf , relativeOf ).
R(X, Y) ← subRelation(P, R), P(X, Y).
brotherOf (john, al).
relativeOf (john, joe).
brotherOf (al, mick).
The device of higher order atoms
Predicate names can be variables
Constants can appear both as terms values or as predicate values
Allows (comfortable) meta-reasoning
subRelation(brotherOf , relativeOf ). ⇒ relativeOf (X, Y) ← brotherOf (X, Y).
R(X, Y) ← subRelation(P, R), P(X, Y).
Minh Dao-Tran DERI, July 2011 30/33
74. An Answer Set Programming Tutorial 5. Answer Set for the Semantic Web 5.2 HEX-Programs
External atoms
&reach[relativeOf , john](X) (2)
°s[invites](Min, Max) (3)
The device of external atoms
Each external predicate is tied to a corresponding evaluation
function
E.g. &reach corresponds to f&reach .
For a given interpretation I , I |= &reach[relativeOf , john](x) if
f&reach (I, relativeOf , john) = 1
Minh Dao-Tran DERI, July 2011 31/33
75. An Answer Set Programming Tutorial 6. Future Directions of ASP
Current state-of-the-art
Semantics
Introduction of Function Symbols [Syrjänen, 2001],[Bonatti,
2004],[Calimeri et al., 2008],[Šimkus and Eiter, 2007],[Eiter and Šimkus,
2009]
Modularity [Dao-Tran et al., 2009],[Janhunen et al., 2007],[Oikarinen and
Janhunen, 2008],[Tari et al., 2005],[Balduccini, 2007],[Baral et al.,
2006],[Calimeri and Ianni, 2006],[Polleres et al., 2006],[Analyti et al., 2008]
Study of equivalence [Lifschitz et al., 2001],[Gelfond, 2008],[Eiter et al.,
2007],[Eiter et al., 2004],[Woltran, 2008]
Minh Dao-Tran DERI, July 2011 32/33
76. An Answer Set Programming Tutorial 6. Future Directions of ASP
Current state-of-the-art
Semantics
Introduction of Function Symbols [Syrjänen, 2001],[Bonatti,
2004],[Calimeri et al., 2008],[Šimkus and Eiter, 2007],[Eiter and Šimkus,
2009]
Modularity [Dao-Tran et al., 2009],[Janhunen et al., 2007],[Oikarinen and
Janhunen, 2008],[Tari et al., 2005],[Balduccini, 2007],[Baral et al.,
2006],[Calimeri and Ianni, 2006],[Polleres et al., 2006],[Analyti et al., 2008]
Study of equivalence [Lifschitz et al., 2001],[Gelfond, 2008],[Eiter et al.,
2007],[Eiter et al., 2004],[Woltran, 2008]
Engineering
Debuggers [El-Khatib et al., 2005],[Brain and Vos, 2005] and in-database
evaluation [Terracina et al., 2008]
See the SEA workshop series http://sea07.cs.bath.ac.uk/
Minh Dao-Tran DERI, July 2011 32/33
77. An Answer Set Programming Tutorial 6. Future Directions of ASP
Current state-of-the-art II
Scalability
Intelligent and lazy grounders [Calimeri et al., 2008],[Gebser et al.,
2008],[Palù et al., 2008], [Lefévre and Nicolas, 2008]
Incremental reasoning [Gebser et al., 2011]
See the Answer Set Programming competition
http://www.cs.kuleuven.be/∼dtai/events/ASP-competition/
https://www.mat.unical.it/aspcomp2011
Minh Dao-Tran DERI, July 2011 33/33
78. An Answer Set Programming Tutorial 7. Playing with ASP
xkcd Knapsack
order(Food) ∨ skip(Food) ← menu(Food, _).
ok ← 825 ≤ #sum{Price : order(Food), menu(Food, Price)} ≤ 825.
← not ok.
menu(mixed_fruit, 215).
menu(french_fries, 275).
menu(side_salad, 335).
menu(host_wings, 355).
menu(mozzarella_sticks, 420).
menu(samples_place, 580).
Minh Dao-Tran DERI, July 2011 34/33
79. An Answer Set Programming Tutorial 7. Playing with ASP
Graph 3-Coloring
r(X) ∨ g(X) ∨ b(X) ← node(X).
← edge(X, Y), r(X), r(Y).
← edge(X, Y), g(X), g(Y).
← edge(X, Y), b(X), b(Y).
node(a). node(b). node(c).
edge(a, b). edge(b, c). edge(a, c).
Minh Dao-Tran DERI, July 2011 35/33
80. An Answer Set Programming Tutorial 7. Playing with ASP
Hamilton Path/Cycle
inPath(X, Y) ∨ outPath(X, Y) ← edge(X, Y).
← inPath(X, Y), inPath(X, Y1 ), Y = Y1 .
← inPath(X, Y), inPath(X1 , Y), X = X1 .
← node(X), not reached(X).
reached(X) ← start(X).
reached(X) ← reached(Y), inPath(Y, X).
Minh Dao-Tran DERI, July 2011 36/33
81. An Answer Set Programming Tutorial 7. Playing with ASP
Hamilton Path/Cycle
inPath(X, Y) ∨ outPath(X, Y) ← edge(X, Y).
← inPath(X, Y), inPath(X, Y1 ), Y = Y1 .
← inPath(X, Y), inPath(X1 , Y), X = X1 .
← node(X), not reached(X).
← not start_reached.
reached(X) ← start(X).
reached(X) ← reached(Y), inPath(Y, X).
start_reached ← start(Y), inPath(X, Y).
Minh Dao-Tran DERI, July 2011 36/33
82. An Answer Set Programming Tutorial 7. Playing with ASP
Choosing wine
Assume that we have a Wine ontology and specification of who prefer
which type of wine.
person(“axel”). preferredWine(“axel”, “SweetWine”).
person(“gibbi”). preferredWine(“gibbi”, “DessertWine”).
person(“roman”). preferredWine(“roman”, “ItalianWine”).
Minh Dao-Tran DERI, July 2011 37/33
83. An Answer Set Programming Tutorial 7. Playing with ASP
Choosing wine
Assume that we have a Wine ontology and specification of who prefer
which type of wine.
person(“axel”). preferredWine(“axel”, “SweetWine”).
person(“gibbi”). preferredWine(“gibbi”, “DessertWine”).
person(“roman”). preferredWine(“roman”, “ItalianWine”).
isA(X, “SweetWine”) ← DL[SweetWine](X).
isA(X, “DessertWine”) ← DL[DessertWine](X).
isA(X, “ItalianWine”) ← DL[ItalianWine](X).
Minh Dao-Tran DERI, July 2011 37/33
84. An Answer Set Programming Tutorial 7. Playing with ASP
Choosing wine
Assume that we have a Wine ontology and specification of who prefer
which type of wine.
person(“axel”). preferredWine(“axel”, “SweetWine”).
person(“gibbi”). preferredWine(“gibbi”, “DessertWine”).
person(“roman”). preferredWine(“roman”, “ItalianWine”).
isA(X, “SweetWine”) ← DL[SweetWine](X).
isA(X, “DessertWine”) ← DL[DessertWine](X).
isA(X, “ItalianWine”) ← DL[ItalianWine](X).
compliantBottle(X, Z) ← preferredWine(X, Y), isA(Z, Y).
Minh Dao-Tran DERI, July 2011 37/33
85. An Answer Set Programming Tutorial 7. Playing with ASP
Choosing wine
Assume that we have a Wine ontology and specification of who prefer
which type of wine.
person(“axel”). preferredWine(“axel”, “SweetWine”).
person(“gibbi”). preferredWine(“gibbi”, “DessertWine”).
person(“roman”). preferredWine(“roman”, “ItalianWine”).
isA(X, “SweetWine”) ← DL[SweetWine](X).
isA(X, “DessertWine”) ← DL[DessertWine](X).
isA(X, “ItalianWine”) ← DL[ItalianWine](X).
compliantBottle(X, Z) ← preferredWine(X, Y), isA(Z, Y).
bottleChosen(X) ∨ nonbottleChosen(X) ← compliantBottle(_, X).
Minh Dao-Tran DERI, July 2011 37/33
86. An Answer Set Programming Tutorial 7. Playing with ASP
Choosing wine
Assume that we have a Wine ontology and specification of who prefer
which type of wine.
person(“axel”). preferredWine(“axel”, “SweetWine”).
person(“gibbi”). preferredWine(“gibbi”, “DessertWine”).
person(“roman”). preferredWine(“roman”, “ItalianWine”).
isA(X, “SweetWine”) ← DL[SweetWine](X).
isA(X, “DessertWine”) ← DL[DessertWine](X).
isA(X, “ItalianWine”) ← DL[ItalianWine](X).
compliantBottle(X, Z) ← preferredWine(X, Y), isA(Z, Y).
bottleChosen(X) ∨ nonbottleChosen(X) ← compliantBottle(_, X).
hasBottleChosen(X) ← bottleChosen(Z), compliantBottle(X, Z).
Minh Dao-Tran DERI, July 2011 37/33
87. An Answer Set Programming Tutorial 7. Playing with ASP
Choosing wine
Assume that we have a Wine ontology and specification of who prefer
which type of wine.
person(“axel”). preferredWine(“axel”, “SweetWine”).
person(“gibbi”). preferredWine(“gibbi”, “DessertWine”).
person(“roman”). preferredWine(“roman”, “ItalianWine”).
isA(X, “SweetWine”) ← DL[SweetWine](X).
isA(X, “DessertWine”) ← DL[DessertWine](X).
isA(X, “ItalianWine”) ← DL[ItalianWine](X).
compliantBottle(X, Z) ← preferredWine(X, Y), isA(Z, Y).
bottleChosen(X) ∨ nonbottleChosen(X) ← compliantBottle(_, X).
hasBottleChosen(X) ← bottleChosen(Z), compliantBottle(X, Z).
← person(X), not hasBottleChosen(X).
Minh Dao-Tran DERI, July 2011 37/33
88. An Answer Set Programming Tutorial 7. Playing with ASP
Choosing wine
Assume that we have a Wine ontology and specification of who prefer
which type of wine.
person(“axel”). preferredWine(“axel”, “SweetWine”).
person(“gibbi”). preferredWine(“gibbi”, “DessertWine”).
person(“roman”). preferredWine(“roman”, “ItalianWine”).
isA(X, “SweetWine”) ← DL[SweetWine](X).
isA(X, “DessertWine”) ← DL[DessertWine](X).
isA(X, “ItalianWine”) ← DL[ItalianWine](X).
compliantBottle(X, Z) ← preferredWine(X, Y), isA(Z, Y).
bottleChosen(X) ∨ nonbottleChosen(X) ← compliantBottle(_, X).
hasBottleChosen(X) ← bottleChosen(Z), compliantBottle(X, Z).
← person(X), not hasBottleChosen(X).
← bottleChosen(X).[1 : 1]
Minh Dao-Tran DERI, July 2011 37/33
89. An Answer Set Programming Tutorial 7. Playing with ASP
People whom Axel knows
triple(X, Y, Z) ← &rdf [“foaf .axel.rdf ”](X, Y, Z).
knownbyAxelbyName(X) ← triple(ID, “foaf : name”, “Axel Polleres”),
triple(ID, “foaf : knows”, ID2),
triple(ID2, “foaf : name”, X).
Minh Dao-Tran DERI, July 2011 38/33
90. References I
Anastasia Analyti, Grigoris Antoniou, and Carlos Viegas Damásio.
A principled framework for modular web rule bases and its semantics.
In Proceedings of the 11th International Conference on Principles of
Knowledge Representation and Reasoning (KR2008). AAAI Press,
September 2008.
Marcello Balduccini.
Modules and Signature Declarations for A-Prolog: Progress Report.
In Marina de Vos and Torsten Schaub, editors, Informal Proceedings of the
1st International Workshop on Software Engineering for Answer Set
Programming, Tempe, AZ (USA), May 2007, 2007.
Available at http://sea07.cs.bath.ac.uk/downloads/
sea07-proceedings.pdf.
91. References II
Chitta Baral, Juraj Dzifcak, and Hiro Takahashi.
Macros, Macro calls and Use of Ensembles in Modular Answer Set
Programming.
In Proceedings of the 22th International Conference on Logic Programming
(ICLP 2006), number 4079 in LNCS, pages 376–390. Springer, 2006.
Piero A. Bonatti.
Reasoning with infinite stable models.
Artificial Intelligence, 156(1):75–111, 2004.
Martin Brain and Marina De Vos.
Debugging logic programs under the answer set semantics.
In Answer Set Programming, 2005.
92. References III
Francesco Calimeri and Giovambattista Ianni.
Template programs for Disjunctive Logic Programming: An operational
semantics.
AI Communications, 19(3):193–206, 2006.
Francesco Calimeri, Susanna Cozza, Giovambattista Ianni, and Nicola
Leone.
Computable Functions in ASP: Theory and Implementation.
In Logic Programming, 24th International Conference, ICLP 2008, Udine,
Italy, December 9-13 2008, Proceedings, volume 5366 of LNCS, pages
407–424. Springer, 2008.
Minh Dao-Tran, Thomas Eiter, Michael Fink, and Thomas Krennwallner.
Modular nonmonotonic logic programming revisited.
In P. Hill and D.S. Warren, editors, Proceedings 25th International
Conference on Logic Programming (ICLP 2009), volume 5649 of LNCS,
pages 145–159. Springer, July 2009.
93. References IV
Thomas Eiter and Mantas Šimkus.
Bidirectional answer set programs with function symbols.
In C. Boutilier, editor, Proceedings of the 21st International Joint
Conference on Artificial Intelligence (IJCAI-09). AAAI Press/IJCAI, 2009.
T. Eiter, M. Fink, H. Tompits, and S. Woltran.
Simplifying logic programs under uniform and strong equivalence.
In Ilkka Niemelä and Vladimir Lifschitz, editors, Proceedings of the 7th
International Conference on Logic Programming and Nonmonotonic
Reasoning (LPNMR 2004), number 2923 in LNCS, pages 87–99. Springer,
2004.
Thomas Eiter, Michael Fink, and Stefan Woltran.
Semantical Characterizations and Complexity of Equivalences in Answer
Set Programming.
ACM Trans. Comput. Log., 8(3), 2007.
Article 17 (53 + 11 pages).
94. References V
Omar El-Khatib, Enrico Pontelli, and Tran Cao Son.
Justification and debugging of answer set programs in asp.
In AADEBUG, pages 49–58, 2005.
Martin Gebser, Roland Kaminski, Benjamin Kaufmann, Max Ostrowski,
Torsten Schaub, and Sven Thiele.
Engineering an Incremental ASP Solver.
In M.G. de La Banda and E. Pontelli, editors, Proceedings 24th
International Conference on Logic Programming (ICLP 2008), number 5366
in LNCS, pages 190–205. Springer, 2008.
Martin Gebser, Orkunt Sabuncu, and Torsten Schaub.
An incremental answer set programming based system for finite model
computation.
AI Commun., 24(2):195–212, 2011.
95. References VI
Michael Gelfond and Vladimir Lifschitz.
The Stable Model Semantics for Logic Programming.
In Logic Programming: Proceedings Fifth Intl Conference and Symposium,
pages 1070–1080, Cambridge, Mass., 1988. MIT Press.
Michael Gelfond and Vladimir Lifschitz.
Classical Negation in Logic Programs and Disjunctive Databases.
New Generation Computing, 9:365–385, 1991.
M. Gelfond.
Answer sets.
In B. Porter F. van Harmelen, V. Lifschitz, editor, Handbook of Knowledge
Representation, chapter 7, pages 285–316. Elsevier, 2008.
96. References VII
Tomi Janhunen, Emilia Oikarinen, Hans Tompits, and Stefan Woltran.
Modularity Aspects of Disjunctive Stable Models.
In Proceedings of the 9th International Conference on Logic Programming
and Nonmonotonic Reasoning, volume 4483 of LNCS, pages 175–187.
Springer, May 2007.
Claire Lefévre and Pascal Nicolas.
Integrating grounding in the search process for answer set computing.
In ASPOCP: Answer Set Programming and Other Constraint Paradigms,
pages 89–103, 2008.
Vladimir Lifschitz, David Pearce, and Agustín Valverde.
Strongly equivalent logic programs.
ACM Trans. Comput. Log., 2(4):526–541, 2001.
97. References VIII
Ilkka Niemelä (ed.).
Language Extensions and Software Engineering for ASP.
Technical Report WP3, Working Group on Answer Set Programming
(WASP), IST-FET-2001-37004, September 2005.
Available at http://www.tcs.hut.fi/Research/Logic/wasp/
wp3/wasp-wp3-web/.
Emilia Oikarinen and Tomi Janhunen.
Achieving compositionality of the stable model semantics for Smodels
programs.
Theory and Practice of Logic Programming, 8(5–6):717–761, November
2008.
A. Dal Palù, A. Dovier, E. Pontelli, and G. Rossi.
Gasp: Answer set programming with lazy grounding.
In LaSh 2008: LOGIC AND SEARCH - Computation of structures from
declarative descriptions, 2008.
98. References IX
Axel Polleres, Cristina Feier, and Andreas Harth.
Rules with Contextually Scoped Negation.
In Proceedings of the 3rd European Conference on Semantic Web (ESWC
2006), volume 4011 of LNCS, pages 332–347. Springer, 2006.
Mantas Šimkus and Thomas Eiter.
FDNC: Decidable non-monotonic disjunctive logic programs with function
symbols.
In N. Dershowitz and A. Voronkov, editors, Proceedings 14th International
Conference on Logic for Programming, Artificial Intelligence and Reasoning
(LPAR 2007), number 4790 in LNCS, pages 514–530. Springer, 2007.
Extended Paper to appear in ACM Trans. Computational Logic.
99. References X
Tommi Syrjänen.
Omega-restricted logic programs.
In Proceedings of the 6th International Conference on Logic Programming
and Nonmonotonic Reasoning, Vienna, Austria, September 2001.
Springer-Verlag.
Luis Tari, Chitta Baral, and Saadat Anwar.
A Language for Modular Answer Set Programming: Application to ACC
Tournament Scheduling.
In Proceedings of the 3Proceedings of the 3rd International ASP’05
Workshop, Bath, UK, 27th–29th July 2005, volume 142 of CEUR Workshop
Proceedings, pages 277–293. CEUR WS, July 2005.
Giorgio Terracina, Nicola Leone, Vincenzino Lio, and Claudio Panetta.
Experimenting with recursive queries in database and logic programming
systems.
TPLP, 8(2):129–165, 2008.
100. References XI
Allen Van Gelder, Kenneth A. Ross, and John S. Schlipf.
The Well-Founded Semantics for General Logic Programs.
Journal of the ACM, 38(3):620–650, 1991.
Stefan Woltran.
A common view on strong, uniform, and other notions of equivalence in
answer-set programming.
Theory and Practice of Logic Programming, 8(2):217–234, 2008.
101. An Answer Set Programming Tutorial 8. References 8.1 ASP Performance
The 3rd ASP Competition
Results from https://www.mat.unical.it/aspcomp20111
Input size (plain text of facts):
Reachability: 0.5 — 20 MB
Grammar Based Information Extraction: 1.5 — 5 MB
1
Many thanks to Giovambattista Ianni for insightful analysis of the results.
Minh Dao-Tran DERI, July 2011 50/33
102. An Answer Set Programming Tutorial 8. References 8.1 ASP Performance
The 3rd ASP Competition - Scoring
Minh Dao-Tran DERI, July 2011 51/33
103. An Answer Set Programming Tutorial 8. References 8.1 ASP Performance
clasp Benchmarking
http://www.cs.uni-potsdam.de/clasp/?page=experiments
Check some of the well-known problems: HamiltonianCycle,
HamiltonianPath, Su-DoKu, TowersOfHanoiCompetition
Minh Dao-Tran DERI, July 2011 52/33
104. An Answer Set Programming Tutorial 8. References 8.2 What is ASP good for?
What is ASP good for?
Combinatorial search problems (some with substantial amount of
data):
• For instance, auctions, bio-informatics, computer-aided verification,
configuration, constraint satisfaction, diagnosis, information
integration, planning and scheduling, security analysis, semantic web,
wire-routing, zoology and linguistics, and many more
A favorite application : Using ASP as a basis for a decision support
system for NASA’s space shuttle (Gelfond et al., Texas Tech)
And more:
• Automatic synthesis of multiprocessor systems
• Inconsistency detection, diagnosis, repair, and prediction in large
biological networks
• Home monitoring for risk prevention in ambient assisted living
• General game playing
Minh Dao-Tran DERI, July 2011 53/33
105. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Logic Programming – Prolog revisited
Prolog = “Programming in Logic”
Basic data structures: terms
Programs: rules and facts
Computing: Queries (goals)
• Proofs provide answers
• SLD-resolution
• unification - basic mechanism to manipulate data structures
Extensive use of recursion
Minh Dao-Tran DERI, July 2011 54/33
106. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Prolog – Truly Declarative Programming?
Example
parent(John, Mary).
parent(Mary, James).
ancestor(X, Y) : − parent(X, Y).
ancestor(X, Z) : − parent(X, Y), ancestor(Y, Z).
vs.
parent(John, Mary).
parent(Mary, James).
ancestor(X, Z) : − ancestor(Y, Z), parent(X, Y).
ancestor(X, Y) : − parent(X, Y).
Query: ?- ancestor(John,W)
Minh Dao-Tran DERI, July 2011 55/33
107. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Desiderata
Relieve the programmer from several concerns.
It is desirable that
the order of program rules does not matter;
the order of subgoals in a rule does not matter;
termination is not subject to such order.
Minh Dao-Tran DERI, July 2011 56/33
108. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Desiderata
Relieve the programmer from several concerns.
It is desirable that
the order of program rules does not matter;
the order of subgoals in a rule does not matter;
termination is not subject to such order.
“Pure” declarative programming
Prolog does not satisfy these desiderata
Satisfied e.g. by the answer set semantics of logic programs
Minh Dao-Tran DERI, July 2011 56/33
109. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Programs with Negation
Prolog: “not X ” means “Negation as Failure (to prove to X )”
Different from negation in classical logic!
Minh Dao-Tran DERI, July 2011 57/33
110. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Programs with Negation
Prolog: “not X ” means “Negation as Failure (to prove to X )”
Different from negation in classical logic!
Example (Program P3 )
man(dilbert).
single(X) : − man(X), not husband(X).
husband(X) : − fail.
Minh Dao-Tran DERI, July 2011 57/33
111. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Programs with Negation
Prolog: “not X ” means “Negation as Failure (to prove to X )”
Different from negation in classical logic!
Example (Program P3 )
man(dilbert).
single(X) : − man(X), not husband(X).
husband(X) : − fail.
Query:
? − single(X).
Minh Dao-Tran DERI, July 2011 57/33
112. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Programs with Negation
Prolog: “not X ” means “Negation as Failure (to prove to X )”
Different from negation in classical logic!
Example (Program P3 )
man(dilbert).
single(X) : − man(X), not husband(X).
husband(X) : − fail.
Query:
? − single(X).
Answer:
X = dilbert.
Minh Dao-Tran DERI, July 2011 57/33
113. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Example (cont’d)
Modifying the last rule of P3 , we get P4 :
man(dilbert).
single(X) ← man(X), not husband(X).
husband(X) ← man(X), not single(X).
Result in Prolog ????
Minh Dao-Tran DERI, July 2011 58/33
114. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Example (cont’d)
Modifying the last rule of P3 , we get P4 :
man(dilbert).
single(X) ← man(X), not husband(X).
husband(X) ← man(X), not single(X).
Result in Prolog ????
Problem: not a single intuitive model!
Minh Dao-Tran DERI, July 2011 58/33
115. An Answer Set Programming Tutorial 8. References 8.3 What is the difference compared to Prolog?
Example (cont’d)
Modifying the last rule of P3 , we get P4 :
man(dilbert).
single(X) ← man(X), not husband(X).
husband(X) ← man(X), not single(X).
Result in Prolog ????
Problem: not a single intuitive model!
Two intuitive Herbrand models:
M1 = {man(dilbert), single(dilbert)}, and
M2 = {man(dilbert), husband(dilbert)} .
Which one to choose?
Minh Dao-Tran DERI, July 2011 58/33
116. An Answer Set Programming Tutorial 8. References 8.4 Semantics of Logic Programs With Negatio
Semantics of Logic Programs With Negation
“War of Semantics” in Logic Programming (1980/90s):
Meaning of programs like the Dilbert example above
Minh Dao-Tran DERI, July 2011 59/33
117. An Answer Set Programming Tutorial 8. References 8.4 Semantics of Logic Programs With Negatio
Semantics of Logic Programs With Negation
“War of Semantics” in Logic Programming (1980/90s):
Meaning of programs like the Dilbert example above
Great Schism: Single model vs. multiple model semantics
Minh Dao-Tran DERI, July 2011 59/33
118. An Answer Set Programming Tutorial 8. References 8.4 Semantics of Logic Programs With Negatio
Semantics of Logic Programs With Negation
“War of Semantics” in Logic Programming (1980/90s):
Meaning of programs like the Dilbert example above
Great Schism: Single model vs. multiple model semantics
To date:
• Well-Founded Semantics [Van Gelder et al., 1991]
Partial model: man(dilbert) is true,
single(dilbert), husband(dilbert) are unknown
Minh Dao-Tran DERI, July 2011 59/33
119. An Answer Set Programming Tutorial 8. References 8.4 Semantics of Logic Programs With Negatio
Semantics of Logic Programs With Negation
“War of Semantics” in Logic Programming (1980/90s):
Meaning of programs like the Dilbert example above
Great Schism: Single model vs. multiple model semantics
To date:
• Well-Founded Semantics [Van Gelder et al., 1991]
Partial model: man(dilbert) is true,
single(dilbert), husband(dilbert) are unknown
• Answer Set (alias Stable Model) Semantics by Gelfond and Lifschitz
[1988,1991].
Alternative models: M1 = {man(dilbert), single(dilbert)},
M2 = {man(dilbert), husband(dilbert)}.
Minh Dao-Tran DERI, July 2011 59/33
120. An Answer Set Programming Tutorial 8. References 8.4 Semantics of Logic Programs With Negatio
Semantics of Logic Programs With Negation
“War of Semantics” in Logic Programming (1980/90s):
Meaning of programs like the Dilbert example above
Great Schism: Single model vs. multiple model semantics
To date:
• Well-Founded Semantics [Van Gelder et al., 1991]
Partial model: man(dilbert) is true,
single(dilbert), husband(dilbert) are unknown
• Answer Set (alias Stable Model) Semantics by Gelfond and Lifschitz
[1988,1991].
Alternative models: M1 = {man(dilbert), single(dilbert)},
M2 = {man(dilbert), husband(dilbert)}.
Agreement for so-called “stratified programs”
Different selection principles for non-stratified programs
Minh Dao-Tran DERI, July 2011 59/33
121. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimality
Semantics: disjunction is minimal (different from classical logic):
a ∨ b ∨ c.
Minimal models: {a}, {b}, and {c}.
Minh Dao-Tran DERI, July 2011 60/33
122. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimality
Semantics: disjunction is minimal (different from classical logic):
a ∨ b ∨ c.
Minimal models: {a}, {b}, and {c}.
actually subset minimal:
a ∨ b. a ∨ c.
Minimal models: {a} and {b, c}.
Minh Dao-Tran DERI, July 2011 60/33
123. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimality
Semantics: disjunction is minimal (different from classical logic):
a ∨ b ∨ c.
Minimal models: {a}, {b}, and {c}.
actually subset minimal:
a ∨ b. a ∨ c.
Minimal models: {a} and {b, c}.
a ∨ b. a←b
Models {a} and {a, b}, but only {a} is minimal.
Minh Dao-Tran DERI, July 2011 60/33
124. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimality
Semantics: disjunction is minimal (different from classical logic):
a ∨ b ∨ c.
Minimal models: {a}, {b}, and {c}.
actually subset minimal:
a ∨ b. a ∨ c.
Minimal models: {a} and {b, c}.
a ∨ b. a←b
Models {a} and {a, b}, but only {a} is minimal.
but minimality is not necessarily exclusive:
a ∨ b. b ∨ c. a ∨ c.
Minimal models: {a, b}, {a, c}, and {b, c}.
Minh Dao-Tran DERI, July 2011 60/33
125. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimal Model Semantics
A logic program has multiple models in general.
Select one of these models as the canonical model.
Commonly accepted: truth of an atom in model I should be
“founded” by clauses.
Minh Dao-Tran DERI, July 2011 61/33
126. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimal Model Semantics
A logic program has multiple models in general.
Select one of these models as the canonical model.
Commonly accepted: truth of an atom in model I should be
“founded” by clauses.
Example
Given
P2 = {a ← b. b ← c. c},
truth of a in the model I = {a, b, c} is “founded.”
Minh Dao-Tran DERI, July 2011 61/33
127. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimal Model Semantics
A logic program has multiple models in general.
Select one of these models as the canonical model.
Commonly accepted: truth of an atom in model I should be
“founded” by clauses.
Example
Given
P2 = {a ← b. b ← c. c},
truth of a in the model I = {a, b, c} is “founded.”
Given
P2 = {a ← b. b ← a. c},
truth of a in the model I = {a, b, c} is not founded.
Minh Dao-Tran DERI, July 2011 61/33
128. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimal Model Semantics (cont’d)
Semantics: Prefer models with true-part as small as possible.
Definition
A model I of P is minimal, if there exists no model J of P such that J ⊂ I .
Minh Dao-Tran DERI, July 2011 62/33
129. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimal Model Semantics (cont’d)
Semantics: Prefer models with true-part as small as possible.
Definition
A model I of P is minimal, if there exists no model J of P such that J ⊂ I .
Theorem
Every logic program P has a single minimal model (called the least
model), denoted LM(P).
Minh Dao-Tran DERI, July 2011 62/33
130. An Answer Set Programming Tutorial 8. References 8.5 Minimality
Minimal Model Semantics (cont’d)
Semantics: Prefer models with true-part as small as possible.
Definition
A model I of P is minimal, if there exists no model J of P such that J ⊂ I .
Theorem
Every logic program P has a single minimal model (called the least
model), denoted LM(P).
Example
For P1 = { a ← b. b ← c. c }, we have LM(P1 ) = {a, b, c}.
For P2 = { a ← b. b ← a. c }, we have LM(P2 ) = {c}.
Minh Dao-Tran DERI, July 2011 62/33
131. An Answer Set Programming Tutorial 8. References 8.6 TP operator
Computation
The minimal model can be computed via fixpoint iteration.
Definition (TP Operator)
Let TP : 2HB(P) → 2HB(P) be defined as
there exists some a ← b1 , . . . , bm
TP (I) = a .
in grnd(P) such that {b1 , . . . , bm } ⊆ I
0 i+1 i
We let denote TP = ∅, TP = TP (TP ), i ≥ 0.
Minh Dao-Tran DERI, July 2011 63/33
132. An Answer Set Programming Tutorial 8. References 8.6 TP operator
Computation
The minimal model can be computed via fixpoint iteration.
Definition (TP Operator)
Let TP : 2HB(P) → 2HB(P) be defined as
there exists some a ← b1 , . . . , bm
TP (I) = a .
in grnd(P) such that {b1 , . . . , bm } ⊆ I
0 i+1 i
We let denote TP = ∅, TP = TP (TP ), i ≥ 0.
Fundamental result:
Theorem
i
TP has a least fixpoint, lfp(TP ), and the sequence TP , i ≥ 0,
converges to lfp(TP ).
Minh Dao-Tran DERI, July 2011 63/33
133. An Answer Set Programming Tutorial 8. References 8.7 Answer Set Programming Systems for Debi
Answer Set Programming Systems for Debian/Ubuntu
Minh Dao-Tran DERI, July 2011 64/33
134. An Answer Set Programming Tutorial 8. References 8.7 Answer Set Programming Systems for Debi
Answer Set Programming Systems for Debian/Ubuntu
Minh Dao-Tran DERI, July 2011 65/33
135. An Answer Set Programming Tutorial 8. References 8.7 Answer Set Programming Systems for Debi
Answer Set Programming Systems for Debian/Ubuntu
Minh Dao-Tran DERI, July 2011 66/33
136. An Answer Set Programming Tutorial 8. References 8.7 Answer Set Programming Systems for Debi
Answer Set Programming Systems for Debian/Ubuntu
Minh Dao-Tran DERI, July 2011 67/33
137. An Answer Set Programming Tutorial 8. References 8.7 Answer Set Programming Systems for Debi
Answer Set Programming Systems for Debian/Ubuntu
Minh Dao-Tran DERI, July 2011 68/33
138. An Answer Set Programming Tutorial 8. References 8.7 Answer Set Programming Systems for Debi
Answer Set Programming Systems for Debian/Ubuntu
Minh Dao-Tran DERI, July 2011 69/33