1 Expressive Power of Safe HORS Examined Through Decomposition of Higher Order Programs to Garbage Free 1 st Order Form Kazuhiro Inaba Joint work with.

Slides:



Advertisements
Similar presentations
Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
Advertisements

Simplifications of Context-Free Grammars
Mathematical Preliminaries
Variations of the Turing Machine
PDAs Accept Context-Free Languages
ALAK ROY. Assistant Professor Dept. of CSE NIT Agartala
Adders Used to perform addition, subtraction, multiplication, and division (sometimes) Half-adder adds rightmost (least significant) bit Full-adder.
1
Feichter_DPG-SYKL03_Bild-01. Feichter_DPG-SYKL03_Bild-02.
1 Vorlesung Informatik 2 Algorithmen und Datenstrukturen (Parallel Algorithms) Robin Pomplun.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
UNITED NATIONS Shipment Details Report – January 2006.
By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Around the World AdditionSubtraction MultiplicationDivision AdditionSubtraction MultiplicationDivision.
Programming Language Concepts
1 Outline relationship among topics secrets LP with upper bounds by Simplex method basic feasible solution (BFS) by Simplex method for bounded variables.
CSCI 3130: Formal Languages and Automata Theory Tutorial 5
Solve Multi-step Equations
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Break Time Remaining 10:00.
Turing Machines.
Table 12.1: Cash Flows to a Cash and Carry Trading Strategy.
PP Test Review Sections 6-1 to 6-6
Bright Futures Guidelines Priorities and Screening Tables
Bellwork Do the following problem on a ½ sheet of paper and turn in.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
How to convert a left linear grammar to a right linear grammar
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
© 2012 National Heart Foundation of Australia. Slide 2.
Adding Up In Chunks.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Synthetic.
25 seconds left…...
Subtraction: Adding UP
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
Datorteknik TopologicalSort bild 1 To verify the structure Easy to hook together combinationals and flip-flops Harder to make it do what you want.
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
Analyzing Genes and Genomes
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Essential Cell Biology
CSE Lecture 17 – Balanced trees
Clock will move after 1 minute
Intracellular Compartments and Transport
PSSA Preparation.
Chapter Eleven: Non-Regular Languages
Essential Cell Biology
Datorteknik TopologicalSort bild 1 To verify the structure Easy to hook together combinationals and flip-flops Harder to make it do what you want.
Immunobiology: The Immune System in Health & Disease Sixth Edition
Energy Generation in Mitochondria and Chlorplasts
Murach’s OS/390 and z/OS JCLChapter 16, Slide 1 © 2002, Mike Murach & Associates, Inc.
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
1 Non Deterministic Automata. 2 Alphabet = Nondeterministic Finite Accepter (NFA)
The Pumping Lemma for CFL’s
1 Decompositions of Higher-Order Grammars to First-Order Transducers Kazuhiro Inaba.
Higher-Order Tree Transducers and Their Expressive Power Kazuhiro Inaba at Dagstuhl Seminar, May 2013.
The Complexity of Tree Transducer Output Languages FSTTCS 2008, Bengaluru The Univ. of Tokyo Kazuhiro Inaba NICTA, and UNSW Sebastian Maneth.
Presentation transcript:

1 Expressive Power of Safe HORS Examined Through Decomposition of Higher Order Programs to Garbage Free 1 st Order Form Kazuhiro Inaba Joint work with Sebastian Maneth at Shonan Meeting on Automated Techniques for Higher-Order Program Verification 2011

2 HORS (Higher Order Recursion Scheme) is very powerful and expressive. n-EXPTIME hard problems! Background

3 MSO on words/trees: – Emptiness checking is non elementary (HYPEREXP) for the size of the formula. – The class of languages it represents is regular. O(n) time, O(1) space membership wrt the word length MSO on words is a verrrrrrrrry concise representation for relatively simple languages. Computational Complexity w.r.t. Grammar Size and Data Size

4 HORS: – Emptiness, Model Checking, Containment by Regular Languages,... are n-EXPTIME hard. – What is known about the languages it describes? The class of languages it represents is ????. ???? time, ???? space membership wrt the word length. How about HORS?

5 Todays talk verifies the statement (even for wider class of languages). [Greibach 70] [Gr70] S. A. Greibach, Full AFLs and Nested Iterated Substitution, Inf. Ctrl. 16

6 Our Approach Intermediate Data Size HORS Output If they are at most of size M at any point, O(M) space & O(2 M ) time.

7 Outline of This Talk Target Language – Higher-order Tree Transducers 1 st -order Decomposition – Sketch of the construction Garbage Free Form – Derived consequences – Sketch of the construction λ t s1s1 s2s2 S n-1 s0s0 τ1τ1 τ2τ2 τnτn τ' 1 τ' 2 τ' n τ ' del

8 HTT [Engelfriet&Vogler 88] Higher-order single-input safe tree transducer Mult :: Tree Tree Mult(Pair(x 1,x 2 )) Iter(x 1 )(Add(x 2 ))(Z) Iter :: Tree (Tree Tree) Tree Tree Iter(S(x))(f)(y) Iter(x)(f)(f(y)) Iter(Z)(f)(y) y Add :: Tree Tree Tree Add(S(x))(y) Add(x)(S(y)) Add(Z)(y) y

9 Iter :: Tree (Tree Tree) Tree Tree Iter(S(x))(f)(y) Iter(x)(f)(f(y)) Iter(Z)(f)(y) y HTT Set of mutually recursive functions – Defined in terms of induction on a single input tree Input trees are always consumed, not newly constructed Output trees are always created, but not destructed – Rest of the parameters are ordered by the order Multiple parameters of the same order is ok but in uncurried form Inductive Input ParamOrder-1 Param(s)Order-0 Param(s)Result

10 HTT Nondeterminism ( and ) Subseq :: Tree Tree Subseq(Cons(x,xs)) Cons(x, Subseq(xs)) Subseq(xs) Subseq(Nil) Nil Subseq(Other) In this talk, evaluation strategy is unrestricted (= call-by-name). But call-by-value can also be dealt with.

11 HTT Notation: n-HTT – is the class of Tree Tree functions representable by HTTs of order n. – { Subseq } is 0-HTT, { Mult, Iter, Add } 2-HTT Subseq :: Tree Tree Mult :: Tree Tree Iter :: Tree (Tree Tree) Tree Tree Add :: Tree Tree Tree

12 Order-n to Order-1 T HEOREM [EV88] [EV86] (n-HTT) (1-HTT) n n-th order tree transducer is representable by a n-fold composition of 1 st -order tree transducers. (= or ? is left open, as far as I know.) [EV86] J. Engelfriet & H. Vogler, Pushdown Machines for Macro Tree Transducers, TCS 42 [EV88], High Level Tree Transducers and Iterated Pushdown Tree Transducers, Acta Inf. 26

13 Proof: n-HTT = 1-HTT (n-1)-HTT Idea: Represent 1 st -order term Tree Tree by a Tree. Represent 1 st -order application symbolically, too. F :: Tree Tree Tree F(Z)(y) S(S(y)) F :: Tree Tree F(Z) S(S(Y)) Z) … F(x)(Z)

14 Proof: n-HTT = 1-HTT (n-1)-HTT Represent 1 st -order things symbolically. Then a 1-HTT performs the actual application. b))(y) Eval(f, Eval(b)(y)) Eval(Y)(y) y Eval(S(x))(y) S(Eval(x)(y)) Eval(Z)(y) Z F :: Tree Tree F(Z) S(S(Y)) Z)

Z Z Add(S(Z)) Y Y Y Y Y Y S S Y Y Example Mult(Pair(x 1,x 2 1 )(Add(x 2 )), Y)) Iter(Z)(f) Y Add(Z) Y

16 Eval(, Y Y Y Y S S Y Y Y Y Y Y S S Y Y Eval(,y=Eval(,y= ) Y Y Y Y S S Y Y Z Z S S b))(y) Eval(f, Eval(b)(y)) Eval(Y)(y) y Eval(S(x))(y) S(Eval(x)(y)) Eval(Z)(y) Z Eval(,y= ) Y Y S S Y Y

17 Why That Easy Relies on the ordered-by-order condition. – No variable renaming is required! [Blum&Ong 09] [BO09] W. Blum and C.-H. L. Ong, The Safe Lambda Calculus, LMCS 5 Eval(,y=Eval(,y= ) Y Y Y Y S S Y Y

18 Now, Decomposed. n-HTT λ λ λ n-HTT λ λ λ 1-HTT n τ1τ1 τ2τ2 τnτn

19 Next, Make Intermediate Trees Small. 1-HTT n t s s1s1 s2s2 S n-1 s0s0 τ1τ1 τ2τ2 τnτn τ' 1 τ' 2 τ' n τ ' del t s

20 T HEOREM [I. & Maneth 08] [I. 09] (+ improvement) τ 1,..., τ n 1-HTT, τ del 0-LHTT, τ 1,..., τ n 1-HTT, for any (τ n... τ 1 )(s) t, there exist τ del (s) s 0, τ i (s i ) s i+1, |s i | |s i+1 |, s n =t. [IM08] K. Inaba & S. Maneth, The complexity of tree transducer output languages, FSTTCS [Inaba09] K. Inaba, Complexity and Expressiveness of Models of XML Transformations, Dissertation t s s1s1 s2s2 S n-1 s0s0 τ1τ1 τ2τ2 τnτn τ' 1 τ' 2 τ' n τ ' del t s |s| = number of nodes

21 Consequences : Range Membership That is, given (τ n... τ 1 ) and t, we can determine s. (τ n... τ 1 )(s) t in O( f(|τ 1 |+...+|τ n |) |t| ) space and in O( g(|τ 1 |+...+|τ n |) poly(|t|) ) nondeterministic time. Membership problem for the class Range(1-HTT n ) of languages is in DLINSPACE in NP

22 Consequences : Range Membership P ROOF Guess (in NP) or exhaustively try (in DLINSPACE) all the intermediate trees: s 0... s n-1. Then check Range(τ del ) s 0 and τ i (s i ) s i+1, both turn out to be feasible in DLINSPACE NP. Membership problem for the class Range(1-HTT n ) of languages is in DLINSPACE in NP t s s1s1 s2s2 S n-1 s0s0 τ' 1 τ' 2 τ' n τ ' del

23 Consequences : Range Membership C OROLLARY Higher-order safe recursion scheme, also known as OI-hierarchy, HO-PDA language, Maslov hierarchy, generalized indexed language, etc., is Context-Sensitive. Membership problem for the class Range(1-HTT n ) of languages is in DLINSPACE in NP CFL (order-1) RE Indexed (order-2) order-n CSL (NLINSPACE) Regular (order-0)

24 Consequences : Linear-Size Inverse C OROLLARY (by our constructive proof) Right inverse of 1-HTT n is computable in DLINSPACENP. For all τ n... τ 1 1-HTT n, t Range(τ n... τ 1 ) there exists s such that f(s) t and |s| < h(|τ n... τ 1 |) |t|

25 How to Construct the Garbage-Free Form Make each 1-HTT productive τnτn τ n-1 t τnτn t

26 How to Construct the Garbage-Free Form Make each 1-HTT productive by separating its deleting part τnτn τ n-1 t τ del τnτn τ n-1 t τnτn τnτn τ del =

27 How to Construct the Garbage-Free Form Make each 1-HTT productive by separating its deleting part, and fuse the deleter to the left [En75,77][EnVo85][EnMa02] τnτn τ n-1+del t τnτn τ n-1 t

28 Repeat τ4τ4 τ3τ3 τ2τ2 τ1τ1 τ3τ3 τ2τ2 τ1τ1 τ4τ4 τ 4d τ 34d τ2τ2 τ1τ1 τ4τ4 τ3τ3 τ2τ2 τ1τ1 τ4τ4 τ3τ3 τ 234d τ1τ1 τ4τ4 τ3τ3 τ2τ2 τ1τ1 τ4τ4 τ3τ3 τ2τ2 τ4τ4 τ 1234d τ3τ3 τ2τ2 τ4τ4 τ1τ1 Split Fuse Split Fuse Split Fuse Split

29 Separate the deleting transformation Key Part τnτn = τ del τnτn ; =

30 Slogan: Work on every node (τ n must generate at least one node for each input node) Key Part τnτn τ del ;

31 Deleting HTTs Work on Every Node Visit All Nodes G(Z)(y 1 ) Z y 1 F(S(x 1,x 2 )) F(x 1 ) F(x 2 ) G(x 1 )(F(x 2 )) τnτn may not recurse down to a subtree.

32 Nondeterministically delete every subtree! Work on Every Node Visit All Nodes F(S(x 1,x 2 )) G(x 1 )(F(x 2 )) τnτn F(S12(x 1,x 2 )) G(x 1 )(F(x 2 )) F(S1_(x 1 )) G(x 1 )( ) F(S_2(x 2 )) F(S__()) τnτn Del(S(x 1,x 2 )) S12(Del(x 1 ),Del(x 2 )) S1_(Del(x 1 )) S_2(Del(x 2 )) S__() τ del At least one choice of nodeterminism deletes correctly.

33 Work on Every Node Work on Leaf Erasing HTTs F(S(x)) G(x)(Z) G(Z)(y) y may be idle at leaves. τnτn

34 Work on Every Node Work on Leaf F(S(Z)) Z τnτn Inline Expansion Erasing HTTs F(S(x)) G(x)(Z) G(Z)(y) y τnτn

35 Work on Every Node Work on Monadic Nodes F(S(x))(y 1,y 2,y 3 ) F(x)(y 2,y 3,y 1 ) F(Z)(y 1,y 2,y 3 ) Done(y 1,y 2,y 3 ) Skipping HTTs are good at juggling. τnτn

36 Work on Every Node Work on Monadic Nodes Nondeterministic deletion again. Remember how argugments wouldve been shuffled. F(Z123)(y 1,y 2,y 3 ) Done(y 1,y 2,y 3 ) F(Z231)(y 1,y 2,y 3 ) Done(y 2,y 3,y 1 ) F(Z312)(y 1,y 2,y 3 ) Done(y 3,y 1,y 2 ) F(S(x))(y 1,y 2,y 3 ) F(x)(y 2,y 3,y 1 ) F(Z)(y 1,y 2,y 3 ) Done(y 1,y 2,y 3 ) Skipping HTTs τnτn τnτn

37 Input size = #leaf + #monadic + #others – For each leaf on the input, generate 1 node. – For each monadic node, generate 1 node. – Thus, #leaf + #monadic Output size. For any tree, #others < #leaf Output size. Add: #leaf + #monadic + #others Output size*2 So, Input size < Output Size * 2 Simple Arithmetic

38 Input size < Output Size * 2 This bound is sufficient for deriving the results, but we can improve this to Input size Output Size, by deterministic deletion of leaves + inline expansion. Work on Nodes with Rank-2,3,... Fr(Bin(x 1,x 2 ))(y) Fr(x 1 )(Fr(x 2 )(y)) Fr(A)(y) A(y) Fr(B)(y) B(y)

39 Done! τnτn τ del ;

40 Summary Order-n HTT (Order-1 HTT) n Garbage Free Form – L( Safe-HORS ) is context-sensitive. Future Direction – Extend it to Unsafe HTT – Or, use it for proving safe unsafe λ t s1s1 s2s2 S n-1 s0s0 τ1τ1 τ2τ2 τnτn τ' 1 τ' 2 τ' n τ ' del