The Interpretation and Inter-Derivation of Small-Step and Big-Step Specifications

The Interpretation and Inter-Derivation of Small-Step and Big-Step Specifications

The Interpretation and Inter-derivation of Small-step and Big-step Specifications Ian Zerny PhD Dissertation Department of Computer Science Aarhus University Denmark The Interpretation and Inter-derivation of Small-step and Big-step Specifications A Dissertation Presented to the Faculty of Science and Technology of Aarhus University in Partial Fulfillment of the Requirements for the PhD Degree by Ian Zerny June 21, 2013 Abstract We study the interpretation and inter-derivation of big-step and small-step specifications. In particular, we consider formal specifications of program- ming languages, e.g., denotational semantics and operational semantics, and investigate how these specifications relate to each other. We carry out this investigation by interpreting specifications as programs in a pure functional meta-language and by constructively deriving one program from the other us- ing program transformations. To this end, we use two derivational correspon- dences: The functional correspondence between compositional higher-order specifications and first-order transition systems, and the syntactic correspon- dence between rewriting specifications and first-order transition systems. The main contribution of this dissertation is threefold: First, we extend these correspondences to systematically derive small-step reduction semantics and abstract machines from big-step reduction strategies. Second, we show how these correspondences can be used to relate specifications for lazy evalua- tion, e.g., graph reduction and call-by-need evaluation. Third, we describe an alternative interpretation of specifications as logic programs in a logical framework, and we give a logical counterpart to the functional correspon- dence. i Resumé Vi studerer fortolkningen og udledelsen af big-step og small-step specifika- tioner. Især betragter vi formelle specifikationer af programmeringssprog, så- som denotationel semantik og operationel semantik, og vi undersøger, hvor- dan disse specifikationer relaterer til hinanden. Denne relation undersøger vi ved at fortolke specifikationer som programmer i et effektfri funktionel metasprog og bruger programtransformationer til konstruktivt at udlede et program fra et andet. Til dette benytter vi to udledningskorrespondancer: Den funktionelle korrespondance mellem kompositionelle højereordensspeci- fikationer og transitionssystemer, samt den syntaktiske korrespondance mellem omskrivningsspecifikationer og transitionssystemer. Hovedbidraget i denne afhandling er tredelt: Først udvider vi disse korrespon- dancer med en systematisk udledning af en small-step reduktionssemantik og en abstrakt maskine fra en big-step reduktionsstrategi. Dernæst viser vi, hvordan disse korrespondancer kan relatere specifikationer for lazy evaluer- ing, såsom grafreduktion og call-by-need evaluering. Slutteligt beskriver vi en alternativ fortolkning af specifikationer som logikprogrammer i et logisk system, og vi giver en logisk pendant til den funktionelle korrespondance. iii Acknowledgments As many before me, I would like to thank my supervisor Olivier Danvy, whose supervision goes well beyond the call of duty. As a teacher, Olivier exposed to me the structure, notation, and interpretation of programs. As a mentor, Olivier guided me through the academic world of writing, publishing, and teaching. As a colleague, Olivier introduced me to the wonders of research, discovery, and development. As a friend, Olivier kindled my interests in tech culture, science fiction, and many other fine details of life. I would like to thank Jan Midtgaard. As a teaching assistant, Jan, who was then a PhD student, made a lasting impression on me that ultimately led to my own pursuit of a PhD degree. I have since been fortunate to receive Jan’s support as colleague, as coauthor, as friend, and as, de facto, second advisor. I am also grateful to Zena Ariola and Glynn Winskel for reviewing this PhD dissertation and serving in its PhD committee. I would also like to thank Kevin Millikin for his advice and encouragements as a Google Fellowship Mentor and for hosting a fruitful internship at Google in the early fall of 2012. I would like to thank Frank Pfenning for an inspiring stay at Carnegie Mellon University during the winter from 2011 to 2012. CMU is a truly remarkable institution which is made so by many: Thanks to Frank Pfenning for his course on logic, to Karl Crary for his course on LF, to Robert Harper for his courses on functional programming and type theory, and to Stephen Brookes for his course on semantics. Thanks to the POP students, to the tea trolls, and for the weekly D’z. I would like to thank Kenichi Asai and his PhD students for a wonderful visit in the programming-language lab of Ochanomizu University in December 2010. Thanks to Moe Masuko, Kanae Tsushima, and Yayoi Ueda for their great hos- pitality and academic engagement. I was fortunate enough to attend Henk Barendregt and Jan Willem Klop’s mini-course on Lambda Calculus and Term Rewriting Systems in 2009, the Midlands Graduate School in 2009, the Central European School on Func- tional Programming in 2009, the Estonian Winter School in Computer Sci- v ence in 2010, and the Oregon Summer School in 2009 and in 2011. These events have shaped my PhD studies, and I want to extend grateful thanks to their organizers. Thanks to my coauthors, Olivier Danvy, Jacob Johannsen, Jan Midtgaard, Kevin Millikin, Johan Munk, Ken Shan, Robert Simmons, Peter Thiemann, and Johnni Winther. This dissertation is but a single fruit of our collabora- tion. Thanks to Kent Grigo, Mathias Schwarz, and Jakob Thomsen for their feedback on this dissertation. Thanks to the other members of the programming-languages group at Aarhus University and to Christian Christoffersen, Dennis Decker Jensen, Finn Jensen, Peter Kristensen, Carsten Nørby, Matthias Puech, Thomas Salomon, Filip Siecz- kowski, and Sarah Zakarias for our discussions and also their support. Thanks to the kind and effective support of the administrative staff at Aarhus Univer- sity and in particular to Michael Glad, Ellen Kjemtrup, and Ann Eg Mølhave. My PhD studies have successively been funded by the Faculty of Science at Aarhus University and by the Google Fellowship program. I was also awarded an EliteForsk travel grant from the Ministry of Science, Innovation and Higher Education. For this support I express my sincere thanks. Finally, I am forever grateful to Anne for her unreserved love, for her unwa- vering support, and for Erik, our son. Ian Zerny, Aarhus, June 21, 2013. vi Contents Abstract i Resumé iii Acknowledgments v Contents vii I Background and overview 1 1 Introduction 3 2 The semantics of programming languages 7 2.1 Syntax .......................................... 8 2.2 Denotational semantics ................................ 9 2.3 Operational semantics ................................ 19 2.4 Representations and implementations ....................... 31 3 A functional correspondence: from definitional interpreter to abstract machine 39 3.1 The CPS transformation: from direct-style to continuation-style . 39 3.2 Defunctionalization: from higher order to first order . 44 3.3 Summary and conclusion ............................... 45 3.4 The functional correspondence in perspective . 45 4 A syntactic correspondence: from reduction semantics to abstract machine 51 4.1 A prequel to reduction semantics: from search to decompose . 51 4.2 Refocusing: from reduction-based to reduction-free evaluation . 56 4.3 Lightweight fusion: from small-step to big-step abstract machine . 58 4.4 Hereditary transition compression ......................... 59 4.5 Summary and conclusion ............................... 61 4.6 The syntactic correspondence in perspective . 61 vii Contents II Publications 65 5 A prequel to reduction semantics 67 5.1 Introduction ....................................... 67 5.2 Arithmetic expressions ................................ 69 5.3 Call-by-value λ-calculus ................................ 77 5.4 Call-by-value λ-calculus with exceptions and context-sensitive contraction rules . 80 5.5 Call-by-value λ-calculus with exceptions and context-insensitive contraction rules . 82 5.6 Case study: JavaScript ................................. 87 5.7 Related work ...................................... 92 5.8 Conclusion and perspectives ............................. 92 6 Normalization functions for Boolean propositional formulas 93 6.1 Introduction ....................................... 93 6.2 Domain of discourse .................................. 94 6.3 Leftmost outermost negational normalization . 97 6.4 Leftmost outermost conjunctive normalization . 113 6.5 Conclusion and perspectives .............................122 7 Storeless call-by-need evaluation 125 7.1 Introduction .......................................125 7.2 The standard call-by-name reduction for the λ-calculus . 127 7.3 The standard call-by-need reduction for the λ-calculus . 128 7.4 Some exegesis .....................................131 7.5 From reduction semantics to abstract machine . 139 7.6 Small-step AMs define relations, big-step AMs define functions . 143 7.7 From abstract machine to evaluation functions . 144 7.8 Deterministic abstract machines define functions . 148 7.9 Conclusion ........................................149 7.A On refunctionalizing and going back to direct style . 149 7.B On the control pattern underlying call by need . 152 8 A synthetic operational account of call-by-need evaluation 157 8.1 Introduction .......................................158 8.2 Call by need vs.

View Full Text

Details

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