# Logic

advertisement
Key Stage 3 lessons for the terrified
BOOLEAN LOGIC
TEACHER OVERVIEW
Boolean Logic is a branch of Mathematics term commonly used in computing. It models how
elements work together. Created by George Boole, an English mathematician, it is heavily used in
the algebra of sets
In most cases of Boolean Logic we consider a system that has one or two inputs. These inputs can
be in one of two states, true or false. This is a binary system and has its equivalence in how
computers work with electricity, to have power turned off or power turned on. These two states are
normally associated with 0 and 1s.
Another use of Boolean logic is when considering how searches are completed. However the latest
versions of many search engines have negated the need to add logic terms to searches, although this
is explored in the beginning of the lesson.
It is quite an intellectual exercise to get learners to think about how electrical circuits can be used to
process binary. How ‘dumb’ circuits can be created to add numbers together and the relation to
how real computers work. There has to be careful progression to get to a meaningful end.
Learners should have been taught about Binary numbers and how these can be added together
before they tackle this lesson.
Process:



What do AND, OR and not mean?
How do computer circuits process binary – the AND, OR and NOT gates?
Creating a half adder circuit
RESOURCES
https://slp.somerset.gov.uk/cypd/elim/somersetict/Computing_curriculum_ks3_ks4/Forms/AllItems
.aspx?RootFolder=%2fcypd%2felim%2fsomersetict%2fComputing%5fcurriculum%5fks3%5fks4%2fLo
gic%20Gates&amp;FolderCTID=&amp;View=%7bE4E979BE%2d3409%2d4D54%2d8C10%2d8AC50A7F76E8%7d
These include:
Logic Presentation
Logic Worksheet
Large Logic Cards
PowerPoint can be used throughout the lesson
Worksheet for recording results
A4 Cards with logic gates
Key Stage 3 lessons for the terrified
Load the PowerPoint presentation logic
Show the second slide and ask them a question ‘Does a
computer think?’
You should get some interesting answers
and you should spend some time
exploring these.
Some can be quite philosophical and are
worth taking the time to discuss quite
widely.
If you are really interested then do some
research on the Turing Test –which is the
accepted test to see if a machine exhibits
intelligent behaviour.
Now ask – if a machine can add two numbers is it
intelligent? (Slide 3)
How much human intervention does there have to be.
State that we have learnt that every computer must
use binary number and that they have previously learnt
how to add binary numbers together.
Maybe do a couple of sums to remind them how this
was completed.
Circuits within a computer are designed to work binary
numbers in a logical fashion to complete tasks.
Before we work with binary numbers let’s have a look
at some logic statement and see if we can find out how
these work.
Show slide 4 and get them to complete the three
different searches recording the number of sites that
are found in the search.
First search - One
Second search – Direction
Third Search – One Direction
When we put in One AND Direction we got a better
result.
We used logic to complete the search.
In fact, computers are inherently stupid –
it is the way in which they are
programmed that make them appear
intelligent.
Key Stage 3 lessons for the terrified
This time get them to complete this search
One Direction –Harry Styles
and look at the number of results.
What do we think the – does
It is in fact a NOT and therefore should only display the
pages about One Direction that have no reference to
Harry Styles in them
Computers are quite happy to work with this type of
logic and there three basic logic gates that they use
The – means Not and should mean that
the websites displayed have no reference
to Harry Styles
They are called gates because the accept
input which they then process and then
allow these to be output
AND, OR and NOT
To further illustrate how these logic gates can work let
us pretend that we are the manager of a nightclub.
One of the issues is the ratio of females to males in the
night club, we would like this to be as even as possible,
and there are normally too many men. Unfortunately
we have hired stupid bouncers and have to give them
precise instructions to control the gender of the people
that are allowed in.
Select 3 bouncers for the class. Give each one a AND,
OR or NOT card to represent a logic gate.
Now select three pairs of learners: one pair should be
both girls, the second a boy and a girl, the third both
boys. Give the girls a card with a 1 and the boys a card
with a zero.
At the beginning of the evening the manager wants
only girls to come so he uses his AND bouncer.
Only if person one is female AND person two is female
will he allow them to come in.
Let the learners demonstrate this.
Later on in the evening the ratio of male to female
becomes better so the manager relaxes the rule a little
and lets the OR bouncer take charge (The manager
must not allow too many males in).
Only if person one is female OR person two is female
will he allow them in.
Let the learners demonstrate this.
The transistors on a semiconductor chip
are constructed to allow electricity to run
through them according to the inputs they
receive.
Some transistors act as AND gates, others
as OR or NOT gates.
There are in fact other types of gate called
NAND and NOR which reverse the outputs
from AND and OR gates.
Chips can have over a billion transistors on
them.
Key Stage 3 lessons for the terrified
There is one bouncer who has yet to do any work, the
NOT bouncer. Now we have saved him to last as he
only works with one person at a time, but what he does
is special – he changes the sex of anyone who gets past
him. Does anyone want to try?
The presentations slides 7, 8 and 9 demonstrate this
All computers use these three basic logic gates for all
the work they complete.
They help because the make decisions easy based on
whether inputs are true or false, 0 or 1.
Let’s run the slides again this time with 0 and 1 on the
people
Slides 10, 11 and 12
Now get them to fill in the truth tables on the
worksheets we the correct numbers
Slides 13 - 25 show the correct answers.
The question is how we use the logic gates to add
numbers together.
Let’s consider the simplest job adding two binary digits
together.
We should get the answer shown on slide 26.
Why does 1 + 1 = 10 and not 2
Slide 27 show a series of logic gates placed together in
a circuit
We are going to fill in Truth table as shown on the
worksheet. He table looks like this Slide 28
Let’s trace the path thought the circuit. Slide 29.
Put the number 0 and 0 into A and B of the first row.
Click through the slide getting the learners to guess
what is going to happen at each logic gate and filling in
the columns as you go.
The correct Truth Table is shown on slide 30
You can either then lead them thorough the next pair
of number using slide 31 or let them have a go.
This is true for all the next slides 31-36
Then show the last slide
This part is difficult for many of the
learners and according to their ability you
should either lead them through this very
slowly or let them complete some of the
exercises