Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží...

38
Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží [email protected]

Transcript of Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží...

Page 1: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic1

Introduction to logic: Lesson 2, propositional logic

Marie Duží

[email protected]

Page 2: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 2

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 Pn implies Z is necessarily true (a tautology):

|= (P1 & … & Pn) Z

Page 3: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 3

Arguments

P1, ..., Pn |= Z iff

|= (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.

Page 4: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 4

Arguments

No prime is divisible by 39 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.

Page 5: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 5

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)

Page 6: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 6

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

Page 7: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 7

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)

Page 8: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic8

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.

Page 9: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic9

Examples of composed sentences

It is raining in Prague and it is a sunshine in Brno.

S1 connective S2

It is not true that it is raining in Prague.

connective S

Page 10: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 10

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:

a) Symbols for propositions: p, q, r, ... (also with indexes p1, p2, …)

b) Symbols for logical connectives: , , , , c) Auxiliary symbols: (, ), [, ], {, }

• Symbols ad a) stand for elementary sentences• Symbols ad b), i.e., , , , , are called:

negation (), disjunction (), conjunction (), implication (), equivalence ().

Page 11: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 11

Definition: language of PL

Grammar (defines inductively well-formed-formulas)Inductive definition of an infinite set of WFF:

1. Symbols p, q, r, ... are (well-formed) formulas (the definition base).

2. If A, B are formulas, then expressions

A, A B, A B, A B, A B are (well-formed) formulas (inductive definition step).

3. Only expressions due to 1. and 2. are WFFs. (the definition closure).

• The language of PL is the set of well-formed formulas.Note: Formulas according to 1. are atomic formulas

Formulas according to 2. are composed formulas

Page 12: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 12

Well-formed formulasNotes:

Symbols A, B are metasymbols. 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

Page 13: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 13

Definition: semantics (meaning) of formulas

The truth-value valuation of propositional symbols is a mapping v that to each propositional symbol p assigns 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 is a function w, which for each valuation v of propositional symbols pi associates the formula with its truth value in the following way:

• The truth value of an elementary formula p: wpv = vp for any 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.:

Page 14: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 14

Table 2.1.: the truth–value functions

A B A A B A B A B A B

1 1 0 1 1 1 1

1 0 0 1 0 0 0

0 1 1 1 0 1 0

0 0 1 0 0 1 1

Page 15: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 15

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

Page 16: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

16

Implication• Implication• “if … then …“: (binary, non-commutative connective)

A B; A is the antecedent, B is the consequent.• Implication (as well as any other connective) does not render any

semantic connection between antecendent 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 a pope”: p r (What does the sentence entail? Since I am not a pope, the UFOs do not exist)

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

Page 17: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 17

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.

Page 18: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 18

Definition. Satisfiable formulas, tautology, contradiction, model

A model of a formula A: valuation v such 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 v such that v is a model of every formula Ai, i = 1,...,n. The valuation v is then a model of the set {A1,…,An}.

Page 19: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 19

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)

p q p q p q (p q) (p q) (p q) A

1 1 1 0 0 1 0

1 0 0 1 1 1 0

0 1 1 0 0 1 0

0 0 1 0 0 1 0

Page 20: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 20

Logical entailment in PL

A formula A logically follows from a set of formulas M, denoted M |= A, iff A is true in every model of the set M.

Note: Mind the Definition 1 (slide 5 of Lesson 1). The circumstances are in propositional logic mapped as valuations (True – 1, False - 0) of elementary atomic sentences: Under all the circumstances (means

valuations in PL) such that the premises are true the conclusion must be true as well.

Page 21: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 21

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 | h p, h w | w p 1 1 1 1 1 1 conclusion

1 1 0 1 0 1 1 0 1 1 1 1 is true in all

1 0 0 1 0 0 0 1 1 1 1 1 the four models 0 1 0 1 1 1 of premises

0 0 1 0 1 10 0 0 0 1 0

Page 22: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 22

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: h p, h w | w p

1 1 0 1 0 0

1 0 1 0 0

contradiction

Page 23: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 23

Examples: Logical entailment

All the arguments with the same logical form as a valid argument are valid:h p, h w |= w p

For variables h, p, w any elementary sentence 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

Page 24: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 24

Logical entailment

If the argument is valid, P1,...,Pn |= Z,then the formula of the implication form is a tautology:

|= (P1 ... Pn) Z. A proof that a formula is a tautology or that a

conclusion Z logically follows from premises can be performed:a) In the direct way – for instance by a truth-value tableb) In the indirect way: P1 ... Pn Z is a contradiction;

hence the set of premises + negated 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.

Page 25: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 25

A proof of a tautology

|= ((p q) q) pIndirect: ((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

Page 26: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 26

The most important tautologies

Tautologies with one propositional variable:

|= p p

|= p p the law of excluded middle

|= (p p) the law of contradiction

|= p p the law of double negation

Page 27: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 27

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)]

Page 28: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 28

Laws of 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)

Page 29: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 29

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

Page 30: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 30

Negation of implication

Parents: If you are good you well get a new ski at Christmas! (p q)

Child: I have been good all the year and there is no ski under the Christmas tree!

p q(Did the parents fulfill their promise?)

Attorney general:If the accused man is guilty then there was an accessory in the fact

Defence lawyer:It is not true !

Question: Did the advocate (defence lawyer) help the accused man; what did he actually claim?(The man is guilty and he performed the illegal act alone!)

Page 31: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 31

Negation of implicationSentence 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 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.

Page 32: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 32

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

Page 33: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 33

Some more arguments

If Charles has high blood pressure and breathes with difficulties or he 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 1. reading and

the 2. reading because they are not equivalent. The conclusions will be different.

Page 34: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 34

Analysis of the 1. reading

1. analysis: [(p q) r] s, s, q ???a) 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.

Page 35: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 35

Analysis of the 2. reading

2. analysis: [p (q r)] s, s, q ??? a) reasoning with equivalent transformations:

[p (q r)] s, s [p (q r)] transposition de Morgan:

p (q r) but q is true the second disjunct cannot be true the first is true:

p (consequence)

Hence Charles does not have a high blood pressure

(we cannot conclude anything about his temperature r)

Page 36: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 36

A proof of both cases

1. analysis: [(p q) r] s, s, q |= p,r2. analysis: [p (q r)] s, s, q |= p home worka) 1. case – by means of a table: home workb) 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

Page 37: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 37

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 transformation– Indirect proof

Page 38: Introduction to Logic 1 Introduction to logic: Lesson 2, propositional logic Marie Duží marie.duzi@vsb.cz.

Introduction to Logic 38

Thank you for your attention

See you next week