Introduction to Logical Thinking in Computer Science at VSB - Technical University of Ostrava
This course introduces the concept of logical thinking in Computer Science at VSB - Technical University of Ostrava. Topics include valid arguments, deductive reasoning, and the science of correct reasoning. Requirements for passing the course include written tests and exams with specified grade ranges. Emphasis is placed on understanding logical structures and reasoning processes.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Department of Computer Science, Faculty of Electrical Engineering and Computer Science, VSB - Technical University of Ostrava Introduction to Logical Thinking 1
Texts to study: Devlin, K.: Introduction to Mathematical Thinking, K. Devlin 2012, ISBN: 978-0615653631 Huth, M.: Logic in Computer Science: Modelling and Reasoning about Systems, Cambridge 2008, ISBN: 978-0521670890 Mathematical Logic 2
Requirements to pass the course Accreditation: Written test Min. 21 grades, max. 40 grades Exam: Written test (min. 31 grades, max. 60 grades) Total: at least 51 grades good (3), at least 66 grades very good (2), at least 86 grades excellent (1) Mathematical Logic 3
1. Introduction What is logic about? What is the subject of logic? Logic is the science of correct, valid reasoning, or, in other words, the art of a valid argumentation What is an argument? Argument: On the assumption of true premises P1,...,Pnit is possible to reason that the conclusion Z is true as well: P1, ..., Pn Z Example: On the assumption that it is Tuesday I belief that today a lecture on Mathematical logic takes place: Tuesday Lecture on Logic 4
Introduction: valid arguments In this course we deal only with deductively valid arguments. Notation: P1,...,Pn|= Z The conclusion Z logically follows from the premises P1,..., Pn. Definition 1: The conclusion Z logically follows from the premises P1,...,Pn, notation: P1,...,Pn|= Z, iff under no circumstances it might happen that the premises were true and the conclusion false. 5
Introduction: valid arguments Example: Because it is Tuesday today I believe that the lecture on Mathematical Logic takes place: It is Tuesday Lecture on Logic takes place Is it a deductively valid argument? No, it is not: It might happen that Duzi were sick and the lecture does not take place though it is Tuesday (a premise is missing, for instance that each Tuesday the lecture takes place). Each Tuesday the lecture on Logic takes place. It is Tuesday today Today the lecture on Logic takes place. invalid valid 6
(Deductively) invalid arguments: generalization (induction), abduction We will not deal with arguments that are not deductively valid, like: generalization (induction), abduction, and other ductions a subject of Artificial Intelligence (non-monotonic reasoning) Examples: Till now logic always took place on Tuesdays. (Therefore) Logic will take place also this Tuesday induction, invalid All swans that I have seen till now are white. (Therefore) All swans are white induction, invalid 7
(Deductively) invalid arguments: generalization (induction), abduction Examples: All rabbits in the hat are white. These rabbits are from the hat. These rabbits are white. Deduction, valid These rabbits are from the hat. These rabbits are white. (Probably) All rabbits in the hat are white. Generalization, Induction, invalid All rabbits in the hat are white. These rabbits are white. (Probably because) These rabbits are from the hat. Abduction, invalid Seeking premises, causes of events, diagnosis of malfunctions 8
Examples of deductively valid arguments Examples of deductively valid arguments 1. He is at home or he has gone to a pub. If he is at home then he plays a piano. But he does not play a piano. ------------------------------------------------ Hence He has gone to the pub. Sometimes the arguments are so obvious that it seems as if we did not need any logic. Well: If he did not play a piano (3. premise), then he was not at home (2. premise), and according to the first premise he must have gone to the pub. We all use logic in our everyday life, we wouldn t survive without logic: 2. All agarics (mushrooms) have a strong toxic effect. The mushroom I have picked up is an agaric. ---------------------------------------------------------------------- The mushroom I have picked up has a strong toxic effect. Will you examine the mushroom by tasting it, or will you rely on logic? 9
Examples of deductively valid arguments Examples of deductively valid arguments All agarics (mushrooms) have a strong toxic effect. This apple is an agaric. ---------------------------------------------------------------------- Hence This apple has a strong toxic effect. The argument is valid. But the conclusion is evidently not true (false). Hence, at least one premise is false (obviously the second). Circumstances according to Definition 1 are particular interpretations (depending on the expressive power of the logical system). Logical connectives ( and , or , if then ) and quantifiers ( all , some , every , ) have a fixed interpretation; we interpret elementary propositions and/or their parts, i.e. predicates and descriptions In our example, if this apple and agarics were interpreted in such a way that the second premise were true, the truth of the conclusion is guaranteed. We also say that the argument has a valid logical form. 10
Examples of deductively valid arguments Logic is a tool that helps us to discover the relation of logical entailment, to answer questions like What follows from particular assumptions ?, etc. If the course is good then it is useful. The lecturer is sharply demanding studiousness or the course is not useful. But the lecturer is not demanding. -------------------------------------------------------------------------- Hence 4. The course is not good. It helps our intuition that can sometimes fail. The assumptions can be complicated, enmeshed in negations and other connectives , so that the relation of entailment is not obvious at first sight. Similarly as all the mother-tongue speakers use intuitively rules of grammar without knowing the grammar explicitly (often not being able to formulate the rules). But sometimes it is useful to consult the grammar book or a dictionary (in particular when taking part in a TV competition). 1. 2. 3. 11
Examples of deductively valid arguments 1. All men like football and beer. 2. Some beer-lovers do not like football. 3. Xaver likes only those who like football and beer. 4. Xaver does not like some women. Necessarily, if premises are true the conclusion has to be true as well. Is this argument valid? Certainly, if Xaver likes only those who like football and beer (premise 3), then he does not like some beer- lovers (namely those who do not like football according to the premise 2). Hence, (according to 1) he does not like some no-men , i.e., women. But according to the Definition 1 the argument is not valid: the argument is valid if necessarily, i.e., in all the circumstances (under all interpretations) in which the premises are true the conclusion is true as well. But: in our case those individuals that are not men would not have to be interpreted as women. A premise is missing, viz. the premise who is not a man is a woman . Moreover, to be precise, we should also specify that who is a lover of something he likes that . 12
Examples of deductively valid arguments Hence: We have to state all the premises necessary for deriving the conclusion. 1. 2. 3. 4. 5. All men like football and beer. Some beer-lovers do not like football. Xaver likes only those who like football and beer. Who is not a man is a woman. Who is a lover of something he likes it. 6. Xaver does not like some women. Now the argument is valid, it has a valid logical form. The conclusion is logically entailed by (follows from) the premises. We also say that the conclusion is informationally (deductively) contained in the premises. 13
Valid arguments in mathematics Argument A: No prime number is divisible by three. The number 9 is divisible by three. Thenumber 9 is not a prime. valid Argument B: No prime number is divisible by six. The number eight is not a prime. The number eight is not divisible by six. invalid Though in the second case B it can never happen that the premises were true and the conclusion false, the argument is invalid. The conclusion is not logically entailed by the premises. If the expression eight were interpreted as the number 12, the premises would be true and the conclusion false. (The conclusion is not deductively contained in the premises) 14
Theorem of deduction; semantic variant If the argument P1,...,Pn |= Z is valid, then the statement of the form if P1and ... and Pnthen Z P1&...& Pn Z is analytically (necessarily) true. Notation: |= P1 ... Pn Z. Hence: P1,...,Pn |= Z P1,...,Pn-1 |= (Pn Z) P1,...,Pn-2 |= ((Pn-1 Pn) Z) P1,...,Pn-3 |= ((Pn-2 Pn-1 Pn) Z) |= (P1 ... Pn) Z (if and only if) 15
Logical analysis of language Validness of an argument is determined by the meaning (interpretation) of particular statements that are analyzed (formalized) in a less or more fine- grained way according to the expressive power of a logical system: Propositional logic: makes it possible to analyze only the way in which a complex statement is composed from elementary propositions. The composition of elementary propositions is not examined, they contribute only by its truth value: True 1, False 0 (an algebra of truth values) 1st-order Predicate logic: makes it possible to analyze moreover the composition of elementary propositions, namely the way in which properties and/or relations are ascribed to (tuples of) individuals. 2nd-order Predicate logic: makes it possible to analyze moreover properties of properties, propertied of functions and relations between them. Modal logics (analyze necessary and possible ), epistemic logics (knowledge), doxastic logics (of hypotheses) deontic logics (of commands), ... Transparent intensional logic (perhaps the most powerful system) see the course Principles of logical analysis . 16
Properties of valid arguments A valid argument may have a false conclusion: All primes are odd The number 2 is not odd The number 2 is not a prime But then at least one premise has to be false In such a case we also say that the argument is not sound. But a valid argument that is not sound may also be useful: a proof ad absurdum. If you want to show that your boss is not right, it is not diplomatic to say it in an open way. Instead, you may argue by way of the proof ad absurdum: Well, you say P interesting, but P entails Q, and Q entails R, which is obviously false. (Hence, P must have been false as well.) Monotonicity: if an argument is valid then extending the set of assumptions by another premise does not change the validity of the argument. 17
Properties of valid arguments From contradictory (inconsistent) assumptions (such that it can never happen that all of them were simultanously true) any conclusion follows. If I study hard then I ll pass the exam. I haven t passed the exam though I studied hard. -------------------------------------------------------------------- (e.g.) My dog plays a piano right now Reflexivity: If A is one of the assumptions P1,...,Pn, then P1,...,Pn|= A. Transitivity: If P1, , Pn|= Z and Q1, , Qm, Z |= Z , then P1, , Pn, Q1, , Qm|= Z . 18