A DENOTATIONAL ENGINEERING of PROGRAMMING LANGUAGES to Make Software Systems Reliable and User Manuals Clear, Complete and Unambiguous
Total Page:16
File Type:pdf, Size:1020Kb
A DENOTATIONAL ENGINEERING OF PROGRAMMING LANGUAGES to make software systems reliable and user manuals clear, complete and unambiguous A book in statu nascendi Andrzej Jacek Blikle in cooperation with Piotr Chrząstowski-Wachtel It always seems impossible until it's done. Nelson Mandela Warsaw, March 22nd, 2019 „A Denotational Engineering of Programming Languages” by Andrzej Blikle in cooperation with Piotr Chrząstowski-Wachtel has been licensed under a Creative Commons: Attribution — NonCommercial — NoDerivatives 4.0 International. For details see: https://creativecommons.org/licenses/by-nc-nd/4.0/le- galcode Andrzej Blikle in cooperation with Piotr Chrząstowski-Wachtel, A Denotational Engineering of Programming Languages 2 About the current versions of the book Both versions ― Polish and English ― are in statu nascendi which means that they are both in the process of correction due to my readers’ remarks. Since December 2018 both versions, and currently also two related papers, are available in PDF format and can be downloaded from my website: http://www.moznainaczej.com.pl/what-has-been-done/the-book as well as from my accounts on ResearchGate, academia.edu and arXiv.org I very warmly invite all my readers to send their remarks and questions about all aspects of the book. I am certainly aware of the fact that my English requires a lot of improvements and therefore I shall very much appreciate all linguistic corrections and suggestions as well. You may write to me on [email protected]. All interested persons are also invited to join the project Denotational Engineering. For more details see: http://www.moznainaczej.com.pl/an-invitation-to-the-project Acknowledgements to the Polish version Since June 2018 a preliminary version of the Polish version has been made available to selected readers which resulted with a flow of remarks. Below is the list of readers whose observations contributed to the improvement of my book. The order is chronological according to the dates of receiving the remarks. I hope that this list will keep growing. To all the contributors I express my very sincere thanks. Piotr Chrząstowski-Wachtel, Stanisław Budkowski, Antoni Mazurkiewicz, Marek Ryćko, Bogusław Jackowski, Ryszard Kubiak, Paweł Urzyczyn, Stefan Sokołowski, Marek Bednar- czyk, Wiesław Pawłowski, Jan Madey, Krzysztof Apt, Andrzej Tarlecki, Jarosław Deminet. Acknowledgements to the English version Vacant, so far… A technical remark to the reader of the “Word version” of the book To protect the layout of formulas, set tabulators to 0,5 cm. Tabulator’s setting is a local param- eter of a document which you set in the section Main tools / Paragraph of the tools panel, where at the lower right corner of that panel you should click a small arrow. Nelson Mandela’s quotation on the front page has been taken from https://www.brainyquote.com/authors/nelson_mandela Andrzej Blikle in cooperation with Piotr Chrząstowski-Wachtel, A Denotational Engineering of Programming Languages 3 Contents FOREWORD ......................................................................................................................................................... 8 1 INTRODUCTION ..................................................................................................................................... 11 1.1 REVERSE THE TRADITIONAL ORDER OF THINGS ....................................................................................... 11 1.2 WHAT IS IN THE BOOK ............................................................................................................................. 13 1.3 WHAT THIS BOOK IS NOT OFFERING ......................................................................................................... 14 1.4 WHAT IS NEW IN MY APPROACH AND WHAT IS NOT.................................................................................. 15 1.5 LINGUA FROM BIRD’S-EYE VIEW .............................................................................................................. 16 1.5.1 Notational conventions .................................................................................................................. 16 1.5.2 Data and (their) types ................................................................................................................... 17 1.5.3 Abstract errors .............................................................................................................................. 20 1.5.4 Expressions ................................................................................................................................... 21 1.5.5 Instructions .................................................................................................................................... 22 1.5.6 Variable declaration and type definitions ..................................................................................... 24 1.5.7 Procedures’ declarations .............................................................................................................. 24 1.5.8 Object programming ..................................................................................................................... 26 1.5.9 SQL programming ......................................................................................................................... 26 1.5.10 Programs .................................................................................................................................. 26 1.5.11 Validating programming .......................................................................................................... 26 2 METASOFT AND ITS MATHEMATICS .............................................................................................. 29 2.1 BASIC NOTATIONAL CONVENTIONS OF METASOFT .................................................................................. 29 2.1.1 General mathematical notation ..................................................................................................... 29 2.1.2 Sets ................................................................................................................................................ 30 2.1.3 Functions ....................................................................................................................................... 31 2.1.4 Tuples ............................................................................................................................................ 34 2.2 PARTIALLY ORDERED SETS ...................................................................................................................... 36 2.3 CHAIN-COMPLETE SETS ........................................................................................................................... 37 2.4 THE CPOS OF FORMAL LANGUAGES ........................................................................................................ 39 2.5 EQUATIONAL GRAMMARS ........................................................................................................................ 40 2.6 THE CPOS OF BINARY RELATIONS ........................................................................................................... 42 2.7 THE CPO OF DENOTATIONAL DOMAINS ................................................................................................... 45 2.8 ABSTRACT ERRORS .................................................................................................................................. 47 2.9 A THREE-VALUED PROPOSITIONAL CALCULUS ......................................................................................... 48 2.10 DATA ALGEBRAS ................................................................................................................................ 50 2.11 MANY-SORTED ALGEBRAS .................................................................................................................. 53 2.12 ABSTRACT SYNTAX AND REACHABLE ALGEBRAS ............................................................................... 57 2.13 AMBIGUOUS AND UNAMBIGUOUS ALGEBRAS ...................................................................................... 61 2.14 ALGEBRAS AND GRAMMARS ............................................................................................................... 63 3 THE SEMANTIC CORRECTNESS OF PROGRAMS ......................................................................... 70 3.1 HISTORICAL REMARKS ............................................................................................................................. 70 3.2 ITERATIVE PROGRAMS ............................................................................................................................. 71 3.3 PROCEDURES AND RECURSION ................................................................................................................. 73 3.4 TWO CONCEPTS OF PROGRAM CORRECTNESS ........................................................................................... 75 3.5 PARTIAL CORRECTNESS ........................................................................................................................... 78 3.5.1 Sequential composition and branching ......................................................................................... 78 3.5.2 Recursion and iteration ................................................................................................................. 80 3.6 TOTAL CORRECTNESS .............................................................................................................................