390 likes | 429 Views
Mathematical Logic : Lesson 2, propositional logic. Marie Duží m arie.duzi@ vsb .c z. Some more arguments.
E N D
Mathematical Logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz Mathematical Logic
Some more arguments • An argument is valid iff it is necessary that under all interpretations (valuations in propositional logic), in which the premises are true the conclusion is true as well: P1,...,Pn |= Z • P1,...,Pn |= Z if and only if The statement of the form P1 and ... and Pnimplies Z is necessarily true (a tautology): |= (P1 & … & Pn) Z Mathematical Logic
Arguments P1, ..., Pn|= Ziff |=(P1& … & Pn) Z • BUT !!! • It does not mean that the conclusion is (or must be) true. We are dealing with a valid logical form, a necessary relation between premises and the conclusion. Mathematical Logic
Arguments No prime is divisible by 3 9 is divisible by 3 ---------------------------------- 9 is not a prime • It is a valid argument though the first premise is not true (3 is a prime divisible by 3). Another interpretation: All men are rational. A stone is not rational. -------------------------------- A stone is not a man. Mathematical Logic
Arguments • Or, by substituting: If the number 12 is a prime then it is not divisible by 3. 12 is divisible by 3. 12 is not a prime. • Or: 12 is not a prime number or it is not divisible by 3. 12 is divisible by 3. 12 is not a prime number. Valid argument schemes (examples of logical forms): • A B, A |= B modus ponens • A B, B |= A, modus ponens + transposition • A B, B |= A modus ponens + transposition • A B, B |= A elimination of disjunction (disjunctive syllogism) Mathematical Logic
Arguments • Hence if we prove that the conclusion logically follows from the assumptions, then by virtue of it we do not prove that the conclusion is true • It is true, provided the premises are true • The argument the premises of which are true is called sound. • Truthfulness or Falseness of premises can be a contingent matter. But the relation of logical entailment is a necessary relation (“in all the circumstances ...“). • Similarly a tautology is a logically, necessarily true formula. • If a tautology is of an implication form, then according to the definition of the implication it is true also in case of the antecedent being false, and false only in case the antecedent is true and consequent false, which corresponds to the definition of logical entailment: • A1,…,An |= C iff |= A1… An C Mathematical Logic
Propositional (Sententional) Logic • The simplest logical system. It analyzes a way of composing a complex sentence (proposition) from elementary propositions by means of logical connectives. • What is a proposition? A proposition (sentence) is a statement that can be said to be true or false. • The Two-Value Principle – tercium non datur – two-valued logic (but there are many-valued logical systems, logics of partial functions, fuzzy logics, etc.) • Is the definition of a sentence trivial? Are all the statements sentences, or in other words, do all the statements denote a proposition? No, it is not so: • The (current) King of France is bald. • True? But then the King of France exists. False? But then it is true that the King of France is not bald, hence the King of France exists as well. The statement is neither true nor false, it is not a sentence. • Did you stop beating your wife? (try to answer in case you have never been married or never beat your wife) Mathematical Logic
Propositional logic: semantic exposition (Semantics = meaning) • There are two kinds of Sentences: • Atomic (Elementary) – no proper part of the sentence is a sentence as well • Molecular (Composed) – the sentence has its own part(s) that is (are) a sentence(s) as well • The Compositionality Principle: meaning of a composed sentence is a function (depends only on) the meanings of its components. • The meaning of sentences is in propositional logic reduces to: True (1), False (0). • An algebra of truth values. Mathematical Logic
Examples of composed sentences It is raining in Pragueanditis a sunshine in Brno. S1 connective S2 • It is not truethat it is raining in Prague. connective S Mathematical Logic
Definition: language of PL • A formal language is defined by an alphabet (a set of symbols) and a grammar (a set of rules that define the way of forming “Well Formed Formulas” - WFF) • Language of Propositional Logic (PL) • alphabet: • Symbols for propositions: p, q, r, ... (also with indexes p1, p2, …) • Symbols for logical connectives: , , , , • Auxiliary symbols: (, ), [, ], {, } • Symbols ad a) stand for elementary sentences • Symbols ad b), i.e., , , , , are called: negation (), disjunction (), conjunction (), implication (), equivalence (). Mathematical Logic
Definition: language of PL Grammar (defines inductively well-formed-formulas) Inductive definition of an infinite set of WFF: • Symbols p, q, r, ... are (well-formed) formulas(the definition base). • If A, B are formulas, then expressions A, A B, A B, A B, A B are (well-formed) formulas(inductive definition step). • Only expressions due to 1. and 2. are WFFs. (the definition closure). • The language of PLis the set of well-formed formulas. Note: Formulas according to 1. are atomic formulas Formulas according to 2. are composed formulas Mathematical Logic
Well-formed formulas Notes: Symbols A, B aremetasymbols. We can substitute for them any WFF created according to the definition. The outermost parentheses can be omitted. For the logical connectives other symbols are sometimes used: Symbol alternate -------------------------------- , , & ~ Example: (p q) p is a WFF (the outer parentheses omitted) (p ) q is not a WFF Mathematical Logic
Definition: semantics (meaning) of formulas The truth-value valuation of propositional symbolsisa mappingvthatto each propositional symbol passigns a truth value, i.e., a value from the set {1,0},which codes the set {True, False}: {pi}{1,0} The truth-value function of a PL formula isa functionw, which for each valuation v of propositional symbols piassociates the formula with its truth value in the following way: • The truth value of an elementary formula p: wpv = vpforany propositional variable p. • If the truth values of formulas A, B are given, then the truth value of the formulas A, A B, A B, A B, A B are defined by the table 2.1.: Mathematical Logic
Table 2.1.: the truth–value functions Mathematical Logic
Transforming natural language to the PL language • Elementary sentences: by the propositional variables p, q, r, ... • Connectives of natural language: by means of the symbols for logical connectives: • Negation: • “it is not true that”: (unary connective) • Conjunction: • “and”: (binary, commutative connection) • Prague is a capital and 2+2=4:p q • Note: not every “and” denotes a logical connective! Example: “Peter came home and opened the window”. • Disjunction: • “or”: (binary, commutative connection) • Prague or Brno is a great city. p q • non-alternative • In a natural language we often use “or” as an alternative “either, or”: “I’ll go to the cinema or I’ll stay at home” • Alternative “or” is a non-equivalence Mathematical Logic
Implication– be careful !!! • “if … then …“: • (binary, non-commutative connective)A B; A is the antecedent, B is the consequent. • Implication (as well as any other connective of propositional logic) does not render any semantic connection between antecedent and consequent: • material implication(middle ages: ”suppositio materialis”). • Hence implication does not render a causal or chronological connection: • ”If 1+1=2, then iron is a metal” (a true proposition): p q • ”If the UFOs (flying saucers) exist, then I am the Pope”: p r (What do I want to say? Since I am not the Pope, the UFOs do not exist)
Implication– be careful !!! • Note: The connectives “because”, “therefore”, “since”, etc. do not correspond to the logical implication! • “The ice-hockey team lost the match, therefore the players came home from the world championship earlier”. “Because I am sick, I stay at home”. • “sick” “home”? But then it would have to be true even if I am not sick (see the table 2.1 – the definition of implication) • We might analyze it by means of the modus ponens: [p (p q)] q
The equivalence connective • Equivalence: • ”if and only if” (iff) • ”The Greek army used to win if and only if the result of the battle depended on their physical strength”: p q • It is most frequently used in mathematics (in definitions), in a natural language its use is seldom • Example: a) “I’ll slap you if you cheat on me” cheat slap b) “I’ll slap you if and only if you cheat on me” cheat slap Situation: You did not cheat. When can you be slapped? Ad a) – You may be slapped, Ad b) – You might not be slapped. Mathematical Logic
Definition. Satisfiable formulas, tautology, contradiction, model • A model of a formula A is avaluation vsuch that A is true in v: w(A)v = 1. • A formula is satisfiable iff it has at least one model • A formula is a contradiction iff it has no model • A formula is a tautology iff any valuation v is its model. • A set of formulas {A1,…,An} is satisfiable iff there is a valuation vsuch that vis a model of every formula Ai, i = 1,...,n. The valuation v is then a model of the set {A1,…,An}. Mathematical Logic
Satisfiable formulas, tautology, contradiction, model • Example. Formula A is a tautology, A is a contradiction, formulas (p q), (p q) are satisfiable. • Formula A: (p q) (p q) Mathematical Logic
Logical entailment in PL • A formula A logically follows from a set of formulas M, denotedM |= A, iffA is true in every model of the set M. • Note: Mind the Definition 1 (slide 5 of Lesson 1). The circumstancesare in propositional logic mapped as valuations (True – 1, False - 0) of elementary atomic sentences: • Under all the circumstances (means valuationsofatomicpropositionalvariables in PL) such that the premises are true the conclusion must be true as well. Mathematical Logic
Examples: Logical entailment • He is at home (h) or he has gone to a pub (p) • If he is at home (h) then he is waiting for us (w) • If he is not waiting (w) for us then he has gone to the pub (p). h, p, w |hp, hw| wp 1 1 1 1 1 1conclusion 1 1 0 1 0 1 1 0 1 1 1 1is true in all 1 0 0 1 0 0 0 1 1 1 1 1the four models 0 1 0 1 1 1ofpremises 0 0 1 0 1 1 0 0 0 0 1 0 Mathematical Logic
Examples: Logical entailment • He is at home (h) or he has gone to a pub (p) • If he is at home (h) then he is waiting for us (w) • If he is not waiting (w) for us then he has gone to the pub (p). h p, h w| w p • The table has 2n lines!Hence, an indirect proof is more effective: • Assume that the argument is not valid. But then all the premises may be true and the conclusion false: • hp, hw | wp 1 1 0 1 0 0 1 0 1 0 0 contradiction Mathematical Logic
Examples: Logical entailment • All the arguments with the same logical form as a valid argument are valid: hp, hw |= wp For variables h, p, w any elementary sentences can be substituted: He plays a piano or studies logic. If he plays a piano then he is a virtuous. Hence If he is not a virtuous then he studies logic. Valid argument – the same valid logical form Mathematical Logic
Logical entailment • The argument is valid P1,...,Pn|= Z iff the formula of the implicative form is a tautology: |= (P1 ... Pn) Z. • The proof that a formula is a tautology or that a conclusion Z logically follows from premises can be done: • In thedirect way – for instance by a truth-value table • In theindirect way: P1 ... Pn Z is a contradiction; hence the set of premises + thenegated conclusion {P1, ...,Pn, Z} is contradictory, i.e., does not have a model: there is no valuation under which all the formulas – its elements were true. Mathematical Logic
A proof of a tautology |= ((p q) q) p Indirect: ((p q) q) p negated f., must be a contradiction 1 1 attempt whether it can be 1 1 1 1 1 0 contradiction There is no valuation under which the negated formula were true. Therefore, the original formula is a tautology Mathematical Logic
The most important tautologies Tautologies with one propositional variable: |= pp |= pp the law of excluded middle |= (pp) the law of contradiction |= pp the law of double negation Mathematical Logic
Algebraic laws for conjunction, disjunction and equivalence • |= (p q) (q p) commutative laws • |= (p q) (q p) • |= (p q) (q p) • |= [(p q) r] [p (q r)] associative laws • |= [(p q) r] [p (q r)] • |= [(p q) r] [p (q r)] • |= [(p q) r] [(p r) (q r)] distributive laws • |= [(p q) r] [(p r) (q r)] Mathematical Logic
Laws for implication |= p (q p) law of simplification |= (p p) q Duns Scot’s law |= (p q) (q p) law of contra-position |= (p (q r)) ((pq) r)premises joint |= (p (q r)) (q (p r)) order of premises does not matter |= (p q) ((q r) (p r)) hypothetic sylogism |= ((p q) (q r)) (p r) transitivity of implication |= (p (q r)) ((p q) (p r)) Frege’s law |= (p p) p reductio ad absurdum |= ((p q) (p q)) p reductio ad absurdum |= (p q) p , |= (p q) q |= p (p q) , |= q (p q) Mathematical Logic
Laws of transformation |= (p q) (p q) (q p) |= (p q) (p q) (q p) |= (p q) (p q) (q p) |= (p q) (p q) |= (p q) (p q)Negation of implication |= (p q) (p q)De Morgan law |= (p q) (p q)De Morgan law These laws define a method for negating Mathematical Logic
Negation of implication Implication works well in case of a promise. Example: Parents: If you behave well you will get a new iPhone at Christmas! (p q) Child: I did behave well the whole year and there is no iPhone under the Christmas tree! p q (Did the parents fulfill their promise?) Public prosecutor: If the accused man is guilty then he had an accomplice Defence lawyer: It is not true ! Question: Did the advocate (defence lawyer) help the accused man? What did he actually say? (The man is guilty and he performed the illegal act alone!) Mathematical Logic
Negation of implication Sentence in the future tense: If you steel it I’ll kill you! (p q) It is not true: I will steel it and yet you will not kill me. p q OK, but: If the 3rd world war breaks out tomorrow then more than three million people will be killed. It is not true: The 3rd world war will break out tomorrow and less than three million people will be killed ??? Probably by negating the sentence we did not intend to claim that (certainly) the 3rd world war will break out tomorrow: There is an unsaid (ecliptic) modality: Necessarily,if the 3rd world war breaks out tomorrow then more than three million people will be killed. It is not true: Possibly the 3rd world war breaks out tomorrow but at that case less than three million people will be killed. Handled by modal logics – not a subject of this course. Mathematical Logic
Some more arguments • Transformation from natural language may be ambiguous: If a man has high blood pressure and breathes with difficulties or he has a fever then he is sick. p – ”X has high blood pressure” q – ”X breathes with difficulties” r – ”X has a fever” s – ”X is sick” 1. possible analysis:[(p q) r] s 2. possible analysis: [p (q r)] s Mathematical Logic
Some more arguments If Charles has high blood pressure and breathes with difficulties or has a fever then he is sick. Charles is not sick but he breathes with difficulties. What can be deduced from these facts? We have to distinguish the first and second reading, because they are not equivalent. The conclusions will be different. Mathematical Logic
Analysis of the 1. reading • analysis: [(p q) r] s, s, q ??? • By means of equivalent transformations: [(p q) r] s, s [(p q) r] (de transposition Morgan) (p q) r (p q), r, but q holds p, r (consequences) Hence Charles does not have a high blood pressure and does not have a fever. Mathematical Logic
Analysis of the 2. reading • analysis: [p (q r)] s, s,q ??? • reasoning with equivalent transformations: [p (q r)] s,s [p (q r)] transposition, de Morgan: p (q r) butqis true the second disjunct cannot be true the first must be true: p (consequence) HenceCharles does not have a high blood pressure (we cannot conclude anything about his temperature r) Mathematical Logic
A proof of both cases 1. analysis: [(p q) r] s, s, q |= p,r 2. analysis: [p (q r)] s, s, q |= p home work • 1. case – by means of a table: home work • Indirect: premises + negated conclusion (p r) (p r) and we assume that every f. is true: • [(p q) r] s, s, q, p r • 1 1 0 1 1 • 0 0 • 0 0 • 0 1 p r = 0 contradiction Mathematical Logic
Summary • Typical tasks: • Verifying a valid argument • What can be deduced from given assumptions? • Add the missing assumptions • Is a given formula a tautology, contradiction, satisfiable? • Find models of a formula, find a model of a set of formulas • Methods we have learnt till now: • Table method • reasoning and equivalent transformations • Indirect proof Mathematical Logic
Propositional Satisfiability problem (the SAT problem) • In computer science, the Boolean satisfiability problem (sometimes called Propositional Satisfiability Problem and abbreviated as SATISFIABILITY or SAT) is the problem of determining if there exists an interpretation that satisfies a given propositional formula. • In other words, it asks whether the propositional variables of a given formula can be consistently replaced by the values 1 or 0 in such a way that the formula evaluates to 1. • If this is the case, the formula is called satisfiable. On the other hand, if no such assignment exists, the function expressed by the formula is FALSE for all possible variable assignments and the formula is unsatisfiable (contradiction). • For example, the formula „p q" is satisfiable because one can find the values p = 1 and q = 0, which make (p q) = 1. In contrast, „p p" is a contradiction (unsatisfiable). • SAT is the first problem that was proven to be NP-complete; see Cook–Levin theorem. This means that all problems in the complexity class NP, which includes a wide range of natural decision and optimization problems, are at most as difficult to solve as SAT. There is no known algorithm that efficiently solves each SAT problem, and it is generally believed that no such algorithm exists; yet this belief has not been proven mathematically, and resolving the question whether SAT has a polynomial-time algorithm is equivalent to the P versus NP problem, which is a famous open problem in the theory of computing. • Nevertheless, as of 2016, heuristical SAT-algorithms are able to solve problem instances involving tens of thousands of variables and formulas consisting of millions of symbols, which is sufficient for many practical SAT problems from e.g. artificial intelligence, circuit design, and automatic theorem proving. • Fordetailssee, e.g. https://en.wikipedia.org/wiki/Boolean_satisfiability_problem Mathematical Logic