incr-set prlevel 1
if #0>1 START
incr-set prlevel -1
;;; Usage:
;;; 	<annihilated I M [ans]
;;;
;;; checks whether the ideal I annihilates the
;;; module M.  Much faster than computing the annihilator.
;;; Replaces M with a standard basis. Prints an answer,
;;; or, if the third argument is present, sets it to
;;; 1 for yes or 0 for no.
incr-set prlevel 1
jump END
;;; Parameters:
;;;
;;; Output values:
;;;
;;; if M = coker m: F --> G, 
;;; we form a matrix whose image is IG, then reduce
;;; its columns mod those of m.  M is annihilated
;;; if all the columns reduce to 0.
;;;
; created 4/9/91
START:
std #2 @Mstd
;Now the hard work is done.  
;Form a matrix whose columns
;generate IG
<idenrowdegs #2 @gens
outer #1 @gens @Igens
reduce @Mstd @Igens @reduced
compress @reduced @reduced ;gets rid of all the 0 cols
ncols @reduced @criterion

;Now output the result
if #0=3 makeans
if @criterion=0 annihilated
shout echo The ideal DOES NOT annihilate the module
jump cleanup
annihilated:
shout echo The ideal DOES annihilate the module
jump cleanup

;If the third argument was present
makeans:
if @criterion=0 annihilated1
int #3 0
jump cleanup
annihilated1:
int #3 1

cleanup:
kill @Mstd @gens @Igens @reduced @criterion 
END:
incr-set prlevel -1

$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;
reset
<ring 2 ab r
<ideal row1 a b 0
<ideal row2 0 a b
<stack m row1 row2 
type m
betti m
<ideal i a
<ideal j a2
<annihilated i m
<annihilated j m
<annihilated i m ans
type ans
<annihilated j m ans
type ans

listvars

;It even works if m has no columns:
<ring 2 ab r
<ideal m 
transpose m m
betti m
<annihilated r m

; ;;;;;
; Some tests of whether the socle mod I
;kills wedge^{g+1}I,
;where I is a primary ideal in a poly ring with g vars.

;g=3
<ring 3 a-z r

;The commented out ideals have been tested, with all
;the members of their socle series, and give examples
;rather than counterexamples.

;<ideal s a4+b3c ab2c+b4 c4+a2b2 
;<ideal s a4 b4 c4
;<ideal s a3 b5 c7
;power r 5 r5
<random_mat 1 3 r5 s

<wedge_cokernel s 4 m
<annihilated s m 

;The following 4 commands can be run over and over to test
;a given socle series
quotient s r s
betti s
<wedge_cokernel s 4 m
<annihilated s m 
