Transcript Logic Intro
Great Ideas
Alan Turing –
What is computable?
A task is computable if one can specify a sequence of
instructions which when followed will result in the completion of
the task.
John Von Neumann –
Stored program concept
Developed the concept of storing a program in the computer’s
memory rather than it’s circuitry
Copyright © 2008 by Helene G. Kershner
Great Ideas
Technological advances
Vacuum tube transistor integrated circuits (multiple
transistors on a chip) VLSI (very large scale integration)
Microprocessor chip – computer on a chip
High level programming language – people can build “user
friendly” software”
Changes in memory device hardware
Storing information digitally, making use of the concept
that computers work with two states: on/off, 1/0, yes/no,
high current/low current
The computer is a binary machine
Copyright © 2008 by Helene G. Kershner
Great Ideas
The computer is a binary machine
Perform mathematics
Perform operations on letters that form words
Represent images in grayscale and color
Represent sound
Copyright © 2008 by Helene G. Kershner
The computer is a binary machine
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
An algebra for symbolically representing problems in
logic & analyzing them mathematically
Based on work of George Boole
English mathematician
An Investigation of the Laws of Thought
Published in 1854
Reduced logic of human thought to mathematical operations
An analysis of how natural language works if it were
logical
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
In 1938 Claude E. Shannon of MIT
Showed that Boolean logic could be applied to the design of
relay networks in telephone systems (the ability to switch
signals from one place to another automatically)
Invented branch of mathematics called Information
Theory
Applied Boolean algebra to certain engineering
problems systems
Today, boolean algebra, as applied to computer logic
design is also known as switching theory.
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Boolean Logic is an abstraction.
Definition -- Abstraction:
Is the process of taking away or removing characteristics
from something in order to reduce it to a set of essential
characteristics (Whatis.com)
not concrete: not relating to concrete objects but
expressing something that can only be appreciated
intellectually (Encarta.msn.com)
Considered apart from concrete existence: an abstract
concept (www.thefreedictionary.com)
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Computer are very complex
Designing hardware and software is very complicated
Abstraction allows the designer to be separated from the
machine to get a clearer picture of what needs to be done.
allows us to drive a car without knowing how the engine works
allows computer users to work with the hardware without
knowing exactly how the machine does what it does.
Add a flash stick, the software will recognize it
Plug in a digital camera and the software will find it
Move music onto my iPod from the hard-drive without having any
real idea what the computer is doing.
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Basic Computer Components
Switches
On/off, high current / low current, 1/0
Connectors
Wires that connect switches – pipes
Must be able to branch, one or more paths
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Logic Gates
Hardware interpretation of boolean logic
Universal building blocks
AND
OR
NOT
From these basic elements, we can design anything
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Different and equal ways to represent this kind
of logic
Using the English works
AND, OR, NOT
Using Mathematical symbols
Λ, ۰
V, +
~, ¯
(means AND)
(means OR)
(means NOT)
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Different and equal ways to represent this kind of logic
Engineering symbols
inverter
http://www.ee.surrey.ac.uk/Projects/Labview/gatesfunc/index.html#andgate
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Logic can be applied to statements.
Statements have the property of either being True (T, 1)
or False (F, 0).
Not everything we say is a statement because it cannot
be thought of as having the value of either True or
False.
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Look at statements that can be determined to be true or
false.
I think therefore I am.
Yesterday my daughter in college called needing money.
This can be either true or false
My son lives in Washington DC.
This can be either true or false
This can also be either true or false
Bozo the Clown will be the next president.
This too can be true or false
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Look at statements that cannot be to be true or false.
A Question is not a statement:
While an answer to a question may be Yes or No, the statement is
neither true or false: Is it 3 o’clock?
A command is not a statement:
What time is it?
You MUST get an A in this class!
Turn at the next corner.
Wishes are not statements:
I’d like to make a million dollars.
Have a Happy Thanksgiving.
http://www.informatik.htw-dresden.de/~nestleri/logic/01/index.html
Copyright © 2008 by Helene G. Kershner
Boolean Logic / Boolean Algebra
Different and equal ways to represent this kind of logic
Truth Tables
Visually shows true/false values and the results (inputs
and outputs) of a logic example.
Describes what is happening in a logic gate or logic
statement
Uses T/F, 1/0
Copyright © 2008 by Helene G. Kershner
Logic -- AND
AND combines two statements/inputs either one of which
can be True or False
A statement using AND is only true if both parts of the sentence
are true
I like ice cream AND chocolate.
Hillary Clinton AND Barak Obama are running for president.
Copyright © 2008 by Helene G. Kershner
Logic -- AND
I like ice cream AND chocolate.
Truth table identifies the possibilities for AND:
I like ice cream AND I like chocolate Result
F
F
F
F
T
F
T
F
F
T
T
T
Copyright © 2008 by Helene G. Kershner
Logic -- AND
A: I like ice cream
B: I like chocolate
A AND B
F
F
F
T
T
F
T
T
Result
F
F
F
T
A AND B
0
0
0
1
1
0
1
1
R
0
0
0
1
Copyright © 2008 by Helene G. Kershner
Logic -- AND
A: John likes apples
B: Joe likes grapes
A AND B
0
0
0
1
1
0
1
1
R
0
0
0
1
0
0
0
0
1
0
1
0
0
1
1
1
Copyright © 2008 by Helene G. Kershner
Logic -- AND
In English as in logic more than two things can be ANDed
together.
Hillary Clinton AND Barak Obama AND John Edwards are running for
President – for this statement to be True, all parts must be True
Hillary AND Barak AND John Result
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
ABC R
000 0
001 0
010 0
011 0
100 0
101 0
110 0
111 1
Copyright © 2008 by Helene G. Kershner
Logic – OR
OR combines two statements/inputs either one of which
can be True or False
A statement using OR is true if either parts of the
sentence is true.
I like mango OR chocolate ice cream.
In yesterday’s primary, as a democrat I could choose
Barak Obama OR Hillary Clinton for president.
Copyright © 2008 by Helene G. Kershner
Logic – OR
In yesterday’s primary, as a democrat I could choose
Barak Obama OR Hillary Clinton for president.
Truth table identifies the possibilities for OR:
I like ice cream OR I like chocolate Result
F
F
F
F
T
T
T
F
T
T
T
T
Copyright © 2008 by Helene G. Kershner
Logic – OR
A: I voted for Barak
B: I voted for Hillary
A OR B
F
F
F
T
T
F
T
T
Result
F
T
T
T
A OR
0
0
1
1
B R
0 0
1 1
0 1
1 1
Copyright © 2008 by Helene G. Kershner
Logic – OR
A: I voted for a Democrat
B: I voted for a Republican
A OR
0
0
1
1
B R
0 0
1 0
0 0
1 1
0
0
0
0
1
1
1
0
1
1
1
1
Copyright © 2008 by Helene G. Kershner
Logic – OR
In English as in logic more than two things can be ORed
together.
Yesterday I voted for Hillary Clinton OR Barak Obama ORJohn
McCain for President – for this statement to be True, one of
the parts must be True.
Hillary AND Barak AND John Result
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
1
1
1
1
1
ABC R
000 0
001 1
010 1
011 1
100 1
101 1
110 1
111 1
Copyright © 2008 by Helene G. Kershner
Logic – NOT/Invert
A
NOT
R
The NOT command, flips or Inverts the value it is given.
The operation switches that statement between True and
False
I am a liberal Democrat. I will NOT vote for John McCain
NOT John McCain is the INVERT or opposite of John McCain
A = I eat peanut-butter
NOT A means I do NOT eat peanut-butter
If A is True, then NOT A is False
If A is False, then NOT A is True
A = I love peanut-butter
For me A is False, so NOT A would be True
Logic – NOT/Invert
Truth Table
A NOT A = ~A
0
1
1
0
A
NOT
R
Logic Symbols – Order of Operations
Order of Operations: In a logic statement using the three
operators we have learned the order is
Parenthesis ()
NOT NOT, ~ ¯¯
AND AND, ۰, Λ
OR OR, +, V
Logic
Logic problems can relate back to English statements:
A newly constructed building has three types of security alarms. It has
an intrusion alarm, a fire alarm and a flood alarm. If the intrusion or
fire alarm goes off then the police department is called. If the fire or
flood alarm goes off then the fire department is called. But if the
flood alarm goes off don’t call the police. And if the intrusion alarm
goes off don’t call the fire department.
A = intrusion alarm
A OR B = Police
B = fire alarm
C = flood alarm
B OR C = Fire Department