--* From postmaster%watson.vnet.ibm.com@yktvmv.watson.ibm.com  Tue Jul 12 11:21:23 1994
--* Received: from yktvmv-ob.watson.ibm.com by asharp.watson.ibm.com (AIX 3.2/UCB 5.64/930311)
--*           id AA22410; Tue, 12 Jul 1994 11:21:23 -0400
--* Received: from watson.vnet.ibm.com by yktvmv.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 4543; Tue, 12 Jul 94 11:21:22 EDT
--* Received: from YKTVMV by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.BRONSTEI.NOTE.YKTVMV.3479.Jul.12.11:21:22.-0400>
--*           for asbugs@watson; Tue, 12 Jul 94 11:21:22 -0400
--* Received: from inf.ethz.ch by watson.ibm.com (IBM VM SMTP V2R3) with TCP;
--*    Tue, 12 Jul 94 11:21:21 EDT
--* Received: from vinci.inf.ethz.ch (bronstei@vinci.inf.ethz.ch [129.132.12.46]) by inf.ethz.ch (8.6.9/8.6.9) with ESMTP id RAA29857 for <asbugs@watson.ibm.com>; Tue, 12 Jul 1994 17:21:16 +0200
--* From: Manuel Bronstein <bronstei@inf.ethz.ch>
--* Received: (bronstei@localhost) by vinci.inf.ethz.ch (8.6.8/8.6.6) id RAA01237 for asbugs@watson.ibm.com; Tue, 12 Jul 1994 17:21:15 +0200
--* Date: Tue, 12 Jul 1994 17:21:15 +0200
--* Message-Id: <199407121521.RAA01237@vinci.inf.ethz.ch>
--* To: asbugs@watson.ibm.com
--* Subject: [3] internal compiler error (genFoam) [bug.as][0.36.0]

--@ Fixed  by:  SSD   Thu Jul 28 18:18:49 EDT 1994 
--@ Tested by:  none 
--@ Summary:    abcheck now produces an error when it encounters an exit in the capsule of an add or in the context of a where. 

------------------------------ bug.as ----------------------------
--
-- vinci.inf.ethz.ch{bronstei} 210: asharp bug.as
-- "bug.as", line 7 char 28 abTag = Exit
-- Bug: genFoam

#include "aslib.as"

macro Z == SingleInteger;

SmallPrimeField(p:Z): Join(Field, Finite) with {
        lift: % -> Z;
} == SingleIntegerMod p add {
	macro Rep == SingleIntegerMod p;

	import from Rep;

        not(p > 1) => error "p should be greater than 1";

	#:Integer	== p::Integer;
	(a:%) / (b:%):%	== mod_/(lift a, lift b, p)::%;
	inv(a:%):%	== mod_/(1, lift a, p)::%;

	(a:%)^(n:Integer):% == {
		zero? n => 1;
		n < 0 => repsqr(inv a, -n);
		repsqr(a, n);
	}

	repsqr(a:%, n:Integer):% == {
		n = 1 => a;
		an2 := repsqr(a * a, shift(n, -1));
		odd? n => a * an2;
		an2;
	}
}
 
