SlideShare a Scribd company logo
Modeling and Reasoning in Event Calculus
using Goal-Directed Constraint Answer Set Programming
(Extended Abstract)
Joaquı́n Arias1
Manuel Carro2,3
Zhuo Chen4
Gopal Gupta4
1
CETINIA, Universidad Rey Juan Carlos, Madrid, Spain 2
Universidad Politécnica de Madrid, Spain
3
IMDEA Software Institute, Pozuelo, Spain 4
University of Texas at Dallas, Richardson, USA
3 August 2022 [ICLP’22]
www.ia.urjc.es
Introduction I
Commonsense Reasoning (CR)
• Requires modelling:
• Non-monotonicity.
• Continuous characteristics of the world.
• Event Calculus (EC): formalism that represents
continuous change and captures law of inertia.
• EC components:
Narrative A description of the world we want to
model. Assumes circumscription.
Axioms A generic description of how the world
behaves given a narrative.
• Implementing EC: logic + continuous domains.
Example:
A tap fills a vessel [12].
Center for Intelligent Information Technologies 1/12
www.ia.urjc.es
Introduction II
Reasoning on EC:
• Deduction / proving in first order logic (+ circumscription).
Related Work
• Non-interactive theorem prover: likely won’t always answer.
• Prolog: incomplete implementations [2; 10; 13].
• Answer Set Programming (ASP): logic programming paradigm.
• Has been used to model (discrete) EC [8; 9].
• Classical (C)ASP systems require grounding:
• Limited to variables ranging over discrete, finite domains.
• CASP proposals not applied (yet) to modeling EC:
• ASPMT [7]: Action languages [6] + continuous time.
• PDDL+ [1; 4]: Planning & Diagnosis.
Center for Intelligent Information Technologies 2/12
www.ia.urjc.es
s(CASP)
• Goal directed execution without grounding.
• The execution starts with a query. ?- T #> 5, T #< 8, cross(T).
• Returns partial stable models [5] Only literals supporting the query.
• For each successful top-down derivation, on backtracking returns:
• A justification tree. Explanation for observations.
• Bindings for the free variables. T=6.
• Constraint representing refined domain of the variables. T #> 5, T #< 7.
Center for Intelligent Information Technologies 3/12
www.ia.urjc.es
s(CASP)
• Goal directed execution without grounding.
• The execution starts with a query. ?- T #> 5, T #< 8, cross(T).
• Returns partial stable models [5] Only literals supporting the query.
• For each successful top-down derivation, on backtracking returns:
• A justification tree. Explanation for observations.
• Bindings for the free variables. T=6.
• Constraint representing refined domain of the variables. T #> 5, T #< 7.
• Provides a constructive and sound negation:
• Default negation: In the absence of information. cross(T):- not train(T).
• Classical negation: Explicit knowledge. cross(T):- -train(T).
Center for Intelligent Information Technologies 3/12
www.ia.urjc.es
s(CASP)
• Goal directed execution without grounding.
• The execution starts with a query. ?- T #> 5, T #< 8, cross(T).
• Returns partial stable models [5] Only literals supporting the query.
• For each successful top-down derivation, on backtracking returns:
• A justification tree. Explanation for observations.
• Bindings for the free variables. T=6.
• Constraint representing refined domain of the variables. T #> 5, T #< 7.
• Provides a constructive and sound negation:
• Default negation: In the absence of information. cross(T):- not train(T).
• Classical negation: Explicit knowledge. cross(T):- -train(T).
• Allows rules with negated heads. -train(T):- not barrier(up,T).
• Global constraints ensure consistency. :- train(T), -train(T).
Center for Intelligent Information Technologies 3/12
www.ia.urjc.es
Event Calculus
• EC uses a universal theory (axioms) to reason about scenarios (narrative).
• Event are actions that may happens at a time point. tapOn Open the tap.
• A fluent is a time-varying property of the world. filling The vessel is been filled.
• Time and/or fluent may have continuous quantities associated. level(X) Level of water.
Center for Intelligent Information Technologies 4/12
www.ia.urjc.es
Event Calculus
• EC uses a universal theory (axioms) to reason about scenarios (narrative).
• Event are actions that may happens at a time point. tapOn Open the tap.
• A fluent is a time-varying property of the world. filling The vessel is been filled.
• Time and/or fluent may have continuous quantities associated. level(X) Level of water.
• State constraints: represent restrictions on the model:
• To ensure consistency of the narrative w.r.t. the axioms. :- holds(F,T), -holds(F,T).
Center for Intelligent Information Technologies 4/12
www.ia.urjc.es
Event Calculus
• EC uses a universal theory (axioms) to reason about scenarios (narrative).
• Event are actions that may happens at a time point. tapOn Open the tap.
• A fluent is a time-varying property of the world. filling The vessel is been filled.
• Time and/or fluent may have continuous quantities associated. level(X) Level of water.
• State constraints: represent restrictions on the model:
• To ensure consistency of the narrative w.r.t. the axioms. :- holds(F,T), -holds(F,T).
• Trajectory: a fluent depends on the time elapsed since an event:
• If at T1 the level of water is L1. Then, at T2 the level is L1+T2-T1.
Center for Intelligent Information Technologies 4/12
www.ia.urjc.es
Event Calculus
• EC uses a universal theory (axioms) to reason about scenarios (narrative).
• Event are actions that may happens at a time point. tapOn Open the tap.
• A fluent is a time-varying property of the world. filling The vessel is been filled.
• Time and/or fluent may have continuous quantities associated. level(X) Level of water.
• State constraints: represent restrictions on the model:
• To ensure consistency of the narrative w.r.t. the axioms. :- holds(F,T), -holds(F,T).
• Trajectory: a fluent depends on the time elapsed since an event:
• If at T1 the level of water is L1. Then, at T2 the level is L1+T2-T1.
• Non-monotonic reasoning
• Different scenarios/worlds (uncertainty). max_level(10) or max_level(16) Vessel size.
• Abductive reasoning: events may happens or not. Sequence of events to reach a final state.
Center for Intelligent Information Technologies 4/12
www.ia.urjc.es
Event Calculus Basics I: Narrative
Predicate Meaning
initiallyN(f) fluent f is false at time 0
initiallyP(f) fluent f is true at time 0
happens(e, t) event e occurs at time t
initiates(e, f, t) if e happens at time t, f is true after t
terminates(e, f, t) if e occurs at time t, f is false after t
releases(e, f, t) if e occurs at time t, f is released after t
trajectory(f1, t1, f2, t2) if f1 is initiated at t1, then f2 is true at t2
stoppedIn(t1, f, t2) f is stopped between t1 and t2
startedIn(t1, f, t2) f is started between t1 and t2
holdsAt(f, t) fluent f is true at time t
Basic event calculus (BEC) predicates e = event, f, f1, f2 = fluents and t, t1, t2 = timepoints
Center for Intelligent Information Technologies 5/12
www.ia.urjc.es
Event Calculus Basics II: Axioms
BEC1. StoppedIn(t1, f , t2) ≡ ∃e, t ( Happens(e, t) ∧ t1 < t < t2 ∧ ( Terminates(e, f , t) ∨ Releases(e, f , t) ) )
BEC2. StartedIn(t1, f , t2) ≡ ∃e, t ( Happens(e, t) ∧ t1 < t < t2 ∧ ( Initiates(e, f , t) ∨ Releases(e, f , t) ) )
BEC3. HoldsAt(f2, t2) ← Happens(e, t1) ∧ Initiates(e, f1, t1) ∧ Trajectory(f1, t1, f2, t2) ∧ ¬StoppedIn(t1, f1, t2)
BEC4. HoldsAt(f , t) ← InitiallyP(f ) ∧ ¬StoppedIn(0, f , t)
BEC5. ¬HoldsAt(f , t) ← InitiallyN(f ) ∧ ¬StartedIn(0, f , t)
BEC6. HoldsAt(f , t2) ← Happens(e, t1) ∧ Initiates(e, f , t1) ∧ t1 < t2 ∧ ¬StoppedIn(t1, f , t2)
BEC7. ¬HoldsAt(f , t2) ← Happens(e, t1) ∧ Terminates(e, f , t1) ∧ t1 < t2 ∧ ¬StartedIn(t1, f , t2)
Formalization of BEC axioms [11]
Center for Intelligent Information Technologies 6/12
www.ia.urjc.es
Translating Event Calculus into s(CASP) I: Scheme
Atoms and Constants: Uniqueness of names [12] By default in s(CASP).
Constraints: t1 < t2 T1 #< T2 handled by CLP(Q).
Definitions: D(x) ≡ ∃yB(x, y) ∀x(D(x) ← ∃yB(x, y))
+ Clark’s completion [3].
Rules with positive head:
∀x(H(x) ← ∃y(A(y) ∧ ¬B(x, y) ∧ x < y)) h(X):- X #< Y, a(Y), not b(X,Y).
Rules with negative head:
∀x(¬H(x) ← ∃yB(x, y)) -h(X):- b(X,Y).
:- -h(X),h(X).
Rule with disjunctive bodies:
∀x[H(x) ← ∃y( (A(x, y) ∨ B(x, y)) ∧ C(x, y) )] h(X):- a(X,Y), c(X,Y).
h(X):- b(X,Y), c(X,Y).
Center for Intelligent Information Technologies 7/12
www.ia.urjc.es
Translating Event Calculus Axioms into s(CASP) II: Code
1 %% BEC1
2 stoppedIn(T1,F,T2) :-
3 T1 #< T, T #< T2,
4 terminates(E,F,T),
5 happens(E,T).
6 stoppedIn(T1,F,T2) :-
7 T1 #< T, T #< T2,
8 releases(E,F,T),
9 happens(E,T).
10 %% BEC2
11 startedIn(T1,F,T2) :-
12 T1 #< T, T #< T2,
13 initiates(E,F,T),
14 happens(E,T).
15 startedIn(T1,F,T2) :-
16 T1 #< T, T #< T2,
17 releases(E,F,T),
18 happens(E,T).
19 %% BEC3
20 holdsAt(F2,T2) :-
21 initiates(E,F1,T1),
22 happens(E,T1),
23 trajectory(F1,T1,F2,T2),
24 not stoppedIn(T1,F1,T2).
25
26 %% BEC4
27 holdsAt(F,T) :-
28 0 #< T, initiallyP(F),
29 not stoppedIn(0,F,T).
30
31 %% BEC5
32 -holdsAt(F,T) :-
33 0 #< T, initiallyN(F),
34 not startedIn(0,F,T).
35
36
37 %% BEC6
38 holdsAt(F,T) :-
39 T1 #< T, initiates(E,F,T1),
40 happens(E,T1),
41 not stoppedIn(T1,F,T).
42
43 %% BEC7
44 -holdsAt(F,T) :-
45 T1 #< T, terminates(E,F,T1),
46 happens(E,T1),
47 not startedIn(T1,F,T).
48
49
50 %% Consistency
51 :- -holdsAt(F,T), holdsAt(F,T).
Center for Intelligent Information Technologies 8/12
www.ia.urjc.es
Example: Continuous Change Encoding.
• A vessel is filled with water from a tap [12]. When the
water level reaches the rim, it starts spilling.
• Note state in fluents!
1 max_level(10) :- not max_level(16).
2 max_level(16) :- not max_level(10).
3
4 initiallyP(level(0)).
5
6 happens(overflow,T).
7 happens(tapOn,5).
8
9 terminates(tapOff,filling,T).
10
11 initiates(tapOn,filling,T).
12 initiates(overflow,spilling,T) :-
13 max_level(Max), holdsAt(level(Max), T).
14 releases(tapOn,level(0),T) :- happens(tapOn,T).
15
16
17 trajectory(filling,T1,level(X2),T2) :-
18 T1 #< T2, X2 #= X+4/3*(T2-T1), X2 #=< Max,
19 max_level(Max), holdsAt(level(X),T1).
20 trajectory(filling,T1,level(overflow),T2) :-
21 T1 #< T2, X2 #= X+4/3*(T2-T1), X2 #> Max,
22 max_level(Max), holdsAt(level(X),T1).
23
24 trajectory(spilling,T1,leak(X),T2) :-
25 holdsAt(filling, T2), T1 #< T2, X #= 4/3*(T2-T1).
Center for Intelligent Information Technologies 9/12
www.ia.urjc.es
Example: Continuous Change Reasoning.
Deduction: Determines whether a state of the world is possible.
• ?- holdsAt(level(H),15/2) H=10/3.
• ?- holdsAt(level(10/3),T) T=15/2.
Abductive reasoning:
• Determines consistent world.
• ?- holdsAt(level(12),14) single model with a vessel of 16.
{ max_level(16), happens(tapOn,5), holdsAt(level(12),14), ... }
• Determines sequence of events...
Adding the directive #abducible to happens(tapOn,5)
• ?- holdsAt(level(L),14) returns two models:
{ max_level(16), happens(tapOn,5), holdsAt(level(12),14), ... }
{ max_level(16), not happens(tapOn,5), holdsAt(level(0),14), ... }
Center for Intelligent Information Technologies 10/12
www.ia.urjc.es
Evaluation
• Note the advantage of providing constraints over continuous domains.
• We compare our proposal w.r.t. F2LP + clingo:
• No constraints (different precision is needed in clingo).
• Conditions checked when variables instantiated.
• For queries involving rational numbers, a specific version is needed.
Run time (ms) comparison
Queries s(CASP) F2LP+clingo and precision
holdsAt(level(11),T) 301 475 10*
77,305 100
(*) With this precision, clingo computes incorrect answers.
• For ?- holdsAt(level(11),T) the correct answer is T=13,25.
• With precision 10, ?- holdsAt(level(110),T) holds for T=133.
• With precision 100, ?- holdsAt(level(1100),T) holds for T=1325.
Center for Intelligent Information Technologies 11/12
www.ia.urjc.es
Conclusions
• EC can be naturally and directly encoded in s(CASP).
• s(CASP) captures the notion of continuous change in EC:
• Thanks to its grounding-free top-down evaluation strategy.
• s(CASP) can represent complex models & answer queries:
• In a flexible manner.
• Thanks to the use of constraints.
Center for Intelligent Information Technologies 12/12
www.ia.urjc.es
Conclusions
• EC can be naturally and directly encoded in s(CASP).
• s(CASP) captures the notion of continuous change in EC:
• Thanks to its grounding-free top-down evaluation strategy.
• s(CASP) can represent complex models & answer queries:
• In a flexible manner.
• Thanks to the use of constraints.
• s(CASP) gives explanations for observations via abduction.
Center for Intelligent Information Technologies 12/12
www.ia.urjc.es
Conclusions
• EC can be naturally and directly encoded in s(CASP).
• s(CASP) captures the notion of continuous change in EC:
• Thanks to its grounding-free top-down evaluation strategy.
• s(CASP) can represent complex models & answer queries:
• In a flexible manner.
• Thanks to the use of constraints.
• s(CASP) gives explanations for observations via abduction.
Future work
• Apply the s(CASP) system to solve planning problems:
• Generated plans must obey continuous- and real- time constraints.
Center for Intelligent Information Technologies 12/12
www.ia.urjc.es
Conclusions
• EC can be naturally and directly encoded in s(CASP).
• s(CASP) captures the notion of continuous change in EC:
• Thanks to its grounding-free top-down evaluation strategy.
• s(CASP) can represent complex models & answer queries:
• In a flexible manner.
• Thanks to the use of constraints.
• s(CASP) gives explanations for observations via abduction.
Future work
• Apply the s(CASP) system to solve planning problems:
• Generated plans must obey continuous- and real- time constraints.
THANKS!
Center for Intelligent Information Technologies 12/12
References www.ia.urjc.es
Referencias I
[1] M. Balduccini, D. Magazzeni, and M. Maratea (2016). PDDL+ Planning via Constraint
Answer Set Programming. In: 9th Workshop on Answer Set Programming and Other
Computing Paradigms. http://arxiv.org/abs/1609.00030.
[2] L. Chittaro and A. Montanari (1996). Efficient Temporal Reasoning in the Cached Event
Calculus. In: Computational Intelligence 12, pp. 359–382. doi:
10.1111/j.1467-8640.1996.tb00267.x.
[3] K. L. Clark (1978). Negation as Failure. In: Logic and Data Bases. Ed. by H. Gallaire and
J. Minker. Springer, pp. 293–322. doi: 10.1007/978-1-4684-3384-5_11.
[4] M. Fox and D. Long (2002). PDDL+: Modeling continuous time dependent effects. In:
Proceedings of the 3rd International NASA Workshop on Planning and Scheduling for Space.
Vol. 4, p. 34.
Center for Intelligent Information Technologies 13/12
References www.ia.urjc.es
Referencias II
[5] M. Gelfond and V. Lifschitz (1988). The Stable Model Semantics for Logic Programming.
In: 5th International Conference on Logic Programming, pp. 1070–1080. doi:
10.2307/2275201. url:
http://www.cse.unsw.edu.au/~cs4415/2010/resources/stable.pdf.
[6] – (1993). Representing Action and Change by Logic Programs. In: The Journal of Logic
Programming 17.2-4, pp. 301–321.
[7] J. Lee and Y. Meng (2013). Answer Set Programming Modulo Theories and Reasoning
about Continuous Changes. In: 23rd Int’l. Joint Conference on Artificial Intelligence,
pp. 990–996.
[8] J. Lee and R. Palla (2009). System F2LP – Computing Answer Sets of First-Order
Formulas. In: Logic Programming and Nonmonotonic Reasoning. Berlin, Heidelberg:
Springer Berlin Heidelberg, pp. 515–521. doi: 10.1007/978-3-642-04238-6_51.
Center for Intelligent Information Technologies 14/12
References www.ia.urjc.es
Referencias III
[9] J. Lee and R. Palla (2012). Reformulating the Situation Calculus and the Event Calculus
in the General Theory of Stable Models and in Answer Set Programming. In: Journal
of Artificial Intelligence Research 43, pp. 571–620.
[10] E. T. Mueller (2008). Chapter 17: Event Calculus. In: Handbook of Knowledge
Representation. Ed. by F. van Harmelen, V. Lifschitz, and B. Porter. Vol. 3. Foundations of
AI. Elsevier, pp. 671 –708. doi: 10.1016/S1574-6526(07)03017-9.
[11] – (2014). Commonsense reasoning: an event calculus based approach. Morgan
Kaufmann. doi: 10.1016/B978-0-12-801416-5.00002-4.
[12] M. Shanahan (1999). The Event Calculus Explained. In: Artificial Intelligence Today.
Springer, pp. 409–430. doi: 10.1007/3-540-48317-9_17.
[13] – (2000). An Abductive Event Calculus Planner. In: The Journal of Logic Programming
44.1-3, pp. 207–240.
Center for Intelligent Information Technologies 15/12
References www.ia.urjc.es
Center for Intelligent Information Technologies 16/12

More Related Content

Similar to Modeling and Reasoning in Event Calculus using Goal-Directed Constraint Answer Set Programming (20)

PPT
cs344-lect11-resolution-robotic-knowledge-representation-29jan08.ppt
SujalGupta60
 
PDF
Operationalizing Declarative and Procedural Knowledge
Giovanni Sileno
 
PPTX
DEBS 2019 tutorial : correctness and consistency of event-based systems
Opher Etzion
 
PPT
Knowledge engg using & in fol
chandsek666
 
PPTX
aritficial intellegence
Ankit Sharma
 
PPT
Knowledge_Representbhhggghhhhhhhtrrghjuuuuation.ppt
SupriyoRoy41
 
PDF
Temporal logic-model-checking
Dr. Jayaraj Poroor
 
PDF
Semantic Complex Event Processing
Adrian Paschke
 
PPT
KnowledgeRepresentation in artificial intelligence.ppt
ratnababum
 
PDF
Event Stream Processing with BeepBeep 3
Sylvain Hallé
 
PPTX
knowledge representation using rules
Harini Balamurugan
 
PPT
Aaai 2011 event processing tutorial
Opher Etzion
 
PDF
The Power Of Event Chapter 5
Woojin Joe
 
PDF
21 situation calculus
Tianlu Wang
 
PPTX
eventnet asynchronous recursive event processing
Ryuta Shitomi
 
PPT
Artificial Intelligence: Case-based & Model-based Reasoning
The Integral Worm
 
PDF
Fcv rep todorovic
zukun
 
PPT
Deductive Database
Nikhil Sharma
 
PPT
KNOWLEDGE Representation unit 3 for data mining
RGAYATHRI25
 
cs344-lect11-resolution-robotic-knowledge-representation-29jan08.ppt
SujalGupta60
 
Operationalizing Declarative and Procedural Knowledge
Giovanni Sileno
 
DEBS 2019 tutorial : correctness and consistency of event-based systems
Opher Etzion
 
Knowledge engg using & in fol
chandsek666
 
aritficial intellegence
Ankit Sharma
 
Knowledge_Representbhhggghhhhhhhtrrghjuuuuation.ppt
SupriyoRoy41
 
Temporal logic-model-checking
Dr. Jayaraj Poroor
 
Semantic Complex Event Processing
Adrian Paschke
 
KnowledgeRepresentation in artificial intelligence.ppt
ratnababum
 
Event Stream Processing with BeepBeep 3
Sylvain Hallé
 
knowledge representation using rules
Harini Balamurugan
 
Aaai 2011 event processing tutorial
Opher Etzion
 
The Power Of Event Chapter 5
Woojin Joe
 
21 situation calculus
Tianlu Wang
 
eventnet asynchronous recursive event processing
Ryuta Shitomi
 
Artificial Intelligence: Case-based & Model-based Reasoning
The Integral Worm
 
Fcv rep todorovic
zukun
 
Deductive Database
Nikhil Sharma
 
KNOWLEDGE Representation unit 3 for data mining
RGAYATHRI25
 

Recently uploaded (20)

PPTX
Akshay tunneling .pptx_20250331_165945_0000.pptx
akshaythaker18
 
PPTX
Structure and uses of DDT, Saccharin..pptx
harsimrankaur204
 
PDF
2025-06-10 TWDB Agency Updates & Legislative Outcomes
tagdpa
 
PPTX
PEDIA IDS IN A GIST_6488b6b5-3152-4a4a-a943-20a56efddd43 (2).pptx
tdas83504
 
PPTX
Diagnostic Features of Common Oral Ulcerative Lesions.pptx
Dr Palak borade
 
PDF
Insect Behaviour : Patterns And Determinants
SheikhArshaqAreeb
 
PDF
WUCHERIA BANCROFTI-converted-compressed.pdf
S.B.P.G. COLLEGE BARAGAON VARANASI
 
PPT
Introduction of animal physiology in vertebrates
S.B.P.G. COLLEGE BARAGAON VARANASI
 
PDF
Chemokines and Receptors Overview – Key to Immune Cell Signaling
Benjamin Lewis Lewis
 
PPTX
Anatomy and physiology of digestive system.pptx
Ashwini I Chuncha
 
PPTX
Different formulation of fungicides.pptx
MrRABIRANJAN
 
PDF
Step-by-Step Guide: How mRNA Vaccines Works
TECNIC
 
PDF
Carbon-richDustInjectedintotheInterstellarMediumbyGalacticWCBinaries Survives...
Sérgio Sacani
 
PDF
A young gas giant and hidden substructures in a protoplanetary disk
Sérgio Sacani
 
PDF
Introduction of Animal Behaviour full notes.pdf
S.B.P.G. COLLEGE BARAGAON VARANASI
 
PPTX
LESSON 2 PSYCHOSOCIAL DEVELOPMENT.pptx L
JeanCarolColico1
 
PDF
GK_GS One Liner For Competitive Exam.pdf
abhi01nm
 
PPTX
Animal Reproductive Behaviors Quiz Presentation in Maroon Brown Flat Graphic ...
LynetteGaniron1
 
PDF
Adding Geochemistry To Understand Recharge Areas - Kinney County, Texas - Jim...
Texas Alliance of Groundwater Districts
 
PDF
crestacean parasitim non chordates notes
S.B.P.G. COLLEGE BARAGAON VARANASI
 
Akshay tunneling .pptx_20250331_165945_0000.pptx
akshaythaker18
 
Structure and uses of DDT, Saccharin..pptx
harsimrankaur204
 
2025-06-10 TWDB Agency Updates & Legislative Outcomes
tagdpa
 
PEDIA IDS IN A GIST_6488b6b5-3152-4a4a-a943-20a56efddd43 (2).pptx
tdas83504
 
Diagnostic Features of Common Oral Ulcerative Lesions.pptx
Dr Palak borade
 
Insect Behaviour : Patterns And Determinants
SheikhArshaqAreeb
 
WUCHERIA BANCROFTI-converted-compressed.pdf
S.B.P.G. COLLEGE BARAGAON VARANASI
 
Introduction of animal physiology in vertebrates
S.B.P.G. COLLEGE BARAGAON VARANASI
 
Chemokines and Receptors Overview – Key to Immune Cell Signaling
Benjamin Lewis Lewis
 
Anatomy and physiology of digestive system.pptx
Ashwini I Chuncha
 
Different formulation of fungicides.pptx
MrRABIRANJAN
 
Step-by-Step Guide: How mRNA Vaccines Works
TECNIC
 
Carbon-richDustInjectedintotheInterstellarMediumbyGalacticWCBinaries Survives...
Sérgio Sacani
 
A young gas giant and hidden substructures in a protoplanetary disk
Sérgio Sacani
 
Introduction of Animal Behaviour full notes.pdf
S.B.P.G. COLLEGE BARAGAON VARANASI
 
LESSON 2 PSYCHOSOCIAL DEVELOPMENT.pptx L
JeanCarolColico1
 
GK_GS One Liner For Competitive Exam.pdf
abhi01nm
 
Animal Reproductive Behaviors Quiz Presentation in Maroon Brown Flat Graphic ...
LynetteGaniron1
 
Adding Geochemistry To Understand Recharge Areas - Kinney County, Texas - Jim...
Texas Alliance of Groundwater Districts
 
crestacean parasitim non chordates notes
S.B.P.G. COLLEGE BARAGAON VARANASI
 
Ad

Modeling and Reasoning in Event Calculus using Goal-Directed Constraint Answer Set Programming

  • 1. Modeling and Reasoning in Event Calculus using Goal-Directed Constraint Answer Set Programming (Extended Abstract) Joaquı́n Arias1 Manuel Carro2,3 Zhuo Chen4 Gopal Gupta4 1 CETINIA, Universidad Rey Juan Carlos, Madrid, Spain 2 Universidad Politécnica de Madrid, Spain 3 IMDEA Software Institute, Pozuelo, Spain 4 University of Texas at Dallas, Richardson, USA 3 August 2022 [ICLP’22]
  • 2. www.ia.urjc.es Introduction I Commonsense Reasoning (CR) • Requires modelling: • Non-monotonicity. • Continuous characteristics of the world. • Event Calculus (EC): formalism that represents continuous change and captures law of inertia. • EC components: Narrative A description of the world we want to model. Assumes circumscription. Axioms A generic description of how the world behaves given a narrative. • Implementing EC: logic + continuous domains. Example: A tap fills a vessel [12]. Center for Intelligent Information Technologies 1/12
  • 3. www.ia.urjc.es Introduction II Reasoning on EC: • Deduction / proving in first order logic (+ circumscription). Related Work • Non-interactive theorem prover: likely won’t always answer. • Prolog: incomplete implementations [2; 10; 13]. • Answer Set Programming (ASP): logic programming paradigm. • Has been used to model (discrete) EC [8; 9]. • Classical (C)ASP systems require grounding: • Limited to variables ranging over discrete, finite domains. • CASP proposals not applied (yet) to modeling EC: • ASPMT [7]: Action languages [6] + continuous time. • PDDL+ [1; 4]: Planning & Diagnosis. Center for Intelligent Information Technologies 2/12
  • 4. www.ia.urjc.es s(CASP) • Goal directed execution without grounding. • The execution starts with a query. ?- T #> 5, T #< 8, cross(T). • Returns partial stable models [5] Only literals supporting the query. • For each successful top-down derivation, on backtracking returns: • A justification tree. Explanation for observations. • Bindings for the free variables. T=6. • Constraint representing refined domain of the variables. T #> 5, T #< 7. Center for Intelligent Information Technologies 3/12
  • 5. www.ia.urjc.es s(CASP) • Goal directed execution without grounding. • The execution starts with a query. ?- T #> 5, T #< 8, cross(T). • Returns partial stable models [5] Only literals supporting the query. • For each successful top-down derivation, on backtracking returns: • A justification tree. Explanation for observations. • Bindings for the free variables. T=6. • Constraint representing refined domain of the variables. T #> 5, T #< 7. • Provides a constructive and sound negation: • Default negation: In the absence of information. cross(T):- not train(T). • Classical negation: Explicit knowledge. cross(T):- -train(T). Center for Intelligent Information Technologies 3/12
  • 6. www.ia.urjc.es s(CASP) • Goal directed execution without grounding. • The execution starts with a query. ?- T #> 5, T #< 8, cross(T). • Returns partial stable models [5] Only literals supporting the query. • For each successful top-down derivation, on backtracking returns: • A justification tree. Explanation for observations. • Bindings for the free variables. T=6. • Constraint representing refined domain of the variables. T #> 5, T #< 7. • Provides a constructive and sound negation: • Default negation: In the absence of information. cross(T):- not train(T). • Classical negation: Explicit knowledge. cross(T):- -train(T). • Allows rules with negated heads. -train(T):- not barrier(up,T). • Global constraints ensure consistency. :- train(T), -train(T). Center for Intelligent Information Technologies 3/12
  • 7. www.ia.urjc.es Event Calculus • EC uses a universal theory (axioms) to reason about scenarios (narrative). • Event are actions that may happens at a time point. tapOn Open the tap. • A fluent is a time-varying property of the world. filling The vessel is been filled. • Time and/or fluent may have continuous quantities associated. level(X) Level of water. Center for Intelligent Information Technologies 4/12
  • 8. www.ia.urjc.es Event Calculus • EC uses a universal theory (axioms) to reason about scenarios (narrative). • Event are actions that may happens at a time point. tapOn Open the tap. • A fluent is a time-varying property of the world. filling The vessel is been filled. • Time and/or fluent may have continuous quantities associated. level(X) Level of water. • State constraints: represent restrictions on the model: • To ensure consistency of the narrative w.r.t. the axioms. :- holds(F,T), -holds(F,T). Center for Intelligent Information Technologies 4/12
  • 9. www.ia.urjc.es Event Calculus • EC uses a universal theory (axioms) to reason about scenarios (narrative). • Event are actions that may happens at a time point. tapOn Open the tap. • A fluent is a time-varying property of the world. filling The vessel is been filled. • Time and/or fluent may have continuous quantities associated. level(X) Level of water. • State constraints: represent restrictions on the model: • To ensure consistency of the narrative w.r.t. the axioms. :- holds(F,T), -holds(F,T). • Trajectory: a fluent depends on the time elapsed since an event: • If at T1 the level of water is L1. Then, at T2 the level is L1+T2-T1. Center for Intelligent Information Technologies 4/12
  • 10. www.ia.urjc.es Event Calculus • EC uses a universal theory (axioms) to reason about scenarios (narrative). • Event are actions that may happens at a time point. tapOn Open the tap. • A fluent is a time-varying property of the world. filling The vessel is been filled. • Time and/or fluent may have continuous quantities associated. level(X) Level of water. • State constraints: represent restrictions on the model: • To ensure consistency of the narrative w.r.t. the axioms. :- holds(F,T), -holds(F,T). • Trajectory: a fluent depends on the time elapsed since an event: • If at T1 the level of water is L1. Then, at T2 the level is L1+T2-T1. • Non-monotonic reasoning • Different scenarios/worlds (uncertainty). max_level(10) or max_level(16) Vessel size. • Abductive reasoning: events may happens or not. Sequence of events to reach a final state. Center for Intelligent Information Technologies 4/12
  • 11. www.ia.urjc.es Event Calculus Basics I: Narrative Predicate Meaning initiallyN(f) fluent f is false at time 0 initiallyP(f) fluent f is true at time 0 happens(e, t) event e occurs at time t initiates(e, f, t) if e happens at time t, f is true after t terminates(e, f, t) if e occurs at time t, f is false after t releases(e, f, t) if e occurs at time t, f is released after t trajectory(f1, t1, f2, t2) if f1 is initiated at t1, then f2 is true at t2 stoppedIn(t1, f, t2) f is stopped between t1 and t2 startedIn(t1, f, t2) f is started between t1 and t2 holdsAt(f, t) fluent f is true at time t Basic event calculus (BEC) predicates e = event, f, f1, f2 = fluents and t, t1, t2 = timepoints Center for Intelligent Information Technologies 5/12
  • 12. www.ia.urjc.es Event Calculus Basics II: Axioms BEC1. StoppedIn(t1, f , t2) ≡ ∃e, t ( Happens(e, t) ∧ t1 < t < t2 ∧ ( Terminates(e, f , t) ∨ Releases(e, f , t) ) ) BEC2. StartedIn(t1, f , t2) ≡ ∃e, t ( Happens(e, t) ∧ t1 < t < t2 ∧ ( Initiates(e, f , t) ∨ Releases(e, f , t) ) ) BEC3. HoldsAt(f2, t2) ← Happens(e, t1) ∧ Initiates(e, f1, t1) ∧ Trajectory(f1, t1, f2, t2) ∧ ¬StoppedIn(t1, f1, t2) BEC4. HoldsAt(f , t) ← InitiallyP(f ) ∧ ¬StoppedIn(0, f , t) BEC5. ¬HoldsAt(f , t) ← InitiallyN(f ) ∧ ¬StartedIn(0, f , t) BEC6. HoldsAt(f , t2) ← Happens(e, t1) ∧ Initiates(e, f , t1) ∧ t1 < t2 ∧ ¬StoppedIn(t1, f , t2) BEC7. ¬HoldsAt(f , t2) ← Happens(e, t1) ∧ Terminates(e, f , t1) ∧ t1 < t2 ∧ ¬StartedIn(t1, f , t2) Formalization of BEC axioms [11] Center for Intelligent Information Technologies 6/12
  • 13. www.ia.urjc.es Translating Event Calculus into s(CASP) I: Scheme Atoms and Constants: Uniqueness of names [12] By default in s(CASP). Constraints: t1 < t2 T1 #< T2 handled by CLP(Q). Definitions: D(x) ≡ ∃yB(x, y) ∀x(D(x) ← ∃yB(x, y)) + Clark’s completion [3]. Rules with positive head: ∀x(H(x) ← ∃y(A(y) ∧ ¬B(x, y) ∧ x < y)) h(X):- X #< Y, a(Y), not b(X,Y). Rules with negative head: ∀x(¬H(x) ← ∃yB(x, y)) -h(X):- b(X,Y). :- -h(X),h(X). Rule with disjunctive bodies: ∀x[H(x) ← ∃y( (A(x, y) ∨ B(x, y)) ∧ C(x, y) )] h(X):- a(X,Y), c(X,Y). h(X):- b(X,Y), c(X,Y). Center for Intelligent Information Technologies 7/12
  • 14. www.ia.urjc.es Translating Event Calculus Axioms into s(CASP) II: Code 1 %% BEC1 2 stoppedIn(T1,F,T2) :- 3 T1 #< T, T #< T2, 4 terminates(E,F,T), 5 happens(E,T). 6 stoppedIn(T1,F,T2) :- 7 T1 #< T, T #< T2, 8 releases(E,F,T), 9 happens(E,T). 10 %% BEC2 11 startedIn(T1,F,T2) :- 12 T1 #< T, T #< T2, 13 initiates(E,F,T), 14 happens(E,T). 15 startedIn(T1,F,T2) :- 16 T1 #< T, T #< T2, 17 releases(E,F,T), 18 happens(E,T). 19 %% BEC3 20 holdsAt(F2,T2) :- 21 initiates(E,F1,T1), 22 happens(E,T1), 23 trajectory(F1,T1,F2,T2), 24 not stoppedIn(T1,F1,T2). 25 26 %% BEC4 27 holdsAt(F,T) :- 28 0 #< T, initiallyP(F), 29 not stoppedIn(0,F,T). 30 31 %% BEC5 32 -holdsAt(F,T) :- 33 0 #< T, initiallyN(F), 34 not startedIn(0,F,T). 35 36 37 %% BEC6 38 holdsAt(F,T) :- 39 T1 #< T, initiates(E,F,T1), 40 happens(E,T1), 41 not stoppedIn(T1,F,T). 42 43 %% BEC7 44 -holdsAt(F,T) :- 45 T1 #< T, terminates(E,F,T1), 46 happens(E,T1), 47 not startedIn(T1,F,T). 48 49 50 %% Consistency 51 :- -holdsAt(F,T), holdsAt(F,T). Center for Intelligent Information Technologies 8/12
  • 15. www.ia.urjc.es Example: Continuous Change Encoding. • A vessel is filled with water from a tap [12]. When the water level reaches the rim, it starts spilling. • Note state in fluents! 1 max_level(10) :- not max_level(16). 2 max_level(16) :- not max_level(10). 3 4 initiallyP(level(0)). 5 6 happens(overflow,T). 7 happens(tapOn,5). 8 9 terminates(tapOff,filling,T). 10 11 initiates(tapOn,filling,T). 12 initiates(overflow,spilling,T) :- 13 max_level(Max), holdsAt(level(Max), T). 14 releases(tapOn,level(0),T) :- happens(tapOn,T). 15 16 17 trajectory(filling,T1,level(X2),T2) :- 18 T1 #< T2, X2 #= X+4/3*(T2-T1), X2 #=< Max, 19 max_level(Max), holdsAt(level(X),T1). 20 trajectory(filling,T1,level(overflow),T2) :- 21 T1 #< T2, X2 #= X+4/3*(T2-T1), X2 #> Max, 22 max_level(Max), holdsAt(level(X),T1). 23 24 trajectory(spilling,T1,leak(X),T2) :- 25 holdsAt(filling, T2), T1 #< T2, X #= 4/3*(T2-T1). Center for Intelligent Information Technologies 9/12
  • 16. www.ia.urjc.es Example: Continuous Change Reasoning. Deduction: Determines whether a state of the world is possible. • ?- holdsAt(level(H),15/2) H=10/3. • ?- holdsAt(level(10/3),T) T=15/2. Abductive reasoning: • Determines consistent world. • ?- holdsAt(level(12),14) single model with a vessel of 16. { max_level(16), happens(tapOn,5), holdsAt(level(12),14), ... } • Determines sequence of events... Adding the directive #abducible to happens(tapOn,5) • ?- holdsAt(level(L),14) returns two models: { max_level(16), happens(tapOn,5), holdsAt(level(12),14), ... } { max_level(16), not happens(tapOn,5), holdsAt(level(0),14), ... } Center for Intelligent Information Technologies 10/12
  • 17. www.ia.urjc.es Evaluation • Note the advantage of providing constraints over continuous domains. • We compare our proposal w.r.t. F2LP + clingo: • No constraints (different precision is needed in clingo). • Conditions checked when variables instantiated. • For queries involving rational numbers, a specific version is needed. Run time (ms) comparison Queries s(CASP) F2LP+clingo and precision holdsAt(level(11),T) 301 475 10* 77,305 100 (*) With this precision, clingo computes incorrect answers. • For ?- holdsAt(level(11),T) the correct answer is T=13,25. • With precision 10, ?- holdsAt(level(110),T) holds for T=133. • With precision 100, ?- holdsAt(level(1100),T) holds for T=1325. Center for Intelligent Information Technologies 11/12
  • 18. www.ia.urjc.es Conclusions • EC can be naturally and directly encoded in s(CASP). • s(CASP) captures the notion of continuous change in EC: • Thanks to its grounding-free top-down evaluation strategy. • s(CASP) can represent complex models & answer queries: • In a flexible manner. • Thanks to the use of constraints. Center for Intelligent Information Technologies 12/12
  • 19. www.ia.urjc.es Conclusions • EC can be naturally and directly encoded in s(CASP). • s(CASP) captures the notion of continuous change in EC: • Thanks to its grounding-free top-down evaluation strategy. • s(CASP) can represent complex models & answer queries: • In a flexible manner. • Thanks to the use of constraints. • s(CASP) gives explanations for observations via abduction. Center for Intelligent Information Technologies 12/12
  • 20. www.ia.urjc.es Conclusions • EC can be naturally and directly encoded in s(CASP). • s(CASP) captures the notion of continuous change in EC: • Thanks to its grounding-free top-down evaluation strategy. • s(CASP) can represent complex models & answer queries: • In a flexible manner. • Thanks to the use of constraints. • s(CASP) gives explanations for observations via abduction. Future work • Apply the s(CASP) system to solve planning problems: • Generated plans must obey continuous- and real- time constraints. Center for Intelligent Information Technologies 12/12
  • 21. www.ia.urjc.es Conclusions • EC can be naturally and directly encoded in s(CASP). • s(CASP) captures the notion of continuous change in EC: • Thanks to its grounding-free top-down evaluation strategy. • s(CASP) can represent complex models & answer queries: • In a flexible manner. • Thanks to the use of constraints. • s(CASP) gives explanations for observations via abduction. Future work • Apply the s(CASP) system to solve planning problems: • Generated plans must obey continuous- and real- time constraints. THANKS! Center for Intelligent Information Technologies 12/12
  • 22. References www.ia.urjc.es Referencias I [1] M. Balduccini, D. Magazzeni, and M. Maratea (2016). PDDL+ Planning via Constraint Answer Set Programming. In: 9th Workshop on Answer Set Programming and Other Computing Paradigms. http://arxiv.org/abs/1609.00030. [2] L. Chittaro and A. Montanari (1996). Efficient Temporal Reasoning in the Cached Event Calculus. In: Computational Intelligence 12, pp. 359–382. doi: 10.1111/j.1467-8640.1996.tb00267.x. [3] K. L. Clark (1978). Negation as Failure. In: Logic and Data Bases. Ed. by H. Gallaire and J. Minker. Springer, pp. 293–322. doi: 10.1007/978-1-4684-3384-5_11. [4] M. Fox and D. Long (2002). PDDL+: Modeling continuous time dependent effects. In: Proceedings of the 3rd International NASA Workshop on Planning and Scheduling for Space. Vol. 4, p. 34. Center for Intelligent Information Technologies 13/12
  • 23. References www.ia.urjc.es Referencias II [5] M. Gelfond and V. Lifschitz (1988). The Stable Model Semantics for Logic Programming. In: 5th International Conference on Logic Programming, pp. 1070–1080. doi: 10.2307/2275201. url: http://www.cse.unsw.edu.au/~cs4415/2010/resources/stable.pdf. [6] – (1993). Representing Action and Change by Logic Programs. In: The Journal of Logic Programming 17.2-4, pp. 301–321. [7] J. Lee and Y. Meng (2013). Answer Set Programming Modulo Theories and Reasoning about Continuous Changes. In: 23rd Int’l. Joint Conference on Artificial Intelligence, pp. 990–996. [8] J. Lee and R. Palla (2009). System F2LP – Computing Answer Sets of First-Order Formulas. In: Logic Programming and Nonmonotonic Reasoning. Berlin, Heidelberg: Springer Berlin Heidelberg, pp. 515–521. doi: 10.1007/978-3-642-04238-6_51. Center for Intelligent Information Technologies 14/12
  • 24. References www.ia.urjc.es Referencias III [9] J. Lee and R. Palla (2012). Reformulating the Situation Calculus and the Event Calculus in the General Theory of Stable Models and in Answer Set Programming. In: Journal of Artificial Intelligence Research 43, pp. 571–620. [10] E. T. Mueller (2008). Chapter 17: Event Calculus. In: Handbook of Knowledge Representation. Ed. by F. van Harmelen, V. Lifschitz, and B. Porter. Vol. 3. Foundations of AI. Elsevier, pp. 671 –708. doi: 10.1016/S1574-6526(07)03017-9. [11] – (2014). Commonsense reasoning: an event calculus based approach. Morgan Kaufmann. doi: 10.1016/B978-0-12-801416-5.00002-4. [12] M. Shanahan (1999). The Event Calculus Explained. In: Artificial Intelligence Today. Springer, pp. 409–430. doi: 10.1007/3-540-48317-9_17. [13] – (2000). An Abductive Event Calculus Planner. In: The Journal of Logic Programming 44.1-3, pp. 207–240. Center for Intelligent Information Technologies 15/12
  • 25. References www.ia.urjc.es Center for Intelligent Information Technologies 16/12