Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA...
Transcript of Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA...
![Page 1: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/1.jpg)
Analyzing Runtime Complexity via Innermost RuntimeComplexity
Florian Frohn1 Jurgen Giesl1
1RWTH Aachen University, Germany
May 11, 2017
![Page 2: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/2.jpg)
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
![Page 3: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/3.jpg)
...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
![Page 4: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/4.jpg)
...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
![Page 5: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/5.jpg)
...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?
![Page 6: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/6.jpg)
...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?
![Page 7: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/7.jpg)
...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?
![Page 8: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/8.jpg)
...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?
![Page 9: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/9.jpg)
...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?
![Page 10: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/10.jpg)
...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?
![Page 11: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/11.jpg)
...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?
![Page 12: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/12.jpg)
...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?
![Page 13: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/13.jpg)
...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?
![Page 14: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/14.jpg)
...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?
![Page 15: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/15.jpg)
Outline
1 Preliminariesrc and ircNDG Rewriting
2 Handling Constructor Systems
3 Handling Non-Constructor Systems
4 Experimental Results, Conclusion
![Page 16: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/16.jpg)
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
![Page 17: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/17.jpg)
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
![Page 18: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/18.jpg)
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
![Page 19: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/19.jpg)
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
![Page 20: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/20.jpg)
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
![Page 21: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/21.jpg)
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
![Page 22: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/22.jpg)
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
![Page 23: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/23.jpg)
Outline
1 Preliminariesrc and ircNDG Rewriting
2 Handling Constructor Systems
3 Handling Non-Constructor Systems
4 Experimental Results, Conclusion
![Page 24: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/24.jpg)
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
![Page 25: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/25.jpg)
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
![Page 26: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/26.jpg)
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
![Page 27: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/27.jpg)
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
![Page 28: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/28.jpg)
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
![Page 29: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/29.jpg)
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
![Page 30: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/30.jpg)
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
![Page 31: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/31.jpg)
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
![Page 32: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/32.jpg)
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
![Page 33: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/33.jpg)
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
![Page 34: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/34.jpg)
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
![Page 35: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/35.jpg)
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
![Page 36: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/36.jpg)
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
![Page 37: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/37.jpg)
Outline
1 Preliminariesrc and ircNDG Rewriting
2 Handling Constructor Systems
3 Handling Non-Constructor Systems
4 Experimental Results, Conclusion
![Page 38: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/38.jpg)
“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”
![Page 39: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/39.jpg)
“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”
![Page 40: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/40.jpg)
“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”
![Page 41: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/41.jpg)
“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”
![Page 42: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/42.jpg)
“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”
![Page 43: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/43.jpg)
“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”
![Page 44: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/44.jpg)
“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”
![Page 45: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/45.jpg)
“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”
![Page 46: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/46.jpg)
“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”
![Page 47: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/47.jpg)
“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”
![Page 48: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/48.jpg)
“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”
![Page 49: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/49.jpg)
“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”
![Page 50: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/50.jpg)
“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”
![Page 51: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/51.jpg)
“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”
![Page 52: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/52.jpg)
“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
![Page 53: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/53.jpg)
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
![Page 54: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/54.jpg)
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
![Page 55: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/55.jpg)
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
![Page 56: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/56.jpg)
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
![Page 57: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/57.jpg)
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
![Page 58: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/58.jpg)
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
![Page 59: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/59.jpg)
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
![Page 60: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/60.jpg)
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
![Page 61: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/61.jpg)
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
![Page 62: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/62.jpg)
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
![Page 63: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/63.jpg)
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
![Page 64: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/64.jpg)
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)
![Page 65: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/65.jpg)
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)
![Page 66: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/66.jpg)
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)
![Page 67: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/67.jpg)
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)
![Page 68: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/68.jpg)
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)
![Page 69: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/69.jpg)
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)
![Page 70: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/70.jpg)
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
![Page 71: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/71.jpg)
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)
![Page 72: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/72.jpg)
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)
![Page 73: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/73.jpg)
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)
![Page 74: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/74.jpg)
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)
![Page 75: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/75.jpg)
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)
![Page 76: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/76.jpg)
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)
![Page 77: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/77.jpg)
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)
![Page 78: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/78.jpg)
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)
![Page 79: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/79.jpg)
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)
![Page 80: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/80.jpg)
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!
![Page 81: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/81.jpg)
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!
![Page 82: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/82.jpg)
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!
![Page 83: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/83.jpg)
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!
![Page 84: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/84.jpg)
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!
![Page 85: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/85.jpg)
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!
![Page 86: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/86.jpg)
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!
![Page 87: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/87.jpg)
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!
![Page 88: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/88.jpg)
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!
![Page 89: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/89.jpg)
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!
![Page 90: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/90.jpg)
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!
![Page 91: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/91.jpg)
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!
![Page 92: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/92.jpg)
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!
![Page 93: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/93.jpg)
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!
![Page 94: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/94.jpg)
Outline
1 Preliminariesrc and ircNDG Rewriting
2 Handling Constructor Systems
3 Handling Non-Constructor Systems
4 Experimental Results, Conclusion
![Page 95: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/95.jpg)
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
![Page 96: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/96.jpg)
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
![Page 97: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/97.jpg)
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
![Page 98: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/98.jpg)
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
![Page 99: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/99.jpg)
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
![Page 100: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/100.jpg)
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
![Page 101: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/101.jpg)
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
![Page 102: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/102.jpg)
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
![Page 103: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/103.jpg)
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
![Page 104: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/104.jpg)
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
![Page 105: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/105.jpg)
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
![Page 106: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/106.jpg)
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
![Page 107: Analyzing Runtime Complexity via Innermost …...NDG Rewriting is cheap! Theorem (Pol et. al, RTA ’05) NDG rewriting is at least as e cient as innermost rewriting. Reminder: rc rc](https://reader034.fdocuments.us/reader034/viewer/2022050303/5f6c13c6f306c562f4058a92/html5/thumbnails/107.jpg)
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