Programming Language Semantics a Rewriting Approach

Programming Language Semantics a Rewriting Approach

Programming Language Semantics A Rewriting Approach Grigore Ros, u University of Illinois at Urbana-Champaign 2 Contents 1 Introduction 7 2 Background and Preliminaries 15 2.1 Mathematical Background . 16 2.1.1 Functions . 16 2.1.2 Partial Functions . 17 2.1.3 Context-Free Grammars and the Mixfix Algebraic Notation . 18 2.1.4 Basic Term Rewriting . 19 2.1.5 On Logics and Logic Deduction . 20 2.2 Basic Computability Elements . 22 2.2.1 Turing Machines . 22 2.2.2 Universal Machines, the Halting Problem, and Decision Problems . 24 2.2.3 The Arithmetic Hierarchy . 25 2.2.4 Notes . 26 2.2.5 Exercises . 26 2.3 Propositional Logic . 27 2.3.1 Syntax and Semantics . 27 2.3.2 Proof System and Soundness . 28 2.3.3 Consistency and Model Existence . 29 2.3.4 Completeness and Compactness . 30 2.3.5 Notes . 30 2.3.6 Exercises . 31 2.4 Equational Logic . 32 2.4.1 Signatures, Algebras, Equations, Satisfaction . 32 2.4.2 Proof System and Soundness . 32 2.4.3 Computation as Equational Deduction . 33 2.4.4 Initial Algebra . 36 2.4.5 Completeness . 37 2.4.6 Defining Data-Types Equationally . 42 2.4.7 Notes . 49 2.4.8 Exercises . 49 2.5 Rewrite logic . 50 2.5.1 Equations versus Rewrite Rules . 50 2.5.2 Proof System and Soundness . 55 2.5.3 Computation as Rewrite Logic Deduction . 58 3 2.5.4 Completeness . 61 2.5.5 Rewrite Logic as a Universal Logical Formalism . 61 2.5.6 Maude: A High Performance Rewrite Logic System . 62 2.5.7 Exercises . 82 2.5.8 Notes . 84 2.6 Complete Partial Orders and the Fixed-Point Theorem . 85 2.6.1 Posets, Upper Bounds and Least Upper Bounds . 85 2.6.2 Complete Partial Orders . 86 2.6.3 Monotone and Continuous Functions . 87 2.6.4 The Fixed-Point Theorem . 89 2.6.5 Equational Framework for Fixed-Points . 90 2.6.6 Exercises . 92 2.6.7 Notes . 92 2.7 Category Theory . 95 3 Executable Semantics Approaches 101 3.1 IMP: A Simple Imperative Language . 109 3.1.1 IMP Syntax . 109 3.1.2 IMP State . 114 3.1.3 Notes . 115 3.2 Big-Step Structural Operational Semantics (Big-Step SOS) . 117 3.2.1 IMP Configurations for Big-Step SOS . 118 3.2.2 The Big-Step SOS Rules of IMP . 119 3.2.3 Big-Step SOS in Rewrite Logic . 123 3.2.4 Defining a Type System for IMP Using Big-Step SOS . 130 3.2.5 Notes . 135 3.2.6 Exercises . 137 3.3 Small-Step Structural Operational Semantics (Small-Step SOS) . 139 3.3.1 IMP Configurations for Small-Step SOS . 140 3.3.2 The Small-Step SOS Rules of IMP . 141 3.3.3 Small-Step SOS in Rewrite Logic . 147 3.3.4 Notes . 153 3.3.5 Exercises . 154 3.4 Denotational Semantics . 157 3.4.1 The Denotational Semantics of IMP . 162 3.4.2 Denotational Semantics in Equational/Rewrite Logic . 162 3.4.3 Notes . 165 3.4.4 Exercises . 168 3.5 IMP++: IMP Extended with Several Features . 171 3.5.1 Adding Variable Increment . 172 3.5.2 Adding Input/Output . 176 3.5.3 Adding Abrupt Termination . 181 3.5.4 Adding Dynamic Threads . 188 3.5.5 Adding Local Variables . 193 3.5.6 Putting Them All Together: First Attempt . 196 3.5.7 Putting Them All Together: Second Attempt . 204 4 3.5.8 Notes . 204 3.5.9 Exercises . 205 3.6 Modular Structural Operational Semantics (MSOS) . 213 3.6.1 The MSOS of IMP . 218 3.6.2 The MSOS of IMP++ ................................. 218 3.6.3 MSOS in Rewrite Logic . 224 3.6.4 Notes . 230 3.6.5 Exercises . 230 3.7 Reduction Semantics with Evaluation Contexts . 233 3.7.1 The Reduction Semantics with Evaluation Contexts of IMP . 236 3.7.2 The Reduction Semantics with Evaluation Contexts of IMP++ ............ 239 3.7.3 Reduction Semantics with Evaluation Contexts in Rewrite Logic . 242 3.7.4 Notes . 263 3.7.5 Exercises . 264 3.8 The Chemical Abstract Machine (CHAM) . 269 3.8.1 The CHAM of IMP . 272 3.8.2 The CHAM of IMP++ ................................. 278 3.8.3 CHAM in Rewrite Logic . 281 3.8.4 Notes . 291 3.8.5 Exercises . 293 3.9 Advanced Denotational Semantics: Continuations, Monads and Powerdomains . 295 3.10 Discussion: Advantages, Disadvantages and Comparisons . 296 3.11 Existing Approaches and Their Limitations for Programming Language Semantics . 296 3.11.1 Structural Operational Semantics (SOS) Frameworks . 296 3.11.2 Rewriting Frameworks . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    397 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