Docsity

THE PRIMARY LOGICS OF PROGRAMMING LANGUAGES A ..., Schemes and Mind Maps of Programming Languages

Toggle sidebar
bg1
THE PRIMARY LOGICS OF PROGRAMMING LANGUAGES
A THESIS
Presented to
The Faculty of the Division of Graduate
Studies and Research
By
Robert Ian Winner
In Partial Fulfillment
of the Requirements for the Degree
Doctor of Philosophy
in the School of Information and Computer Science
Georgia Institute of Technology
July, 1975
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download THE PRIMARY LOGICS OF PROGRAMMING LANGUAGES A ... and more Schemes and Mind Maps Programming Languages in PDF only on Docsity!

THE PRIMARY LOGICS OF PROGRAMMING LANGUAGES

A THESIS

Presented to The Faculty of the Division of Graduate Studies and Research By Robert Ian Winner

In Partial Fulfillment of the Requirements for the Degree Doctor of Philosophy in the School of Information and Computer Science

Georgia Institute of Technology July, 1975

THE PRIMARY LOGICS OF PROGRAMMING LANGUAGES

APPROVED;, .J

/iJ^^^ _...

Lucio Chiaraviglio, Chairm^*^" I X^ -^ •

Willim I. Grosky C^

Peter E. Lauer, Visiting

David^^ Ro^ers^^ _;/

F r e d e r i c k A. 'Rossikii

DATE^ ^^ I?^ ,^ >^7s

I l l

ACKNOWLEDGMENTS

Many people have aided in one way or another in the research, writing, and editing of this dissertation. Thanks are due my reading and examining committees consisting of Professors William I. Grosky, Peter E. Lauer, David E. Rogers, Frederick A. Rossini, and, as chairman, Lucio Chiaraviglio, for their timely advice, pertinent questions, and patience. I owe a particular debt of gratitude to my advisor, Professor Chiaraviglio, a true intellectual, mentor, and friend. A person of such insight is rarely found, and I count myself fortunate to have been his student and colleague. Other past and present members of the faculty of information and computer science to whom I am grateful for general assistance and advice are Professors James Gough, Jr., Phillip J. Siegmann, John M. Gwynn, Robert B. Cooper, Michael J. Kelly, T. Chin Ting, Gordon Pask, and Thomas J. Windeknecht, and Messrs. Alton P. Jensen and John M. Gehl. I also thank my employers. Professor Vladimir Slamecka of the School of Informa- tion and Computer Science and Mr. Charles Reed of the Office of Computer Services. To my parents I am indebted beyond repayment for an upbringing in an atmosphere in which education and scholarship were prized and for their constant support of a sometimes errant son.

I V

TABLE OF CONTENTS

Page

ACKNOWLEDGMENTS , iii

LIST OF ILLUSTRATIONS v

SUMMARY vi

Chapter

I. HISTORICAL PERSPECTIVES AND ORIENTATION 1

II. THE PROGRAMMING LANGUAGE FAMILY L AND

ITS PRIMARY LOGIC o.. 13

The Morphology

The Theory of L,

Semantics

Metalogical Analysis

Programmatic Valuation Spaces

Summary

III. FUTURE DIRECTIONS FOR STUDY 87

Embellishments of L,

Summary

Conclusion

BIBLIOGRAPHY 104

VITA 107

VI

SUMMARY

In computer programming and computing, one finds a paradigm case of planning and execution of plans. These plans and their executions are successful or fail in much the same way that assertions are true or false. This dissertation attempts to demonstrate that the methods of logical assessment of assertoric reasoning can be applied fruitfully to the assess- ment of programmatic reasoning and in particular to problems of correctness and equivalence of programs. The first chapter discusses the history of logical assessment, describes the relationship between logistic analysis and the broader semiotic analysis, and introduces the notion of programmatic reasoning, valuations, and inferences. The second chapter presents a family of pro- gramming languages, PL, and a subfamily thereof called L,. The families are presented in sections on morphology, theory, and semantics. The semantics are of two forms, one based on models, the other on valuations. The chapter also includes several metalogical results about the theory of L^ including completeness, soundness, and consistency. The third chapter discusses several directions for future study including further specifi- cation of L and another possible type of programming language, L^^, The dissertation ends with a few pages of concluding remarks. The audience of the dissertation is assumed to be that part of the computer science community which has a theoretical interest in programming.

CHAPTER I

HISTORICAL PERSPECTIVES AND ORIENTATION

At least since the time of the ancient Greeks, a major enterprise

of logic has been the assessment of inferences. Members of the Stoa, for

example, were concerned with the kinds of inferences contained in the

dialectic of the Megarian philosophers such as Zeno of Elea. (Essenti-

ally, these were arguments of the reductio ad impossibile variety.)^20]

In particular, one of the most significant streams of Megarian-Stoic

thought related to the nature of conditionals [20]. This is evidenced in

references (for example by Cicero [?]) to works by Diodorus Cronus of

lasus, Philo of Megara, and Chrysippus of Soli (c. 280-207 b.c.e., the

most renowned compiler of Stoic logic [8,4]). The resulting logic was a

prepositional logic consisting of inference schemata, further developed

in the medieval theory of consequences, and, as Lukasiewicz points out

[25], significantly similar to modern propositional logic as formulated

by Frege.

The central question in the assessment of inferences, as motivated

by the Zenonian dialectic or as in later developments, is given a collec-

tion of premises, what can be validly concluded? In other words, what

propositions can be inferred from the assumed ones? This question has

three aspects, a distinction not fully made by the ancients, that are

typical components of problems dealt with in a linguistic framework:

adhered to in that languages will be assumed, without substantive loss of generality, to be written.) Having described the elemental symbols, the morphology defines the rules for combining these into larger forms, for example terms (items intended to name things) and well-formed formulae, In this way the morphology configures the set of expressions of the language. The second component of the semiotic of a language, the semantic, provides interpretations of the elements of the morphology in some uni- verses. It is common in logistic analyses to formalize the semantic by framing it in set theory, an approach which is used in this study. The semantic may also contain axiological components which distinguish a sub- set of the expressions of the language, to wit those having some particu- lar semantic property such as universal validity, satisfiability, or tautologism. The pragmatic shows the relationship between the expressions of the language and the users. Of concern here are such things as the nature of the set of users qua users. For example, is the set uniform or does it have distinguished subsets? Do distinguished users use distinguished interpretations? Temporal variants might also be included under prag- matics as well as particular conditions of use. The logic of a language abstracts away from the pragmatic as found in the semiotic, leaving the relationship between the morphology and the semantic to be appraised. The logic therefore extends the syntactic side of the system to include not only the morphology but also a component in- tended to reflect syntactically the axiological component of the semantics, This aspect of the analysis is called the theory proper, proof theory,

transformational syntax, or as in sequel the theory. The combination of morphology and theory is called a calculus, the theory delineating a sub- set of the expressions in the language called theorems. In an axiomatic theory, a subset of the expressions are deemed to be theorems as axioms or instances of axiom schemata. Other theorems are then distinguished by the recursive application of rules of inference, rules which allow the inference of theorems from sets of theorems. It is hoped that the set of theorems as syntactically characterized by the calculus is in a highly regular way related to the set of expressions axiologically distinguished by the semantics. If the two sets are equal, then the logic is said to be adequate to the language because the distinguished "meaning" as defined in the semantic of an expression may be determined adequately in the lan- guage (i.e. via morphology and semantic) or in the logic (i.e. via mor- phology and theory) whichever is the more convenient. A programming language is by intent a language the expressions of which are plans or programs [l9] which describe processes executed in universes of interpretation. It is clear from this basic description that programming languages should be susceptible to semiotic and logical analy- sis for as mathematical languages contain expressions which may be true or false, programming languages contain expressions which may succeed or fail; where mathematical logics investigate inferences based on the valua- tions of truth, programmatic logics investigate inferences based on valua- tions of success. The parallels seem obvious. One might go so far as to say that the logics of programming languages may be viewed as having a relation to the unexplored world of programmatic reasoning that is similar to the relation of mathematical logics to assertoric reasoning.

of the form: If this program works, then we infer that that (1.3) program works.

Programmers often attempt to make this sort of inference and, depending on their sophistication, might be going through a process of identifying parts of programs which react the same way on a particular machine or re- act similarly under specific preconditions. To those concerned with manipulating programs, as through optimization or reduction to normal forms, this programmatic inference is fundamental, as it is also in prov- ing correctness of programs. All this notwithstanding, there is some question as to what (1.3) means. To be precise this has been one of the goals of this research. Before continuing with the specifics of the pri- mary logics of programming languages, an outline of the brief history of investigations into this question is in order. (In the literature this area has come to be called "formal semantics of programming languages," but the substitution of "logic" for "formal semantics" is surely justi- fied. For more extensive summaries see [l,10].) A main thrust of the previous work in the logic of programming languages has been in the area of defining and assessing various notions of programmatic bi-inference leading to discussions of equivalence (bi- conditionals) rather than conditionals. This, too, is the approach of this dissertation with the exception that equivalence will be viewed in a somewhat broader sense and in a more general setting than in previous work. The need for putting the descriptions of programming languages in

order was realized in the late 1950's. Early significant work, especially in the morphological component, is evidenced in the reports and defini- tions of Algol 60 [35], Euler [4l], and Algol 68 [40] with a machine oriented treatment of semantics (at the term level only) being added by the IBM Vienna laboratory work [23]. The attempts to formalize the notion of program equivalence began with a paper by lanov [I8] in which the notion of program schemata was introduced. Various types of program schemata have been investigated, but essentially the idea has been to isolate the control structure with func- tors, predicators, and input, output, and program variables. This struc- ture, or schema, can then be interpreted in a set theoretic domain with functions, predicates, and so on as the designata in the usual and obvious way. An interpreted schema is a program. From the point of view of the present project a program schema simply names a class of programs whose syntax and semantics are further restricted by specific interpretations of functors, predicates and the rest [29]. The work done with program schemata has produced some interesting results by way of delineating classes with particular decision properties, but seems nevertheless un- satisfying because of implicit assumptions made, such as, for example, notions of the semantics of assignment, looping, concatenation, and branch- ing, not to mention absence of discussion or implicit assumptions about the processing agent. Key papers in this area are those by lanov [iS], Luckham, Park, and Paterson [24], Paterson [36], Chandra [5], and Manna [26,27,28], A good summary of Soviet efforts in this area appears in Ershov [13]. Points about program schemata approaches worth noting are their

the correctness and partial correctness of "if-then-else" programs for the computation of partial functions are allied to the validity and satis- fiability of certain formulae of lower predicate calculus. The fact that three valued logics and certain parallel evaluations are required for ex- pressive completeness (the ability to express all desired partial func- tions) follows from the notion that pairs of non-terminating (undefined) items are evaluated as equal and from the absence of "while" loops. The work of Landin [2l] bears some similarity to the present re- search in that it also proposes a family of languages and presents some axioms for the equivalence of programs given some assumed morphological constructs. The dissimilarity between Landin's work and that presented in this paper is more basic, however, in that Landin's purpose was to pro- pose a family of functional (non-procedural) programming languages for actual use. The notion of a language family was used to provide a mold into which one might cast specific languages for particular problem orien- tations rather than to highlight important features of programming lan- guages in general for a full-fledged logical assessment. The axioms and rules presented by Landin are used to replace an unstated semantics rather than to show a relationship between form and meaning as is the case in the present work. It has recently come to the attention of this research project that semantical results similar to some of those contained in this dissertation are being achieved by Reynolds through the use of continuation semantics. At this writing, the critical paper [37] is available only from its author. In it continuation semantics are contrasted to relational semantics in the ability to distinguish certain abnormalities such as the termination of a

"while" loop over a "do-nothing" program dependent on a tautology. This same result arises naturally in the current logic from the definition of termination in the model semantics and even more simply by a natural, intuitive rule in the valuational semantics. Differences between the two approaches appear to rest on the fact that the continuation semantics is a kind of functional calculus rather than a logic in the more standard sense. The result of this is that the range of reasonable interpretations of languages seems to remain obscure, at least to the author of this dis- sertation. Even though it is rather detailed, the model semantics of the primary logics discussed in the following chapter does point out clearly the relationship between plans, processes, and the goals sought by the execution of the plans. In addition, the schematology for the logics of all manner of assertions about programs is presented in order to provide great generality. On the other hand, the valuational semantics described in the following chapter provide a simple, elegant way of reconstructing the final valuations of programs regardless of what the programs actually do when executed. It is this kind of feature, readily found in the methods and schematology of logic, in the strict sense, that has attracted the author to the orthodox logics rather than to functional calculi as de- scribed by Reynolds. In any case, the developments in continuational se- mantics are of great interest and deserve further study. The partially integrative work of Lauer and Hoare [17,22] is con- cerned with the description of the semantics of programming languages. They note that there are essentially two classes of descriptions being investigated today--the constructive approach and the implicit approach, The former is aimed mainly at compiler implementers by specifying how

pragmatic aspect of the semiotic. The notions of programmatic valuations and programmatic inferences have been introduced on the intuitive level, and it has been noted that these are the main targets for appraisal by the primary logics of programming languages. Lastly, this section in- cludes remarks on some other approaches to be found in the literature,

CHAPTER II

THE PROGRAMMING LANGUAGE FAMILY L^ AND ITS PRIMARY LOGIC

In this chapter a family of formal programming languages, PL, which allows for a broad scope of features usually found in programming languages is introduced. At the same time, a subfamily of PL, called L, , is defined so that this initial logistic analysis may be aimed specifi- cally at the bearing of certain common features, such as term and control structures, on valuations and inferences. This chapter includes both the first primary logic of L and also some metalogical assessment of it. The Morphology Embedded in the programming languages of PL and particularly notice- able in their control structures is the language of non-quantified predi- cators. The morphology of this embedded language will be treated first in each of the two subsections of the morphology of PL and L^, the primitive signs and the rules of formation. A like arrangement will be used in the section on semantics. Several morphological sets are defined below for PL. Their respective subsets in L^ will be indicated by appending a sub- script "l". For example, since Cnc is the set of connectors of PL, then Cnc. is the set of connectors of L,. Primitive Signs Variables; There are denumerably many individual variables x, x , x^, X2,.. .. For purposes of readability, other lower case letters of