This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Syntax Semantics Truth tables Lecture 1: Propositional Logic Implications and Equivalences Valid and Invalid arguments Normal forms DavisPutnam Algorithm 1 Atomic propositions and logical connectives terminates”. An atomic proposition is a statement or assertion that must be true or false.
Examples of atomic propositions are: “5 is a prime” and “program Propositional formulas are constructed from atomic propositions by using logical connectives.
Connectives
false
true
not
and
or
conditional (implies)
biconditional (equivalent) ¡
¢
£
¤
¥
¦
§ A typical propositional formula is ¨ ¤
© ¥ ¦
The truth value of a propositional formula can be calculated from the truth values of the atomic
propositions it contains.
2 Wellformed propositional formulas £ , , , and . The wellformed formulas of propositional logic are obtained by using the construction rules
below:
is a wellformed formula.
. ¡ ¤
¡ ¥
¡ ¦ ¡ § ¡ . are wellformed formulas, then so are is a wellformed formula, then so is and is a wellformed formula, then so is An atomic proposition
If
If
If © Alternatively, can use BackusNaur Form (BNF) :
formula £ £ £ ¢ ¢ ::= Atomic Proposition
formula
formula
formula
formula
formula
formula
formula
formula
formula
formula
¤ ¤ £ ¢ ¤ £ ¤ ¥ £ ¤ ¢ £ ¦ £ ¤ ¢ ¢ ¢ £ § £ ¢ ¢ £ 3 ¢ £ ¤ © ¢ is a function of the truth values of the atomic Truth functions ¡ £ ¡¤ ¥ ¦ The truth of a propositional formula
propositions
it contains.
¡¢© £ ¡¤
¥
¤ ¡¤ ¦ ¤ ¡¤
¡ £ ¡¤ A truth assignment is a mapping that associates a truth value with each of the atomic propositions
. Let be a truth assignment for
.
¡
£ ¡¤ ¥ ¤ ¡¤ ¦ § ¥ ¦ ¤ ¡¤ If we identify with false and with true, we can easily determine the truth value of
under . ¡© ¡¤
£ ¥ ¡ ¦ ¤ ¡¤ § ¢ ¨ ¡ ¢ §¨
© ¡ ¢ £
¨
¢ ¨
§¨
© ¨ ¤ ¨
© §¨ ¤ §¨ §¨ © © ¥ ¨
© §¨ ¤ © © The other logical connectives can be handled in a similar manner.
Truth functions are sometimes called Boolean functions.
4 Truth tables for basic logical connectives A truth table shows whether a propositional formula is true or false for each possible truth
assignment. If we know how the ﬁve basic logical connectives work, it is easy (in principle) to construct a truth
table. ¡ £ ¢
¡ ¡ 5 ¡ ¡ ¤ ¢
¥ ¦
§ ¢ ¢ ¡ ¡ ¡ ¡
¢
¡ ¢
¢ ¢
¡ ¡ ¢
¡ ¢ ¡ ¡ ¢ ¢
¢ ¡ ¡
¢ ¡ ¢ if is ¡ ¡
¢ £¤ ¥ ¦§ ¨ ¥ is .
£¤ ¥ . Could this possibly be correct? ¡
¢ will be and Mistake in table for implication? is only , then the implication ¦ is Notice that
If ¡
¢ £¤ ¥ ¦ ¡ ¡ ¦§ ¨ ¥ Some people feel that it is counterintuitive to say that the implication
“If horses have wings, then elephants can dance” : is true, when we know that horses don’t have wings and that elephants can’t dance.
There are four possible truth tables for implication ¦ ¡ T1 T2 T3 T4
¢ 6 ¡ ¡ ¡ ¡ ¡ ¢
¡
¢ ¢ ¢
¡ ¡
¡ ¡ ¢
¡ ¢ ¡
¢ ¢ ¢ ¡
¢ ¢ First Argument:
If we used T1, then If we used T2, then would have the same table as
would have the same table as ¡ ¤ .
¡
¡ –even worse! § would have the same table as . Mistake in table for implication? ¦ If we used T3, then ¦
¦ ¡
¡ ¡ Clearly, each of these three alternatives is unreasonable. Table T4 is the only remaining possibility. 7 Second Argument: to be a tautology. Let’s test each of the four possible Mistake in table for implication? ¡ We would certainly want
choices for
. ¦ ¦ © ¥ ¡
¡ ¦
© ¥ ¡ T1 T2 T3 T4 ¢ ¡ ¡ ¡ ¢
¡
¢ ¢ ¢
¡ ¡ ¢
¢ ¢ ¡ ¡ ¢ ¢
¢ ¢
¢ ¢ ¢ Only T4 makes the implication a tautology. 8 ¢ Let be the formula A more complex truth table ¨©
© ©
¤ ¨
¨ ¤
©
© ¨ , and ¤ ¨ ¥
¡
¨
¦
¦
¦
¢
¢ ¡ ¡ ¡ ¢ ¢
¢ ¡ ¡ ¢ ¢ ¢ ¢
¢ ¡ ¢
¡ ¢
¢ ¢ ¢
¢ ¢
¢ ¢
¢ ¢ ¢
¡ ¢ ¢
¡ ¡
¢ ¢ ¡
¡ ¡ ¢
¢ ¢ ¢
¢ ¢
¡ ¢ ¢ © ¤
¡
¢ ¨
¢
¢ ¨
¡
¢ ¢ rows. ¢
£¡ propositions, its truth table will have will have 8 rows. we must consider all possible truth assignments for , such truth assignments. Hence, the table for To construct the truth table for
In this case there are In general, if the truth of a formula depends on ¦ ¡ 9 . ¦ A propositional formula a tautology if §¨ ¤ © § §¨ ¤
§ © ¡ for some . §¨ ¤
§ is a tautology and that ¨ © ¢
£ £ ¨ ¨ ¥ ¨ ¤ is a tautology. is a contradiction, Special formulas for all . for all . is ¢ a contradiction if
satisﬁable if It is easy to see that £
¨ is not a tautology. is a tautology. The truth table on the previous page shows that the formula
Note that
is a contradiction iff
is satisﬁable iff ¨ £ ¨ ¨ Major open problem: Is there a more efﬁcient way to determine if a formula is a tautology (is
satisﬁable) than by constructing its truth table?
10 In the formula
¨ ¨ ¨
£ £ ¨
£ £
¨
¨ and
¨ , conclude , conclude and .
. Implications is the antecedent, hypothesis or premise
is the consequent or conclusion Can be associated with 3 variants:
Converse:
Inverse:
Contrapositive: Modus Ponens: Given An implication and its contrapositive are equivalent.
Modus Tollens: Given ¨ £ £
¨ 11 and Equivalences § we have §¨ ¤ © §¨ . © is a tautology. are equivalent iff for any truth assignment are equivalent iff and Two formulae Claim: § Some Useful Equivalences that can be used to simplify complex formulas: ¨ ¨
¡ ¨ ¤ ¡
§
¨ ¨ ¤
§
¨ ¨
¤ ¨¤
¤ §
§ ¨¤
¤ ¤ © © ¥ ¤ ¢
§ ¨
©
¨ ¤
¨
¥
© ¤
¨ © ¤
£ £ ¤ §
£
£ ¨© ¥
12 ¨
¨
§
§ ¨
¥ When is an argument valid? An argument is an assertion that a set of statements, called the premises, yields another statement,
called the conclusion. An argument is valid if and only if the conjunction of the premises implies the conclusion. In other words, if we grant that the premises are all true, then the conclusion must be true also. An invalid argument is called a fallacy. Unfortunately, fallacies are probably more common than
valid arguments. In many cases, the validity of an argument can be checked by constructing a truth table. All we have to do is show that the conjunction of the premises implies the conclusion. 13 Valid and Invalid Arguments Which of the following arguments are valid?
1. If I am wealthy, then I am happy. I am happy. Therefore, I am wealthy. 2. If John drinks beer, he is at least 18 years old. John does not drink beer. Therefore, John is not
yet 18 years old. 3. If girls are blonde, they are popular with boys. Ugly girls are unpopular with boys. Intellectual
girls are ugly. Therefore, blonde girls are not intellectual. 4. If I study, then I will not fail basket weaving 101. If I do not play cards to often, then I will
study. I failed basket weaving 101. Therefore, I played cards too often. 14 A More Complicated Example! The following example is due to Lewis Carroll. Prove that it is a valid argument.
1. All the dated letters in this room are written on blue paper. 2. None of them are in black ink, except those that are written in the third person.
3. I have not ﬁled any of those that I can read.
4. None of those that are written on one sheet are undated.
5. All of those that are not crossed out are in black ink.
6. All of those that are written by Brown begin with “Dear Sir.”
7. All of those that are written on blue paper are ﬁled.
8. None of those that are written on more than one sheet are crossed out.
9. None of those that begin with “Dear sir” are written in the third person.
Therefore, I cannot read any of Brown’s letters. 15 Let Lewis Carrol example (cont.) be “the letter is dated,” be “the letter is written on blue paper,” be “the letter is written in black ink,” § ¡ be “the letter is written in the third person,” ¤ be “the letter is ﬁled,” ¦ be “I can read the letter,” ¨ be “the letter is written on one sheet,” ¢ be “the letter is crossed out,” £ be “the letter is written by Brown,” ¡ be “the letter begins with ‘Dear Sir’ “ 16 ¤ Lewis Carrol example (cont.) Now, we can write the argument in propositional logic.
1.
2. £ ¦
¡ £
§ 3. ¤
¨ ¦
¦ £
¦ 4.
¢ 5.
£ ¦ § ¦ 6.
¡
¤ 7. £ ¦ 8. ¡ ¦ ¦ ¦ £ 9. £
¢ ¤ £
¦ ¤ Therefore 17 ¡ £ ¦ £
¨ Negation Normal Form Some more useful equivalences: £ £ £ £ ©
£ § § £ © £ ¤ © ¥
§ £
¤
§ © ¥ 18 £
© ¦ © ¤ £ The negation of
is simply Negation Normal Form £ ¦ £ ¦ © © ¥ © £
© ¤
£
¤
¥
£ © ¨ This may not be very useful. Often desirable to simplify formula as much as possible using four
tautologies above.
£ ¥ © ¨ ¦
© © ¤ £
£
¥ £ © ¤ £
¨ ©
£ © ¤ £
£
¤ £ £¨ © ¤
©
£ ¨© ¤
¤ £ © ¤
¤
© ¨© £
© © ©
© ¤
¤
¤ £
© © ¥
¥ £ £¨ ¤
The resulting formula is said to be in negation normal form. 19 Disjunctive Normal Form Every propositional formula is equivalent to a formula in disjunctive normal form (DNF): where each ¨
© £
¤ ¨¤
¤ ¨
¤ ¤ ¥ £ ¥ ¨¤
£
¦ ¥ ¥
© ¥ £ ¨¤
¦
¡ ¥
¨
© £
¢ ¨¤ ¢ ¦ £ . is a literal (an atomic proposition or the negation of one). £ In short: ¨ ¦ § ¨
¤
¥ ¤
¥ Every propositional formula is equivalent to a formula in conjunctive normal form (CNF): where each ¨
© £
¤ ¨¥
¥ ¨
¥ ¥ ¥ £ ¥ ¨¥
£
¦ ¤
¥ © ¥ £ ¨¥
¦ ¤
¡ ¨
© £
¢ ¨¥ ¢ ¦ £ . is a literal. £ In short: ¨ § ¨
¦ ¤ ¥ ¥ How hard is it to check if CNF formula is a tautology? How about DNF? How about checking for
satisﬁability instead?
20 Connectives ¤ £ . ¤ ¤
¡ , we only need £ £ £ £ ¨© ¥ ¤
¡ . ¥
¤
¤ £
¤
¡ £
¤
¡ ¤ ¥
¤ ¡ ¡ ¥ ¤ alone is sufﬁcient. ¨ is not sufﬁcient. is sufﬁcient. is sufﬁcient. is equivalent to From CNF (or DNF) it follows that no connectives other than
Since
Likewise,
Likewise,
But NAND
Consider the binary connective Claim: 21 are really needed. ¢ ¡ ¢
¤ £ £
¡© ¤
¤ Deciding satisﬁability The fastest known algorithms for deciding propositional satisﬁability are based on the
DavisPutnam Algorithm.
A unit clause is a clause that consists of a single literal.
function Satisﬁable (clause list S) returns boolean;
/* unit propagation */
repeat
for each unit clause
do
delete from every clause containing
delete
from every clause of in which it occurs
end for
if is empty then return TRUE
else if null clause is in then return FALSE end if
until no further changes result end repeat
/* splitting */
choose a literal occurring in
if Satisﬁable (
) then return TRUE
else if Satisﬁable (
then return TRUE
else return FALSE end if
end function
22 ¢ £ ¢ ¤ ¥ ¢ ¢ ¦ ¤ £ ¥ ¡ ¢ ¢ ¦ ¢ ¢ ...
View Full
Document
 Spring '09
 EdmundM.Clarke

Click to edit the document details