Symbolic Logic - University of New England

Symbolic Logic
Ioan Despi
[email protected]
University of New England
July 19, 2013
Outline
1
What is logic?
2
Modus Ponens
3
Features of Rules of Reasoning
4
Necessity in Logic
5
Formal and informal logic
6
Statements
7
Logic Puzzles
8
Basic Concepts
9
Connectives
10
Negation
11
Truth-Tables
12
Logical Equivalence
13
De Morgan’s Laws
Ioan Despi – Web Programming
2 of 24
What is logic?
Logic came from logos[Greek]: sentence, discourse, reason, rule, ratio
Logic is the study of the principles of correct reasoning.
Many of them, e.g.,
I
principles governing the validity of arguments, that is
F
whether certain conclusions follow from some given assumptions.
Examples:
If Tom is an actor, then Tom is rich.
Tom is an actor.
Therefore, Tom is rich.
More:
If Deta is in Europe, then Deta is not in
China.
Deta is in Europe.
Therefore, Deta is not in China.
Ioan Despi – Web Programming
3 of 24
If πœ† > 3, then πœ† > 2.
πœ† > 3.
Therefore, πœ† > 2.
All Cretans are liars.
Ariadna is a Cretan.
Therefore, Ariadna is a liar.
Modus Ponens
These four arguments here are obviously good arguments in the sense
that their conclusions follow from the assumptions.
If the assumptions of the argument are true, then the conclusion of the
argument must also be true.
They are all cases of a particular form of argument known as ”modus
ponens”:
𝑃 ⇒𝑄
If P then Q.
𝑃
P.
Therefore Q.
βˆ΄π‘„
We shall be discussing validity again later on.
Logic is not just concerned with the validity of arguments.
Logic also studies
I
I
I
consistency, and
logical truths, and
properties of logical systems such as
F
F
completeness and
soundness.
But we shall see that these other concepts are also very much related to
the concept of validity.
Ioan Despi – Web Programming
4 of 24
Features of Rules of Reasoning
Modus ponens illustrates two features about the rules of reasoning in logic:
1
Topic-neutrality.
I
I
Modus ponens can be used in reasoning about diverse topics.
This is true of all the principles of reasoning in logic.
F
F
F
2
The laws of biology might be true only of living creatures, and
the laws of economics are only applicable to collections of agents that
enagage in financial transactions, but
the principles of logic are universal principles which are more general than
biology and economics.
Non-contingency,
I
I
I
They do not depend on any particular accidental features of the world.
The theories in the empirical sciences (physics, biology) are contingent in
the sense that they could have been otherwise.
The principles of logic, on the other hand, are derived using reasoning only,
and their validity does not depend on any contingent features of the world.
Ioan Despi – Web Programming
5 of 24
Two Definitions
This is what is implied in the definitions of logic by two famous logicians:
Figure : Alfred Tarski (1901-1983)
Figure : Gottlob Frege (1848-1925)
β€œlogic. . . [is] . . . the name of a discipline
which analyzes the meaning of the
concepts common to all the sciences,
and establishes the general laws
governing the concepts. ”
β€œTo discover truths is the task of all
sciences; it falls to logic to discern the
laws of truth. ... I assign to logic the
task of discovering the laws of truth,
not of assertion or thought.”
Ioan Despi – Web Programming
6 of 24
Necessity in Logic
The theories in the empirical sciences are contingent in the sense that
they could have been otherwise.
The principles of logic are derived using reasoning only, and their validity
does not depend on any contingent features of the world.
Example:
I
I
I
I
logic tells us that any statement of the form ”If P then P” is necessarily
true.
this principle tells us that a statement such as
”if it is snowing, then it is snowing” must be true.
we can easily see that this is indeed the case, whether or not it is actually
snowing.
even if the laws of physics or weather patterns were to change, this
statement will remain true.
Thus we say that scientific truths (mathematics aside) are contingent
whereas logical truths are necessary.
This shows how logic is different from the empirical sciences like physics,
chemistry or biology.
Ioan Despi – Web Programming
7 of 24
Formal and informal logic
One can distinguish between informal and formal logic:
Informal logic is used to
I
I
mean the same thing as critical thinking
the study of reasoning and fallacies in the context of everyday life.
Formal logic is
I
concerned with formal systems of logic, i.e.,
F
F
I
specially constructed systems for carrying out proofs, where
the languages and rules of reasoning are precisely and carefully defined.
Examples:
F
F
Sentential logic (also known as ”Propositional logic”) and
Predicate Logic
Ioan Despi – Web Programming
8 of 24
Reasons for Studying Formal Logic
Formal logic helps us identify
I
I
patterns of good reasoning and
patterns of bad reasoning, so
we know which to follow and which to avoid.
Basic formal logic can help improve critical thinking.
Formal systems of logic are also used by
I
I
I
I
linguists – to study natural languages
computer scientists – to research relating to Artificial Intelligence
philosophers – to make their reasoning more explicit and precise
many other disciplines
Ioan Despi – Web Programming
9 of 24
Statements
In logic we often talk about the logical properties of statements and how
one statement is related to another.
There are three main sentence types in English:
I
I
I
Declarative sentences are used for assertions, e.g. ”She is here.”
Interrogative sentences are used to ask questions, e.g. ”Is she here?”
Imperative sentences are used for making requests or issuing commands,
e.g. ”Come here!”
In the sequel, we shall only take a statement to be a declarative sentence,
i.e.,
I
a complete and grammatical sentence that makes a claim, e.g.,
F
F
F
F
There is no reality, only its reflection.
The moon is made of green cheese.
Talking brings an audience.
Doing brings a profit.
Statements can be true or false, and they can be simple or complex.
But they must be grammatical and complete sentences.
Ioan Despi – Web Programming
10 of 24
Counterexamples and Test
These are not statements :
I
I
I
I
I
The Commonwealth of Australia [ A proper name, but not a sentence ]
A bridge too far. [ Not a complete sentence ]
Sit down! [ A command that is not a complete sentence making a claim ]
Are you coming? [ A question ]
+*()= [ Ungrammatical ]
Test to decide whether something is a statement in English:
I
given a sentence πœ‘, add ”it is true that. . . ” to the front.
F
F
if the resulting expression is grammatical, then πœ‘ is a statement.
otherwise it is not.
Ioan Despi – Web Programming
11 of 24
Logic Puzzles
Bob was looking at a photo. Someone asked him
”Whose picture are you looking at?”
He replied:
”I don’t have any brother or sister,
but this man’s father is my father’s son.”
So, whose picture was Bob looking at?
The man in the photo is Bob’s son.
There was a robbery in which a lot of goods were stolen. The robber(s)
left in a truck. It is known that :
1
2
3
Nobody else could have been involved other than A, B and C.
C never commits a crime without A’s participation.
B does not know how to drive.
So, is A innocent or guilty?
A is guilty.
Ioan Despi – Web Programming
12 of 24
Basic Concepts
A proposition is a statement which is either true or false.
A tautology is a proposition which is always true.
A contradiction is a proposition which is always false.
A compound proposition is build from propositions by the use of
connectives and, or, not, implies, and equivalent to.
Ioan Despi – Web Programming
13 of 24
Connectives
Given two statements (propositions), denoted by 𝑝 and π‘ž respectively, one can
use connectives to get the following compound propositions:
𝑝 ∧ π‘ž, the conjunction of 𝑝 and π‘ž, meaning β€œπ‘ and π‘žβ€
𝑝 ∨ π‘ž, the disjunction of 𝑝 and π‘ž, meaning β€œπ‘ or π‘žβ€
∼ 𝑝, the negation of 𝑝, meaning β€œnot 𝑝”
𝑝 β†’ π‘ž, the implication, meaning β€œπ‘ implies π‘žβ€
𝑝 ↔ π‘ž, the equivalence of 𝑝 and π‘ž, meaning β€œπ‘ and π‘ž are equivalent”
Ioan Despi – Web Programming
14 of 24
Negation
The negation of a statement πœ™ is a statement whose truth-value is
necessarily opposite to that of πœ™.
For any English sentence πœ™, you can form its negation by appending
”it is not the case that” to πœ™ to form the longer statement
it is not the case that πœ™.
In formal logic, the negation of πœ™ can be written as ∼ πœ™ or ¬ πœ™.
A statement and its negation
I
can never be true together
I
exhaust all logical possibilities
F
F
they are logically inconsistent with each other.
in any situation, one and only one of them must be true.
Here are some concrete examples:
πœ™
βˆΌπœ™
It is snowing. It is not the case that it is snowing.
(i.e., It is not snowing.)
1+1=2
It is not the case that 1 + 1 = 2.
(i.e., 1 + 1 is not 2.)
Ioan Despi – Web Programming
15 of 24
Logical Values
In Propositional Logic there are only two truth-values :
T and F, which stand for truth and falsity, respectively.
Some textbooks use ”1” and ”0” in place of ”T” and ”F”.
I
I
To say that a statement has truth-value T is just to say that it is true.
To say that its truth-value is F is to say that it is false.
The principle of bivalence: a WFF either has truth-value T or F.
The principle of excluded middle [tertium non datur] states that for
any proposition, either that proposition is true, or its negation is true.
The principle of (non-) contradiction states that no statement can be
both true and not true (false).
Ioan Despi – Web Programming
16 of 24
Truth-Tables
They provide one systematic method for determining the validity of
sentences or arguments in Sentential (Propositional) Logic.
They show how the truth-value of a complex Well-Formed-Formula
(WFF) depends on the truth-values of its component WFFs.
A truth table is a complete list of the possible truth values of a
statement. We use ”T” to mean ”true”, and ”F” to mean ”false” (though
it may be clearer and quicker to use ”1” and ”0” respectively).
I
I
I
with two propositions there are 4 possibilities
with three propositions there are 8 possibilities
with 𝑛 propositions there are 2𝑛 possibilities.
It is a mathematical tradition to split the first column in two - the first
half being all T’s and the second half being all F’s, then to split the
second column into quarters with T’s in the first quarter, F’s in the
second quarter and so on, then to split the third column, if there is one,
into eights with blocks of T’s and F’s alternating, and so on.
The truth tables can be taken as the precise definitions for the
corresponding connectives.
Ioan Despi – Web Programming
17 of 24
Truth-Tables
Ioan Despi – Web Programming
18 of 24
Truth-Tables
𝑝
𝑇
𝑇
𝐹
𝐹
π‘ž
𝑇
𝐹
𝑇
𝐹
π‘βˆ§π‘ž
𝑇
𝐹
𝐹
𝐹
𝑝
𝑇
𝑇
𝐹
𝐹
Ioan Despi – Web Programming
𝑝
𝑇
𝑇
𝐹
𝐹
π‘ž
𝑇
𝐹
𝑇
𝐹
π‘ž
𝑇
𝐹
𝑇
𝐹
π‘β†’π‘ž
𝑇
𝐹
𝑇
𝑇
π‘βˆ¨π‘ž
𝑇
𝑇
𝑇
𝐹
𝑝
𝑇
𝑇
𝐹
𝐹.
19 of 24
𝑝
𝑇
𝐹
π‘ž
𝑇
𝐹
𝑇
𝐹
π‘β†”π‘ž
𝑇
𝐹
𝐹
𝑇
βˆΌπ‘
𝐹
𝑇
.
Logical Equivalence
Definition
Two (compound) propositions 𝑃 and 𝑄 are said to be equivalent or
logically equivalent, denoted by
𝑃 ≑ 𝑄 or by 𝑃 ⇔ 𝑄,
iff (i.e., if and only if) they have the same truth values.
In other words, for all possible truth values of the component statements,
the compound propositions will have the same truth values.
Show (∼ 𝑝) ∨ (∼ π‘ž) and ∼ (𝑝 ∧ π‘ž) are equivalent.
Ioan Despi – Web Programming
20 of 24
Example
Show (∼ 𝑝) ∨ (∼ π‘ž) and ∼ (𝑝 ∧ π‘ž) are equivalent.
Solution.
𝑝
𝑇
𝑇
𝐹
𝐹
π‘ž
𝑇
𝐹
𝑇
𝐹
βˆΌπ‘
𝐹
𝐹
𝑇
𝑇
βˆΌπ‘ž
𝐹
𝑇
𝐹
𝑇
π‘βˆ§π‘ž
𝑇
𝐹
𝐹
𝐹
⏟
⏞
intermediate results
not necessary but useful
∼ (𝑝 ∧ π‘ž)
𝐹
𝑇
𝑇
𝑇
⏟
(∼ 𝑝) ∨ (∼ π‘ž)
𝐹
𝑇
𝑇
𝑇
⏞
exactly same columns
(same truth values)
Since the last two columns are the same, we conclude (βˆΌπ‘) ∨ (βˆΌπ‘ž) and ∼(𝑝 ∧ π‘ž)
are equivalent.
Ioan Despi – Web Programming
21 of 24
Example
Show ∼(𝑝 ∧ π‘ž) and (βˆΌπ‘) ∧ (βˆΌπ‘ž) are not logically equivalent.
Solution. This is manifested in the following truth table
𝑝
𝑇
𝑇
𝐹
𝐹
π‘ž
𝑇
𝐹
𝑇
𝐹
βˆΌπ‘
𝐹
𝐹
𝑇
𝑇
βˆΌπ‘ž
𝐹
𝑇
𝐹
𝑇
π‘βˆ§π‘ž
𝑇
𝐹
𝐹
𝐹
∼(𝑝 ∧ π‘ž)
𝐹
𝑇
𝑇
𝑇
⏟
(∼ 𝑝) ∧ (βˆΌπ‘ž)
𝐹
𝐹
𝐹
𝑇
⏞
not exactly same
because the corresponding truth values differ (at 2 places).
Ioan Despi – Web Programming
22 of 24
Example
Show (𝑝 ∨ π‘ž) ∨ (∼ 𝑝) is a tautology and (𝑝 ∧ π‘ž) ∧ (∼ 𝑝) is a contradiction.
Solution. From the following truth table
𝑝
𝑇
𝑇
𝐹
𝐹
π‘ž
𝑇
𝐹
𝑇
𝐹
βˆΌπ‘
𝐹
𝐹
𝑇
𝑇
βˆΌπ‘ž
𝐹
𝑇
𝐹
𝑇
π‘βˆ¨π‘ž
𝑇
𝑇
𝑇
𝐹
π‘βˆ§π‘ž
𝑇
𝐹
𝐹
𝐹
(𝑝 ∨ π‘ž) ∨ (∼ 𝑝)
𝑇
𝑇
𝑇
𝑇
(𝑝 ∧ π‘ž) ∧ (∼ 𝑝)
𝐹
𝐹
𝐹
𝐹
⏟
⏟
⏞
contradiction
⏞
tautology
We see that
(𝑝 ∨ π‘ž) ∨ (∼ 𝑝) is always true and is thus a tautology and
(𝑝 ∧ π‘ž) ∧ (∼ 𝑝) is always false and is thus a contradiction.
Ioan Despi – Web Programming
23 of 24
De Morgan’s Laws
Theorem
(i) ∼ (𝑝 ∧ π‘ž) is equivalent to (∼ 𝑝) ∨ (∼ π‘ž) , i.e.,
∼ (𝑝 ∧ π‘ž) ≑ (∼ 𝑝) ∨ (∼ π‘ž)
(ii) ∼ (𝑝 ∨ π‘ž) is equivalent to (∼ 𝑝) ∧ (∼ π‘ž) , i.e.,
∼ (𝑝 ∨ π‘ž) ≑ (∼ 𝑝) ∧ (∼ π‘ž)
Proof.
(i) already done in the first example ;
(ii) can be proved likewise.
Theorem
𝑝 β†’ π‘ž ≑ (∼ 𝑝) ∨ π‘ž.
Proof.
Can easily be proved by the use of a truth table.
Ioan Despi – Web Programming
24 of 24
Logical Equivalences
A number of logical equivalences are summarised in the following theorem.
Proofs are left as exercises.
Theorem
Let 𝑝, π‘ž, π‘Ÿ be propositions and denote by ⊀ and βŠ₯ tautology, respectively
contradiction. Then the following logical equivalences hold.
1. Commutative laws
π‘βˆ§π‘ž β‰‘π‘žβˆ§π‘
π‘βˆ¨π‘ž β‰‘π‘žβˆ¨π‘
2. Associative laws
(𝑝 ∧ π‘ž) ∧ π‘Ÿ ≑ 𝑝 ∧ (π‘ž ∧ π‘Ÿ)
(𝑝 ∨ 𝑝) ∨ π‘Ÿ ≑ 𝑝 ∨ (π‘ž ∨ π‘Ÿ)
3. Distributive laws
𝑝 ∧ (π‘ž ∨ π‘Ÿ) ≑ (𝑝 ∧ π‘ž) ∨ (𝑝 ∧ π‘Ÿ) 𝑝 ∨ (π‘ž ∧ π‘Ÿ) ≑ (𝑝 ∨ π‘ž) ∧ (𝑝 ∨ π‘Ÿ)
4. Identity laws
π‘βˆ§βŠ€β‰‘π‘
π‘βˆ¨βŠ₯≑𝑝
5. Negation laws
π‘βˆ§ ∼ 𝑝 ≑ βŠ₯
π‘βˆ¨ ∼ 𝑝 ≑ ⊀
6. Double Negation law
∼ (∼ 𝑝) ≑ 𝑝
7. Idempotent laws
π‘βˆ§π‘β‰‘π‘
π‘βˆ¨π‘β‰‘π‘
8. Universal bound laws
π‘βˆ§βŠ₯≑βŠ₯
π‘βˆ¨βŠ€β‰‘βŠ€
9. De Morgan’s laws
∼ (𝑝 ∧ π‘ž) ≑ (∼ 𝑝) ∨ (∼ π‘ž)
∼ (𝑝 ∨ π‘ž) ≑ (∼ 𝑝) ∧ (∼ π‘ž)
10. Absorption laws
𝑝 ∧ (𝑝 ∨ π‘ž) ≑ 𝑝
𝑝 ∨ (𝑝 ∧ π‘ž) ≑ 𝑝
11. Negations of ⊀ and βŠ₯
βˆΌβŠ€β‰‘βŠ₯
∼βŠ₯β‰‘βŠ€
Ioan Despi – Web Programming
25 of 24
Examples
Example
5. Use the laws of Theorem ?? to verify the logical equivalence
∼ 𝑝 ∧ ∼ π‘ž β‰‘βˆΌ (𝑝 ∨ (∼ 𝑝 ∧ π‘ž))
Solution. Starting with the most complex side, working toward the other
side:
∼ (𝑝 ∨ (∼ 𝑝 ∧ π‘ž)) ≑
Ioan Despi – Web Programming
∼ ((π‘βˆ¨ ∼ 𝑝) ∧ (𝑝 ∨ π‘ž))
Distributivity
≑
∼ (⊀ ∧ (𝑝 ∨ π‘ž))
Identity
≑
∼ (𝑝 ∨ π‘ž)
≑
∼ π‘βˆ§ ∼ π‘ž
26 of 24
De Morgan
Conditional Statements
The compound proposition implication
π‘β†’π‘ž
is a conditional statement, and can be read as
β€œif 𝑝 then π‘žβ€ or β€œπ‘ implies π‘žβ€, or β€œπ‘ž, if 𝑝”.
Its precise definition is given by the following truth table
𝑝 π‘ž π‘β†’π‘ž
𝑇 𝑇
𝑇
𝐹
𝑇 𝐹
𝐹 𝑇
𝑇
𝐹 𝐹
𝑇
.
Let us briefly see why the above definition via the truth table is
β€œreasonable” and is consistent with our day to day understanding of the
notion of implications.
We observe that the only explicit contradiction to β€œif 𝑝 then π‘žβ€ comes
from the case when 𝑝 is true but π‘ž is false, and this explains the only β€œπΉ ”
entry in the 𝑝 β†’ π‘ž column.
We also note that some people would never use β€œπ‘ implies π‘žβ€ to refer to
𝑝 β†’ π‘ž; they would instead use β€œπ‘ implies π‘žβ€ to exclusively refer to 𝑝 β‡’ π‘ž,
i.e., 𝑝 β†’ π‘ž is a tautology. More details on β€œβ‡’β€ can be found in one of the
later
lectures.
Ioan Despi
– Web
Programming
27 of 24
Example
Example
6. Let 𝑝 denote β€œI buy shares” and π‘ž denote β€œI’ll be rich”. Then 𝑝 β†’ π‘ž
means β€œIf I buy shares then I’ll be rich”.
Solution. Let us check row by row the β€œreasonableness” of the truth table
for 𝑝 β†’ π‘ž given shortly before.
Row 1:
β€œI buy shares” (𝑝 true) and β€œI’ll be rich” (π‘ž true) is certainly consistent with (𝑝 β†’ π‘ž) being true.
Row 2:
β€œI buy shares” and β€œI won’t be rich” means β€œIf I buy
shares then I’ll be rich” (i.e., 𝑝 β†’ π‘ž) is false.
Row 3 and 4: β€œI don’t buy shares” won’t contradict our statement
𝑝 β†’ π‘ž, regardless of whether I’ll be rich, as obviously
there are other ways to get rich.
Ioan Despi – Web Programming
28 of 24
Representation
Representation
𝑝 β†’ π‘ž ≑ (∼ 𝑝) ∨ π‘ž
This can easily be proved by the use of the truth table.
Note. Obviously a string like 𝑝)) ∧ ∧ β†’ π‘žπ‘Ÿ is not a legitimate logical
expression. In this unit, we always assume that all the concerned strings of
logical expressions are well-formed formulas, or wffs, i.e., the strings are
legitimate.
Ioan Despi – Web Programming
29 of 24