Vectors and Vector Operations .edu



1. Logic

Logic is the mathematics of True and False (1 and 0). The ancient Greeks developed logic when they were analyzing whether arguments were valid. Then in the 1930's logic was applied to the design of logic circuits. More recently it has been applied to computer programming, searching (e.g. internet searches) and other fields.

1.1 Bits, Logical Values and Propositions

bit = something that has two possibilities

These two possibilities are represented in various ways. Three common ones are

1 = true = T

0 = false = F

These are called the logical values or Boolean values. In most computer systems information is represented by sequences of bits.

There are various ways to work with bits physically. One common way is by the voltage in a wire. A common convention is

voltage near 0 volts (relative to ground) = 0

voltage near 5 volts (relative to ground) = 1

Example 1. The following is a simple circuit in which each of two lines can be set to represent 0 or 1.

switch A in position 1 ( voltage in line x = 5 v ( x = 1

switch A in position 0 ( voltage in line x = 0 v ( x = 0

Similarly for switch B and line y. We might want to design the circuitry so that z = 1 if x and y have the same value. In that case the light would be on if x and y had the same value.

In this circuit x and y are variables whose values can be either of the logical values. Such a variable is called a logical variable or Boolean variable.

There are other places besides circuits where one encounters things that have two possibilities. One place is classical logic that deals with classifying statements as true or false.

Example 2. Here are two statements along with their how one might classify them as to being true or false.

"Lansing is the capital of Michigan" We would classify this as true.

"2 + 2 = 5" We would classify this as false

Most textbooks make the following definition.

proposition = a statement that can be classified as either true or false

Problem 1. Verify that the following proposition is true

"The population of Lansing is more than 100,000"

and the following proposition is false.

"The number of billionaires in the world is less than 1000"

In the above example "Lansing is the capital of Michigan" and "2 + 2 = 5" are propositions. Often whether or not a statement is classified as true or false depends on additional information.

Example 3. Consider the statement

(1) Ít is raining.

Whether or not this is a proposition or not depends on the circumstances. For example, if the person who makes this statement is referring to the time he or she makes the statement, then it is a proposition. On the other hand, if it is part of the larger statement

(2) If it is raining then I carry my umbrella.

then the person making the statement probably has in mind that the statement applies to more than one time. To indicate this we might rephrase the statement (1) as

It is raining at time x.

In this case the statement (2) might be interpreted as

At any time x if it is raining at time x then I am carrying my umbrella at time x.

Here the values of x and y need to be supplied before the statement can be classified as true or false. Statements of this form are called predicates or relations

predicate = relation

= a statement containing variables which can be classified as true or false once the values of the variables are known

Thus "It is raining at time x." is a predicate. So is "I am carrying my umbrella at time x".

Problem 2. Identify two predicates in the statement "If a city is the capital of some state then its population is greater than 100,000".

Example 4. In mathematics, an equation such as x2 – 5x + 6 = 0 can be regarded as a predicate. When a value of x is substituted into the equation then one gets either true or false. For example, if x = 0 is substituted into the equation then one gets (0)2 - (5)(0) + 6 = 0 or 6 = 0 which is false. However, if x = 2 is substituted into the equation then one gets (2)2 – (5)(2) + 6 = 0 or 4 – 10 + 6 = 0 or 0 = 0 which is true. When we solve an equation we are looking for the values of x which when substituted in give true.

Most of what follows applies to both propositions and predicates. We shall try to comment on the differences as we go along.

Another place one encounters relations is in computer programs.

Example 5. Consider the following segment of a computer program.

if (income < 50000)

tax = 0.1 * income;

else

tax = 5000 + 0.15 * (income – 50000);

In this program segment income is a variable whose value gets sets earlier in the program either by being read in or by as the result of calculation. When this program segment is encountered during the execution of the program the first thing that is done is the expression "income < 50000" is evaluated. If the value of the variable income is less than 50000 then the expression "income < 50000" evaluates to true and the statement "tax = 0.1 * income" is executed. On the other hand if the value of the variable income is greater than or equal to 50000 then the expression "income < 50000" evaluates to false and the statement "tax = 5000 + 0.15 * (income – 50000)" is executed.

In most programming languages "income < 50000" would be called a logical expression. However, it would be a predicate or relation in the terminology of logic.

, (, = and ( are examples of relational operators. They produce a value of true or false when they are applied to two numbers. For example, 2 < 4 evaluates to true while 2 < 1 evaluates to false. Similarly, 2x + 5 < 9 is a predicate. For some x it evaluates to true and for others it evaluates to false.

-----------------------

power

supply

5 v

ground

switch

A

1

0

1

0

switch

B

circuitry

line y

line z

line x

light

Logic

Mathematics of True and False (1 and 0)

Arguments

Philosophy - Ancient Greeks

Logic Design

Computer Engineering

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download