O mputational gic L Closing the Gap Between Runtime Complexity - - PowerPoint PPT Presentation

o
SMART_READER_LITE
LIVE PREVIEW

O mputational gic L Closing the Gap Between Runtime Complexity - - PowerPoint PPT Presentation

C O mputational gic L Closing the Gap Between Runtime Complexity and Polytime Computability Martin Avanzini and Georg Moser Computational Logic Faculty of Computer Science, University of Innsbruck RTA 10 Complexity Analysis of Term


slide-1
SLIDE 1

O

L C

mputational

gic

Closing the Gap Between Runtime Complexity and Polytime Computability

Martin Avanzini and Georg Moser

Computational Logic Faculty of Computer Science, University of Innsbruck

RTA ’10

slide-2
SLIDE 2

Complexity Analysis of Term Rewrite Systems

Runtime Complexity Analysis

Simple “Functional Program”

➀ d(c) = 0 ➂ d(x + y) = d(x) + d(y) ➁ d(x × y) = d(x) × y + x × d(y) ➃ d(x − y) = d(x) − d(y) data Exp = Zero | Const c | Times Exp Exp e1 × e2 | Plus Exp Exp e1 + e2 | Minus Exp Exp e1 − e2

MA & GM (ICS @ UIBK) RC = CC 2/15

slide-3
SLIDE 3

Complexity Analysis of Term Rewrite Systems

Runtime Complexity Analysis

Simple “Functional Program”

➀ d(c) = 0 ➂ d(x + y) = d(x) + d(y) ➁ d(x × y) = d(x) × y + x × d(y) ➃ d(x − y) = d(x) − d(y)

Computation

d(c × c)

MA & GM (ICS @ UIBK) RC = CC 2/15

slide-4
SLIDE 4

Complexity Analysis of Term Rewrite Systems

Runtime Complexity Analysis

Simple “Functional Program”

➀ d(c) = 0 ➂ d(x + y) = d(x) + d(y) ➁ d(x × y) = d(x) × y + x × d(y) ➃ d(x − y) = d(x) − d(y)

Computation

d(c × c) = d(c) × c + c × d(c)

MA & GM (ICS @ UIBK) RC = CC 2/15

slide-5
SLIDE 5

Complexity Analysis of Term Rewrite Systems

Runtime Complexity Analysis

Simple “Functional Program”

➀ d(c) = 0 ➂ d(x + y) = d(x) + d(y) ➁ d(x × y) = d(x) × y + x × d(y) ➃ d(x − y) = d(x) − d(y)

Computation

d(c × c) = 0 × c + c × d(c)

MA & GM (ICS @ UIBK) RC = CC 2/15

slide-6
SLIDE 6

Complexity Analysis of Term Rewrite Systems

Runtime Complexity Analysis

Simple “Functional Program”

➀ d(c) = 0 ➂ d(x + y) = d(x) + d(y) ➁ d(x × y) = d(x) × y + x × d(y) ➃ d(x − y) = d(x) − d(y)

Computation

d(c × c) = 0 × c + c × 0

MA & GM (ICS @ UIBK) RC = CC 2/15

slide-7
SLIDE 7

Complexity Analysis of Term Rewrite Systems

Runtime Complexity Analysis

Simple “Functional Program” ≈ Term Rewrite System (TRS)

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y)

Computation ≈ Rewriting

d(c × c) − →!

R 0 × c + c × 0

MA & GM (ICS @ UIBK) RC = CC 2/15

slide-8
SLIDE 8

Complexity Analysis of Term Rewrite Systems

Runtime Complexity Analysis

Simple “Functional Program” ≈ Term Rewrite System (TRS)

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y)

Computation ≈ Rewriting

d(c × c) − →!

R 0 × c + c × 0

Runtime Complexity

“number of reduction steps as function in the size of the initial terms”

MA & GM (ICS @ UIBK) RC = CC 2/15

slide-9
SLIDE 9

Complexity Analysis of Term Rewrite Systems

Runtime Complexity Analysis

Simple “Functional Program” ≈ Term Rewrite System (TRS)

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y)

Computation ≈ Rewriting

d(c × c) − →!

R 0 × c + c × 0

Runtime Complexity

“number of reduction steps as function in the size of the initial terms”

◮ initial terms are argument normalised

MA & GM (ICS @ UIBK) RC = CC 2/15

slide-10
SLIDE 10

Complexity Analysis of Term Rewrite Systems

Computation and Complexity

let C collect all constructor symbols and let Val abbreviate T (C, V)

Definition (Computation)

Let R denote a confluent and terminating TRS. R computes a function f : Valk → Val if ∃ function symbol f f (v1, . . . , vk) = w ⇐ ⇒ f(v1, . . . , vk) − →!

R w

MA & GM (ICS @ UIBK) RC = CC 3/15

slide-11
SLIDE 11

Complexity Analysis of Term Rewrite Systems

Computation and Complexity

let C collect all constructor symbols and let Val abbreviate T (C, V)

Definition (Computation)

Let R denote a confluent and terminating TRS. R computes a relation R ⊆ Valk × Val if ∃ function symbol f (v1, . . . , vk, w) ∈ R ⇐ ⇒ f(v1, . . . , vk) − →!

R w and w accepting

MA & GM (ICS @ UIBK) RC = CC 3/15

slide-12
SLIDE 12

Complexity Analysis of Term Rewrite Systems

Computation and Complexity

let C collect all constructor symbols and let Val abbreviate T (C, V)

Definition (Computation)

Let R denote a confluent and terminating TRS. R computes a relation R ⊆ Valk × Val if ∃ function symbol f (v1, . . . , vk, w) ∈ R ⇐ ⇒ f(v1, . . . , vk) − →!

R w and w accepting

Definition (Runtime Complexity)

rcR(n) = max{ dl(t, − →R) | |t| n } where dl(t, − →R) = max{ℓ | ∃(t1, . . . , tℓ). t − →R t1 − →R . . . − →R tℓ}

MA & GM (ICS @ UIBK) RC = CC 3/15

slide-13
SLIDE 13

Complexity Analysis of Term Rewrite Systems

Computation and Complexity

let C collect all constructor symbols and let Val abbreviate T (C, V)

Definition (Computation)

Let R denote a confluent and terminating TRS. R computes a relation R ⊆ Valk × Val if ∃ function symbol f (v1, . . . , vk, w) ∈ R ⇐ ⇒ f(v1, . . . , vk) − →!

R w and w accepting

Definition (Runtime Complexity)

rcR(n) = max{ dl(t, − →R) | |t| n and arguments from Val } where dl(t, − →R) = max{ℓ | ∃(t1, . . . , tℓ). t − →R t1 − →R . . . − →R tℓ}

MA & GM (ICS @ UIBK) RC = CC 3/15

slide-14
SLIDE 14

Complexity Analysis of Term Rewrite Systems

Automated Complexity Analysis

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y)

MA & GM (ICS @ UIBK) RC = CC 4/15

slide-15
SLIDE 15

Complexity Analysis of Term Rewrite Systems

Automated Complexity Analysis

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y)

◮ derivational complexity of above TRS is at least exponential

MA & GM (ICS @ UIBK) RC = CC 4/15

slide-16
SLIDE 16

Complexity Analysis of Term Rewrite Systems

Automated Complexity Analysis

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y)

◮ derivational complexity of above TRS is at least exponential ◮ runtime complexity of above TRS is linear

$ tct -a rc -p dif.trs YES(?,O(n^1)) ’Weak Dependency Pairs’

  • Answer:

YES(?,O(n^1)) Input Problem: runtime-complexity with respect to Rules: { d(c) -> 0() , d(*(x, y)) -> +(*(y, d(x)), *(x, d(y))) , d(+(x, y)) -> +(d(x), d(y)) , d(-(x, y)) -> -(d(x), d(y))} Proof Details: ... MA & GM (ICS @ UIBK) RC = CC 4/15

slide-17
SLIDE 17

Complexity Analysis of Term Rewrite Systems

Automated Complexity Analysis

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y)

◮ derivational complexity of above TRS is at least exponential ◮ runtime complexity of above TRS is linear

$ tct -a rc -p dif.trs YES(?,O(n^1)) ’Weak Dependency Pairs’

  • Answer:

YES(?,O(n^1)) Input Problem: runtime-complexity with respect to Rules: { d(c) -> 0() , d(*(x, y)) -> +(*(y, d(x)), *(x, d(y))) , d(+(x, y)) -> +(d(x), d(y)) , d(-(x, y)) -> -(d(x), d(y))} Proof Details: ...

Our Question

what can we infer about the computational complexity from this proof?

MA & GM (ICS @ UIBK) RC = CC 4/15

slide-18
SLIDE 18

Complexity Analysis of Term Rewrite Systems

Automated Complexity Analysis

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y)

◮ derivational complexity of above TRS is at least exponential ◮ runtime complexity of above TRS is linear

$ tct -a rc -p dif.trs YES(?,O(n^1)) ’Weak Dependency Pairs’

  • Answer:

YES(?,O(n^1)) Input Problem: runtime-complexity with respect to Rules: { d(c) -> 0() , d(*(x, y)) -> +(*(y, d(x)), *(x, d(y))) , d(+(x, y)) -> +(d(x), d(y)) , d(-(x, y)) -> -(d(x), d(y))} Proof Details: ...

Our Question

In particular, does it certify polytime computability

  • f the functions defined?

MA & GM (ICS @ UIBK) RC = CC 4/15

slide-19
SLIDE 19

Main Result

Yes

MA & GM (ICS @ UIBK) RC = CC 5/15

slide-20
SLIDE 20

Main Result

runtime complexity is a reasonable cost model for rewriting

MA & GM (ICS @ UIBK) RC = CC 5/15

slide-21
SLIDE 21

Main Result

runtime complexity is a reasonable cost model for rewriting

1 runtime complexity naturally expresses the cost of computation

MA & GM (ICS @ UIBK) RC = CC 5/15

slide-22
SLIDE 22

Main Result

runtime complexity is a reasonable cost model for rewriting

1 runtime complexity naturally expresses the cost of computation 2 polynomially related to actual cost of an implementation

  • n a Turing machine

MA & GM (ICS @ UIBK) RC = CC 5/15

slide-23
SLIDE 23

Main Result

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7)

MA & GM (ICS @ UIBK) RC = CC 6/15

slide-24
SLIDE 24

Main Result

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7)

s · t1 t2 · t3 · t4 t5 t6 t7

MA & GM (ICS @ UIBK) RC = CC 6/15

slide-25
SLIDE 25

Main Result

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7)

s · t1 t2 · t3 · t4 t5 t6 t7 computed NF depends on employed strategy

MA & GM (ICS @ UIBK) RC = CC 6/15

slide-26
SLIDE 26

Main Result

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

s · t1 t2 · t3 · t4 t5 t6 t7 choice of redex nondeterministically

MA & GM (ICS @ UIBK) RC = CC 6/15

slide-27
SLIDE 27

Main Result

Difficulty

a single rewrite step may copy arbitrarily large terms

◮ terms may grow exponential in the length of derivations

MA & GM (ICS @ UIBK) RC = CC 7/15

slide-28
SLIDE 28

Main Result

Difficulty

a single rewrite step may copy arbitrarily large terms

◮ terms may grow exponential in the length of derivations

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y)

MA & GM (ICS @ UIBK) RC = CC 7/15

slide-29
SLIDE 29

Main Result

Difficulty

a single rewrite step may copy arbitrarily large terms

◮ terms may grow exponential in the length of derivations

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y) d(c) − →!

R 0

MA & GM (ICS @ UIBK) RC = CC 7/15

slide-30
SLIDE 30

Main Result

Difficulty

a single rewrite step may copy arbitrarily large terms

◮ terms may grow exponential in the length of derivations

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y) d(c) − →!

R 0

d(c × c) − →!

R 0 × c + c × 0

MA & GM (ICS @ UIBK) RC = CC 7/15

slide-31
SLIDE 31

Main Result

Difficulty

a single rewrite step may copy arbitrarily large terms

◮ terms may grow exponential in the length of derivations

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y) d(c) − →!

R 0

d(c × c) − →!

R 0 × c + c × 0

d((c × c) × c) − →!

R (0 × c + c × 0) × c + (c × c) × 0

MA & GM (ICS @ UIBK) RC = CC 7/15

slide-32
SLIDE 32

Main Result

Difficulty

a single rewrite step may copy arbitrarily large terms

◮ terms may grow exponential in the length of derivations

Example

➀ d(c) → 0 ➂ d(x + y) → d(x) + d(y) ➁ d(x × y) → d(x) × y + x × d(y) ➃ d(x − y) → d(x) − d(y) d(c) − →!

R 0

d(c × c) − →!

R 0 × c + c × 0

d((c × c) × c) − →!

R (0 × c + c × 0) × c + (c × c) × 0

d((c × c) × (c × c)) − →!

R ((0 × c + c × 0) × c + (c × c) × 0) × (c × c)

+ (c × c) × ((0 × c + c × 0) × c + (c × c) × 0)

MA & GM (ICS @ UIBK) RC = CC 7/15

slide-33
SLIDE 33

Main Result

Proof Outline

f (s1, . . . , sn) t

ℓ R

term rewriting f (s1, . . . , sn) t

p(ℓ) M

Turing machine

MA & GM (ICS @ UIBK) RC = CC 8/15

slide-34
SLIDE 34

Main Result

Proof Outline

f (s1, . . . , sn) t

ℓ R

term rewriting · ·

ℓ G

graph rewriting f (s1, . . . , sn) t

p(ℓ) M

Turing machine

MA & GM (ICS @ UIBK) RC = CC 8/15

slide-35
SLIDE 35

Main Result

Proof Outline

Adequacy of Graph Rewriting – “Complexity Version”

f (s1, . . . , sn) t

ℓ R

term rewriting · ·

ℓ G

graph rewriting f (s1, . . . , sn) t

p(ℓ) M

Turing machine

MA & GM (ICS @ UIBK) RC = CC 8/15

slide-36
SLIDE 36

Graph Rewriting in a Nutshell

1 term rewriting on graphs

Example

term t = d(x + x) × d(x + x) represented by × d d + x

◮ same variable represented by unique node

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-37
SLIDE 37

Graph Rewriting in a Nutshell

1 term rewriting on graphs

Example

term t = d(x + x) × d(x + x) represented by × d d + + x × d d + x × d + x

◮ same variable represented by unique node

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-38
SLIDE 38

Graph Rewriting in a Nutshell

1 term rewriting on graphs

Example

term t = d(x + x) × d(x + x) represented by × d d + + x

  • ×

d d + x

  • ×

d + x

◮ same variable represented by unique node

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-39
SLIDE 39

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing

Example Term Rewriting

d

− →R

+

d(x) → x + x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-40
SLIDE 40

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing

Example Graph Rewriting

d

− →G

+

d(x) → x + x ⇓

d x → + x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-41
SLIDE 41

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing 3 structural equality “pointer equality”

Example Matching

+ x y +

x + y → d(x) ⇓

+ x y → d x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-42
SLIDE 42

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing 3 structural equality “pointer equality”

Example Matching

+ x y +

x + y → d(x) ⇓

+ x y → d x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-43
SLIDE 43

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing 3 structural equality “pointer equality”

Example Matching

+ x y +

x x + y → d(x) ⇓

+ x y → d x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-44
SLIDE 44

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing 3 structural equality “pointer equality”

Example Matching

+ x y +

x y x + y → d(x) ⇓

+ x y → d x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-45
SLIDE 45

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing 3 structural equality “pointer equality”

Example Matching

+ x +

x + x → d(x) ⇓

+ x → d x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-46
SLIDE 46

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing 3 structural equality “pointer equality”

Example Matching

+ x +

x + x → d(x) ⇓

+ x → d x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-47
SLIDE 47

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing 3 structural equality “pointer equality”

Example Matching

+ x +

x + x → d(x) ⇓

+ x → d x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-48
SLIDE 48

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing 3 structural equality “pointer equality”

Example Matching

+ x +

☞ x + x → d(x) ⇓

+ x → d x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-49
SLIDE 49

Graph Rewriting in a Nutshell

1 term rewriting on graphs 2 copying sharing 3 structural equality “pointer equality”

Example Matching

+ x +

x x + x → d(x) ⇓

+ x → d x

MA & GM (ICS @ UIBK) RC = CC 9/15

slide-50
SLIDE 50

Adequacy of Graph Rewriting

Problems

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + (0 + 0)

→R

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + d(0)
  • x + x → d(x)

MA & GM (ICS @ UIBK) RC = CC 10/15

slide-51
SLIDE 51

Adequacy of Graph Rewriting

Problems

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + (0 + 0)

→R

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + d(0)
  • x + x → d(x)

× + +

MA & GM (ICS @ UIBK) RC = CC 10/15

slide-52
SLIDE 52

Adequacy of Graph Rewriting

Problems

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + (0 + 0)

→R

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + d(0)
  • x + x → d(x)

× + +

no redex

MA & GM (ICS @ UIBK) RC = CC 10/15

slide-53
SLIDE 53

Adequacy of Graph Rewriting

Problems

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + (0 + 0)

→R

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + d(0)
  • x + x → d(x)

× + +

Problem ➀

below redex maximal sharing required

MA & GM (ICS @ UIBK) RC = CC 10/15

slide-54
SLIDE 54

Adequacy of Graph Rewriting

Problems

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + (0 + 0)

→R

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + d(0)
  • x + x → d(x)

× + +

Problem ➀

below redex maximal sharing required − →G × + d

MA & GM (ICS @ UIBK) RC = CC 10/15

slide-55
SLIDE 55

Adequacy of Graph Rewriting

Problems

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + (0 + 0)

→R

  • (0 + 0) + (0 + 0)
  • ×
  • (0 + 0) + d(0)

→3

R

  • d(0) + d(0)
  • ×
  • d(0) + d(0)
  • x + x → d(x)

× + +

Problem ➀

below redex maximal sharing required − →G × + d

Problem ➁

both arguments

  • f +\× rewritten

MA & GM (ICS @ UIBK) RC = CC 10/15

slide-56
SLIDE 56

Adequacy of Graph Rewriting

Theorem

suppose S is a term graph such that

1 node corresponding to p is unshared 2 subgraph S ↾p is maximally shared

Then S − →G,p T ⇐ ⇒ term(S) − →R,p term(T)

MA & GM (ICS @ UIBK) RC = CC 11/15

slide-57
SLIDE 57

Adequacy of Graph Rewriting

Theorem

suppose S is a term graph such that

1 node corresponding to p is unshared 2 subgraph S ↾p is maximally shared

Then S − →G,p T ⇐ ⇒ term(S) − →R,p term(T)

Idea

◮ extend rewrite relation −

→G with folding and unfolding steps that recover condition ➊ and ➋ S · · − →G T ⇐ ⇒ term(S) − →R term(T)

MA & GM (ICS @ UIBK) RC = CC 11/15

slide-58
SLIDE 58

Adequacy of Graph Rewriting

Theorem

suppose S is a term graph such that

1 node corresponding to p is unshared 2 subgraph S ↾p is maximally shared

Then S − →G,p T ⇐ ⇒ term(S) − →R,p term(T)

Idea

◮ extend rewrite relation −

→G with folding and unfolding steps that recover condition ➊ and ➋ S · · − →G T ⇐ ⇒ term(S) − →R term(T)

Observation

◮ unfolding may lead to exponential blowup

MA & GM (ICS @ UIBK) RC = CC 11/15

slide-59
SLIDE 59

Restricted Folding and Unfolding

define for term graphs S, T

◮ S u v T :⇐

⇒ “T obtained from S by identifying nodes u and v” f g g

  • u

v f g

  • S

T

MA & GM (ICS @ UIBK) RC = CC 12/15

slide-60
SLIDE 60

Restricted Folding and Unfolding

define for term graphs S, T

◮ S u v T :⇐

⇒ “T obtained from S by identifying nodes u and v”

Example u

v

+ +

u v

+ +

MA & GM (ICS @ UIBK) RC = CC 12/15

slide-61
SLIDE 61

Restricted Folding and Unfolding

define for term graphs S, T

◮ S u v T :⇐

⇒ “T obtained from S by identifying nodes u and v” and position p

◮ S ◮p T :⇐

⇒ S u

v T for nodes u, v ∈ S strictly below position p

Example u

v

+ +

u v

+ +

MA & GM (ICS @ UIBK) RC = CC 12/15

slide-62
SLIDE 62

Restricted Folding and Unfolding

define for term graphs S, T

◮ S u v T :⇐

⇒ “T obtained from S by identifying nodes u and v” and position p

◮ S ◮p T :⇐

⇒ S u

v T for nodes u, v ∈ S strictly below position p

Example ◮2

+ +

u v

+ +

MA & GM (ICS @ UIBK) RC = CC 12/15

slide-63
SLIDE 63

Restricted Folding and Unfolding

define for term graphs S, T

◮ S u v T :⇐

⇒ “T obtained from S by identifying nodes u and v” and position p

◮ S ◮p T :⇐

⇒ S u

v T for nodes u, v ∈ S strictly below position p ◮ S ⊳p T :⇐

⇒ S u

v T and u ∈ T

node above position p

MA & GM (ICS @ UIBK) RC = CC 12/15

slide-64
SLIDE 64

Restricted Folding and Unfolding

define for term graphs S, T

◮ S u v T :⇐

⇒ “T obtained from S by identifying nodes u and v” and position p

◮ S ◮p T :⇐

⇒ S u

v T for nodes u, v ∈ S strictly below position p ◮ S ⊳p T :⇐

⇒ S u

v T and u ∈ T unshared node above position p

MA & GM (ICS @ UIBK) RC = CC 12/15

slide-65
SLIDE 65

Restricted Folding and Unfolding

define for term graphs S, T

◮ S u v T :⇐

⇒ “T obtained from S by identifying nodes u and v” and position p

◮ S ◮p T :⇐

⇒ S u

v T for nodes u, v ∈ S strictly below position p ◮ S ⊳p T :⇐

⇒ S u

v T and u ∈ T unshared node above position p

Example u2

v2

+ + + + +

v2 u2

u1

v1

+ + +

v1 u1

MA & GM (ICS @ UIBK) RC = CC 12/15

slide-66
SLIDE 66

Restricted Folding and Unfolding

define for term graphs S, T

◮ S u v T :⇐

⇒ “T obtained from S by identifying nodes u and v” and position p

◮ S ◮p T :⇐

⇒ S u

v T for nodes u, v ∈ S strictly below position p ◮ S ⊳p T :⇐

⇒ S u

v T and u ∈ T unshared node above position p

Example ⊳2.2

+ + + + +

v2 u2

⊳2.2

+ + +

v1 u1

MA & GM (ICS @ UIBK) RC = CC 12/15

slide-67
SLIDE 67

Adequacy Theorem

“Complexity Version”

Lemma

1 if S is ◮p-minimal then S ↾p is maximally sharing 2 if S is ⊳p-minimal then the node at position p is unshared

MA & GM (ICS @ UIBK) RC = CC 13/15

slide-68
SLIDE 68

Adequacy Theorem

“Complexity Version”

Lemma

1 if S is ◮p-minimal then S ↾p is maximally sharing 2 if S is ⊳p-minimal then the node at position p is unshared

Theorem

S ⊳!

p · ◮! p · −

→G,p T ⇐ ⇒ term(S) − →R,p term(T)

MA & GM (ICS @ UIBK) RC = CC 13/15

slide-69
SLIDE 69

Adequacy Theorem

“Complexity Version”

Lemma

1 if S is ◮p-minimal then S ↾p is maximally sharing 2 if S is ⊳p-minimal then the node at position p is unshared

Theorem

S ⊳!

p · ◮! p · −

→G,p T ⇐ ⇒ term(S) − →R,p term(T)

◮ set

⊳ ◮

− →G,p : = ⊳!

p · ◮! p · −

→G,p

MA & GM (ICS @ UIBK) RC = CC 13/15

slide-70
SLIDE 70

Adequacy Theorem

“Complexity Version”

Lemma

1 if S is ◮p-minimal then S ↾p is maximally sharing 2 if S is ⊳p-minimal then the node at position p is unshared

Theorem

S

⊳ ◮

− →G,p T ⇐ ⇒ term(S) − →R,p term(T)

◮ set

⊳ ◮

− →G,p : = ⊳!

p · ◮! p · −

→G,p

MA & GM (ICS @ UIBK) RC = CC 13/15

slide-71
SLIDE 71

Adequacy Theorem

“Complexity Version”

Lemma

1 if S is ◮p-minimal then S ↾p is maximally sharing 2 if S is ⊳p-minimal then the node at position p is unshared

Theorem

S

⊳ ◮

− →G,p T ⇐ ⇒ term(S) − →R,p term(T)

◮ set

⊳ ◮

− →G,p : = ⊳!

p · ◮! p · −

→G,p

Lemma

If S

⊳ ◮

− →ℓ

G T then |T| (ℓ + 1) · |S| + ℓ2 · ∆ for fixed ∆ ∈ N ◮ polynomial size growth in |S| and length ℓ

MA & GM (ICS @ UIBK) RC = CC 13/15

slide-72
SLIDE 72

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-73
SLIDE 73

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Proof Idea.

s = s0 − →R s1 − →R · · · − →R sl

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-74
SLIDE 74

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Proof Idea.

S = S0

⊳ ◮

− →G S1

⊳ ◮

− →G · · ·

⊳ ◮

− →G Sl

1 rewrite graphs instead of terms

adequacy theorem

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-75
SLIDE 75

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Proof Idea.

S = S0

⊳ ◮

− →G S1

⊳ ◮

− →G · · ·

⊳ ◮

− →G Sl

1 rewrite graphs instead of terms

adequacy theorem

2 size growth bound polynomially in ℓ and |S|

restrictive unfolding

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-76
SLIDE 76

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|) = Ω(|S|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Proof Idea.

S = S0

⊳ ◮

− →G S1

⊳ ◮

− →G · · ·

⊳ ◮

− →G Sl

1 rewrite graphs instead of terms

adequacy theorem

2 size growth bound polynomially in ℓ and |S|

restrictive unfolding

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-77
SLIDE 77

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|) = Ω(|S|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Proof Idea.

S = S0

⊳ ◮

− →G S1

⊳ ◮

− →G · · ·

⊳ ◮

− →G Sl

1 rewrite graphs instead of terms

adequacy theorem

2 size growth bound polynomially in ℓ

restrictive unfolding

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-78
SLIDE 78

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|) = Ω(|S|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Proof Idea.

S = S0

⊳ ◮

− →G S1

⊳ ◮

− →G · · ·

⊳ ◮

− →G Sl

1 rewrite graphs instead of terms

adequacy theorem

2 size growth bound polynomially in ℓ

restrictive unfolding

3 each step Si

⊳ ◮

− →G Si+1 polytime computable in |Si| tedious

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-79
SLIDE 79

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|) = Ω(|S|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Proof Idea.

S = S0

⊳ ◮

− →G S1

⊳ ◮

− →G · · ·

⊳ ◮

− →G Sl

1 rewrite graphs instead of terms

adequacy theorem

2 size growth bound polynomially in ℓ

restrictive unfolding

3 each step Si

⊳ ◮

− →G Si+1 polytime computable in |Si| hence ℓ tedious

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-80
SLIDE 80

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|) = Ω(|S|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Proof Idea.

S = S0

⊳ ◮

− →G S1

⊳ ◮

− →G · · ·

⊳ ◮

− →G Sl

1 rewrite graphs instead of terms

adequacy theorem

2 size growth bound polynomially in ℓ

restrictive unfolding

3 each step Si

⊳ ◮

− →G Si+1 polytime computable in |Si| hence ℓ tedious

4 at most ℓ steps have to be performed

assumption

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-81
SLIDE 81

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|) = Ω(|S|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-82
SLIDE 82

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|) = Ω(|S|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Corollary

Let R be a terminating TRS with rcR(n) ∈ O(nk) k 1

1 if R computes the function f then f ∈ FP

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-83
SLIDE 83

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|) = Ω(|S|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Corollary

Let R be a terminating TRS with rcR(n) ∈ O(nk) k 1

1 if R computes the function f then f ∈ FP 2 if R computes the relation R then the function problem associated

with R is in FNP. given v ∈ Valk, find w ∈ Val with ( v, w) ∈ R

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-84
SLIDE 84

Main Result Revisited

Theorem

For any term s with dlR(s) ℓ ℓ = Ω(|s|) = Ω(|S|)

1 some normal-form is computable in deterministic time O(log(ℓ)3ℓ7) 2 any normal-form is computable in nondeterministic time O(log(ℓ)2ℓ5)

Corollary

Let R be a terminating TRS with rcR(n) ∈ O(nk) k 1

1 if R computes the function f then f ∈ FP 2 if R computes the relation R then the function problem associated

with R is in FNP. given v ∈ Valk, find w ∈ Val with ( v, w) ∈ R FNP “is class of function problems associated with L ∈ NP” FSAT = given formula φ, find satisfying assignment α

MA & GM (ICS @ UIBK) RC = CC 14/15

slide-85
SLIDE 85

Conclusion and Related Work

notion of runtime-complexity is a reasonable cost model for rewriting

1 cost of computation naturally expressed 2 polynomially related to actual cost on Turing machines

MA & GM (ICS @ UIBK) RC = CC 15/15

slide-86
SLIDE 86

Conclusion and Related Work

notion of runtime-complexity is a reasonable cost model for rewriting

1 cost of computation naturally expressed 2 polynomially related to actual cost on Turing machines

  • U. Dal Lago and S. Martini

On Constructor Rewrite Systems and the Lambda-Calculus. In ICALP, pages 163–174, 2009.

Results

polynomially bounded innermost runtime complexity induces polytime computability on orthogonal constructor TRSs

MA & GM (ICS @ UIBK) RC = CC 15/15

slide-87
SLIDE 87

Conclusion and Related Work

notion of runtime-complexity is a reasonable cost model for rewriting

1 cost of computation naturally expressed 2 polynomially related to actual cost on Turing machines

  • U. Dal Lago and S. Martini

On Constructor Rewrite Systems and the Lambda-Calculus. In ICALP, pages 163–174, 2009.

  • U. Dal Lago and S. Martini

Derivational Complexity is an Invariant Cost Model. In FOPARA, 2009.

Results

polynomially bounded innermost (outermost) runtime complexity induces polytime computability on orthogonal TRSs

MA & GM (ICS @ UIBK) RC = CC 15/15

slide-88
SLIDE 88

Conclusion and Related Work

notion of runtime-complexity is a reasonable cost model for rewriting

1 cost of computation naturally expressed 2 polynomially related to actual cost on Turing machines

following tools verify polynomial (i)RC fully automatically

◮ T

C T http://cl-informatik.uibk.ac.at/research/software/tct

MA & GM (ICS @ UIBK) RC = CC 15/15

slide-89
SLIDE 89

Conclusion and Related Work

notion of runtime-complexity is a reasonable cost model for rewriting

1 cost of computation naturally expressed 2 polynomially related to actual cost on Turing machines

following tools verify polynomial (i)RC + CC fully automatically

◮ T

C T http://cl-informatik.uibk.ac.at/research/software/tct

MA & GM (ICS @ UIBK) RC = CC 15/15

slide-90
SLIDE 90

Conclusion and Related Work

notion of runtime-complexity is a reasonable cost model for rewriting

1 cost of computation naturally expressed 2 polynomially related to actual cost on Turing machines

following tools verify polynomial (i)RC + CC fully automatically

◮ AProVE

innermost runtime complexity http://aprove.informatik.rwth-aachen.de/

◮ C

a T http://cl-informatik.uibk.ac.at/research/software/ttt2

◮ T

C T http://cl-informatik.uibk.ac.at/research/software/tct

◮ Matchbox/Poly

derivational complexity http://dfa.imn.htwk-leipzig.de/matchbox/poly

MA & GM (ICS @ UIBK) RC = CC 15/15