.he 'OVERVIEW''Page %'
.fo 'Steven Hardy'- % -'May 1978'
.ce 2
Overview of Computing in Cognitive Studies
==========================================
.ce 3
Steven Hardy
Cognitive Studies Programme
University of Sussex
.sp
The Cognitive Studies Programme
is engaged in teaching computing and Artificial Intelligence to undergraduates in the
School of Social Sciences.
The aim of this paper is to explain how and why this teaching differs
from the 'normal diet` for such students.
.sp
The equipment
.br
-------------
.br
The Cognitive Studies Laboratory has the following equipment:
.nf
 	PDP-11/40 central processor,
 	128K bytes of core memory,
 	15 Mbytes, of on-line disc memory
 	6 teletypewriters, and one VDU
.fi
We hope to add more 
VDUs and printers in the near future.
.sp
The computer is run under the UNIX operating system,
which makes available the following
high level
language systems:
.nf
 	C (a systems programing language),
 	FORTRAN,
 	BASIC,
 	SNOBOL,
 	POP11.
.fi
The language used by students is POP11,
a locally implemented dialect of POP2 (a list processing
language based on LISP and ALGOL).
.sp
The Cognitive Studies Programme
.br
-------------------------------
.br
The Programme offers a linked set of 'contextual` course to undergraduates
in the School of Social Sciences majoring in Philosophy and Psychology
(amongst other subjects).
The contextual courses are taken in parallel with major courses
and account for roughly 4/9 of the students time and final
assesment units.
This document concerns only the contextual courses
provided by the programme - the major courses being the
responsibility of the relevant 'subject group` (ie department).
After a common first year course
(providing a general introduction to
psychology, linguistics, philosophy and AI)
students in the Programme take two further
courses from the options:
.nf
 	Philosophy,
 	Psychology,
 	Linguistics,
 	Artificial Intelligence, Further Artificial Intelligence.
.fi
The options are two term courses, the first taken in the
students second year and the second in her final year.
It is the aim of the Programme to bring together these different approaches
to the study of mind.
.sp
Almost all students take the Artificial Intelligence course and, since
many of our students are majoring in Psychology (Developmental or Social)
few take the Psychology option.
.sp
A 'preliminary` course entitled 'Computers and Thought` is offered by
faculty in the Programme.
This course is available to almost any first year Arts student.
Additionally the programme undertakes substantial teaching of Science
undergraduates as part of an Arts/Science scheme.
Much of the material described in this document is relevant to these courses.
.sp
.tp 10
.sp
Teaching of Computing
.br
---------------------
.br
As part of the Artificial Intelligence Course and in the Computers and Thought
Course, we introduce students to simple computer programming. Our
aim is 
.ul
not
to turn them into computer scientists but rather to give them a comprehension
of the uses to which modern computers can be put. Since most people know
that computers can be used for "number crunching", we teach no numerical
analysis.  Indeed, the Computers and Thought Course is specifically designated
as an introduction to
.ul
non-numerical
programming.
.sp
.in +5
.ll -5
We regard programming to be concerned with the synthesis and analysis
of symbolic structures.
Since we are interested in understanding people our
symbolic structures are things like pictures, sentences, relationships
between objects etc.
We hope that by teaching programming we are teaching
problem solving skills (eg debugging of plans) of wide applicability.
Moreover we hope to teach new ways of expressing complex
theories (eg about perception) in a testable form (ie you can run them).
.in -5
.ll +5
.sp
LISP lists have been found an extremely useful symbolic data structure and much
of our teaching is oriented around list processing techniques. (Other than
TURTLE, see below, we teach virtually no array processing). In addition to drawing
on LISP we have made use of the ideas embodied in LOGO systems.
.sp2
Approximate Syllabus
.br
-------------------
.br
Most of our students have had little or no contact with computers before taking
our course.
(Very few have  studied mathematics beyond 'A` level).
This means that we must first overcome their fear of
computing and computers. We do this by first getting people to write TURTLE
programs. TURTLE is a package of functions providing the picture drawing primitives
of LOGO, for example:
.nf
.tp 6
 	: FUNCTION SQUARE(SIZE);
 	:	REPEAT 4 TIMES
 	:		DRAW(SIZE);
 	:		TURN(90);
 	:	CLOSE
 	: END;
 	: SQUARE(5);
 	: DISPLAY();
 	******
 	*    *
 	*    *
 	*    *
 	*    *
 	******
.fi
.sp
Students immediately understand this domain, leaving their minds
free to concentrate on learning the syntax of
POP11,
learning how to interpret error messages and how to debug simple
programs.
.sp
During this part of the course students learn to create and modify
disc files.
In addition to an advanced text editor available with the UNIX System,
we have implemented a simple line oriented editor similar to that of
most
LOGO
and
BASIC
systems.
We find that students can understand this type of editor
very quickly.
Many students
move on to the UNIX text editor after two or three months as it has
more facilities.
.sp
The majority of students become bored with drawing pictures
of houses, flowers etc (some think it a 'bit silly`) and
we start introducing them to techniques relevant to the design
of more complex programs - in our case programs that display
some 'intelligence`.
(This is not to say that our ideas about teaching programming are relevant
to such students alone.
General problem solving skills are useful to everyone.)
An early exercise in list processing is the writing
of a program to print out the words of a simple nursery rhyme:
.nf
.tp 8
 	: FUNCTION OLDMACVERSE(ANIMAL, NOISE);
 	:	[OLD MACDONALD HAD A FARM] =>
 	:	[EEYI EEYI OH] =>
 	:	[AND ON THIS FARM HE HAD A %ANIMAL%] =>
 	:	[EEYI EEYI OH] =>
 	:	[WITH A ^NOISE, ^NOISE HERE] =>
 	:	...
 	: END;
 	: OLDMACVERSE("COW","MOO");
 	** [OLD MACDONALD HAD A FARM]
 	** [EEYI EEYI OH]
 	** [AND ON THIS FARM HE HAD A COW]
 	** [EEYI EEYI OH]
 	** [WITH A MOO MOO HERE]
 	...
.fi
.sp
After these initial assignments students spend around two weeks
on more list processing exercises.
These introduce concepts like recursion, variables, results (of functions)
in connection with problems which are
.ul
easily
intelligible to our students.
An example is the writing of a function to sum a list of numbers.
.nf
.tp 22
 	: FUNCTION SUM(LIST);
 	:	IF	LIST = []
 	:	THEN	0
 	:	ELSE	HD(LIST) + SUM(TL(LIST))
 	:	CLOSE
 	: END;
 	: SUM([1 2 3 4 5]) =>
 	** 15
 	: TRACE SUM;
 	: SUM([1 2 3 4]) =>
 	>SUM [1 2 3 4]
 	!>SUM [2 3 4]
 	!!>SUM [3 4]
 	!!!>SUM [4]
 	!!!!>SUM []
 	!!!!<SUM 0
 	!!!<SUM 4
 	!!<SUM 7
 	!<SUM 9
 	<SUM 10
 	** 10
.fi
.tp 5
.sp
Most students next 'mini-project` is to do with simple arithmetic
- the oddity being that numbers are represented by their 'names`, that is
ONE TWO THREE
instead of their 'values` 1 2  and 3.
The rationale for this exercise is the observation that many children find it
easier (on the whole) to count up from a given number than to count down from a
given number. This is vaguely reminiscent of the way it is easier to find what
follows a given element in a list than to find what precedes a given element in
a list. In the NUMBERS exercise a global list of number names is kept, thus:
.nf
 	: VARS NUMBERS;
 	: [ZERO ONE TWO THREE FOUR FIVE SIX] -> NUMBERS;
.fi
Students write functions to find the successor of a given number, to count the number of
things in a given set and eventually to add two numbers, for example:
.nf
 	: SUCCESSOR("THREE") =>
 	** FOUR
 	: COUNT([APPLES ORANGES BANANAS]) =>
 	** THREE
 	: ADD("TWO","FIVE") =>
 	** SEVEN
.fi
.sp
If nothing else, this exercise gives students greater awareness of the difficulties
young school children face in learning simple arithmetic.
One extension of this mini-project is to write a program to convert a 'verbal`
number name to an integer, for example:
.nf
 	: CONVERT([TWO HUNDRED AND TWENTY SEVEN]) =>
 	** 227
.fi
.sp
At this stage of the course, students are free to choose between a number of
projects. A representative example of this is generating nonsensical
sentences from some simple grammar, for example:
.nf
.tp 3
 	: FUNCTION ARTICLE();
 	:	ONEOF([A THE ANOTHER])
 	: END;
.tp 3
 	: FUNCTION ADJECTIVE();
 	:	ONEOF([BIG RED HAPPY SHINY])
 	: END;
.tp 3
 	: FUNCTION NOUN();
 	:	ONEOF([MAN GIRL LORRY GOAT])
 	: END;
.tp 6
 	: FUNCTION QUALIFIEDNOUN();
 	:	IF	ONEOF([HEADS TAILS]) = "HEADS"
 	:	THEN	NOUN();
 	:	ELSE	[%ADJECTIVE(), QUALIFIEDNOUN()%]
 	:	CLOSE
 	: END;
.tp 3
 	: FUNCTION NOUNPHRASE();
 	:	[%ARTICLE(), QUALIFIEDNOUN()%]
 	: END;
.tp 3
 	: FUNCTION VERB();
 	:	ONEOF([LIKED KICKED [SMILED AT] [RAN OVER]])
 	: END;
.tp 3
 	: FUNCTION SENTENCE();
 	:	[%NOUNPHRASE(), VERB(), NOUNPHRASE()%]
 	: END;
.tp 5
 	: SENTENCE() =>
 	** [[THE [BIG MAN]] [SMILED AT] [THE [HAPPY GIRL]]]
 	: SENTENCE() =>
 	** [[THE [SHINY [RED GIRL]]] [RAN OVER]
 		[THE [HAPPY LORRY]]]
.fi
.tp 5
This exercise invites many extensions.
For example, could one alter the program to produce only
sensible sentences.
Or again, could one write a program to take input like the following list:
.nf
 	** [THE SHINY RED GIRL RAN OVER THE HAPPY LORRY]
.fi
which inserted the 'missing` brackets
(ie parse the sentence).
This might be the first step in writing a program to
'understand` such sentences.
.sp
A second project concerns the use of the DATABASE package. This package provides
a facility for storing "facts" and retrieving stored facts on a pattern
matching basis, for example
.nf
 	: ADD([HAIR STEVE BROWN]);
 	: ADD([SEX STEVE MALE]);
 	: LOOKUP([HAIR ?WHO BROWN]);
 	: WHO =>
 	** STEVE
.fi
The call of LOOKUP in this example corresponds to asking the question "who has brown
hair?". Those familiar with PLANNER-like languages will recognise some
aspects of those languages in this package. Having learnt the primitives of the 
DATABASE package, students can attempt a BLOCKSWORLD exercise. In this exercise a
small world of blocks on a table is simulated by assertions in the DATABASE, e.g.
.nf
 	: ADD([COLOUR B1 RED]);
 	: ADD([SIZE B1 LARGE]);
 	: ADD([B1 ISA CUBE]);
 	: ADD([ON B1 TABLE]);
 	: ADD([ON B2 B1]);
.fi
The task here is to write functions to identify blocks in the scene (for example
print the names of all big red pyramids) or to perform actions, for example:
.nf
.tp 9
 	: FUNCTION BIG_RED_PYRAMIDS();
 	:	VARS NAME;
 	:	FOREACH [?NAME ISA PYRAMID]
 	:	THEN	IF	PRESENT([COLOUR ^NAME RED])
 	:			AND	PRESENT([SIZE ^NAME LARGE])
 	:		THEN	NAME =>
 	:		CLOSE
 	:	CLOSE
 	: END;
.tp 6
 	: FUNCTION PICKUP(BLOCK);
 	:	CLEARTOP(BLOCK);
 	:	EMPTYHAND();
 	:	MOVEHANDTO(BLOCK);
 	:	GRASP();
 	: END;
.tp 6
 	: FUNCTION CLEARTOP(BLOCK);
 	:	VARS PEST;
 	:	FOREACH [?PEST ON %BLOCK%]
 	:	THEN	GETRIDOF(PEST)
 	:	CLOSE
 	: END;
.tp 5
 	: FUNCTION GETRIDOF(BLOCK);
 	:	PICKUP(BLOCK);
 	:	MOVEHANDTO("TABLE");
 	:	UNGRASP();
 	: END;
.fi
Students are expected to provide their own definitions of the BLOCKSWORLD
primitives GRASP, MOVEHANDTO etc. These primitives work by altering
the DATABASE of stored assertions.
.sp2
More advanced projects are undertaken by students on the Artificial Intelligence
Course. These projects include programs to converse in a subset of
English, programs to recognise what has been drawn in a TURTLE picture,
programs to produce plans for simple goal directed robots etc.
.sp2
.tp 10
The Demos Library
.br
-----------------
.br
The UNIX system provides powerful text processing programs and we make
extensive use of these programs to produce demonstration handouts
('demos` for short)
for students to read.
(This document is itself a demo of a kind).
.sp
This handouts take the place of a conventional textbook
or reading list - and have
.ul
considerable
advantages over a text book.
For example, they are easily modified in the light of student comments.
More importantly, they need not be read in any fixed order.
Many demos start by citing other demos as suggested prerequisite reading
and end by suggesting which demos could be read next.
There is no expectation that students should complete all handouts.
