• Keine Ergebnisse gefunden

Inferring Lower Bounds for Runtime Complexity

N/A
N/A
Protected

Academic year: 2021

Aktie "Inferring Lower Bounds for Runtime Complexity"

Copied!
214
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Inferring Lower Bounds for Runtime Complexity

J¨ urgen Giesl

LuFG Informatik 2, RWTH Aachen University, Germany

joint work with Florian Frohn, Jera Hensel, Cornelius Aschermann, and Thomas Str¨ oder

(2)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs)))

low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys)) if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons(zero, . . . , cons(zero, nil)))

3n

2+2n+1

cons(zero, . . . , cons(zero, nil))

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(3)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons(zero, . . . , cons(zero, nil)))

3n

2+2n+1

cons(zero, . . . , cons(zero, nil))

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(4)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons(zero, . . . , cons(zero, nil)))

3n

2+2n+1

cons(zero, . . . , cons(zero, nil))

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(5)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons(zero, . . . , cons(zero, nil)))

3n

2+2n+1

cons(zero, . . . , cons(zero, nil))

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero)

Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(6)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons(zero, . . . , cons(zero, nil)))

3n

2+2n+1

cons(zero, . . . , cons(zero, nil))

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n

Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(7)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons(zero, . . . , cons(zero, nil)))

3n

2+2n+1

cons(zero, . . . , cons(zero, nil))

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

))

New goal: lower bounds for runtime complexity

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(8)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons(zero, . . . , cons(zero, nil)))

3n

2+2n+1

cons(zero, . . . , cons(zero, nil))

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(9)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons(zero, . . . , cons(zero, nil)))

3n

2+2n+1

cons(zero, . . . , cons(zero, nil))

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(10)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(11)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2

rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(12)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n

(rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(13)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(14)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(15)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(16)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

rc

R

(n)

Ω(n

2

)

Improvements

Implementation and Experiments

(17)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures

qs(cons

n

(zero, nil))

cons

n

(zero, nil) Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence

Improvements

Implementation and Experiments

(18)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

rc

R

(n)

Ω(n

2

)

Improvements

Implementation and Experiments

(19)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures Infer Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence

Improvements

Implementation and Experiments

(20)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Bounds for Rewrite Lemmas

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

rc

R

(n)

Ω(n

2

)

Improvements

Implementation and Experiments

(21)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Bounds for Rewrite Lemmas qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs

rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence

Improvements

Implementation and Experiments

(22)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Bounds for Rewrite Lemmas qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

rc (n)

Ω(n

2

)

Improvements

Implementation and Experiments

(23)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Bounds for Rewrite Lemmas qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence Improvements

Implementation and Experiments

(24)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

Speculate Conjectures qs(cons

n

(zero, nil))

cons

n

(zero, nil)

Prove Conjectures

Infer Bounds for Rewrite Lemmas qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs rc

R

(n)

Ω(n

2

)

(25)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

1

Speculate Conjectures qs(cons

n

(zero, nil))

cons

n

(zero, nil)

2

Prove Conjectures

3

Infer Bounds for Rewrite Lemmas qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

4

Infer Bounds for TRSs rc

R

(n)

Ω(n

2

)

relation between length of rewrite sequence and size of first term in sequence

5

Improvements

6

Implementation and Experiments

(26)

Runtime Complexity Analysis of TRSs

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

Rewrite Lemma

qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

|qs(consn(zero,nil))|= 2n+2 rcR(2n+ 2) ≥ 3n2+ 2n+ 1

Basic Terms f (t

1

, . . . , t

k

)

f defined symbol (low, qs), t

1

, . . . , t

k

no defined symbols (nil, cons, zero) Runtime Complexity rc

R

(n) of TRS R:

length of longest →-sequence with basic term t where | t | ≤ n Up to now: upper bounds for runtime complexity (rc

R

(n) ∈ O(n

2

)) New goal: lower bounds for runtime complexity (rc

R

(n) ∈ Ω(n

2

))

prove tightness of upper bounds detect bugs / vulnerabilities

1

Speculate Conjectures qs(cons

n

(zero, nil))

cons

n

(zero, nil)

2

Prove Conjectures

3

Infer Bounds for Rewrite Lemmas qs(cons

n

(zero, nil))

3n

2+2n+1

cons

n

(zero, nil)

rewrite lemma

describes family of rewrite sequences

Infer Bounds for TRSs rc

R

(n)

Ω(n

2

)

(27)

1. Speculating Conjectures

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

γNats

(0) = zero

γList

(0) = nil

γNats(n+ 1) = succ(γNats(n)) γList(n+ 1) = cons(zero, γList(n))

Compute most general typing for the TRS

zero :Nats, succ :Nats→Nats, nil :List, cons :Nats×List→List, . . .

Generator function symbol γ

τ

: N → τ

to express families of terms of type τ

γ

τ

(n): constructor ground term where constructor is nested n times

Generator equations G for type τ with constructors c, d:

if c:τ1×. . .×τk→τ and d:ρ1×. . .×τ×. . .×ρb→τ

thenGcontains γτ(0) = c(γτ1(0), . . . , γτk(0))

γτ(n+ 1) = d(γρ1(0), . . . ,γτ(n), . . . , γρb(0))

For

f

:

τ1×. . .×τk→τ, speculate a conjecture

by narrowing

f

τ1

(n

1

), . . . , γ

τk

(n

k

))

using rewrite rules, generator equations, integer arithmetic,

already proven rewrite lemmas:

low(zero,consn(zero,nil)) →3n+1 nil, high(γNats(0), γList(n)) →3n+1 γList(n)

qs(γList(n))

nil [n/0]

qs(low(zero, γList(n0)))++cons(zero,qs(high(zero, γList(n0))))

cons(zero,nil) [n0/0]

cons(zero,cons(zero,qs(γList(n00))))

cons(zero,cons(zero,nil)) [n00/0]

. . . [n0/n00+ 1]

[n/n0+ 1]

Every path from root to leaf yields a sample conjecture

Recursion depthd: number of recursive qs-rule applications

d= 0

qs(γList(n))[n/0] → γList( 0 ) polleft(d

0

) = 0 polright(d

0

) = 0

d= 1 qs(γList( 1 ))→ γList( 1 ) polleft(1) = 1 polright(1) = 1

d= 2 qs(γList( 2 ))→ γList( 2 ) polleft(2) = 2 polright(2) = 2

Speculate conjecture

qs(γ

List

(

polleft

(d) ))

γList

(

polright

(d ) )

replacenumbersin sample conjectures by polynomial with variabled econstraints can be solved by polynomial of degreee−1

polleft(d) = d polright(d) = d

(28)

1. Speculating Conjectures

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

γNats

(0) = zero

γList

(0) = nil

γNats(n+ 1) = succ(γNats(n)) γList(n+ 1) = cons(zero, γList(n))

Compute most general typing for the TRS

zero :Nats, succ :Nats→Nats, nil :List, cons :Nats×List→List, . . .

Generator function symbol γ

τ

: N → τ

to express families of terms of type τ

γ

τ

(n): constructor ground term where constructor is nested n times

Generator equations G for type τ with constructors c, d:

if c:τ1×. . .×τk→τ and d:ρ1×. . .×τ×. . .×ρb→τ

thenGcontains γτ(0) = c(γτ1(0), . . . , γτk(0))

γτ(n+ 1) = d(γρ1(0), . . . ,γτ(n), . . . , γρb(0))

For

f

:

τ1×. . .×τk→τ, speculate a conjecture

by narrowing

f

τ1

(n

1

), . . . , γ

τk

(n

k

))

using rewrite rules, generator equations, integer arithmetic,

already proven rewrite lemmas:

low(zero,consn(zero,nil)) →3n+1 nil, high(γNats(0), γList(n)) →3n+1 γList(n)

qs(γList(n))

nil [n/0]

qs(low(zero, γList(n0)))++cons(zero,qs(high(zero, γList(n0))))

cons(zero,nil) [n0/0]

cons(zero,cons(zero,qs(γList(n00))))

cons(zero,cons(zero,nil)) [n00/0]

. . . [n0/n00+ 1]

[n/n0+ 1]

Every path from root to leaf yields a sample conjecture

Recursion depthd: number of recursive qs-rule applications

d= 0

qs(γList(n))[n/0] → γList( 0 ) polleft(d

0

) = 0 polright(d

0

) = 0

d= 1 qs(γList( 1 ))→ γList( 1 ) polleft(1) = 1 polright(1) = 1

d= 2 qs(γList( 2 ))→ γList( 2 ) polleft(2) = 2 polright(2) = 2

Speculate conjecture

qs(γ

List

(

polleft

(d) ))

γList

(

polright

(d ) )

replacenumbersin sample conjectures by polynomial with variabled econstraints can be solved by polynomial of degreee−1

polleft(d) = d polright(d) = d

(29)

1. Speculating Conjectures

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

γNats

(0) = zero

γList

(0) = nil

γNats(n+ 1) = succ(γNats(n)) γList(n+ 1) = cons(zero, γList(n))

Compute most general typing for the TRS

zero :Nats, succ :Nats→Nats, nil :List, cons :Nats×List→List, . . .

Generator function symbol γ

τ

: N → τ

to express families of terms of type τ

γ

τ

(n): constructor ground term where constructor is nested n times

Generator equations G for type τ with constructors c, d:

if c:τ1×. . .×τk→τ and d:ρ1×. . .×τ×. . .×ρb→τ

thenGcontains γτ(0) = c(γτ1(0), . . . , γτk(0))

γτ(n+ 1) = d(γρ1(0), . . . ,γτ(n), . . . , γρb(0))

For

f

:

τ1×. . .×τk→τ, speculate a conjecture

by narrowing

f

τ1

(n

1

), . . . , γ

τk

(n

k

))

using rewrite rules, generator equations, integer arithmetic,

already proven rewrite lemmas:

low(zero,consn(zero,nil)) →3n+1 nil, high(γNats(0), γList(n)) →3n+1 γList(n)

qs(γList(n))

nil [n/0]

qs(low(zero, γList(n0)))++cons(zero,qs(high(zero, γList(n0))))

cons(zero,nil) [n0/0]

cons(zero,cons(zero,qs(γList(n00))))

cons(zero,cons(zero,nil)) [n00/0]

. . . [n0/n00+ 1]

[n/n0+ 1]

Every path from root to leaf yields a sample conjecture

Recursion depthd: number of recursive qs-rule applications

d= 0

qs(γList(n))[n/0] → γList( 0 ) polleft(d

0

) = 0 polright(d

0

) = 0

d= 1 qs(γList( 1 ))→ γList( 1 ) polleft(1) = 1 polright(1) = 1

d= 2 qs(γList( 2 ))→ γList( 2 ) polleft(2) = 2 polright(2) = 2

Speculate conjecture

qs(γ

List

(

polleft

(d) ))

γList

(

polright

(d ) )

replacenumbersin sample conjectures by polynomial with variabled econstraints can be solved by polynomial of degreee−1

polleft(d) = d polright(d) = d

(30)

1. Speculating Conjectures

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

γNats

(0) = zero

γList

(0) = nil

γNats(n+ 1) = succ(γNats(n)) γList(n+ 1) = cons(zero, γList(n))

Compute most general typing for the TRS

zero :Nats, succ :Nats→Nats, nil :List, cons :Nats×List→List, . . .

Generator function symbol γ

τ

: N → τ

to express families of terms of type τ

γ

τ

(n): constructor ground term where constructor is nested n times

Generator equations G for type τ with constructors c, d:

if c:τ1×. . .×τk→τ and d:ρ1×. . .×τ×. . .×ρb→τ

thenGcontains γτ(0) = c(γτ1(0), . . . , γτk(0))

γτ(n+ 1) = d(γρ1(0), . . . ,γτ(n), . . . , γρb(0))

For

f

:

τ1×. . .×τk→τ, speculate a conjecture

by narrowing

f

τ1

(n

1

), . . . , γ

τk

(n

k

))

using rewrite rules, generator equations, integer arithmetic,

already proven rewrite lemmas:

low(zero,consn(zero,nil)) →3n+1 nil, high(γNats(0), γList(n)) →3n+1 γList(n)

qs(γList(n))

nil [n/0]

qs(low(zero, γList(n0)))++cons(zero,qs(high(zero, γList(n0))))

cons(zero,nil) [n0/0]

cons(zero,cons(zero,qs(γList(n00))))

cons(zero,cons(zero,nil)) [n00/0]

. . . [n0/n00+ 1]

[n/n0+ 1]

Every path from root to leaf yields a sample conjecture

Recursion depthd: number of recursive qs-rule applications

d= 0

qs(γList(n))[n/0] → γList( 0 ) polleft(d

0

) = 0 polright(d

0

) = 0

d= 1 qs(γList( 1 ))→ γList( 1 ) polleft(1) = 1 polright(1) = 1

d= 2 qs(γList( 2 ))→ γList( 2 ) polleft(2) = 2 polright(2) = 2

Speculate conjecture

qs(γ

List

(

polleft

(d) ))

γList

(

polright

(d ) )

replacenumbersin sample conjectures by polynomial with variabled econstraints can be solved by polynomial of degreee−1

polleft(d) = d polright(d) = d

(31)

1. Speculating Conjectures

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

γNats

(0) = zero

γList

(0) = nil

γNats(n+ 1) = succ(γNats(n)) γList(n+ 1) = cons(zero, γList(n))

Compute most general typing for the TRS

zero :Nats, succ :Nats→Nats, nil :List, cons :Nats×List→List, . . .

Generator function symbol γ

τ

: N → τ to express families of terms of type τ

γ

τ

(n): constructor ground term where constructor is nested n times

Generator equations G for type τ with constructors c, d:

if c:τ1×. . .×τk→τ and d:ρ1×. . .×τ×. . .×ρb→τ

thenGcontains γτ(0) = c(γτ1(0), . . . , γτk(0))

γτ(n+ 1) = d(γρ1(0), . . . ,γτ(n), . . . , γρb(0))

For

f

:

τ1×. . .×τk→τ, speculate a conjecture

by narrowing

f

τ1

(n

1

), . . . , γ

τk

(n

k

))

using rewrite rules, generator equations, integer arithmetic,

already proven rewrite lemmas:

low(zero,consn(zero,nil)) →3n+1 nil, high(γNats(0), γList(n)) →3n+1 γList(n)

qs(γList(n))

nil [n/0]

qs(low(zero, γList(n0)))++cons(zero,qs(high(zero, γList(n0))))

cons(zero,nil) [n0/0]

cons(zero,cons(zero,qs(γList(n00))))

cons(zero,cons(zero,nil)) [n00/0]

. . . [n0/n00+ 1]

[n/n0+ 1]

Every path from root to leaf yields a sample conjecture

Recursion depthd: number of recursive qs-rule applications

d= 0

qs(γList(n))[n/0] → γList( 0 ) polleft(d

0

) = 0 polright(d

0

) = 0

d= 1 qs(γList( 1 ))→ γList( 1 ) polleft(1) = 1 polright(1) = 1

d= 2 qs(γList( 2 ))→ γList( 2 ) polleft(2) = 2 polright(2) = 2

Speculate conjecture

qs(γ

List

(

polleft

(d) ))

γList

(

polright

(d ) )

replacenumbersin sample conjectures by polynomial with variabled econstraints can be solved by polynomial of degreee−1

polleft(d) = d polright(d) = d

(32)

1. Speculating Conjectures

qs(nil)→nil qs(cons(x,xs))→qs(low(x,xs))++cons(x,qs(high(x,xs))) low(x,nil)→nil low(x,cons(y,ys))→if(x≤y,x,cons(y,ys))

if(tt,x,cons(y,ys))→low(x,ys) if(ff,x,cons(y,ys))→cons(y,low(x,ys))

γNats

(0) = zero

γList

(0) = nil

γNats(n+ 1) = succ(γNats(n)) γList(n+ 1) = cons(zero, γList(n))

Compute most general typing for the TRS

zero :Nats, succ :Nats→Nats, nil :List, cons :Nats×List→List, . . .

Generator function symbol γ

τ

: N → τ to express families of terms of type τ

γ

τ

(n): constructor ground term where constructor is nested n times

Generator equations G for type τ with constructors c, d:

if c:τ1×. . .×τk→τ and d:ρ1×. . .×τ×. . .×ρb→τ

thenGcontains γτ(0) = c(γτ1(0), . . . , γτk(0))

γτ(n+ 1) = d(γρ1(0), . . . ,γτ(n), . . . , γρb(0))

For

f

:

τ1×. . .×τk→τ, speculate a conjecture

by narrowing

f

τ1

(n

1

), . . . , γ

τk

(n

k

))

using rewrite rules, generator equations, integer arithmetic,

already proven rewrite lemmas:

low(zero,consn(zero,nil)) →3n+1 nil, high(γNats(0), γList(n)) →3n+1 γList(n)

qs(γList(n))

nil [n/0]

qs(low(zero, γList(n0)))++cons(zero,qs(high(zero, γList(n0))))

cons(zero,nil) [n0/0]

cons(zero,cons(zero,qs(γList(n00))))

cons(zero,cons(zero,nil)) [n00/0]

. . . [n0/n00+ 1]

[n/n0+ 1]

Every path from root to leaf yields a sample conjecture

Recursion depthd: number of recursive qs-rule applications

d= 0

qs(γList(n))[n/0] → γList( 0 ) polleft(d

0

) = 0 polright(d

0

) = 0

d= 1 qs(γList( 1 ))→ γList( 1 ) polleft(1) = 1 polright(1) = 1

d= 2 qs(γList( 2 ))→ γList( 2 ) polleft(2) = 2 polright(2) = 2

Speculate conjecture

qs(γ

List

(

polleft

(d) ))

γList

(

polright

(d ) )

replacenumbersin sample conjectures by polynomial with variabled econstraints can be solved by polynomial of degreee−1

polleft(d) = d polright(d) = d

Referenzen

ÄHNLICHE DOKUMENTE

(2) The proof of this theorem given in [4] is in fact algorithmic, that is, the authors provide an efficient algorithm that turns the given flow x into an unsplittable flow y

We study asymptotic lower and upper bounds for the sizes of constant dimension codes with respect to the subspace or injection distance, which is used in random linear network

In the next section we present a lower bound method for sums of graph–driven ⊕BP1s in order to prove lower bounds for this model with the additional restriction that the orderings

the exponential-size finite-state upper bound presented in the original paper, we introduce a polynomial-size finite-state Markov chain for a new synchronizer variant α ,

In [11], the author shows how to extend Lee-Brickell’s and Stern’s algorithms to codes over F q. The website [12] lists the work factor of this algorithm against several parameters.

Pos- sibly the most important novel results of this paper are the following: (1) A derivation of a lower bound for the Jaccard distance of sets represented using Bloom filters, (2)

The paper describes a numerically stable method of minimization of piecewise quadratic convex functions subject to lower and upper bounds.. The presented approach may

We consider a generalization of the Prize Collecting Steiner Tree Problem on a graph with special redundancy requirements on a subset of the customer nodes suitable to model a