Introduction
Definitions
Applications
Summary Appendix
Petri nets for modeling problem of logic programming and knowledge representation Perspective for modeling Fluent Calculus o0o
Doan Trung Son
12th of July, 2012
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Appendix
Motivation
...what in a computational architecture of [Barret 2010] I
Combining interacting procedural model (based on Petri net) and inferential model (called the Probabilistic Relational Model) to capture structure of actions.
...but I Inference can not implement on achieved Petri nets Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Appendix
Motivation Question? How to apply Petri nets to Fluent Calculus and vice versa? Similar thing... I Fluent Calculus consider state as multiset of fluent and represent state
on the term level I High-level Petri nets has state representing the distribution of
multiset tokens. Each places stand for predicate I Mathematical foundation: Multiset satisfies foundational axiom (AC1) I Relation between transition rule in Petri nets with update axioms of
fluent in Fluent Calculus.
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Appendix
Outline Structure Part 1. Definitions of Petri nets Part 2. Applications of Petri nets Problems: I Robot planning I
Son D.T
Well-founded semantics
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary P/T netsAppendix HLPN EPN
What kind of Petri nets for investigation: 1. High-level Petri nets I Robot planning . . . for modeling Fluent Calculus in High-level Petri nets 2. Extended Petri nets I Well-founded semantics . . . for modeling Well-founded model in Extended Petri nets
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary P/T netsAppendix HLPN EPN
Definition: Place/Transition nets Place/Transition nets is 5-tuple: hP, T, F, W, M0 i I
P is a finite set of places
I
T is a finite set of transitions
I
F ⊆ (P × T ) ∪ (T × P ) is set of arcs
I
W : F → {N/0} is weight function, assigning a positive integer to each arc
I
M0 : P → N is the initial marking representing the initial distribution of tokens
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary P/T netsAppendix HLPN EPN
Place/Transition nets example
The Place/Transition nets above is defined as follows: I P = {p1 , p2 , p3 , p4 , p5 , p6 } and T = {t1 , t2 , t3 , t4 } where: I F = {hp1 , t1 i, ht1 , p2 i, ht1 , p3 i, hp2 , t2 i, ht2 , p4 i, hp4 , t4 i, hp3 , t3 i, ht3 , p5 i, hp5 , t4 i, ht4 , p6 i} I W = {hp1 , t1 i : 2, ht1 , p2 i : 1, ht1 , p3 i : 1, hp2 , t2 i : 2, ht2 , p4 i : 1, hp4 , t4 i : 1, hp3 , t3 i : 1, ht3 , p5 i : 1, hp5 , t4 i : 1, ht4 , p6 i : 1} I M0 = {p1 → 3, p2 → 0, p3 → 0, p4 → 1, p5 → 0, p6 → 0} = h3, 0, 0, 1, 0, 0i Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary P/T netsAppendix HLPN EPN
Transition Rule Let hP, T, F, W, M0 i be a Petri net and marking M : P → N Firing condition: I
Transition t ∈ T is enabled iff every input place p of transition t satisfy: M (p) > W (p, t)
Firing rule: I
Transition t ∈ T may fire and produce the successor t
0
making M written by M → M
0
0
where: ∀p ∈ P : M (p) = M (p) − W (p, t) + W (t, p) NOTE: if hp, ti ∈ / F or ht, pi ∈ / F then W hp, ti = 0 or W ht, pi = 0 correspondingly. Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary P/T netsAppendix HLPN EPN
Definition: High level Petri nets High-level Petri nets is 8-tuple: hP, T, F, Sig, V, Sort, AN, M0 i where: I P: set of Places I T: set of Transitions I F: set of Arcs. Each arcs is pair of (Arc, T ypeArc). T ypeArc : Arc → N is a function which assign types to arcs. I Sig: Sig = (S, O) is a Boolean signature I V: set of Variables I Sort: Sort : P → S is a function which assigns sorts to places I AN: AN = (A, T C): a pair of net annotations A : F → TERM(O ∪ V): function that annotates each arc with a term of the same sort as that of the associated place TC : T → TERM(O ∪ V)Bool : function that annotates transitions with Boolean terms I M0 : Initial marking M0 : P → T ERM (O): function which associates a ground term with each place or ∀p ∈ P, M0 (p) ∈ T ERM (O)Sort(p) Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary P/T netsAppendix HLPN EPN
High level Petri nets ∇ Enabling transition: The marking of each input place of the transition satisfies the demand imposed on it by its arc annotation evaluated for the particular transition mode. ∇ Transition rule: 1. For each input places of the transition: the enabling tokens of the input arc annotation in the transition mode are substracted from the input places’s marking 2. For each output place of the transition: the multiset of tokens of the evaluated output arc annotation is added to the output place’s marking. Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary P/T netsAppendix HLPN EPN
Extended Petri nets (EPN) EPN: Place/Transition nets with an extended set of inhibitor arcs ∇ Siphon (deadlock): A nonempty set of places S in an ordinary Petri net is called a siphon if every transition having an output places in S has an input place in S. F Siphon in EPN is a siphon when we consider all inhibitor arcs that are deleted F Greatest siphon in EPN is the union of all possible siphons in the net Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
I. Blocks World Problem INITIAL STATE: OnTable(A), OnTable(B), Clear(B), Clear(C), HandEmpty, On(C,A) OPERATORS: I PICKUP(x) Pre-conditions and delete condition: OnTable(x), Clear(x), HandEmpty Add condition: Holding(x)
I
PUTDOWN(x) Pre-condition and delete condition: Holding(x) Add conditions: OnTable(x), Clear(x), HandEmpty
I
UNSTACK(x,y) Pre-condition and delete condition: Clear(x), On(x,y) Add conditions: Holding(x), Clear(y)
I
STACK(x,y) Pre-condition and delete condition: Holding(x), Clear(y) Add conditions: HandEmpty, On(x,y), Clear(x)
GOAL: OnTable(C),Clear(A),On(B,C),On(A,B) Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Modeling for single-hand robot planning
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Modeling for multi-hand robot planning
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
II. Representation of normal logic program in Petri net Why Fix-point semantics is defined for Petri nets? Logical equivalence Alternative theorem proving technique
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Transformation Procedure 1 Instantiated normal logic program clause C in form of: A ← B1 , ..., Bn , ¬D1 , ..., ¬Dm Transformation 1: 1. Draw a transition and label it with C 2. Draw a place and arc from transition C to the place and label the place with A 3. If n 6= 0 the repeat the following f or i = 1 to n : Draw a place and a normal arc from the place to the transition C and label the place with Bi 4. If m 6= 0 the repeat the following f or i = 1 to m : Draw a place and an inhibitor arc from the place to the transition C and label the place with Di Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Transformation Procedure 2 Transformation 2: 1. For each clause, do the Transformation 1 2. For each label of the place produced by the above step, superimpose all the places that have the same label Let the normal logic program P be: C1: b ← ¬a C2 : c ← ¬b C3 : c ← a, ¬p C4 : p ← ¬q C5 : q ← ¬p, b
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Notes: O P L: set of all places i.e :
PL = {a, b, c, p, q}
O T R: set of all transitions i.e :
TR = {C1, C2, C3, C4, C5}
O ST : set of all source transition i.e :
ST = {∅}
O GS1 : a greatest siphon i.e :
GS1 = {a}
O Bp : the Herbrand base of a program P
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Algorithm (1): 3 steps compute the well founded model We have I0 =< ∅, ∅ > and Ii = Wp (Ii−1 ) =< Ti , Fi > for i ≥ 1: O Algorithm: .Step 1: For i = 0: T0 = ∅ F = ∅ 0 .Step 2: For i = 1: T1 = all output places of source transitions F = GS ∪ (B − PL) 1 1 p
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Algorithm (2): 3 steps compute the well founded model . Step 3: For i = 2,3,4... 0
h1i Ti = Ti−1 ∪ Ti where: 0
Ti = {x ∈ P L| for some input transition t of x if there exists input place u ∈ Fi−1 of an inhibitor arc of t (Form 1) or if there exists input place u ∈ Ti−1 of a non-inhibitor arc of t (Form 2) h2i Fi = GSi ∪ (Bp − PL) where: GSi : the greatest siphon in the net obtained by deleting all transitions of T Ri . T Ri = {t ∈ T R| there exists either: a non-inhibitor arc from u ∈ Fi−1 to t (Form 3) or an inhibitor arc from u ∈ Ti−1 to t (Form 4)} Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Graphical interpretation for Step 3
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Graphical interpretation for Step 3
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Example 1: Steps of Implementation 1. For i = 0: T0 = {∅} F0 = {∅} 2. For i = 1: T1 = {∅} F1 = {a} 3. For i = 2: T2 = {b} F2 = {a} 4. For i = 3: T3 = {b} F3 = {a, c} 5. For i = 4: T4 = {b} F4 = {a, c} ∴ Well-founded model is < {b}, {a, c} >
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Example 2: Let the normal logic program P be: C1 : q(a) ← r(a), ¬q(b) C2 : q(b) ← where q,r: are predicate symbols and a,b are constant symbols. Steps of Implementation 1. For i = 0: T0 = {∅} and F0 = {∅} 2. For i = 1: T1 = {q(b)} and F1 = {r(a), r(b), q(a)} 3. For i = 2: T2 = T1 and F2 = F1 ∴ Well-founded model is < {q(b)}, {r(a), r(b), q(a)} > Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary Robot planning Appendix Well-founded semantics
Example 3: Let the normal logic program P be: C1 : b ← ¬a C2 : c ← b C3 : b ← c C4 : c ← ¬d C5 : e ← c
C6 : a ←
C7 : d ←
Steps of Implementation 1. For i = 0: T0 = {∅} and F0 = {∅} 2. For i = 1: T1 = {a, d} and F1 = {∅} 3. For i = 2: T2 = {a, d} and F2 = {b, c, e} ∴ Well-founded model is < {a, d}, {b, c, e} > Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary SummaryAppendix Further investigation
Summary
Planning problem Robot planning Logic program Well-founded semantics
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary SummaryAppendix Further investigation
Further investigation
Equivalent components with Fluent Calculus. Search Algorithms in High-level Petri-nets. Real-time systems. Correlation with Neural-Symbolic systems.
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
Petri nets for modeling problems logic program and knowledge representation
Application Artificial Intelligent Neural Network Algorithm State Discuss Agent Action language Fluent calculus Problem Sort Matrix Analysis Inference Semantic
PETRI NET
Operator
Combination Feature Graph Space First order logic Flux player Goal Syntax Representation
Solution Rule
Transition
Planing Well-founded semantic
Interpretation Fix point semantics
Model checking Lattice theory
Logic
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
Reference(1) [1]. High level Petri nets - Concepts, Definitions and Graphical Notation. Final Draft International Standard ISO/IEC 15909. Tadao Mutara and Du Zhang. [2]. A predicate transition net model for parallel interpretation of logic programs. Tadao Mutara, Peter C. Nelson and Jacgeol Yim. [3]. A predicate transition net model for multi agent planning. Inf. Sci. 57-58: 361-384 (1991)
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
Reference(2) Teruhiro Shimura, Jorge Lobo and Tadao Mutara. [4]. An extended Petri net model for normal logic programs. IEEE Trans. Knowl. Data Eng. 7(1): 150-162 (1995). Tadao Mutara, V.S. Subrahmanian and Toshiro Wakayama. [5]. A Petri net model for reasoning in the presence of inconsistency. IEEE Trans. Knowl. Data Eng. 3(3): 281-292 (1991). Tadao Mutara. [6]. Some recent application of high level Petri nets.
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
Reference(3) Tadao Mutara fellow IEEE. [7]. Petri nets: properties, analysis and applications. Proceedings of the IEEE. Michael Thielscher. [8]. Introduction to the Fluent Calculus. Leon Rubin Barrett. [9]. An Architecture for Structured, Concurrent, Real-time Action Doctor dissertation in Computer Science.
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
Multiset Definition Multiset Multiset B over non empty basic set A is a function B : A → N which associates a multiplicity with each of the basic elements. Multiplicity of a ∈ A in B, is given by B(a). The set of multisets over A is denoted by µA. Sum Representation A multiset may be represented by their multiplicities as P 0 symbolic sum of basic elements: B = a∈A B(a) a
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
Multiset(next) Membership Given a multiset B ∈ µA, a ∈ A is a member of B, denoted a ∈ B if B(a) ≥ 0 and conversely if B(a) = 0 then a ∈ /B Empty multiset The empty multiset ∅ has no member: ∀a ∈ A, ∅(a) = 0 Multiset equality and comparation Two multiset B1andB2 ∈ µA are equal B1 = B2 iff ∀a ∈ A, B1(a) = B2(a) B1 is less than or equal to B2, B1 ≤ B2 iff ∀a ∈ A, B1(a) ≤ B2(a) Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
Multiset(next) Multiset Operation The addition operation and subtraction partial operation on two multiset B1, B2 ∈ µA: B = B1 + B2 iff ∀a ∈ A : B(a) = B1(a) + B2(a) B = B1 − B2 iff ∀a ∈ A if B1(a) ≥ B2(a) then B(a) = B1(a) − B2(a) Scalar multiplication of a multiset B1 ∈ µA by a natural number n ∈ N is defined as: B = nB1 if ∀a ∈ A, B(a) = n × B1(a) where × is arithmetic multiplication.
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
II. Horn clause logic program
∇ Let the Horn clause logic program be: C1 : P arent(David, M ary) ← C2 : P arent(M ary, T om) ← C3 : Ancestor(x, y) ← P arent(x, y) C4 : Ancestor(x, z) ← P arent(x, y), Ancestor(y, z) C5 :← Ancestor(x, T om) ∇ There are 2 firing sequences δ1 , δ2 which start from the empty marking, fire the goal transition C5 and end at the empty marking: δ1 =< C2 , C3 , C5 > with substitution {M ary|x} then x = Mary δ2 =< [C1 , C2 ], C3 , C4 , C5 > with substitution {David|x} then x = David Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
III. Non-monotonic reasoning ∇ Let the non-monotonic logic program be: C1 : a ← C2 : b ←, unless(c) C3 : a ←, unless(b) Fix point of nonmonotonic theory can be represented as the support of a firing sequence which is maximal and consistent. There are two fix point {a, b} and {a, c}
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
IV. Example of annotated predicate logic program 1. d1 (< x, t >) ← s1 (< x, t >) & s2 (< x, t >)
9. s2 (< John, f >) ←
2. d2 (< x, t >) ← s1 (< x, t >) & s3 (< x, t >)
10. s2 (< Bill, f >) ←
3. d1 (< x, t >) ← d2 (< x, t >)
11. s3 (< John, t >) ←
4. d2 (< x, t >) ← d1 (< x, t >)
12. s3 (< Bill, t >) ←
5. d1 (< x, t >) ← s1 (< x, t >) & s4 (< x, t >)
13. s4 (< John, t >) ←
6. d2 (< x, t >) ← s1 (< x, t >) & s3 (< x, t >)
14. s4 (< Bill, f >) ←
7. s1 (< John, t >) ←
15. ← d1 (< x, t >)
8. s1 (< Bill, f >) ←
16. ← d1 (< x, f >)
Interpretation: Two doctors DOC1 and DOC2 have given their rules to diagnose two diseases d1 , d2 from four symptoms s1 , s2 , s3 , s4 Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
The high level Petri net of mini expert system Three firing sequences which reproduce the empty initial marking and fire a goal t15,t16: δ1 =< t7 , t13 , t5 , t15 > δ2 =< t7 , t11 , t2 , t3 , t16 > δ3 =< t8 , t12 , t6 , t3 , t16 > Remark: It is possible to perform reasoning or inference even if knowledge bases are inconsistent. Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012
Introduction
Definitions
Applications
Summary ReferenceAppendix Multiset Application in Horn clause logic
Theorem Necessary and sufficient conditions for the goal transition satisfirability.
Let N be the high level representation of a finite horn clause logic program P. Let G be a goal clause and tg be the corresponding goal transition in N. Then the following three statements are equivalent: P ∪ ¬G has a contradiction There exists a firing sequence which reproduces the empty marking and fires the goal transition tg in N N has non-negative T-invariant X such that X(tg ) 6= ∅.
Son D.T
Petri nets for logic programming and knowledge representation
12th of July, 2012