incr-set prlevel 1
if #0=3 START
incr-set prlevel -1
;;; Usage:
;;; 	<prune_and_map a b f
;;;
;;; finds a minimal presentation b for coker a and a map 
;;; 	f: target b --> target a
;;; inducing the identity on the cokernel.
incr-set prlevel 1
jump END
;;; Parameters:
;;;		a = matrix
;;; Output values:
;;;		b = minimal matrix with the same cokernel
;;;		f = matrix so that fb = ag for some g and f induces 1 on 
;;;				1: coker b --> coker a.

;Last modified 2/28/89 DE
START:
;Find a minimal set of generators for the cokernel of a:
<complement #1 #3

;Now compute the minimal set of relations on
;this new set of generators:
modulo #3 #1 #2
END:
incr-set prlevel -1

$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;
reset
;Torsion in the cotangent sheaf of a nodal curve:

;The nodal plane cubic:
<ring 3 x-z r
poly i y2z-x2(x-z)
type i

<cotan i Omega
type Omega
;The following line is necessary because of a bug (5/14/89)
std i i    
qring i rr
fetch Omega Omega
<prune Omega Omega
<double_dual Omega N f
<kernel_and_map f Omega N torsion g
;The cotangent sheaf has torsion at the origin!

type Omega
; -y x2+y2 1/3xy y2+2/3xz 
; x  0     1/3y2 2/3yz    
; z  2yz   x2-xz 2yz      

type torsion
; 1 0 0   0 0 0 
; 0 0 1/3 0 x y 
; 0 1 0   1 0 0 
; 0 1 0   0 0 0 
; 0 0 1   0 0 0 
type g
; -y xy      y2+2/3xz x2-2/3xz 0              
; x  0       2/3yz    -2/3yz   1/3y2          
; z  2xz-2z2 2yz      0        x2-5/3xz+2/3z2 

;But the minimal presentation is much simpler:
<prune_and_map
<prune_and_map torsion torsion g1
mult g g1 g2
type torsion
; x y 
type g2
; -1/3xy       
; 0            
; -2/3xz+2/3z2 
