incr-set prlevel 1
if #0=4 START
incr-set prlevel -1
;;; Usage:
;;; 	<map_from_col f a b g
;;;
;;; given 
;;;			a
;;; 	A1 --> A0
;;;         b
;;; 	B1 --> B0
;;;
;;; and a map (that is, a column) 
;;; which for some integer n has the form
;;;     f: R(n) --> A0^* \tensor B0,
;;;
;;; this script sets g to the adjoint map
;;;
;;;     g: A0(n) --> B0.
;;;
;;;
incr-set prlevel 1
jump END
;;; Parameters:
;;;     f a column ; a, b matrices,
;;;     f: R(n) --> A0^* \tensor B0
;;;     the row degrees of f must be 
;;;     the col degrees of A0^* \tensor B0 up to shift by n
;;;
;;; Output values:
;;;	    g a matrix from the row space of a to that of b
;;;
;;; This is useful after 
;;; <hom_and_map a b c ff,
;;; since if f1 is a column whose entries have degrees
;;; matching the column degrees of ff, then the composite ff.f1 
;;; produced by
;;; mult ff f1 f
;;; <map_from_col f a b g
;;; gives g: A0 --> B0 representing a map coker a --> coker b.
;;;
;;;Caveat:  row degrees are set to those of B0, but column degrees
;;;for columns of zeros in g will likely be set WRONG.  To get around
;;;this problem we would have to know n (or be able to compute it.)
; created 7/31/90 DE
START:

;Tensor f with A0 to get
;    @f: @A0 --> @A0 \tensor A0^* \tensor B0
<idenrowdegs #2 @A0
outer @A0 #1 @f

;Make the tautological map 
;    @taut:A0 \tensor A0^* --> R
flatten @A0 @taut

;tensor it with B0, the row space of b, to get
;    @taut: @A0 \tensor A0^* \tensor B0 --> B0
<idenrowdegs #3 @B0
outer @taut @B0 @taut

;Compute f:
mult @taut @f #4

;Optional simplification:
;Now reduce #4 modulo the column space of b
std #3 @b
reduce @b #4 #4

;force degrees to be correct:

setdegs #4
	#3
	;
kill @A0 @f @B0 @taut @b  

END:
incr-set prlevel -1

$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;
reset
;Map between factor rings
<ring 3 a-z r
<ideal i a2 b2
<ideal j b2 c2
<ideal h ab2
<map_from_col h i j k
type k
listvars

; ;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Map from canonical module to the ring
<ring 2 a-z r
power r 3 i
<ext(-,r) 2 i e
<hom_and_map e i h ff
betti ff
; total:      3     9 
; --------------------
;     4:      3     - 
;     5:      -     9 

<column_vector h 0 0 0 1 0 0 0 0 0
mult ff h h1
betti h1

<map_from_col h1 e i k
type i
type e
type k
betti k
betti i
betti h


;present the module L which is the image (of k modulo e):
modulo k i L
<prune L L
nres L LL
betti LL

