Data Structure Implementation and Correctness Mahmoud Parsian Iowa State University
Total Page:16
File Type:pdf, Size:1020Kb
Iowa State University Capstones, Theses and Retrospective Theses and Dissertations Dissertations 1982 Data structure implementation and correctness Mahmoud Parsian Iowa State University Follow this and additional works at: https://lib.dr.iastate.edu/rtd Part of the Computer Sciences Commons Recommended Citation Parsian, Mahmoud, "Data structure implementation and correctness " (1982). Retrospective Theses and Dissertations. 8952. https://lib.dr.iastate.edu/rtd/8952 This Dissertation is brought to you for free and open access by the Iowa State University Capstones, Theses and Dissertations at Iowa State University Digital Repository. It has been accepted for inclusion in Retrospective Theses and Dissertations by an authorized administrator of Iowa State University Digital Repository. For more information, please contact [email protected]. INFORMATION TO USERS This reproduction was made from a copy of a document sent to us for microfilming. While the most advanced technology has been used to photograph and reproduce this document, the quality of the reproduction is heavily dependent upon the quality of the material submitted. The following explanation of techniques is provided to help clarify markings or notations which may appear on this reproduction. 1.The sign or "target" for pages apparently lacking from the document photographed is "Missing Page(s)". If it was possible to obtain the missing page(s) or section, they are spliced into the film along with adjacent pages. This may have necessitated cutting throu^i an image and duplicating adjacent pages to assure complete continuity. 2. When an image on the film is obliterated with a round black mark, it is an indication of either blurred copy because of movement during exposure, duplicate copy, or copyrighted materials that should not have been filmed. For blurred pages, a good image of the page can be found in the adjacent frame. If copyrighted materials were deleted, a target note will appear listing the pages in the adjacent frame. 3. When a map, drawing or chart, etc., is part of the material being photographed, a definite method of "sectioning" the material has been followed. It is customary to begin filming at the upper left hand comer of a large sheet and to continue from left to right in equal sections with small overlaps. If necessary, sectioning is continued again—beginning below the first row and continuing on until complete. 4. For illustrations that cannot be satisfactorily reproduced by xerographic means, photographic prints can be purchased at additional cost and inserted into your xerographic copy. These prints are available upon request from the Dissertations Customer Services Department. 5. Some pages in any document may have indistinct print. In all cases the best available copy has been filmed. UniversiV Micrixilms International 300 N. Zeeb Road Ann Arbor, Ml 48106 8407116 Parsian, Mahmoud DATA STRUCTURE: IMPLEMENTATION AND CORRECTNESS Iowa State University PH.D. 1982 University Microfilms Internâtionâl 300 N. zeeb Road, Ann Arbor, Ml48106 PLEASE NOTE: In all cases this material has been filmed in the best possible way from the available copy. Problems encountered with this document have been identified here with a check mark V . 1. Glossy photographs or pages 2. Colored illustrations, paper or print 3. Photographs with dark background 4. Illustrations are poor copy 5. Pages with black marks, not original copy 6. Print shows through as there is text on both sides of page 7. Indistinct, broken or small print on several pages S. Print exceeds margin requirements 9. Tightly bound copy with print lost in spine 10. Computer printout pages with indistinct print 11. Page(s) lacking when material received, and not available from school or author. 12. Page(s) seem to be missing in numbering only as text follows. 13. Two pages numbered . Text follows. 14. Curling and wrinkled pages 15. Other University Microfilms International Data Structure Implementation and Correctness by Mahmoud Parsian A Dissertation Submitted to the Graduate Faculty in Partial Fulfillment of the Requirements for the Degree of DOCTOR OF PHILOSOPHY Major: Computer Science Approved: Signature was redacted for privacy. In Charge of Major Work Signature was redacted for privacy. For the Major Department Signature was redacted for privacy. For the Grad Iowa State University Ames, Iowa 1982 ii TABLE OF CONTENTS Page DEDICATION viii X 1. INTRODUCTION 1 1.1. Related Work and Motivation 3 1.2. Outline of the Thesis 5 2. PRELIMINARY BACKGROUND 8 2.1. Basic Concepts and Notation 8 2.2. Context Free Grammar 9 2.3. Algebraic Syntax and Semantics 11 2.4. Derived and Represented Algebras 25 3. REDUCTION ON DATA STRUCTURE TREES 38 3.1. Algebraic Equations 38 3.2. Informal Description of a Rewrite Rule 43 3.3. Previous and Related Work 44 3.4. Application of a Rewrite Rule to a Tree 45 3.5. Reduced Trees under Rewriting Systems 51 3.6. A Lattice Theoretic Approach to Equivalences in Tree Rewriting Systems 61 3.6.1. Lattice theory background 61 3.6.2. Example: introducing L(0) 63 3.6.3. Basic results about L(0) 76 3.6.4. Algorithm for construction of L(0) 79 3.6.5. Conditions for compatibility of L{0) 85 3.7. Conclusions 88 11i Page 4. NATURAL TREE TRANSDUCERS 90 4.1. Introduction to Tree Transducers 90 4.1.1. Construction of a tree transducer within L(0,) and L(0p) 90 4.1.2. Informal construction of a tree transducer 91 4.1.3. Tree transucers, tree translation 96 4.2. Formal Definition of a Tree Transducer within 1(0^) and LfGg) 97 4.2.1. Algebraic definition of a tree transducer 100 4.2.2. Example: formal construction of a tree transducer 102 4.2.3. Tree transducer within L(0, ) and L(0p) 102 4.2.4. Mono tree transducer 104 4.3. Introduction to Properties of Tree Transducers 105 4.3.1. Source tree and tranëduced tree 105 4.3.2. Informal discussion of tree trans duction 106 4.3.3. Informal discussion of consistency of tree transducers 107 4.4. Formal Definition of Consistency and Semir consistency 111 4.4.1. Example: Boolean type implementation 111 4.4.2. Local consistency and local semi- consistency 114 4.4.3. Global consistency and global semi- consistency 115 4.5. Weak Syntactical Honest Tree Transducer 116 4.6. Major Theorems 118 4.7. Simplifications, Summary 121 iv Page 5. CONDITIONAL REWRITING SYSTEM 122 5.1. The Idea of Conditional Rewrite Rules 122 5.2. Related Work and Discussion 122 5.3. Conditional Equations versus Simple Equations 123 5.4. Formal Definition of Conditional Equations 127 5.5. Examples: Power of Conditional Equations 132 5.5.1. Example 1: QUEUE 132 5.5.2. Example 2: BINARY TREE 136 5.6. Major Theorem 139 5.7. Summary and Results 142 5. DATA STRUCTURE IMPLEMENTATION AND CORRECTNESS 144 6.1. Related Work and Discussion 145 6.2. Algebraic Specification of a Data Structure 147 6.2.1. Definition of a data structure 147 6.2.2. Example of a data structure 148 6.3. Equivalence of Data Structures 149 6.3.1. Method for checking equivalent data structures 149 6.3.2. Example of equivalent data structures 150 6.3.3. Power of complex data structures 151 6.4. Implementation of a Data Structure 158 6.4.1. Syntactical level of implementations 159 6.4.2. Semantical level of implementations 161 6.5. Correctness of Impelmentation of Data Structures 162 V Page 6.6. Development of Correct Implementations 163 6.6.1. Development of SYNIMPL tree transducer 163 6.6.2. Correctness of SYNIMPL tree transducer 165 6.6.3. Development of SEMIMPL tree transducer 172 6.6.4. Correctness of SEMIMPL tree transducer 174 6.7. An Illustration of Correctness of Syntactical Implementation of Data Structures 176 6.8. Summary, Conclusions 189 7. CONCLUSIONS AND FUTURE WORK 190 7.1. Results and Summary 190 7.2. Directions for Future Research 193 8. BIBLIOGRAPHY 194 9. ACKNOWLEDGEMENTS 198 vi LIST OF FIGURES Page Figure 2.1. Signature for "set" data structure 13 Figure 2.2. The cfg for "set" data structure 17 Figure 2.3. Commutative diagram: homomorphism 19 Figure 2.4. Pictorial representation of h<f<a>h< g<b>b» 21 Figure 2.5. Syntax and semantics homomorphisms 26 Figure 2.6. A row of a tree transducer 35 Figure 3.1. Church-Rosser property 48 Figure 3.2. Pictorial representation of ŒFI] 55 Figure 3.3. Pictorial representation of lit]] 56 Figure 3.4. Pictorial; representation of Lemma 3.18 60 Figure 3.5. P({fi,f2.f3}) under binary relation >_ 65 Figure 3.6. The lattice with four elements (P(T)) 66 Figure 3.7. Effective lattice: L(T) 67 Figure 3.8. Algorithm for computing 72 Figure 3.9. Algorithm for computing 73 Figure 3.10 Unaryandbinaryrefinement function 81 Figure 3.11 Allrefinements function 82 Figure 4.1 L(0j) and LfGg) 94 Figure 4.2. Picture of an informal tree transducer 95 Figure 4.3. Pictorial representation of tree transducer Tg 98 vil Page Figure 4.4. A tree transduction by tree transducer 99 Figure 4.5. Informal view of a tree transducer 101 Figure 4.6. Full specification of tree transducer Tj 103 Figure 4.7. Pictorial representation of Lfe^) 109 Figure 4.8. Tree transducer T within L(0j) and LfGg) 113 Figure 5.1. Equations for SET data structure 126 Figure 5.2. Signature of QUEUE data structure 134 Figure 5.3. Equations of QUEUE data structure 135 Figure 5.4. Equations CE of 3TREE data structure 138 Figure 5.5. Representation of a binary tree (sort tree) 140 Figure 6,1. Equations E^, Eg 152 Figure 6.2.