13
$\begingroup$

I can understand the importance that computer scientists or any software development related engineers should have understood the study of basic logics as a basis.

But is there any tasks/jobs that explicitly require the knowledge about these, other than the tasks that require any kind of knowledge representation using Knowledge Base? I want to hear the types of tasks, rather than conceptual responses.

The reason I ask this is just from my curiosity. While CS students have to spend certain amount of time on this subject, some practicality-intensive courses (e.g. AI-Class) skipped this topic entirely. And I just wonder that for example knowing predicate logic might help drawing ER diagram but might not be a requirement.


Update 5/27/2012) Thanks for answers. Now I think I totally understand & agree with the importance of logicin CS with its vast amount of application. I just picked the best answer truly from the impressiveness that I got by the solution for Windows' blue screen issue.

$\endgroup$
4
  • 4
    $\begingroup$ As I was writing my answer, I found that scope of your question unclear. Are you restricting yourself to CS, or industry, or both, or perhaps lift in general? $\endgroup$ Commented May 2, 2012 at 18:21
  • $\begingroup$ @Dave Clarke Yeah I found that not clear enough too. 1st thing I wanted to know was which industry the literacy of specific logic is required in (, although I appreciate your response just to convince myself that any software related engineers shouldn't skip this subject). $\endgroup$
    – IsaacS
    Commented May 2, 2012 at 19:40
  • $\begingroup$ It would be good if you could change your question to capture what you really are looking for. $\endgroup$ Commented May 2, 2012 at 19:51
  • $\begingroup$ How exactly would one write an if condition without propositional logic? $\endgroup$ Commented May 28, 2012 at 4:04

5 Answers 5

22
$\begingroup$

I tend to like Unification and anything related to it. If you don't know propositional & predicate logic, then you are skipping the basics of logic. If you have an interest in anything listed, then it would be like having an interest in math and skipping addition and multiplication. Logic is not just for AI.

As a practical answer, remember the Intel floating point problem and how you never see them anymore? Thanks to the use of theorem provers they are a thing of the past. Remember the Microsoft blue screen of death. Thanks to SAT solvers, model checking and other logic based solution, they are an endangered species.

$\endgroup$
6
  • 3
    $\begingroup$ endangered species [citation nee— Segmentation fault. Core dumped. $\endgroup$
    – JeffE
    Commented May 4, 2012 at 12:06
  • $\begingroup$ @JeffE If you are looking for a citation, I instead present actual evidence. When was the last time you saw one? :) $\endgroup$
    – Guy Coder
    Commented May 4, 2012 at 12:33
  • 3
    $\begingroup$ I've never seen one. I use a Mac. $\endgroup$
    – JeffE
    Commented May 4, 2012 at 12:37
  • 1
    $\begingroup$ @JeffE Mac's are close-coupled systems, where everything from the machine architecture to application programs are decided by one team/organization. Windows systems are open, where a variety of manufacturers and teams provide solutions that plug together, relying only on the standards and interfaces that have been specified (often loosely and vaguely). They are much more of a challenge to Computer Science. The Microsoft teams that developed the theorem proving/static analysis techniques to do this safely have made fundamental advances to our field. $\endgroup$
    – Uday Reddy
    Commented May 28, 2012 at 7:53
  • 1
    $\begingroup$ @UdayReddy: I don't doubt that Microsoft researchers have made fundamental progress, or that the BSOD is much less common than it used to be. But "endangered species" is unsupported hyperbole; faulty code is not the only source of crashes. $\endgroup$
    – JeffE
    Commented May 28, 2012 at 8:28
21
$\begingroup$

There are extremely deep and pervasive connections between logic and computer science. In understanding what they might be, keep in mind that computer science is also called "information technology" or "informatics", meaning that computer systems capture, process and deliver information. Well, logic is a similar thing. It studies how information is captured in sentences and how it is possible for one statement to be a consequence of another, i.e., how its information content is already present in another statement (or collection of statements). In that sense, logic and computer science are essentially the same discipline, focusing on different aspects. Logicians (Church, Kleene, Turing, Post and their students and colleagues) created the discipline of Computer Science, and many logicians continue to make contributions to Computer Science, most notably Jean-Yves Girard and his students.

Here are some standard applications of logic in Computer Science:

  • The design of digital circuits is entirely based on proposal logic, so much so that its engineers call it "logic design" rather than "circuit design". Even writing a computer program is often thought to involve devising its "logic". (Note that "logic" in the latter sense is an informal idea rather than formal logic, used to refer to the flow on information through the program and whether it is being processed correctly.)

  • Predicate logic and its mathematical cousin, set theory, are used in a variety of computing languages, e.g., the language SQL for relational database queries. There are also programming languages based on logic, called "logic programming languages".

  • Knowledge representation, which you have already mentioned, has many formalisms based on logic. Even if it uses non-logical formalisms, many of them still have a logical meaning, and hence are based on logic.

  • Probabilistic logic, where statements do not have just true/false values, but levels of certainty/uncertainty, is increasingly the foundation for machine learning systems.

  • If you want to formally state what a program does, i.e., giving a program specification, you will end up using some form of a logical language. Indeed, there are many program specification languages, like Z and B, which are based on predicate logic and set theory. There are also specification languages based on equational logic, such as Larch. Computer Scientists often invent new logics to represent the needs of computer science, e.g., Hoare Logic and Separation Logic, or they pick up and develop various underused forms of traditional logics, such as temporal logic and modal logic, and develop them further.

  • If you want to verify whether a program does what it is supposed to do, then you end up using not only the language of logic, but the entire machinery of logic: proof theory, model theory and decision procedures. Verification technology is now growing by leaps and bounds and I expect that, in another decade or so, they would be routinely used for almost all software development.

In fact, the connections between logic and computer science are so deep and pervasive that I would say it is a hard to be a good computer scientist without a thorough understanding of logic.

The reason some AI scientists underrate logic at this time is that some of the early developers of AI had proposed off-the-shelf logic as a tool rather than a foundation. AI, by its very nature, promises to deliver magic. We don't have to do the hard job of programming systems to deliver results. They would be able to figure out on their own how to produce solutions because they would be "intelligent". Logic seemed to point the way because if computer systems understood logic and knew how to process information using the rules of logic, they would be able to deliver magic. That kind of faith in logic was, in retrospect, misplaced. In the first place, off-the-shelf logic is too strong and too weak at the same time. It is too strong in the sense that the rules of logic are too general to devise effective procedures. It is also too weak because it is the logic devised by mathematicians for the needs of mathematics and it doesn't have the vocabulary needed to deal with a lot of other kinds of real-world information that AI systems must handle (such as uncertainty, contextual information like time, change, knowledge, agency and so forth). So, AI is currently undergoing a backlash against logic. But I think that, when they get over that backlash, AI scientists will realize that all the newer methods are still based on logic, broadly construed.

$\endgroup$
3
  • $\begingroup$ Add relational databases! $\endgroup$ Commented May 4, 2012 at 18:51
  • $\begingroup$ Very nice and complete answer, mention to Jean-Yves Girard. Do you consider Probabilistic logic being the same research field as fuzzy logic ? In the literature we meet the two term and I'd like to know if they denote the same research domain. $\endgroup$
    – zurgl
    Commented Mar 8, 2013 at 22:34
  • $\begingroup$ @zurgl. My understanding is that there is no single formalism that is firmly called "probabilistic logic". Fuzzy logic is indeed one such formalism, but there are also others. The form of probabilistic reasoning that is most successful in artificial intelligence today is Bayesian inference. However, its logical foundations are not yet firmly laid. $\endgroup$
    – Uday Reddy
    Commented Mar 15, 2013 at 0:04
16
$\begingroup$

Logic is fundamental to all theoretical computer science. Without learning these, you won't be able to properly grasp programming language semantics, Turing machines, logic programming, computability, and so on. Even reasoning about your programs will be more difficult without it. Certainly, trying to do a mathematical proof of some CS concept with be virtually impossible.

Or maybe you are asking about uses in industry. Learning logic forms the basis for learning how to reason clearly and see holes in other people's arguments. Logic is fundamental, whether you use the formal symbols or not.

$\endgroup$
2
  • $\begingroup$ You're missing algorithmics. $\endgroup$ Commented May 6, 2012 at 1:34
  • 4
    $\begingroup$ That's included in 'and so on'. $\endgroup$ Commented May 6, 2012 at 6:10
9
$\begingroup$

One of the repeating tasks CS practitioners and theorists face is gaining confidence in the correctness of their code.

There are two main approaches:

  1. Proof: Devise a logical proof that part of a system has certain properties, possibly aided by preconditions, design-by-contract, code checkers.
  2. Testing: Test that certain properties hold for a variety of inputs and then induce that that property holds for other inputs.

The first, based on logical methods, is often the only option when

  1. There is no typical input. For example, when testing security properties, it is the atypical inputs that you have to worry about so unless you can logically reason about which inputs are atypical, you are unlikely to get good coverage.
  2. The configuration space is very large, so you have to decompose it into parts by logically reasoning about which parts can affect which other parts before testing locally.
  3. You have only documentation describing edge-case behavior of systems outside your control. You might be able to simulate them but can't test what happens when an external dependency fails because you are not capable of causing it to fail for legal or ethical reasons.

Empirical testing in the absence of a proof is basically a substitute for proof. When you're designing a system to be testable, you are building up a proof sketch where you fill in parts of the proof with "test X,Y, and Z here." The ability to reason logically is essential to be able to architect a testable system. If the system is not testable or provable then its designer/architect has no business saying it is fit for its intended use.

$\endgroup$
6
$\begingroup$

Two most important fields that logic plays vital role are:

  1. Formal Language specification and verification.
  2. Fixed parameter tractable classes.

Seems needs some clarification, in formal languages you need to extremely work on logic, for clarification take a look at: 1. Formal language. 2. Introduction to $Z$.

In short: 1. Definition of language needs logic, 2: Justice of it's procedures needs logic, 3. verification procedures need logic.

I should mention that this is different from compiler design or ..., This is "Formal" definition of languages, main reason to do this is proving correctness of language or model, also having a formal proof. This can be used in verification of software models, finding errors before implementing, finding deadlocks again before implementing, ...., For software which simulate this you can take a look at NModel.

Now why in Fixed parameter tractable problems you need to work with logic, You can divide classes of Fixed parameter tractability with different levels of logic, they can be converted to each other : logic to automata, automata to graph, and vice verse, But if you be an expert in logic you can divide and decide on them simply, most important theorem (after Robertson and Seymour theorem), in this field is Courcelle's theorem. for more information read Meta Algorithmic Theorem survey.

$\endgroup$
2
  • $\begingroup$ While logics can be used to define languages, that's hardly a "vital role" in my experience. I don't see how logics relate to FPT at all. $\endgroup$
    – Raphael
    Commented May 4, 2012 at 6:16
  • $\begingroup$ @Raphael, I see answer to your comment takes more than a lines, I updated my answer. I think I answered you, but if still you think it's not OK, tell me, about my "Formal" part I think my first wiki link was not good enough, I added more information, Also for second part I added a nice paper and if you like to know more about it, you can read it. $\endgroup$
    – user742
    Commented May 4, 2012 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.