* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download PROPOSITIONAL LOGIC 1 Propositional Logic - Glasnost!
Gödel's incompleteness theorems wikipedia , lookup
Axiom of reducibility wikipedia , lookup
Willard Van Orman Quine wikipedia , lookup
Analytic–synthetic distinction wikipedia , lookup
Meaning (philosophy of language) wikipedia , lookup
Fuzzy logic wikipedia , lookup
Mathematical proof wikipedia , lookup
History of the function concept wikipedia , lookup
Jesús Mosterín wikipedia , lookup
George Boole wikipedia , lookup
Foundations of mathematics wikipedia , lookup
Combinatory logic wikipedia , lookup
Mathematical logic wikipedia , lookup
Curry–Howard correspondence wikipedia , lookup
Modal logic wikipedia , lookup
History of logic wikipedia , lookup
Quantum logic wikipedia , lookup
Interpretation (logic) wikipedia , lookup
Truth-bearer wikipedia , lookup
Propositional formula wikipedia , lookup
Laws of Form wikipedia , lookup
Intuitionistic logic wikipedia , lookup
Natural deduction wikipedia , lookup
Principia Mathematica wikipedia , lookup
Propositional calculus wikipedia , lookup
1 1 CHAPTER 4. PROPOSITIONAL LOGIC INSTITIÚID TEICNEOLAÍOCHTA CHEATHARLACH INSTITUTE OF TECHNOLOGY CARLOW PROPOSITIONAL LOGIC 1 Propositional Logic 1.1 Introduction George Boole, mathematician, logician and one of the fathers of the modern computer was born in the City of Lincoln in the East of England in 1815. From his father he inherited a love of science, and a young George was drawn into the worlds of physics, applied mathematics, and finally mathematics. George Boole was intensely religious and at one stage even contemplated becoming a clergyman of the Church of England. All of his life he viewed the human mind as God’s most significant creation, and he set himself the task of understanding how the mind worked and in particular how it processed information. His ultimate ambition was to express the workings of the mind by means of mathematical symbols – this was of course the beginning of a study which led eventually to our present day world of digital technology, electronics, and high-speed computers. Classical logic, which in the 19th century was not regarded as a branch of mathematics, was the key to Boole’s Figure 1: George Boole (1815-1864) attempt to understand how the human mind processes information. Before Boole’s time, algebraic symbols such as x always stood for unknown numbers, but Boole widened this interpretation to allow x stand for any well-defined class of objects. For example, x could represent the class of all sheep, and y could represent the class of all white objects. They xy represents the class of all white sheep. In particular, x2 = xx represents the class of all sheep which are sheep, which is clearly just the class of all sheep! Thus in all cases this statement simplifies to x2 = x, a simple equation which became the cornerstone of Boole’s new system, nowadays called Boolean Algebra. 2 CHAPTER 4. PROPOSITIONAL LOGIC 2 He built up the rules to express elementary logical statements in symbolic form, which was a colossal leap forward in both logic and mathematics. In 1847 Boole published his first book, The Mathematical Analysis of Logic. As a result of this publication and on the recommendation of many of the leading British mathematicians of the day, Boole was appointed first Professor of Mathematics at the newly founded Queen’s College Cork (now University College Cork) in Ireland in 1849. This was a daring move on behalf of the electors considering that he had neither a secondary education nor a university degree, but it turned out very successfully. Boole devoted the year 1849 to 1854n busily to his first taste of third level teaching but also to developing and expanding his work on logic. In 1854 he published An Investigation of the Laws of Thought which made extensive improvements on his earlier work on logic. The practical importance of this book and its deeper significance lay untapped until 1938 when the American engineer Claude Shannon at Massachusetts Institute of Technology (MIT) realised that Boole’s algebra was precisely what was needed to describe electronic switching circuits and eventually high-speed computers. Thus the modern binary approach to mathematics, logic, electronics and computer science stems almost entirely from Boole’s work in the 1850’s. Boole lived most of his life as a bachelor, but in 1855, at the age of nearly forty, he married a lady just half his age. She was Mary Everest, who came from a distinguished English family. Her uncle, Sir George Everest, was the Surveyor-General of India and the man after whom the world’s highest mountain is named. George and Mary Boole appear to have had a blissfully happy marriage and they had five daughters - Mary Ellen (1856), Margaret (1858), Alicia (1860), Lucy (1862), and Ethel (1864). Alicia went on to become an eminent self-taught mathematician, Lucy become the first woman professor of chemistry in England, and Ethel (Voynich) wrote one of the world’s bestselling novels, The Gadfly (1897). Many descendants of George Boole made important contributions to physics, medicine, sport and art. Boole’s health was never robust and overwork and college controversy weakened him further. He died in 1864 at the tragically early age of 49 as a result of pneumonia caused by walking to a lecture in a December downpour and lecturing all day in wet clothes. He is buried in Blackrock in Cork and is commemorated by the magnificent Boole Library at University College Cork. George Boole’s most enduring contribution to human knowledge was the realisation that mathematics is not confined to the traditional areas of arithmetic, algebra, geometry and calculus, but that mathematics Figure 2: George Boole’s Grave, Blackrock, Cork. applies to everything - every class of objects, every thought that passes through mind or machine. Everywhere there is order, structure, data or information, there is mathematics. His discoveries opened the floodgates and made mathematics central to everything that involves organised thought but Boole did not live to see the fruits of his work. In 1862 he had met with Charles Babbage and inspected his analytical engine, the hardware of which was the forerunner of modern computer hardware. Between 3 CHAPTER 4. PROPOSITIONAL LOGIC 3 them Babbage and Boole had the basis of modern computer technology. If he had lived, and he and Babbage had worked together, the digital revolution might have come a long time before it did and history would have been very different. As it was, Boole’s notion that mathematics consists essentially of the manipulation of symbols has had profound effects on the development of mathematics and its applications. Since those symbols do not necessarily have to have a meaning attached to them, they can be processed by minds and machines, which need only to be able to recognise them and process and manipulate them according to specified and prescriptive rules. This is one of the most profound insights ever achieved by a human being and is the essence of the genius of George Boole. We complete this introduction by stating that, in general, logic is about reasoning. It is about the validity of arguments, consistency among statements (propositions) and matters of truth and falsehood. Logic is only concerned with the form of arguments and the principles of valid deductions. The following are two examples of arguments: John is over 90 years old. So John is over 20. John is over 20 years old. John is over 90 years old. The first arguments are valid - the second is invalid. What do we mean when we say that a piece of reasoning is valid? We mean that the conclusion is true in every situation in which the premises are true. But the fact that the conclusion has been validly deduced says nothing about its actual truth. Whether it is true or not in a given case depends on the truth of the premises, and that is a matter for science and not for logic. What is of concern in logic is that true conclusions should be drawn from true premises by acceptable rules of reasoning. Or, to put it more strongly, that it is never the case that a false conclusion is drawn from true premises. An argument is valid if and only if there is NO logically possible situation where all the premises are true and the conclusion is false at the same time. Validity is not about the actual truth of falsehood of the premises or the conclusion of an argument. Validity is about the logical connection between the premises and the conclusion. 4 4 CHAPTER 4. PROPOSITIONAL LOGIC 1.2 Propositions and Truth Tables To introduce logic we must recall the notion of a set. A set is a collection of entities. A s x x∈A For this fundamental object we can say that x ∈ A or x ∈ / A, but not both. Definition A proposition, or statement, is a sentence which is either true of false, both not both. The truth value of the proposition will be denoted by true (T) or false (F). The following are all examples of propositions: i Mr. Jones is happy. ii Sam will go to the party. iii The capital of Ireland is Cork. n iv For all n ∈ N, the integer Fn defined by Fn = 22 + 1 is prime. The truth value of these statements are not of concern to us – only the fact that they can assume a true or false value. We can combine statements using various connectives, or connecting words, such as ‘and’ and ‘or’, to form more complicated statements (compound statements). There are 5 connectives in logic and each one equates with its corresponding connective in sets. Let A, B, C, ............. denote propositions. Say we are concerned with the truth value of a particular compound statement. This will depend on the truth vale of each proposition and the connectives used. A tool to examine a compound statement for every arrangement of true and false is called a truth table. We begin with defining the basic 3 connectives of logic, using the corresponding connective in sets to help our understanding. 5 5 CHAPTER 4. PROPOSITIONAL LOGIC 1.2.1 Conjunction, Disjunction and Negation The conjunction of A and B is denoted by A ∧ B. Both A and B must be true in order for A ∧ B to be true. A B A∧B T T T T F F F T F F F F The disjunction of A and B is denoted by A ∨ B. If either A is true or B is true or both A and B are true, then A ∨ B is true. A B A∨B T T T T F T F T T F F F The negation of A is denoted by ¬A. The truth values of ¬A are exactly opposite those of A. 6 6 CHAPTER 4. PROPOSITIONAL LOGIC A ¬A T F F T Remark Allowing the notion of a set correspond to a proposition – the three basic connectives above correspond to the set connectives A ∩ B, A ∪ B and A0 . Say, for example, we consider the definition of the intersection of two sets: A ∩ B = {x : x ∈ A, x ∈ B} If truth value T corresponds to x ∈ A and truth value F corresponds to x ∈ / A, in order for an element x to belong to the intersection A ∩ B we must have x ∈ A and x ∈ B. All other arrangements do not allow x to be in A ∩ B. This corresponds to the first row and subsequent rows of the truth table for the conjunction A ∧ B. Example A truth table for the compound statement (A ∨ B) ∧ ¬(A ∧ B) is constructed as follows: A B A∨B A∧B ¬(A ∧ B) (A ∨ B) ∧ ¬(A ∧ B) T T T T F F T F T F T T F T T F T T F F F F T F The truth values of the statement is dependent on the truth values of the individual propositions as well as the connectives used. 7 7 CHAPTER 4. PROPOSITIONAL LOGIC Example A truth table for the compound statement (A ∧ B) ∨ (¬A ∧ B) is constructed as follows: A B A∧B ¬A ¬A ∧ B (A ∧ B) ∨ (¬A ∧ B) T T T F F T T F F F F F F T F T T T F F F T F F Example A truth table for the compound statement (¬A ∨ ¬B) ∨ ¬(A ∧ B) is constructed as follows: A B ¬A ¬B ¬A ∨ ¬B A∧B ¬(A ∧ B) (¬A ∨ ¬B) ∨ ¬(A ∧ B) T T F F F T F F T F F T T F T T F T T F T F T T F F T T T F T T Exercise Establish the following equivalence using a truth table. (A ∨ B) ∧ (A ∨ ¬B) = A Exercise Establish the following equivalence using a truth table. ¬ (A ∧ B) ∨ (¬A ∧ ¬B) = (¬A ∧ B) ∨ (¬B ∧ A) 8 8 CHAPTER 4. PROPOSITIONAL LOGIC 1.2.2 Implication and Equivalence An implication is a proposition of the form “if A then B” or “A implies B” denoted by A ⇒ B. The first proposition (or compound statement) A is called the hypothesis and the second proposition (or compound statement) B is the conclusion. A B A⇒B T T T T F F F T T F F T Example We can easily illustrate the truth table for equivalence as follows: Let A = John lives in Borris. B = John lives in Co. Carlow. The implication A ⇒ B is: ‘If John lives in Borris, then John lives in Co. Carlow.’ It is reasonable to regard this statement as true in three of the four possible cases, and false in the other one. If John lives in Borris then John lives in Co. Carlow (row 1). If John does not live in Borris he may or may not live in Co. Carlow (row 3 and 4). However it is impossible for John to live in Borris and not live in Co. Carlow (row 2). Note Implication is not commutative i.e., A ⇒ B B ⇒ A For x ∈ R, let A be the statement x = 3 and let B be the statement x2 = 9. The implication ‘If x = 3, then x2 = 9’ is true. However the converse ‘If x2 = 9, then x = 3’ is false, since the real number x = −3 also satisfies x2 = 9. An equivalence is a proposition of the form ‘A is equivalent to B’ or ’A if and only if B’ denoted by A ⇔ B. 9 9 CHAPTER 4. PROPOSITIONAL LOGIC A B A⇔B T T T T F F F T F F F T If A and B have the same truth value, A ⇔ B is true, otherwise false. Remark The precedence rules of logic are as follows: • expressions in brackets first • perform negations • perform conjunctions – disjunctions (from left to right) • perform implication – equivalence (form left to right). Also if a compound statement has n propositions, its truth table has 2n rows. Example A truth table for the compound statement (A ∨ B) ⇒ (¬A ∧ B) is constructed as follows: A B A∨B ¬A ¬A ∧ B (A ∨ B) ⇒ (¬A ∧ B) T T T F F F T F T F F F F T T T T T F F F T F T 10 10 CHAPTER 4. PROPOSITIONAL LOGIC Example A truth table for the compound statement ¬(A ∧ B) ⇔ (¬A ∨ ¬B) is constructed as follows: A B A∧B ¬(A ∧ B) ¬A ¬B ¬A ∨ ¬B ¬(A ∧ B) ⇔ (¬A ∨ ¬B) T T T F F F F T T F F T F T T T F T F T T F T T F F F T T T T T Exercise Construct a truth table for the following (A ∧ B) ⇒ (¬A ∧ B) Exercise Construct a truth table for the following (¬A ∨ B) ∨ ¬(A ⇒ B) 11 11 CHAPTER 4. PROPOSITIONAL LOGIC 1.3 Laws of Logic Definition A tautology is a compound statement that is always true. Definition A contradiction is a compound statement that is always false. We denote a tautology by 1 and a contradiction by 0. Let A, B and C be propositions (or compound statements). We can easily verify the following laws of logic using truth tables: A∨B = B ∨ A, A∧B = B ∧ A, (A ∨ B) ∨ C = A ∨ (B ∨ C), (A ∧ B) ∧ C = A ∧ (B ∧ C), A ∧ (B ∨ C) = (A ∧ B) ∨ (A ∧ C), A ∨ (B ∧ C) = (A ∨ B) ∧ (A ∨ C), ¬(A ∨ B) = ¬A ∧ ¬B, ¬(A ∧ B) = ¬A ∨ ¬B ¬¬A = A Also, we have the following A ∨ ¬A = 1, A∨A = A, A ∧ ¬A = 0, A∧A = A, A∨0 = A, A∨1 = 1, A∧1 = A, A∧0 = 0. We can use the laws of logic to establish an equivalence between statements. Example Using the laws of logic we can establish an equivalence as follows: (A ∧ B) ∨ (¬A ∧ B) = (B ∧ A) ∨ (B ∧ ¬A) = B ∧ (A ∨ ¬A) = B∧1 = B 12 12 CHAPTER 4. PROPOSITIONAL LOGIC Example Again, using the laws of logic we can establish: A ∨ (¬A ∧ ¬B) ∨ (A ∧ B) = (A ∨ ¬A) ∧ (A ∨ ¬B) ∨ (A ∧ B) 1 ∧ (A ∨ ¬B) ∨ (A ∧ B) A ∨ ¬B ∨ (A ∧ B) A∨ ¬B ∨ (A ∧ B) A ∨ (¬B ∨ A) ∧ (¬B ∨ B) A ∨ (¬B ∨ A) ∧ 1 = A ∨ (¬B ∨ A) = (A ∨ A) ∨ ¬B = A ∨ ¬B = = = = = Exercise Establish the following equivalence using the laws of logic. Confirm your work using a truth table. (A ∨ B) ∧ (A ∨ ¬B) = A Exercise Establish the following equivalence using the laws of logic. Confirm your work using a truth table. ¬ (A ∧ B) ∨ (¬A ∧ ¬B) = (¬A ∧ B) ∨ (¬B ∧ A] Remark We can state other laws of logic relating to the connectives implication ⇒ and equivalence ⇔. A⇒B = ¬A ∨ B, ¬(A ⇒ B) = A ∧ ¬B, A⇔B ¬(A ⇔ B) = (A ⇒ B) ∧ (B ⇒ A), = ¬(A ⇒ B) ∨ ¬(B ⇒ A). 13 13 CHAPTER 4. PROPOSITIONAL LOGIC Example Again, using the laws of logic we can establish: A ⇒ (B ⇒ A) = ¬A ∨ (B ⇒ A) = ¬A ∨ (¬B ∨ A) = (¬A ∨ A) ∨ ¬B = 1 ∨ ¬B = 1. Example Finally, using the laws of logic we can establish: (¬B ⇒ ¬A) ⇒ (A ⇒ B) = ¬(¬B ⇒ ¬A) ∨ (A ⇒ B) = ¬(¬¬B ∨ ¬A) ∨ (¬A ∨ B) = ¬(B ∨ ¬A) ∨ (¬A ∨ B) = (¬B ∧ ¬¬A) ∨ (¬A ∨ B) = (¬B ∧ A) ∨ (¬A ∨ B) = (¬A ∨ B ∨ ¬B) ∧ (¬A ∨ B ∨ A) = (¬A ∨ 1) ∧ (B ∨ 1) = 1∧1 = 1. Exercise Establish the following equivalences using the laws of logic. Confirm your work using a truth table. i A ∧ ¬(A ∨ B) ≡ 0 ii B ⇔ (B ∨ B) ≡ 1 iii (A ⇒ B) ⇔ (¬A ∨ B) ≡ 1 iv (A ⇒ B) ⇔ (¬A ∧ ¬B) ≡ ¬B v (A ⇒ B) ∧ ¬B ⇒ ¬A ≡ 1 14 14 CHAPTER 4. PROPOSITIONAL LOGIC 1.4 Arguments Definition An argument is an assertion that a given set of propositions A1 , A2 , ............, An called premises, has as a consequence another proposition C, called the conclusion. We say A1 , A2 , ............, An | −→ C where the symbol | −→ reads “yields”. A = {A1 , A2 , ............, An } A(T orF ) ⇒ T ≡ T A(F ) ⇒ F ≡ T A(T ) ⇒ F T What do we mean when we say that a piece of reasoning is valid? We mean that the conclusion is true in every situation in which the premises are true. But the fact that the conclusion has been validly deduced says nothing about its actual truth. Whether it is true or not in a given case depends on the truth of the premises, and that is a matter for science, not for logic. What is concern in logic is that true conclusions should be deduced from true premises by acceptable rules of reasoning. (Or it can never be the case that a false conclusion is deduced from true premises). For the argument A1 , A2 , ............, An | −→ C if we ensure that [A1 ∧ A2 ∧ ............ ∧ An ] ⇒ C is a tautology we are ensuring that the argument is valid. Remark To consider this explanation in more detail consider the following arguments: Argument 1: John is over 90 years old. So John is over 20. Argument 2: John is over 20 years old. So John is over 90 years old. 15 15 CHAPTER 4. PROPOSITIONAL LOGIC Intuitively, the conclusion of the first argument follows from the premise whereas the conclusion of the second argument does not follow from its premise. To explain the difference between the two arguments precisely – in the first argument, if the premise is indeed true, then the conclusion cannot be false. On the other hand, even if the premise in the second argument is true, there is no guarantee that the conclusion must also be true. For example, John could be 30 years old. An argument is valid if and only if there is NO logically possible situation where all the premises are true and the conclusion is false at the same time. A(T ) ⇒ F T The idea of validity provides a more precise explanation of what it is for a conclusion to follow from the premises. Applying this definition, we can see that the first argument above is valid, since there is no possible situation where John can be over 90 but not over 20. The second argument is not valid because there are plenty of possible situations where the premise is true but the conclusion is false. Consider a situation where John is 25, or one where he is 85. The fact that these situations are possible is enough to show that the argument is not valid or invalid. Now consider the following argument: Argument 3:All pigs can fly. Anything that can fly can swim. So all pigs can swim. Although the two premises of this argument are false, this is actually a valid argument. To evaluate its validity, ask yourself whether it is possible to come up with a situation where all the premises are true and the conclusion is false. (We are not asking whether there is a situation where the premises and the conclusion are all true). Of course, the answer is ‘no’. If pigs can indeed fly, and if anything that can fly can also swim, then it must be the case that all pigs can swim. The premises and the conclusion of a valid argument can all be false. A(F ) ⇒ F ≡ T Hopefully you will now realize that validity is not about the actual truth of falsehood of the premises or the conclusion. Validity is about the logical connection between the premises and the conclusion. A valid argument is one where the truth of the premises guarantees the truth of the conclusion, but validity does not guarantee that the premises are in fact true. All that validity tells us is that if the premises are true, the conclusion must also be true. Finally, consider the following argument: 16 16 CHAPTER 4. PROPOSITIONAL LOGIC Argument 4: All pigs are purple in color. Anything that is purple is an animal. So all pigs are animals. This is a valid argument – there in NO logically possible situation where all the premises are true and the conclusion is false at the same time. It is possible for a valid argument to have a true conclusion even when all its premises are false. A(F ) ⇒ T ≡ T So, again we say a valid argument is an argument whose conclusions follow from its premises, but it is an argument whose conclusions might not be true (as we have seen above) because its premises might not be true. A sound argument, on the other hand, is a valid argument whose premises are true. A sound argument therefore arrives at a true conclusion. Exercise Translate each of the following arguments to Propositional Logic The file is either a binary file or a text file. If it is a binary file, then my program won’t accept it. My program will accept the file. Therefore, the file is a text file. If John likes logic, then he attended his classes or he studied the topic. If he did not study the topic, then he attended his classes. John did not attend his classes. Therefore, John does not like logic. Exercise Consider the following arguments. Formulate each argument within propositional logic and use a truth table to investigate their validity. If the violinist plays the concerto, then the crowds will come if the prices are not too high. If the violinist plays the concerto, the prices will not be too high. Therefore, if the violinist plays the concerto, crowds will come. If the President broke the law, then the people were not alert or the cabinet was competent. If the cabinet was not competent, then the people were alert. The cabinet was not competent. Therefore, the president did not break the law. If Fermat’s Last Theorem is correct, then all elliptic curves are modular. If all elliptic curves are modular then the class number formula is correct. Therefore, if Fermat’s Last Theorem is correct, then so is the class number formula. 17 CHAPTER 4. PROPOSITIONAL LOGIC 1.5 17 Resolution in Propositional Logic We will use the resolution principle to investigate if a sequence of compound statements are inconsistent. That is, we can easily establish that a sequence of statements cannot be simultaneously true. In the context of an argument – if we negate the conclusion of the argument and show, using resolution, that it is inconsistent with the premises of the argument, then the argument will be valid. This approach is very mechanical but is relying on an inconsistency (contradiction) being established. If an inconsistency cannot be established – the argument is invalid. Remember to apply the resolution technique our compound statements must be in normal form. 1.5.1 Conjunctive Normal Form Definition A literal is just a proposition or the negation of a proposition. For example A is called a positive literal and ¬B is called a negative literal. Definition A compound statement is in conjunctive normal form (C.N.F) if it is a conjunction of disjunction of literals; i.e., of the form A1 ∧ A2 ∧ .......... ∧ Ai ∧ .......... ∧ An where Ai is of the form λ1 ∨ λ2 ∨ .......... ∨ λj ∨ ............ ∨ λm where each λj is a literal. The following statement is in conjunctive normal form: (A ∨ ¬B ∨ C) ∧ (¬A ∨ B) Exercise Convert each of the following statements to conjunctive normal form: i A ∨ (B ∧ C) ii A ⇔ (B ∧ C) iii ¬A ∧ (¬B ⇒ C) ⇒ D iv ¬(A ⇒ ¬C) ∧ (¬B ⇒ C) 18 18 CHAPTER 4. PROPOSITIONAL LOGIC Definition A clause is a finite disjunction of literals. Remark If a statement has been converted to C.N.F., we can suppress ∧ and ∨. For example the statement (A ∨ B ∨ ¬C) ∧ (D ∨ E) may now be represented as {A, B, ¬C} , {D, E} 1.5.2 The Resolution Principle Definition A resolvent of two clauses C1 and C2 containing the complementary pair of literals λ and ¬λ respectively may be defined as res(C1 , C2 ) = C1 \{λ} ∪ C2 \{¬λ} For example {A, B, ¬C} A {C, D} A A AAU {A, B, D} Now that we have all the definitions in place we formally state the resolution principle and apply to a simple argument. Theorem 1 (The Resolution Principle) A resolvent of two clauses C1 and C2 is a logical consequence of C1 ∧ C2 . C1 ∧ C2 | −→ res(C1 , C2 ) This theorem is simply saying that if the conjunction of two clauses are true then the resolvent of the two clauses must also be true. 19 19 CHAPTER 4. PROPOSITIONAL LOGIC Example Consider the following argument: A ⇒ B , B ⇒ C | −→ A ⇒ C Bringing all statements to C.N.F., remembering to negate the conclusion, we have A⇒B = ¬A ∨ B B⇒C = ¬B ∨ C Negating the conclusion ¬(A ⇒ C) = ¬(¬A ∨ C) = ¬¬A ∧ ¬C = A ∧ ¬C Our clauses are {¬A, B} , {¬B, C} , {A} , {¬C} We can use the resolution principle to show that these statements cannot be simultaneously true i.e., they are inconsistent. We do so by constructing a resolution tree. {¬A, B} {¬B, C} {A} {¬C} @ @ {¬A, C}@ @ @ @ {C} @ @ @ ⊥ We have applied the resolution principle to the above clauses. It has yielded a contradiction so we conclude the the statements are inconsistent. This further implies that the argument from which these statements have come is a valid argument. 20 20 CHAPTER 4. PROPOSITIONAL LOGIC Remark This truth table will help confirm our findings. A B C ¬A ∨ B ¬B ∨ C A ¬C *** T T T T T T F F T T F T F T T F T F T F T T F F T F F F T T T F F T T T T F F F F T F T F F T F F F T T T F F F F F F T T F T F The column of this truth table marked ∗ ∗ ∗ indicates the statement (¬A ∨ B) ∧ (¬B ∨ C) ∧ A ∧ C. It is clear that there is NO arrangement where this statement is true, i.e., the statement is inconsistent. To put this another way, the individual statements cannot be all true at he same time (they cannot be simultaneously true). Example Consider the following argument: A ⇒ (A ⇒ B) , (A ⇒ B) ⇒ ¬B | −→ A ⇒ ¬B Bringing all statements to C.N.F., remembering to negate the conclusion, we have A ⇒ (A ⇒ B) = ¬A ∨ (¬A ∨ B) = ¬A ∨ B 21 21 CHAPTER 4. PROPOSITIONAL LOGIC (A ⇒ B) ⇒ ¬B = ¬(¬A ∨ B) ∨ ¬B = (¬¬A ∧ ¬B) ∨ ¬B = (A ∧ ¬B) ∨ ¬B = (A ∨ ¬B) ∧ (¬B ∨ ¬B) = (A ∨ ¬B) ∧ ¬B Negating the conclusion ¬(A ⇒ ¬B) = ¬(¬A ∨ ¬B) = ¬¬A ∧ ¬¬B = A∧B Our clauses are {¬A, B} , {A, ¬B} , {¬B} , {A} , {B} We can use the resolution principle to show that these statements cannot be simultaneously true i.e., they are inconsistent. We do so by constructing a resolution tree. {¬A, B} {A, ¬B} {B} @ @ {B, ¬B}@ @ @ @ ⊥ We have applied the resolution principle to some of the above clauses. It has yielded a contradiction (without having to involve all clauses) so we conclude the the statements are inconsistent. This further implies that the argument from which these statements have come is a valid argument. This truth table will help confirm our findings. 22 22 CHAPTER 4. PROPOSITIONAL LOGIC A B ¬A ¬B ¬A ∨ B A ∨ ¬B *** T T F F T T F T F F T F T F F T T F T F F F F T T T T F The column of this truth table marked ∗∗∗ indicates the statement (¬A∨B)∧(A∨¬B)∧¬B ∧A∧B. It is clear that there is NO arrangement where this statement is true, i.e., the statement is inconsistent. To put this another way, the individual statements cannot be all true at he same time (cannot be simultaneously true). Remark We pose the question - having negated the conclusion of the argument and shown, using the resolution principle, that it is inconsistent with the premises of the argument, why does this mean that the argument valid? For the argument A1 , A2 , ............, An | −→ C we have just shown that the statements A1 , A2 , ............, An , ¬C are inconsistent. Let A = {A1 , A2 , ............, An }. If A1 , A2 , ............, An are true, then ¬C must be false, hence A(T ) ⇒ T ≡ T. If A1 , A2 , ............, An are false, then ¬C may be true or false, hence A(F ) ⇒ F ≡ T A(F ) ⇒ T ≡ T For all arrangements our deduction is valid. 23 23 CHAPTER 4. PROPOSITIONAL LOGIC Exercise Using the resolution principle investigate the validity of the following arguments A ⇒ B , A | −→ B A ⇒ (A ⇒ B) , A | −→ B A ⇒ (B ⇒ ¬A) , (B ⇒ ¬A) ⇒ ¬A | −→ A ⇒ ¬A A ⇒ (¬A ⇒ B) , (¬A ⇒ B) ⇒ ¬B | −→ A ⇒ ¬B 1.6 Formal Proofs in Propositional Logic We consider a more formal or syntactic treatment of proofs and deductions. Our objective is to prove logical forms from given logical forms using formal rules of deduction. The rules of deduction are like the rules of a game, such as chess. They permit certain logical moves. They must be adhered to in order to play the formal game of logic. The rules of deduction will ensure true conclusions will be deduced from true premises. Remark We will use the logical constant ⊥ to replace the symbol 0. This constant has the false value. It is known by the latin name falsum. The rules of deduction are intended to represent in a formal way the intuitive or ‘natural’ methods of reasoning used by humans. • ∧I (∧ − introduction) A B A∧B • ∧E (∧ − elimination) A∧B A • ∧E (∧ − elimination) A∧B B 24 24 CHAPTER 4. PROPOSITIONAL LOGIC • ∨I (∨ − introduction) A A∨B • ∨I (∨ − introduction) B A∨B • ∨E (∨ − elimination) A .. . C A∨B B .. . C C If C is derived from A, and C is derived from B, then C may be derived from A ∨ B. The reason A and B are crossed out is that they are no longer needed - A ∨ B takes their place. If A and B are assumptions then they are said to be discharged. • ⇒ I (⇒ −introduction) A .. . C A⇒C If C can be derived from the assumption A, then we can discharge the assumption and conclude that A ⇒ C. For example, say we conclude that ‘The cat drank the cream’ from the assumption ‘The saucer is empty’. Then it is reasonable to make the assertion ‘If the saucer is empty, then the cat drank the cream’. We do not hold on to the assumption ‘The saucer is empty’, since it is contained in the assertion. • ⇒ E (⇒ −elimination) A A⇒C C If A holds, and A implies C, then C holds. This is the modus ponens rule of reasoning. 25 25 CHAPTER 4. PROPOSITIONAL LOGIC • ⊥ ⊥ C From a contradiction, any conclusion C can be drawn. • RAA (Reductio Ad Absurdum) ¬A .. . ⊥ A This rule formalises the famous proof by contradiction method of arguing. If assuming that A is not the case leads to a contradiction, then we conclude that A is the case. Using the ⇒ I rule and noting that A ⇒ ⊥ ≡ ¬A we get a complementary form of this rule: A .. . ⊥ ¬A We will refer to this form of the rule as RAA also. Finally we have a final rule. • Id (Identity) A A Any formula can be derived from itself. Remark The method of natural deduction was introduced by the German/Polish mathematician Gerhard Gentzen (1909-1945) in a paper published in 1935. He intended to set up a formal system which comes as close as possible to actual reasoning. 26 26 CHAPTER 4. PROPOSITIONAL LOGIC Let us consider how we use he above rules of deduction to establish the validity of an argument in a more efficient way. Recall the form of an argument A1 , A2 , ............, An | −→ C Note If the set of assumptions are empty we simply write | −→ C. Theorem 2 A ∧ B | −→ B ∧ A Proof The general strategy is to start with one or more assumptions and use the rules to make progress from there. 1. A ∧ B P remise 2. A by ∧ E 3. A ∧ B P remise 4. B by ∧ E 5. B ∧ A by ∧ I Notice that we can use an assumption as often as we like or need to. Theorem 3 | −→ A ∧ B ⇒ B ∧ A Proof 1. A ∧ B Assumption 2. A by ∧ E 3. A ∧ B Assumption 4. B by ∧ E 5. B ∧ A by ∧ I 6. A ∧ B ⇒ B ∧ A by ⇒ I, discharging 1, 3. 27 27 CHAPTER 4. PROPOSITIONAL LOGIC Notice that discharging the assumption involves discharging all occurances of it as they are the same thing. Theorem 4 | −→ A ⇒ (B ⇒ (A ∧ B)) Proof 1. A Assumption 2. B Assumption 3. A ∧ B by ∧ I 4. B ⇒ (A ∧ B) by ⇒ I, discharging 2. 5. A ⇒ (B ⇒ (A ∧ B)) by ⇒ I, discharging 1. Remark If asked to deduce a formula of the form A ⇒ B, then it is very often useful to make A an assumption, with the idea of discharging it later using ⇒ I. Theorem 5 B | −→ A ⇒ B Proof 1. A Assumption 2. B P remise 3. B by Id 4. A ⇒ B by ⇒ I, discharging 1. This theorem is important. It says that if a result, say B, has been established, then a further result is A ⇒ B, where A is any logical form. Theorem 6 | −→ B ⇒ (A ⇒ B) Proof 1. A Assumption 28 28 CHAPTER 4. PROPOSITIONAL LOGIC 2. B Assumption 3. B by Id 4. A ⇒ B by ⇒ I, discharging 1. 5. B ⇒ (A ⇒ B) by ⇒ I, discharging 2. Looking at Theorem 4 and Theorem 5 we could pose the following question. Could it be that we can move an assumption across the ` symbol to get another valid result? We will consider this question later. Theorem 7 A ⇒ B, B ∧ C | −→ A ⇒ C Proof 1. A Assumption 2. B ∧ C P remise 3. C by ∧ E 4. A ⇒ C by ⇒ I, discharging 1. Note that we did not need to use A ⇒ B, so effectively we have B ∧ C ` A ⇒ C. Of course it is still the case that A ⇒ B, B ∧ C | −→ A ⇒ C. Theorem 8 | −→ (A ⇒ (B ⇒ C)) ⇒ ((A ⇒ B) ⇒ (A ⇒ C)) Proof 1. A Assumption 2. A ⇒ B Assumption 3. B by ⇒ E with 1, 2. 4. A ⇒ (B ⇒ C) Assumption 5. B ⇒ C by ⇒ E with 1, 4. 6. C by ⇒ E with 3, 5. 7. A ⇒ C by ⇒ I, discharging 1. 29 29 CHAPTER 4. PROPOSITIONAL LOGIC 8. (A ⇒ B) ⇒ (A ⇒ C) by ⇒ I, discharging 2. 9. (A ⇒ (B ⇒ C)) ⇒ ((A ⇒ B) ⇒ (A ⇒ C)) by ⇒ I, discharging 4. Although this formal proof seems a little long - with more practice this will become less daunting the alternative methods of establishing the validity of this argument are not as attractive. Exercise Prove the following | −→ ((A ⇒ B) ∧ (B ⇒ C)) ⇒ (A ⇒ C) Theorem 9 A, ¬A | −→ ⊥ Proof Recalling that A ⇒ ⊥ ≡ ¬A 1. A Assumption 2. A ⇒ ⊥ Assumption 3. ⊥ ⇒ E with 1, 2. Theorem 10 ¬A | −→ A ⇒ B Proof 1. A Assumption 2. ¬A Assumption 3. ⊥ T heorem 9 4. B ⊥ 5. A ⇒ B by ⇒ I, discharging 1. Exercise Prove each of the following i | −→ ¬A ⇒ (A ⇒ ⊥) 30 30 CHAPTER 4. PROPOSITIONAL LOGIC ii | −→ A ⇒ (¬A ⇒ B) Theorem 11 | −→ (¬B ⇒ ¬A) ⇒ (A ⇒ B) Proof We could try to use ¬B ⇒ ¬A and A as assumptions and try to derive B, and then discharge the assumption to get the result. However this will not work. Consider the following approach. 1. ¬B Assumption 2. ¬B ⇒ ¬A Assumption 3. ¬A by ⇒ E with 1, 2. 4. A Assumption 5. ⊥ by theorem 9 6. B by RAA discharging 1. 7. A ⇒ B by ⇒ I, discharging 4. 8. (¬B ⇒ ¬A) ⇒ (A ⇒ B) by ⇒ I, discharging 2. Theorem 12 | −→ (B ⇒ A) ⇒ (¬A ⇒ ¬B) Proof 1. B Assumption 2. B ⇒ A Assumption 3. A by ⇒ E with 1, 2. 4. ¬A Assumption 5. ⊥ by theorem 9 6. ¬B by RAA discharging 1. 7. ¬A ⇒ ¬B by ⇒ I, discharging 4. 8. (B ⇒ A) ⇒ (¬A ⇒ ¬B) by ⇒ I, discharging 2. 31 31 CHAPTER 4. PROPOSITIONAL LOGIC Exercise Prove each of the following i | −→ (A ⇒ ⊥) ⇒ ¬A ii | −→ (¬A ⇒ B) ⇒ (¬B ⇒ A) iii | −→ (A ⇒ ¬B) ⇒ (B ⇒ ¬A) Theorem 13 | −→ ¬¬A ⇒ A Proof 1. ¬A Assumption 2. ¬¬A Assumption 3. ⊥ by theorem 9 4. A by RAA discharging 1. 5. ¬¬A ⇒ A by ⇒ I, discharging 2. Exercise Prove the following | −→ A ⇒ ¬¬A Exercise Write a formal proof for each of the following arguments from propositional logic ¬A | −→ A ⇒ B A ⇒ B , A | −→ B A ⇒ (A ⇒ B) , A | −→ B A ⇒ (B ⇒ ¬A) , (B ⇒ ¬A) ⇒ ¬A | −→ A ⇒ ¬A A ⇒ (A ⇒ B) , (A ⇒ B) ⇒ ¬B | −→ A ⇒ ¬B 32 CHAPTER 4. PROPOSITIONAL LOGIC 32 Contents 1 Propositional Logic 1 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Propositions and Truth Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2.1 Conjunction, Disjunction and Negation . . . . . . . . . . . . . . . . . . . . . . . 7 1.2.2 Implication and Equivalence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.3 Laws of Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.4 Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 1.5 Resolution in Propositional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 1.5.1 Conjunctive Normal Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 1.5.2 The Resolution Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Formal Proofs in Propositional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 1.6