Logic in computer science
All men are mortal. Socrates is a man. Therefore, Socrates is mortal. Logical arguments like this one have been studied since antiquity. In the last few decades, however, logic research has changed considerably: the computer sciences were born. The success of informatics would have been impossible without the groundwork provided by logicians – and, in turn, computer sciences keep posing new interesting questions, which can only be answered by formal logic. Informatics is not the modern-day successor of logic, both fields keep moving forward, hand in hand.
Calculating Logical Statements
Simple logical conclusions such as the famous syllogism about Socrates' mortality appear clear and simple to us. But logic is not just about formalizing the obvious. Just like in mathematics, logic allows us to construct arbitrarily complex equations, to do sophisticated calculations, to analyse the world.
Even before the first electronic calculating devices were built, research on the hypothetical possibilities of computers was done: in the 1930s, the mathematicians Alan Turing and Alonzo Church characterized the class of mathematical problems which can in principle be tackled. Turing put forward an intriguingly simple model for a calculating machine – the Turing machine: It moves on an infinitely long ribbon, reads numbers and changes it according to a given set of rules.
Such a machine can be built with mechanical gears or lego bricks. Although in practice such a machine is highly inefficient, one can show that in principle any conceivable computer calculation can be carried out by such a simple device. With the Turing machine it became possible to clearly define what "doing mathematical calculations" even means. Using this concept, Turing could show that some questions can never be answered by a computer: a computer program which reads other programs and then decides whether its calculations would ever come to a halt or go on forever is logically impossible.
Looking inward, looking outward
"Today, most of the research in logic is done by computer scientists, not by mathematicians", says Professor Helmut Veith from the Vienna University of Technology. Logic in computer science has to fulfil several tasks. First of all, it is a tool with which computer programs can describe the world. Logic is used for databases or for creating artificial intelligence.
But logic does not only help a computer to view the world, it also offers the possibility of introspection: computer codes can check other computer codes and look for logical errors. "It is similar to the way we humans think", says Helmut Veith. "We think about the world around us, but we can also contemplate ourselves and our own mind."
Logic-based quality checks of computer codes (verification, model checking) play an important role for industry and the economy. When a user tests a program and finds that it works, this does not by all means guarantee that the program is free of errors. The crucial question is: does the code react correctly to any conceivable input, in any logically possible situation? This can only be determined by an automated program.
Such a reliable check is particularly important for security relevant code such as airplane controls. Logical checks are essential for the production of computer chips as well. Today, chips start out as a computer program, long before they are physically built. No human being could ever determine by hand whether the chip does indeed react correctly to any given situation. Computer programs carry out this task. With their logical checks, they ensure our safety.