Introduction to Logic 1
Total Page:16
File Type:pdf, Size:1020Kb
Introduction to logic 1. Logic and Artificial Intelligence: some historical remarks One of the aims of AI is to reproduce human features by means of a computer system. One of these features is reasoning. Reasoning can be viewed as the process of having a knowledge base (KB) and manipulating it to create new knowledge. Reasoning can be seen as comprised of 3 processes: 1. Perceiving stimuli from the environment; 2. Translating the stimuli in components of the KB; 3. Working on the KB to increase it. We are going to deal with how to represent information in the KB and how to reason about it. We use logic as a device to pursue this aim. These notes are an introduction to modern logic, whose origin can be found in George Boole’s and Gottlob Frege’s works in the XIX century. However, logic in general traces back to ancient Greek philosophers that studied under which conditions an argument is valid. An argument is any set of statements – explicit or implicit – one of which is the conclusion (the statement being defended) and the others are the premises (the statements providing the defense). The relationship between the conclusion and the premises is such that the conclusion follows from the premises (Lepore 2003). Modern logic is a powerful tool to represent and reason on knowledge and AI has traditionally adopted it as working tool. Within logic, one research tradition that strongly influenced AI is that started by the German philosopher and mathematician Gottfried Leibniz. His aim was to formulate a Lingua Rationalis to create a universal language based only on rationality, which could solve all the controversies between different parties. This language was supposed to be comprised of a: - characteristica universalis: a set of symbols with which one may express all the sentences of this language; and a - calculus ratiocinator: a set of rules by which one may deduce all possible truths from an initial list of thoughts (expressed in the form of a characteristica universalis sentence). Leibniz’s very ambitious project failed: he encountered several difficulties already in the development of the characteristica universalis due to the absence of an appropriate formalism for this kind of language. The necessary steps to the development of logic in its modern form were taken by George Boole (1854) and Gottlob Frege (1879). Boole revolutionized logic by applying methods from the then- emerging field of symbolic algebra to logic. Where traditional (Aristotelian) logic relied on cataloging the valid syllogisms of various simple forms, Boole's method provided general algorithms in an algebraic language which applied to an infinite variety of arguments of arbitrary complexity. Frege essentially reconceived the discipline of logic by constructing a formal system which, in effect, constituted the first ‘predicate calculus’. In this formal system, Frege developed an analysis of quantified statements and formalized the notion of a ‘proof’ in terms that are still accepted today. Frege then demonstrated that one could use his system to resolve theoretical mathematical statements in terms of simpler logical and mathematical notions. There are different types of logic, which we can use to pursue our aim of representing and reasoning on knowledge, but we start with the simplest one, called Propositional Logic (PL). Then we present a 2 more powerful type of logic, called First Order Logic (FOL) or Predicate Calculus, which is the one usually adopted in AI. 2. Introduction to key terms Before presenting PL and FOL, we briefly introduce some key terms of logic (argument, deductive validity, soundness) (Lepore 2003) that, in the following, we will decline within the specific logical languages we will present. 2.1 Arguments As said, an argument is any set of statements – explicit or implicit – one of which is the conclusion (the statement being defended) and the others are the premises (statements providing the defense). The relationship between the conclusion and the premises is such that the conclusion follows from the premises. Here is one example. (2.1) Anyone who deliberates about alternative courses of action believes he is free. Since everybody deliberates about alternative courses of action, it follows that we all believe ourselves to be free. A statement is any indicative sentence that is either true or false. ‘Galileo was an astronomer’ is a statement; ‘Is George Washington president?’ is not a statement. Putting arguments into a standard format Having determined that some part of discourse contains an argument, the next task is to put it into a standard format. As said, an argument is any set of statements – explicit or implicit – one of which is the conclusion, and the others are the premises. To put an argument in a standard form requires all the following steps: - to identify the premises and the conclusion; - to place the premises first and the conclusion last; - to make explicit any premise or even the conclusion; this may be only implicit in the argument, but essential to the argument itself. So the argument presented as example above (2.1) has the following standard format. Premise 1: Anyone who deliberates about alternative courses of action believes he is free. Premise 2: Everybody deliberates about alternative courses of action. Conclusion: We all believe ourselves to be free. To make statements (both premises and conclusions) explicit is often critical when putting an argument into standard format. Let us consider another example in which both one of the two premises and the conclusion are hidden in its natural format. (2.2) What’s the problem today with John? Everybody is afraid to go to the dentist. Premise 1: Everybody is afraid to go to the dentist. Premise 2 (hidden): John is going to the dentist today. Conclusion (hidden): John is afraid. 2.2 Deductive validity Defining an argument, we have said that the relationship between the conclusion and the premises is such that the conclusion purportedly follows from the premises. But what is for one statement to ‘follow from others’? The principal sense of ‘follows from’ derives from the notion of deductively valid argument. 3 A deductively valid argument is an argument such that it is not possible both for its premises to be true and its conclusion to be false. In other terms, in a valid argument it is not possible that, if the premises are true, the conclusion is false. (2.3) All men are mortal. Socrates is a man. So Socrates is mortal. (2.3) is a deductively valid argument, whose conclusion follows from its premises. (2.4) All bachelors are nice. John is a bachelor. So John is nice. (2.4) is also a deductively valid argument. However, its premises should be false. It is worth noting that to determine whether a specific statement is true or false is not the aim of logic. Logic cannot say if the statements ‘All bachelors are nice’ and ‘John is a bachelor’ are true or false. This has to be determined by means of empirical analysis. The aim of logic, rather, is to determine if the argument is valid: given that the premises are true, the conclusion has to be true as well. If in ordinary language the terms ‘valid’ and ‘true’ are often used interchangeably, in logic ‘valid’ and ‘invalid’ apply only to arguments, while ‘true’ and ‘false’ only to statements. 2.3 Soundness An argument can be deductively valid, but unlikely to persuade anyone. Normally good arguments are not only deductively valid. They also have true premises. These arguments are called sound. Argument (2.4) above is valid, but not sound. Another example: (2.5) All fish fly. Anything which flies talks. So, all fish talk. This is a deductively valid argument but unlikely to persuade anyone. 3. Propositional Logic In learning Propositional Logic (PL) we learn ways of representing arguments correctly and ways of testing the validity of those arguments. There exist various techniques to determine whether arguments containing these types of statements are deductively valid in virtue of their form and PL is one of them. PL, like any other logic, can be thought as comprised of three components: - syntax: which specifies how to build sentences of the logic; - semantics: which attaches to these sentences a meaning; - inference rules: which manipulate these sentences to obtain more sentences. The basic symbolization rule in PL is that a simple statement is symbolized by a single statement letter. 3.1 Syntax of PL It defines the allowable sentences in PL. PL sentences are comprised of: Atomic sentences: indivisible syntactic elements consisting of a single propositional symbol, usually an upper case letter (P, Q, R). Every symbol represents a sentence that can be true (T) or false (F). Complex sentences: constructed from atomic ones by means of logical connectives, ¬ (negation), ∧ (conjunction), ∨ (disjunction), → (conditional), ↔ (biconditional). 4 Let us analyze in more details logical connectives: Negation ¬ - if P is a PL sentence, ¬P is a PL sentence, too. - ¬P is called the negation of P. - If P is an atomic sentence, both P and ¬P are called literals (positive and negative respectively). Conjunction ∧ - If P and Q are PL sentences, P ∧ Q is a PL sentence. Disjunction ∨ - If P and Q are PL sentences, P ∨ Q is a PL sentence. Conditional → - If P and Q are PL sentences, P → Q is a PL sentence. Biconditional ↔ - If P and Q are PL sentences, P ↔ Q is a PL sentence. 3.2 Semantics of PL The semantics defines the rules for determining the truth of a sentence with respect to a particular model. A model fixes the truth value (True, False) for every proposition symbol. A model is a pure mathematical object, with no necessary connection to the actual world.