Quick viewing(Text Mode)

Appendix A.0 Logic

Appendix A.0 Logic

Math 0413 Appendix A.0

Logic

Definition [1] A logic is a that comes with rules for deducing the truth of one from the truth of another.

This type of logic is called propositional.

Definition A sentence with (True/False, T/F) is called a proposition (or a statement).

Types of mathematical operations:

• Nullary. It has no .

• Unary. It has one . Arithmetic examples: −a, 1/a.

• Binary. It has two arguments. Arithmetic examples: a + b, a − b, a × b, a ÷ b, ab.

• Ternary. It has three arguments.

• n-ary. It has n arguments.

Many mathematical operations can be treated as functions of the corresponding number of arguments. For example, in Arithmetic the addition a + b, being a binary , can be defined as a of two arguments (variables) f(a, b) = a + b. In logic arguments of a function are . The domain of the function is finite and made of all possible combinations of truth values (T and F) of corresponding propositions. It is discrete and finite. The range of a function is either T, or F, or both T and F. The range is also discrete and finite. Because domain and range both are finite the total number of possible functions has to be finite. The following examples explain the concept.

Example 1. Consider a proposition P. We want to define the 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 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 | TTFF F | TFTF

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.

Now let’s analyze types of operations in terms of functions.

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 | TT F F F | TF 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:

PQ | f1 f2 f3 f4 f5 f6 f7 f8

TT | T T T T T T T T TF | T T T T F F F F FT | T T F F T T F F FF | T F T F T F T F

PQ | f9 f10 f11 f12 f13 f14 f15 f16 TT | FFFFFFFF TF | TTTTFFFF FT | TTFFTTFF FF | TFTFTFTF

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

We omitted f3 which is another conditional Q ⇒ P because it is similar to f5. Sometimes f10 is called exclusive OR and denoted by P Y Q. We are not going to use it here since it is just a negation of f7.

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.

Logic operations and their truth tables

A table which is similar to the previous tables and representing one logic operation is called a for the logic operation. Below are truth tables for one unary and all four binary logic operations that have to be memorized

Truth table for ∼ P :

P | ∼ P T | F F | T

Truth table for P ∧ Q:

PQ | P ∧ Q TT | T TF | F FT | F FF | F

Truth table for P ∨ Q:

PQ | P ∨ Q TT | T TF | T FT | T FF | F

4 Truth table for P ⇒ Q:

PQ | P ⇒ Q TT | T TF | F FT | T FF | T

Truth table for P ⇔ Q:

PQ | P ⇔ Q TT | T TF | F FT | F FF | 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

In compound propositions the following order of operations is applied:

• Negation

• Logic AND precedes logic OR

In other cases use parentheses to specify the order of operations.

Example. ∼ P ∧ Q ∨ R is not the same as ∼ P ∧ (Q ∨ R) or ∼ (P ∧ Q) ∨ R.

Example. Find the truth table for the compound proposition ∼ P ∨ Q

5 Solution: PQ | ∼ P ∼ P ∨ Q TT | FT TF | FF FT | TT FF | TT

Equivalent propositions

Two propositions are equivalent if their truth tables are the same.

Example. Show that ∼ P ∨ Q is equivalent to P ⇒ Q.

Solution: The truth table for P ⇒ Q is

PQ | P ⇒ Q TT | T TF | F FT | T FF | 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.

Solution: Truth table:

PQP ∨ Q ∼(P ∨ Q) ∼P ∼Q ∼P ∧ ∼Q TTTFFFF TFTFFTF FTTFTFF FFFTTTT

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.

Example. By constructing truth table show that the proposition (P ∧ Q) ⇒ P is a tautology.

Solution: Truth table: PQP ∧ Q (P ∧ Q) ⇒ P TTTT TFFT FTFT FFFT

The last column contains true values only. Hence, the proposition (P ∧ Q) ⇒ P is a tautology.

Example. Show that the proposition (P ∧ ∼Q) ⇒ (P ∨ ∼Q) is a tautology.

Solution: Truth table:

PQ ∼QP ∧ ∼QP ∨ ∼Q (P ∧ ∼Q) ⇒ (P ∨ ∼Q) TTFFTT TFTTTT FTFFFT FFTFTT

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.

Example. Show that the proposition (P ∧ Q) ∧ (∼P ) is a contradiction.

Solution: Truth table:

PQP ∧ Q ∼P (P ∧ Q) ∧ (∼P ) TTTFF TFFFF FTFTF FFFTF

7 The last column contains false values only. Hence, the proposition (P ∧ Q) ∧ (∼P ) is a contradiction.

Definition [1] A conditional proposition that is not tautological is called a fallacy.

Example. Show that the proposition (P ∧ ∼Q) ⇒ (∼P ) is a fallacy.

Solution: Truth table:

PQ ∼QP ∧ ∼Q ∼P (P ∧ ∼Q) ⇒ (∼P ) TTFFFT TFTTFF FTFFTT FFTFTT

The last column does not contain true values only. Hence, the conditional proposition (P ∧ ∼Q) ⇒ (∼P ) is a fallacy.

Definition [1] A conditional or biconditional proposition that is a tautology is called a rule of .

Example. Show that the proposition ((P ∨ Q) ∧ ∼P ) ⇒ Q is a .

Solution: The proposition is conditional. We need to show that it is a tautology. Truth table:

PQP ∨ Q ∼P (P ∨ Q) ∧ ∼P ((P ∨ Q) ∧ ∼P ) ⇒ Q TTTFFT TFTFFT FTTTTT FFFTFT

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

Some fallacies:(A ∧ (A ∨ B)) ⇒ ∼ B,(B ∧ (A ⇒ B)) ⇒ A,(∼ A ∧ (A ⇒ B)) ⇒ ∼ B

Definition [1] A is a proposition of the form

If H1,H2,...,Hn then C

where each Hi, i = 1, 2, . . . , n is a proposition called hypothesis and C is a proposition called conclusion.

Definition [1] A proof of the theorem

If H1,H2,...,Hn then C

is a finite P1,...,Pk of propositions with Pk = C, and such that each of Pi is either a hypothesis, or the conclusion of the rules of inference which has as hypothesis one or more of the previous propositions.

If the theorem If H1,H2,...,Hn then C is true we write

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

• Direct proof: H1,H2,...,Hn ` C is proved.

• Proof by contrapositive: ∼C ` ∼(H1 ∧ H2 ∧ · · · ∧ Hn) is proved.

• Proof by contradiction: H1,H2,...,Hn, ∼C ` D is proved, where D is a contradiction.

• 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 (proposition) has only two values and there are no n-ary operations for n ≥ 3.

First-order logic [1]

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.

A proposition in first-order logic is made of propositions in propositional logic, predicates, and quantifiers.

10 Negation of propositions

There are several simple negations that should be memorized:

∼(∼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”.

Example Negate the statement: ∀ε > 0 ∃M ∈ N such that ∀n ≥ M |xn − x| < ε.

Solution: ∃ε > 0 such that ∀M ∈ N ∃n ≥ M |xn − x| > ε.

Example. Theorem. There is no rational square root of 2. m Solution: In the statement of the theorem ’rational’ means a rational number of the form n where m and n are integer numbers with no common factors. To prove the theorem we restate its statement in the form of hypotheses and conclusion. Our first try is m Theorem. If r2 = 2 then r 6= where m and n are integer numbers with no common factors. n Our second try is m Theorem. If r2 = 2 and m and n are integer numbers with no common factors then r 6= . n The last form of the theorem has hypotheses and a conclusion. Let’s write them down:

2 Hypothesis 1, H1: r = 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.

We will prove it by contrapositive: ∼C ` ∼(H1 ∧ H2) is proved

11 Applying the negation to the right side we obtain

∼C ` ∼H1 ∨ ∼H2

In other words, we have to prove the following m Theorem. IF r = THEN r2 6= 2 OR m and n are integer numbers with common factors. n m m2 Proof : r = ⇒ r2 = . We have two cases: n n2 1. r2 6= 2 and the theorem is proven. OR 2. r2 = 2. m2 In this case we have = 2 ⇒ m2 = 2n2 ⇒ m is even. n2 Indeed, if m is odd then m2 also must be odd and cannot be equal 2n2 which is even. So, m = 2k for some integer number k. Then (2k)2 = 2n2, 4k2 = 2n2, 2k2 = n2 and n must be even, i.e. n = 2l for some integer number l. The last means that m and n have a common factor 2. The theorem is proven.

References

[1] Bogdan Ion Math 0413 lecture notes.

12