0% found this document useful (0 votes)
459 views

Discrete Mathematics Using A Computer - 06 - Propositional Logic Notes

This document provides an introduction to propositional logic and formal reasoning about logical statements. It outlines three main systems for propositional logic - truth tables, natural deduction, and Boolean algebra. Truth tables provide a semantic technique for determining logical validity by considering all possible combinations of variable truth values. Natural deduction uses inference rules in a syntactic approach. Boolean algebra takes an axiomatic view. The document then defines basic logical operators like conjunction, disjunction, negation, implication and equivalence. It provides truth tables to illustrate the meaning and evaluation of statements using these operators. Examples are given to demonstrate propositional logic syntax and evaluating statements.

Uploaded by

kanakkshetri
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
459 views

Discrete Mathematics Using A Computer - 06 - Propositional Logic Notes

This document provides an introduction to propositional logic and formal reasoning about logical statements. It outlines three main systems for propositional logic - truth tables, natural deduction, and Boolean algebra. Truth tables provide a semantic technique for determining logical validity by considering all possible combinations of variable truth values. Natural deduction uses inference rules in a syntactic approach. Boolean algebra takes an axiomatic view. The document then defines basic logical operators like conjunction, disjunction, negation, implication and equivalence. It provides truth tables to illustrate the meaning and evaluation of statements using these operators. Examples are given to demonstrate propositional logic syntax and evaluating statements.

Uploaded by

kanakkshetri
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

DiscreteMathComputer 06 - Propositional Logic

Kanak Kshetri

1 Chapter Outline
• Difficulties with informal logic

• Propositional logic (one type of formal logic)

• Three mathematical systems for reasoning about propositions:

– Truth Tables: easy to understand but unwieldy for large expressions; “semantic
technique”
– Natural Deduction: “syntactic technique”, uses inference rules
– Boolean Algebra: axiomatic approach

2 Need for Formalism


• Natural language has ambiguities and subtleties

– e.g. “and” can sometimes suggest an implication as in “The sun is shining and I
am happy”

• Proposition: variable whose value must be either True or False

• Logical Operators: and, or, not, implies . Operate on propositions

• Statements that can’t be represented by propositional logic (due to lack of context):

– e.g. “That cloud looks like a motor bike”


– context required: which cloud? who thinks that it looks like a motor bike?

3 Basic Logical Operators


3.1 Logical And (∧)
• aka Conjunction

1
3.1.1 Truth Table
A B A∧B
False False False
False True True
True False False
True True True

3.2 Inclusive Or (∨)


• aka Disjunction

3.2.1 Truth Table


A B A∨B
False False False
False True True
True False True
True True True

3.3 Exclusive Or (⊕)


• Either one or the other, but not both

3.3.1 Truth Table


A B A⊕B
False False False
False True True
True False True
True True False

3.4 Logical Not (¬)


3.4.1 Truth Table
A ¬A
True False
False True

3.5 Logical Implication (⇒)


• Use to represent conditional phrases

• e.g. “If it is sunny today, then there will be a picnic.”

• Implication does not say anything about cause-and-effect

2
3.5.1 Truth Table
A B A⇒B
False False True
False True True
True False False
True True True

3.5.2 Understanding the truth table


• Why is an implication true even if A is False?

• 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

– So, if we see an A but not a B, clearly A isn’t sufficient for B


– But if we see a B on its own, maybe something other than A caused it.
– e.g. Matchsticks are sufficient for fire. But just because you use a lighter to make
a fire doesn’t mean matchsticks can’t cause fire. However, if you have a matchstick
and still can’t produce fire, it clearly isn’t sufficient.

• Book is a little handwavy and just says “this is the way it is”

3.6 Logical Equivalence (⇔)


• Use to make a claim that two propositions always have the same value, or are equivalent

• aka “If and only if”, “necessary and sufficient”

3.6.1 Truth Table


A B A⇔B
False False True
False True False
True False False
True True True

3.6.2 "If and only If"


• A ⇔ B can be written as (A ⇒ B) ∧ (B ⇒ A)

3
4 The Language of Propositional Logic
4.1 Well-Formedness
• Have a grammar for propositional logic

• If a formula doesn’t follow this grammar, it isn’t well formed

• e.g. Well-Formed Formula: A ⇒ (B ∧ (¬A))

• e.g. not Well-Formed Formula: ∧AB¬C

• 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

4.2 Syntax of Well-Formed Formulas


• Constants F alse and T rue are WFF.

• Any propositional variable is WFF.

• Negation: If a is WFF, then ¬a is WFF

• Conjunction: If a and b are WFF, then a ∧ b is WFF

• Disjunction: If a and b are WFF, then a ∨ b is WFF

• Implication: If a and b are WFF, then a ⇒ b is WFF

• Equivalence: If a and b are WFF, then a ⇔ b is WFF

4.2.1 Example: P ⇒ (Q ∧ R) is a WFF


• P, Q, R are WFF because they’re propositional variables

• So, Q ∧ R is a WFF (conjunction rule)

• So, P ⇒ (Q ∧ R) is a WFF (implication rule)

4.3 Order of Precedence


• Negation (¬) is the most tightly binding operator

• Conjunction (∧)

• Disjunction (∨)

• Implication (⇒)

• Equivalence (⇔) is the least tightly binding operator

4
4.4 Object Language and Meta Language
• WFFs of propositional language will be called object language

– They refer to sentences in propositional logic

• Language of equations, substitutions, and justifications will be called the meta lan-
guage

– The surround the object language


– They’re used to talk about propositions

4.5 Computing with Boolean Expressions


• ¬x is written not x

• a ∧ b is written a && b

• a ∨ b is written a || b

• a ⇒ b is written a ==> b

• a ⇔ b is written a <=> b

4.6 (Exercise 1) : Lying Bus Driver


4.6.1 Scenario
• Want to go to the airport, are at the bus stop

• Either this bus or the next is going to the airport, but not both

• Can only ask one “yes-or-no” question

• Some drivers will answer “yes” when the correct answer is “no”

– You don’t know if this bus driver is one of those people

• 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:

– A: this bus goes to the airport


– So, ¬A means the next one goes to the airport
– L: this driver is a liar
– So, ¬L means this driver answers truthfully

• I want to formulate my question so that if the answer is “True”, then A.

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

4.7 (Exercise 2) : Evaluating propositional formulas


• F alse ∧ T rue

– F alse

• T rue ∨ (¬T rue)

– T rue

• ¬(F alse ∨ T rue)

– ¬T rue
– F alse

• (¬(F alse ∧ T rue)) ∨ F alse

– (¬F alse) ∨ F alse


– T rue ∨ F alse
– T rue

• (¬T rue) ⇒ T rue

– F alse ⇒ T rue
– T rue

• T rue ∨ F alse ⇒ T rue

– T rue ⇒ T rue
– T rue

• T rue ⇒ (T rue ∧ F alse)

– 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 ⇔ (F alse ⇒ F alse)

– T rue ⇔ T rue
– T rue

• F alse ⇔ (T rue ∧ (F alse ⇒ T rue))

– F alse ⇔ (T rue ∧ T rue)


– F alse ⇔ T rue
– F alse

• ¬(T rue ∨ F alse) ⇔ F alse ∧ T rue

– ¬T rue ⇔ F alse
– F alse ⇔ F alse
– T rue

4.7.1 Verification using the Book’s Stdm Library

∗Stdm> False / \ True


False
∗Stdm> True \ / ( not True )
True
∗Stdm> not ( False \ / True )
False
∗Stdm> ( not ( False / \ True ) ) \ / False
True
∗Stdm> ( not True ) ==> True
True
∗Stdm> True \ / False ==> True
True
∗Stdm> True ==> ( True / \ False )
False
∗Stdm> False ==> False
True
∗Stdm> ( not False ) <=> True
True
∗Stdm> True <=> ( False ==> False )
True
∗Stdm> False <=> ( True / \ ( False ==> True ) )
False

7
∗Stdm> ( not ( True \ / False ) ) <=> False / \ True
True
∗Stdm>

5 Truth Tables: Semantic Reasoning


• Table
• Column headers are all the variables (and expressions)
• Add a row for each possible setting of values for variables
– 3 variables means 23 = 8 rows
– because 2 possible settings for each of the 3 variables

5.1 Example: Calculating using a Truth Table


• Suppose we want to know when the proposition ((A ⇒ B) ∧ ¬B) ⇒ ¬A is true
• Make a Truth Table
A B A⇒B ¬B (A ⇒ B) ∧ ¬B ¬A ((A ⇒ B) ∧ ¬B) ⇒ ¬A
F F T T T T T
F T T F F T T
T F F T F F T
T T T F F F T

5.2 Definition: Tautology


• Proposition that is always True, regardless of its variables

5.3 Definition: Contradiction


• Proposition that is always False, regardless of its variables

5.4 Definition: Entailment ()


• P1 , P2 , · · · , Pn  Q means that if all the propositions P1 , P2 , · · · , Pn are True, then Q is
also True

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

• Without Truth Table: by commutativity of ∨

5.6.5 ((P ∨ Q) ∧ (P ∨ R)) ⇔ (P ∧ (Q ∨ R))


P Q R P ∨Q P ∨R LHS Q∨R RHS LHS ⇔ RHS
F F F F F F F F T
F F T F T F T F T
F T F T F F T F T
F T T T T T T F F
T F F T T T F F F
T F T T T T T T T
T T F T T T T T T
T T T T T T T T T

• Not a tautology

5.7 Exercise 4: Determine Well-formedness, and build a truth table


5.7.1 (T rue ∧ P ) ∨ Q
• Truth table from Ex 3.1

• See that it is satisfiable, but not a tautology

5.7.2 ((P ∨ Q) ∧ (P ∨ R)) ⇔ (P ∧ (Q ∨ R))


• Truth table from Ex 3.5

• Satisfiable, but not a tautology

5.7.3 ((P ∧ ¬Q) ∨ (Q ∧ ¬P )) ⇒ ¬(P ⇔ Q)


P Q A=P ∧ ¬Q B=Q ∧ ¬P A∨B C=(P ⇔ Q) ¬C (A ∨ B) ⇒ C
T T F F F T F T
T F T F T F T T
F T F T T F T T
F F F F F T F T

• 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

• Satisfiable, but not a tautology

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

• (This is just the contrapositive)

6 Natural Deduction: Inference Reasoning


6.1 Introduction
• Natural deduction allows us to reason about logical propositions without substituting
values for variables

• Logical Inference: reasoning formally about a set of statements. Requires:

– 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

6.1.1 Definition: Sequent (`)


• P1 , P2 , · · · , Pn ` Q is called a sequent

• Means: if all propositions P1 , · · · , Pn are known, then proposition Q can be inferred


formally using the rules of natural deduction

• e.g. Difference between P  Q ⇒ P and P ` Q ⇒ P

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

6.1.2 Meta Variables


• Meta variables can stand for any WFF proposition

• e.g. we can have a be P ∧ Q

• Convention: meta variables will be written in lower case, propositional variables in


upper case

6.1.3 Writing an Inference Rule


• Assumptions are written above a horizontal line

• Conclusion written below the line.

• (For latex simplicity, I’ll just use the sequent notation to talk about inference rules)

• Inference rule only works in one direction

6.2 Definitions of True, Not and Equivalence


6.2.1 Primitives
• Only primitive objects are constant False, and ∨, ∧, ⇒

• All other objects are built using these

• Below we give definitions for some primitives

– can be verified using truth tables


– But we’ll only manipulate them using rules of logical deduction

6.2.2 Definition: True


• T rue = F alse ⇒ F alse

• (Verify using truth table, but this particular definition is “trivial” because that’s how
we defined implication)

6.2.3 Definition: Negation


• ¬a = a ⇒ F alse

• Proof (via truth tables):

– 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

• Consistency (via logical inference only):

– If a is T rue, then ¬T rue is T rue ⇒ F alse which is (F alse ⇒ F alse) ⇒ F alse


– We have a rule called Reduction Ad Absurdum which allows us to infer F alse from
(F alse ⇒ F alse) ⇒ F alse
– If a is F alse, then ¬F alse is $False ⇒ False$< which we defined to be T rue

6.2.4 Definition: Equivalence


• a ⇔ b = (a ⇒ b) ∧ (b ⇒ a)

• (Note that’s the definition of if and only if)

• Proof by Truth Table:

a b a⇒b b⇒a LHS RHS


T T T T T T
T F F T F F
F T T F F F
F F T T T T

• Hence, this formula is also correct

6.3 IMPORTANT: Note on Proofs of the Inference Rules


• I’ve “proven” each of the inference rules by making references to the Truth Table

• 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

6.4 And Introduction


6.4.1 Definition: a, b ` a ∧ b
• Proof:

– We know that a and b are True


– By definition of ∧, a ∧ b is True

13
6.4.2 Usage Example 1
• Statement: (R ⇒ S), ¬P ` (R ⇒ S) ∧ ¬P

• Proof:

– Use and introduction

6.4.3 Usage Example 2


• Statement: P, Q, R ` (P ∧ Q) ∧ R

• Proof:

– If P and Q are True, P ∧ Q is True by and introduction


– Since, R is True, another usage of and introduction means (P ∧ Q) ∧ R is True as
well

• Note: This can be written in a tree diagram type form (Page 130)

6.4.4 Exercise 10:


• Statement: Prove P, Q, R ` P ∧ (Q ∧ R)

• Proof:

– If Q and R are True, Q ∧ R is true by and introduction


– If, P is true, another application of and introduction means P ∧ (Q ∧ R) is True as
well

• Note, we could have proven this simply by noting the associativity of ∧

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

– Balanced tree: height is logarithmic in number of variables


– (At each level, we can reason about half of the variables in y)

14
6.5 And Elimination
6.5.1 Definition: (a ∧ b) ` a, (a ∧ b) ` b
• Proof:

– We know that a ∧ b is True


– But a ∧ b is True exactly when both a and b are True
– So, if the conjunction is True, they must individually be True as well

6.5.2 Usage Example


• Statement: P, Q ∧ R ` P ∧ Q

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

6.5.3 Usage Example


• Statement: (P ∧ Q) ∧ R ` R ∧ Q

• Proof:

– By and elimination, both P ∧ Q and R are True


– Another and elimination on P ∧ Q yields True for P and Q
– So, both Q and R are True, by and introduction, Q ∧ R is True

6.5.4 Usage Example


• Statement: P ∧ Q ` Q ∧ P

• Proof:

– By and elimination, both P and Q are True


– By and introduction, Q ∧ P is True

• 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:

– By and elimination on a ∧ (b ∧ c), both a and b ∧ c are True


– By and elimination on b ∧ c, both b and c are True
– By and introduction, a ∧ b is True
– By and introduction, (a ∧ b) ∧ c is True

• We’ve proved the associativity of and

6.5.6 Exercise 12
• Statement: Prove: (P ∧ Q) ∧ R ` P ∧ (Q ∧ R)

• Proof:

– We proved that “and” is associative for well formed propositions


– This is a well formed proposition

6.6 Imply Elimination


6.6.1 Definition: a, a ⇒ b ` b
• Also known as Modus Ponens

• 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

6.6.2 Usage Example


• Statement: Q ∧ P, P ∧ Q ⇒ R ` R

• Proof:

– Q ∧ P is True which means that P ∧ Q is true by the commutativity of and (proved


earlier)
– By Modus Ponens on P ∧ Q ⇒ R, we get R is True

16
6.6.3 Usage Example
• Statement: a, a ⇒ b, b ⇒ c ` c

• Proof:

– By Modus Ponens on a, a ⇒ b, we see that b is True


– By Modus Ponens on b, b ⇒ c, we see that c is True

6.6.4 Exercise 13
• Statement: P, P ⇒ Q, (P ∧ Q) ⇒ (R ∧ S) ` S

• Proof:

– By Modus Ponens on P, P ⇒ Q, we see that Q is True


– By And Introduction, P ∧ Q is True
– By Modus Ponens on P ∧ Q, P ∧ Q ⇒ R ∧ S, we see that R ∧ S is True
– By And Elimination on R ∧ S, we see that both R and S are True

6.6.5 Exercise 14
• Statement: P ⇒ Q, R ⇒ S, P ∧ R ` S ∧ R

• Proof:

– By And Elimination on P ∧ R, we see that P and R are True


– By Modes Ponens on R, R ⇒ S, we see that S is True
– By And Introduction on R and S, we see that S ∧ R is True

6.7 Imply Introduction


6.7.1 Definition: (a ` b) ` (a ⇒ b)
• “In order to imply the logical implication a ⇒ b, you must have a proof of b using a as
an assumption”

6.7.2 Example Usage


• Statement: ` (P ∧ Q) ⇒ Q

• Since the ` doesn’t have anything to the left, it is saying that this is a tautology

• What proof do we have for this?

– Consider the sequent P ∧ Q ` Q, which is just and elimination


– So, we have a proof for P ∧ Q ` Q, which means we can write ` P ∧ Q ⇒ Q by
Implies introduction

17
• Assumptions Made

– And Elimination assumed P ∧ Q is True.


– We can’t infer Q without this assumption.
– So, this appears in the sequent to the left of the ` in P ∧ Q ` Q
– But the entire sequent P ∧ Q ` Q doesn’t have any further assumptions
∗ Whenever P ∧ Q is true, Q is true.
– So, this sequent can be put in as an assumption without adding any other assump-
tions
– This is why when we do implies introduction, we get ` (P ∧ Q) ⇒ Q

6.7.3 Discharged assumptions


• Assumptions that are made temporarily to establish a sequent, and which is then
thrown away

• E.g. to establish the sequent P ∧ Q ` Q, we made an assumption P ∧ Q

• Once we got P ∧ Q ` Q, we don’t need to assumption for any other purpose

• Indicate discharged assumptions by boxes

6.7.4 Implication Chain Rule


• Statement: a ⇒ b, b ⇒ c ` a ⇒ c

• Proof:

– Since we are trying to prove a ⇒ c, we must use Imply Introduction somewhere


– This means that we need to show a ` c
– Assume a is True, then by Modus Ponens on a ⇒ b, b is True
– Since b is True, by Modus Ponens on b ⇒ c, c is True
– So, we have a sequent a ` c, and we can discharge the assumption that a is True
– By Imply Introduction on a ` c, we get ac

6.7.5 Modus Tollens


• Statement: a ⇒ b, ¬b ` ¬a

• Proof:

– ¬a is an abbreviation for a ⇒ F alse


– This means that we need to use Imply Introduction
– Expand ¬a and ¬b to get: a ⇒ b, b ⇒ F alse ` a ⇒ F alse
– This is just implication chain rule

18
6.7.6 Exercise 15
• Statement: P ` Q ⇒ P ∧ Q

• Proof:

– We are trying to prove an implication Q ⇒ P ∧Q, means we have to Imply Introduction


– To introduce imply, we need to prove the sequent Q ` P ∧ Q
– We know that P is true from what is given
– Assume that Q is true.
– By and introduction, we have P, Q ` P ∧ Q
– This sequent does not have any further assumptions, so we can discharge the as-
sumption that B is True
– So, we have the sequent Q ` P ∧ Q, which means we have Q ⇒ P ∧ Q by
introduce imply

• (Maybe incorrect)

6.7.7 Exercise 16
• Statement: ` P ∧ Q ⇒ Q ∧ P

• Proof:

– We need to use introduce imply on the sequent P ∧ Q ` Q ∧ P


– But that’s just commutativity of ∧, which we proved earlier, the sequent holds
without any further assumptions
– So, we can introduce imply on the sequent to get the desired answer

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

6.8.2 Example Usage


• Statement: P ∧ Q ` P ∨ Q

• Proof

– By and elimination on P ∧ Q, we have P is True, Q is True


– By or introduction, we have P ∨ Q is True

19
6.8.3 Exercise 17
• Statement: P ⇒ F alse ∨ P

• Proof

– To prove this implication, we need to prove the sequent P ` F alse ∨ P


– But that sequent is True by or introduction
– So, by introduce implication, we have P ⇒ F alse ∨ P

6.8.4 Exercise 18
• Statement: P, Q ` (P ∧ Q) ∨ (Q ∨ R)

• Proof:

– By and introduction, we have P ∧ Q is True


– By or introduction, we have Q ∨ R is True
– By or introduction, (P ∧ Q) ∨ (Q ∨ R) is True
– (Actually, knowing that P ∧ Q is True is sufficient because we can or introduce that
to get True)

6.9 Or Elimination
6.9.1 Definition (((a ∨ b), (a ` c), (b ` c)) ` c)
• This is Proof by Case Analysis

• Proof:

– Assumption is that a ∨ b is True


– By the definition of ∨ (from Truth Table), atleast one of a and b must be True
– Suppose a is True
∗ We have a ` c, i.e. a proof that c is True when a holds
– Otherwise, b is True
∗ We have b ` c, i.e. a proof that c is True when a holds
– So, c is True whenever the assumptions hold

• (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:

– Suppose P ∧ Q is True, then by and elimination, P is True


– Suppose instead that P ∧ R is True, then by and elimination, P is True
– So, we have ((P ∧ Q) ∨ (P ∧ R)), (P ∧ Q) ` P, (P ∧ R) ` P
– Use or elimination to get that P is True

6.9.3 Example Usage


• Statement: (a ∧ b) ∨ (a ∧ c) ` (b ∨ c)

• Proof:

– Assume a ∧ b by and elimination, we get a ∧ b ` b


– Discharge the assumption a ∧ b because we have a sequent
– By or introduction, we have b ` b ∨ c
– Assume a ∧ c by and elimination, we get a ∧ c ` c
– Discharge the assumption a ∧ c
– By or introduction, we have c ` b ∨ c
– We can no do or elimination on (a ∧ b) ∨ (a ∧ c) ` (b ∨ c), ((a ∧ b) ` b) ` b ∨ c, ((a ∧ c) `
c) ` b ∨ c
– This gives us b ∨ c

6.10 Identity
6.10.1 Definition a ` a
• It is necessary because we can’t prove P ` P without it.

6.10.2 Theorem: ` T rue


• By definition, T rue = F alse ⇒ F alse

• So, we need to introduce imply to prove this

• To introduce imply, we need to prove the sequent F alse ` F alse

• This is true by identity

• So, we have F alse ⇒ F alse or equivalently, T rue

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”

6.11.2 Example Usage


• Statement: P, ¬P ` Q

• Proof:

– ¬P is shorthand for P ⇒ F alse


– So, from P, P ⇒ F alse by modus ponens, we have F alse
– F alse ` Q follows from contradiction

6.11.3 Example Usage


• Statement; a ∨ b, ¬a ` b

• Proof:

– ¬a is shorthand for a ⇒ F alse


– Performing or elimination on a ∨ b,
∗ Assume a is True, then we have a, a ⇒ F alse, which by Modus Ponens gives
us F alse
∗ So, by contradiction, b is True
∗ (Discharge the assumption that a is True)
∗ Assume b is True, the by identity, b is True
∗ (Discharge the assumption that b is True)
∗ Combining, we have (a ∨ b, ¬a), (((a ∨ b) ` a), a ⇒ F alse) ` b, (((a ∨ b) ` b) ` b),
we can now perform or elimination

6.12 Reduction Ad Absurdum


6.12.1 Definition: (¬a ` F alse) ` a
• If you can infer False from an assumption ¬a, then you must conclude that a is true

• This is the Proof by Contradiction strategy

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

6.13 Inferring the Operator Truth Tables


• Two fundamental questions:

– Are inference rules powerful enough?


– Will they ever allow us to make mistakes?

• 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?

6.13.1 Example: Deriving the Truth Table value of T rue ∧ F alse


• Want to show that it is logically equivalent to False, and not logically equivalent to True

• To show equivalence with False, we need to show: F alse ⇒ (T rue ∧ F alse), T rue ∧
F alse ⇒ F alse

– F alse ` (T rue ∧ F alse) follows from contradiction


– By introduce implication, we have F alse ⇒ (T rue ∧ F alse)
– T rue ∧ F alse ` F alse
∗ Expand out T rue the expression is now F alse ∧ (F alse ⇒ F alse)
∗ By and elimination, we get F alse ∧ (F alse ⇒ F alse) ` F alse, which by identity
gives us F alse ` F alse
∗ By introduce implication, we have 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

– By and elimination, we have T rue ∧ T rue ` T rue


– By identity, we have T rue ` T rue
– By introduce implication, we have T rue ∧ T rue ⇒ T rue

• Proof that T rue ⇒ (T rue ∧ T rue)

– Need to prove the sequent T rue ` T rue ∧ T rue


– By and introduction, we have T rue ` T rue ∧ T rue
– By introduce implication, we have T rue ⇒ T rue ∧ T rue

6.13.3 Exercise: Calculating the value of T rue ∨ F alse


• Proof that T rue ∨ F alse ⇒ T rue

– We have T rue ` T rue from identity


– We have F alse ` T rue from contradiction
– So, we have (T rue ∨ F alse), (T rue ` T rue), (F alse ` T rue)
– By or elimination, we have (T rue ∨ F alse) ` T rue
– By introduce implication, we have T rue ∨ F alse ⇒ T rue

• Proof that T rue ⇒ (T rue ∨ F alse)

– From or introduction, we have T rue ` (T rue ∨ F alse)


– By introduce implication, we have T rue ⇒ (T rue ∨ F alse)

6.13.4 Extra Credit: What happens when we try to say T rue ∨ F alse is F alse?
• Need to show equivalence

• Proof that F alse ⇒ (T rue ∨ F alse)

– F alse ` (T rue ∨ F alse) by contradiction


– By introduce implication, we have F alse ⇒ (T rue ∨ F alse)

• Proof that (T rue ∨ F alse) ⇒ F alse

– 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

• What would have happened then?

– We would have had to show that T rue ` F alse


– That is, F alse ⇒ F alse ` F alse
– Same situation as in extra credit: Have no valid inference law to use; so can’t
deduce.

7 Proof Checking by Computer


7.1 Proof Checkers and Theorem Provers
• Proof Checker: reads in a theorem and a proof. Determines if the proof is valid

• Theorem Prover: reads in a theorem and attempts to generate a proof

7.2 Example of Proof Checking


• See 06-proofs.hs

8 Boolean Algebra: Equational Reasoning


8.1 Introduction
8.1.1 Approaches to Propositional Logic
• Truth Tables: semantic approach

• Natural Deduction: syntactic approach

• Boolean Algebra: axiomatic approach

8.1.2 Equational Reasoning


• Show that two values are the same by building chains of equalities

– e.g. show that a = b and b = c, so a = c

• can substitute equals for equals

– if x = y, can substitute in x wherever y is used

25
8.2 Laws of Boolean Algebra
8.2.1 Operations with Constants
• a ∧ F alse = F alse

• a ∧ T rue = T rue

• Identity for or: a ∨ T rue = T rue

• Identity for and: a ∨ F alse = a

• Exercise 25: Simplification

– (P ∧ F alse) ∨ (Q ∧ T rue)
– F alse ∨ (Q ∧ T rue)
– Q ∧ T rue
– Q

• Exercise 26

– Prove that: (P ∧ F alse) ∧ T rue) = F alse


– Direct Proof:
∗ (P ∧ F alse) ∧ T rue)
∗ F alse ∧ T rue
∗ F alse

8.2.2 Basic Properties of ∧ and ∨


• Disjunctive Implication: a ⇒ a ∨ b (Or Introduction)

• Conjunctive Implication: a ∧ b ⇒ a (And Elimination)

• 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

– Prove: P ∧ (Q ∧ (R ∧ S)) = ((P ∧ Q) ∧ R) ∧ S


– Direct proof starting from LHS
– P ∧ (Q ∧ (R ∧ S))
– ((P ∧ Q) ∧ (R ∧ S)) (by associativity of and)
– ((P ∧ Q) ∧ R) ∧ S (by associativity of and)

8.2.3 Distributive and De Morgan’s Laws


• And distributes over Or: a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)

• Or distributes over And: a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)

• De Morgan: ¬(a ∧ b) = ¬a ∨ ¬b

• De Morgan: ¬(a ∨ b) = ¬a ∧ ¬b

• Exercise 29

– Give an intuitive explanation of second De Morgan’s laws


– If none of (a, b) are true, it means that a is not true and b is not true

8.2.4 Laws on Negation


• ¬T rue = F alse

• ¬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)

• Implication Combination: (a ⇒ b) ∧ (c ⇒ d) ⇒ ((a ∧ c) ⇒ (b ∧ d))

• Currying: (a ∧ b) ⇒ c = a ⇒ b ⇒ c

• Implication: a ⇒ b = ¬a ∧ b

• Contrapositive: a ⇒ b = ¬b ⇒ ¬a

• Absurdity: (a ⇒ b) ∧ (a ⇒ ¬b) = ¬a

• Understanding the currying law

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

• Understanding the Implication Law

– 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

8.2.6 Logical Equivalence


• a ⇔ b is the same as (a ⇒ b) ∧ (b ⇒ a)

• Subtle difference between ⇔ and =

– = 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

– Prove: ((¬A ∧ B) ∨ (A ∧ ¬B)) ⇔ (A ∨ B) ∧ (¬(A ∧ B))


– Direct proof starting from “left side”
– (¬A ∧ B) ∨ (A ∧ ¬B)
– (¬A ∨ (A ∧ ¬B)) ∧ (B ∨ (A ∧ ¬B)) (by distributing the OR over the AND)
– ((¬A ∨ A) ∧ (¬A ∨ ¬B)) ∧ ((B ∨ A) ∧ (B ∨ ¬B)) (by distributing the OR over the AND)
– (T rue ∧ (¬A ∨ ¬B)) ∧ ((B ∨ A) ∧ T rue)
– (¬A ∨ ¬B) ∧ (B ∨ A)
– ¬(A ∧ B) ∧ (B ∨ A) (by Demorgan’s laws)

• 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

– Prove: (A ∨ B) ∧ (¬A ∨ C) ∧ (B ∨ C) ⇔ (A ∨ B) ∧ (¬A ∨ C)


– Proof is by cases on A
– Case: A is True
∗ LHS: (T rue ∨ B) ∧ ((¬T rue) ∨ C) ∧ (B ∨ C)
∗ i.e. T rue ∧ C ∧ (B ∨ C)
∗ i.e. C ∧ (B ∨ C)
∗ i.e. C (proven in Review Exercise 45)
∗ RHS: (T rue ∨ B) ∧ ((¬T rue) ∧ C)

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.

9 Logic in Computer Science


• Talks about applications of theorem provers

10 Meta Logic
• Making statements about the logical system itself

• Fundamental Meta-Logic operators:

– P1 , P2 , · · · , Pn ` Q means there is a proof that shows Q from the assumptions


P1 , · · · , Pn
– P1 , P2 , · · · , Pn  Q means Q must be tree if all assumptions are true, but says
nothing about the proof

10.1 Definition: Consistency of a Logical System


• A formal system is consistent if, for all well-formed formulas a and b, if a ` b then a  b

• That is, each proposition that is provable is actually True

10.2 Definition: Completeness of a Logical System


• A formal system is complete if, for all well-formed formulas a and b, if a  b then a ` b

• That is, every proposition that is true can be proved using the system

10.3 Theorem: Propositional Logic is consistent and complete


• No proof given

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

– “Don’t miss it”

• Godel, Escher, Bach: An Eternal Braid by Douglas Hofstadter

– “Another unmissable classic”

• How to Prove it: A Structured approach by Daniel Velleman

– Good source for hints on carrying out proofs with lots of example

• Computer-Aided Reasoning: An approach: by Matt Kaufmann, Panagiotis Mano-


lios, and J Strother Moore

– Describes the ACL2 theorem prover

• Introduction to HOL: by M Gordon and T Melham

– Describes the HOL theorem prover

• Logic for Mathematics and Computer Science by Burris

– “more advanced treatement of mathematical logic”

• A Mathematical Introduction to Logic by Enderton

– “standard presentation of logic from a mathematical perspective”

• Type Theorey and Functional Programming by Thompson

– “detailed development of relationship between inference rules and rules used to


define type systems”

• Logic and Declarative Language by Downward

• Proofs and Types by Girard, Lafont and Taylor

– relationship between inference proofs and type systems at a research level

31

You might also like