Transforming Cycle Rewriting into String Rewriting David Sabel 1 and - - PowerPoint PPT Presentation

transforming cycle rewriting into string rewriting
SMART_READER_LITE
LIVE PREVIEW

Transforming Cycle Rewriting into String Rewriting David Sabel 1 and - - PowerPoint PPT Presentation

Transforming Cycle Rewriting into String Rewriting David Sabel 1 and Hans Zantema 2 , 3 1 Goethe University Frankfurt, Germany 2 TU Eindhoven, The Netherlands 3 Radboud University Nijmegen, The Netherlands RTA 2015, Warsaw, Poland 1 Cycle


slide-1
SLIDE 1

1

Transforming Cycle Rewriting into String Rewriting

David Sabel1 and Hans Zantema2,3

1Goethe University Frankfurt, Germany 2TU Eindhoven, The Netherlands 3Radboud University Nijmegen, The Netherlands

RTA 2015, Warsaw, Poland

slide-2
SLIDE 2

Cycle Rewriting

A cycle is a string in which the start and end are connected. b a b c b a b b b a c c b a b c b a b c c a b b

2/18

slide-3
SLIDE 3

Cycle Rewriting

A cycle is a string in which the start and end are connected. b a b c b a b b b a c c b a b c b a b c c a b b Cycle rewriting ◦ → applies string rewrite rules to cycles, e.g. R ={cba → aabbcc} b a b c b a b c c a b b

2/18

slide-4
SLIDE 4

Cycle Rewriting

A cycle is a string in which the start and end are connected. b a b c b a b b b a c c b a b c b a b c c a b b Cycle rewriting ◦ → applies string rewrite rules to cycles, e.g. R ={cba → aabbcc} b a b c b a b c c a b b

2/18

slide-5
SLIDE 5

Cycle Rewriting

A cycle is a string in which the start and end are connected. b a b c b a b b b a c c b a b c b a b c c a b b Cycle rewriting ◦ → applies string rewrite rules to cycles, e.g. R ={cba → aabbcc} b a b c b a b c c a b b

  • →R

b c c b b a a b a b c c a b b

2/18

slide-6
SLIDE 6

Cycle Rewriting

A cycle is a string in which the start and end are connected. b a b c b a b b b a c c b a b c b a b c c a b b Cycle rewriting ◦ → applies string rewrite rules to cycles, e.g. R ={cba → aabbcc} b a b c b a b c c a b b

  • →R

b c c b b a a b a b c c a b b

2/18

slide-7
SLIDE 7

Cycle Rewriting

A cycle is a string in which the start and end are connected. b a b c b a b b b a c c b a b c b a b c c a b b Cycle rewriting ◦ → applies string rewrite rules to cycles, e.g. R ={cba → aabbcc} b a b c b a b c c a b b

  • →R

b c c b b a a b a b c c a b b

  • →R

b c c b b a a b c c b b a a c a b b

2/18

slide-8
SLIDE 8

Applications of Cycle Rewriting

Termination analysis for graph transformation systems [Bruggink,K¨

  • nig,Zantema 2014, IFIP TCS]

3/18

slide-9
SLIDE 9

Applications of Cycle Rewriting

Termination analysis for graph transformation systems [Bruggink,K¨

  • nig,Zantema 2014, IFIP TCS]

Some systems are naturally cycle rewrite systems: F T F T F T F T F T T: thinking philosopher F: fork L: philosopher has left fork E: eating philosopher Rewrite rules: T F → L (pick up left fork) F L → E (pick up right fork and eat) E → F T F (stop eating and put down forks)

3/18

slide-10
SLIDE 10

Applications of Cycle Rewriting

Termination analysis for graph transformation systems [Bruggink,K¨

  • nig,Zantema 2014, IFIP TCS]

Some systems are naturally cycle rewrite systems: F T F T F T F T F T T: thinking philosopher F: fork L: philosopher has left fork E: eating philosopher Rewrite rules: T F → L (pick up left fork) F L → E (pick up right fork and eat) E → F T F (stop eating and put down forks)

3/18

slide-11
SLIDE 11

Applications of Cycle Rewriting

Termination analysis for graph transformation systems [Bruggink,K¨

  • nig,Zantema 2014, IFIP TCS]

Some systems are naturally cycle rewrite systems: F T L F T F T F T T: thinking philosopher F: fork L: philosopher has left fork E: eating philosopher Rewrite rules: T F → L (pick up left fork) F L → E (pick up right fork and eat) E → F T F (stop eating and put down forks)

3/18

slide-12
SLIDE 12

Applications of Cycle Rewriting

Termination analysis for graph transformation systems [Bruggink,K¨

  • nig,Zantema 2014, IFIP TCS]

Some systems are naturally cycle rewrite systems: F T L F T F T F T T: thinking philosopher F: fork L: philosopher has left fork E: eating philosopher Rewrite rules: T F → L (pick up left fork) F L → E (pick up right fork and eat) E → F T F (stop eating and put down forks)

3/18

slide-13
SLIDE 13

Applications of Cycle Rewriting

Termination analysis for graph transformation systems [Bruggink,K¨

  • nig,Zantema 2014, IFIP TCS]

Some systems are naturally cycle rewrite systems: F T E T F T F T T: thinking philosopher F: fork L: philosopher has left fork E: eating philosopher Rewrite rules: T F → L (pick up left fork) F L → E (pick up right fork and eat) E → F T F (stop eating and put down forks)

3/18

slide-14
SLIDE 14

Applications of Cycle Rewriting

Termination analysis for graph transformation systems [Bruggink,K¨

  • nig,Zantema 2014, IFIP TCS]

Some systems are naturally cycle rewrite systems: F T E T F T F T T: thinking philosopher F: fork L: philosopher has left fork E: eating philosopher Rewrite rules: T F → L (pick up left fork) F L → E (pick up right fork and eat) E → F T F (stop eating and put down forks)

3/18

slide-15
SLIDE 15

Applications of Cycle Rewriting

Termination analysis for graph transformation systems [Bruggink,K¨

  • nig,Zantema 2014, IFIP TCS]

Some systems are naturally cycle rewrite systems: F T F T F T F T F T T: thinking philosopher F: fork L: philosopher has left fork E: eating philosopher Rewrite rules: T F → L (pick up left fork) F L → E (pick up right fork and eat) E → F T F (stop eating and put down forks)

3/18

slide-16
SLIDE 16

Applications of Cycle Rewriting

Termination analysis for graph transformation systems [Bruggink,K¨

  • nig,Zantema 2014, IFIP TCS]

Some systems are naturally cycle rewrite systems: F T F T F T F T F T T: thinking philosopher F: fork L: philosopher has left fork E: eating philosopher Rewrite rules: T F → L (pick up left fork) F L → E (pick up right fork and eat) E → F T F (stop eating and put down forks)

3/18

slide-17
SLIDE 17

Cycle Rewriting (Formally)

Let Σ be an alphabet, R be an SRS over Σ u ∼ v = strings u, v ∈ Σ∗ represent the same cycle: u ∼ v iff ∃w1, w2 : u = w1w2 and v = w2w1 cycle [u] = equivalence class of string u w.r.t. ∼ cycle rewrite relation ◦ →R ⊆ (Σ/∼ × Σ/∼) of R: [u] ◦ →R [v] iff ∃w ∈ Σ∗ : u ∼ ℓw, (ℓ → r) ∈ R, and rw ∼ v

4/18

slide-18
SLIDE 18

Cycle Termination

  • →R is non-terminating iff there exists an infinite sequence

[u0] ◦ →R [u1] ◦ →R [u2] ◦ →R · · · Otherwise, ◦ →R is terminating.

5/18

slide-19
SLIDE 19

Cycle Termination

  • →R is non-terminating iff there exists an infinite sequence

[u0] ◦ →R [u1] ◦ →R [u2] ◦ →R · · · Otherwise, ◦ →R is terminating. Cycle-termination is different from string-termination: for R = {ab → ba} →R is terminating, but

  • →R is non-terminating

But non-termination of →R implies non-termination of ◦ →R

5/18

slide-20
SLIDE 20

Previous Work [Zantema,K¨

  • nig,Bruggink 2014,RTA-TLCA]

Termination techniques arctic and tropical matrix interpretations based on type-graphs implemented in torpacyc, iteratively removes rewrite rules using relative termination technique can only remove rules which are applied at most polynomially often in any derivation

6/18

slide-21
SLIDE 21

Previous Work [Zantema,K¨

  • nig,Bruggink 2014,RTA-TLCA]

Termination techniques arctic and tropical matrix interpretations based on type-graphs implemented in torpacyc, iteratively removes rewrite rules using relative termination technique can only remove rules which are applied at most polynomially often in any derivation Complexity Transformation φ on SRSs R (“string rewriting → cycle rewriting”) s.t. →R is string-terminating ⇐ ⇒ ◦ →φ(R) is cycle-terminating Consequences: proving cycle-termination is at least as hard as string-termination proving cycle-termination is undecidable

6/18

slide-22
SLIDE 22

Our Contributions: Improved Termination Techniques

Transformational approach

1 reduce cycle-termination to string-termination 2 apply state-of-the-art ATPs to prove string-termination

required: transformation ψ : “cycle rewriting → string rewriting” which is sound: →ψ(R) is string-terminating = ⇒ ◦ →R is cycle-terminating complete: ◦ →R is cycle-terminating = ⇒ →ψ(R) is string-terminating We provide three sound and complete transformations split, rotate, shift

7/18

slide-23
SLIDE 23

Our Contributions: Improved Termination Techniques

Transformational approach

1 reduce cycle-termination to string-termination 2 apply state-of-the-art ATPs to prove string-termination

required: transformation ψ : “cycle rewriting → string rewriting” which is sound: →ψ(R) is string-terminating = ⇒ ◦ →R is cycle-terminating complete: ◦ →R is cycle-terminating = ⇒ →ψ(R) is string-terminating We provide three sound and complete transformations split, rotate, shift Trace-decreasing matrix interpreations following a suggestion of Johannes Waldmann extend the matrix interpretations from [Zantema,K¨

  • nig,Bruggink 2014,RTA]

7/18

slide-24
SLIDE 24

The Transformation Split: Idea

For a cycle rewrite step [u1] ◦ →{ℓ→r} [u2] and v1 ∈ [u1]

8/18

slide-25
SLIDE 25

The Transformation Split: Idea

For a cycle rewrite step [u1] ◦ →{ℓ→r} [u2] and v1 ∈ [u1] case 1: v1 →{ℓ→r} v2 where v2 ∈ [u2] c d c b a d c b a a c d c a a a a d c b a a c d c d a b c d c d c a a b c d a a a a c d c a a b

  • →{abcd→aaaa}

→{abcd→aaaa}

8/18

slide-26
SLIDE 26

The Transformation Split: Idea

For a cycle rewrite step [u1] ◦ →{ℓ→r} [u2] and v1 ∈ [u1] case 2: we can split ℓ = ℓAℓB s.t. v1 = ℓBuℓA →{ℓB→ε} uℓA →{ℓA→r} ur where ur ∈ [u2] c d c b a d c b a a c d c d c b a a a a a a c d c d a b c d c d c a a b a b c d c d c a a a a a

  • →{abcd→aaaa}

cdabcdcdcaab →{cd→ε} abcdcdcaab →{ab→aaaa} abcdcdaaaa cd→ε ab→aaaa

8/18

slide-27
SLIDE 27

The Transformation Split: Idea

For a cycle rewrite step [u1] ◦ →{ℓ→r} [u2] and v1 ∈ [u1] case 2: we can split ℓ = ℓAℓB s.t.

prefix string rewrite step

  • v1 = ℓBuℓA →{ℓB→ε} uℓA →{ℓA→r} ur where ur ∈ [u2]
  • suffix string rewrite step

c d c b a d c b a a c d c d c b a a a a a a c d c d a b c d c d c a a b a b c d c d c a a a a a

  • →{abcd→aaaa}

cdabcdcdcaab →{cd→ε} abcdcdcaab →{ab→aaaa} abcdcdaaaa cd→ε ab→aaaa

8/18

slide-28
SLIDE 28

The Transformation Split

Naive (but sound) transformation: Add all rewrite rules (ℓ → r) Add all splitting rules (ℓA → r) and (ℓB → ε) for ℓ = ℓAℓB ⇒ results in non-terminating SRSs in most of the cases (i.e. whenever r contains some prefix ℓA)

9/18

slide-29
SLIDE 29

The Transformation Split

Naive (but sound) transformation: Add all rewrite rules (ℓ → r) Add all splitting rules (ℓA → r) and (ℓB → ε) for ℓ = ℓAℓB ⇒ results in non-terminating SRSs in most of the cases (i.e. whenever r contains some prefix ℓA) Requirements for a better transformation (and for completeness) ensure that split rules are only applied to a prefix or a suffix, resp. ⇒ surround the string by fresh begin symbol B and end symbol E synchronize the application of the prefix and the suffix rewrite step ⇒ use fresh symbols a for a ∈ Σ, and W, L and Ri,j

9/18

slide-30
SLIDE 30

The Transformation Split

Definition of the transformation split(.) For an SRS R over alphabet Σ, the SRS split(R) over Σsplit = Σ ∪ Σ ∪ {B, E, L, W, Ri,j} is constructed as follows: Let (ℓ → r) ∈ R be the ith rule of R: add rule ℓ → r

(for case 1)

for every splitting ℓ = ℓAℓB with |ℓA| = j, add the rules: BℓB → WRi,j

(prefix rewrite step)

Ri,j a → aRi,j

(synchronize, shift Ri,j in front of the suffix)

Ri,j ℓAE → LrE

(suffix rewrite step)

add rules aL → La for all a ∈ Σ (clean up) add rule WL → B

(finish)

10/18

slide-31
SLIDE 31

Split is Sound and Complete

Theorem The transformation split is sound and complete, i.e. →split(R) is string-terminating iff ◦ →R is cycle-terminating. Soundness follows by construction: [u] ◦ →R [v] = ⇒ BuE →+

split(R) Bv′E where v′ ∼ v

Completeness can be shown by type introduction [Zantema 1994, JSC] a mapping Φ :: Σ∗

split → Σ∗ with

∀u :: T : u →split(R) u′ = ⇒ [Φ(u)] ◦ →∗

R [Φ(u′)]

11/18

slide-32
SLIDE 32

Trace-Decreasing Matrix Interpretations

Md := all d × d matrices A over I N s.t. A11 > 0 for A, B ∈ Md, A > B ⇐ ⇒ A11 > B11 ∧ ∀i, j : Aij ≥ Bij A ≥ B ⇐ ⇒ ∀i, j : Aij ≥ Bij

12/18

slide-33
SLIDE 33

Trace-Decreasing Matrix Interpretations

Md := all d × d matrices A over I N s.t. A11 > 0 for A, B ∈ Md, A > B ⇐ ⇒ A11 > B11 ∧ ∀i, j : Aij ≥ Bij A ≥ B ⇐ ⇒ ∀i, j : Aij ≥ Bij a matrix interpretation · : Σ → Md is extended to strings as ε = I and ua = u × a for all u ∈ Σ∗, a ∈ Σ where I is the identity matrix, × is matrix multiplication

12/18

slide-34
SLIDE 34

Trace-Decreasing Matrix Interpretations

Theorem Let R′ ⊆ R be SRSs over Σ and let · : Σ → Md such that

  • →R′ is terminating,

ℓ ≥ r for all (ℓ → r) ∈ R′, and ℓ > r for all (ℓ → r) ∈ R \ R′. Then ◦ →R is terminating.

13/18

slide-35
SLIDE 35

Trace-Decreasing Matrix Interpretations

Theorem Let R′ ⊆ R be SRSs over Σ and let · : Σ → Md such that

  • →R′ is terminating,

ℓ ≥ r for all (ℓ → r) ∈ R′, and ℓ > r for all (ℓ → r) ∈ R \ R′. Then ◦ →R is terminating. Proof: The main observations are trace(a × u) = trace(u × a) and thus trace(u) = trace(v) if u ∼ v >, ≥ are stable w.r.t ×, and thus ℓ > r = ⇒ ℓw > rw [u] ◦ →R′ [v] = ⇒ trace(u) ≥ trace(v), and [u] ◦ →R\R′ [v] = ⇒ trace(u) > trace(v)

13/18

slide-36
SLIDE 36

Improvements and Limitations

Trace-decreasing matrix interpretations can remove rules which are applied exponentially often (improves [Zantema, K¨

  • nig, Bruggink 2014,RTA])

impossible to remove rules which are applied more often

14/18

slide-37
SLIDE 37

Improvements and Limitations

Trace-decreasing matrix interpretations can remove rules which are applied exponentially often (improves [Zantema, K¨

  • nig, Bruggink 2014,RTA])

impossible to remove rules which are applied more often Example (adapted from [Hofbauer and Waldmann 2006,RTA]) R := φ({ab → bca, cb → bbc}) = {RE → LE, aL → La′, bL → Lb′, cL → Lc′, Ra′ → aR, Rb′ → bR, Rc′ → cR, abL → bcaR, cbL → bbcR} has cycle rewrite derivations where the number of rule applications is a tower of exponentials for each rule impossible to prove cycle termination by trace-decreasing matrix interpretations

14/18

slide-38
SLIDE 38

Improvements and Limitations

Trace-decreasing matrix interpretations can remove rules which are applied exponentially often (improves [Zantema, K¨

  • nig, Bruggink 2014,RTA])

impossible to remove rules which are applied more often Example (adapted from [Hofbauer and Waldmann 2006,RTA]) R := φ({ab → bca, cb → bbc}) = {RE → LE, aL → La′, bL → Lb′, cL → Lc′, Ra′ → aR, Rb′ → bR, Rc′ → cR, abL → bcaR, cbL → bbcR} has cycle rewrite derivations where the number of rule applications is a tower of exponentials for each rule impossible to prove cycle termination by trace-decreasing matrix interpretations but AProVE proves string termination of split(R) ⇒ transformational approach succeeds

14/18

slide-39
SLIDE 39

Experiments

Techniques torpacyc: trace decreasing matrix interpretations transformations split, rotate, shift with AProVE and T T T 2 combination 1: first torpacyc then transformation split combination 2: like combination 1, but first string-nontermination check by AProVE, or T T T 2, resp. Tools and webinterface available via http://www.ki.cs.uni-frankfurt.de/research/cycsrs

15/18

slide-40
SLIDE 40

Cycle Non-/Termination of TPDB/SRS-Standard

309 168 45 65 310 161 335 173 336 36

torpacyc 2014

46

torpacyc 2015

40

split(AProVE)

30

split(T T T 2)

10

rotate(AProVE)

6

rotate(T T T 2)

10

shift(AProVE)

8

shift(T T T 2)

55

comb1(AProVE)

55

comb1(T T T 2)

54

comb2(AProVE)

54

comb2(T T T 2)

63

any

cycle termination proved, cycle nontermination proved 1315 problems, timeout 60sec, 916 problems remain open

16/18

slide-41
SLIDE 41

Cycle Non-/Termination of 50000 Random SRS

50000 randomly generated problems

  • f size 12 with |Σ| = 3

no obviously nonterminating problems Results rotate and shift show termination of 74 % of the problems torpacyc and split show termination of 94 % of the problems In total (combining all results): No 4.7% Maybe 1.1% Yes 94.2%

17/18

slide-42
SLIDE 42

Conclusion & Future Work

Conclusion new techniques to prove cycle termination three sound and complete transformations from cycle into string rewriting transformation split seems to be useful in practice trace-decreasing matrix interpretations new techniques solve problems for which the earlier techniques failed

18/18

slide-43
SLIDE 43

Conclusion & Future Work

Conclusion new techniques to prove cycle termination three sound and complete transformations from cycle into string rewriting transformation split seems to be useful in practice trace-decreasing matrix interpretations new techniques solve problems for which the earlier techniques failed

18/18

slide-44
SLIDE 44

Conclusion & Future Work

Conclusion new techniques to prove cycle termination three sound and complete transformations from cycle into string rewriting transformation split seems to be useful in practice trace-decreasing matrix interpretations new techniques solve problems for which the earlier techniques failed

18/18

slide-45
SLIDE 45

Conclusion & Future Work

Conclusion new techniques to prove cycle termination three sound and complete transformations from cycle into string rewriting transformation split seems to be useful in practice trace-decreasing matrix interpretations new techniques solve problems for which the earlier techniques failed

18/18

slide-46
SLIDE 46

Conclusion & Future Work

Conclusion new techniques to prove cycle termination three sound and complete transformations from cycle into string rewriting transformation split seems to be useful in practice trace-decreasing matrix interpretations new techniques solve problems for which the earlier techniques failed Future work extend the benchmark problem set specific methods for cycle non-termination applications for cycle rewriting

18/18