complexity analysis of precedence terminating infinite
play

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


  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

  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

  3. Why runtime complexity? Why graph rewriting? Derivation height, Runtime complexity dh( t , → ) = max { m ∈ N | ∃ t 1 , . . . , t m s.t. t → t 1 → · · · → t m } rc R ( n ) = max { dh( t , → R ) | | t | ≤ n & t = f ( s 1 , , s k ) } . . . � �� � constructor terms Such a term f ( s 1 , . . . , s k ) 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

  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 )] = (2 O ( m ) many copies of [ y ]) [ f ( s m (0) , y )] = Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 4/16

  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 c 0 ( ǫ ) = ǫ , c n +1 ( ǫ ) = c ( c n ( ǫ ) , c n ( ǫ )). • f ( s m (0) , c n ( ǫ )) leads to a normal form of exponential size in a polynomial step, but • Avanzini-Moser’s maxim still applies if rc R is polynomial. However none of existing methods can show rc R is poly. Why? • g is duplicated in g ( c ( x , y ) , z ) → c ( g ( x , z ) , g ( y , z )). Hence normalisation of f ( s m (0) , c n ( ǫ )) needs an exponential step if measured by the depth of f ( s m (0) , c n ( ǫ )). • Most methods practically use depth not size. Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 5/16

  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 ( x 1 , . . . , x k ) ,� y ) → h c ( x 1 , . . . , x k ,� y , f ( x 1 ,� y ) , . . . , f ( x k ,� 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

  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

  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 )) of 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

  9. ♦ ✎ ⑥s ⑧ Unfolding graph rewriting 2/2 Note: An infinite set G of unfolding graph h rewrite rules for a fixed signature is uniformly defined, • independent of each instance and ✬ ✗ ✟ ✇ c h of the underlying TRS. • Hence ∃ polytime algorithm ⌈ G ⌉ �→ ⌈ H ⌉ i ✗ ✞ ✖ ✟ such that G − → G H . ǫ z g 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 i ∃ p: poly. s.t. G − → k G H = ⇒ max { k , | H |} ≤ p ( | G | ) . Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 9/16

  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

  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 g ( ǫ ; z ) → z g ( c ( x , y ); z ) → c (; g ( x ; z ) , g ( y ; z )) R : f (0 , y ; ) → f ( s ( x ) , y ; ) → g ( y ; f ( x , y ; )) ǫ f ( x 1 , . . . , x k ; x k +1 , . . . , x k + 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

  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 root L ) → k Then ∃ p: poly. s.t. G − 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 root G ) Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 12/16

  13. Precedence termination with argument separation 3/4 Corollary ∀ f : tiered recursive function ∃G : infinite GRS defining f → k ∃ p: poly. s.t. G − 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 root G ) Compare: Theorem (Dal Lago-Martini-Zorzi ’10) ∀ f : tiered recursive function ∃G : infinite GRS defining f i ∃ p: poly. s.t. G − → 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

  14. ✎ ♦ ✁ ♦ ⑦s ✎ Precedence termination with argument separation 4/4 Example f ( x ; y ) c f h ✫ ✖ ✖ ✟ ✠ ② h ( x , y ; z , u , v ) c − → c h ✖ ✟ ✖ ✟ ✖ ✟ 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 root L ) Naohi Eguchi (Chiba U. / UIBK) Precedence Terminating Infinite GRSs 14/16

Recommend


More recommend