Professional Documents
Culture Documents
Appendix A0 Logic
Appendix A0 Logic
Logic
Definition [1] A logic is a formal language that comes with rules for deducing the truth of
one proposition from the truth of another.
Definition A sentence with truth value (True/False, T/F) is called a proposition (or a
statement).
Example 1. Consider a proposition P. We want to define the set of all functions of P. The
proposition P has two truth values T and F. The list of all possible truth values is T and F.
So, the domain of a function is a set of two values. Each function has to be defined at these
two values. For example, two possible functions are f1 (T ) = T , f1 (F ) = T and f2 (T ) = T ,
f2 (F ) = F . These functions are different since f1 (F ) 6= f2 (T ).
What is the total number of functions of P? For each of two truth values in the domain there
are two truth values in the range. The total number of combinations is 22 = 4. Therefore, there
are four different functions of one argument P. The following table lists all of them
1
P | f1 f2 f3 f4
T | T T F F
F | T F T F
Example 2. Consider two propositions P and Q and all functions f (P, Q). Each of propositions
has two truth values T and F. The list of all possible combinations (pairs) of truth values for
P and Q is (T,T), (T,F), (F,T), and (F,F). So, the domain of a function of P and Q is a set of
four pairs of truth values. Each function has to be defined at these pairs. For each of four pairs
in the domain there are two values in the range. The total number of possible combinations is
24 = 16. Therefore, there are sixteen different functions of two arguments P and Q.
Example 3. Consider three propositions P, Q, and R and all functions f (P, Q, R). Each of
propositions has two truth values T and F. The list of all possible combinations (triplets) of
truth values is (T,T,T), (T,T,F), (T,F,T), (T,F,F), (F,T,T), (F,T,F), (F,F,T), and (T,F,F). So,
the domain of a function is a set of eight triplets. For each of eight values in the domain there
are two values in the range. The total number of possible combinations is 28 = 256. Therefore,
there are 256 different functions of three propositions.
Unary
Unary operation is a function of one proposition P. As it was shown above there are four such
functions. Let’s look at their table again and emphasize a nontrivial function:
P | f1 f2 f3 f4
T | T T F F
F | T F T F
The functions f1 and f4 are constant (f1 = T , f4 = F ) and hence trivial. The function f2 is
also trivial since f2 (P ) = P . The only nontrivial function of one argument is f3 and hence it
is special. In logic it is called negation and denoted by ∼ P (or ¬P ). Please remember this
function.
2
Binary
It is defined on the four pairs of truth values of two proposition P and Q. Those pairs are (T, T ),
(T, F ), (F, T ), and (F, F ). Therefore, the domain of a function contains four points. For each
point a function can attain two values either T or F. Hence the total number of all possible
binary functions is 24 = 16. Here is the table of them:
P Q | f1 f2 f3 f4 f5 f6 f7 f8
T T | T T T T T T T T
T F | T T T T F F F F
F T | T T F F T T F F
F F | T F T F T F T F
The functions f9 − f16 are negations of the functions f1 − f8 and can be removed (f16 is negation
to f1 , f15 is negation to f2 , and etc.) The function f1 = T is constant, f4 = P , f6 = Q. The
only nontrivial functions are f2 , f3 , f5 , f7 , and f8 , and they have special names and notations
that have to be remembered:
f8 is called logic AND (conjunction) and denoted by P ∧ Q
f2 is called logic OR (disjunction) and denoted by P ∨ Q
f5 is called conditional (implication) and denoted by P ⇒ Q
f7 is called biconditional (double implication) and denoted by P ⇔ Q
A conditional proposition can be expressed as ”If P then Q”, where P is called a hypothesis
and Q is called a conclusion.
3
Ternary
It contains three propositions and its domain is made of 23 = 8 triplets of truth values of the
propositions. The total number of all possible ternary functions is 28 = 256. This number
is huge and there is no way to list and remember them all. So, this way is not productive. A
productive way is to represent a ternary function as a combination of unary and binary functions.
The same is true for any function with the number of arguments greater than three. That is why
in logic we do not define operations with the number of arguments greater than two. Although
functions of three and more arguments are under consideration.
A table which is similar to the previous tables and representing one logic operation is called a
truth table for the logic operation. Below are truth tables for one unary and all four binary logic
operations that have to be memorized
P | ∼P
T | F
F | T
P Q | P ∧Q
T T | T
T F | F
F T | F
F F | F
P Q | P ∨Q
T T | T
T F | T
F T | T
F F | F
4
Truth table for P ⇒ Q:
P Q | P ⇒Q
T T | T
T F | F
F T | T
F F | T
P Q | P ⇔Q
T T | T
T F | F
F T | F
F F | T
Compound propositions
Binary logic operations are called connectives. A proposition made of several propositions
and containing unary and binary operations is called a compound proposition or a formula.
Primitive propositions that do not contain unary or binary operations are called atoms.
Order of operations
• Negation
5
Solution:
P Q | ∼P ∼P ∨Q
T T | F T
T F | F F
F T | T T
F F | T T
Equivalent propositions
Two propositions are equivalent if their truth tables are the same.
P Q | P ⇒Q
T T | T
T F | F
F T | T
F F | T
which equals to truth table ∼ P ∨ Q in the previous example. Hence these two propositions
are equivalent.
Alternative solution: Construct the truth table for the compound proposition
(∼ P ∨ Q) ⇔ (P ⇒ Q) and show that its last column contains only T values.
Example. By constructing truth tables prove De Morgan’s Law (∼(P ∨ Q)) ⇔ (∼P ∧ ∼Q),
where the sign ⇔ means equivalence.
P Q P ∨ Q ∼(P ∨ Q) ∼P ∼Q ∼P ∧ ∼Q
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
The fourth and seventh columns are equivalent. Hence, De Morgan’s Law is true.
Alternative solution: Construct the truth table for the compound proposition
(∼(P ∨ Q)) ⇔ (∼P ∧ ∼Q) and show that its last column contains only T values.
6
Definition [1] A compound proposition that is true regardless of the truth values of its atoms
is called a tautology.
The last column contains true values only. Hence, the proposition (P ∧ Q) ⇒ P is a tautology.
P Q ∼Q P ∧ ∼Q P ∨ ∼Q (P ∧ ∼Q) ⇒ (P ∨ ∼Q)
T T F F T T
T F T T T T
F T F F F T
F F T F T T
The last column has true values. Hence, the proposition (P ∧ ∼Q)) ⇒ (P ∨ ∼Q) is a tautology.
Definition [1] A compound proposition that is false regardless of the truth values of its atoms
is called a contradiction.
P Q P ∧Q ∼P (P ∧ Q) ∧ (∼P )
T T T F F
T F F F F
F T F T F
F F F T F
7
The last column contains false values only. Hence, the proposition (P ∧ Q) ∧ (∼P ) is a
contradiction.
P Q ∼Q P ∧ ∼Q ∼P (P ∧ ∼Q) ⇒ (∼P )
T T F F F T
T F T T F F
F T F F T T
F F T F T T
The last column does not contain true values only. Hence, the conditional proposition
(P ∧ ∼Q) ⇒ (∼P ) is a fallacy.
Solution: The proposition is conditional. We need to show that it is a tautology. Truth table:
P Q P ∨Q ∼P (P ∨ Q) ∧ ∼P ((P ∨ Q) ∧ ∼P ) ⇒ Q
T T T F F T
T F T F F T
F T T T T T
F F F T F T
The last column contains true values only. Hence, the proposition ((P ∨ Q) ∧ ∼P ) ⇒ Q is a
tautology and it is a rule of inference.
8
Rules of inference
Double negation: ∼ (∼ A) ⇔ A
Simplification: A ∧ B ⇒ A
Addition: A ⇒ A ∨ B
Disjunctive syllogism: ((A ∨ B) ∧ ∼ A) ⇒ B
Reductio ad absurdum: ((∼ A ⇒ B) ∧ (∼ A ⇒ ∼ B)) ⇔ A
Modus ponens: (A ∧ (A ⇒ B)) ⇒ B
Modus tollens: (∼ B ∧ (A ⇒ B)) ⇒ ∼ A
Contrapositive: (A ⇒ B) ⇔ (∼ B ⇒ ∼ A)
Deduction principle: ((A ∧ B) ⇒ C) ⇔ (A ⇒ (B ⇒ C))
Hypothetical syllogism: ((A ⇒ B) ∧ (B ⇒ C) ⇒ (A ⇒ C)
Case analysis: ((A ∨ B) ∧ (A ⇒ C) ∧ (B ⇒ C)) ⇒ C
Distributivity: (A ∨ (B ∧ C)) ⇔ (A ∨ B) ∧ (A ∨ C), (A ∧ (B ∨ C)) ⇔ (A ∧ B) ∨ (A ∧ C)
DeMorgan’s laws: ∼ (A ∧ B) ⇔ ∼ A ∨ ∼ B, ∼ (A ∨ B) ⇔ ∼ A ∧ ∼ B
If H1 , H2 , . . . , Hn then C
If H1 , H2 , . . . , Hn then C
H1 , H2 , . . . , Hn ` C
9
Definition [1] Types of proofs Let If H1 , H2 , . . . , Hn then C be a theorem. There are
several types of proofs
• If the hypothesis is of the form (H1 , . . . , Hn ) ∨ (K1 , . . . , Km ) then we also have proof by
exhaustion: H1 , . . . , Hn ` C and K1 , . . . , Km ` C are proved.
Definition An algebra (or algebraic structure) is a set A of its elements together with their
values and a collection of operations on A that operate on values of elements of A.
A propositional logic is a simplest possible nontrivial algebra. Its simplicity comes from the fact
that each element (proposition) has only two values and there are no n-ary operations for n ≥ 3.
In mathematics we typically encounter more complicated sentences that depend on variables and
whose truth value depends on the value of the variables. To handle such statements we need to
consider an extension of propositional logic, called first-order logic.
Definition A predicate, also called open statement, is a sentence with one or more variables
such that when the variable is replaced by a value from a specified domain, also called universe
of discourse, the resulting sentence is a statement in propositional logic (i.e. unambiguously true
or false).
To be able to create statements in propositional logic from predicates we need to expand the
lexicon of propositional logic by adding the following quantifiers:
∃ for ’for some’, ’there exists . . . such that . . . ’, ∀ for ’for all’.
∃ is called the existential quantifier, and ∀ is called the universal quantifier.
10
Negation of propositions
∼(∼P ) = P
∼(P ∧ Q) = ∼P ∨ ∼Q
∼(P ∨ Q) = ∼P ∧ ∼Q
∼(P ⇒ Q) = P ∧ ∼Q
∼(∃x P (x)) = ∀x ∼P (x)
∼(∀x P (x)) = ∃x ∼P (x)
For example the last proposition is read as the negation of ”for all x P (x) is true” is the same
as ”there exists x for which P (x) is false”.
Hypothesis 1, H1 : r2 = 2.
Hypothesis 2, H2 : m and n are integer numbers with no common factors.
m
Conclusion, C: r 6= .
n
In terms of logic the theorem is
Theorem. H1 ∧ H2 ⇒ C.
11
Applying the negation to the right side we obtain
∼C ` ∼H1 ∨ ∼H2
References
[1] Bogdan Ion Math 0413 lecture notes.
12