Types and Verification for Infinite State Systems

Types and Verification for Infinite State Systems

Types and Verification for Infinite State Systems Gavin Mendel-Gleason Bachelor of Science in Physics and Pure Mathematics A Dissertation submitted in fulfilment of the requirements for the award of Doctor of Philosophy (Ph.D.) to the Dublin City University Faculty of Engineering and Computing, School of Computing Supervisor: Geoff Hamilton July 19, 2012 Declaration I hereby certify that this material, which I now submit for assessment on the programme of study leading to the award of Doctor of Philosophy is entirely my own work, that I have exercised reasonable care to ensure that the work is original, and does not to the best of my knowledge breach any law of copyright, and has not been taken from the work of others save and to the extent that such work has been cited and acknowledged within the text of my work. Signed: Student ID: Date: Contents Abstract 6 Acknowledgements 7 List of Figures 8 1 Introduction 12 1.1 Type Theory . 17 1.1.1 λ-calculus . 18 1.1.2 Simple Theory of Types . 23 1.1.3 System F . 24 1.1.4 Curry Howard Correspondence . 28 1.2 Overview and Main Contributions . 30 2 Preliminaries 33 2.1 Greatest and Least Fixed Points . 33 2.2 Coq . 35 2.2.1 Theorems and Properties . 36 2.2.2 (Co)Recursion and (Co)Induction . 37 2.3 Equality . 41 2.4 Language . 46 2.5 Inversion . 53 2.6 Explicit Substitution . 54 3 Transition Systems 57 3.1 Introduction . 57 3.2 System F+ Transition Systems . 58 3 3.3 Bisimilarity . 59 3.4 Examples . 60 3.5 Bismulation is Contextual Equivalence . 61 3.6 Properties of Bisimulations . 66 3.7 Related Work . 67 4 Cyclic Proof 68 4.1 Introduction . 68 4.2 Cyclic Proof Rules . 71 4.2.1 Cyclic Type-Checking . 73 4.3 Preservation and Progress . 76 4.4 Normalisation . 78 4.5 Function Unfolding . 89 4.6 Proofs . 89 4.7 Example . 92 4.8 Related Work . 97 5 Program Transformation 100 5.1 Introduction . 100 5.2 General Framework . 100 5.3 The Supercompilation Algorithm . 102 5.3.1 The Parts Assembled . 112 5.4 Reification . 114 5.5 Example . 118 5.6 Related Work . 120 6 Soundness 125 6.1 Introduction . 125 6.2 (Co)-Inductive Constructive Types . 125 6.3 Examples . 130 6.4 Related Work . 133 7 Implementation 134 7.1 Mechanisation in Coq . 134 4 7.1.1 Derivations . 136 7.1.2 Progress and Preservation . 142 7.1.3 Transition Systems . 146 7.2 Haskell Implementation . 148 8 Conclusion and Further Work 153 Bibliography 156 A Supercompilation Implementation 165 B System-F Embedding in Coq 167 C Non-positive Types in System-F 175 5 Abstract Server-like or non-terminating programs are central to modern computing. It is a common requirement for these programs that they always be available to produce a behaviour. One method of showing such availability is by endowing a type-theory with constraints that demonstrate that a program will always produce some behaviour or halt. Such a constraint is often called pro- ductivity. We inroduce a type theory which can be used to type-check a polymorphic functional programming language similar to a fragment of the Haskell programming language. This allows placing constraints on program terms such that they will not type-check unless they are produc- tive. We show that using program transformation techniques, one can restructure some programs which are not provably productive in our type theory into programs which are manifestly produc- tive. This allows greater programmer flexibility in the specification of such programs. We have demonstrated a mechanisation of some of these important results in the proof-assistant Coq. We have also written a program transformation system for this term-language in the programming language Haskell. Acknowledgments I would like to thank my wife, Deirdre, for her long suffering patience. Without her contribu- tion this thesis wold not exist. I also would like to thank Geoff Hamilton for his helpful suggestions and encouragement. I would like to thank James for assistance with some of the mathematical de- tails and Paul Bowman for helping to make the mathematics more accessible. I would like to thank Rose Murphy for reading through the thesis despite not understanding it. I would also like to thank my examiners, specifically the helpful and detailed suggestions for revisions given by Conor McBride and the assistance of David Gray in making the section on transition systems readable. List of Figures 1.1 λ-Calculus . 19 1.2 Example Reductions . 20 1.3 Church Rosser Property . 21 1.4 Simply Typed λ-Calculus . 23 1.5 System F . 26 1.6 System F Substitution . 27 1.7 Substitution and Modus Ponens . 29 1.8 Choices for Evaluation Order . 29 1.9 Barendregt’s λ-cube . 30 2.1 Monotone Function . 34 2.2 Commutivity of Conjunction . 36 2.3 Program for inf and inf2 ............................. 43 2.4 Two Bisimilar Systems . 44 2.5 Coequivalence . 44 2.6 System F+ Syntax . 46 2.7 Formation Rules . 48 2.8 Term Substitution for System F+ .......................... 48 2.9 Substitution for System F+ ............................. 49 2.10 System F+ Proof Rules . 50 2.11 System F+ Experiments . 52 2.12 System F+ Evaluation . 53 2.13 Relations Related to Evaluation . 53 2.14 Inversion . 54 2.15 Explicit Substitution . 55 8 3.1 Actions and Labelled Transitions . 58 3.2 Compatible Refinement . 62 4.1 Cyclic Proofs . 71 4.2 Cyc Rule . 72 4.3 FunRec Pre-Proof . 74 4.4 FunRec Pre-Proof 2 . 75 4.5 FunRec Transformation to Cyclic Pre-Proof . 75 4.6 Normalisation Grammar . 78 4.7 Normalisation . 79 4.8 Normalisation (Cont.) . 80 4.9 Function Unfolding Rule . 89 4.10 Structural Ordering . 90 4.11 Structural Recursion . 90 4.12 Guardedness . 92 4.13 Program for plus ................................. 93 4.14 Plus . 93 4.15 Sumlen Program . 94 4.16 Cyclic Pre-Proof for Sumlen . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    176 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us