Section 2

advertisement
Formal Logic
Mathematical Structures
for Computer Science
Chapter 1
Copyright © 2006 W.H. Freeman & Co.
MSCS Slides
Formal
Propositional Logic




Section 1.2
Deriving a logical conclusion by combining many propositions
and using formal logic: hence, determining the truth of
arguments.
Definition of Argument:
An argument is a sequence of statements in which the
conjunction of the initial statements (called the
premises/hypotheses) is said to imply the final statement (called
the conclusion).
An argument can be presented symbolically as
(P1 Λ P2 Λ ... Λ Pn)  Q
where P1, P2, ..., Pn represent the hypotheses and Q represents
the conclusion.
Propositional Logic
1
Valid Argument




What is a valid argument?  When does Q logically follow
from P1, P2, ..., Pn.
Informal answer: Whenever the truth of hypotheses leads to the
conclusion
Note: We need to focus on the relationship of the conclusion to
the hypotheses and not just any knowledge we might have about
the conclusion Q.
Example:




Section 1.2
P1: Neil Armstrong was the first human to step on the moon.
P2 : Mars is a red planet
And the conclusion
Q: No human has ever been to Mars.
This wff P1 Λ P2  Q is not a tautology
Propositional Logic
2
Valid Argument



Definition of valid argument:
An argument is valid if whenever the hypotheses are all true, the
conclusion must also be true. A valid argument is intrinsically
true, i.e. (P1 Λ P2 Λ ... Λ Pn)  Q is a tautology.
How to arrive at a valid argument?



Section 1.2
Using a proof sequence
Definition of Proof Sequence:
It is a sequence of wffs in which each wff is either a hypothesis
or the result of applying one of the formal system’s derivation
rules to earlier wffs in the sequence.
Propositional Logic
3
Rules for Propositional Logic

Section 1.2
Derivation rules for propositional logic
Equivalence Rules
Inference Rules
Allows individual wffs to be
rewritten
Allows new wffs to be derived
Truth preserving rules
Work only in one direction
Propositional Logic
4
Equivalence Rules


Section 1.2
These rules state that certain pairs of wffs are equivalent, hence
one can be substituted for the other with no change to truth
values.
The set of equivalence rules are summarized here:
Expression
Equivalent to
Abbreviation for rule
RVS
SVR
Commutative comm
(R V S) V Q
(R Λ S) Λ Q
R Λ (S Λ Q)
R V (S V Q)
Associativeass
(R V S)
(R Λ S)
R Λ S
R V S
De-Morgan’s Laws
De-Morgan
RS
R V S
implication - imp
R
(R)
Double Negation- dn
PQ
(P  Q) Λ (Q  P)
Equivalance - equ
Propositional Logic
5
Inference Rules


Inference rules allow us to add a wff to the last part of the proof
sequence, if one or more wffs that match the first part already exist
in the proof sequence.
From
Can Derive
Abbreviation for
rule
R, R  S
S
Modus Ponens- mp
R  S, S
R
Modus Tollens- mt
R, S
RΛS
Conjunction-con
RΛS
R, S
Simplification- sim
R
RVS
Addition- add
Note: Inference rules do not work in both directions, unlike
equivalence rules.
Section 1.2
Propositional Logic
6
Examples

Example for using Equivalence rule in a proof sequence:

Simplify (A V B) V C
1. (A V B) V C
2. (A Λ B) V C
3. (A Λ B)  C

1, De Morgan
2, imp
Example of using Inference Rule

If it is bright and sunny today, then I will wear my sunglasses.
Modus Ponens
It is bright and sunny today. Therefore, I will wear my sunglasses.
Modus Tollens
I will not wear my sunglasses. Therefore, it is not bright and sunny
today.
Section 1.2
Propositional Logic
7
Deduction Method



To prove an argument of the form
P1 Λ P2 Λ ... Λ Pn  R  Q
Deduction method allows for the use of R as an additional
hypothesis and thus prove
P1 Λ P2 Λ ... Λ Pn Λ R  Q
Prove
(A  B) Λ (B  C)  (A  C)
Using deduction method, prove (A  B) Λ (B  C) Λ A  C
1.
AB
hyp
2.
BC
hyp
3.
A
hyp
4.
B
1,3 mp
5.
C
2,4 mp


Section 1.2
The above is called the rule of Hypothetical Syllogism or hs in
short.
Many such other rules can be derived from existing rules which
thus provide easier and faster proofs.
Propositional Logic
8
More Inference Rules

Section 1.2
These rules can be derived using the previous rules. They
provide a faster way of proving arguments.
From
Can Derive
Name / Abbreviation
P  Q, Q  R
PR
Hypothetical syllogismhs
P V Q, P
Q
Disjunctive syllogismds
PQ
Q  P
Contraposition- cont
Q  P
PQ
Contraposition- cont
P
PΛ P
Self-reference - self
PVP
P
Self-reference - self
(P Λ Q)  R
P  (Q R)
Exportation - exp
P, P
Q
Inconsistency - inc
P Λ (Q V R)
(P Λ Q) V (P Λ R)
Distributive - dist
P V (Q Λ R)
(P V Q) Λ (P V R)
Distributive - dist
Propositional Logic
9
Proofs of inference rules

Prove that (P  Q)  (Q P) is a valid argument (called
Contraposition – con).



Prove P Λ P  Q
1.
2.
3.
4.
5.
6.
7.
8.
Section 1.2
Hence prove, (P  Q) Λ Q  P (using deduction method).
The above is true using the modus tollens inference rule.
P
P
PVQ
QVP
(Q) V P
Q  P
(Q)
Q
(called Inconsistency)
hyp
hyp
1, add
3, comm
4, dn
5, imp
2, 6, mt
7, dn
Propositional Logic
10
Proofs using Propositional Logic

Prove the argument
A Λ (B  C) Λ [(A Λ B)  (D V C)] Λ B  D
First, write down all the hypotheses.
1.
A
2.
BC
3.
(A Λ B)  (D V C)
4.
B
Use the inference and equivalence rules to get at the conclusion D.
5.
C
2,4, mp
6.
AΛ B
1,4, con
7.
D V C
3,6, mp
8.
C V D
7, comm
9.
CD
8, imp
and finally
10. D
5,9 imp
The idea is to keep focused on the result and sometimes it is very easy
to go down a longer path than necessary.

Section 1.2
Propositional Logic
11
More Proofs

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
Section 1.2
(A Λ B) Λ (C Λ A) Λ (C Λ B)  A is an argument
(A Λ B)
(C Λ A)
(C Λ B)
A V B
B V A
B  A
(C) V A
C  A
C V (B)
(B) V C
B  C
B  A
(B  A) Λ (B  A)
hyp
hyp
hyp
1, De Morgan
4, comm
5, imp
2, De Morgan
7, imp
3, De Morgan
9, comm
10, imp
8, 11, hs
6, 12, con
Propositional Logic
12
Proof Continued

At this point, we have now to prove that
(B  A) Λ (B  A)  A

1.
2.
3.
4.
5.
6.
Section 1.2
Proof sequence
B  A
B  A
A  B
A  A
A V A
A
hyp
hyp
1, cont
3, 2, hs
4, imp
6, self
Propositional Logic
13
Proving Verbal Arguments


Russia was a superior power, and either France was not strong or
Napoleon made an error. Napoleon did not make an error, but if the
army did not fail, then France was strong. Hence the army failed and
Russia was a superior power.
Converting it to a propositional form using letters A, B, C and D
A: Russia was a superior power
B: France was strong
C: Napoleon made an error
D: The army failed

Combining, the statements using logic
(A Λ (B V C))
C
(D  B)
(D Λ A)

B: France was not strong
C: Napoleon did not make an error
D: The army did not fail
hypothesis
hypothesis
hypothesis
conclusion
Combining them, the propositional form is
(A Λ (B V C)) Λ C Λ (D  B)  (D Λ A)
Section 1.2
Propositional Logic
14
Verbal Argument Proof


Section 1.2
Prove (A Λ (B V C)) Λ C Λ (D  B)  (D Λ A)
Proof sequence
1.
A Λ (B V C)
2.
C
3.
D  B
4.
A
5.
B V C
6.
C V B
7.
B
8.
B  (D)
9.
(D)
10. D
11. D Λ A
hyp
hyp
hyp
1, sim
1, sim
5, comm
2, 6, ds
3, cont
7, 8, mp
9, dn
4, 10 , con
Propositional Logic
15
Class Exercise

Prove the following arguments




(A´  B´) Λ (A  C)  (B  C)
(Y  Z´) Λ (X´  Y) Λ [Y  (X  W)] Λ (Y  Z)  (Y  W)
If the program is efficient, it executes quickly. Either the program is
efficient, or it has a bug. However, the program does not execute
quickly. Therefore it has a bug. (use letters E, Q, B)
The crop is good, but there is not enough water. If there is a lot of
rain or not a lot of sun, then there is enough water. Therefore the
crop is good and there is a lot of sun. (use letters C, W, R, S)
Section 1.2
Propositional Logic
16
Class Exercise


Section 1.2
Write down the propositional form of the following argument:
If my client is guilty, then the knife was in the drawer. Either the
knife was not in the drawer or Jason Pritchard saw the knife. If
the knife was not there on October 10, it follows that Jason
Pritchard didn’t see the knife. Furthermore, if the knife was
there on October 10, then the knife was in the drawer and also
the hammer was in the barn. But we all know that the hammer
was not in the barn. Therefore, ladies and gentlemen of the jury,
my client is innocent.
Propositional Logic
17
Download