Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA...

Post on 24-Jul-2020

4 views 0 download

transcript

Analyzing Runtime Complexity via Innermost RuntimeComplexity

Florian Frohn1 Jurgen Giesl1

1RWTH Aachen University, Germany

May 11, 2017

Consider the following MAUDE program...

Example

mod BASIC-NAT is...rl p l u s 0 Y => Y .rl p l u s s (X) Y => s ( p l u s X Y) .rl t i m e s 0 Y => 0 .

crl t i m e s s (X) Y => p l u s Z Y i f t i m e s X Y => Z .endm

...which can be seen as a Conditional TRS...

Example

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(z , y) ⇐ times(x , y) ≈ z

Goal: Prove upper bound on worst case complexity

...which can be seen as a Conditional TRS...

Example

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(z , y) ⇐ times(x , y) ≈ z

Goal: Prove upper bound on worst case complexity

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y ,>, x2) → yplus(s(x), y , x1,>) → s(plus(x , y ,>,>))times(0, y ,>, x2) → 0

times(s(x), y , x1,>) → times12(s(x), y , x1, times(x , y ,>,>))times12(s(x), y , x1, z) → plus(z , y ,>,>)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y ,>, x2) → yplus(s(x), y , x1,>) → s(plus(x , y ,>,>))times(0, y ,>, x2) → 0

times(s(x), y , x1,>) → times12(s(x), y , x1, times(x , y ,>,>))times12(s(x), y , x1, z) → plus(z , y ,>,>)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y ,>, x2) → yplus(s(x), y , x1,>) → s(plus(x , y ,>,>))times(0, y ,>, x2) → 0

times(s(x), y , x1,>) → times12(s(x), y , x1, times(x , y ,>,>))times12(s(x), y , x1, z) → plus(z , y ,>,>)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y ,>, x2) → yplus(s(x), y , x1,>) → s(plus(x , y ,>,>))times(0, y ,>, x2) → 0

times(s(x), y , x1,>) → times12(s(x), y , x1, times(x , y ,>,>))times12(s(x), y , x1, z) → plus(z , y ,>,>)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y ,>, x2) → yplus(s(x), y , x1,>) → s(plus(x , y ,>,>))times(0, y ,>, x2) → 0

times(s(x), y , x1,>) → times12(s(x), y , x1, times(x , y ,>,>))times12(s(x), y , x1, z) → plus(z , y ,>,>)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y ,>, x2) → yplus(s(x), y , x1,>) → s(plus(x , y ,>,>))times(0, y ,>, x2) → 0

times(s(x), y , x1,>) → times12(s(x), y , x1, times(x , y ,>,>))times12(s(x), y , x1, z) → plus(z , y ,>,>)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y ,>, x2) → yplus(s(x), y , x1,>) → s(plus(x , y ,>,>))times(0, y ,>, x2) → 0

times(s(x), y , x1,>) → times12(s(x), y , x1, times(x , y ,>,>))times12(s(x), y , x1, z) → plus(z , y ,>,>)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))

times(0, y ,>, x2) → 0times(s(x), y , x1,>) → times12(s(x), y , x1, times(x , y ,>,>))times12(s(x), y , x1, z) → plus(z , y)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))

times(0, y ,>, x2) → 0times(s(x), y , x1,>) → plus(times(x , y ,>,>), y)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

...which can be transformed to a standard TRS.

Transformation by Cynthia Kop, Aart Middeldorp, and Thomas Sternagel

“Complexity of Conditional Term Rewriting”, LMCS ’17

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Let’s analyze it using leading tools!

TcT: timeout (60 s)

AProVE: full rewriting not supported

But: O(n3) for innermost rewriting – can we exploit that?

Outline

1 Preliminariesrc and ircNDG Rewriting

2 Handling Constructor Systems

3 Handling Non-Constructor Systems

4 Experimental Results, Conclusion

rc and irc

rc maps n ∈ N to the length of the longest rewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

irc: similar, but just considers innermost sequences

Example

plus(0, s(0))

3

plus(0,plus(0, s(0))) 8

rc and irc

rc maps n ∈ N to the length of the longest rewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

irc: similar, but just considers innermost sequences

Example

plus(0, s(0))

3

plus(0,plus(0, s(0))) 8

rc and irc

rc maps n ∈ N to the length of the longest rewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

irc: similar, but just considers innermost sequences

Example

plus(0, s(0))

3

plus(0,plus(0, s(0))) 8

rc and irc

rc maps n ∈ N to the length of the longest rewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

irc: similar, but just considers innermost sequences

Example

plus(0, s(0)) 3

plus(0,plus(0, s(0))) 8

rc and irc

rc maps n ∈ N to the length of the longest rewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

irc: similar, but just considers innermost sequences

Example

plus(0, s(0)) 3

plus(0,plus(0, s(0)))

8

rc and irc

rc maps n ∈ N to the length of the longest rewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

irc: similar, but just considers innermost sequences

Example

plus(0, s(0)) 3

plus(0,plus(0, s(0))) 8

rc and irc

rc maps n ∈ N to the length of the longest rewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

irc: similar, but just considers innermost sequences

Example

plus(0, s(0)) 3

plus(0,plus(0, s(0))) 8

Outline

1 Preliminariesrc and ircNDG Rewriting

2 Handling Constructor Systems

3 Handling Non-Constructor Systems

4 Experimental Results, Conclusion

NDG Rewriting

By Jaco van de Pol and Hans Zantema:

“Generalized innermost rewriting” (RTA ’05)

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Goal: Implement rewriting efficiently

Idea: No duplication of nested defined symbols

Example

times(s(0),plus(0, 0))→ plus(times(0,plus(0, 0)),plus(0, 0)) 8

plus(s(0),plus(0, 0))→ s(plus(0,plus(0, 0))) 3

NDG Rewriting

By Jaco van de Pol and Hans Zantema:

“Generalized innermost rewriting” (RTA ’05)

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Goal: Implement rewriting efficiently

Idea: No duplication of nested defined symbols

Example

times(s(0),plus(0, 0))→ plus(times(0,plus(0, 0)),plus(0, 0)) 8

plus(s(0),plus(0, 0))→ s(plus(0,plus(0, 0))) 3

NDG Rewriting

By Jaco van de Pol and Hans Zantema:

“Generalized innermost rewriting” (RTA ’05)

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)Goal: Implement rewriting efficiently

Idea: No duplication of nested defined symbols

Example

times(s(0),plus(0, 0))→ plus(times(0,plus(0, 0)),plus(0, 0)) 8

plus(s(0),plus(0, 0))→ s(plus(0,plus(0, 0))) 3

NDG Rewriting

By Jaco van de Pol and Hans Zantema:

“Generalized innermost rewriting” (RTA ’05)

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)Goal: Implement rewriting efficiently

Idea: No duplication of nested defined symbols

Example

times(s(0),plus(0, 0))→ plus(times(0,plus(0, 0)),plus(0, 0))

8

plus(s(0),plus(0, 0))→ s(plus(0,plus(0, 0))) 3

NDG Rewriting

By Jaco van de Pol and Hans Zantema:

“Generalized innermost rewriting” (RTA ’05)

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)Goal: Implement rewriting efficiently

Idea: No duplication of nested defined symbols

Example

times(s(0),plus(0, 0))→ plus(times(0,plus(0, 0)),plus(0, 0)) 8

plus(s(0),plus(0, 0))→ s(plus(0,plus(0, 0))) 3

NDG Rewriting

By Jaco van de Pol and Hans Zantema:

“Generalized innermost rewriting” (RTA ’05)

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)Goal: Implement rewriting efficiently

Idea: No duplication of nested defined symbols

Example

times(s(0),plus(0, 0))→ plus(times(0,plus(0, 0)),plus(0, 0)) 8

plus(s(0),plus(0, 0))→ s(plus(0,plus(0, 0)))

3

NDG Rewriting

By Jaco van de Pol and Hans Zantema:

“Generalized innermost rewriting” (RTA ’05)

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)Goal: Implement rewriting efficiently

Idea: No duplication of nested defined symbols

Example

times(s(0),plus(0, 0))→ plus(times(0,plus(0, 0)),plus(0, 0)) 8

plus(s(0),plus(0, 0))→ s(plus(0,plus(0, 0))) 3

NDG Rewriting is cheap!

Theorem (Pol et. al, RTA ’05)

NDG rewriting is at least as efficientas innermost rewriting.

Reminder: rc

rc maps n to the length of the longestrewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

y all sequences ndg =⇒ innermost is the worst case

y all sequences starting with basic terms ndg =⇒ rc = irc

y Goal: Prove that all sequences starting with basic terms are ndg

Use irc techniques to analyze rc

NDG Rewriting is cheap!

Theorem (Pol et. al, RTA ’05)

NDG rewriting is at least as efficientas innermost rewriting.

Reminder: rc

rc maps n to the length of the longestrewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

y all sequences ndg =⇒ innermost is the worst case

y all sequences starting with basic terms ndg =⇒ rc = irc

y Goal: Prove that all sequences starting with basic terms are ndg

Use irc techniques to analyze rc

NDG Rewriting is cheap!

Theorem (Pol et. al, RTA ’05)

NDG rewriting is at least as efficientas innermost rewriting.

Reminder: rc

rc maps n to the length of the longestrewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

y all sequences ndg =⇒ innermost is the worst case

y all sequences starting with basic terms ndg =⇒ rc = irc

y Goal: Prove that all sequences starting with basic terms are ndg

Use irc techniques to analyze rc

NDG Rewriting is cheap!

Theorem (Pol et. al, RTA ’05)

NDG rewriting is at least as efficientas innermost rewriting.

Reminder: rc

rc maps n to the length of the longestrewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

y all sequences ndg =⇒ innermost is the worst case

y all sequences starting with basic terms ndg =⇒ rc = irc

y Goal: Prove that all sequences starting with basic terms are ndg

Use irc techniques to analyze rc

NDG Rewriting is cheap!

Theorem (Pol et. al, RTA ’05)

NDG rewriting is at least as efficientas innermost rewriting.

Reminder: rc

rc maps n to the length of the longestrewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

y all sequences ndg =⇒ innermost is the worst case

y all sequences starting with basic terms ndg =⇒ rc = irc

y Goal: Prove that all sequences starting with basic terms are ndg

Use irc techniques to analyze rc

NDG Rewriting is cheap!

Theorem (Pol et. al, RTA ’05)

NDG rewriting is at least as efficientas innermost rewriting.

Reminder: rc

rc maps n to the length of the longestrewrite sequence s.t.

(A) size of start term bounded by n

(B) start term basic

y all sequences ndg =⇒ innermost is the worst case

y all sequences starting with basic terms ndg =⇒ rc = irc

y Goal: Prove that all sequences starting with basic terms are ndg

Use irc techniques to analyze rc

Outline

1 Preliminariesrc and ircNDG Rewriting

2 Handling Constructor Systems

3 Handling Non-Constructor Systems

4 Experimental Results, Conclusion

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument

duplication of times’ second argument

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)

nesting below plus’ first argument

duplication of times’ second argument

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument

duplication of times’ second argument

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(times(x , y), y)

duplication of times’ second argument

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument times(s(x), y)

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument times(s(x),�)

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument times(s(x),�)

plus(...)

no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument times(s(x),�)

plus(...)

no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument times(s(x),�)

plus(...)

no (further) nesting

plus(�, y)

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument times(s(x),�)

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument times(s(x),�)

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument times(s(x),�)

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

“Proving” ndg-ness by hand

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

times(...)nesting below plus’ first argument plus(�, y)

duplication of times’ second argument times(s(x),�)

plus(...)no (further) nesting

no duplication

plus(�, y) and times(s(x),�) don’t “overlap”

Reminderno duplication of defined symbols

y innermost rewriting is worst

y rc = irc

y irc techniques applicable for rc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(x ,�) does not match plus(s(�), y)

Intuition: plus(�, y) represents “marked” terms

plus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(x ,�) does not match plus(s(�), y)

Intuition: plus(�, y) represents “marked” terms

plus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(x ,�) does not match plus(s(�), y)

Intuition: plus(�, y) represents “marked” terms

plus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(x ,�) does not match plus(s(�), y)

Intuition: plus(�, y) represents “marked” terms

plus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(�, y) matches plus(s(�), y)

Intuition: plus(�, y) represents “marked” terms

plus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(�, y) matches plus(s(�), y)

Intuition: plus(�, y) represents “marked” terms

plus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(�, y) matches plus(s(�), y)

Intuition: plus(�, y) represents “marked” termsplus(times(x , z), y),

plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(�, y) matches plus(s(�), y)

Intuition: plus(�, y) represents “marked” termsplus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(�, y) matches plus(s(�), y)

Intuition: plus(�, y) represents “marked” termsplus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and Def

Dup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(�, y) matches plus(s(�), y)

Intuition: plus(�, y) represents “marked” termsplus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

Proving ndg-ness automatically

Representing sets of contexts

C matches D if

C [x ]σ = D

� in D below � in C

Overlapping contexts

C and D overlap if both match some E

Example

plus(�, y) matches plus(s(�), y)

Intuition: plus(�, y) represents “marked” termsplus(times(x , z), y),plus(s(times(0, 0)), 0), . . .

Goal: compute sets of contexts Dup and DefDup and Def don’t overlap y rc = irc

The easy one: Computing Dup

Algorithm

collect left-hand sides of rules with non-linear right-hand sidesreplace occurrences of duplicated variables in left-hand sides with �

Example

Dup = {times(s(x),�)}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The easy one: Computing Dup

Algorithm

collect left-hand sides of rules with non-linear right-hand sides

replace occurrences of duplicated variables in left-hand sides with �

Example

Dup = {times(s(x),�)}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The easy one: Computing Dup

Algorithm

collect left-hand sides of rules with non-linear right-hand sides

replace occurrences of duplicated variables in left-hand sides with �

Example

Dup = {times(s(x),�)}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The easy one: Computing Dup

Algorithm

collect left-hand sides of rules with non-linear right-hand sidesreplace occurrences of duplicated variables in left-hand sides with �

Example

Dup = {times(s(x),�)}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The easy one: Computing Dup

Algorithm

collect left-hand sides of rules with non-linear right-hand sidesreplace occurrences of duplicated variables in left-hand sides with �

Example

Dup = {times(s(x),�)}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The easy one: Computing Dup

Algorithm

collect left-hand sides of rules with non-linear right-hand sidesreplace occurrences of duplicated variables in left-hand sides with �

Example

Dup = {times(s(x),�)}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The easy one: Computing Dup

Algorithm

collect left-hand sides of rules with non-linear right-hand sidesreplace occurrences of duplicated variables in left-hand sides with �

Example

Dup = {times(s(x),�)}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

ReminderDup and Def don’t overlap

y no duplication of defined symbols

y rc = irc

y irc techniques applicable for rc

The hard one: Computing Def

Initialization

collect right-hand sides with nested defined symbols

replace nested defined symbols with � y C

add bCc to Def

Example

Def = {}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The hard one: Computing Def

Initialization

collect right-hand sides with nested defined symbols

replace nested defined symbols with � y C

add bCc to Def

Example

Def = {}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The hard one: Computing Def

Initialization

collect right-hand sides with nested defined symbols

replace nested defined symbols with � y C

add bCc to Def

Example

Def = {}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The hard one: Computing Def

Initialization

collect right-hand sides with nested defined symbols

replace nested defined symbols with � y C

add bCc to Def

Example

Def = {}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The hard one: Computing Def

Initialization

collect right-hand sides with nested defined symbols

replace nested defined symbols with � y C

add bCc to Def

Example

Def = {}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The hard one: Computing Def

Initialization

collect right-hand sides with nested defined symbols

replace nested defined symbols with � y C

add bCc to Def

Example

Def = {

plus(�, y)

}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The hard one: Computing Def

Initialization

collect right-hand sides with nested defined symbols

replace nested defined symbols with � y C

add bCc to Def

Example

Def = {

plus(�, y)

}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The hard one: Computing Def

Initialization

collect right-hand sides with nested defined symbols

replace nested defined symbols with � y C

add bCc to Def

Example

Def = {bplus(�, y)c}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The hard one: Computing Def

Initialization

collect right-hand sides with nested defined symbols

replace nested defined symbols with � y C

add bCc to Def

Example

Def = {plus(�, y)}

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}

`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}

`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}

`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}

`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}

`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y), bplus(�, y)c}`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y),plus(�, y)}`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

The hard one: Computing Def

Idea: capture that nested defined symbols may be matched by variables

Fixed Point Step

pick a rule `→ r

replace some x in ` with �

if `[�] overlaps with D ∈ Def

pick a subterm f(...x ...) of r

add bf(...�...)c to Def

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

Example

Def = {plus(�, y)}`[�] = plus(s(�), y)

Dup = {times(s(x),�)} and Def = {plus(�, y)} don’t overlap y rc = irc!

Outline

1 Preliminariesrc and ircNDG Rewriting

2 Handling Constructor Systems

3 Handling Non-Constructor Systems

4 Experimental Results, Conclusion

Handling Non-Constructor Systems

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

plus(x ,plus(y , z)) → plus(plus(x , y), z)

nested defined symbols only below plus’s first argument

y plus(x ,plus(y , z)) not reachable from basic terms!

information which defined symbols can be nested often crucial

y similar fixed point algorithm

Handling Non-Constructor Systems

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)plus(x ,plus(y , z)) → plus(plus(x , y), z)

nested defined symbols only below plus’s first argument

y plus(x ,plus(y , z)) not reachable from basic terms!

information which defined symbols can be nested often crucial

y similar fixed point algorithm

Handling Non-Constructor Systems

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)plus(x ,plus(y , z)) → plus(plus(x , y), z)

nested defined symbols only below plus’s first argument

y plus(x ,plus(y , z)) not reachable from basic terms!

information which defined symbols can be nested often crucial

y similar fixed point algorithm

Handling Non-Constructor Systems

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)plus(x ,plus(y , z)) → plus(plus(x , y), z)

nested defined symbols only below plus’s first argument

y plus(x ,plus(y , z)) not reachable from basic terms!

information which defined symbols can be nested often crucial

y similar fixed point algorithm

Handling Non-Constructor Systems

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

plus(x ,plus(y , z)) → plus(plus(x , y), z)

nested defined symbols only below plus’s first argument

y plus(x ,plus(y , z)) not reachable from basic terms!

information which defined symbols can be nested often crucial

y similar fixed point algorithm

Handling Non-Constructor Systems

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

plus(x ,plus(y , z)) → plus(plus(x , y), z)

nested defined symbols only below plus’s first argument

y plus(x ,plus(y , z)) not reachable from basic terms!

information which defined symbols can be nested often crucial

y similar fixed point algorithm

Handling Non-Constructor Systems

Leading Example Rtimes

plus(0, y) → yplus(s(x), y) → s(plus(x , y))times(0, y) → 0

times(s(x), y) → plus(times(x , y), y)

plus(x ,plus(y , z)) → plus(plus(x , y), z)

nested defined symbols only below plus’s first argument

y plus(x ,plus(y , z)) not reachable from basic terms!

information which defined symbols can be nested often crucial

y similar fixed point algorithm

Experimental Results, Conclusion

Experiments on the TPDB:

TcT AProVE TcT preproc AProVE & TcT

209 270 299 308

powerful sufficient criterion for rc = irc

easy to automate

y future irc techniques applicable for rc

significant improvement of the state of the art

Experimental Results, Conclusion

Experiments on the TPDB:

TcT AProVE TcT preproc AProVE & TcT

209 270 299 308

powerful sufficient criterion for rc = irc

easy to automate

y future irc techniques applicable for rc

significant improvement of the state of the art

Experimental Results, Conclusion

Experiments on the TPDB:

TcT AProVE TcT preproc AProVE & TcT

209 270 299 308

powerful sufficient criterion for rc = irc

easy to automate

y future irc techniques applicable for rc

significant improvement of the state of the art

Experimental Results, Conclusion

Experiments on the TPDB:

TcT AProVE TcT preproc AProVE & TcT

209 270 299 308

powerful sufficient criterion for rc = irc

easy to automate

y future irc techniques applicable for rc

significant improvement of the state of the art

Experimental Results, Conclusion

Experiments on the TPDB:

TcT AProVE TcT preproc AProVE & TcT AProVE++

209 270 299 308 324

powerful sufficient criterion for rc = irc

easy to automate

y future irc techniques applicable for rc

significant improvement of the state of the art

Experimental Results, Conclusion

Experiments on the TPDB:

TcT AProVE TcT preproc AProVE & TcT AProVE++

209 270 299 308 324

powerful sufficient criterion for rc = irc

easy to automate

y future irc techniques applicable for rc

significant improvement of the state of the art