Title: Logic
1Logic
2What is Logic?
3What is logic?
- Logic is the study of valid reasoning.
- That is, logic tries to establish criteria to
decide whether some piece of reasoning is valid
or invalid. - OK, so then what do we mean by valid reasoning?
4Reasoning
- When we reason, we infer something (Y) from
something else (X). - That is, when we reason, we go like Well, if
such-and-such-and-so (X) is the case, then
this-and-that-and-the-other-thing (Y) must also
be the case - X and Y are thus things-that-can-be-the-case-or-no
t-be-the-case
X ? Y
Reasoning Diagram
5Good vs Bad Reasoning
- What is the purpose of reasoning? Well, through
reasoning, we try to gain new knowledge. - Good reasoning is a piece of reasoning that
successfully fulfills this purpose, i.e. that
indeed gives us a new piece of knowledge. - Bad reasoning is a piece of reasoning that, for
some reason or other, is unsuccessful in this
purpose. - What can go wrong?
- Reasoning is invalid
- Reasoning is unsound
- Reasoning is circular
6Valid Reasoning
- While in every piece of reasoning something is
believed to follow from something else, this may
in fact not be so. - Example If I win the lottery, then Im happy.
However, I did not win the lottery. Therefore, I
am not happy. - A piece of reasoning in which Y is believed to
follow from X is valid if Y does indeed follow
from X. Otherwise, the reasoning is said to be
invalid.
7Sound Reasoning
- Not all valid reasoning is good reasoning.
- Example If I win the lottery, then Ill be
poor. So, since I did win the lottery, I am
poor. - This piece of reasoning is valid, but not very
good, since part of what it assumed is absurd
(If I win the lottery, Ill be poor. Huh??)
(also, I did not win the lottery ? ) - A piece of reasoning where Y is believed to
follow from X is sound if a) it is valid, and b)
X is true (or at least acceptable/plausible).
8Truth and Implication
- Logic studies the validity of reasoning.
- Logic does not study soundness.
- Therefore, logic alone cannot tell us whether an
argument is good. Hence, logic alone is not a
guide to truth. - Instead, logic can tell us, assuming certain
things to be true, what else will be true as
well. Thus, logic is a guide to implication.
9Arguments
- A piece of reasoning consists of a sequence of
statements, some of which are claimed to follow
from previous ones. That is, some are claimed to
be inferred from others. - Example Either the housemaid or the butler
killed Mr. X. However, if the housemaid would
have done it, the alarm would have gone off, and
the alarm did not go off. Therefore, the butler
did it.
10Arguments, Premises and Conclusion
- In logic, pieces of reasoning are analyzed using
the notion of an argument - An argument consists of any number of premises,
and one conclusion - Again, in logic, we are merely interested in
whether the conclusion follows from the premises
we are not interested in whether those premises
are true or acceptable. - If you want to study all aspects of good
reasoning, take my class Methods of Reasoning.
11Deductive Validity vs Inductive Validity
- An argument is said to be deductively valid if,
assuming the premises to be true, the conclusion
must be true as well. - An argument is said to be inductively valid if,
assuming the premises to be true, the conclusion
is likely to be true as well. - For now, we will limit ourselves to deductive
validity only! - If you want to study non-deductive reasoning,
take my Methods of Reasoning class.
12Argument Forms
- If I win the lottery, then I am poor. I win the
lottery. Hence, I am poor. - This argument has the following abstract
structure or form If P then Q. P. Hence, Q - Any argument of the above form is valid,
including If flubbers are gook, then trugs are
brig. Flubbers are gook. Hence, trugs are brig.! - Hence, we can look at the abstract form of an
argument, and tell whether it is valid without
even knowing what the argument is about!!
13Formal Logic
- Formal logic studies the validity of arguments by
looking at the abstract form of arguments. - Formal logic always works in 2 steps
- Step 1 Use certain symbols to express the
abstract form of premises and conclusion. - Step 2 Use a certain procedure to figure out
whether the conclusion follows from the premises
based on their symbolized form alone.
14Example Step 1 Symbolization
- Use symbols to represent simple propositions
- H The housemaid did it
- B The butler did it
- A The alarm went off
- Use further symbols to represent complex claims
- H ? B The housemaid or the butler did it
- H?A If the housemaid did it, the alarm would go
off - A The alarm did not go off
15Example Step 2 Evaluation
- One possible technique is to transform the
symbolic representations using basic rules that
reflect elementary valid inferences
H ? B
A.
1.
H?A
A.
2.
Since every step along the way is an instance of
an obviously valid inference, the conclusion
does indeed follow from the premises. So, valid
argument!
?A
A.
3.
?H
2, 3 MT
4.
B
5.
1, 4 DS
16Propositional Logic
- Propositional Logic studies validity at the level
of simple and compound propositions. - Simple proposition An expression that has a
truth value (a claim or a statement). E.g. John
is tall - Compound proposition An expression that combines
simple propositions using truth-functional
connectives like and, or, not, and if
then. E.g. John is tall and Mary is smart
17Predicate Logic
- Predicate Logic extends Propositional Logic by
adding individuals, predicates, and quantifiers - Individuals John, Mary
- Predicates tall, smart
- Quantifiers all, some
18Just to Put Things in Perspective
All arguments
All deductive arguments
All deductive arguments that can be analyzed
using the formal logics we cover in class
(And Im probably optimistic here!)
19Uses of Formal Logic
- Evaluation/Checking
- Formal logic can be used to evaluate the validity
of arguments. - Clarification/Specification
- Formal logic can be used to express things in a
precise and unambiguous way. - Demonstration/Proof
- Formal logic can be used to figure out what
follows from a set of assumptions. - Computation/Automated Reasoning
- Formal logic can be used for machine reasoning.
20Logic, Computers, and AI
- Formal logic has many connections to computers
- Computation Formal logic played a crucial role
in the development of the notion of computation
(See my class PHIL 4420 Computability and Logic) - Circuit Design Formal logic can be used for
circuit design (See CSCI 2500 Computer
Organization) - Artificial Intelligence Formal logic is central
to many AI applications (See CSCI 4150 Artificial
Intelligence)
21Boolean Connectives
22Propositional Logic
- Propositional Logic is the logic involving
complex claims as constructed from atomic claims
and connectives. - Propositional Logic is not as powerful as
Predicate Logic, but it has some powerful
applications already.
23Truth-Functional Connectives and Boolean
Connectives
- Connectives are usually called truth-functional
connectives - This is because the truth value of a complex
claim that has been constructed using a
truth-functional connective is considered to be a
function of the truth values of the claims that
are being connected by that connective. - This is also why propositional logic is also
called truth-functional logic. - For now, we will focus on three connectives and,
or, not these are called the Boolean
connectives.
24Negation
- The claim a is not to the right of b is a
complex claim. It consists of the atomic claim a
is to the right of b and the truth-functional
connective not. - We will call the above statement a negation.
- To express negations, we use the symbol ?
- ? should be put in front of what you want to be
negated. - If we symbolize the atomic claim a is to the
right of b as P, then the original claim will be
symbolized as ?P
25Truth-Table for Negation
- ? is truth-functional, since the truth-value of
a negation is the exact opposite of the
truth-value of the statement it negates. - We can express this using a truth table
P
?P
T
F
T
F
26Conjunction
- The claim a is to the right of b, and a is in
front of b is called a conjunction. - The two claims that are being conjuncted in a
conjunction are called its conjuncts. - To express conjunctions, we will use the symbol
? - ? should be put between the two claims.
- Thus, the above statement can be symbolized as P
? Q
27Truth-Table for Conjunction
- ? is truth-functional, since a conjunction is
true when both conjuncts are true, and it is
false otherwise. - Again, we can show this using a truth table
P
P ? Q
Q
T
T
T
F
F
T
T
F
F
F
F
F
28Disjunction
- The claim a is to the right of b, or a is in
front of b is called a disjunction. - The two claims that are being disjuncted in a
disjunction are called its disjuncts. - To express disjunctions, we will use the symbol
? - ? should be put between the two claims.
- Thus, the above statement can be symbolized as P
? Q
29Truth-Table for Disjunction
- ? is truth-functional, since a disjunction is
true when at least one of its disjuncts is true,
and it is false otherwise. - Again, we can show this using a truth table
P
P ? Q
Q
T
T
T
F
T
T
T
T
F
F
F
F
30Combining Complex Claims Parentheses
- Using the truth-functional connectives, we can
combine complex claims to make even more complex
claims. - We are going to use parentheses to indicate the
exact order in which claims are being combined. - Example (P ? Q) ? (R ? S) is a conjunction of
two disjunctions.
31Parentheses and Ambiguity
- An ambiguous statements is a statement whose
meaning is not clear due to its syntax. Example
P or Q and R - In formal systems, an expression like P ? Q ? R
is simply not allowed and considered
unsyntactical. - Claims in our formal language are therefore never
ambiguous. - One important application of the use of formal
languages is exactly this to avoid ambiguities!
32Exclusive Disjunction vs Inclusive Disjunction
- Notice that the disjunction as defined by ? is
considered to be true if both disjuncts are true.
This is called an inclusive disjunction. - However, when I say a natural number is either
even or odd, I mean to make a claim that would
be considered false if a number turned out to be
both even and odd. Thus, I am trying to express
an exclusive disjunction.
33How to express Exclusive Disjunctions
- We could define a separate symbol for exclusive
disjunctions, but we are not going to do that. - Fortunately, exclusive disjunctions can be
expressed using the symbols we already have
(P?Q) ? ?(P?Q)
P
(P ? Q) ? ?(P?Q)
Q
T
T
T
T
F
F
F
T
T
F
T
T
T
T
F
F
T
T
F
F
F
F
T
F
!
34Conditionals
35The Material Conditional
- Let us define the binary truth-functional
connective ? according to the truth-table
below. - The expression P ? Q is called a conditional. In
here, P is the antecedent, and Q the consequent.
P
P ? Q
Q
T
T
T
F
F
T
T
T
F
T
F
F
36If then Statements
- The conditional is used to capture if then
statements. - However, the match isnt perfect. For example, we
dont want to say that the claim If grass is
green then elephants are big is true just
because grass is green and elephants are big, nor
that any if then statement is automatically
true once the if part is false or the then
part true. The problem is that most English
ifthen expressions arent meant to make a
claim that is truth-functional in nature. - Still, any if then statement will be false
if the if part is true, but the then part
false, and the conditional captures at least this
important truth-functional aspect of any if
then statement. - So, while we will from now on refer to the
conditional as an if then statement, we must
be careful about the use of this, just as care
must be taken when applying Newtonian physics to
some situation.
37Necessary and Sufficient Conditions
- Conditionals can be used to express necessary and
sufficient conditions - Sufficient Condition Something (P) is a
sufficient condition for something else (Q) iff P
being the case guarantees Q being the case.
Hence, if we know that P is true, we know that Q
is true P ? Q - Necessary Condition Something (P) is a necessary
condition for something else (Q) iff P being the
case is required for Q being the case. Thus,
while P may be true without Q being true, we do
know that if Q is true, P is true Q ? P
38If vs Only if
- Sufficient conditions are expressed in English
using if, while necessary conditions are
expressed using only if. - Thus
- If P then Q P ? Q
- P if Q Q ? P
- P only if Q P ? Q
- Only if P, Q Q ? P
39If and only if and the Material Biconditional
- A statement of the form P if and only if Q (or
P iff Q) is short for P if Q, and P only if
Q. Hence, we could translate this as (P ? Q) ?
(Q ? P). However, since this is a common
expression, we define a new connective ?
P
P ? Q
Q
T
T
T
F
F
T
T
F
F
T
F
F
40Logical Properties
41Truth Tables
- Truth-tables can be used for
- defining the truth-conditions of truth-functional
connectives - evaluating the truth-conditions of any complex
statement
42Tautologies
- A tautology is a statement that is necessarily
true. - Example P ? ?P
P ? ?P
P
T
T
T
F
T
F
T
T
F
F
43Contradictions
- A contradiction is a statement that is
necessarily false. - Example P ? ?P
P ? ?P
P
T
F
T
F
T
F
F
T
F
F
44Contingencies
- A contingency is a statement that can be true as
well as false - Example P
P
P
T
T
F
F
45Equivalences
- Two statements are equivalent if they have the
exact same truth-conditions. - Example P and ??P
P
P
??P
T
T
F
T
T
F
T
F
F
F
46Contradictories
- Two statements are contradictories if one of them
is false whenever the other one is true and vice
versa. - Example P and ?P
P
P
?P
T
T
F
T
F
T
F
F
47Implication
- One statement implies a second statement if it is
impossible for the second statement to be false
whenever the first statement is true. - Example P implies P ? Q
P
P ? Q
Q
P
T
T
T
T
F
T
T
T
T
F
F
T
F
F
F
F
48Consistency
- A set of statements is consistent if it is
possible for all of them to be true at the same
time. - Example P, P ? Q, ?Q
P
P ? Q
Q
P
?Q
T
T
T
T
F
F
T
T
T
T
T
F
F
T
F
F
F
F
F
T
49Consequence
- A statement is a consequence of a set of
statements if it is impossible for the statement
to be false while each statement in the set of
statements is true. - Example P is a consequence of P?Q, ?Q
P
P ? Q
Q
P
?Q
T
T
T
T
F
F
T
T
T
T
T
F
F
T
F
F
F
F
F
T
50Validity
- An argument is valid if it is impossible for the
conclusion to be false whenever all of its
premises are true. - Example P ? Q, ?Q ? P
P
P ? Q
Q
P
?Q
T
T
T
T
F
F
T
T
T
T
T
F
F
T
F
F
F
F
F
T
51Implication, Consequence, Validity
- The notions of implication, consequence, and
validity are very closely related - A statement ? implies a statement ? if and only
if ? is a consequence of the set of statements
? - For implication and consequence we use the symbol
? - If statement ? implies statement ? we write ? ? ?
- If statement ? is a consequence of a set of
statements ?1, , ?n, we write ?1, , ?n ? ? - An argument consisting of premises ?1, , ?n and
conclusion ? is valid iff ?1, , ?n ? ? - The terms implication, consequence and validity
can therefore be used interchangeably.
52Summary
- Logical properties of a single statement
- Tautology cannot be false
- Contradiction cannot be true
- Contingent can be true and can be false
- Logical properties of 2 statements
- Equivalent always the same truth-value
- Contradictory always opposite truth-values
- Contrary cannot be both true
- Subcontrary cannot be both false
- Implication implied statement cannot be false
while the implying statement is true - Logical properties of a set of statements
- Consistent can be all true at the same time
- Logical properties of a set of statements in
relation to a single statement - Consequence statement cannot be false if all of
the statements of the set are true - Logical properties of an argument
- Valid conclusion cannot be false if all premises
are true
53But Wait!
- Consider the statement aa
- This statement is a tautology, since it is always
true. - However, since this statement does not involve
any truth-functions, propositional logic
considers this an atomic statement, and
symbolizes it as P. But P is a contingency. - What is going on??
54Truth-Functional Tautologies
- What is going on is that truth-tables only
capture the truth-functional aspects of
sentences. - So, a statement may be a tautology for reasons
other than truth-functional reasons. aa is an
example. - A statement that is a tautology because of
truth-functional considerations is called a
truth-functional tautology. - Notice that while every truth-functional
tautology is a tautology, not every tautology is
a truth-functional tautology (again, aa is a
tautology, but not a truth-functional tautology)
55Normal Forms and Expressive Completeness
56Logically Equivalent Statements
- To express that two statements P and Q are
logically equivalent, we will write P?Q - ? is not a symbol of F!!
57Some Important Equivalences
- Double Negation
- P ? ? ? P
- DeMorgan
- ?(P ? Q) ? ?P ? ?Q
- ?(P ? Q) ? ?P ? ?Q
- Distribution
- P ? (Q ? R) ? (P ? Q) ? (P ? R)
- P ? (Q ? R) ? (P ? Q) ? (P ? R)
- (Q ? R) ? P ? (Q ? P) ? (R ? P)
- (Q ? R) ? P ? (Q ? P) ? (R ? P)
58More Equivalences
- Commutation
- P ? Q ? Q ? P
- P ? Q ? Q ? P
- Association
- P ? (Q ? R) ? (P ? Q) ? R
- P ? (Q ? R) ? (P ? Q) ? R
- Idempotence
- P ? P ? P
- P ? P ? P
- Subsumption
- P ? (P ? Q) ? P
- P ? (P ? Q) ? P
59Even More Equivalences
- Implication
- P ? Q ? ?P ? Q
- ?(P ? Q) ? P ? ?Q
- Transposition
- P ? Q ? ?Q ? ?P
- Exportation
- P ? (Q ? R) ? (P ? Q) ? R
- Absorption
- P ? Q ? P ? (P ? Q)
- Equivalence
- P ? Q ? (P ? Q) ? (Q ? P)
- P ? Q ? (P ? Q) ? (?P ? ?Q)
60Simplifying Statements I
- Using the principle of substitution of logical
equivalents, and using the logical equivalences
that we saw before (Double Negation, Association,
Commutation, Idempotence, DeMorgan, Distribution,
and Subsumption), we can often simplify
statements. - Example
(A ? B) ? A ? (Commutation) (B ? A) ? A ?
(Association) B ? (A ? A) ? (Idempotence) B ? A
61Generalized Conjunctions and Generalized
Disjunctions
- Recall the Association equivalences
- P ? (Q ? R) ? (P ? Q) ? R
- P ? (Q ? R) ? (P ? Q) ? R
- Because of this, well allow to drop brackets
- P ? Q ? R
- P ? Q ? R
- Thus we can generalize conjunctions and
disjunctions - A generalized conjunction (disjunction) can have
any number of conjuncts (disjuncts)
62Simplifying Statements II
- The conjuncts (disjuncts) of a generalized
conjunction (disjunction) can be switched around
in any way you want. This really helps with
simplifying statements. Example
C ? (A ? (B ? C)) ? (Distribution) C ? (A ? B) ?
(A ? C) ? (Subsumption) C ? (A ? B)
63? and ?
- A generalized conjunction is false if it has at
least one false conjunct, otherwise it is true. - So, a generalized conjunction with 0 conjuncts
cannot have a false conjunct, and hence cannot be
false. Therefore, it is a tautology! We will
write this as ?. - A generalized disjunction is true if it has at
least one true disjunct, otherwise it is false. - Hence, a generalized disjunction with 0 disjuncts
can never be true, and is therefore a
contradiction! We will write this as ?.
64Some equivalences involving ? and ?
- ?? ? ?
- ?? ? ?
- P ? ? ? ?
- P ? ? ? ?
- P ? ? ? P
- P ? ? ? P
- P ? ?P ? ?
- P ? ?P ? ?
65Simplifying Statements III
- Using ? and ?, we can simplify statements
even more. Example
?(?A ? ?(?B ? (?A ? B)) ? (DeMorgan) ??A ? ??(?B
? (?A ? B)) ? (Double Neg.) A ? ?B ? (?A ? B) ?
(Distribution) (A ? ?B ? ?A) ? (A ? ?B ? B) ? ? ?
? ? ?
66Negation Normal Form
- Literals Atomic Sentences or negations thereof.
- Negation Normal Form An expression built up with
?, ?, and literals. - Using repeated DeMorgan and Double Negation, we
can transform any truth-functional expression
built up with ?, ?, and ? into an
expression that is in Negation Normal Form. - Example
?((A ? B) ? ?C) ? (DeMorgan) ?(A ? B) ? ??C ?
(Double Neg, DeM) (?A ? ?B) ? C
67Disjunctive Normal Form
- Disjunctive Normal Form A disjunction of
conjunctions of literals. - Using repeated distribution of ? over ?, any
statement in Negation Normal Form can be written
in Disjunctive Normal Form. - Example
(A?B) ? (C?D) ? (Distribution) (A?B)?C ?
(A?B)?D ? (Distribution (2x)) (A?C) ? (B?C) ?
(A?D) ? (B?D)
68Conjunctive Normal Form
- Conjunctive Normal Form A conjunction of
disjunctions of literals. - Using repeated distribution of ? over ?, any
statement in Negation Normal Form can be written
in Conjunctive Normal Form. - Example
(A?B) ? (C?D) ? (Distribution) (A?B) ? C ?
(A?B) ? D ? (Distribution (2x)) (A?C) ?
(B?C) ? (A?D) ? (B?D)
69Truth-Functional Connectives
- So far, we have seen one unary truth-functional
connective (?), and two binary truth-functional
connectives (?, ?). - Later, we will see two more binary connectives
(?, ?) - However, there are many more truth-functional
connectives possible - First of all, a connective can take any number of
arguments 3 (ternary), 4, 5, etc. - Second, there are unary and binary connectives
other than the ones listed above.
70Unary Connectives
- What other unary connectives are there besides
?? - Thinking about this in terms of truth tables, we
see that there are 4 different unary connectives
P
P
P
P
P
P
P
P
T
T
T
T
T
F
T
F
F
T
F
F
F
T
F
F
71Binary Connectives
- The truth table below shows that there are 24
16 binary connectives
P
Q
PQ
In general n sentences ?
T
T
T/F
T
F
T/F
2n truth value combinations (i.e. 2n rows in
truth table) ?
T
F
T/F
F
F
T/F
2n
2
different n-ary connectives!
72Expressing other connectives using and, or,
and not
- We saw that we can express the exclusive
disjunction using and, or, and not. - Q Can we express all other connectives as well?
- A Yes! We can generalize from this example
P
Q
PQ
Step 1
Step 2
T
T
F
? P??Q
T
F
T
? (P??Q) ? (?P?Q)
T
F
T
? ?P?Q
F
F
F
73Truth-Functional Expressive Completeness
- Since I can express any truth function using ?,
?, and ?, we say that the set of operators
?, ?, ? is (truth-functionally) expressively
complete. - DeMorgan Laws
- ?(P ? Q) ? ?P ? ?Q
- ?(P ? Q) ? ?P ? ?Q
- Hence, by the principle of substitution of
logical equivalents, since ?, ?, ? is
expressively complete, the sets ?, ? and ?, ?
are expressively complete as well!
74Applications Computer Hardware and Software
- The results that we have seen on the previous
slides have important applications in both
computer hardware and software - Digital Circuits
- Machine Reasoning
75Logic and Computer Circuitry
761s and 0s
- All what modern digital computers do is transform
strings of 1s and 0s, called bitstrings. - Information is represented using 1s and 0s, and
information is processed through the manipulation
of those bitstrings. - The 1s and 0s can be physically realized using
any kind of physical dichotomy. We can therefore
use pure mechanics (levers, pulleys, punchcards,
etc.), electronics, optics, DNA, quantum physics,
toilet paper and pennies, or just about anything
else to physically implement the 1s and 0s.
77Logic Gates
- To process information, bitstrings need to be
manipulated. - Thus, depending on whatever way the 1s and 0s
are physically implemented, there needs to be a
device to change those physical representations. - But, we are not going to be interested in the
physical nature of these devices, since this is
just an issue of implementation. - Rather, we are going to think of these devices as
logic gates thingamabobs that transform
bitstrings into other bitstrings.
78And, Or, and Not Gates
Out
In1
In2
1
1
1
In1
Out
0
0
1
In2
1
0
0
0
0
0
Out
In1
In2
In1
1
1
1
Out
0
1
1
In2
1
1
0
0
0
0
In
Out
In
Out
1
0
1
0
79Representing Numbers
- We normally represent numbers using the decimal
system. That is, we take 10 as our base number to
represent numbers. - Example
53627
7100 71 7
2101 210 20
6102 6100 600
3103 31000 3000
5104 510000 50000
53627
80Binary Numbers
- Binary numbers take 2 as their base.
- Example
10110
020 01 0
121 12 2
122 14 4
023 08 0
124 116 16
22
81Adding Binary Numbers
1
1
1
1
1
11010110
10110011
110001001
82Computing Binary Addition
- To compute the addition of two binary numbers, we
need to implement the following architecture
In10
Out0
In20
Carry1
In11
Out1
In21
Carry2
In12
Out2
In22
?
832 Bit and Carry Adder
Carryn
In1n
In2n
Carryn
Outn
Carryn1
In1n
Outn
1
1
1
1
1
1
1
1
0
0
1
1
0
1
0
Carryn1
In2n
0
1
0
0
1
1
0
1
1
0
0
0
1
0
1
0
0
0
1
1
0
0
0
0
0
84Circuitry for the 2 Bit and Carry Adder (output
bit)
In1n
In2n
Outn
Carryn
85Circuitry for the 2 Bit and Carry Adder (carry
bit)
In1n
In2n
Carryn1
Carryn
86Simplifying
- While the Disjunctive Normal Form provides us
with a working circuitry (and thus guarantees us
of one!), this circuitry may not be the most
efficient one. - Carryn1 (In1n ? In2n) ? (In1n ? Carryn) ?
(In2n ? Carryn) - Outn (In1n XOR In2n) XOR Carryn
- where P XOR Q (P ? ?Q) ? (?P ? Q)
87An Interesting Trade-Off
- To keep production costs down
- Use as few gates as possible
- Use as few different kinds of gates as possible
- However, there is a trade-off between these two
objectives The fewer the number of kinds of
gates one uses, the more gates of those kinds are
needed.
88Example of the Trade-Off
- The Disjunctive Normal Form tells us that we can
build any circuit using only 3 kinds of gates. - With more types of gates (e.g. the XOR), we could
have saved on the total number of gates. - On the other hand, because of the DeMorgans Law,
we know that we can express any expression using
only and and not. Thus, we can also try and
cut down on the number of types of gates, but
this will mean an increase in the number of
gates.
89The NAND
- Let us define the binary truth-functional
connective NAND according to the truth-table
below. - Obviously, P NAND Q ? ?(P ? Q) (hence the name!)
P
P NAND Q
Q
T
F
T
F
T
T
T
T
F
T
F
F
90Expressive Completeness of the NAND
- The NAND has a very interesting property, in that
it can express any truth-functional connective,
i.e. NAND is expressively complete! - Proof We already know that we can express every
truth-functional connective using only ? and ?.
Furthermore - P NAND P ? ?(P ? P) ? ?P
- (P NAND P) NAND (Q NAND Q) ? ?((P NAND P) ? (Q
NAND Q)) ? ?(?P ? ?Q) ? P ? Q - In other words, we can build circuitry using only
one kind of logic gate!! Of course, the drawback
is that we need many of those gates.
91The Miniac
- Behold! The worlds most powerful computer that
fits in the palm of your hand a penny!! - Instructions Ask any question with a yes or no
answer. Flip the coin. Tails means yes and
heads means no. To see whether the Miniacs
answer is correct or incorrect, flip the coin a
second time, asking Is your answer to this
question just as correct as your answer to the
previous question? - Question How does this work?
92Formal Proofs
93Demonstrating Invalidity
- To demonstrate invalidity one has to show that it
is possible for all premises to be true and the
conclusion to be false all at the same time. - One way to do this is to come up with a possible
scenario (or possible world) in which all
premises are true and the conclusion false
(Tarskis World). This is called a counterexample.
94Demonstrating Validity
- To demonstrate validity, we have to show that
there is no possible way for all premises to be
true and the conclusion false all at the same
time. - Showing a scenario in which all premises are
true, and in which the conclusion is true as
well, does not demonstrate validity, b/c there
may still be a different scenario in which all
premises are true and the conclusion false. - Of course, we could try and generate all possible
worlds, but this method is either impractical
(b/c there are too many possible worlds), or
simply impossible (b/c there are infinitely many
possible worlds).
95Proofs
- OK, so what do we do? Well, we can do what we do
in everyday reasoning we start with the
premises, and we gradually work our way to the
conclusion Either the housemaid or the butler
killed Mr. X. Now, we know that if the housemaid
would have done it, the alarm would have gone
off. But, the alarm did not go off. Therefore,
the housemaid did not do it. So, since it was
either the housemaid or the butler, it must have
been the butler.
96Intermediate Results
- The previous argument had 3 premises
- 1. Either the housemaid or the butler did it.
- 2. If the housemaid did it, the alarm would have
gone off. - 3. The alarm did not go off.
- The conclusion was The butler did it.
- We combined premises 2 and 3 to get an
intermediate result The housemaid did not do it. - We then combined the intermediate result with
premise 1 to get the conclusion. - We use intermediate conclusions because without
them, the inference from the premises to the
conclusion may not be obvious, but with them,
each of the steps does become obvious.
97Obvious
- In formal proofs, we try and formalize this
step-by-step inference process, where each
inference is obvious. - OK, but obvious is a bit of a vague term, as
what is obvious to some, may not be obvious to
others. So, what are going to count as obvious? - We are going to play it safe In formal proofs,
we are only going to allow steps that are about
as obvious as we can get. Thus, we are only going
to allow baby inferences. - So, in formal proofs, bigger inferences, which
may still be obvious to many (if not all of us),
will still have to be broken up into smaller ones!
98Inference Rules
- Formal systems of logic come with a finite set of
inference rules that reflect baby inferences. - There are many formal systems of logic, each with
their own set of inference rules - The nature of the inference rules depends on the
symbols that the system uses to express
statements. - However, even if two systems use the same
symbols, they may still have different inference
rules.
99F A Fitch-style Deductive System
- The formal system that our book uses is called F.
- F has 2 inference rules for each connective
- Introduction A rule to infer a statement with
that connective as its main connective - Elimination A rule to infer something from a
statement with that connective as its main
connective. - Formal systems with these two types of inference
rules are called Fitch-style systems. - Warning While Fitch-style systems are
mathematically elegant, they are not always very
user-friendly. In particular, it does not contain
inference rules that reflect some obviously
valid inferences!
100The Structure of Proofs in F
- A formal proof in F will look like this
P1
1
?
Pn
n
I1
Justification 1
n1
?
Im
n m
Justification m
C
n m 1
Justification m1
101Justification
- In a formal proof, you have to indicate from
which premises or intermediate results you infer
the new statement. Thus, each step needs to have
its own justification. - Inference rules may need any number of statements
from which the new statement is inferred (though
with too many statements, the rule may no longer
be considered obvious). - Most inference rules require one or two
statements. - Some inference rules require no statements at
all. This is when the inferred statement is
unconditionally true. - To help refer to previous statements, we are
going to number the statements.
102? Elim
- Conjunction Elimination (? Elim) allows one to
infer any conjunct from a conjunction.
P1 ? P2 ? ? Pn
?
Pi
103? Intro
- Conjunction Introduction (? Intro) allows one to
conjunct any number of previously established
statements in any order.
P1
?
Pn
P1 ? P2 ? ? Pn
104? Intro
- Disjunction Introduction (? Intro) allows one to
construct any disjunction using a previous result
as one of its disjuncts.
Pi
?
P1 ? ? Pi ? ? Pn
105? Elim
- Negation Elimination (? Elim) allows one to infer
P from ? ?P
??P
?
P
106Do we Have Free Will?
- Either determinism is true or not. Now, if
determinism is true, then my actions cannot be
otherwise from what they are, i.e. I dont any
freedom to exert my will. On the other hand, if
indeterminism is true, then my actions are partly
determined by pure randomness, so there is no
such thing as a will that is in total control of
my actions. Either way, I dont have free will.
107Proof by Cases
- The proof we just saw follows a certain pattern
Either P is the case or Q is the case. However,
if P is the case, then S is the case, and if Q is
the case, then S is the case as well. Either way,
S is therefore the case. Hence, S is the case. - This pattern of reasoning is called Proof by
Cases - Obviously, the above pattern can be generalized
to disjunctions with any number of disjuncts. - However, a very common form is to start with
Either P is the case or P is not the case.
108Is Space Continuous?
- Suppose space is continuous.
- Then between any two (different) points A and B
there exist infinitely many other points. - Thus, in order to move from any point A to any
other point B, you have to completely go through
a sequence of infinitely many points. But, you
can never reach the end of an infinite sequence.
Hence, motion is impossible. - But, things do move.
- Contradiction!
- So, space is not continuous. (thanks to Zeno!)
109Proof by Contradiction
- The proof we just saw relied on the following
pattern Assuming P to be the case, then I get
some kind of impossibility or contradiction.
Hence, contrary to my assumption, P cannot be the
case. - This pattern of reasoning is called Proof by
Contradiction (or Indirect Proof or Reductio ad
Absurdum or simply Reductio).
110Proof by Cases and Proofs by Contradiction
- Proof by cases and proof by contradiction are two
important proof techniques that we would like to
formalize. - But, these proof techniques do not work by
inferring some statement from some other
statement(s). - Rather, they work by pointing to the fact that I
am able to infer something from something else.
111Subproofs
- At any time during a proof, a subproof may be
started by making an additional assumption which
can then be used to draw further inferences. - The subproof may be ended at any time. When it is
ended, the individual statements from the
subproof can no longer be used to infer others. - Subproofs demonstrate that certain statements can
be inferred when an additional assumption is
made, and this result can be used in the proof
itself. That is, the subproof as a whole can be
used to infer other statements.
112Formalizing Proof by Cases using Subproofs and ?
- Using subproofs, we can now formalize the Proof
by Cases technique - You have a disjunction P1 ? ? Pi ? ? Pn
- These are the possible cases
- You start a subproof for each of the possible
disjuncts - This is going through each of the cases (what if
P1 is the case? what if P2 is the case?, etc.) - You infer the same statement (Q) in all subproofs
- This show that in all cases, the same thing (Q)
can be inferred - You now point to the initial disjunction and all
the relevant subproofs to conclude Q
113? Elim
- Disjunction Elimination (? Elim) is the formal
counterpart of Proof by Cases
P1 ? ? Pi ? ? Pn
P1
?
S
?
Pn
?
S
S
114Subproofs and Scope
- An additional line is used to indicate the start
and end of the subproof. - The line can also be seen as the scope of the
additional assumption made at the start of the
subproof every statement within that scope is
inferred from the truth of that assumption and
all previous assumptions. - The line of the proof itself can be seen in
exactly this way as well. Therefore, there is no
real difference between subproofs and proofs.
115Subproofs within Subproofs
- Within any subproof, another subproof can be
started. - Subproofs within subproofs must be ended before
the original subproof is ended. - The general rule is one can use as justification
all and only statements that is either one of the
assumptions whose scope one is working in, or
some statement inferred from those.
116Formalizing Proof by Contradiction using
subproofs and ?
- We can now formalize the Proof by Contradiction
- Start a subproof, and assume P
- All proofs by contradiction start by assuming
something, and this is the opposite of what you
want to prove! - In the subproof, derive ?
- This shows that assuming P leads to a
contradiction - Point to the subproof, and conclude ?P
117? Intro
- Negation Introduction (? Intro) is the formal
counterpart of Proof by Contradiction
P
?
?
?P
118? Intro
- ? Introduction (? Intro) allows one to infer ?
from a pair of statements P and ?P
P
?
?P
?
?
119More on contradictions
- Theorem For any statement P ? ? P
- Proof It is impossible for ? to be true, so it
is impossible for ? to be true and P to be false,
and hence for any P ? ? P - In other words Anything is a logical consequence
from a logical contradiction!
120? Elim
- ? Elimination (? Elim) allows one to infer any
statement P from ?
?
?
P
121? Elim
- Conditional Elimination (? Elim) allows one to
infer the consequent of a conditional, given the
truth of its antecedent
P ? Q
This pattern is better known as Modus Ponens
?
P
?
Q
122Conditional Proof
- We have seen two uses of subproofs for Proofs by
Contradiction, and for Proofs by Cases. - A third use for subproofs is to do a Conditional
Proof. - A Conditional Proof infers some kind of
conditional P ? Q from a given set of statements
by making P an extra assumption, and trying to
infer Q from the given statements and the
additional assumption P.
123? Intro
- Conditional Introduction (? Intro) is the formal
counterpart of Conditional Proof
P
?
Q
P ? Q
124Modus Tollens
Pattern
Proof
? ? ?
? ? ?
1.
??
??
2.
?
3.
??
?
1,3 ? Elim
4.
?
5.
2,4 ? Intro
6.
??
3-5 ? Intro
125Disjunctive Syllogism
Pattern
Proof
? ? ?
? ? ?
1.
??
??
2.
?
3.
?
?
2,3 ? Intro
4.
?
5.
4 ? Elim
?
6.
1,3-5,6-6 ? Elim
?
7.
126Fitch
- Fitch is the program that allows the user to
construct formal proofs in F. - Fitch has a number of additional features
- Checks whether a rule is applied correctly
- Allows shortcuts that are not allowed in F
- Provides CON rules
127Metalogic
128Logic and Metalogic
- Metalogic is the study of logic. That is, where
logic has no specific subject matter (logic can
be applied in any field where reasoning takes
place), the subject matter of metalogic is logic
itself. - Metalogic makes claims about logical properties
and relationships. For example A statement is a
tautology if and only if its negation is a
contradiction is a metalogical claim. - Of course, the paradox of metalogic is that it
needs logic to support the claims it makes about
logic! Hmmm
129A Central Metalogical ResultConsequence as a
Central Notion
- Many interesting logical properties can be
expressed in terms of logical consequence. For
example - Tautology A statement ? is a tautology iff ?
? - Contradiction A statement ? is a contradiction
iff ? ? ? - Equivalence Two statements ? and ? are
equivalent iff ? ? ? and ? ? ? - Inconsistency A set of statements ?1, , ?n is
logically inconsistent iff ?1, , ?n ? ?
130Consequence and Formal Proof
- Since formal proofs can be used to demonstrate
consequence, and since consequence can be used to
demonstrate other logical properties, formal
proofs can be used to demonstrate these other
logical properties - Tautology
- To prove that something is a tautology, derive
that statement from an empty set of premises. - Contradiction
- To prove that a statement is a contradiction,
derive ? from that statement as a premise. - Equivalence
- To prove that two statements P and Q are
equivalent, do two proofs - First, assume P as a premise, and derive Q.
- Second, assume Q as a premise, and derive P.
- Inconsistency
- To prove that a set of statements is
inconsistent, assume all those statements as
premises, and derive ?.
131Talking about Proofs
- How do we know if a formal proof does what it is
supposed to do? That is, if I can derive a
sentence ? from a set of sentences ?1, , ?n,
does that really mean that ? is a
truth-functional consequence of ?1, , ?n? - Notice that this is a metalogical questions it
asks something about formal proofs in relation to
a logical property. But of course, we want to
settle this question through the use of a
rigorous proof, i.e. we want to prove something
about formal proofs!?!
132Modus Bogus
- In order to demonstrate that the question on the
previous slide is an interesting and meaningful
question, consider the following rule
P ? Q
?
Obviously, a formal proof system that
would contain this rule would be able to
prove things that just dont follow!
?P
?
?Q
133?TF
- Recall ? is a truth-functional consequence of
?1, , ?n iff according to truth-functional
properties it is impossible for ? to be false if
each ?i is true. - Let us use the symbol ?TF to indicate
truth-functional consequence ? ?TF ? iff ? is a
truth-functional consequence of ?. - Remember If ? ?TF ? then ? ? ?, but not vice
versa. E.g. LeftOf(a,b) ? RightOf(b,a), but not
LeftOf(a,b) ?TF RightOf(b,a).
134Truth-functional Provability
- Let us define truth-functional provability with
regard to some formal deductive logic system S
(e.g F) as follows Q is truth-functionally
provable from a set of premises P1, , Pn in
the system S iff there exists a formal proof in S
going from P1, , Pn as premises and Q as the
conclusion using the rules for ?, ?, ?,
?, ?, and ? (or any other truth-functional
connective defined by S).
135?TF(S)
- Let us use the symbol ?TF(S) to indicate
truth-functional provability in S ? ?TF(S) ? iff
? is truth-functionally provable from ? in the
system S. - The subscript TF(S) indicates that we restrict
our proofs to the truth-functional rules of S.
136Two Very Important Properties
- For every deductive system of formal logic S we
can define the following 2 properties - 1. Truth-Functional Deductive Soundness A system
S is truth-functionally deductively sound iff for
any ? and ? - if ? ?TF(S) ? then ? ?TF ?
- 2. Truth-Functional Deductive Completeness A
system S is truth-functionally deductively
complete iff for any ? and ? - if ? ?TF ? then ? ?TF(S) ?
137F is Sound
- Q Is F truth-functionally deductively sound?
- A Yes!
- If you want the full proof, take Intermediate
Logic.
138A Trivially Sound System
- Let S? be a logic system that has no inference
rules. Then, trivially, all inference rules of S?
are sound. Hence S? is deductively sound as well. - In other words, it is trivial to make a
deductively sound logic system just dont define
any inference rules!
139Deductive Completeness
- Q Why is truth-functional deductive completeness
important? - A If a logic system S is not complete, then for
certain ? and ?, ? ?TF ? but not ? ? TF(S) ?. So,
although ? is a truth-functional consequence of
?, the rules do not allow one to prove ? from ?! - Q How is that possible?
- A Easy. While P ?TF ??P, the system S? will not
be able to prove this. Hence, S? is not a
truth-functionally deductively complete system!
140Proving Deductive Completeness
- Proving completeness for some logic system S can
be very difficult. This is not hard to
understand one needs to prove that for every ?
and ? such that ? ? ?, there exists a proof in S
going from ? to ?. But, there are an infinite
number of pairs ? and ? such that ? ? ?, and the
proofs dont seem to follow any kind of
systematic pattern. - Note If we already know a certain system S to
be complete, we can try to prove S to be complete
by demonstrating how S can prove anything that S
is able to prove.
141F is Complete
- Q Is F truth-functionally deductively complete?
- A Yes, but the proof for this is rather
complicated and outside the scope of this class.
Again, if youre interested, take Intermediate
Logic.
142An Algorithm for Producing Formal Proofs
- Restricting ourselves to ?, ?, ?, and ? only
- Start a proof by contradiction (assume negation
of conclusion). Let ? be the set of statements
you have. Then go through the following loop to
obtain ? (keep adding results to ?) - If ?? ? stop
- If ? ? ? and ?? ? ? get ? by ? Intro
- If ??? ? ? get ? by ? Elim
- If ?(?1 ? ? ?n ) ? ? get ??1 ? ? ??n by
DeMorgan pattern - If ?(?1 ? ? ?n ) ? ? get ??1 ? ? ??n by
DeMorgan pattern - If ?1 ? ? ?n ? ? get ?1, , ?n by ? Elim
- If ?1 ? ? ?n ? ? set up subproof for each ?1
and derive ? from ? ??1 / ?1 ? ? ?n with
this same method. Then get ? with ? Elim
143Hokus Ponens
- The logic system B (Bram) contains only one
inference rule, called Hokus Ponens
?
Woohoo! One line proofs! This system is going
to make me famous! (Only one small problem )
P
144Automated Theorem Proving
145Systematic Procedures
- A systematic procedure is a procedure that
follows a certain step-by-step algorithm to
perform a certain task. - Examples are cookbook recipes and computer
programs. - A systematic procedure will either stop after a
finite amount of time, or never stop (e.g.
because it goes into an infinite loop). - The truth-table method is a systematic procedure.
- The method of formal proof is not a systematic
procedure (though it can be used to make one).
146Positive Tests, Negative Tests, and Full Tests
- A positive test is a systematic procedure that
tries to figure out whether certain things have a
certain property. - A negative test is a systematic procedure that
tries to figure out whether certain things do not
have a certain property. - A full test is a systematic procedure that tries
to figure out whether certain things do or do not
have a certain property. - The truth table method is a full test. It can
answer that something is or is not a logical
consequence of something else. - The formal proof method, even if it were
systematic, is not a full test, but only a
positive test. It can answer that something is a
logical consequence of something else, but it
never concludes that it isnt a logical
consequence.
147Soundness and Completeness for Tests and Decision
Procedures
- A test (positive, negative, or full) is sound
iff - if the test claims that something has (not) a
certain property, then it has (not) that
property. - A test (positive, negative, or full) is complete
iff - If something has (not) a certain property, then
the test claims that it has (not) that property.
148Decision Procedures
- A full test that is both sound and complete is
called a decision procedure. - The truth-table method is a decision procedure
for truth-functional consequence. - The Taut Con rule (mechanism!) is also a
decision procedure for truth-functional
consequence. - Questions Is there a decision procedure for TF
consequence that is more efficient than the
truth-table method. In fact, how does Taut Con
work?
149Truth-Trees
150Logical Possibility
- All logically interesting claims can be reduced
to questions about logical possibility - Logical Consistency Is it possible for all
statem