Cs245 F16 Part 1
Cs245 F16 Part 1
Cs245 F16 Part 1
Propositional Logic
Jonathan Buss
November 1, 2016
Based in part on materials prepared by B. Bonakdarpour
from Huth & Ryans text.
Additional thanks to D. Maftuleac, R. Trefler, and P. Van Beek.
1/241
2/241
Introduction to Logic
What is logic?
3/241
An Example Argument
Consider this example.
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.
Question. Is this argument valid? Why, or why not?
Introduction to Logic
What is logic?
4/241
An Example Argument
Consider this example.
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.
Question. Is this argument valid? Why, or why not?
Question. What is the structure of the argument?
Introduction to Logic
What is logic?
4/241
An Example Argument
Consider this example.
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.
Question. Is this argument valid? Why, or why not?
Question. What is the structure of the argument?
We can represent the structure symbolically as
If p and not q, then r. Not r. p. Therefore q.
Introduction to Logic
What is logic?
4/241
Introduction to Logic
What is logic?
5/241
What is logic?
5/241
Introduction to Logic
What is logic?
6/241
What Is Logic?Reprise
In the example argument,
The factual content of the statements doesnt matter.
The relationships among the statements govern the argument.
Introduction to Logic
What is logic?
7/241
Propositions
Introduction to Logic
Propositional logic
8/241
Examples of Propositions
Each of the following is a proposition.
The sum of 3 and 5 is 8.
The sum of 3 and 5 is 35.
5.
Program p terminates.
If the input to program p is a non-negative integer , then
numbers.
Jane reacted violently to Jacks accusations.
Introduction to Logic
Propositional logic
9/241
pq
pq
pq
p q
Introduction to Logic
Propositional logic
10/241
Examples
1. She is clever and hard working.
2. He is clever but not hard working.
3. He didnt write the letter or the letter was lost.
4. If he does not study hard then he will fail.
5. He must study hard; otherwise he will fail.
6. He will fail unless he studies hard.
7. He will not fail only if he studies hard.
Introduction to Logic
Propositional logic
11/241
Examples
1. If it rains, he will be at home; otherwise he will go to the market
or to school.
2. The sum of two numbers is even if and only if both numbers are
even or both numbers are odd.
3. If y is an integer then z is not real, provided that is rational.
Introduction to Logic
Propositional logic
12/241
Propositions
Introduction to Logic
Propositional logic
13/241
Introduction to Logic
Propositional logic
14/241
Syntax of
Propositional Logic
Syntax
15/241
Syntax
16/241
Syntax
17/241
More on Expressions
An expression is a finite sequence (or string) of symbols.
The length of an expression is its number of symbols.
For example, ()()pq is an expression.
Questions:
What is its length of this expression?
Is it a formula?
Syntax
18/241
of the same length, say n, and if n > 0 then for all [1..n] the
th symbol of is the same as the th symbol of .
= ()()
= pq
= ()()pq .
Syntax
19/241
Concatenation, formally
Definition:
If is an expression of length and is an expression of
length j, then is an expression of length + j. We have
the k th symbol of
if k
th
The k symbol of is
th
the (k ) symbol of if k >
Syntax
20/241
( ) ,
and
( ) ,
and
( )
is a well-formed formula.
4. Nothing else is a well-formed formula.
Syntax
21/241
(rule 1)
2. (p)
3. (r q)
4. ((p) s)
6. ((r q))
Syntax
22/241
Question: Can a formula have two (or more) kinds? E.g., can it be
both a conjunction and an implication? Or both a negation and a
disjunction?
Syntax
23/241
Semantics of
Propositional Logic
Semantics
24/241
Semantics
The semantics of a logic describes how to interpret the well-formed
formulas of the logic.
The semantics of propositional logic is compositional; in other
words, the meaning of a whole formula derives from the meaning of
its parts.
In propositional logic, we need to give meaning to atoms,
connectives, and formulas.
For example, the interpretation of formula (p q) depends on three
things: the meaning of p, the meaning of q, and the meaning of .
Semantics
25/241
Definition:
A truth valuation is a function with the set of all proposition
symbols as domain and {F, T} as range.
In other words, a truth valuation assigns a value to every
propositional variable.
If t(p) = T, then we say/write, t makes p true.
If t(p) = F, then we say/write, t makes p false.
Semantics
26/241
Compound formulas
Not A
A and B
A or B
If A then B
A iff B
Semantics
27/241
Semantics of Connectives
Formally, a connective represents a function from truth values to
truth values.
There are two types of connectives: unary and binary.
The connective is unary; it maps one value to one value. We can
show its function in a picture, known as a truth table:
T
F
()
F
T
The other connectives are binary; they map two values to one value.
Thus their truth tables require four lines to cover the possibilities.
Semantics
Connectives
28/241
T
T
F
F
T
F
T
F
( )
T
F
F
F
( )
T
T
T
F
( )
T
F
T
T
( )
T
F
F
T
Connectives
29/241
If-then??
Some people find the meaning of rather unintuitive. You may
want to think of as meaning truth is preserved.
The meaning of T T is T because truth is preserved.
The meaning of T F is F because truth is not preserved.
The meaning of F T and F F are both T, because there is no
truth to preserve.
For example, the following sentence comes out true:
If everyone is a child, then the moon is made of green
cheese.
Some people prefer to call that sentence non-sensical, rather than
true. But propositional logic gives every formula a meaning.
Semantics
Connectives
30/241
2. ()t =
3. ( )t =
4. ( )t =
T
F
6. (
)t
T
F
if t = t = T
otherwise
T
F
if t = T or t = T
otherwise
T
F
if
= F or
otherwise
T
F
5. ( )t =
if t = F
if t = T
The valuation t is
necessary.
Without a valuation, a
formula has no value.
=T
if t = t
otherwise
Semantics
Formulas
31/241
Semantics
Properties of formulas
32/241
As an example, consider (p q) r . It can be formed from the
two formulas (p q) and r using the connective .
Semantics
Properties of formulas
33/241
Mathematical Induction
Semantics
Properties of formulas
34/241
Natural Numbers
The natural numbers are the numbers we use to count things.
Before we start, we count zero; as we find things we count one, two,
etc.
The natural numbers form an unbounded sequence
0, 1, 2, 3, 4, . . .
Suppose P names a property. We write P(2) to mean 2 has
property P, or P holds for 2.
A statement every natural number has property P corresponds to
a sequence of statements
P(0), P(1), P(2), P(3), P(4), . . .
Semantics
Mathematical induction
35/241
Mathematical Induction
Principle of mathematical induction:
Suppose we establish two things: that
0 has property P, and that
whenever any number has property P, then the next
number also has property P.
Then we may conclude that every natural number has
property P.
n
P
=0
n(n+1)
2
n
P
=0
Semantics
Mathematical induction
n(n+1)
.
2
36/241
0
P
=0
0(0+1)
2
The left side of the equation is just 0. Also the right side evaluates
to 0.
Thus 0 has property P.
Step 2 (inductive step): hypothesize that some number has
property P; in other words, that
some P
number
=0
Semantics
Mathematical induction
37/241
0
P
=0
0(0+1)
2
The left side of the equation is just 0. Also the right side evaluates
to 0.
Thus 0 has property P.
Step 2 (inductive step): hypothesize that some number has
property P; in other words, that
some P
number
=0
k
P
=0
Semantics
k(k+1)
2
Mathematical induction
37/241
k
X
k(k + 1)
=0
(k + 1) ((k + 1) + 1)
2
(k + 1) (k + 2)
2
We calculate:
k+1
X
=0
=
=
=
k
X
+ (k + 1)
=0
k(k+1)
+ (k + 1)
2
k
+ 1 (k + 1)
2
(k+1)(k+2)
2
Semantics
definition of
hypothesis
"algebra"
DONE!
Mathematical induction
38/241
k
X
k(k + 1)
=0
(k + 1) ((k + 1) + 1)
2
(k + 1) (k + 2)
2
We calculate:
k+1
X
=0
=
=
=
k
X
+ (k + 1)
=0
k(k+1)
+ (k + 1)
2
k
+ 1 (k + 1)
2
(k+1)(k+2)
2
Semantics
definition of
hypothesis
"algebra"
DONE!
Mathematical induction
38/241
Observations/Techniques
To talk about something, give it a name.
E.g., property P, number k, etc.
A formula is a textual object. In this text, we can substitute one
symbol or expression for another. For example, we put k + 1 in
place of k.
The induction principle gives a template for a proof:
The proof has two parts: the basis and the inductive step.
In the inductive step, hypothesize P(k) and prove P(k + 1) from
it.
But the induction principle does not say how to actually do either
step. We must invent the method ourselves.
Semantics
Mathematical induction
39/241
Strong Induction
or Course of Values
Basis
Show P(0)
Show P(0)
Ind. Hypothesis P(k) holds
P(m) holds, for every m k
Ind. Step
Show P(k + 1) holds
Show P(k + 1) holds
Conclusion
P(k) holds for every k P(k) holds for every k
Simple induction is sometimes called weak induction.
Semantics
Mathematical induction
40/241
Strong Induction
or Course of Values
Basis
Show P(0)
Show P(0)
Ind. Hypothesis P(k) holds
P(m) holds, for every m k
Ind. Step
Show P(k + 1) holds
Show P(k + 1) holds
Conclusion
P(k) holds for every k P(k) holds for every k
Simple induction is sometimes called weak induction.
Semantics
Mathematical induction
40/241
Strong Induction
or Course of Values
Basis
Show P(0)
Show P(0)
Ind. Hypothesis P(k) holds
P(m) holds, for every m k
Ind. Step
Show P(k + 1) holds
Show P(k + 1) holds
Conclusion
P(k) holds for every k P(k) holds for every k
Simple induction is sometimes called weak induction.
Semantics
Mathematical induction
40/241
Strong Induction
or Course of Values
Basis
Show Q(0)
Show P(0)
Ind. Hypothesis P(k) holds
P(m) holds, for every m k
Ind. Step
Show P(k + 1) holds
Show P(k + 1) holds
Conclusion
P(k) holds for every k P(k) holds for every k
Simple induction is sometimes called weak induction.
Semantics
Mathematical induction
40/241
Strong Induction
or Course of Values
Basis
Show Q(0)
Show P(0)
Ind. Hypothesis Q(k) holds
P(m) holds, for every m k
Ind. Step
Show Q(k + 1) holds
Show P(k + 1) holds
Conclusion
P(k) holds for every k P(k) holds for every k
Simple induction is sometimes called weak induction.
Semantics
Mathematical induction
40/241
Strong Induction
or Course of Values
Basis
Show Q(0)
Show P(0)
Ind. Hypothesis Q(k) holds
P(m) holds, for every m k
Ind. Step
Show Q(k + 1) holds
Show P(k + 1) holds
Conclusion
Q(k) holds for every k P(k) holds for every k
Simple induction is sometimes called weak induction.
Semantics
Mathematical induction
40/241
Structural Induction
Goal: prove that every formula has property P.
How to prove such a statement? Can we use induction?
A formula is not a natural number. . . .
Semantics
Mathematical induction
41/241
Structural Induction
Goal: prove that every formula has property P.
How to prove such a statement? Can we use induction?
A formula is not a natural number, but it suffices to prove any one of
the following.
For every natural number n, every formula with n or fewer
symbols has property P.
or
For every natural number n, every formula with n or fewer
connectives has property P.
or
Semantics
Mathematical induction
41/241
Mathematical induction
42/241
Semantics
Mathematical induction
43/241
Mathematical induction
44/241
Semantics
Mathematical induction
45/241
Semantics
inspection
Mathematical induction
45/241
= 1 + c() + c()
Semantics
inspection
R() and R()
Mathematical induction
45/241
= 1 + c() + c()
= c ( )
Semantics
inspection
R() and R()
inspection .
Mathematical induction
45/241
Semantics
Mathematical induction
46/241
Semantics
Mathematical induction
46/241
Semantics
Mathematical induction
46/241
Semantics
Mathematical induction
46/241
Semantics
Mathematical induction
46/241
Semantics
Mathematical induction
47/241
Semantics
Mathematical induction
47/241
Mathematical induction
48/241
Mathematical induction
49/241
Commentary
The goal of the proof is property Cunique formation.
However, properties A and B are required in order to prove C.
There are actually two equally good options for a proof:
1. Prove A, B and C simultaneously, as a single compound
property.
(As done here.)
2. Prove them separately: first A, then B, and finally C.
(The text uses this method.)
Two fundamental techniques:
1. If a proof doesnt work, go back and fix it
as often as necessary.
2. Start from the end and work backwards.
Semantics
Mathematical induction
50/241
( rest of subformula )
{z
}
|
To determine m: count
excess of ( over )
m+1
m+ 2 ... n 1
subformula 2
51/241
52/241
Evaluating formulas
Recall that propositional logic is compositional. The value of two
subformulas, determines the value of their composition using a
propositional connective. Given a valuation t:
pt = t(p)
T
()t =
F
T
( )t =
F
if t = F
if t = T
if t = t = T
otherwise
( ) =
( )t =
( )t =
T
F
if t = T or t = T
otherwise
T
F
if t = F or t = T
otherwise
T
F
if t = t
otherwise
Evaluation of Formulas
53/241
q
F
F
T
T
F
F
T
T
r
F
T
F
T
F
T
F
T
(p q)
F
F
T
T
T
T
T
T
(q r)
F
F
F
T
F
F
F
T
(p q) (q r)
T
T
F
T
F
F
F
T
Columns: List all the propositional variables on left and all the
subformulas (in increasing order of the number of connectives) on
the right.
Rows: Create a row for every possible combination of truth
valuations for the propositional variables.
Working with Formulas
Evaluation of Formulas
54/241
Exercises
iii. p (q)) q (p)
Evaluation of Formulas
55/241
56/241
A Tautology Example
Example. Is ((((p q) r) (p q)) (p r)) a tautology?
One method: Fill out a truth table.
For larger formulas, with more variables, this approach can take a
long time.
Can we do better? Is there some other method?
Basic Idea For a formula like (p q) ((p) r) , if we set t(p) = T
then the formula simplifies to (T q) (F r) which in turn
simplifies to q.
Clearly this formula is not a tautology. When you set t(p) = T and
t(q) = F it has the value F.
Clearly this formula is not a contradicton. When you set t(p) = T and
t(q) = T it has the value T.
57/241
F
T
AT
AF
TA
FA
AA
A
F
A
F
A
AT
AF
TA
FA
AA
T
A
T
A
A
AT
AF
TA
FA
AA
T
A
A
T
T
58/241
59/241
59/241
59/241
59/241
Equivalence of Formulas
Suppose that a formula ( ) is a tautology.
Then and must have the same final column in their truth
tablesthey have the same value under any valuation.
E.g. if = (q (p)) and = (p q) we can see that their
corresponding columns are identical.
p
F
F
T
T
q
F
T
F
T
(q (p))
T
T
F
T
p
F
F
T
T
(p q)
T
T
F
T
q
F
T
F
T
Equivalence
60/241
Equivalent is Equivalent
Equivalent formulas are equivalent in any context.
Lemma. Suppose that . Then for any formula , and any
connective ?, the formulas ( ? ) and ( ? ) are equivalent:
( ? ) ( ? ) .
Proof idea: a value ( ? )t depends only on the values t and t ,
and the identity of ?.
Example: (p) p p. Check this with a truth table.
p
F
T
(p)
T
F
(p) p
F
T
Hence we get that (p p) q (p q).
Working with Formulas
Equivalence
61/241
Algebra of Formulas
Many equivalences of formulas look much like rules of ordinary
arithmetic.
Commutativity
( ) ( )
( ) ( )
Idempotence
( )
( )
Associativity
Double Negation
(())
( ) ( )
( ) ( )
Distributivity
( ) ( ) ( )
( ) ( ) ( )
Equivalence
De Morgans Laws
( ) ( )
( ) ( )
62/241
Implication
( ) (() )
Simplification II
( )
( )
Equivalence
Contrapositive
( ) () ()
( ) ( ) ( )
Excluded Middle
( ()) T
Contradiction
( ) F
Equivalence
63/241
1.
2.
3.
4.
5.
6.
7.
8.
(p q) (q r)
(p r) (q s)
p (p q)
(p (r s))
((p q) p)
p
p
p ((q p) p)
q (p r)
(p q) (p s) (r q) (r s)
p (without using Simplification II)
(p r) (p s)
F
p (q p)
p (((q) (p)) p)
q
Note: Apply only one rule per line of your proof (but you may apply
the rule multiple times).
Working with Formulas
Equivalence
64/241
Application: Cards
We are given a deck of cards with a letter of the alphabet on one
side and a natural number on the other side.
Claim: For the four cards shown below, each card that has a vowel
on one side, has an even number on the other side.
Equivalence
65/241
Entailment
66/241
Entailment
67/241
Examples: Entailment
Example
{(p q), (q r)} |= (p r)
Entailment
68/241
Examples: Entailment
Example
{(p q), (q r)} |= (p r)
Example
((p (q)) r), (q (r)), (p r) 6|= (p (q r))
Entailment
68/241
Examples: Entailment
Example
{(p q), (q r)} |= (p r)
Example
((p (q)) r), (q (r)), (p r) 6|= (p (q r))
Example
|= means that is a tautology. Why?
Entailment
68/241
Examples: Entailment
Example
{(p q), (q r)} |= (p r)
Example
((p (q)) r), (q (r)), (p r) 6|= (p (q r))
Example
|= means that is a tautology. Why?
Example
{, ()} |= is always true, whatever and are. Why?
Entailment
68/241
Entailment
69/241
A Code Example
if ( (input > 0) OR NOT output ) {
if ( NOT (output AND (queuelength < 100) ) ) {
P1
} else if ( output AND NOT (queuelength < 100) ) {
P2
} else { P3 }
} else { P4 }
Let :
:
q:
input > 0,
output,
queuelength < 100.
Conditional Code
70/241
P4
P4
Conditional Code
( q)
Action
71/241
( q)
Action
P3
P1
P1
P1
P4
P4
P1
P1
Conditional Code
71/241
( q)
Action
P3
P1
P1
P1
P4
P4
P1
P1
P2 is never executed.
Conditional Code
71/241
Negation
Commutativity
Associativity
Contradiction
Simplification I
Conditional Code
72/241
Conditional Code
73/241
Simplifying Code
Consider these two fragments of code. Are they equivalent?
Fragment 2:
Fragment 1:
if ( q ) {
P3
}
else if ( ) {
P4
}
else {
P1
}
if ( ) {
if ( ( q) ) {
P1
}
else if ( q ) {
P2
}
else {
P3
}
}
else {
P4
}
Conditional Code
74/241
Simplifying Code
To prove that the two fragments are equivalent, show that each
block of code P1 , P2 , P3 , and P4 is executed under equivalent
conditions.
Block
P1
P2
P3
P4
Fragment 1
( ) ( q)
( ) ( q) ( q)
( ) ( q) ( q)
( )
Fragment 2
( q) ( )
F
( q)
( q) ( )
Conditional Code
75/241
Definability of Connectives
Formulas and are equivalent.
Thus is said to be definable in terms of and .
There are actually sixteen possible binary connectives. (Why?)
Two of these are essentially nullary (they ignore the input).
1. one is always T no matter what the input
2. the other is always F no matter what the input
Four others are essentially unary (they ignore one value but not the
other).
E.g. a connective (p ? q) = p ignores the first value and always
76/241
Adequate Sets
A set of connectives is said to be adequate iff any n-ary (n 1)
connective can be defined in terms of the ones in the set.
Lemma. {, , } is an adequate set of connectives.
Proof: see the equivalence rules Implication and Equivalence.
Lemma. Each of the sets {, }, {, }, and {, } is adequate.
Proof: For the first two, use De Morgans laws. For the third, . . . ?
Theorem. The set {, } is not an adequate set of connectives.
Proof: For both and : the output is always F if both inputs are F;
the output is always T if both the inputs are T. So you cannot
implement .
77/241
78/241
79/241
What Is a Proof?
A proof is a formal demonstration that a statement is true.
It must be mechanically checkable. A reader need not apply any
Notions of Proof
80/241
preceding formulas.
That is, there is an inference rule (defined by the proof system)
that justifies the formula, based on the previous ones.
The final formula is the conclusion.
The key here is the set of inference rules. A set of inference rules
defines a proof system.
We notate there is a proof with premises and conclusion by
`
which can be read as proves .
Proofs in Propositional Logic
Notions of Proof
81/241
Inference Rules
In general, an inference rule is written as
1
...
A kind of definition of .
Notions of Proof
Approaches to Proofs
Direct proofs:
To establish ` , give a proof with 1 , 2 , . . . , n as
assumptions, and obtain as the conclusion.
Refutations (a.k.a. indirect proofs, or proofs by contradiction):
To establish ` , take as an assumption, in addition to
1 , 2 , . . . , n . Obtain a definitive contradiction (denoted )
as a conclusion.
In other words, give a direct proof of {} ` .
Why does the refutation approach work?
If {} is a contradiction, then any valuation t that makes
true must make false and thus make true. Therefore, |= .
Notions of Proof
83/241
Notions of Proof
84/241
Unit resolution:
(eliminate p)
p p
Resolution
85/241
premise
2.
premise
3.
p q
negated goal
Resolution
86/241
premises
2.
premises
3.
p q
Resolution
87/241
1.
premises
2.
premises
3.
p q
4.
1, 3
Resolution
87/241
1.
premises
2.
premises
3.
p q
4.
1, 3
5.
2, 4
Resolution
87/241
clauses.
In other words, a formula is in CNF if and only if
its only connectives are , and/or ,
applies only to variables, and
applies only to subformulas with no occurrence of .
Resolution
88/241
Converting to CNF
1. Eliminate implication and equivalence.
Replace ( ) by ( )
Replace ( ) by ( ) ( ).
Now only , and appear as connectives.
2. Apply De Morgans and double-negation laws as often as
possible.
Replace ( ) by .
Replace ( ) by .
Replace by .
Now negation only occurs in literals.
3. Transform into a conjunction
of clauses usingdistributivity.
Replace ( ) by ( ) ( ) .
4. Simplify using idempotence, contradiction, excluded middle and
Simplification I & II.
Resolution
89/241
Resolution
90/241
Example: Resolution
Resolution
91/241
Example, contd
p q
premise
2.
q r
premise
3.
4.
Resolution
92/241
Example, contd
p q
premise
2.
q r
premise
3.
4.
5.
1, 3 (variable p)
Resolution
92/241
Example, contd
p q
premise
2.
q r
premise
3.
4.
5.
1, 3 (variable p)
6.
2, 5 (variable q)
Resolution
92/241
Example, contd
p q
premise
2.
q r
premise
3.
4.
5.
1, 3 (variable p)
6.
2, 5 (variable q)
7.
4, 6 (variable r)
Refutation complete!
Resolution
92/241
93/241
Resolution Is Sound
For resolution to be meaningful, we need the following.
Theorem. Suppose that {1 , . . . , n } `Res ; that is, there is a
resolution refutation with premises 1 , . . . , n and conclusion .
Then the set {1 , . . . , n } is unsatisfiable (contradictory).
That is, if {} `Res , then {} is a contradiction.
Therefore, |= .
In other words, the Resolution proof system is sound.
I.e. if we prove something, (with a method like resolution) then it is
true using a truth valuation.
We prove the theorem by induction on the length of the refutation.
94/241
95/241
96/241
97/241
98/241
99/241
100/241
101/241
clauses.
Additional techniques: setting variables, learning, etc.
102/241
103/241
104/241
Satisfiability in Theory
If a formula is satisfiable, then there is a short demonstration of that:
simply give the valuation. Anyone can easily check that it is correct.
The class of problems with this property is known as NP.
The class of problems for which one can find a solution efficiently is
known as P.
(For a precise definition, we need to define efficiently. We wont,
here.)
105/241
Natural Deduction
106/241
Natural Deduction
Introduction
107/241
or simply
Natural Deduction
Introduction
` .
108/241
`-notation
inference notation
{} `
Natural Deduction
Basic Rules
109/241
A First Example
Recall the format of a proof from slides 80-82. For Natural Deduction
each line is identified with a line number,
followed by the formula,
followed by the justification.
Here is a proof of p, q ` p.
1. p
Premise
2. q
Premise
3. p
Reflexivity: 1
Premise
and be done.
Note: extra formulas never hurt anything.
Natural Deduction
Basic Rules
110/241
`-notation
If ` and ` ,
then `
inference notation
Rule i means
If each of the formulas and already appear in the proof,
then we may write the formula as the next formula of
the proof.
Natural Deduction
Conjunction Rules
111/241
`-notation
If ` ,
then ` and `
inference notation
Rule e means
If the formula already appears in the proof, then we
may write either or as the next formula of the proof.
Natural Deduction
Conjunction Rules
112/241
Premise
2. q
e: 1
3. p
e: 1
4. q p
i: 2, 3
Explanation
The second line of the proof is saying that the formula q was
Conjunction Rules
113/241
Premise
2. r
Premise
3. q
e: 1
4. q r
i: 3, 2
Explanation
The premise (or premises) are listed first.
The final formula is the conclusion.
Natural Deduction
Conjunction Rules
114/241
`-notation
If ` and ` ,
then `
inference notation
In words:
If each of the formulas and already appear in the
proof, then you may conclude .
Natural Deduction
Implication Rules
115/241
`-notation
-introduction
(i)
If {} ` ,
then `
inference notation
..
..
Implication Rules
116/241
Sub-Proof Rules
To use rule i, we must have a completed sub-proof.
Assumption Rule
A sub-proof may be opened at any point.
Its first line, labelled assumption, may be any formula.
Implication Rules
117/241
p q, q r ` p r.
pq
Premise
2.
qr
Premise
pr
What next?
???
Natural Deduction
Implication Rules
118/241
p q, q r ` p r.
pq
Premise
2.
qr
Premise
3.
Assumption
What next?
The goal p r contains .
Lets try rule i. . .
4.
5.
6.
pr
i: ??
Natural Deduction
Implication Rules
118/241
p q, q r ` p r.
1.
pq
Premise
2.
qr
Premise
3.
Assumption
4.
5.
e: 2, 4
6.
pr
i: ??
Natural Deduction
Implication Rules
118/241
p q, q r ` p r.
pq
Premise
2.
qr
Premise
3.
Assumption
4.
e: 1, 3
5.
e: 2, 4
6.
pr
What next?
The goal p r contains .
Lets try rule i. . .
Inside the sub-proof, we can
use rule e.
i: 35
Done!
Note the use of the range 3-5 on line 6 to specify the beginning and
the end of the sub-proof.
In order to conclude p r on line 5 the box must begin with p (line
3) and end with r (line5).
Natural Deduction
Implication Rules
118/241
`-notation
If ` ,
then `
and `
If , 1 `
and , 2 ` ,
then
, 1 2 `
inference notation
1
..
..
1 2
2
..
..
For the -elimination rule, if you have 1 2 and you can show
both that 1 implies and that 2 implies , then you can conclude
.
Rule e is also known as proof by cases.
Natural Deduction
Disjunction Rules
119/241
pq
Premise
2.
Assumption
3.
Assumption
4.
Reflexivity: 2
5.
qp
i: 34
6.
(p q) (q p)
i: 5
7.
Assumption
8.
Assumption
9.
Reflexivity: 7
10.
pq
i: 89
11.
(p q) (q p)
i: 10
12.
(p q) (q p)
e: 1, 26, 711
Natural Deduction
Disjunction Rules
120/241
Disjunction Rules
121/241
Negation
We shall treat negation by considering contradictions, such as
( ()).
The notation , sometimes called bottom or contradiction will be
used to represent any contradiction.
It may appear in proofs as if it were a formula.
The -elimination rule (a.k.a the -introduction rule).
Name
-introduction, or
-elimination (e)
`-notation
, , `
inference notation
Negation
122/241
`-notation
-introduction
(i)
If , ` ,
then `
inference notation
..
..
In words:
If the assumption of a sub-proof, , leads to a contradiction,
then derive .
Natural Deduction
Negation
123/241
Example: Negation
Example. Show that ` .
Natural Deduction
Negation
124/241
Example: Negation
Example. Show that ` .
1.
Natural Deduction
Premise
??
Negation
124/241
Example: Negation
Example. Show that ` .
1.
Premise
2.
Assumption
3.
4.
5.
Natural Deduction
??
i: 2?
Negation
124/241
Example: Negation
Example. Show that ` .
1.
Premise
2.
Assumption
3.
e: 1, 2
4.
5.
Natural Deduction
??
i: 2?
Negation
124/241
Example: Negation
Example. Show that ` .
1.
Premise
2.
Assumption
3.
e: 1, 2
4.
e: 2, 3
5.
i: 24
Natural Deduction
Negation
124/241
Double-Negtion Elimination
`notation
If ` ,
then `
inference notation
In words:
Two adjacent negation connectives can cancel each other
out.
Natural Deduction
Negation
125/241
Contradiction Elimination
The -elimination rule specifies what can be derived if there is a
contradiction.
Contradiction Elimination:
Name
`-notation
-elimination
(e)
If ` ,
then `
inference notation
In words:
Any formula, can be derived from a contradiction.
Natural Deduction
Negation
126/241
A Redundant Rule
Although the -elimination is quite useful is not actually needed.
Since it can be derived from other rules it is called a derived rule.
Suppose a proof has
27.
some rule
28.
e: 27.
27.
some rule
28.
Assumption
29.
Reflexivity: 27
30.
i: 2829
31.
e: 30.
Negation
127/241
Natural Deduction
Negation
128/241
pq
Premise
2.
Premise
??
MT
Natural Deduction
Negation
128/241
pq
Premise
2.
Premise
3.
Assumption
5.
??
6.
i: ??
4.
MT
Natural Deduction
Negation
128/241
pq
Premise
2.
Premise
3.
Assumption
4.
e: 3, 1
5.
??
6.
i: ??
MT
Natural Deduction
Negation
128/241
pq
Premise
2.
Premise
3.
Assumption
4.
e: 3, 1
5.
e: 2, 4
6.
i: 35
Natural Deduction
Negation
128/241
Derived Rules
Whenever we have a proof of the form ` , we can consider it as a
derived rule:
Natural Deduction
Negation
129/241
130/241
pq
Premise
(r p) (r q)
??
Natural Deduction
131/241
pq
Premise
2.
rp
Assumption
rq
??
(r p) (r q)
??
9.
Natural Deduction
131/241
pq
Premise
2.
rp
Assumption
3.
Assumption
4.
rq
??
5.
Assumption
7.
rq
??
8.
rq
e: ??
9.
(r p) (r q)
i: 28
6.
Natural Deduction
131/241
1.
pq
Premise
2.
rp
Assumption
3.
Assumption
4.
rq
i: 3
5.
Assumption
6.
e: 5, 1
7.
rq
i: 6
8.
rq
e: 2, 34, 57
9.
(r p) (r q)
i: 28
Natural Deduction
131/241
` (p q) p p.
1.
(p q) p p
Natural Deduction
Try i. . .
132/241
` (p q) p p.
1.
(p q) p
5.
6.
(p q) p p
Natural Deduction
Assumption
Try i. . .
132/241
` (p q) p p.
(p q) p
Assumption
No elimination applies.
2.
3.
4.
?????
5.
6.
No connective.
(p q) p p
Natural Deduction
Try i. . .
132/241
` (p q) p p.
(p q) p
Assumption
No elimination applies.
2.
3.
4.
?????
5.
6.
No connective.
(p q) p p
Try i. . .
Natural Deduction
132/241
133/241
Soundness and
Completeness
of Natural Deduction
Natural Deduction
134/241
Natural Deduction
135/241
Proof of Soundness
To prove soundness, we use induction on the length of the proof:
For all deductions ` which have a proof of length n or
less, it is the case that |= .
That property, however, is not quite good enough to carry out the
induction, because of the issue of open sub-proofs.
We actually use the following property of a natural number n.
Suppose that a formula appears at line n of a partial
deduction, which may have one or more open sub-proofs.
Let be the set of premises used and be the set of
assumptions of open sub-proofs. Then |= .
Natural Deduction
136/241
1.
Premise.
or
1.
Assumption.
We have either (in the first case), or (in the second case).
Thus |= , as required.
Natural Deduction
137/241
Natural Deduction
138/241
Natural Deduction
139/241
Natural Deduction
140/241
141/241
Natural Deduction
Proof of Completeness
142/241
Natural Deduction
Proof of Completeness
143/241
p
if (p ) = T
=
p if (p ) = F.
If = T, then {1 , . . . k } ` , and
if = F, then {1 , . . . k } ` .
To prove the claim, use structural induction on formulas
(which is induction on the column number of the truth table).
Once the claim is proven, we can prove a tautology as follows. . . .
Natural Deduction
Proof of Completeness
144/241
p1 p1
L.E.M.
2.
p2 p2
L.E.M.
..
.
k.
k + 1.
m + 1. p1
pk pk
L.E.M.
p1
assumption
p2
assumption
..
.
n.
..
.
assumption
e: 1, (k + 1)m,
(m + 1)n
p2
assumption
..
.
m.
e: 2, . . .
Natural Deduction
Proof of Completeness
145/241
Proof of Completeness
146/241
First-Order Logic
147/241
false.
A compound proposition was made up of
propositional variables, e.g. p, q, r
connectives, e.g. , , ,
punctuation, e.g. (, )
set.
This requires extensions to Propositional Logic.
First-Order Logic
148/241
First-Order Logic
149/241
First-Order Logic
150/241
Arithmetic, Etc.
In arithmetic, we have several possible domains, e.g.
N: The natural numbers
Z: The integers
Q: The rationals
Integers modulo n
151/241
1111111111
0000000000
000000000
111111111
0000000000
1111111111
000000000
111111111
0000000000
1111111111
B3
000000000
111111111
0000000000
1111111111
000000000
111111111
0000000000
1111111111
000000000
111111111
0000000000
1111111111
11111
00000
00000
11111
00000
11111
0000
1111
00000
11111
0000
1111
00000
11111
0000
1111
00000
11111
0000
1111
00000
11111
0000
1111
00000
11111
0000
1111
00000
11111
0000
1111
00000
11111
0000
1111
B2
11111111
00000000
00000000
11111111
00000000
11111111
00000000
11111111
First-Order Logic
152/241
B1 B2 B3
B1
F
F
F
B2
F
F
F
B3
T
F
F
The set b | Be(b) of blue boxes is {B2, B3}.
First-Order Logic
153/241
(On(, )) .
OnTable() ( y On(, y) )
.
Some properties depend on the situation.
Every
red block has a block
on it:
Red() y On(y, ) .
Some block is on a block that is on the table:
y On(, y) OnTable(y)
.
First-Order Logic
154/241
Graphs
A graph is a binary relation.
A finite graph:
An infinite graph:
y
4
3
2
1 2 3 4 5
(The set , y | y = 1 + / 2 ).
155/241
Relational Databases
A relational database is a listing of one or more relations.
Example:
Person: The people (or their names).
NumberOf : An association between people and their phone
Here the domain contains both people and phone numbers the
objects about which we have relations.
A sample statement: There exists a person who does not have a
phone number.
Person() ( y(NumberOf (, y) ) .
First-Order Logic
156/241
A Conundrum
Consider the statement, Only people have phone numbers.
How shall we represent it as a logical formula?
Whenever and y satisfy NumberOf (, y), then is a person.
y NumberOf (, y) Person()
.
Whenever has some phone number y, then is a person.
y NumberOf (, y) Person() .
Using equivalences for and for ( z ), they are equivalent
respectively to
y (NumberOf (, y)) Person()
and to
( y NumberOf (, y) ) Person() .
First-Order Logic
157/241
Domains
First-Order Logic
158/241
Predicates/Relations
A predicate, or relation, represents a property that an individual, or
collection of individuals, may (or may not) have. In English, we
might express a predicate as
is a student.
becomes S(Alex).
If is the property of being an instructor then Sam is an
than Sam.
First-Order Logic
159/241
Representing Relations
Mathematically, we represent a relation by the set of all things that
have the property.
E.g. if S is the set of all students, then S means is a student.
The only restriction on a relation is that it must be a subset of the
domain.
A k-ary relation is a set of k-tuples of domain elements. For
example, the binary relation less-than, over a domain D, is
represented by the set
, y D 2 | < y .
E.g., the On relation in the sample blocks world has just one pair:
{B3, B1}.
In a relational database, the listing of such a set is called a table.
First-Order Logic
160/241
Variables
Variables make statements more expressive.
You may think of a variable as a place holder or blank, that can be
replaced by a concrete object.
Alternatively, a variable is a name without a fixed referent (the
object the name refers to). The referent can vary from time to time.
A variable lets us refer to an object, without specifyingperhaps
without even knowingwhich particular object it is. Thus we can
express a relation in the abstract.
S():
is a student
():
is an instructor
Y(, y): is younger than y
First-Order Logic
161/241
Uses of Variables
In general, we use variables that range over the domain to make
general statements, such as
2 0 ,
and in expressing conditions which individuals may or may not
satisfy, such as
+ = .
This latter condition is satisfied by only two numbers: 0 and 2.
The meaning of such an expression will depend on the domain.
For example, the formula 2 < is always false over the domain of
integers, but not over the domain of rational numbers.
First-Order Logic
162/241
Quantifiers
What about Every student is younger than some professor y?
In math-speak, we say for all to express every and there exists to
express some.
A familiar(?) example from calculus:
For all > 0, there exists > 0 such that for all y,
if | y| < then | () (y)| < .
For all is denoted by , the universal quantifier symbol, and
there exists is denoted by , the existential quantifier symbol.
In First Order Logic (FOL), the above comes out as the formula
> 0 > 0 y(| y| < | () (y)| < ) .
First-Order Logic
163/241
Quantifiers: Examples
Quantifiers require a variable: (for all ) or z (there exists z).
For example, the statement Not all birds can fly can be written as
( (B() F())) .
First-Order Logic
164/241
165/241
Constant symbols
Variables
Function symbols
Predicate symbols
Connectives
Quantifiers
Punctuation
Usually c, d, c1 , c2 , . . . , d1 , d2 . . .
Usually , y, z, . . . 1 , 2 , . . . , y1 , y2 . . .
Usually , g, h, . . . 1 , 2 , . . . , g1 , g2 , . . .
P, Q, . . . P1 , P2 , . . . , Q1 , Q2 , . . .
, , ,
and
(, ), , and ,
166/241
Terms
In FOL, we need to consider two kinds of expressions:
those that can have a truth value, called formulas, and
those that refer to an object of the domain, called terms.
167/241
Examples of Terms
Example 1. If 0 is a constant symbol, and y are variables, and s(1)
and + (2) are function
symbols, then 0, , and y are terms, as are
s(0) and + , s(y) .
The expressions s(, y) is not a term since s is a unary function
symbol.
The expression s + is not a term since s is a unary function symbol.
Example 2. Suppose is a unary function symbol, g is a binary
function symbol, and is a constant symbol.
Then g( (), ) and g , () are terms.
The expressions g() and (), are not terms.
168/241
Atomic Formulas
As in propositional logic, a formula represents a proposition (a
true/false statement).
Relation symbols produce propositions.
Definition: An atomic formula (or atom) is an expression of the
form
P(t1 , . . . , tn )
where P is an n-ary relation symbol and each t is a term (1 n).
If P has arity 2, the atom P(t1 , t2 ) may alternatively be written
(t1 P t2 ).
E.g. < (t1 , t2 ) can be written as (t1 < t2 ).
169/241
General Formulas
We define the set of well-formed formulas of first-order logic
inductively as follows.
1. An atomic formula is a formula.
2. If is a formula, then () is a formula.
3. If and are formulas, and ? is a binary connective symbol,
then ( ? ) is a formula.
4. If is a formula and is a variable,
then each of ( ) and ( ) is a formula.
5. Nothing else is a formula.
In case 4, the formula is called the scope of the quantifier.
The quantifier keeps the same scope if it is included in a larger
formula.
170/241
Parse Trees
Parse trees for FOL formulas are similar to parse trees for
propositional formulas.
Quantifiers and y form nodes is the same way as negation
171/241
172/241
172/241
F(b) y z G(y, z) H(, , y)
.
172/241
Semantics: Interpretations
We shall cover more about syntax later, but we first start the
discussion of semantics.
Definition: Fix a set L of constant symbols, function symbols, and
relation symbols.
An interpretation I (for the set L) consists of
A non-empty set dom(I), called the domain (or universe) of I.
For each constant symbol c, a member cI of dom(I).
For each function symbol () , an -ary function I .
For each relation symbol R() , an -ary relation RI .
Huth and Ryan use the term model instead of interpretation, which
is not a standard usage.
E.g. if L = {, (2) , R(1) } then the domain could be the natural
numbers, could be the constant 0, could be addition, and R could
be the set of prime numbers.
Variable-free semantics
173/241
Variable-free semantics
174/241
I =
T if t1I , . . . , tnI RI
F otherwise.
Variable-free semantics
175/241
Examples
Let 0 be a constant symbol, (1) a function
symbol
and E(1) a
relation symbol. Thus E (0) and E (0) are both formulas.
Consider an interpretation I with
Domain:
0I :
I:
EI :
I
Terms get numerical values: (0)I is 1 and (0) is 2.
I
Formula E (0) means 1 is even, and E (0) = F.
I
Formula E (0) means 2 is even, and E (0)
= T.
176/241
Example, Continued
Let J be the interpretation with
Domain:
0J :
J :
EJ :
halving; , / 2 | Q
is an integer; | Z
J
E (0) means 1 is an integer, and E (0)
is T.
J
E (0) means 1/2 is an integer, and E (0)
is F.
Exercise: in both I and J , the formula E (0) E (0) receives
value F. Find another interpretation which gives it the value T.
Variable-free semantics
177/241
Gotchas
Two often-overlooked points about interpretations.
1. There is NO default meaning for relation, function or constant
symbols.
1 + 2 = 3 might mean that one plus two equals threebut only
if we specify that interpretation. Any interpretation of constants
1, 2, and 3, function symbol + (2) and relation symbol =(2) is
possible.
2. Functions must be defined at every point in the domain.
(I.e., they must be total.)
If we have language with a binary function symbol , we
cannot specify an interpretation with domain N and subtraction
for . Subtraction is not total on N.
Variable-free semantics
178/241
Variables
Syntax, Continued
179/241
Syntax, Continued
180/241
Syntax, Continued
181/241
Substitution
The notation [t/ ], for a variable , a term t, and a formula ,
denotes the formula obtained from by replacing each free
occurrence of with t. Intuitively, it is the formula that answers the
question,
What happens to if has the value specified by term t?
Examples.
If is the formula E () , then [y + y/ ] is E (y + y) .
[ ()/ ] is E () .
E ( + y) [y/ ] is E (y + y) .
Substitution
182/241
Examples: Substitution
Example 1: Let be P(, y) R(, y) .
Syntax, Continued
Substitution
183/241
Examples: Substitution
Example 2: Let be y (y > ).
Formula could be interpreted as There exists a y such that y is
greater than .
What about [y/ ]?
Is it y (y > y)?
There is a problem.
Syntax, Continued
Substitution
184/241
Avoiding Capture
Example. Formula = S() y P() Q(y) ; term t = (y, y).
Syntax, Continued
Substitution
185/241
SubstitutionFormal Definition
Let be a variable and t a term.
For a term , the term [t/ ] is with each occurrence of the
variable replaced by the term t.
For a formula ,
1. If is P(t1 , . . . , tk ), then [t/ ] is P t1 [t/ ], . . . , tk [t/ ] ,
i.e. apply the substitution to each term in the predicate.
Syntax, Continued
Substitution
186/241
Substitution
187/241
Example, Revisited
Example. If is y + y = z, what is [(y 1)/ z]?
This falls under case 5(b): the term to be substituted, namely y 1,
contains a variable y quantified in formula .
Let be + y = z; thus is y .
Syntax, Continued
Substitution
188/241
Example, Revisited
Example. If is y + y = z, what is [(y 1)/ z]?
This falls under case 5(b): the term to be substituted, namely y 1,
contains a variable y quantified in formula .
Let be + y = z; thus is y .
1. Select a new variable, say .
2. Then substitute it for the variable y bound in i.e.
[/ y]
is
+ = z,
is
+ = y 1.
Substitution
188/241
Semantics
189/241
Semantics
190/241
Environments
A first-order environment is a function that assigns a value in the
domain to each variable.
Example. With the domain N, we might have environment E1 given
by E1 () = 9 and E1 (y) = 2.
If the interpretation specifies < is less-than, then the formula
( < y), which is interpreted as (9 < 2), gets the value false.
Example. With the domain of fictional animals, we might have
E2 () = Tweety and E2 (y) = Nemo.
If the interpretation specifies < is was created before, then
( < y), which is interpreted as (Tweety was created before Nemo),
gets the value true.
Semantics
Environments
191/241
Semantics
Environments
192/241
Meaning of Terms
The combination of an interpretation and an environment supplies a
value for every term.
Definition: Fix an interpretation I and environment E. For each
term t, the value of t under I and E, denoted t (I ,E) , is as follows.
If t is a constant c, the value t (I ,E) is cI .
If t is a variable , the value t (I ,E) is E .
(I ,E)
If t is (t1 , . . . , tn ), the value t (I ,E) is I (t1
, . . . , tn(I ,E) ).
Semantics
Environments
193/241
Meaning of TermsExample
Example. Suppose a language has constant symbol 0, a unary
function s, and a binary function +. We shall write + in infix position:
( + y) instead of +(, y).
The expressions s s(0) + s() and s + s + s(0) are both
terms.
The following are examples of interpretations and environments.
dom{I} = {0, 1, 2, . . .}, 0I = 0, sI is the successor function (the
(I ,E)
Then, if E() = 3, the terms get values s s(0) + s()
=6
(I ,E)
and s + s + s(0)
= 9.
Semantics
Environments
194/241
Meaning of TermsExample 2
0J = ,
sJ appends to the end of a string, and
+ J is concatenation.
and
s s(0) + s()
(J ,E)
= b
(J ,E)
s + s + s(0)
= bb .
Semantics
Environments
195/241
Quantified Formulas
To evaluate the truthfulness of a formula , check whether
holds for every value d in the domain.
To evaluate the truthfulness of a formula , check whether
holds for some value d in the domain.
How can we express this precisely?
Definition: For any environment E and domain element d, the
environment E with re-assigned to d, denoted E[ 7 d],
is given by
(
d
if y is
E[ 7 d](y) =
E(y) if y is not .
Semantics
Environments
196/241
Semantics
Environments
197/241
Example. Let dom(I) = {, b} and RI = {, , , b, b, b }.
R(, )(I ,E) = T, since E(), E() = , RI .
R(y, )(I ,E) = F, since E(y), E() = b,
/ RI .
(I ,E)
y R(y, )
= T, since R(y, )(I ,E[y7]) = T.
(That is, E[y 7 ](y), E[y 7 ]() = , RI ).
What is y R(, y)
(I ,E)
Semantics
Environments
198/241
Examples: Continued
Example. Let dom(I) = {, b} and RI = {, , , b, b, b}.
Let E() = and E(y) = b.
What is y R(, y)
(I ,E)
Since b,
/ RI , we have
R(, y)(I ,E[7b][y7]) = F ,
and thus
y R(, y)
Semantics
(I ,E)
Environments
=F .
199/241
Examples: Continued
Example. Let dom(I) = {, b} and RI = {, , , b, b, b}.
Let E() = and E(y) = b.
What is y R(, y)
(I ,E)
Since b,
/ RI , we have
R(, y)(I ,E[7b][y7]) = F ,
and thus
y R(, y)
What about y R(, y)
(I ,E)
Semantics
(I ,E)
=F .
Environments
199/241
A Question of Syntax
Semantics
Environments
200/241
A Question of Syntax
Semantics
Environments
200/241
Satisfaction of Formulas
When an interpretation I and environment E satisfy a formula (i.e.
(I ,E) = T), we denoted it as I |=E ,
If they do not satisfy (i.e. (I ,E) = F), we denoted it as I 6|=E .
Form of
R(t1 , . . . , tk )
E
(I ,E)
, . . . , tk
RI
I 6|=E
both I |=E and I |=E
either I |=E or I |=E (or both)
either I 6|=E or I |=E (or both)
for every dom(I), I |=E[7]
there is some dom(I) such that I |=E[7]
D
(I ,E)
t1
Semantics
Satisfaction of Formulas
201/241
Example: Satisfaction
Semantics
Satisfaction of Formulas
202/241
Semantics
Satisfaction of Formulas
203/241
Example: Let be the formula P g(), g(y) , g(z) . The formula is
satisfiable:
dom(I): N
I : summation
gI : squaring
PI : equality
E() = 3, E(y) = 4 and E(z) = 5.
Semantics
Satisfaction of Formulas
204/241
R()
iff
R()
where R is a property.
Semantics
Satisfaction of Formulas
205/241
Relevance Lemma
Lemma:
Let be a first-order formula, I be an interpretation, and E1 and E2
be two environments such that
E1 () = E2 () for every that occurs free in .
Then
I |=E1 if and only if I |=E2 .
Proof by induction on the structure of .
Semantics
Satisfaction of Formulas
206/241
Logical Consequence
Semantics
Satisfaction of Formulas
207/241
Example
Example: Show that |= ( ) ( ) ( ) .
Satisfaction of Formulas
208/241
Example
Example. Show that |= .
Semantics
Satisfaction of Formulas
209/241
Example
Example. Show that |= .
Suppose that I |=E . By definition, this means
for every dom(I), I |=E[7] .
Again by definition (for a formula with ), this is equivalent to
for every dom(I), I 6|=E[7]
and also
there is no dom(I) such that I |=E[7] .
This last is the definition of I |=E , as required.
Semantics
Satisfaction of Formulas
209/241
Example
Example: Show that, in general,
( ) ( ) 6|= ( ) .
That is, find and such that consequence does not hold.
Semantics
Satisfaction of Formulas
210/241
Example
Example: Show that, in general,
( ) ( ) 6|= ( ) .
That is, find and such that consequence does not hold.
Key idea: yields true whenever is false. So have true in
some cases and so will be false.
Let be R(). Let I have domain {, b} and RI = {}, i.e. R is only
true for . Then I |= ( ) ( ) for any , because is false.
Semantics
Satisfaction of Formulas
210/241
Example
Example: Show that, in general,
( ) ( ) 6|= ( ) .
That is, find and such that consequence does not hold.
Key idea: yields true whenever is false. So have true in
some cases and so will be false.
Let be R(). Let I have domain {, b} and RI = {}, i.e. R is only
true for . Then I |= ( ) ( ) for any , because is false.
To obtain M 6|= ( ), we can use R() for so will be false
when is true.
Thus ( ) ( ) 6|= ( ), as required.
Semantics
Satisfaction of Formulas
210/241
Example
That is, if is true for all then it must certainly be true when is
the term t.
Semantics
Satisfaction of Formulas
211/241
Natural Deduction
212/241
Natural Deduction
213/241
e and i
Elimination of and introduction of are fairly straightforward.
Name
`-notation
inference notation
-elimination
(e)
If ` then
` [t/ ]
[t/ ]
-introduction
(i)
If ` [t/ ],
then `
[t/ ]
Natural Deduction
214/241
Example: e
Consider the proof of the following statements.
All fish can swim. Nemo is a fish. Therefore, Nemo can swim.
In FOL: show that (F() S()), F(Nemo) ` S(Nemo)..
Proof:
1.
(F() S())
Premise
2.
F(Nemo)
Premise
3.
F(Nemo) S(Nemo)
e: 1
4.
S(Nemo)
e: 2, 3
The e rule allows us to go from talking about all the elements in the
domain (line 1) to talking about a specific element, Nemo (line 4).
The proof doesnt care what F and S mean. Fishiness and swimming
ability really have nothing to do with the argument.
Natural Deduction
215/241
Example: i
Example. Show P(y) ` P() Q(y) .
1.
P(y)
Premise
2.
P(y)
Assumption
3.
e: 2, 1
4.
Q(y)
e: 3
5.
P(y) Q(y)
6.
i: 24
P() Q(y)
i: 5
Natural Deduction
216/241
[t/ ]
P() Q(y)
Natural Deduction
217/241
and
[t/ ] |= .
(I,E) ])
I.e. you can substitute first and then evaluate with I, E or evaluate
with the modified environment where 7 t (I ,E) .
To prove this, use the defn of substitution, Cases 4, 5(a) and 5(b).
Natural Deduction
218/241
(I,E) ])
(I ,E[7t
=T .
219/241
Defining Substitution
The definition of substitution included the following.
For a variable and a term t:
4. If is (Q ), then [t/ ] is .
5. If is (Qy ) for some other variable y, then
If y does not occur in t, then [t/ ] is (Qy [t/ ]).
Otherwise, let z be a variable that occurs in neither nor t;
(I,E) ])
= (Qy )[t/ ]
(I ,E)
(I ,E)
Natural Deduction
(I ,E)
!)
220/241
Proving a Universal
The -introduction rule follows ordinary mathematical usage. To
prove a property holds for all integers, one often starts with
Let be an integer. . . .
This means the same as
Assume that the variable refers to an integer.
Then one proves that has the property.
Since we know nothing about the value , except that it is an
integer, this justifies that every integer has the property.
One could also start the proof with
Let be anything. If is an integer, then. . . .
The conclusion is essentially the same.
Natural Deduction
-Introduction
221/241
Rule -Introduction
Definition: a variable is fresh in a subproof if it occurs nowhere
outside the subproof box (i.e. is not a free variable outside the
subproof).
Freshness captures the notion of know nothing about it.
Name
-introduction
(i)
`-notation
inference notation
If ` [y/ ] and
y not free in or ,
y fresh
..
.
[y/ ]
then `
In words: in order to prove (), prove (y) for an arbitrary y in
the domain.
Natural Deduction
-Introduction
222/241
Rule i Is Sound
To further clarify the rule i, we show that it is sound. That is,
Suppose that |= [y/ ] and y is not free in or .
Then |= .
Proof: Fix an arbitrary I and E with I |=E .
The supposition |= [y/ ] thus requires I |=E [y/ ].
We need to show that I |=E[7d] for every d dom(I).
Consider an arbitrary d dom(I).
Since y is not free in , the Relevance Lemma yields I |=E[y7d] ,
i.e. since y is not a free variable in any of and environments only
assign values to the free variables, this does not affect the truth of
any interpretation.
Since y is not free in , we have [y/ ] (I ,E[y7d]) = (I ,E[7d]) , i.e.
whether we set to d, or replace by y and set y to d, we get the
same result.
Therefore I |=E[7d] for every d, and thus I |=E as required.
Natural Deduction
-Introduction
223/241
Example: Use of i
Example. Show that ` , for any .
1.
2.
fresh
n.
Premise
[/ ]
??
i: 26
-Introduction
224/241
Example: Use of i
Example. Show that ` , for any .
1.
2.
fresh
3.
[/ ]
Assumption
4.
i: 3
5.
e: 1, 4
6.
[/ ]
i: 35
7.
i: 26
Premise
-Introduction
224/241
( )
Premise
( ) ( )
i??
-Introduction
225/241
( )
Premise
2.
Assumption
8.
i???
( ) ( )
i??
-Introduction
225/241
( )
Premise
2.
Assumption
3.
fresh
6.
[/ ]
7.
i???
8.
( ) ( )
i??
??
-Introduction
225/241
( )
Premise
2.
Assumption
3.
fresh
4.
[/ ] [/ ]
e: 1
5.
[/ ]
e: 2
6.
[/ ]
e: 4, 5
7.
i: 36
8.
( ) ( )
i: 27
-Introduction
225/241
`-notation
If , [/ ] ` ,
with fresh,
then , `
inference notation
[/ ], fresh
..
.
Natural Deduction
-Elimination
226/241
Rule e Is Sound
Natural Deduction
-Elimination
227/241
Example: Use of e
R()
Premise
2.
R(), fresh
Assumption
3.
y R(y)
i: 2 (term )
4.
y R(y)
e: 1, 23
Natural Deduction
-Elimination
228/241
Premise
2.
[/ ], fresh
Assumption
3.
[y/ ][/ y]
4.
y [y/ ]
i: 3 (term )
5.
y [y/ ]
e: 1, 24
Here [y/ ][/ y] (on line 3) means first substitute y for , then
substitute for y in forumula .
Is the formula on line 2 the same as the one on line 3?
Natural Deduction
-Elimination
229/241
Premise
2.
[/ ], fresh
Assumption
3.
[y/ ][/ y]
4.
y [y/ ]
i: 3 (term )
5.
y [y/ ]
e: 1, 24
Here [y/ ][/ y] (on line 3) means first substitute y for , then
substitute for y in forumula .
Is the formula on line 2 the same as the one on line 3?
If y is free in , then no the derivation fails.
But otherwise, it works.
Natural Deduction
-Elimination
229/241
Premise
e ??
Natural Deduction
-Elimination
230/241
Premise
2.
[/ ], fresh
Assumption
i ??
e ??
7.
Natural Deduction
-Elimination
230/241
Premise
2.
[/ ], fresh
Assumption
3.
Assumption
4.
[/ ]
e: 3
5.
e: 4, 2
6.
i: 35
7.
e: 1, 26
Natural Deduction
-Elimination
230/241
Premise
2.
Assumption
3.
[/ ] ( fresh)
Assumption
4.
[/ ]
e: 1
5.
e: 3, 4
6.
e: 2, 35
7.
i: 26
-Elimination
231/241
Premise
[t/ ]
??
i: ??
Natural Deduction
-Elimination
232/241
Premise
[t/ ]
??
i: ??
Natural Deduction
-Elimination
232/241
Premise
[t/ ]
??
i: ??
-Elimination
232/241
Premise
2.
Assumption
3.
fresh
4.
[/ ]
5.
i: 4
6.
e: 5, 2
7.
[/ ]
i: 46
8.
[/ ]
e: 7
9.
Assumption
i: 38
10.
e: 9, 1
11.
i: 210
12.
e: 11
Natural Deduction
-Elimination
233/241
Repeated Quantifiers
then ` 1 n .
-intro If ` [1 / 1 ] [n / n ], with variables 1 , . . . , n fresh,
then ` 1 n .
-elim If ` 1 n and {[1 / 1 ] [n / n ] ` , with
1 , . . . , n fresh, then ` .
Natural Deduction
-Elimination
234/241
y A(, y)
2.
, fresh
3.
A(, )
e (2): 1
4.
y A(, y)
i (2): 3
Natural Deduction
Premise
-Elimination
235/241
Left to you.
Natural Deduction
-Elimination
236/241
t=t
=i
t1 = t2 [t1 / ]
=e
[t2 / ]
237/241
y = y [/ z] [y/ z]
is an axiom.
These axioms imply
Symmetry of =: ` y = y y = .
Transitivity of =: ` y = y (y = = ) .
238/241
, fresh
= =
y = y y =
???
i (2): 1?
239/241
, fresh
2.
Assumption
??
= =
y = y y =
i: 2?
i (2): 1?
239/241
, fresh
2.
3.
y = y ( = y = )
4.
= ( = = )
e (2) [, ]: 3
5.
==
e: 2, 4
??
Assumption
= =
y = y y =
EQ2 [z = ]
i: 2?
i (2): 1?
239/241
, fresh
2.
3.
y = y ( = y = )
4.
= ( = = )
e (2) [, ]: 3
5.
==
e: 2, 4
6.
EQ1
7.
e []: 6
8.
e: 7,5
9.
= =
10.
Assumption
y = y y =
EQ2 [z = ]
i: 24
i (2): 110
239/241
, , fresh
2.
y ( = y) ( = y = )
3.
= ( = = )
4.
Assumption
5.
EqSymm
6.
==
e: 5, 3
7.
= ( = = )
i: 46
8.
y
= y (y = = )
i (3): 18
EQ2 [z = ]
e (2) [, ]: 2
240/241
EQtrans(k):
t1 = t2
t2 = t3
t1 = tk+1
tk = tk+1
EQsubs(r):
and t2 .
t1 = t2
r[t1 / z] = r[t2 / z]
Prove as an exercise.
241/241