Complexity Analysis of Precedence Terminating Infinite Graph Rewrite - - PowerPoint PPT Presentation

complexity analysis of precedence terminating infinite
SMART_READER_LITE
LIVE PREVIEW

Complexity Analysis of Precedence Terminating Infinite Graph Rewrite - - PowerPoint PPT Presentation

Complexity Analysis of Precedence Terminating Infinite Graph Rewrite Systems Naohi Eguchi Chiba University, Japan University of Innsbruck, Austria September 27, 2014 41st TRS meeting, Jozankei, Sapporo, Japan Introduction Complexity


slide-1
SLIDE 1

Complexity Analysis of Precedence Terminating Infinite Graph Rewrite Systems

Naohi Eguchi

Chiba University, Japan University of Innsbruck, Austria

September 27, 2014 41st TRS meeting, Jozankei, Sapporo, Japan

slide-2
SLIDE 2

Introduction

  • Complexity analysis: Runtime complexity & Normal-form size

measured by the depths of starting terms

  • Precedence terminating TRSs can only express non-recursion

schemata.

  • Infinite precedence terminating TRSs cover all the primitive

recursive functions.

  • can be used as a memoisation technique if graph rewrite

systems (GRSs) are used instead.

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 2/16

slide-3
SLIDE 3

Why runtime complexity? Why graph rewriting?

Derivation height, Runtime complexity

dh(t, →) = max{m ∈ N | ∃t1, . . . , tm s.t. t → t1 → · · · → tm} rcR(n) = max{dh(t, →R) | |t| ≤ n & t = f ( s1, . . . , sk

  • constructor terms

)} Such a term f (s1, . . . , sk) is called basic.

Maxim (Avanzini-Moser RTA ’10, FLOPS ’10)

Polynomial runtime complexity ⇐ ⇒ polytime computability follows from: term rewriting ⇐ ⇒ graph rewriting in the simulating GRSs modulo un-sharing + sharing

  • The size of a normal form can be exponential since the size of

its graph representation is polynomial in the simulating GRS.

  • Hence graph rewriting is a more natural framework.

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 3/16

slide-4
SLIDE 4

Why infinite graph rewriting? 1/3

g : Btree × Btree → Btree, f : Nat × Btree → Btree

Example

R : g(ǫ, z) → z g(c(x, y), z) → c(g(x, z), g(y, z)) f (0, y) → ǫ f (s(x), y) → g(y, f (x, y)) Assume a standard interpretation into binary trees. Let [x] = and [y] = [g(x, y)] = [f (sm(0), y)] = (2O(m) many copies of [y])

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 4/16

slide-5
SLIDE 5

Why infinite graph rewriting? 2/3

Example

R : g(ǫ, z) → z g(c(x, y), z) → c(g(x, z), g(y, z)) f (0, y) → ǫ f (s(x), y) → g(y, f (x, y)) Let c0(ǫ) = ǫ, cn+1(ǫ) = c(cn(ǫ), cn(ǫ)).

  • f (sm(0), cn(ǫ)) leads to a normal form of exponential size in a

polynomial step, but

  • Avanzini-Moser’s maxim still applies if rcR is polynomial.

However none of existing methods can show rcR is poly. Why?

  • g is duplicated in g(c(x, y), z) → c(g(x, z), g(y, z)).

Hence normalisation of f (sm(0), cn(ǫ)) needs an exponential step if measured by the depth of f (sm(0), cn(ǫ)).

  • Most methods practically use depth not size.

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 5/16

slide-6
SLIDE 6

Why infinite graph rewriting? 3/3

Example

R : g(ǫ, z) → z g(c(x, y), z) → c(g(x, z), g(y, z)) f (0, y) → ǫ f (s(x), y) → g(y, f (x, y))

  • Difference between depth and size does not make a big

change over unary constructors.

  • But essential over arbitrary constructors:

(General primitive recursion) f (c(x1, . . . , xk), y) → hc(x1, . . . , xk, y, f (x1, y), . . . , f (xk, y)) The problem cannot be solved by simple sharing.

  • A solution: Infinitely instantiation with fully shared graph

representation = ⇒ Unfolding graph rewrite rules (Dal Lago, Martini and Zorzi ’10)

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 6/16

slide-7
SLIDE 7

Outline

  • Unfolding graph rewrite rules: Representation of the general

primitive recursion with infinite graph rewrite rules (Dal Lago, Martini and Zorzi).

  • Every unfolding graph rewrite rule is precedence terminating

in the sense of Middeldorp, Ohsaki and Zantema.

  • This work: Precedence termination with argument separation

= ⇒ Polynomial complexity analysis of a subclass of precedence terminating infinite GRSs

  • which is complete for an extension of usual polytime

computable functions to those over arbitrary constructors.

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 7/16

slide-8
SLIDE 8

Unfolding graph rewriting 1/2

Representing the general primitive recursion with infinite graph rewrite rules. General Ramified Recurrence is Sound for Polynomial Time Dal Lago, Martini and Zorzi. Proc. DICE ’10. Idea of unfolding rewrite rules:

  • Express equations

f (ǫ, z) → g(z), f (c(x, y), z) → h(x, y, z, f (x, z), f (y, z))

  • f general primitive recursion with infinite instances:

f (ǫ, z) → g(z), f (c(ǫ, ǫ), z) → h(ǫ, ǫ, z, g(z), g(z)), f (c(c(ǫ, ǫ), c(ǫ, ǫ)), z) → h(c(ǫ, ǫ), c(ǫ, ǫ), z, h(ǫ, ǫ, z, g(z), g(z)), h(ǫ, ǫ, z, g(z), g(z))),...

  • But then graph representation is more convenient.

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 8/16

slide-9
SLIDE 9

Unfolding graph rewriting 2/2

h

✟ ✇ ✎ ✬ ✗

c

✗ ✞

h

⑥s ⑧ ✖ ✟

ǫ z g

Note: An infinite set G of unfolding graph rewrite rules for a fixed signature is uniformly defined,

  • independent of each instance and
  • f the underlying TRS.
  • Hence ∃ polytime algorithm ⌈G⌉ → ⌈H⌉

such that G

i

− →G H.

Tiered recursive functions (Dal Lago-Martini-Zorzi)

Tiered recursive function are an extension of usual polytime functions to those functions over arbitrary constructors.

Theorem (Dal Lago-Martini-Zorzi ’10)

∀f : tiered recursive function ∃G: infinite GRS defining f ∃p: poly. s.t. G

i

− →k

G H =

⇒ max{k, |H|} ≤ p(|G|).

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 9/16

slide-10
SLIDE 10

Precedence termination

Observe: Unfolding graph rewrite rule is precedence terminating.

Definition (Middeldorp-Ohsaki-Zantema)

Let >: precedence, well-founded partial order on a signature. A rewrite rule f ( t) → r is precedence terminating if f > g for any g ∈ {h : function symbol | h appears in r}. f (c(ǫ, ǫ), z) → h(ǫ, ǫ, z, g(z), g(z)): precedence terminating if f > h, f > g and f > ǫ.

  • Runtime complexity of precedence terminating finite TRSs is

at most exponential.

  • Precedence terminating infinite TRSs cover all the primitive

recursive functions.

  • This work: Restrictive precedence termination which induces

polynomial complexity of infinite GRSs.

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 10/16

slide-11
SLIDE 11

Precedence termination with argument separation 1/4

Separation of argument positions of functions. (Tiered recursion) A New Recursion-theoretic Characterization of the Polytime Functions Bellantoni and Cook. 1992.

Example

R : g(ǫ; z) → z g(c(x, y); z) → c(; g(x; z), g(y; z)) f (0, y; ) → ǫ f (s(x), y; ) → g(y; f (x, y; )) f (x1, . . . , xk; xk+1, . . . , xk+l): called normal arguments of f .

  • Observation. Starting with a basic term:
  • Terms in normal argument positions are always normalised.
  • Rewriting occurs only in non-normal positions.
  • Note: the argument separation is not always possible.

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 11/16

slide-12
SLIDE 12

Precedence termination with argument separation 2/4

Definition

Let >: precedence. A prec. term. graph rewrite rule L → R is precedence terminating with argument separation if: The structure in normal positions unchanged, i.e. ∀G: normal sub-term graph of R ∃H: normal sub-term graph of L s.t. G ∼ = H.

Theorem

Suppose ∀L → R ∈ G GRS prec. terminating with argument sep.:

  • 1. L: maximally shared (modulo argument separation).
  • 2. |R| ≤ |L| + m. (m: size of subgraphs of L connected to

normal positions of rootL) Then ∃p: poly. s.t. G − →k

G H & G: closed basic term graph

⇒ k ≤ p(n) & |H| ≤ p(n) + |G|. (n: size of subgraphs of G connected to normal positions of rootG)

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 12/16

slide-13
SLIDE 13

Precedence termination with argument separation 3/4

Corollary

∀f : tiered recursive function ∃G: infinite GRS defining f ∃p: poly. s.t. G − →k

G H & G: closed basic term graph

⇒ k ≤ p(n) & |H| ≤ p(n) + |G|. (n: size of subgraphs of G connected to normal positions of rootG) Compare:

Theorem (Dal Lago-Martini-Zorzi ’10)

∀f : tiered recursive function ∃G: infinite GRS defining f ∃p: poly. s.t. G

i

− →k

G H =

⇒ max{k, |H|} ≤ p(|G|).

  • p(n) depends only on the size n of the normal subgraphs of

the starting term graph G.

  • Innermost rewriting is not necessary as long as G is a closed

basic term graph.

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 13/16

slide-14
SLIDE 14

Precedence termination with argument separation 4/4

Example

f (x; y) c

✖ ✟

f

♦ ✎

h

✠ ② ✎ ✫ ✖

h(x, y; z, u, v) c

✖ ✟

− → c

✖ ✟

h

⑦s ✁ ✖ ✟

g(; x) ǫ z ǫ z g

  • L → R: precedence terminating with argument separation if

f > h, f > g, f > c and f > ǫ.

  • |L| = 5, |R| = 6, m = 3. Hence |R| ≤ 8 = |L| + m.

∀L → R ∈ G, |R| ≤ |L| + m (m: size of subgraphs of L connected to normal positions of rootL)

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 14/16

slide-15
SLIDE 15

Conclusion

  • Seems not possible to relate the general form of primitive

recursion to polynomial runtime complexity. f (c(x1, . . . , xk), y) → hc(x1, . . . , xk, y, f (x1, y), . . . , f (xk, y))

  • General primitive recursion can be related to polynomial

runtime complexity with an infinite set of unfolding graph rewrite rules.

  • This work: Complexity analysis of precedence terminating

infinite GRSs based on unfolding graph rewrite rules.

  • Seems more appropriate to measure runtime complexity by the

depth (not by the size) of a starting term for TRSs over non-simple constructors, e.g. TRSs over tree structures.

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 15/16

slide-16
SLIDE 16

References

Proving Termination of Unfolding Graph Rewriting for General Safe Recursion

  • N. Eguchi. Preprint, arXiv:1404.6196.

Complexity Analysis of Precedence Terminating Infinite Graph Rewrite Systems

  • N. Eguchi. In preparation.

Thank you for your listening!

Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 16/16