propositional logic - middle east technical university

32
Propositional Logic COGS 502

Upload: others

Post on 25-Feb-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Propositional Logic

COGS 502

• We need valid arguments to reason about situations formally

• Propositional logic is one of the languages that we can use to base our arguments on a formal structure

• Propositions (declarative senteces) have truth values

Declarative Senteces

• e.g., – The sum of the numbers 3 and 5 equals 8 – All Martians like pepperoni on their pizza – Albert Camus ´etait un ´ecrivain francais

• Both sentences are declarative independent of the

meanings of their components (e.g. Martians) since in principle these sentences can be declared as ‘true’, or ‘false’

• So we are dealing with truth values, not actual state of affairs in propositional logic

Symbolic structure

• If all our assumptions are true, then our conclusion ought to be true as well

• Atomic sentences:

– p: ‘I won the lottery last week.’

– q: ‘I purchased a lottery ticket.’

– r: ‘I won last week’s sweepstakes.’

• Complex sentences can be constructed in a compositional way with atomic sentences

Rules for complex sentences

• ¬: The negation of p is denoted by ¬p and expresses ‘It is not true that I won the lottery last week.’

• ∨: Given p and r , the disjunction of p and r states that at least one of them is true

• ∧: The formula p ∧ r denotes the conjunction of p and r: ‘Last week I won the lottery and the sweepstakes.’

• →: implication between p and q (p → q) states that q is a logical consequence of p (p is the assumption of p → q and q its conclusion) – ‘If I won the lottery last week, then I purchased a lottery ticket.’

expresses an,

cont.

• (p ∧ q) → ((¬r) ∨ q)

• The brackets are necessary to disambiguate assertions

• Binding properties of the symbols: – ¬ binds more tightly than ∨ and ∧, and the latter two bind

more tightly than →

– Implication → is right associative: expressions of the form p → q → r denote p → (q → r).

Natural Deduction

• Proof rules allow us to infer formulas from other formulas

• φ1, φ2, . . . , φn Ⱶ ψ

(premises) Ⱶ (conclusion) • If the train arrives late and there are no taxis at the

station, then John is late for his meeting. John is not late for his meeting. The train did arrive late. Therefore, there were taxis at the station

i. p ∧¬ q → r

Conjuction rules

• Conjunction rule (∧): and-introduction

• Conjunction rule (∧): and-elimination

Name of the rule

premises

conclusion

e.g.

• p ∧ q, r |− q ∧ r

1. p ∧ q premise

2. r premise

3. q ∧ e 1

4. q ∧ r ∧i 3,2

The rules of double negation

• Intuitively, there is no difference between a formula φ and its double negation ¬¬φ

• We are free to state this fact in this more complicated manner if we wish

The rule for eliminating implication (modus ponens)

• This rule states that, given φ and knowing that φ implies ψ, we may rightfully conclude ψ

• p, p → q and p → (q → r)

• infer r

cont.

1. p → (q → r) premise

2. p → q premise

3. p premise

4. q → r →e 1, 3

5. q →e 2, 3

6. r →e 4, 5

Modus tollens (MT)

• Suppose that p → q and ¬ q are the case

• Then, if p holds we can use →e to conclude that q holds. Thus, we then have that q and ¬ q hold, which is impossible. Therefore, we may infer that p must be false

• ‘If Abraham Lincoln was Ethiopian, then he was African. Abraham Lincoln was not African; therefore he was not Ethiopian.’

cont.

• p → (q → r), p, ¬r Ⱶ ¬q

1. p → (q → r) premise

2. p premise

3. ¬r premise

4. q → r →e 1, 2

5. ¬q MT 4, 3

The rule implies introduction

• p → q Ⱶ ¬q → ¬p

• If we temporarily assume that ¬q holds, we can use MT to infer ¬p. Thus, assuming p → q we can show that ¬q implies ¬p

cont.

• Showing p → q using the rule →i is called type checking, an important topic in the construction of compilers for typed programming languages

Theorems

• Logical formulas φ with valid sequent Ⱶ φ are theorems

• Show that the sequent (q → r) → ((¬q → ¬p) → (p → r)) is valid and a theorem

cont.

cont.

• The nested boxes in the proof reveal a pattern of using elimination rules first, to deconstruct assumptions we have made, and then introduction rules to construct our final conclusion

e.g.

p → (q → r) p ∧ q → r and p ∧ q → r p → (q → r) are valid and equivalent

The rules for disjunction

• The introduction of disjunctions is by far easier to grasp than their elimination

• If p stands for ‘Agassi won a gold medal in 1996.’ and q denotes the sentence ‘Agassi won Wimbledon in 1996.’ then p ∨ q is the case because p is true, regardless of the fact that q is false

Or elimination

• To show some proposition χ by assuming φ ∨ ψ, we have to give two separate proofs (since we don’t know which of φ and ψ is true) which we need to combine into one argument

cont.

• (p ∨ q) Ⱶ (q ∨ p) is valid

cont.

• q → r Ⱶ p ∨ q → p ∨ r

The rules for negation

• Introduction or elimination of single negations involve the notion of contradiction

• Contradictions are expressions of the form φ ∧¬φ or ¬φ ∧ φ, where φ is any formula

• As far as truth is concerned, contradictions are all equivalent; that means we should be able to prove the validity of

cont.

• Any formula can be derived from a contradiction and therefore it makes this argument valid (p ∧¬p) Ⱶ q

– p: The moon is made of green cheese.

– q : I like pepperoni on my pizza

• bottom-elimination (⊥ can prove anything)

• not-elimination (⊥ itself represents a contradiction)

e.g.

• ¬p ∨ q Ⱶ p → q

Introducing negations

• p → q, p→ ¬q Ⱶ ¬p

reductio ad absurdum (proof by contradiction)

law of the excluded middle (LEM)

• φ ∨ ¬φ is true: whatever φ is

e.g.

• show that p → q Ⱶ ¬p ∨ q is valid

Well-formed formulas

• The well-formed formulas of propositional logic are those which we obtain by using the construction rules below, and only those, finitely many times

• atom: Every propositional atom p, q, r, . . . and p1, p2, p3, . . .

is a wellformed formula

• ¬: If φ is a well-formed formula, then so is (¬φ)

• ∧: If φ and ψ are well-formed formulas, then so is (φ ∧ ψ)

• ∨: If φ and ψ are well-formed formulas, then so is (φ ∨ ψ)

• →: If φ and ψ are well-formed formulas, then so is (φ → ψ)