I have been wondering, is computer science a branch of mathematics? No one has ever adequately described it to me. It all seems very math-like to me. My second question is, are there any books about computer science/programming that are very rigorous and take an axiomatic approach? Basically, putting computer science and programming on a rigorous foundation.

  • 44,071
  • 8
  • 68
  • 157
  • 13,340
  • 4
  • 16
  • 44
  • 89
    If this was put to a vote, I'd probably be the only one voting that mathematics is a branch of computer science. – DanielV Jan 24 '14 at 00:28
  • 17
    @DanielV: I don't think you'd be the only one. – leftaroundabout Jan 24 '14 at 00:33
  • 1
    Algorithms and Mathematics are both based on Logical foundations. They are not the same, but they are related. – Lucian Jan 24 '14 at 01:19
  • 9
    @user107952 : yes, _theoretical computer science_ is practically a branch of mathematics. Check out their Stack Exchange. It is mostly concerned with studies of algorithms. There are oodles of books on the subject. One famous book is Papadimitriou's _Computational Complexity_, but it might not be the best place for a beginner to start. – Stefan Smith Jan 24 '14 at 02:36
  • 2
    I'm not sure if I should vote to close this question because it belongs in http://cs.stackexchange.com/ – Elchanan Solomon Jan 24 '14 at 02:47
  • 9
    @IsaacSolomon: Couldn't they vote to close saying this question belongs in math.stackexhange.com? – RghtHndSd Jan 24 '14 at 02:49
  • 6
    http://xkcd.com/435/ – Bob Jan 24 '14 at 03:19
  • 5
    Do you seek a philosophical answer? – Paul Jan 24 '14 at 04:56
  • 1
    "Concrete Mathematics: A Foundation for Computer Science (2nd Edition)" would be my suggestion for another book showing how Math can be a foundation for Computer Science. – JB King Jan 24 '14 at 06:10
  • 2
    I believe in the logic of the Dewey Decimal Classification that places *Computer science, knowledge & systems* at 000, (http://dewey.info/class/00/2009-08/about.en) above *Mathematics* at 510 (http://dewey.info/class/510/about.en). – Kris Jan 24 '14 at 07:44
  • 1
    For other part, I think you need to look at CS and programming separately. – Kris Jan 24 '14 at 07:47
  • 1
    *meta*: Why am I unable to find 'Post Your Answer' on this page? – Kris Jan 24 '14 at 07:51
  • 1
    @kris see the protection notice below these comments – AakashM Jan 24 '14 at 09:25
  • 3
    @DanielV How is mathematics a branch of computer science? – k.stm Jan 24 '14 at 10:53
  • @AakashM I have a rep. of 101 on this site as of now. – Kris Jan 24 '14 at 12:38
  • 1
    I suggest you this article by Vincent Cerf "Where is the Science in Computer Science" http://cacm.acm.org/magazines/2012/10/155530-where-is-the-science-in-computer-science/abstract – Matteo De Felice Jan 24 '14 at 12:59
  • As a computer scientist writing a Ph.D. on Requirements Engineering, I could argue that computer science is in fact a branch of social sciences, not mathematics :P – rumtscho Jan 24 '14 at 13:26
  • 1
    While the first question is *somewhat* opinion-based, the second question is not at all, and it seems that the core of the question is not asking about an opinion, but rather about to what extent computer science can be studied in a mathematical context. Voting to reopen. – 6005 Jan 24 '14 at 14:06
  • 1
    It's not even science. Science `is a systematic enterprise that builds and organizes knowledge in the form of testable explanations and predictions about the universe`. When does CS does that? – user13107 Jan 24 '14 at 14:11
  • 2
    @Kris The association bonus doesn't count for protected questions, you must have earned $10$ reputation _on the site_ to be able to answer. – Daniel Fischer Jan 24 '14 at 14:14
  • 2
    Academically, computer science is now a field in its own right. In the UK most comp sci departments started as a branch of applied mathematics. In the US most started as a branch of electrical engineering. A good book about the theoretical foundations of programming is "Introduction to Algorithms" My copy is nearly 20 years old and very dog eared :-) –  Jan 24 '14 at 14:58
  • 1
    From an upcoming book: In 1983, Richard Feynman asserted that giving up “natural” meant you had to give up “science” too, saying: “Computer science also differs from physics in that it is not actually a science. It does not study natural objects. Neither is it, as you might think, mathematics.” 20 years earlier, he argued that mathematics can't be a natural science because “The test of its validity is not experiment.” Feynman’s assertion is ironic because typical working programmers, unlike most computer scientists, spend a great deal of time validating their hypotheses by experiment. – Ron Burk Jan 24 '14 at 15:04
  • 1
    @paj28, I live in the US; my father (now-retired computer scientist) along with a number of my CS professors in university majored in applied mathematics when they went through school. – Brian S Jan 24 '14 at 15:16
  • Definitely not. Computer Science touches almost every other science, including social sciences. – DejanLekic Jan 24 '14 at 15:22
  • 3
    While computer science may be primarily focused on the algorithmic side of things (partly for historical reasons), actual programming and all the sorts of thinking involved in doing it well has at least as much to do with art and linguistics. You could argue that mixing paints is a branch of chemistry, but you'd never say that painting is basically a branch of chemistry. That's the same sort of thing going on here. – iconoclast Jan 24 '14 at 16:01
  • @RonBurk I guess Feynman thought String Theory was not actually science either, since for it too "The test of validity is not experiment." (I'd probably agree with that) – RBarryYoung Jan 24 '14 at 16:48
  • 3
    Nobody agrees on what Computer Science really is, so the question does not have an answer. In my experience, mathematicians who claim that CS $\subset$ Math have a very limited view of CS (only TCS, often even just Computability and Complexity Theory). In truth, CS intersects with social sciences, (several branches of) engineering and mathematics, and has managed to create some "own" problems (arguably, an example are compilers). It's in many ways like physics: use math to create models, do physics/CS, fuel engineering. – Raphael Jan 24 '14 at 17:05
  • @Kris - Is this dewey index a joke? Looks like a classification of things from the middleages. For sure computer science is a science. – Zane Jan 24 '14 at 17:19
  • 1
    The real question is "Is mathematics just a branch of computer science?" :) – JamesRyan Jan 24 '14 at 17:25
  • 117
    __Everything is a branch of mathematics.__ – Lance Roberts Jan 24 '14 at 18:59
  • 5
    Just because something uses a bunch of math does not make it a branch of math... otherwise physics would be a branch of math. – Albert Renshaw Jan 24 '14 at 19:05
  • In politician words: – magallanes Jan 24 '14 at 19:09
  • 2
    Fundamentally yes, because Mathematics is the mother of all Sciences. Computer science is an extension of ideas of mathematics , logic , truth, computation , algorithm, physics, sociology, biology, and what not. It has today become really hard to define the boundries of computer science. @Lance Roberts True, in fact, everything seems to be deeply interconnected.. – SJan Jan 24 '14 at 20:03
  • 3
    In mathematics, $\lim_{x \to \infty}\log(x)=\infty$. In computer science, $\forall x \in \mathbb{R}: \log(x)<20$ ... – Dunno Jan 24 '14 at 20:52
  • As a mathematician and a computer scientist, I think it is a branch of mathematics. At the same time, it has evolved on its own accord and is a separate discipline. – vertical.void Jan 24 '14 at 21:31
  • 1
    *everything* is a branch of [mathematics](http://imgs.xkcd.com/comics/purity.png) – MDMoore313 Jan 24 '14 at 22:54
  • With regards to putting programming on a rigorous mathematical foundation, look into functional programming. – jpmc26 Jan 24 '14 at 23:24
  • 2
    @user1310 So, is Maths a science? – jinawee Jan 24 '14 at 23:25
  • @Zane No, the Dewey Decimal Classification is a serious scientific taxonomy. http://dewey.info – Kris Jan 25 '14 at 14:03
  • @Dunno: No, it's not. At least if you ask computer scientists that try to uphold some measure of mathematical thinking. – Raphael Jan 25 '14 at 15:45
  • This question is a bit off topic on this forum. But I think Computer Science is NOT a branch of Mathematics. Pure mathematicians do NOT need a computer to work. They only need a pen, a piece of paper, and a smart brain to work :) Also Mathematics as a field has been an academic field for more than 4000 years which is long long before CS is considered a subject. – tonga Jan 25 '14 at 22:37
  • 1
    I'm surprised no one linked this before: http://abstrusegoose.com/544 – tomasz Jan 26 '14 at 00:25
  • 1
    "All science is either physics or stamp collecting." – michael Jan 27 '14 at 03:23
  • If we say that all practical computer programming is part of “software engineering” rather than “computer science” -> it would be easy to say that “computer science” is just maths with a different way of writing it down. “computer science” has so little to offer the professional programmer on a **day to day** bases, it might as well be maths. – Ian Jan 27 '14 at 09:22
  • Computer "science" is a branch of trial and error. Mostly error. – Steve Jan 27 '14 at 16:32
  • When a professor insists computer science is X but not Y, have compassion for his graduate students. - Alan J. Perlis – Jay Feb 28 '14 at 04:15
  • 1
    http://ncatlab.org/nlab/show/computational+trinitarianism – Urs Schreiber Sep 10 '14 at 18:02
  • Computer Science can be considered an abstraction of mathematics, yes. But it also heavily relies on concepts in linguistics (natural language parsing) and philosophy (logical constructions). Some might think that logic is simply math, but that gets into the whole "everything is math" argument. – Anthony Sep 11 '18 at 19:35
  • The American Mathematical Society considers Computer Science a field of mathematics. https://mathscinet.ams.org/msc/msc2010.html – eric.mcgregor Mar 28 '19 at 01:10

13 Answers13


Theoretical computer science could certainly be considered a branch of mathematics. This branch of computer science deals with computers and computer programs as mathematical objects. Theoretical computer scientists could be described as computer scientists who know little about computers.

However, when people say "computer science" they usually include many things which would not be considered mathematics, for instance computer architecture, specific programming languages, etc.

Bruno Joyal
  • 52,320
  • 6
  • 122
  • 220
  • 6
    This usually doesn't lead anywhere, but, perhaps the downvoter would care to leave a comment so that I can improve my answer? – Bruno Joyal Jan 24 '14 at 04:56
  • 101
    I remembered this quote which I read somewhere: "Computer science is as much about computers as Astronomy is about telescopes" – Kartik Jan 24 '14 at 09:38
  • 4
    TCS doesn't only speak about algorithms, Turing machines and automata. In a TCS Masters program in France, one also learns about combinatorics, logic, and model theory! – zarathustra Jan 24 '14 at 10:48
  • 12
    @Kartic -- Edsger Dijkstra – OrangeDog Jan 24 '14 at 10:57
  • 17
    @SpYk3HH I've done my share of coding, thank you. How much math have you studied? (Not that it's relevant.) Mathematicians have a different conception of what "math" is (it certainly isn't "long word problems"). In any case, I am happy that you are such a proficient programmer. – Bruno Joyal Jan 24 '14 at 14:41
  • 3
    @MichaelJoyce Wasn't there a one-character answer with over 150 upvotes? I forgot what it was... But it was hard to beat! – Bruno Joyal Jan 24 '14 at 16:09
  • 5
    @Kartik I personally prefer this quote: "Programming is to CS as painting is to geometry.". – obi Jan 24 '14 at 18:04
  • The most succinct description of computer science that I have ever heard was the motto of one of my CS professors: "Computer Science is problem solving." – NemesisX00 Jan 24 '14 at 21:23
  • 19
    @NemesisX00 Yeah, but so is figuring out when to turn right on red. That's about as specific as saying "Computer Science is doing stuff." – 3Dave Jan 24 '14 at 22:02
  • 4
    It's funny that you should mention programming languages because programming language theory is the part of CS that is probably the most like math--even more so than TCS. In fact, when you study programming languages, it quickly turns into studying formal logic. After all, something like type theory is foundational for both CS *and* mathematics. – Tikhon Jelvis Jan 25 '14 at 02:51
  • If TCS includes algorithms and data structures, then it's definitely not a branch of mathematics. While many researchers concentrate on theoretical algorithms and data structures, which are close to mathematics, other approaches to studying them are closer to engineering and natural sciences. – Jouni Sirén Jan 25 '14 at 03:27
  • 2
    @TikhonJelvis: when one is abstracting programming languages and studying their property (with control, with side-effect,...), you eventually talk about semantics and models (game semantics, coherent spaces, ...). When Bruno Joyal says "specific programming languages", I think that he means C, Java and so on, which is absolutely not mathematical, nor related to Löf's type theory. – zarathustra Jan 25 '14 at 06:25
  • 3
    _computer scientists who know little about computers._ — It would be more accurate (and less insulting) to say "computer scientists who **care** little about computers", but even that would be an exaggeration. – JeffE Jan 25 '14 at 20:51
  • 1
    if one wanted to be terse, Comp Sci is more about computing than computers. – barlop Jan 26 '14 at 16:04
  • 1
    @JeffE It was a tongue-in-cheek, I wasn't being serious. I didn't mean to be insulting! But I apologize if you were offended. – Bruno Joyal Jan 26 '14 at 17:09

Let $C$ and $M$ be the set of all things which are considered "computer science" and "mathematics", respectively. If I understand you correctly, your question is: Is $C\subset M$?

If this is the case, your question is not well posed because neither $C$ nor $M$ are well defined. How do you draw the line between what is math and what is not math without ambiguity? No reasonable answer can be given if you try to treat them as sets.

However, I do believe that $C\cap M\neq \varnothing$ because certain aspects of both "sets" are shared, as others have pointed out (e.g. logic, proofs, etc.)

  • 1,975
  • 2
  • 20
  • 35
  • 58
    Most things in life are not well-defined and therefore most questions we ask are not well-posed, but they're still worth asking. :) I would say $C \not\subset M$ because computer science asks questions such as "What computations are feasible in universe?" that depend on physical laws, not just abstract mathematics. – Jair Taylor Jan 24 '14 at 08:15
  • 5
    I love how you can express statements so precisely with Sets. – Aditya M P Jan 24 '14 at 08:43
  • 2
    is the 'subset' relation the same as a 'branch'? I think your answer is an oversimplification and equates 'subset' with 'branch' when it shouldn't. – sashang Jan 24 '14 at 10:12
  • "certain aspects of both "sets" are shared" -- you can go further I think, certain content is shared. For one example, the connection between Turing's work on the halting problem and Goedel's incompleteness theorems isn't merely an application by Turing of mathematics to some applied end. Rather the theoretical computer science he did *is* mathematics, just as physicists who invent fancy n-dimensional manifolds and investigate their topologies sometime are doing novel mathematics. – Steve Jessop Jan 24 '14 at 10:14
  • @sashang C and M are not "Computer science" and "Mathematics", but "all things which are considered ...". Paul's Theorem states that every "branch of x" deals with and only with things which are considered x. So, if computer science deals with "things which are not considered mathematics", it can't be a "branch of mathematics". – Alexander Jan 24 '14 at 11:14
  • @Alexander: Oh. I didn't realize that the set of all things considered computer science was not computer science. That's new to me. – sashang Jan 24 '14 at 12:00
  • 2
    Your break down, while seemingly logical, is far overanalyzed and ignores the fact that *`computer science`* has a definition. By standard it is *`the study of the principles and use of computers`*, however a full logical breakdown will show you it is more of the *scientific* approach to computed calculation or information processing, thus still leaving it heavily indoctrinated with math. To define the term by its individual word meanings is like defining a flower by only it's petals and pistols, independently. It just doesn't make logical sense. – SpYk3HH Jan 24 '14 at 14:07
  • 1
    @SpYk3HH I agree. There is a point where reductionism becomes fruitless. – Apprentice Queue Jan 24 '14 at 19:12
  • @SpYk3HH: The point is that the lines are blurred nonetheless, in spite of what most people believe of both subjects. – Paul Feb 13 '14 at 02:38
  • @sashang: It is difficult to say one way or another if this is an oversimplification or not without establishing a rigorous and unambiguous definition of the word "branch" as it is applied by the OP's question. If you can provide such a definition, I can respond to your "oversimplification" claim more adequately, one way or another. – Paul Feb 25 '14 at 14:03
  • @ApprenticeQueue: Isn't all mathematics essentially a collection of reductionist arguments? – Paul Jun 21 '14 at 01:42

I think your first question has been answered eloquently by others here. I'd just like to add a group of references for your second question. As a math major / CS minor, I was taught CS by people in "Dijkstra's school", which I would consider more rigorously grounded in mathematics than Knuth's. To get a taste of Dijkstra's ideas, you can read all his articles, letters etc., in all their glorious idiosyncrasy, at http://www.cs.utexas.edu/users/EWD/; a favourite of mine is The notational conventions I adopted, and why (EWD1300). An excellent introduction to his view of programming and computer science is:

This was the foundational book for me - really the only CS book for first year university. Kaldewaij is Dijkstra's academic grandchild, by the way.

I believe the following book may have similar content:

Erik P.
  • 521
  • 4
  • 3
  • 3
    I think a better (smoother), modernized version of Kaldewaij and Dijkstra's work is Eric Hehner's [a Practical Theory of Programming](http://www.cs.utoronto.ca/~hehner/aPToP/). – bzm3r Jan 26 '14 at 05:52
  • +1 for the UT shout out. – Anthony Sep 11 '18 at 19:30

It is not uncommon to hear ideas along the lines that

  • computer science is computer programming without practical constraints

  • theoretical computer science is computer science without physical constraints

  • mathematics is computer science without finiteness constraints

Each subject in the chain is seen as a limiting case of the one before, where some parameter describing constraints or resource limits goes to zero or infinity. From this point of view, mathematics is degenerate special case of theoretical computer science, which is a degenerate case of computer science, which is ...

  • 34,340
  • 3
  • 43
  • 106
  • 2
    TCS considers asymptotics of finite processes. It does not, for example, use (usually) the concept of an computation process that produces its output after infinitely many steps. But the latter is standard in mathematics. Asymptotic analysis is essentially inductive proofs of inequalities that hold for all finite $n$ and it is rare for this to require anything more than Peano Arithmetic (ie, a theory of finite sets). – zyx Jan 24 '14 at 03:09
  • 2
    "From this point of view, mathematics is degenerate special case of theoretical computer science" -- or another way, theoretical computer science is mathematics *with* finiteness constraints and hence the relationship is the other way round. Depends whether you treat infinity as an actual thing (in which case TCS is the subset) or just an axiom in the manipulation of finite formulae (in which case mathematics is) :-) – Steve Jessop Jan 24 '14 at 10:19
  • Further, with hindsight you can restate the Entscheidungsproblem informally as, "is mathematical truth computable?". Then suddenly the foundations of mathematics are a CS problem because proof is a mechanical process. – Steve Jessop Jan 24 '14 at 10:30
  • 1
    The constraints are not additional axioms in the same language (which would lead to the subset/superset phenomenon as you mention, where things can be viewed from either side), but an enlargement of the language to model a richer set of phenomena that are ignored in the constraint-less setup. The relation between mathematics and TCS in this sense is not a subset but a quotient space. TCS distinctions are erased since e.g. mathematics does not traditionally distinguish between functions that are equal but computed by different algorithms. @SteveJessop – zyx Jan 24 '14 at 11:40
  • @zyx: sure, it depends how you choose to map between CS and mathematics whether one is immersed in the other ;-). You might choose to consider a function/procedure to be a mathematical function resulting in the return value. Or you might consider it to be a function resulting a the sequence of program state transitions involved in executing it. You get different distinctions according to your choice, and I suppose if someone was trying to come to a specific conclusion they might choose to argue that if you do the latter then you're "doing CS" as opposed to "doing mathematics". – Steve Jessop Jan 24 '14 at 11:52
  • Another point of view is the idea that goes under terms like "theory of the empty set" or "pseudogenerality", where the more constrained discipline views the part of the relaxed discipline that does not apply (even hypothetically) in the constrained situations as being a logical development of things that can never be realized. The issue of course is how much of the more speculative activity is needed in order to eventually broaden the scope of the realistic activity, through discoveries that *might* be easier to make in a looser framework. @SteveJessop – zyx Jan 24 '14 at 11:58
  • 1
    Some branches of CS do deal with infinite processes. For example, infinite data structures come up in PL research and we end up with a bunch of tools for dealing with them like coinduction and bisimulation. Similarly, we also deal with models for continuous sets. This comes in FRP, for example, where the semantics are based on continuous time. – Tikhon Jelvis Jan 25 '14 at 02:46

I would say that computer science is a branch of mathematics.

Donald Knuth is a famous computer scientists and is also considered a great mathematician. He wrote a series of books called "The Art of Computer Programming" which is extremely rigorous and mathematical.


To make my position more clear since it is apparently controversial.

Almost all of computer science is about answering two questions: "What can a turing machine do?" and "How do we make a turing machine do X?". A Turing machine is an abstract mathematical object and any question about Turing machines or their capabilities will be mathematical in nature.

Now, we have implemented Turing machines in various ways (e.g. your PC), but the details of the particular implementation are the subject of computer engineering, not computer science.

  • 2,318
  • 15
  • 31
  • 11,570
  • 3
  • 33
  • 63
  • 71
    Vanessa Mae is a famous violinist, and also an olympic alpine skier. Would you thus say music is a branch of sports? – leftaroundabout Jan 24 '14 at 00:24
  • 24
    I mentioned Donald Knuth not as proof that computer science is a branch of mathematics but to answer the OP's second question about a book which has a "very rigorous axiomatic approach to computer science/programming". – Spencer Jan 24 '14 at 00:27
  • 16
    I don't think a turning machine has anything to do with Human Computer Interaction. Nor does it have much to do with system design. I think you are tacitly assuming "computer science = theoretical computer science". – RghtHndSd Jan 24 '14 at 02:46
  • @PeterSheldrick: Perhaps, depending how your read the OP (two independent questions, or does the second question give context to the first?). But when making any assumptions, they should not be made tacitly. – RghtHndSd Jan 24 '14 at 03:24
  • The first part of OP's question is largely opinion based which is why my phrasing was "I would say that..." rather than "It is..." to emphasize that I was expressing an opinion. I still stand by my *opinion* but I do concede that the lines get blurred where Computer Science and Computer Design/Engineering start to overlap. My main purpose in answering was to inform OP about Donald Knuth's books which I feel are exactly the sort of books he was looking for. – Spencer Jan 24 '14 at 04:35
  • 2
    I could be wrong, but I think that most of computer science is not about "What can we make a Turing machine do?" so much as "how quickly can we make a Turing machine do it?" That is, complexity theory, not computability, tends to be first and foremost. Admittedly, I know next to nothing about the subject matter. – goblin GONE Jan 24 '14 at 09:41
  • 1
    @leftaroundabout: that's such bad logic. – sashang Jan 24 '14 at 10:02
  • 4
    Technically your PC isn't a Turing machine, as it does not have infinite storage. – OrangeDog Jan 24 '14 at 10:58
  • @sashang: oh yeah, my bad, I shouldn't have assumed skiing to be a branch of sports. Let's formulate that weaker: _would you say music is a branch of skiing_? – leftaroundabout Jan 24 '14 at 11:42
  • computer science does not only deal with Turing machines. There is also a lambda calculus. – akonsu Jan 24 '14 at 12:27
  • 1
    "Almost all of computer science is about answering two questions: [...]" -- If that was to mean "how to do stuff with computers" it would be a true statement, but completely useless (and in that way typical for a mathematician?). CS deals with many more problems, e.g. "how to route packages in a network that constantly changes?". That's quite far outside the usual hunting ground of mathematics. – Raphael Jan 24 '14 at 17:00
  • @leftaroundabout I'd say music and sports are both branches of applied mathematics. :-) – corsiKa Jan 24 '14 at 18:04
  • Computer Science also studies Social Engineering to some point. I'd love to see an argument whether Social Engineering is purely mathematical or not. Oh and my degree also involved some courses on process management, friendly user interfaces, ethics and copyright law. Not very mathematical now, are those? – Geeky Guy Jan 24 '14 at 18:38
  • 12
    @corsiKa http://xkcd.com/435/ EVERYTHING is applied mathematics, from some points of view ;) – Geeky Guy Jan 24 '14 at 18:42
  • @Renan that was the in-joke, yes. – corsiKa Jan 24 '14 at 21:41
  • @Renan: I fear for the world in which mathematicians read "ordered by purity" as "ordered by inclusion". – Raphael Jan 25 '14 at 15:47
  • @Renan, http://abstrusegoose.com/544 – Spencer Jan 26 '14 at 00:52
  • 1
    @leftaroundabout Only if she can ski and play violin at the same time. – Anthony Jan 26 '14 at 14:49

That depends on whether you consider software engineering to be computer science. I don't. The theory of computation is absolutely a branch of mathematics, and one of the most difficult. Forget P vs. NP, we can't even decide the Collatz conjecture, which can be understood by the average third-grader in a minute or two.

On the other hand, software engineering is applied psychology: how do we economically build and maintain complex software systems, given the limits of human intellect?

kevin cline
  • 401
  • 2
  • 7
  • 2
    Many people would not consider the Collatz conjecture a part of computer science. – Jeppe Stig Nielsen Jan 24 '14 at 10:59
  • 8
    @JeppeStigNielsen: Why not? Is the halting problem a part of computer science? The Collatz conjecture is about a computation, and illustrates that the halting problem is more than just a theoretical curiousity. – kevin cline Jan 24 '14 at 15:22

If you create a Cayley graph of a group, is that mathematics? What if you simulate the orbit of an element from the group? Where do mathematical models cease to become mathematics? The natural numbers still behave the way they do in an accurate model of them when the model isn't being used by any person. The sole purpose of a computer is to model mathematical objects.

The goal of computer science is to construct or describe a model of mathematical objects, even if there's no implementation of them on any computer or way to get the result that the program is to compute.

Algorithms, ironically, are the aspect of computer science that has the most influence on other fields of mathematics.

A simple case is if you determine an algorithm's time complexity to be too great to actually implement, that is still a contribution to computer science. On the other hand, if you show two constructions are equivalent, say the clique decision problem and factoring large numbers, and there's an algorithm to do one of those things which is of lower time complexity, there must be an algorithm of that same complexity for the second property. The question is, how much information you can avoid obtaining about one problem from the information in the solution or exhaustion of another? The time complexity of an algorithm is an invariant measure of it that gives you a feel for how hard a problem is. When two problems are not equally hard, complex, or time consuming, the harder one cannot be solved using just the easier one's solutions (without those solutions being processed by an algorithm that closes the difference in complexity in the total algorithm). Studying different problems and their time complexities, you see how the genericness of a problem relates to its difficulty to be solved in general. It's also useful to see, for example, logic gates implemented as the solution to a game of Minesweeper, because it shows you what the properties of a Turing-complete system look and feel like.

However, these things can also be deceptive: Initially it might look like you must check every permutation of a type of object to find out what the subset of those permutations satisfy a property, which indicates a hard problem if those permutations grow quickly, say, with the size of the set of permutations. However, it might have a second stage where there's a saturation of independent information and the permutations tried no longer contribute just themselves to the solution of the problem, or else are all determined by the amount of information collected. Like reaching that minimum 3 points to determine a circle.

There are also theorems that characterize the type of data that are viable members of the search space. This is sort of a Mandelbrot program - use your eyes to see what solutions to the problem look like, find a way to enforce those characteristics, and show that they hold for all possible solutions. A good example of this is with projective planes, where the incidence diagrams for finite planes don't have enough symmetry to decide whether even large groups of arrangements which form partial matches are viable pieces of the incidence diagram or not, leading most algorithms to require orders of magnitude beyond the age of the universe to determine the projective planes of a given order, and even those that have managed to find a second stage require massive amounts of searching and weaving of the data together over years of actual runtime to come to a conclusion. The picture I'm painting here is not a success story, it's the reflection of a real lack of understanding of what incidence diagrams for projective planes are like, what rules govern them. An understood object should have an algorithm from the examination of which one can understand the difference between that object and pure noise, a strategy which works well enough to make guesses about the nature of the solutions. So are projective planes' incidence diagrams pure noise? Looking at the incidence diagrams for small planes, they look very distinctive, so the suggestion is that the typical plane looks nothing like any known plane. But in fact, that overall pattern can be induced in a binary matrix, and is shown to hold in planes in general, which means it's possible, starting from that characterization, to greatly reduce the problem's search space. Hence, characterizing the search space of a hard problem is a lot like characterizing the object itself through invariant properties.

I would say that problems relate to their complexity in much the same way as the positions of elements of an infinite set of natural numbers relates to the set's density.

But what is an algorithm? What is a program?

I refer you to Wikipedia for Martin-Loef type theory and Calculus of Constructions for some specific implementations of computation. For full coverage, Practical Foundations for Programming Languages (Harper). For a treatment of domain theory I refer you to Domain Theory in Logical Form (Abramsky).

One answer, given in domain theory by Scott domains, is that the logical structure of a program, as a space of properties and inferences, is like a lattice of subalgebras or normal subalgebras of an abstract algebra that doesn't need a head or abstract algebra containing them all, just a forked or flawed crystal converging to the space where it would be, and that to formulate recursive definitions of program logic is to find the fixed points of the endomorphisms of this order structure, which are equivalent to continuous maps onto itself of a topological space derived from this unfinished lattice. The Stone dual of this is the executed program operating according to this logic, which is a locale whose points are the algorithms. In actual domain theory you have to generalize this a bit, because Scott domains don't form a cartesian closed category, meaning they aren't enough like a topos for programs represented by Scott domains to be arbitrarily expressive.

All of this is a buried version of Lawvere's famous statement that there's a Galois connection between syntax and semantics. More specifically, between a theory and models of the theory, or between a logic and the space of computations it performs (denotational semantics).

On the other hand, there is the relationship between constructions of an object and proofs of a theorem. I don't know if this is the exact reasoning, but if you think about it if propositions can be converted to existential, simultaneously holding properties, then in aggregate they describe a kind of object whose definition is the thing which simultaneously holds those properties, so that to prove those propositions true is to prove the type is occupied by some actual thing. The Curry-Howard correspondence is a proof that proofs are equivalent to programs or constructions, and more generally that intuitionistic logics correspond to typed lambda calculi, and thence to cartesian closed categories (which agrees with how, for logicians, a topos is just the categories of sets for an intuitionistic logic). This affects language design quite a bit, because it provides a means of computing with proofs instead of algorithms. It is the basis for the philosophy of Homotopy Type Theory (Univalent Foundations Program), as well as much of intuitionistic logic and computer science.

There is some degree of interplay between linear logic (i.e. noncommutative geometry) and computer science here. Physics, Topology, Logic and Computation: A Rosetta Stone (Baez, Stay) shows that if you replace cartesian closed categories with closed monoidal categories, you can generalize the Curry-Howard isomorphism to get all sorts of wonderful quantum behavior and semantics. Stone duality features again in the study of Chu spaces, which are a model of linear logic that is ultimately pretty similar to Domain theory in effect.

So, if all this applies to intuitionistic logic, what's classical logic? It turns out certain implementations of continuation passing, like call/cc from Scheme, as well as introducing control flow passing or procedural programming into purely functional language like Haskell amounts to making it a nonconstructive logic. The thing that makes Haskell so bothersome (many say outright useless) is that you can't make a program communicate with the outside world or depend on outside communication, even runtime-dependent parameters, without full-stop breaking the format of the language to talk in procedures with the so-called IO monad, or else destroying all the built-in logic that verifies your program behavior. So the lesson is that non-constructive mathematics is like an interactive program, and constructive mathematics is like a library.

Loki Clock
  • 2,113
  • 11
  • 13
  • 12
    "We apologize for the confusion, but we can't *quite* tell if you're a person or a script." – Loki Clock Jan 24 '14 at 09:31
  • Incidentally, it wasn't until the last year or two of learning about measure theory and some of its applications that I realized what made proofs about bounds, densities, or distributions mathematics and not just statistics. – Loki Clock Jan 24 '14 at 09:43
  • 3
    I did not criticize computer science, the internet, or masturbation. I criticize your philosophic post which conveys nothing to the reader despite the use of a thousand words. It was written for your pleasure only. – Apprentice Queue Jan 25 '14 at 06:53
  • @ApprenticeQueue What it was meant to convey was the relationship between computer science and the rest of mathematics in areas selected to give the basic scope of the field, where possible using topics I've studied myself so that I could provide references I was confident to recommend, together with references on topics that I might not know all about, but which might be of interest to both mathematicians and those interested in the foundations of programming. Do you feel that I didn't accomplish this, or do you think this is not the way to go about addressing the question? – Loki Clock Jan 26 '14 at 00:10
  • I decided to remove the last 2 paragraphs, because they were really responding to comments and not the question. I left them in because I felt the reply needed a conclusion of some kind. – Loki Clock Jan 26 '14 at 00:13
  • 2
    @ApprenticeQueue I think you're on to something here: the internet is a branch of computer science, which is a branch of mathematics, which is a branch of pleasure, which is a branch of masturbation. Everything is therefore a branch of masturbation, the internet being the most pure form. – michael Jan 27 '14 at 03:45

Any science, whether it is physics, computer science, or statistics, is driven forward by a combination of engineering "this usually works" and mathematics "this can be proved to be true under certain assumptions".

I would say there is mathematics in computer science, but computer science has elements which are not yet mathematics.

  • 142,043
  • 9
  • 114
  • 228

Is Computer Science a branch of mathematics?

In my opinion it is not. It's true that it uses nearly every aspect of mathematics. And heavily depends on Logic. But the questions posed are way different then the ones in mathematics.

In mathematics you normally try to understand the structure of objects and try to categorize them. Mostly it is totally unnecesairy if they are easy to compute or not. For example the Algorithm for a determinant of a $n\times n$ matrix is given by $\sum_{\sigma \in S_n} a_{1\sigma(1)}\cdots a_{n\sigma(n)}$ this formula is highly usefull in mathematics, calculating this is nearly impossible with $|S_n| = n!$. So this formula says a lot about the structure of matrices but it says nothing about how to compute it.
So the main work of a mathematician is bending your brain till you got a prove for your problem.

You got these kind of problems in computer science too. But normally you want a solution that is fast and precise not perfect. It does also contain parts like Software engineering which are not mathematical at all.
Or the theory behind building a computer which is part of eletrical engineering.
Also it needs a lot of parts of mathematics in various areas without really needing the tiny proves and lemmas and axioms you depend on in math.

For me it's like physics, all written down in the language of math. But still knowing math will not help you at all! I mean you could also ask if chemistry is just part of physics as it heavily relies on it. Or biology beeing part of chemistry because it also heavily depends on it.

But I guess there are a lot different opinions. I always felt that I have to bend my brain differently if I want to solve problems in computer science. And that a lot mathematicians can't really programm at all!

Is there a good axiomatic Book

I've never read it myself but "The Art of Computer Programming" from Donald Knuth was often noted to be very good! Althought it is quite old.

  • 675
  • 3
  • 9
  • 5
    "But the questions posed are way different then the ones in mathematics." This is simply not true. How does a theorem such as the [Halting theorem](http://en.wikipedia.org/wiki/Halting_problem) fit into your answer? It *is* mathematics, and deep mathematics at that. – Bruno Joyal Jan 24 '14 at 02:10
  • @PeterSheldrick I'm not offended at all. It seems I interpreted your comment as meaning the complete opposite of what you had in mind. Perhaps it's just me, in which case I'm sorry! (Perhaps a link to [Poe's law](http://en.wikipedia.org/wiki/Poe%27s_law) is in order.) – Bruno Joyal Jan 24 '14 at 02:37
  • @BrunoJoyal Obviously I was not refering to the parts of computer science which are plain mathematics. – mjb4 Jan 24 '14 at 15:23

For a rigorous approach inspired by Bourbaki, you may be interested in Alexander Stepanov and Paul McJones's Elements of Programming (2009).

It works with a subset of C++, and proves various interesting theorems. But not all propositions have proofs (e.g., the first two lemmas do not have proofs given).

The authors apparently wanted to work in the "Axiomatic method", which seems to be the OP's interest...

Alex Nelson
  • 1,178
  • 6
  • 16
  • 1
    Books such as Hopcroft and Ullman ("Introduction to Automata Theory, Languages, and Computation"), or Li and Vitanyi ("An Introduction to Kolmogorov Complexity and Its Applications") are also quite rigorous. But the question is not very clear what exact material the question is asking about - "computer science" is not on its own a topic of a book. – Carl Mummert Jan 24 '14 at 17:10
  • @CarlMummert: true, but I figured everyone else would give rigorous books related to the formal field "the theory of computation", like the ones you noted. So, I wanted to just note there's a programming book that uses the axiomatic method :) – Alex Nelson Feb 04 '14 at 00:12

I say that computer science is a branch of mathematics, but it has many branches connected to other sciences or fields of study as well. Many of the founding contributors to the field were mathematicians. The analogy of a musician to sports has no bearing because the person's sports accomplishments weren't necessarily any by-product of this person's musical talents. Computer science was fostered from mathematical carving.

  • 57
  • 1

Computer Science touches a lot of different areas of study, and Mathematics is one of them.

I would probably reword the idea to say that Computer Science involves Mathematics. Computer Math is a specialized field because the way computers have been designed has created a focus on mathematics involving Base 2, 8 and other number systems, and a focus on Algorithm designed and efficient use of algorithms.

The study of Cryptology is almost 100% mathematics.

I think of Computer Science as Mathematics with a whole bunch of Application and O/S development mixed in.

I think Computer Science is really a Branch of Engineering. Now whether Engineering is a branch of Mathematics, or whether Mathematics is a branch of Engineering will entirely depend on your perspective and your definitions of both. Because Mathematics is a system of tools, or an abstracted view of accounting for things, I would say Math is more of a branch of Language, and a tool for Engineering and Science.

  • 149
  • 2
  • 5
    Engineering isn't mathematics. Engineering is "find a good enough way of doing foo in practice" (for some fuzzy definition of "good enough"). Mathematics is (supposed to be) about rigurous, logical proof relating completely abstract objects. – vonbrand Jan 24 '14 at 13:17

the two fields of CS and mathematics are becoming increasingly intertwined especially on the theoretical side and once "more sharp" boundaries are getting blurred by various active/ongoing research programs and developments, and one would expect this trend to continue and heighten gradually over the long term, this century. possibly a whole essay, paper or book could be written on this subject. some examples/highlights where there are strong connections or overlap:

  • 774
  • 6
  • 15