Foundations of Computing Professor Steve Schneider 30BB02 Course - - PowerPoint PPT Presentation
Foundations of Computing Professor Steve Schneider 30BB02 Course - - PowerPoint PPT Presentation
Foundations of Computing Professor Steve Schneider 30BB02 Course Structure Two lectures per week One tutorial per week (exercise sheets) Mathematics Surgeries: Room 44BB02, Wednesdays 10am. Course material posted on CS189
Course Structure
Two lectures per week One tutorial per week (exercise sheets) Mathematics Surgeries:
Room 44BB02, Wednesdays 10am.
Course material posted on CS189 website. Assessment: Entirely by examination. Everything covered in lectures and tutorials is
examinable.
Course Structure
Monday 3pm: lecture Wednesday 9am: lecture (not week 1) Tuesday 2pm: tutorial (not weeks 1, 2, or 4. I n
week 4, the tutorial will be on Wednesday)
to go through the previous week’s exercise sheet. Bring your solution to the previous week’s exercise sheet; it will be
- marked. Marks do not count towards the final assessment.
Office hours: Monday 4pm and Wednesday 10am.
Sign up for an appointment.
Maths surgery: Wednesday 10am in 44BB02
Foundations of Computing Course Content
Set theory
Sets, relations, functions
Logic
Propositions, truth tables, logical reasoning,
predicates
The Z notation
Use of logic and set theory in specification
Number representations
Representation of values in a computer Dr Roger Peel – weeks 11 and 12
Recommended texts
E Currie: The Essence of Z,
Prentice Hall, (1999), ISBN 0-13-749839-X
R Haggarty: Discrete Mathematics for Computing,
Pearson Education, (2002), ISBN 0-201-73047-2L
Bottaci & J Jones: Formal Specification Using Z.
Thompson, (1995), ISBN 1-850-32109-4
Other background texts
Ben Potter, Jane Sinclair, David Till: An Introduction to
Formal Specification and Z, (Prentice Hall) ISBN 0-13-242207-7
Mike McMorran, Steve Powell: Z Guide for Beginners,
(Blackwell) ISBN 0-632-03117-4
Jim Woodcock and Jim Davies: Using Z, Specification and
Refinement, (Prentice Hall) ISBN 0-13-948472-8
Keith Devlin: Sets Functions and Logic (Chapman Hall), ISBN
1-5848-8449-5
Keith Hirst: Numbers Sequences and Series, (Edward Arnold)
ISBN 0-340-61043—3
Judith Gersting: Mathematical Structures for Computer
Science, (Freeman) ISBN 0-7167-8306-1
Daniel Velleman: How to prove it, (Cambridge University
Press) ISBN 0-521-44116-1
Using the voting handset
Do not press this button or you will not be able to vote To vote, press
- ne of these
buttons FIRMLY and watch the small light (goes green on successful vote) Note: you can
- nly vote when
the green ‘polling
- pen’ indicator is
projected in the top-right of the screen
Sim ulation only
Did you have breakfast today?
Y e s N
- D
- n
’ t k n
- w
0% 0% 0%
1.
Yes
2.
No
3.
Don’t know
0 of 5
Are you familiar with sets and logic?
Y e s , v e r y A l i t t l e N
- t
a t a l l
0% 0% 0%
1.
Yes, very
2.
A little
3.
Not at all
Do you know about truth tables?
Y e s I d i d , b u t I ’ v e f
- r
g
- t
. . . N
- 0%
0% 0%
1.
Yes
2.
I did, but I’ve forgotten them
3.
No
Do you know about power sets and cartesian products?
Y e s I d i d , b u t I c
- u
l d d
- w
i . . N e v e r h e a r d
- f
t h e m
33% 33% 33%
1.
Yes
2.
I did, but I could do with some revision
3.
Never heard of them
Do you know about Karnaugh maps?
Y e s N
- 0%
0%
1.
Yes
2.
No
Have you come across boolean algebra?
Y e s N
- 0%
0%
1.
Yes
2.
No
Motivation
Logic is the foundation of computing. The ability to think and reason logically
is essential in Computing.
Humans are not always very good at
thinking logically.
Thus: formal and systematic ways of
handling logic are necessary.
This lecture
Some exercises and discussion in logical
thinking.
Example 1: quality control
You work in quality control at a games
manufacturer.
A game contains cards with letters on
- ne side and numbers on the other.
They must be printed according to the
rule: If one side has a vowel, the other side must have an even number
Example 1: quality control
You have 4 cards in front of you. Which
cards do you need to turn over to check the rule is being followed? If one side has a vowel, the other side must have an even number
A B C D
Which cards do you need to turn
- ver to check the rule is being
followed?
A C A a n d B A a n d C A a n d D B a n d C A , C a n d D A , B , C , a n d D S
- m
e
- t
h e r c
- m
b i n a t i
- n
0% 0% 0% 0% 0% 0% 0% 0% 0%
1.
A
2.
C
3.
A and B
4.
A and C
5.
A and D
6.
B and C
7.
A, C and D
8.
A, B, C, and D
9.
Some other combination
Example 2: law enforcement
You work in law enforcement. A law states that anyone buying alcohol
in a bar should be at least 18 years old.
Example 2: law enforcement
You have 4 customers in front of you. You can question up to 2 of them.
A: buying a beer B: buying a coke C: a 21 year old D: a 17 year old
Which customers should you question to check the rule is being followed?
A B C D A a n d B A a n d C A a n d D B a n d C
0% 0% 0% 0% 0% 0% 0% 0%
1.
A
2.
B
3.
C
4.
D
5.
A and B
6.
A and C
7.
A and D
8.
B and C
Logical structure
What can we say about the logical
structure of examples 1 and 2?
Example 3: genealogy
You are trying to trace your great-
great-grandfather and you are looking through the records at the Family Records Office.
You have spoken to Aunt Gladys and
Uncle Alan
Your sister has spoken to Grandma
Example 3: genealogy Aunt Gladys and Uncle Alan
Aunt Gladys: He was born in Halifax or
married in Derby.
Uncle Alan: He was married in Derby or he
died in Skipton.
Gladys and Alan together: He was born in
Halifax or married in Derby, AND he was married in Derby or died in Skipton.
Example 3: genealogy: Grandma Carol
Grandma Carol: He was either married
in Derby, or he was born in Halifax and died in Skipton.
Whose information narrows it down more: Gladys&Alan, or Carol?
0% 0% 0% 0% 0%
1.
Gladys & Alan
2.
Carol
3.
Neither - they are just different
4.
They are the same.
5.
No idea
Example 4: truth and lies
Consider two kinds of people: truth
tellers who always tell the truth, and liars who never tell the truth.
Alice says: “If you asked Bob, he would
say that I am a liar.”
What can you deduce?
0% 0% 0% 0% 0%
Alice says: “If you asked Bob, he would say that I am a liar.”
1.
Alice is a truth teller
2.
Alice is a liar
3.
Bob is a truth teller
4.
Bob is a liar
5.
You can’t deduce anything
Summary
Logical reasoning is not always easy or
intuitive.
Treating logic and logical thinking in a