structured control for active tree tree pattern rewriting systems (tprs)

33
Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Upload: maud-glenn

Post on 27-Dec-2015

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Structured Control for Active Tree

Tree Pattern Rewriting Systems

(TPRS)

Page 2: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

MailOrder Example

Page 3: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Mail Order: Play.com example

MailOrder (similar to Luc, Serge, Victor): -Catalog of Product, -Order History of Customer (Including Cart).

Orders can be successively: in cart, ordered, processed, posted and received.

Page 4: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Mail Order: Play.com example

What we want to know: - Products and their price of an order- Number of days since a product has been posted

Page 5: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Mail Order: Play.com example

What we want to allow a customer to do (through services): - Customer can register or resilliate.- Customer can add and delete products from their cart- Customer can checkout an order.- Customer can cancel a non processed order- Customer can be refunded if product not delivered after 21 days

Page 6: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Mail Order: Play.com example

What we want to verify: - Can a canceled or refunded order be delivered?- Can the system run infinitely?- Can 2 runs with same services calls with same matching but in different order result in different trees ? (kind of confluence)

Page 7: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

A TPRS rule

Page 8: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

TPRS : The query

Rule Processing gives a bill for an order. Find all the products and their price with a TPQuery.

W2[Ordered]

w3[X]

W1[Play.com]

Name

Y

product

X

w4[Y]

PriceTPQ:

TPQL TPQR

Page 9: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

TPRS : Evaluation of the query

Rule Processing gives a bill for an order. Find all the products and their price with a TPQuery.

W2[Ordered]

w3[X]

W1[Play.com]

w4[Y]Name

product

Price

X YLOTR £25

Page 10: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

TPRS : Evaluation of the query

Rule Processing gives a bill for an order. Find all the products and their price with a TPQuery.

W2[Ordered]

w3[X]

W1[Play.com]

w4[Y]Name

product

Price

X Yskins £10

Page 11: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

TPRS : result of the query

Rule Processing gives a bill for an order. Find all the products and their price with a TPQuery.

Page 12: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

TPRS : the “processing” rule

Rule Processing gives a bill for an order. Find all the products and their price with a TPQuery. Find an ordered product and process it by appending the bill

W2[Ordered]

w3[X]

W1[root]

Name

Y

product

X

w4[Y]

Price

Page 13: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Applying a TPRS rule

Page 14: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

TPRS : the “processing” rule

Semantics: 1) Find a customer with an order with status Ordered.2) Compute the result of query relative to this order3) Delete the ordered son and its subtree4) Add under the customer a node processed plus the bill with the products found by the query associated with this order (self)

W2[Ordered]

w3[X]

W1[root]

Name

Y

product

X

w4[Y]

Price

Page 15: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Mail Order: Play.com example

2) Compute result of TPQ with w2 = v10

1) Match left

Page 16: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Mail Order: Play.com example

1) Match left

2) Compute result of TPQ with w2 = v10

3) Delete node w2 = v10

Page 17: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Mail Order: Play.com example

4) Add a node Processed with a son Bill and the result of the query under it.

Page 18: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Other rules:

Page 19: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Other rules:

Page 20: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Decidability

Page 21: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Models

restrictions

Positive AXML

Guarded

AXML

TPRS

deletion No Yes Yes

Control cycles Yes No (Bounded number steps)

Yes

Inf alphabet No Yes No

Depth all bounded bounded*

Negative Pattern No Yes No

Property Basic TreePattern

LTL

Pattern

Reachab.

Complexity P-EXP 2EXP Non elem.

No cycles in control (or no deletion): cannot (add and delete) a product from cart.

Page 22: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Models

restrictions

Positive AXML

Guarded

AXML

TPRS

deletion No Yes Yes

Control cycles Yes No (Bounded number steps)

Yes

Inf alphabet No Yes No

Depth all bounded bounded*

Negative Pattern No Yes No

Property Basic TreePattern

LTL

Pattern

Reachab.

Complexity P-EXP 2EXP Non elem.No Inf alphabet: products in catalog are fixed, cannot relate bank account/customer, return messages, cannot have fine control (who is making the choice? Several peers. -> all non det.)

Page 23: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Models

restrictions

Positive AXML

Guarded

AXML

TPRS

deletion No Yes Yes

Control cycles Yes No (Bounded number steps)

Yes

Inf alphabet No Yes No

Depth all bounded bounded*

Negative Pattern No Yes No

Property Basic TreePattern

LTL

Pattern

Reachab.

Complexity P-EXP 2EXP Non elem.Depth: not important for MailOrder exampleCan have unbounded depth with TPRS if use only ancestor orderAnd not parent/son (use Kruskall Theorem)

Page 24: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Models

restrictions

Positive AXML

Guarded

AXML

TPRS

deletion No Yes Yes

Control cycles Yes No (Bounded number steps)

Yes

Inf alphabet No Yes No

Depth all bounded bounded*

Negative Pattern No Yes No

Property Basic TreePattern

LTL

Pattern

Reachab.

Complexity P-EXP 2EXP Non elem.

Negative Pattern: useful for optimization (a rule disabled if another rule with higher priority is allowed)

Page 25: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Conclusion:

No current solution is good enough!(Still both are useful to understand what we can and cannot do).

We should at least have: - Infinite Alphabet - Unbounded controlTo model precisely a REAL system.

Page 26: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Main Tool For TPRS

the following < is a well quasi order:A< B if A can be injectively send on B (son/label preserved). Equivalently, A is obtained from B by deleting subtrees.Then, in any infinite sequence, there exists u_i > u_j with i>j

In particular, finite number of minimal events in a forest.

WSTS for well quasi order <

If X Y and X ->* X’ thenY’ with X’ Y’ and Y ->* Y’

X < Y

X’ < Y’That’s why we cannot test negative pattern

Page 27: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Idea: Unbounded control + Infinite Alphabet?

the following < is a well quasi order:The minor order in graphs.

Equivalence class

Infinite alphabet: can be seen as equivalence class

x y z

Bankaccount

customer

The obtained structure is a graph (actually 2 tree structures mixed): Apply Minor Th.

Page 28: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Lower Bound

Page 29: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Simulate deterministic Turing machine:

Hard to encode the tape of the machine:

We should keep some unbounded linear order.But no order between brothers, no infinite depthor infinite depth but no linear order…

If we can count accurately to N, increment, decrement, copythen we can simulate a machine of space(N).

Page 30: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Simulate deterministic Turing machine:

b

2

M

1

b,qa

30

a

Simulation du ruban abqba

run

Page 31: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Simulate deterministic Turing machine:

b

2

M

1

b,qa

30

a

Pas q,b -> a, droite: b,q

Y

M

X

Z a

Y

M

X

Z,qCheck-suc

YX

21

run

run

Page 32: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

Simulate deterministic Turing machine:

b

2

M

1

aa

30

a,q’ run

We have obtained the successor state!If wrong guess of « Y = X+1 » then deadlock.We reach halt in the new systm iff we reach halt in the first system.

Page 33: Structured Control for Active Tree Tree Pattern Rewriting Systems (TPRS)

How high can we count?

Representation of 13 = 8+4+1

First bit last bit

First bit last bit

We can do a tower of exponential! Non elementary complexity.