computer organization 1 logic and boolean algebra
TRANSCRIPT
![Page 1: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/1.jpg)
Computer Organization 1
Logic and Boolean Algebra
![Page 2: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/2.jpg)
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.
![Page 3: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/3.jpg)
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.
![Page 4: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/4.jpg)
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.
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.
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.
![Page 5: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/5.jpg)
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.
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.
![Page 6: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/6.jpg)
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'
![Page 7: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/7.jpg)
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
![Page 8: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/8.jpg)
Truth Tables
We can draw up representations of the possible values of propositions
p p’ OR p p’ T F 1 0
F T 0 1 The binary digit representation is
the accepted computer code for True (1) and False (0)
![Page 9: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/9.jpg)
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.
![Page 10: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/10.jpg)
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'
![Page 11: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/11.jpg)
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’
![Page 12: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/12.jpg)
AND operator The AND operation can be defined by a truth table -
using ^ as the symbol for AND : p q p ^ q 0 0 0 1 0 0 0 1 0 1 1 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.
![Page 13: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/13.jpg)
OR Operator The OR operation can be defined by a truth table -
using v as the symbol for OR : p q p v q 0 0 0 1 0 1 0 1 1 1 1 1 The OR operation is also known as the inclusive
OR, logical sum or union. Also written as p+q, means p OR q
![Page 14: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/14.jpg)
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
![Page 15: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/15.jpg)
Exclusive Or (EXOR) operation p q p EXOR q 0 0 0 1 0 1 0 1 1 1 1 0 That is, (p EXOR q) is true when
p and q are different.
![Page 16: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/16.jpg)
Equivalence (Match) Operation
p q p q 0 0 1 1 0 0 0 1 0 1 1 1 That is, (pq) 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.
![Page 17: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/17.jpg)
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)’
0 0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 0 0 0 1 0
![Page 18: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/18.jpg)
Example Show that A + A’.B = A + B, using a
truth table A B A’ A’.B A + B A + A’.B 0 0 1 0 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 0 0 1 1
![Page 19: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/19.jpg)
Example Show that A + 1 = 1 and that A.1
= A A 1 A + 1 A.1 1 1 1 1 0 1 1 0
![Page 20: Computer Organization 1 Logic and Boolean Algebra](https://reader036.vdocuments.net/reader036/viewer/2022082414/5697bf7b1a28abf838c83b97/html5/thumbnails/20.jpg)
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.