ERRORS IN CHILDRENS SUBTRACTION          Benedict du Boulay May 1985
                                         (updated January 1986, December 1986)      

The objective of this teach file is to illustrate how production rules can be
used to model children's subtraction behaviour.  The associated library file
implements a system substantially similar (though not quite identical) to that
described in Young and O'Shea "Errors in Children's Subtraction", Cognitive
Science, 5, 2, 153-177.

You should be familiar with TEACH, TEACH VED and TEACH VEDPOP before starting
on this file.

You should first read the Young and O'Shea article carefully.  The article
explains much of what you need to know about production systems in order to do
the exercises in this teach file. Figure 2 of this article describes a
production system that will cope successfully with subtraction sums so long as
the top number (minuend) has the same number of digits as the bottom number
(subtrahend) and is larger than it.

A. RUNNING THE SYSTEM

To run the system you must first load the library program by, for example,
typing:

    lib subtract;

This will compile a special version of one of the standard POPLOG production
system interpreters (PRODSYS) as well as the production rules mentioned in the
article and their associated actions.

To run the system it is necessary to choose the digits for the subtraction
sum and the particular rules you wish to use.  The function which makes things
happen is called try and takes 3 arguments as follows:

    try([7 4],[2 8],[fd b2a bs1 bs2 cm in nxt ts wa done b2c ac]);

The first list is the minuend, the second is the subtrahend and the third is
the list of productions from the article, using the same names as Young and
O'Shea.  Notice that the production names are all in lower-case.  Also the
order of ts and nxt are interchanged compared to the article to make this
system run more like that described by the authors.

If you execute the line above (say by marking it and CONTROL-Ding it) you will
be given a blow by blow account showing how the rules fire, how working memory
changes and what the child's paper looks like at each stage.

B. OUTPUT FROM THE SYSTEM

The following is what the system outputs when you execute the line above.  My
comments on this output are surrounded in $$ signs (they are not part of the
output!).

The production rules available are:
[fd b2a bs1 bs2 cm in nxt ts wa done b2c ac]
PAPER:                                  $$ The initial state of the paper $$
     *
  7  4
  2  8
------
WORKING MEMORY:
[processcolumn]                         $$ The initial state of the working
USING RULE:in                              memory $$
[processcolumn]=>readmands ( ) ;        $$ The rule which is about to fire $$

PAPER:
     *
  7  4
  2  8
------
WORKING MEMORY:
[s 8][m 4][processcolumn]
USING RULE:cm
[m ? m][s ? s]=>compare ( ) ;           $$ Young and O'Shea indicate
                                           undecomposable functions with a
PAPER:                                     * e.g. *Compare.  I have used a
     *                                     a pop11 function compare() $$
  7  4
  2  8
------
WORKING MEMORY:
[s greater m][s 8][m 4][processcolumn]
USING RULE:b2a
[s greater m]=>assert ( [ borrow ] ) ;    $$ Young and O'Shea indicate things
                                             to be inserted in the database by
PAPER:                                       terms such as Borrow, here they
     *                                       are shown as assert([borrow]) $$
  7  4
  2  8
------
WORKING MEMORY:
[borrow][s greater m][s 8][m 4][processcolumn]
USING RULE:bs2                   
[borrow]=>decrement ( ) ;

PAPER:
     *
  6  4                                          $$ notice the decrementing $$
  2  8
------
WORKING MEMORY:
[borrow][s greater m][s 8][m 4][processcolumn]
USING RULE:bs1                   
[borrow]=>addtentom ( ) ;

PAPER:
     *
  6 14                                          $$ notice the adding 10 $$
  2  8
------
WORKING MEMORY:
[borrow][s greater m][s 8][m 4][processcolumn]
USING RULE:fd
[m ? m][s ? s]=>assert ( [ nextcolumn ] ) ; assert ( [ finddiff ] ) ;

PAPER:
     *
  6 14
  2  8
------
WORKING MEMORY:
[finddiff][nextcolumn][borrow][s greater m][s 8][m 4][processcolumn]
USING RULE:ts                    
[finddiff]=>takeabsdiff ( ) ;

PAPER:
     *
  6 14
  2  8
------
WORKING MEMORY:
[result 6][finddiff][nextcolumn][borrow][s greater m][s 8][m 4][processcolumn]
USING RULE:wa
[result ? x]=>write ( x ) ;

PAPER:
     *
  6 14
  2  8
------
     6
WORKING MEMORY:
[result 6][finddiff][nextcolumn][borrow][s greater m][s 8][m 4][processcolumn]
USING RULE:nxt                   
[nextcolumn]=>assert ( [ processcolumn ] ) ; shiftleft ( ) ;

PAPER:
  *                                     $$ the * indicates which column is
  6 14                                     being worked on $$
  2  8
------
     6
WORKING MEMORY:
[processcolumn][result 6][finddiff][nextcolumn][borrow][s greater m][s
     8][m 4][processcolumn]
USING RULE:in                            $$ In many psychological models the                   
[processcolumn]=>readmands ( ) ;          working memory is limited to 7 or so
                                          items.  There is no limit here $$
PAPER:
  *
  6 14
  2  8
------
     6
WORKING MEMORY:
[s 2][m 6][processcolumn][result 6][finddiff][nextcolumn][borrow][s greater
     m][s 8][m 4][processcolumn]
USING RULE:cm
[m ? m][s ? s]=>compare ( ) ;

PAPER:
  *
  6 14
  2  8
------
     6
WORKING MEMORY:
[s less m][s 2][m 6][processcolumn][result 6][finddiff][nextcolumn][borrow][s
     greater m][s 8][m 4][processcolumn]
USING RULE:fd                    
[m ? m][s ? s]=>assert ( [ nextcolumn ] ) ; assert ( [ finddiff ] ) ;

PAPER:
  *
  6 14
  2  8
------
     6
WORKING MEMORY:
[finddiff][nextcolumn][s less m][s 2][m 6][processcolumn][result 6][finddiff][
    nextcolumn][borrow][s greater m][s 8][m 4][processcolumn]
USING RULE:ts
[finddiff]=>takeabsdiff ( ) ;

PAPER:
  *
  6 14
  2  8
------
     6
WORKING MEMORY:
[result 4][finddiff][nextcolumn][s less m][s 2][m 6][processcolumn][result
     6][finddiff][nextcolumn][borrow][s greater m][s 8][m 4][processcolumn
    ]
USING RULE:wa                    
[result ? x]=>write ( x ) ;

PAPER:
  *
  6 14
  2  8
------
  4  6
WORKING MEMORY:
[result 4][finddiff][nextcolumn][s less m][s 2][m 6][processcolumn][result
     6][finddiff][nextcolumn][borrow][s greater m][s 8][m 4][processcolumn
    ]
USING RULE:nxt                   
[nextcolumn]=>assert ( [ processcolumn ] ) ; shiftleft ( ) ;

PAPER:
  6 14                            $$ shifting left in the last column forces
  2  8                               [nomore] to be asserted into the WM $$
------
  4  6
WORKING MEMORY:
[nomore][processcolumn][result 4][finddiff][nextcolumn][s less m][s 2][m
     6][processcolumn][result 6][finddiff][nextcolumn][borrow][s greater
     m][s 8][m 4][processcolumn]
USING RULE:done
[nomore]=>halt ( ) ;

It is possible to cut down the output to just the rules used and the final
state of the child's paper by setting a variable called chatty to false before
executing the above line.  This can be achieved by typing:

    false -> chatty;

This is all you get in this mode:

The production rules available are:
[fd b2a bs1 bs2 cm in nxt ts wa done b2c ac]
     *
  7  4
  2  8
------
in cm b2a bs2 bs1 fd ts wa nxt in cm fd ts wa nxt done
  6 14
  2  8
------
  4  6

To get the system to be verbose again, set chatty to true before running try,
by:

    true -> chatty;

C. MODELLING CORRECT AND INCORRECT BEHAVIOUR

By running the system with different rules it is possible to mimic various
sorts of children's errors.  Your main task is to try out various lists of
production rules on a variety of sums and see whether the system conforms to
your own expectations of what children do and to the article by Young and
O'Shea.

(i) Try out the system as above and reconcile its output with the description
of the system on pages 160-161.

(ii) Try out the production system above with a variety of sums.  It ought to
be able to cope with more than two columns.  However if you are awkward you
can probably make the system break.  Keep a record of all the ways are able to
make the system come to a halt with a mishap message.

(iii) You can make the system do subtraction by equal additions rather than by
decrementing by using rule bs3 in place of bs2, see page 162.  Try this out.

(iv) The conflict resolution method used in the production system is not quite
the same as that described by Young and O'Shea.  What are the differences?

(v) Page 163 describes various kinds of common error which can be exhibited
by making changes to the basic production system as shown in table 2 of the
article.  Make up sums to show off all the different kinds of error.  Keep
records of what you have done and also of any unexpected behaviour from the
system.  Note that production rule nnn (from figure 4 and table 2) has not
been implemented so you cannot produce the final bug in table 2.

D. FURTHER EXPERIMENTS

Young and O'Shea tried to explain data from a paper by Brown and Burton.  To
do this they needed to expand the original production system a little.  This
was because in the original system the act of "decrementing" is carried out as
an action on the right hand side of bs2 and so is always done correctly.  In
order to model children's errors in "decrementing" it is necessary to expand
this primitive action into a set of production rules and add them to the
original set.  This can easily be achieved by executing the function try with
appropriate arguments, for example:

    try([2 0 3],[1 7],[fd b2a bs1 bs4 cm in nxt ts wa done b2c ac lhe ten dec
                       dnz dz1 dz2 d10]);

Notice that you can split the list of productions across a line.  Also notice
that rules prop, pz and pnz have not been implemented and that bs4 replaces
bs2. The rule bs4 was not mentioned in the original article but it is needed
to make sure that the original production system makes proper use of the rules
for decrementing (rather than just calling up an undecomposable decrementing
function).

This expanded system should be able to cope with sums where the minuend has
more digits than the subtrahend as well as the special case where the minuend
starts with 1 0 ...

(i) Table 4, on page 169, indicates how various kinds of error can be modelled.
You should make up sums to show off as many of them as possible.

(ii) Young and O'Shea explicitly compare their error representation based on
the omission of productions rules with that of Brown and Burton.  Read the
Brown and Burton paper and write an essay comparing the two approaches.

E. EXPERIMENTS FOR THE HARDWORKING

(i) Gather some raw data on children's (or adults) subtraction and see if any
errors occur which cannot be modelled within the given system.  Indicate how
they might be accommodated in outline.

(ii) Examine the code in LIB SUBTRACT, by typing say,

    SHOWLIB SUBTRACT

and look at the way that the production rules are represented (at the end of
the file).   Make your own copy of this file and see if you can add the
omitted rule nnn.  Compile the new file and try out the system with the extra
rule.

Related teach files are PSYS and PRODSYS.

--- File: local/teach/subtract
--- Distribution: all
--- University of Sussex Poplog LOCAL File ------------------------------