Discrete Mathematics Using A Computer - 06 - Propositional Logic Notes
Discrete Mathematics Using A Computer - 06 - Propositional Logic Notes
Kanak Kshetri
1 Chapter Outline
• Difficulties with informal logic
– Truth Tables: easy to understand but unwieldy for large expressions; “semantic
technique”
– Natural Deduction: “syntactic technique”, uses inference rules
– Boolean Algebra: axiomatic approach
– e.g. “and” can sometimes suggest an implication as in “The sun is shining and I
am happy”
1
3.1.1 Truth Table
A B A∧B
False False False
False True True
True False False
True True True
2
3.5.1 Truth Table
A B A⇒B
False False True
False True True
True False False
True True True
• One way to think about is that an implication is a statement that if something happens
then something else must also happen
– So, if the first event happens, but the second doesn’t, the implication must have
been faulty
– But the first event doesn’t happen at all, then we’re indifferent about the implica-
tion
• Rephrasing the above point, “If A then B” is like saying that “A” is sufficient for B to
occur
• Book is a little handwavy and just says “this is the way it is”
3
4 The Language of Propositional Logic
4.1 Well-Formedness
• Have a grammar for propositional logic
• Well-formedness is only about the syntax and says nothing about the semantics
of the formula
– e.g. “if it compiles”, then it is well-formed. Just because something compiles doesn’t
mean it’ll pass all the tests
• Conjunction (∧)
• Disjunction (∨)
• Implication (⇒)
4
4.4 Object Language and Meta Language
• WFFs of propositional language will be called object language
• Language of equations, substitutions, and justifications will be called the meta lan-
guage
• a ∧ b is written a && b
• a ∨ b is written a || b
• a ⇒ b is written a ==> b
• a ⇔ b is written a <=> b
• Either this bus or the next is going to the airport, but not both
• Some drivers will answer “yes” when the correct answer is “no”
• Ask one “yes or no” question that can help you decide whether to take this bus or the
next
4.6.2 Solution 1
• I first gave names to the situations:
5
• I then made a table of the possible situations:
L A Desired Answer
True True True
True False False
False True True
False False False
• So, clearly just asking A gives me the desired answer regardless of what L is
– F alse
– T rue
– ¬T rue
– F alse
– F alse ⇒ T rue
– T rue
– T rue ⇒ T rue
– T rue
– T rue ⇒ F alse
– F alse
• F alse ⇒ F alse
– T rue
6
• ¬F alse ⇔ T rue
– T rue ⇔ T rue
– T rue
– T rue ⇔ T rue
– T rue
– ¬T rue ⇔ F alse
– F alse ⇔ F alse
– T rue
7
∗Stdm> ( not ( True \ / False ) ) <=> False / \ True
True
∗Stdm>
5.4.1 Discussion
• makes a statement about actual meanings of propositions
• Model of a logic system: Set of truth values along with the method for calculating
meaning of any well-formed formula
• Different values of n
– n = 1 gives P Q, which has the same semantics as ⇒
– n = 0 gives Q, which means that Q is always True, or is a tautology
8
5.5 Limitations of Truth Tables
• Size is exponential in number of variables
• Other techniques (natural deduction, Boolean algebra) give much better insight into
why a proposition is true
5.6 Exercise 3: Determine which formulas are tautologies using truth ta-
bles
5.6.1 (T rue ∧ P ) ∨ Q
P Q T rue ∧ P (T rue ∧ P ) ∨ Q
T T T T
T F T T
F T F T
F F F F
• not a tautology
• without truth tables: (T rue ∧ P ) ∨ Q becomes P ∨ Q, which is False when both P and Q
are False
5.6.2 (P ∨ Q) ⇒ (P ∧ Q)
P Q P ∨Q P ∧Q (P ∨ Q) ⇒ (P ∧ Q)
T T T T T
T F T F F
F T T F F
F F F F T
• not a tautology
5.6.3 (P ∧ Q) ⇒ (P ∨ Q)
P Q P ∧Q P ∨Q (P ∨ Q) ⇒ (P ∧ Q)
T T T T T
T F F T T
F T F T T
F F F F T
• Tautology
5.6.4 (P ∨ Q) ⇒ (Q ∨ P )
P Q P ∨Q Q∨P (P ∨ Q) ⇒ (P ∧ Q)
T T T T T
T F T T T
F T T T T
F F F F T
9
• Tautology
• Not a tautology
• Tautology
5.7.4 (P ⇒ Q) ∧ (P ⇒ ¬Q)
P Q LHS=P ⇒ Q RHS=P ⇒ ¬Q LHS ∧ RHS
T T T F F
T F F T F
F T T T T
F F T T T
10
• Satisfiable, but not a tautology
5.7.5 (P ⇒ Q) ∧ (¬P ⇒ Q)
P Q LHS=P ⇒ Q RHS=¬P ⇒ Q LHS ∧ RHS
T T T T T
T F F T F
F T T T T
F F T F F
5.7.6 (P ⇒ Q) ⇔ (¬Q ⇒ ¬P )
P Q LHS=P ⇒ Q RHS=¬Q ⇒ ¬P LHS ⇔ RHS
T T T T T
T F F F T
F T T T T
F F T T T
• Tautology
– Object Language: to talk about the statements we’re reasoning about. e.g. Propo-
sitional expressions
– Inference Rules: Rules to infer new facts from information given
– Meta Language: Defines the “form of argument” so that we can determine
whether arguments are actually valid
11
– The version doesn’t say how we know that Q ⇒ P when we assume P . It just
says that it is True.
– The ` version says that there is a proof that shows Q ⇒ P when we assume P
• (For latex simplicity, I’ll just use the sequent notation to talk about inference rules)
• (Verify using truth table, but this particular definition is “trivial” because that’s how
we defined implication)
– Suppose a is T rue, then right side becomes T rue → F alse, which is F alse
12
– Suppose a is F alse, then right side becomes F alse → F alse, which we defined to
be T rue
– So in both cases the definition is consistent
• But it looks like that might be circular atleast based on the discussion in the section
on “Inferring the Operator Truth Tables”
• Assume that you have a system with FALSE, and three operators OR, AND, IMPLIES
• Pretend that it is just a coincidence that they match the names of Boolean operators
13
6.4.2 Usage Example 1
• Statement: (R ⇒ S), ¬P ` (R ⇒ S) ∧ ¬P
• Proof:
• Proof:
• Note: This can be written in a tree diagram type form (Page 130)
• Proof:
6.4.5 Exercise 11
• Shape of x = A ∧ (B ∧ (C ∧ D))
– Right-heavy tree
– If there are 2n variables in x, then the height of the proof tree will also be 2n
– (At each level, we can reason about one of the variables in x)
• Shape of y = (A ∧ B) ∧ (C ∧ D))
14
6.5 And Elimination
6.5.1 Definition: (a ∧ b) ` a, (a ∧ b) ` b
• Proof:
• Proof:
– P is True by assumption
– Q ∧ R means Q is True by and elimination
– Since both P and Q are true, P ∧ Q is True (by and introduction)
• Proof:
• Proof:
• This proves the commutativity of And (which we could have also done using Truth
Tables)
15
6.5.5 Usage Example
• Statement: a ∧ (b ∧ c) ` (a ∧ b) ∧ c
• Proof:
6.5.6 Exercise 12
• Statement: Prove: (P ∧ Q) ∧ R ` P ∧ (Q ∧ R)
• Proof:
• Proof:
– Know a is True
– Know a ⇒ b is True
∗ If b is False, we get T rue ⇒ F alse which would be False
∗ But if b is True, we get T rue ⇒ T rue, which is True
– So, b is True
• Proof:
16
6.6.3 Usage Example
• Statement: a, a ⇒ b, b ⇒ c ` c
• Proof:
6.6.4 Exercise 13
• Statement: P, P ⇒ Q, (P ∧ Q) ⇒ (R ∧ S) ` S
• Proof:
6.6.5 Exercise 14
• Statement: P ⇒ Q, R ⇒ S, P ∧ R ` S ∧ R
• Proof:
• Since the ` doesn’t have anything to the left, it is saying that this is a tautology
17
• Assumptions Made
• Proof:
• Proof:
18
6.7.6 Exercise 15
• Statement: P ` Q ⇒ P ∧ Q
• Proof:
• (Maybe incorrect)
6.7.7 Exercise 16
• Statement: ` P ∧ Q ⇒ Q ∧ P
• Proof:
6.8 Or Introduction
6.8.1 Definition: a ` a ∨ b and b ` a ∨ b
• Proof
– By the definition of `, if one of its arguments is true, then the whole expression
becomes true
• Proof
19
6.8.3 Exercise 17
• Statement: P ⇒ F alse ∨ P
• Proof
6.8.4 Exercise 18
• Statement: P, Q ` (P ∧ Q) ∨ (Q ∨ R)
• Proof:
6.9 Or Elimination
6.9.1 Definition (((a ∨ b), (a ` c), (b ` c)) ` c)
• This is Proof by Case Analysis
• Proof:
• (Did i just prove Proof by Case Analysis by DOING proof of case analysis? Something
is weird here. . . )
20
6.9.2 Example Usage
• Statement: (P ∧ Q) ∨ (P ∧ R) ` P
• Proof:
• Proof:
6.10 Identity
6.10.1 Definition a ` a
• It is necessary because we can’t prove P ` P without it.
21
6.11 Contradiction
6.11.1 Definition: F alse ` a
• Anything can be inferred if the assumption is False
• (Remember the Truth table for P ⇒ Q gave True when P was False?)
• Expresses the fact that False is untrue purely using logical inference
– Can’t just say False is not True, because we defined True that way
– Also doesn’t rely on us making “intuitionistic” statements like “False is Wrong”
• Proof:
• Proof:
22
6.12.2 Example Usage
• Statement: ¬¬a ` a
• Proof:
– Strategy: Assume ¬a and show that it leads us to infer False (proof by contradic-
tion)
– Assuming ¬a, we have ¬a, ¬¬a
– Expand out the abbreviations to get: a ⇒ F alse, (a ⇒ F alse) ⇒ F alse
– Since we have a ⇒ F alse and (a ⇒ F alse) ⇒ F alse, by Modus Ponens, we have
F alse
– So, by reductio ad absurdum, a Must be True if ¬¬a is True
• profound and difficult questions, modern research has shown some astonishing results
• Easy version of first question: Are inference rules powerful enough to infer the truth
tables of logical operators?
• To show equivalence with False, we need to show: F alse ⇒ (T rue ∧ F alse), T rue ∧
F alse ⇒ F alse
23
6.13.2 Exercise: Calculating value of T rue ∧ T rue
• Proof that T rue ∧ T rue ⇒ T rue
6.13.4 Extra Credit: What happens when we try to say T rue ∨ F alse is F alse?
• Need to show equivalence
– Need to do an or elimination
– F alse ` F alse comes from identity
– T rue ` F alse needs to be shown
– Expand out T rue: F alse ⇒ F alse ` F alse needs to be shown
– Since F alse is not T rue, we can’t use Modus Ponens
– We have no applicable inference rule to use
24
6.13.5 Exercise
• When we computed value of T rue ∧ F alse, we used and elimination to say that (F alse ⇒
F alse) ∧ F alse ` F alse
• But we could have said (F alse ⇒ F alse) ` F alse ` (F alse ⇒ F alse) which is True
25
8.2 Laws of Boolean Algebra
8.2.1 Operations with Constants
• a ∧ F alse = F alse
• a ∧ T rue = T rue
– (P ∧ F alse) ∨ (Q ∧ T rue)
– F alse ∨ (Q ∧ T rue)
– Q ∧ T rue
– Q
• Exercise 26
• Idempotence: a ∧ a = a
• Idempotence: a ∧ a = a
• Commutative: a ∧ b = b ∧ a
• Commutative: a ∨ b = b ∨ a
• Associativity: (a ∧ b) ∧ c = a ∧ (b ∧ c)
• Associativity: (a ∨ b) ∨ c = a ∧ (b ∨ c)
• Exercise 27
26
– Prove: (P ∧ ((Q ∨ R) ∨ Q)) ∧ S = S ∧ ((R ∨ Q) ∧ P )
– Direct Proof starting from LHS
– (P ∧ ((Q ∨ R) ∨ Q)) ∧ S
– (P ∧ ((R ∨ Q) ∨ Q)) ∧ S (by commutativity of or)
– (P ∧ (R ∨ (Q ∨ Q)) ∧ S (by associativity of or)
– (P ∧ (R ∨ Q)) ∧ S (by idempotence of or)
– ((R ∨ Q) ∧ P ) ∧ S (by commutivatiy of and)
– S ∧ ((R ∨ Q) ∧ P ) (by commutivatiy of and)
• Exercise 28
• De Morgan: ¬(a ∧ b) = ¬a ∨ ¬b
• De Morgan: ¬(a ∨ b) = ¬a ∧ ¬b
• Exercise 29
• ¬F alse = T rue
• a ∧ ¬a = F alse
• a ∨ ¬a = T rue
• ¬(¬a) = a
27
8.2.5 Laws on Implication
• Modus Ponens: a ∧ (a ⇒ b) ⇒ b
• Modus Tollens: ¬b ∧ (a ⇒ b) ⇒ ¬a
• Disjunctive Syllogism: (a ∨ b) ∧ ¬ ⇒ b
• Implication Chain: (a ⇒ b) ∧ (b ⇒ c) ⇒ (a ⇒ c)
• Currying: (a ∧ b) ⇒ c = a ⇒ b ⇒ c
• Implication: a ⇒ b = ¬a ∧ b
• Contrapositive: a ⇒ b = ¬b ⇒ ¬a
• Absurdity: (a ⇒ b) ∧ (a ⇒ ¬b) = ¬a
– Says there are two equivalent ways of establishing that a and b both hold
– One of them is to say a ∧ b
– The other is to have an implication on a and an implication on b
– If either of a or b is false,
∗ a ∧ b is false, so (a ∧ b) ⇒ c is vacuous
∗ Either a ∧ b or b ∧ c is vacuous (if a is False, then the first one is vacuous, if b
is false, the second one)
– allows us to prove a ⇒ b
– Note that we don’t have an “Introduce Implication” rule like in natural deduction
– So we use this rule
– = is an operator in the meta language that says that two sides of an equation have
the same value
– ⇔ is in the object language itself and it gives a new proposition
• Exercise 30
28
– Prove: (A ∨ B) ∧ BB
– Strategy: We’ll reduce the left side of the equivalence to be the right side
– (A ∨ B) ∧ B
– (A ∨ B) ∧ (B ∨ F alse) (by Identity of OR)
– (B ∨ A) ∧ (B ∨ F alse) (commutativity of AND)
– B ∨ (A ∧ F alse) (distributivity of OR)
– B ∨ F alse
– B
• Exercise 31
• Exercise 32
– Prove: ¬(A ∧ B) ≡ ¬A ∨ ¬B
– Direct proof starting from “right side”
– ¬A ∨ ¬B
– ¬(¬(¬A ∨ ¬B)) (Double negation is just identity)
– ¬(A ∧ B) (by De Morgan’s other law)
• Exercise 33
29
∗ i.e. T rue ∧ C
∗ i.e. C
∗ So the equality holds in this case
– Case: A is False
∗ LHS: (F alse ∨ B) ∧ ((¬F alse) ∨ C) ∧ (B ∨ C)
∗ i.e. B ∧ T rue ∧ (B ∨ C)
∗ i.e. B ∧ (B ∨ C)
∗ i.e. B
∗ RHS: (F alse ∨ B) ∧ ((¬F alse) ∨ C)
∗ i.e. B ∧ T rue
∗ i.e. B
∗ So, the equality holds in this case
– Since the equality holds in both cases, the statement is proven.
10 Meta Logic
• Making statements about the logical system itself
• That is, every proposition that is true can be proved using the system
30
10.4 Godel’s Theorem: A logical system powerful enough to express ordi-
nary arithmetic must be either inconsistent or incomplete
• It is impossible to capture all of mathematics in a safe logical system
11 Further Reading
• Forever Undecided: A Puzzle Guide to Godel by Raymond Smullyan
– Good source for hints on carrying out proofs with lots of example
31