<<

Trinity University Digital Commons @ Trinity

Computer Science Faculty Research Department

2-1990 The eC ntral Role of Mathematical in Computer Science John Paul Myers Jr. Trinity University, [email protected]

Follow this and additional works at: https://digitalcommons.trinity.edu/compsci_faculty Part of the Computer Sciences Commons

Repository Citation Myers, J.P., Jr. (1990). The ec ntral role of mathematical logic in computer science. SIGCSE Bulletin, 22(1). doi:10.1145/ 319059.319071

This Article is brought to you for free and open access by the Computer Science Department at Digital Commons @ Trinity. It has been accepted for inclusion in Computer Science Faculty Research by an authorized administrator of Digital Commons @ Trinity. For more information, please contact [email protected]. The Central Role of Mathematical Logic in Computer Science

J. Paul Myers, Jr.

Department of Computer Science Trinity University San Antonio, Texas 78212

I. Introduction and a Short Tirade computer appropriately show only oc- casional interest in it. A fascinating and largely unheralded devel- opment accompanying the rise of computer But it’s astounding that computer scientists science and computer technology has been the are only occasionally interested in learning the increasing applicability of the two most fervently many facets, difficulties, and subtleties of logic “pure” branches of : number since it pervades the entire . In his influ- and mathematical logic. Unexpected mere de- ential text, The Science of Programming, David cades ago are present opportunities for number Gries poignantly confesses: theorists and logicians in this most applied of the mathematical sciences. Indeed, advertisements The research was fraught with lack of for both academic and industrial positions in the understanding and frustration. One rea- ACM Communications, for example, call for ex- son for this was that computer scientists pertise in these fields. Martin Davis expresses in the field, as a whole, did not know the surprise at this new status of mathematical enough logic. Some papers were logic: written simply because the authors didn’t understand earlier work; others When I was a student, even the topolo- contained errors that wouldn’t have hap- gists regarded mathematical logicians as pened had the authors been educated in living in outer space. Today the connec- logic. . . . We spent a good deal of time tions between logic and computers are a thrashing, just treading water, instead of matter of engineering practice at every swimming, because of our ignorance. level of computer organization. . . . Issues With hindsight, I can say that the best and notions that first arose in technical thing for me to have done ten years ago investigations by logicians are deeply would have been to take a course in logic. involved, today, in many aspects of com- I persuaded many students to do so, but I puter science. [3] never did so myself. [6]

While is largely confined at But Gries’ plea has been largely unheeded; present to issues of security and logic is not a true part of the computer science (as well as continuing “pure” activities: e.g., curriculum. The requirement of Trinity Univer- finding the next Mersenne prime), logic has per- sity’s Department of Computer Science -- meated most of the field in both superficial and including formal logic (taught in the profound ways. Number theory, like , Department) as one of several advanced mathe- has only occasional uses in computation; and thus matics courses from which computer science

Permission to copy without fee all or part of this material is granted provided majors must take two -- seems to be as strong a thai the copies are not made or distributed for direct commercial advantage, requirement as any. And even prestigious, the ACM copyright notice and the title of the publication and its date appear. research-oriented institutions (with emphases in and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee applications of logic to computer science) often and/or specific permission. 0 1990 ACM 08979 I-346-9/90/0002/0022 $1.50

22 only informally “strongly encourage” their stu- , , , and dents to take logic. deduction. And as become larger and more complex, isolating the effects of inevitable Our students’ only standard exposure to logic local inconsistencies from the entire system is in the already overworked course in discrete becomes paramount. Work such as in relevance structures. But there it is almost always trivial addresses this problem. Current research, -table logic and never predicate logic to any relying heavily on logic, includes deductive depth whatsoever. Yet our majors continue to be databases and expert systems; expressiveness; required to take a full year (or more) of calculus, dynamic/temporal modeling and temporal logics a discipline that simply does not permeate (for the dimension of time in databases); knowl- computer science as logic does. But, it’s argued, edge-based systems with incomplete and tentative calculus exposes the student to a coherent and information requiring modal and fuzzy reasoning; rigorous study of great power, elegance, and natural interfaces; and . historical value. Are the presentations of logic today any less coherent, rigorous, powerful, Without belaboring the point, brief highlights elegant, historical? No, and, moreover, logic is of the importance of logic to many core areas in increasingly important to a full participation of computer science include the following neces- computer scientists in their field. Of course, sarily partial and not mutually exclusive listing: many -- not all -- of the applications of logic derive from what is now advanced, graduate-level * “theoretical” computer science (of course!) material. But this is all the more to intro- automata, formal , com- duce the requisite logic background at the under- putability, complexity, recursive graduate level. theory;

* artificial intelligence deduction systems, expert systems, II. Logic in Computer Science cognitive science, formalisms, auto- mated proofs, natural language pro- Logic touches on virtually all areas in com- cessing; puter science. While it’s certainly possible for technicians to use systems with significant logi- * programming languages / data structures cal bases, their continuing development and ( is but one evolution of those systems will be frustrated (i la such language), , functional Gries, above) with but poor understanding of logi- languages, semantics (Hoare, denota- cal principles. And the relevance of logic is no tional, procedural, realizability), lan- longer confined (if it ever was!) to mere truth- guage design, computational complete- table propositional logic for circuit design. ness, data abstraction/operations, Significant strides are now made with techniques , object-oriented ap- from deeper areas of logic such as model theory, proaches, parallel processing theory, , and non-classi- (optimality and equivalence to se- cal logics, using such notions as completeness, quential ); consistency, axiomatics, , Skolem functions, h-calculus, constructivity, etc. * systems discussed above: As an example, consider the applicable area of database systems where deep applications of * software engineering logic are necessary for a variety of purposes. At program verification, including test- the most fundamental level are the various alter- ing (path manipulation) and correct- natives for knowledge representation and data ness, ‘formal specifications and pro- models (relational, entity-relationship, etc.) and gram design, executable speci- query-processing languages relying on issues of fications;

23 In fact, even if the deeper concepts of logic * hardware weren’t relevant to CS (they are!), much of the circuit design/optimization, hardware notation for communication among computer design languages, processor verifica- scientists is logic notation. Indeed, it is easy to tion, correctness of OS kernel, lan- find a CS journal or conference proceedings wi,th- guage implementation on given proces- out a single integral or derivative, but virtually sors; impossible to find one without logic terms and notation. * philosophical foundation for CS profound correspondences between Concepts from calculus are relevant in the reasoning and computation, formal above listing of topics only sparsely, if at all systems, constructivity as a basis for (calculus is useful in CS for numerical methods CS influencing language design, se- and for certain analyses -- for example, of com- mantics, etc. (computer science as plexity). So one might justifiably argue for an “applied constructivity”). increasing courseload of discrete topics and a genuine logic sequence to replace calculus. Why, Briefly elaborating a bit of this last area, in an era of continuing curricular changes and a Boyer and Moore discuss the “formalization very rapidly growing “core” of topics for a CS problem”: how to use mathematics and logic to major, this sort of suggestion is always seen as formalize everyday concepts in CS -- that formu- too radical to merit serious discussion is some- las mean what we want them to mean. Reminiscent what puzzling. The theme of this Conference is of Gries’ remark, these authors note that this “From Generation To Generation,” and so it seems appropriate to evaluate what from past genera- is hard because there is a major philo- tions is of the widest relevance for our present sophical gap between the user’s personal curricular needs and constraints. McCarthy intentions and desires and any formal stated (1967, quoted in Hoare and Shepherdson), rendering of them. But many users . . . “It is reasonable to hope that the relationship wade into this ‘specification problem’ between computation and mathematical logic will without fully understanding how treach- be as fruitful in the next century as that between erous it is. . . . Unless you really under- and physics in the last” [7]. There is stand the formal logic you will not be but small hope, however, unless we finally begin able to capture . . . the concepts and to train our students in the tools of logic. relationships you will be grappling with when you apply the logic. [2] It’s time for our field to enter its adulthood with the tools appropriate to that adulthood (alluding to the coincidence that this is the 21st birthday of SIGCSE! -- those most concerned with III. Implications for the Curriculum and CS education). Calculus should be seen as a tool Another Tirade for certain specialized aspects of our field, not as a childhood security blanket, clutched tightly It’s worth remarking that the partial listing because we’ve always done so -- the for above does not represent obscure corners of com- the necessity of a calculus background for a 11 puter science of interest to academics only. students in the sciences often seems to boil down Rather these are some of the “hottest” domains, to something like “it builds character.” concepts, and keywords in contemporary com- puting. Such topics dominate the prestigious Beckman has pointed out that with the com- conferences and symposia in computer science puter as a tool, calculus is becoming more ex- today, such as Principles of Database Systems perimental in nature and that (PODS), Theory of Computing (STOC), Foundations of Computer Science (FOCS), Design and Imple- it seems likely that the basic mathemati- mentation of Symbolic Computation Systems, etc. cal training given computer science stu-

24 dents in the universities will include more work in this mathematics of the To pursue this , Dijkstra has written discrete with, perhaps, a reduced empha- that “it helps to view a program as a formula” and sis on the study of the Calculus . . . . [l] that mathematicians have all but ignored the pro- gramming challenge because “,.. programs were so And, more germane to our argument for logic much longer formulae than [mathematics] was here, he anticipates objections from those not used to that it did not even recognize them as familiar with contemporary treatments of the such.” [4] subject: Thus, building on ideas of Greenleaf [5] and The classical works in this area, written, echoing Dijkstra, we can regard the derivative as say, a century or more ago, clearly be- a single large formula: longed more to philosophy than to math- ematics . .. . Very recent books on math- ematical logic [after its rigorous devel- : analytic functions f con- opment in the early twentieth century] structed inductively from numerous base often include extensive treatments of functions (e, sin, In, etc.) by means of decision and proof methods with detailed basic operations (addition, multiplica- coverage of those algorithmic or computa- tion, composition, etc.). tional procedures that are significant in these studies. [l: insertion added] Specification: Der(f.x) = f(x). At the very least, the work of Ralston, Der(f,x); Prather. and others, supported by the Sloan case f(x) of Foundation a few years ago, might be resurrected. g(x) + h(x): Der := Der(g,x) + Der(h,x); This was an attempt to enhance discrete mathe- matics and better integrate it into the first- g(x)*h(x): Der := h(x)-Der(g,x) + g(x)*Der(h,x); year/sophomore curriculum for CS majors using a g(x)/h(x): Der := . . . “short calculus” course. This goal should receive . . . renewed attention -- not only for the of g(h(x)): Der := Der(g,u)-Der(h,x); coping with the “crisis” of a “bloated calculus” u := h(x); and assuring thbt computer science students . . . receive education in early c: Der := 0; on. Indeed, there was motivation for such an approach then, even without the added emphasis xr: Der := r.x’-l; on logic presented here. In x: Der := l/x; . . . But the integration would add a tremendous sin x: Der := cos x; coherence and elegance to calculus and exercise a end. myriad of fundamental mathematical tools in the process. For example, we would encourage a return to the algorithmic aspects underlying Here the base functions ground the . calculus, largely ignored for a hundred years. Now almost the entire differential calculus may [As an aside, Prather’s approach to the Sloan be seen as but a proof of correctness for this project [8] was to teach discrete mathematics algorithm! So, after suitable motivations and during the first third and a “short” calculus for , the specification is met by this algo- the remainder of the year. Thus the first lecture rithm (formula). For instance the proof of the of calculus could be on the uncountability of the chain rule validates the single appropriate case reals -- thereby marking the boundary between above. discrete and continuous mathematics from the outset!].

25 Few, if any, of these concepts are available to students of Calculus I: detailed treatment of function (one of the most fundamental notions in mathematics), , inductive [l] Beckman, F.S., Mathematical Foundations of , algorithms and correctness, recursion, Programming, The Systems Programming and proof. In fact, it’s often a nuisance that com- Series, Addison-Wesley Publishing Co. puter scientists, in their already full discrete (Reading, MA), 1980. mathematics course, must take precious time to teach some of these most fundamental tools of [2] Boyer, R.S. and J.S. Moore, A Computational mathematics to students who didn’t learn them in Logic Handbook, Perspectives in Computing, a year course in calculus! If students had this Vol. 23, Academic Press (Boston), 1988. background, calculus would then be a marvelous tying together and application of all these funda- [3] Davis, M., “Influences of Mathematical Logic mental topics from discrete mathematics! Differ- on Computer Science,” in R. Herken (ed.), The ential calculus (with its ) is just one Universal : A Half-Century more important algorithm (with its proof of cor- Survey, Oxford University Press (New York), rectness) among many in computer science. 1988.

As a final plea for the incorporation of logic [4] Dijkstra, E.W., “On the Cruelty of Really into the CS curriculum, we may cite Dijkstra Teaching Computer Science,” SIGCSE Bulletin, again: Vol 21, No 1, February 1989.

A , with its formal [5] Greenleaf, N. “Algorithms and Proofs: and with the proof rules that Mathematics in the Computing Curriculum,” define its semantics, is a formal system SIGCSE Bulletin, Vol 21, No 1, February 1989. for which program execution provides only a model. It is well-known that for- [6] Gries, D., The Science of Programming, mal systems should be dealt with in their Springer-Verlag (New York), 198 1. own right, and not in terms of a specific model. . .. Right from the beginning, . . . we [71 Hoare, C.A.R. and J.C. Shepherdson, eds., stress that the programmer’s task is not Mathematical Logic and Programming just to write down a program, but that his Languages, International Series in Computer main task is to give a that Science, Prentice-Hall, 1985. the program he proposes meets the equally formal functional specification. [S] Prather, R.E., “A Freshman-Sophomore [41 Curriculum Integrating Discrete and Continu- ous Mathematics,” in A. Ralston (ed.), Sloan The that permeates computer Foundation Discrete Mathematics Programs, science is the language of predicate logic. It’s a MAA Notes, 1989, to appear. very difficult subject for which we should not rely on self-study. We should teach it.

26