home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol166 / binsu.rec < prev    next >
Encoding:
Text File  |  1984-04-29  |  2.4 KB  |  65 lines

  1.  
  2. [BINSU.REC]
  3. [Post version of binary sum]
  4.  
  5. [To sum two binary numbers using Post's Productions, we set up
  6.  two addition tables for the terminal digits of the numbers.
  7.  One table is used initially, and when there is no carry present.
  8.  The other is used to incorporate a propagated carry into the
  9.  sum.  Auxiliary symbols are naturally incorporated into the
  10.  sum by writing the Axiom in the form a+b=c. The digits to be
  11.  removed from a and b are identified by their proximity to + and
  12.  =, respectively.  As the sum is developed, its digits are inserted
  13.  to the right of the = sign. The computation terminates when the
  14.  auxiliary symbols are dropped after at least one of them
  15.  reaches the front of its summand.]
  16.  
  17. [Post Productions can deal with the digits to be summed even
  18.  though they are widely separated.  In a Markov Algorithm it is
  19.  necessary to move one of them until it is in contact with the
  20.  other before the addition table can be applied.]
  21.  
  22. [[]]
  23.  
  24.  
  25.  
  26. {
  27.     [cr, lf]            (2573TL;)&
  28.     [read console]        (R13%='';T08%(=2080[sp,bs]TL)(@J|;L@J;);)J
  29.     [logon message]        ('
  30. A Post Production scheme which will sum two binary
  31. numbers written in the form a+b=c; for example
  32.  
  33.           111110+011=
  34.  
  35. Each successive keystroke will display one more step
  36. in the transformation until the sum is finished.
  37. 'TL@&'Initial Axiom:'TL@&@JI;:)R
  38.     [to shorten program]    (UQzml;)U
  39.     [write workspace]        (JZqt;)W
  40.     [to shorten program]    (zZQml;)Z
  41.     [signoff message]        (@&'Theorem:'TL@&JZqt;)X
  42.                 (@R(@&@WRL
  43. JZ''E'0+'@U1$S('0+'E'0='@U2$S('0='E@Z3$S(
  44.     JZD''I1$ryGI'+'I2$ryGI'=0'I3$ryGI''I;)nL;nL)nL;nL)nL:
  45. JZ''E'0+'@U1$S('0+'E'1='@U2$S('1='E@Z3$S(
  46.     JZD''I1$ryGI'+'I2$ryGI'=1'I3$ryGI''I;)nL;nL)nL;nL)nL:
  47. JZ''E'1+'@U1$S('1+'E'0='@U2$S('0='E@Z3$S(
  48.     JZD''I1$ryGI'+'I2$ryGI'=1'I3$ryGI''I;)nL;nL)nL;nL)nL:
  49. JZ''E'1+'@U1$S('1+'E'1='@U2$S('1='E@Z3$S(
  50.     JZD''I1$ryGI'+'I2$ryGI'*0'I3$ryGI''I;)nL;nL)nL;nL)nL:
  51. JZ''E'0+'@U1$S('0+'E'0*'@U2$S('0*'E@Z3$S(
  52.     JZD''I1$ryGI'+'I2$ryGI'=1'I3$ryGI''I;)nL;nL)nL;nL)nL:
  53. JZ''E'0+'@U1$S('0+'E'1*'@U2$S('1*'E@Z3$S(
  54.     JZD''I1$ryGI'+'I2$ryGI'*0'I3$ryGI''I;)nL;nL)nL;nL)nL:
  55. JZ''E'1+'@U1$S('1+'E'0*'@U2$S('0*'E@Z3$S(
  56.     JZD''I1$ryGI'+'I2$ryGI'*0'I3$ryGI''I;)nL;nL)nL;nL)nL:
  57. JZ''E'1+'@U1$S('1+'E'1*'@U2$S('1*'E@Z3$S(
  58.     JZD''I1$ryGI'+'I2$ryGI'*1'I3$ryGI''I;)nL;nL)nL;nL)nL:
  59. JZ''E'+'@U1$S('+'E'='@U2$S('='E@Z3$S(
  60.     JZD''I1$ryGI''I2$ryGI''I3$ryGI''I;)nL;nL)nL;nL)nL:
  61. JZ''E'+'@U1$S('+'E'*'@U2$S('*'E@Z3$S(
  62.     JZD'0'I1$ryGI'+0'I2$ryGI'*'I3$ryGI''I;)nL;nL)nL;nL)nL:;)@X;)}
  63.  
  64. [end]
  65.