Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Organization 1 Logic and Boolean Algebra.

Similar presentations


Presentation on theme: "Computer Organization 1 Logic and Boolean Algebra."— Presentation transcript:

1 Computer Organization 1 Logic and Boolean Algebra

2 George Boole (1815 – 1864) The original Working Class Boy Made Good, Boole was born in the wrong time, in the wrong place, and in the wrong class - he didn't have a hope of growing up to be a mathematical genius, but he did it anyway. Born in Lincoln, Boole was lucky enough to have a father with a love of maths. Young George took to learning like a politician to a pay rise and, by the age of eight, had outgrown his father's self-taught limits.

3 George Boole (1815 – 1864) Boole was translating Latin poetry by the age of twelve. By adolescence he was fluent in German, Italian and French. At 16 he became an assistant teacher, at 20 he opened his own school. Depending on mathematical journals borrowed from the local Mechanic's Institute, Boole struggled with Newton's 'Principia' and the works of French mathematicians Laplace and Lagrange.

4 George Boole (1815 – 1864) Boole's 1847 work, 'The Mathematical Analysis of Logic', expanded on Leibniz' earlier speculations on the correlation between logic and maths, and argued that logic was a discipline of mathematics, rather than philosophy.Leibniz' This paper won him the admiration of the logician Augustus de Morgan (a mentor of Ada Byron's), and a place on the faculty of Queen's in Belfast.Ada Byron Boole came up with a type of linguistic algebra, the three most basic operations of which are AND, OR and NOT. These three functions are the only operations necessary to perform comparisons or basic mathematical functions.

5 George Boole (1815 – 1864) Boole's system was based on a binary approach, processing only two objects - the yes-no, true-false, on-off, zero-one approach. Boole's systembinary approach, His two value system, separating arguments into different classes which can then be processed according to the presence or absence of a certain property, enabled any proposition - regardless of the number of individual items - to draw logical conclusions.

6 Boolean algebra - Propositions and Predicates The binary nature of logical propositions (True or False) means that Boolean algebra has applications in computing. A proposition is a statement which can be either true or false. Propositions can be represented by letters. Examples: 'p' stands for the proposition 'you are listening to this lecture' 'q' stands for the proposition '3 + 4 = 9'

7 Propositions and Predicates Negation The negation of proposition p is the proposition which is false when p is true, and true when p is false. We write the negation of p as p', -p, ~p, p, NOT p

8 Truth Tables We can draw up representations of the possible values of propositions p p’ OR pp’ TF10 TF10 FT01FT01 The binary digit representation is the accepted computer code for True (1) and False (0)

9 Predicates and propositions Predicates are like propositions - they can be either true or false - but differ in that they contain variables which prevent the T or F value from being determined right away. Example: 'X > 5' is a predicate because we need to know the value of X before we can determine whether the predicate is true or false. Once a value is assigned, X = 8, say, then the predicate becomes a proposition, 8 > 5, which is true. 'It is red' is a predicate, because we need to know what 'It' is, before we can determine whether the predicate is true or false. Conditions in selections (ifs) and repetitions (for loops) in programming are examples of predicates.

10 Boolean Operations (Logic operations) Propositions and predicates may be combined using Boolean operators AND OR and NOT to make logical operations. Examples 'p' stands for the proposition 'you are listening to this talk' 'q' stands for ' you are chewing gum' p AND q is a logic operation which stands for 'you are listening to this talk' and ' you are chewing gum'

11 AND Operator P(x) is a predicate which stands for x > 5 Q(y) is a predicate which stands for y = 8 P(x) AND Q(y) is a logic operation with P(x) and Q(y) as operands, and AND as operator P(x) AND Q(y) stands for 'x > 5 AND y = 8‘ We can often abbreviate to ‘P AND Q’

12 AND operator The AND operation can be defined by a truth table - using ^ as the symbol for AND : pq p ^ q 00 0 10 0 01 0 11 1 The AND operation is also known as the conjunction, logical product or intersection. We can write p^q, p.q, pq to mean p AND q.

13 OR Operator The OR operation can be defined by a truth table - using v as the symbol for OR : pq p v q 00 0 10 1 01 1 11 1 The OR operation is also known as the inclusive OR, logical sum or union. Also written as p+q, means p OR q

14 Inclusive or Exclusive OR. In everyday usage, OR has 2 possible meanings: OR can mean one or the other or both (inclusive OR) OR can mean one or the other, but not both (exclusive OR) Inclusive OR: To get a Masters degree you have to follow a postgrad programme or submit a thesis (You might do both) Exclusive OR: You are rich or you are poor (you can't be both) Our truth table above demonstrates inclusive OR Exclusive OR is also important in computing

15 Exclusive Or (EXOR) operation pq p EXOR q 00 0 10 1 01 1 11 0 That is, (p EXOR q) is true when p and q are different.

16 Equivalence (Match)  Operation pq p  q 00 1 10 0 01 0 11 1 That is, (p  q) is True when p is the same as q. Two operations are equivalent if they have the same truth table. For convenience, we use the = sign for cases where the equivalence operation is true, eg p = q means p  q.

17 Equivalence Example: Show that (NOT p ^ NOT q) is equivalent to NOT (p v q) Truth table: p q p’q’p’ ^ q’(p v q)(p v q)’ 0011 1 0 1 0110 0 1 0 1001 0 1 0 1100 0 1 0

18 Example Show that A + A’.B = A + B, using a truth table A B A’ A’.B A + B A + A’.B 0010 0 0 0111 1 1 1000 1 1 1100 1 1

19 Example Show that A + 1 = 1 and that A.1 = A A1A + 1A.1 11 1 1 01 1 0

20 Summary Propositions and predicates may be combined using logic operations such as negation (‘ ~ not), Union ( + v OR), intersection (^. AND) and Exclusive OR. We can test (and possibly simplify) these logic operations using truth tables.


Download ppt "Computer Organization 1 Logic and Boolean Algebra."

Similar presentations


Ads by Google