Finding a Forest in a Tree The matching problem for wide reactive - - PowerPoint PPT Presentation

finding a forest in a tree
SMART_READER_LITE
LIVE PREVIEW

Finding a Forest in a Tree The matching problem for wide reactive - - PowerPoint PPT Presentation

Finding a Forest in a Tree The matching problem for wide reactive systems Giorgio Bacci, Marino Miculan, Romeo Rizzi Dept. of Computer Science, Aalborg University Breakfast Talk (presented @ TGC 2014) Outline of the talk Introduction


slide-1
SLIDE 1

Finding a Forest in a Tree

The matching problem for wide reactive systems

Giorgio Bacci, Marino Miculan, Romeo Rizzi

  • Dept. of Computer Science, Aalborg University

Breakfast Talk (presented @ TGC 2014)

slide-2
SLIDE 2

Outline of the talk

  • Introduction
  • The problem: forest matching
  • NP-completeness
  • Fixed-parameter Algorithm (the core only)
  • Concluding remaks
slide-3
SLIDE 3

Motivations

  • Reactive systems (aka reduction systems)

are common in process calculi

  • Defined by
  • a set of reduction rules l(x)→r(x)
  • a contextual closure

l(x)→r(x) a=C[l(x)σ] b=C[r(x)σ] a→b

  • However: not always easy to apply,

especially in models of global computing

slide-4
SLIDE 4

Ex: Message Passing

S1 S2 x

ā⟨M⟩.P | a(x).Q → P | Q[M/x] a

M

slide-5
SLIDE 5

Ex: Message Passing

S1 S2 x

ā⟨M⟩.P | a(x).Q → P | Q[M/x]

M

slide-6
SLIDE 6

C2 C1

Ex: Remote Message Passing

S1 S2 M x

C1[ā⟨M⟩.P] | C2[a(x).Q] → C1[P] | C2[Q{M/x}] a

slide-7
SLIDE 7

C2 C1

Ex: Remote Message Passing

S1 S2 M x

C1[ā⟨M⟩.P] | C2[a(x).Q] → C1[P] | C2[Q{M/x}] a Infinite reduction rules are needed (one for each pair C1,C2)

slide-8
SLIDE 8

⟨C1 , C2⟩ S1 S2 M x

⟨ā⟨M⟩.P , a(x).Q⟩ → ⟨P , Q{M/x}⟩ a

Ex: Remote Message Passing

slide-9
SLIDE 9

⟨C1 , C2⟩ S1 S2 M x

⟨ā⟨M⟩.P , a(x).Q⟩ → ⟨P , Q{M/x}⟩ a Just one wide reduction rule Context has two holes

Ex: Remote Message Passing

slide-10
SLIDE 10

Wide reactive systems

A set of wide reaction rules ⟨l1(x1),…, ln(xn)⟩ → ⟨r1(y1),…, rn(yn)⟩ with {y1,…, yn} ⊆ {x1,…, xn} Contextual closure:

⟨l1(x1),…, ln(xn)⟩ → ⟨r1(y1),…, rn(yn)⟩ a=C[l1(x1)σ,…, ln(xn)σ] b=C[r1(y1)σ,…, rn(yn)σ] a→b

slide-11
SLIDE 11

Wide vs. Non-wide

slide-12
SLIDE 12

Wide vs. Non-wide

  • WRSs are more expressive than non-WRSs
slide-13
SLIDE 13

Wide vs. Non-wide

  • WRSs are more expressive than non-WRSs
  • non-wide are a particular case of wide (width = 1)
slide-14
SLIDE 14

Wide vs. Non-wide

  • WRSs are more expressive than non-WRSs
  • non-wide are a particular case of wide (width = 1)
  • WRSs need less rules (often, finite instead of infinite)
slide-15
SLIDE 15

Wide vs. Non-wide

  • WRSs are more expressive than non-WRSs
  • non-wide are a particular case of wide (width = 1)
  • WRSs need less rules (often, finite instead of infinite)
  • Pattern matching in WRSs is more complex
slide-16
SLIDE 16

Wide vs. Non-wide

  • WRSs are more expressive than non-WRSs
  • non-wide are a particular case of wide (width = 1)
  • WRSs need less rules (often, finite instead of infinite)
  • Pattern matching in WRSs is more complex
  • The bad news: NP-complete
slide-17
SLIDE 17

Wide vs. Non-wide

  • WRSs are more expressive than non-WRSs
  • non-wide are a particular case of wide (width = 1)
  • WRSs need less rules (often, finite instead of infinite)
  • Pattern matching in WRSs is more complex
  • The bad news: NP-complete
  • The good news: combinatorial explosion depends on

redex width only (constant and usually ≤3)

slide-18
SLIDE 18

Linear Context Trees

T(X) :: 0 empty tree x leaf (x ∈ X) m[ T(X)] labeled tree T(X’) | T(X’’) siblings (X = X’ ⊎ X’’) =

T(X) T(Y) m n

m[ T(X)] | n[T(Y)]

slide-19
SLIDE 19

Linear Context Trees

T(X) :: 0 empty tree x leaf (x ∈ X) m[ T(X)] labeled tree T(X’) | T(X’’) siblings (X = X’ ⊎ X’’) =

Unordered

(up to structural congruence ≡) T(X) T(Y) m n

m[ T(X)] | n[T(Y)]

slide-20
SLIDE 20

S

...

The matching problem

T ≡ (C{S/z}){D ,...,D /x ,...,x }

1 m 1 m

D D

1 m

C T ≡ Context Pattern Parameters

slide-21
SLIDE 21

S

... T ≡ (C{S ,...,S /z ,..., z }){D ,...,D /x ,...,x }

1 h 1 h 1 m 1 m

D D

1 m

C T ≡ Context Pattern list Parameters

forest

1

S

...

h

... ...

The matching problem

slide-22
SLIDE 22

Forest matching is NP-complete

  • Tree matching problem is in P

(subtree isomorphim algorithm [Matula’78])

  • Forest matching problem is NP-complete!

S

... D D

1 m

C

1

S

...

h

... ... The pattern matchings must not overlap = antichain in T

slide-23
SLIDE 23

Forest matching is NP-complete

  • Tree matching problem is in P

(subtree isomorphim algorithm [Matula’78])

  • Forest matching problem is NP-complete!

S

... D D

1 m

C

1

S

...

h

... ... The pattern matchings must not overlap = antichain in T

≠ sub-forest isomorphism

slide-24
SLIDE 24

Rainbow antichain

Instance: a tree T colored on palette P of colors. Problem: to find a P-colorful antichain in T.

slide-25
SLIDE 25

Rainbow antichain

Instance: a tree T colored on palette P of colors. Problem: to find a P-colorful antichain in T. Proof sketch of NP-hardness

slide-26
SLIDE 26

Rainbow antichain

Instance: a tree T colored on palette P of colors. Problem: to find a P-colorful antichain in T.

reduction from 3-SAT

Proof sketch of NP-hardness

slide-27
SLIDE 27

Rainbow antichain

Instance: a tree T colored on palette P of colors. Problem: to find a P-colorful antichain in T. ( x v y v z ) ( x v y v z ) _ _ v

C1 C2

reduction from 3-SAT

Proof sketch of NP-hardness

slide-28
SLIDE 28

Rainbow antichain

Instance: a tree T colored on palette P of colors. Problem: to find a P-colorful antichain in T. ( x v y v z ) ( x v y v z ) _ _ v

C1 C2

x

x

_ y

y

_ z

z

_

C2 C2 C2 C1 C1 C1

reduction from 3-SAT

Proof sketch of NP-hardness

slide-29
SLIDE 29

Rainbow antichain

Instance: a tree T colored on palette P of colors. Problem: to find a P-colorful antichain in T. ( x v y v z ) ( x v y v z ) _ _ v

C1 C2

x

x

_ y

y

_ z

z

_

C2 C2 C2 C1 C1 C1

reduction from 3-SAT

every truth assignment satisfying the formula induces a rainbow antichain ...and vice versa

Proof sketch of NP-hardness

slide-30
SLIDE 30

Fixed-parameter Tractability

How to cope with computational intractability?

approximation algorithms, average case analysis, randomized algorithms, heuristics methods, etc...

slide-31
SLIDE 31

Fixed-parameter Tractability

How to cope with computational intractability?

approximation algorithms, average case analysis, randomized algorithms, heuristics methods, etc... [Downey-Fellows’99] FPT’s basic observation: “for many hard problems, the seemingly inherent combinatorial explosion really can be restricted to a ‘small part’ of the input, the parameter”

slide-32
SLIDE 32

Parameterized algorithm for Rainbow antichain

  • Rainbow antichain is the core problem

behind the forest matching problem

  • Rainbow antichain is solved in 2 steps:
  • 1. Reduction to kernel-size of the input tree
  • 2. Exhaustive search of a rainbow antichain
slide-33
SLIDE 33

Parameterized algorithm for Rainbow antichain

  • Rainbow antichain is the core problem

behind the forest matching problem

  • Rainbow antichain is solved in 2 steps:
  • 1. Reduction to kernel-size of the input tree
  • 2. Exhaustive search of a rainbow antichain

parameter: size of P

slide-34
SLIDE 34
  • 1. Reduction by decoloring

delete u Deletion of uncolored nodes does not influence existence of rainbow antichain!

u x y v x y v

(*) we will assume the root cannot be deleted

slide-35
SLIDE 35

Decoloring (rule 1)

u

decolor u

u

Ancestors with the same color can be decolored

slide-36
SLIDE 36

Decoloring (rule 2)

u

decolor u If the tree has all leaves of the same color, then leaves with fan-out ≥ |P| can be decolored

u

fout(u) = 4 (*) fout(u) = out-degree of the whole path from u to the root

slide-37
SLIDE 37

How to apply the rules?

(an example of reduction to kernel size)

P = { red, yellow, green }

slide-38
SLIDE 38

How to apply the rules?

(an example of reduction to kernel size)

Rule 1: Decoloring of ancestors of the same color

slide-39
SLIDE 39

How to apply the rules?

(an example of reduction to kernel size)

Rule 1: Decoloring of ancestors of the same color

slide-40
SLIDE 40

How to apply the rules?

(an example of reduction to kernel size)

Rule 1: Decoloring of ancestors of the same color

slide-41
SLIDE 41

How to apply the rules?

(an example of reduction to kernel size)

Rule 1: Decoloring of ancestors of the same color

slide-42
SLIDE 42

How to apply the rules?

(an example of reduction to kernel size)

Rule 1: Decoloring of ancestors of the same color

slide-43
SLIDE 43

How to apply the rules?

(an example of reduction to kernel size)

Rule 1: Decoloring of ancestors of the same color

slide-44
SLIDE 44

How to apply the rules?

(an example of reduction to kernel size)

Rule 1: Decoloring of ancestors of the same color

slide-45
SLIDE 45

How to apply the rules?

(an example of reduction to kernel size)

Rule 1: Decoloring of ancestors of the same color

Uncolored nodes can be removed

slide-46
SLIDE 46

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

slide-47
SLIDE 47

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

Only leaves with the same color

slide-48
SLIDE 48

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

slide-49
SLIDE 49

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

fout(u) = 6

slide-50
SLIDE 50

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

fout(u) = 6

slide-51
SLIDE 51

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

fout(u) = 6 fout(u) = 5

slide-52
SLIDE 52

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

fout(u) = 6 fout(u) = 5

slide-53
SLIDE 53

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

fout(u) = 6 fout(u) = 4 fout(u) = 5

slide-54
SLIDE 54

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

fout(u) = 6 fout(u) = 4 fout(u) = 5

slide-55
SLIDE 55

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

fout(u) = 6 fout(u) = 3 fout(u) = 4 fout(u) = 5

slide-56
SLIDE 56

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

fout(u) = 6 fout(u) = 3 fout(u) = 4 fout(u) = 5

slide-57
SLIDE 57

How to apply the rules?

(an example of reduction to kernel size)

Rule 2: Decoloring of nodes with fan-out ≥ |P|

fout(u) = 6 fout(u) = 3 fout(u) = 4 fout(u) = 5

and repeat for each color...

slide-58
SLIDE 58

How to apply the rules?

(an example of reduction to kernel size)

...to obtain the reduced tree

slide-59
SLIDE 59

Reduction to Kernel-Size

  • by repeating rule 1 ... height(T) ≤ |P|
  • by repeating rule 2 ... |c-color(T)| ≤ 2|P|
slide-60
SLIDE 60

Reduction to Kernel-Size

  • by repeating rule 1 ... height(T) ≤ |P|
  • by repeating rule 2 ... |c-color(T)| ≤ 2|P|

No repetitions of colors in a path from the root to a leaf

slide-61
SLIDE 61

Reduction to Kernel-Size

  • by repeating rule 1 ... height(T) ≤ |P|
  • by repeating rule 2 ... |c-color(T)| ≤ 2|P|

No repetitions of colors in a path from the root to a leaf If max{ fout(n) | n node in T } ≤ m, then T has at most 2|P| leaves

slide-62
SLIDE 62

Reduction to Kernel-Size

  • by repeating rule 1 ... height(T) ≤ |P|
  • by repeating rule 2 ... |c-color(T)| ≤ 2|P|

as a result |nodes(T)| ≤ |P| 2|P|

No repetitions of colors in a path from the root to a leaf If max{ fout(n) | n node in T } ≤ m, then T has at most 2|P| leaves

slide-63
SLIDE 63
  • 2. Searching for a rainbow

using the fast subset convolution algorithm by [Björklund et al. STOC’97] A(T, X) = N(T, X) v (A(T’,Y) A(T’’,Y \ X)) v

Y⊆X

T’

... T = T’’

slide-64
SLIDE 64
  • 2. Searching for a rainbow

using the fast subset convolution algorithm by [Björklund et al. STOC’97] A(T, X) = N(T, X) v (A(T’,Y) A(T’’,Y \ X)) v

Y⊆X

T’

... T = T’’

true iff T contains all the colors in X⊆P

slide-65
SLIDE 65
  • 2. Searching for a rainbow

using the fast subset convolution algorithm by [Björklund et al. STOC’97] A(T, X) = N(T, X) v (A(T’,Y) A(T’’,Y \ X)) v

Y⊆X

T’

... T = T’’

true iff T contains all the colors in X⊆P

O(|P|2 2|P|) for each node:

slide-66
SLIDE 66

From Forest Matching to Rainbow Antichain

n[0] | m[x | n[0]] | k[n[y]] | m[0] | z ⟨m[x] | n[0] , m[0]⟩

Target T Forest pattern S

slide-67
SLIDE 67

From Forest Matching to Rainbow Antichain

m k m n * n n n m * * m

n[0] | m[x | n[0]] | k[n[y]] | m[0] | z ⟨m[x] | n[0] , m[0]⟩

Target T Forest pattern S

slide-68
SLIDE 68

From Forest Matching to Rainbow Antichain

m k m n * n n n m * * m

n[0] | m[x | n[0]] | k[n[y]] | m[0] | z ⟨m[x] | n[0] , m[0]⟩

Target T Forest pattern S subtrees isomorphisms

slide-69
SLIDE 69

From Forest Matching to Rainbow Antichain

m k m n * n n n m * * m

n[0] | m[x | n[0]] | k[n[y]] | m[0] | z ⟨m[x] | n[0] , m[0]⟩

Target T Forest pattern S

  • pen nodes

are freely matchable

subtrees isomorphisms

slide-70
SLIDE 70

From Forest Matching to Rainbow Antichain

m k m n * n n n m * * m

n[0] | m[x | n[0]] | k[n[y]] | m[0] | z ⟨m[x] | n[0] , m[0]⟩

Target T Forest pattern S

closed nodes can only be matched by closed nodes

  • pen nodes

are freely matchable

subtrees isomorphisms

slide-71
SLIDE 71

From Forest Matching to Rainbow Antichain

m k m n * n n n m * * m

n[0] | m[x | n[0]] | k[n[y]] | m[0] | z

Target T Forest pattern S

1 2

the reduction is done on a 2-level palette

⟨m[x] | n[0] , m[0]⟩

slide-72
SLIDE 72

From Forest Matching to Rainbow Antichain

m k m n * n n n m * * m

n[0] | m[x | n[0]] | k[n[y]] | m[0] | z

Target T Forest pattern S

the rainbow antichain is found on the children’s palette 1 2

the reduction is done on a 2-level palette

⟨m[x] | n[0] , m[0]⟩

slide-73
SLIDE 73

Forest matching is Fixed Parameter Tractable

  • subtree isomorphisms:
  • reduction to kernel size:
  • exhaustive search of antichains: O(h3 k 22h)

O(|T|) O(|S| |T|3/2) h = “# trees in pattern S” k = “max # of 1 -level children in S”

st Parameters

slide-74
SLIDE 74

Forest matching is Fixed Parameter Tractable

  • subtree isomorphisms:
  • reduction to kernel size:
  • exhaustive search of antichains: O(h3 k 22h)

O(|T|) O(|S| |T|3/2) h = “# trees in pattern S” k = “max # of 1 -level children in S”

st Parameters

O(h3 k 22h) + O(|S| |T|3/2)

Total:

slide-75
SLIDE 75

Conclusions

  • WRSs yield simpler and smaller semantics
  • We have shown that matching for WRSs is feasible:
  • exponential in redex width (constant and small)
  • but polynomial in the size of agent
  • Side result: rainbow antichain problem
  • Applications: abstract machines (distributed π, Ambients,

CaSPiS, etc.) and bigraphic reactive systems

  • Future work: quantitative variants (probabilistic, etc.)
slide-76
SLIDE 76

Thanks for your attention