56 KiB
56 KiB
Chapter 1¶
In [1]:
(ql:quickload "kenzo")
Out[1]:
("kenzo")
In [2]:
(cat:cat-init)
---done---
Out[2]:
NIL
1.2.2 Ordering the generators¶
In [3]:
(documentation 'cat:f-cmpr 'function)
Out[3]:
"--------------------------------------------------------------[function-doc] F-CMPR Args: (n1 n2) Returns :LESS, :EQUAL, or :GREATER, according to the result of the canonical comparison of the integers N1 and N2. ------------------------------------------------------------------------------"
In [4]:
(cat:f-cmpr 123 789)
Out[4]:
:LESS
In [5]:
(documentation 'cat:s-cmpr 'function)
Out[5]:
"--------------------------------------------------------------[function-doc] S-CMPR Args: (symbol1 symbol2) Returns :LESS, :EQUAL, or :GREATER, according to the result of the Lisp string comparison function of the strings (SYMBOL-NAME SYMBOL1) and (SYMBOL-NAME SYMBOL2). ------------------------------------------------------------------------------"
In [6]:
(cat:s-cmpr 'circulation 'circular)
Out[6]:
:GREATER
In [7]:
(documentation 'cat:l-cmpr 'function)
Out[7]:
"--------------------------------------------------------------[function-doc] L-CMPR Args: (list1 list2) Returns :LESS, :EQUAL, or :GREATER, according to the lexicographical ordering of the generator lists LIST1 and LIST2. ------------------------------------------------------------------------------"
In [8]:
(cat:l-cmpr '(1 a b) '(1 a))
Out[8]:
:GREATER
1.2.3 Functions handling combinations¶
In [9]:
(documentation 'cat:cmbn 'function)
Out[9]:
"--------------------------------------------------------------[function-doc] CMBN Args: (degr &rest rest) Returns a combination of degree DEGR from a sum of terms provided as a sequence CF1 GNRT1 CF2 GNRT2 ... CFn GNRTn of coefficient / generator pairs in REST. REST can be of arbitrary even length and can be empty, in which case the combination is an instance of the null combination of degree DEGR. ------------------------------------------------------------------------------"
In [10]:
(cat:def comb1 (cat:cmbn 1 1 'u 2 'v 3 'w 4 'z))
Out[10]:
----------------------------------------------------------------------{CMBN 1}
<1 * U>
<2 * V>
<3 * W>
<4 * Z>
------------------------------------------------------------------------------
In [11]:
(documentation 'cat:cmbn-non-zero-p 'function)
Out[11]:
"-----------------------------------------------------------------[macro-doc] CMBN-NON-ZERO-P Args: (cmbn) Tests if the combination CMBN is a non-null combination of any degree. ------------------------------------------------------------------------------"
In [12]:
(cat:cmbn-non-zero-p comb1)
Out[12]:
T
In [13]:
(cat:cmbn-list comb1)
Out[13]:
((1 . U) (2 . V) (3 . W) (4 . Z))
In [14]:
(cat:def term3 (third (cat:cmbn-list comb1)))
Out[14]:
(3 . W)
In [15]:
(cat:cffc term3)
Out[15]:
3
In [16]:
(cat:gnrt term3)
Out[16]:
W
In [17]:
(documentation 'cat:cmbn-opps 'function)
Out[17]:
"--------------------------------------------------------------[function-doc] CMBN-OPPS Args: (cmbn) Returns the combination opposite combination of CMBN. ------------------------------------------------------------------------------"
In [18]:
(cat:def mcomb1 (cat:cmbn-opps comb1))
Out[18]:
----------------------------------------------------------------------{CMBN 1}
<-1 * U>
<-2 * V>
<-3 * W>
<-4 * Z>
------------------------------------------------------------------------------
In [19]:
(documentation 'cat:n-cmbn 'function)
Out[19]:
"--------------------------------------------------------------[function-doc] N-CMBN Args: (n cmbn) Returns N times the combination CMBN. N must be non-zero. ------------------------------------------------------------------------------"
In [20]:
(cat:def comb2 (cat:n-cmbn 10 comb1))
Out[20]:
----------------------------------------------------------------------{CMBN 1}
<10 * U>
<20 * V>
<30 * W>
<40 * Z>
------------------------------------------------------------------------------
In [21]:
(documentation 'cat:2cmbn-add 'function)
Out[21]:
"--------------------------------------------------------------[function-doc] 2CMBN-ADD Args: (cmpr cmbn1 cmbn2) Returns the combination, which is the sum of CMBN1 and CMBN2. The first argument, CMPR, must be a function or macro, which is used to compare the generators of the combination arguments and to order the terms of the result combination. ------------------------------------------------------------------------------"
In [22]:
(cat:def cmb12 (cat:2cmbn-add #'cat:s-cmpr comb1 comb2))
Out[22]:
----------------------------------------------------------------------{CMBN 1}
<11 * U>
<22 * V>
<33 * W>
<44 * Z>
------------------------------------------------------------------------------
In [23]:
(documentation 'cat:2cmbn-sbtr 'function)
Out[23]:
"--------------------------------------------------------------[function-doc] 2CMBN-SBTR Args: (cmpr cmbn1 cmbn2) Returns the combination, which is the difference of CMBN1 and CMBN2. The first argument, CMPR, must be a function or macro, which is used to compare the generators of the combination arguments and to order the terms of the result combination. ------------------------------------------------------------------------------"
In [24]:
(documentation 'cat:ncmbn-add 'function)
Out[24]:
"--------------------------------------------------------------[function-doc] NCMBN-ADD Args: (cmpr cmbn &rest rest) Returns the sum of an arbitrary number of combinations. The first argument, CMPR, must be a function or macro, which is used to compare the generators of the input combinations and to order the terms of the result combination. ------------------------------------------------------------------------------"
In [25]:
(cat:ncmbn-add #'cat:s-cmpr comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2)
Out[25]:
----------------------------------------------------------------------{CMBN 1}
<55 * U>
<110 * V>
<165 * W>
<220 * Z>
------------------------------------------------------------------------------
1.3.1 The function build-chcm¶
A first example of a chain complex¶
In [26]:
(cat:def diabolo-cmpr #'cat:s-cmpr)
Out[26]:
#<FUNCTION CAT:S-CMPR>
In [27]:
(cat:def diabolo-basis #'(lambda (dmn) (case dmn (0 '(s0 s1 s2 s3 s4 s5)) (1 '(s01 s02 s12 s23 s34 s35 s45)) (2 '(s345)) (otherwise nil))))
Out[27]:
#<FUNCTION (LAMBDA (DMN) :IN "/home/gerd/git/fishbowl-repl/fishbowl.lisp") {100711F94B}>
In [28]:
(cat:def diabolo-bspn 's0)
Out[28]:
S0
In [29]:
(cat:def diabolo-pure-dffr #'(lambda (dmn gnr) (unless (<= 0 dmn 2) (error "Incorrect dimension for diabolo-dp.")) (case dmn (0 (cat:cmbn -1)) ; Note the null combination of degree -1 (1 (case gnr (s01 (cat:cmbn 0 -1 's0 1 's1)) (s02 (cat:cmbn 0 -1 's0 1 's2)) (s12 (cat:cmbn 0 -1 's1 1 's2)) (s23 (cat:cmbn 0 -1 's2 1 's3)) (s34 (cat:cmbn 0 -1 's3 1 's4)) (s35 (cat:cmbn 0 -1 's3 1 's5)) (s45 (cat:cmbn 0 -1 's4 1 's5)))) (2 (case gnr (s345 (cat:cmbn 1 1 's34 -1 's35 1 's45)))) (otherwise (error "Bad generator for complex diabolo")))))
Out[29]:
#<FUNCTION (LAMBDA (DMN GNR) :IN "/home/gerd/git/fishbowl-repl/fishbowl.lisp") {100728D41B}>
In [30]:
(cat:def diabolo-strt :GNRT)
Out[30]:
:GNRT
In [31]:
(cat:def diabolo-orgn '(diabolo-for-example))
Out[31]:
(DIABOLO-FOR-EXAMPLE)
In [32]:
(documentation 'cat:build-chcm 'function)
Out[32]:
"--------------------------------------------------------------[function-doc]
BUILD-CHCM
Args: (&key cmpr basis bsgn intr-dffr strt orgn)
Returns an instance of the class CHAIN-COMPLEX. The keyword arguments are as
follows:
:CMPR CMPR, the comparison function for generators
:BASIS BASIS, the function defining the basis of the freee Z-modules C_p or the
the keyword :LOCALLY-EFFECTIVE
:BSGN BSGN, a generator, the base point of the underlying set
:INTR-DFFR INTR-DFFR, a Lisp function defining the differential homomorphism
for each p (d_p: C_p -> C_{p-1}
:STRT STRT, one of the keywords :GNRT or :CMBN, defining the mapping strategy
of the differential homomorphism, either by generator or by
combination. The default is :GNRT
:ORGN ORGN, a list containing a relevant and carefully chosen comment about
the origin of the chain complex. This comment should be unique
for a Kenzo session (between calls of CAT-INIT), as it is used
for caching purposes.
Use this function instead of creating instances via the standard constructor
MAKE-INSTANCE.
------------------------------------------------------------------------------"
In [33]:
(cat:def diabolo (cat:build-chcm :cmpr diabolo-cmpr :basis diabolo-basis :bsgn diabolo-bspn :intr-dffr diabolo-pure-dffr :strt diabolo-strt :orgn diabolo-orgn))
Out[33]:
[K1 Chain-Complex]
In [34]:
(documentation 'cat:chcm 'function)
Out[34]:
"--------------------------------------------------------------[function-doc] CHCM Args: (idnm) Return from the list *CHCM-LIST* the chain complex instance with Kenzo identifier IDNUM or NIL, if it doesn't exist. ------------------------------------------------------------------------------"
In [35]:
(cat:chcm 1)
Out[35]:
[K1 Chain-Complex]
In [36]:
(cat:orgn diabolo)
Out[36]:
(DIABOLO-FOR-EXAMPLE)
In [37]:
(cat:idnm diabolo)
Out[37]:
1
In [38]:
(cat:basis diabolo 0)
Out[38]:
(S0 S1 S2 S3 S4 S5)
In [39]:
(cat:basis diabolo 1)
Out[39]:
(S01 S02 S12 S23 S34 S35 S45)
In [40]:
(cat:basis diabolo 2)
Out[40]:
(S345)
In [41]:
(cat:basis diabolo 10)
Out[41]:
NIL
In [42]:
(cat:dffr diabolo 2 's345)
Out[42]:
----------------------------------------------------------------------{CMBN 1}
<1 * S34>
<-1 * S35>
<1 * S45>
------------------------------------------------------------------------------
In [43]:
(cat:dffr diabolo (cat:dffr diabolo 2 's345))
Out[43]:
----------------------------------------------------------------------{CMBN 0}
------------------------------------------------------------------------------
An important trivial case: the unit chain complex, $\mathbb{Z}$¶
In [44]:
(cat:def ZCC (the cat:chain-complex (cat:build-chcm :cmpr #'(lambda (gnrt1 gnrt2) (declare (ignore gnrt1 gnrt2)) (the cat:cmpr :equal)) :basis #'(lambda (n) (the list (if (zerop n) '(:Z-gnrt) cat:+empty-list+))) :bsgn :Z-gnrt :intr-dffr #'(lambda (cmbn) (the cat:cmbn (cat:zero-cmbn (1- (cat:cmbn-degr cmbn))))) :strt :cmbn :orgn '(zcc-constant))))
Out[44]:
[K3 Chain-Complex]
In [45]:
(documentation 'cat:z-chcm 'function)
Out[45]:
"--------------------------------------------------------------[function-doc] Z-CHCM Args: () Build the unit chain complex. ------------------------------------------------------------------------------"
The chain complex $\texttt{circle}$¶
In [46]:
(defun CIRCLE () (the cat:chain-complex (cat:build-chcm :cmpr #'(lambda (gnrt1 gnrt2) (declare (ignore gnrt1 gnrt2)) (the cat:cmpr :equal)) :basis #'(lambda (dmns) (the list (case dmns (0 '(*)) (1 '(s1)) (otherwise cat:+empty-list+)))) :bsgn '* :intr-dffr #'cat:zero-intr-dffr :strt :cmbn :orgn '(circle))))
Out[46]:
CIRCLE
1.4 Morphisms¶
In [47]:
(documentation 'cat:morphism 'type)
Out[47]:
"-----------------------------------------------------------------[class-doc]
MORPHISM
Slots: (sorc trgt degr intr strt ???-clnm ?-clnm rslts idnm orgn)
Intances of this class represent morphisms between chain complexes, and the
differential homomorphism of a chain complex is treated as a morphism of
degree -1. The class has 10 slots:
1. SORC, an object of class CHAIN-COMPLEX, the source chain complex of this
morphism.
2. TRGT, an object of class CHAIN-COMPLEX, the target chain complex of this
morphism.
3. DEGR, an integer, the degree of the morphism.
4. INTR, a Lisp function implementing the morphism, taking account of the
strategy STRT.
5. STRT, a symbol, one of :GNRT or :CMBN.
6. ???-CLNM, an integer updated by the system for internal statistics.
7. ?-CLNM, another integer maintained by the system for internal pusposes.
8. RSLTS, an array of length +MAXIMAL-DIMENSION+ reserved by the system for
caching intermediate results.
9. IDNM, an integer, a system-generated identifier for this object.
10. ORGN, a list containg a comment indicating the origin of the object. The
should be unique (per session), since it is used in the implementation for
caching purposes.
------------------------------------------------------------------------------"
1.4.1 The function $\texttt{build-mprh}$¶
In [48]:
(documentation 'cat:build-mrph 'function)
Out[48]:
"--------------------------------------------------------------[function-doc]
BUILD-MRPH
Args: (&key sorc trgt degr intr strt orgn)
Returns an instance of the class MORPHISM. The keyword arguments are as
follows:
:SORC SORC, the source object, a CHAIN-COMPLEX type object
:TRGT TRGT, the target object, a CHAIN-COMPLEX type object
:DEGR DEGR, the degree of the morphism, an integer
:INTR INTR, the Lisp function defining the effective mapping
:STRT STRT, one of the keywords :GNRT or :CMBN, defining the mapping strategy
of the differential homomorphism, either by generator or by
combination. The default is :GNRT
:ORGN ORGN, a list containing a relevant and carefully chosen comment about
the origin of the chain complex. This comment should be unique
for a Kenzo session (between calls of CAT-INIT), as it is used
for caching purposes.
Use this function instead of creating instances via the standard constructor
MAKE-INSTANCE.
------------------------------------------------------------------------------"
The differential homomorphism in a chain complex instance¶
In [49]:
(cat:cat-init)
---done---
Out[49]:
NIL
In [50]:
(cat:def ZCC (cat:z-chcm))
Out[50]:
[K1 Chain-Complex]
In [51]:
(cat:def zero-morphism (cat:build-mrph :sorc ZCC :trgt ZCC :degr -1 :intr #'(lambda (comb) (cat:cmbn (1- (cat:degr comb)))) :strt :cmbn :orgn '(zero morphism on ZCC)))
Out[51]:
[K3 Cohomology-Class on K1 of degree 1]
In [52]:
(cat:def id-morphism (cat:build-mrph :sorc ZCC :trgt ZCC :degr 0 :intr #'identity :strt :cmbn :orgn '(identity morphism on ZCC)))
Out[52]:
[K4 Cohomology-Class on K1 of degree 0]
1.4.3 Functions defining morphisms¶
In [53]:
(cat:def ccn-boundary #'(lambda (dgr gnr) (if (evenp (+ dgr gnr)) (cat:cmbn (1- dgr) 1 (- gnr 10)) (cat:cmbn (1- dgr)))))
Out[53]:
#<FUNCTION (LAMBDA (DGR GNR) :IN "/home/gerd/git/fishbowl-repl/fishbowl.lisp") {1004480C9B}>
In [54]:
(cat:def ccn (cat:build-chcm :cmpr #'cat:f-cmpr :basis #'(lambda (n) (cat:<a-b< (* 10 n) (* 10 (1+ n)))) :bsgn 0 :intr-dffr ccn-boundary :strt :gnrt :orgn '(ccn)))
Out[54]:
[K5 Chain-Complex]
In [55]:
(cat:def upper-shift (cat:build-mrph :sorc ccn :trgt ccn :strt :gnrt :degr +1 :intr #'(lambda (d gn) (cat:cmbn (1+ d) 1 (+ gn 10))) :orgn '(ccn shift +10)))
Out[55]:
[K7 Morphism (degree 1): K5 -> K5]
In [56]:
(cat:def lower-shift (cat:build-mrph :sorc ccn :trgt ccn :strt :gnrt :degr -1 :intr #'(lambda (d gn) (cat:cmbn (1- d) 1 (- gn 10))) :orgn '(ccn shift -10)))
Out[56]:
[K8 Morphism (degree -1): K5 -> K5]
In [57]:
(cat:? ccn 2 22)
Out[57]:
----------------------------------------------------------------------{CMBN 1}
<1 * 12>
------------------------------------------------------------------------------
In [58]:
(cat:? ccn (cat:? ccn 2 22))
Out[58]:
----------------------------------------------------------------------{CMBN 0}
------------------------------------------------------------------------------
In [59]:
(cat:def combn (cat:cmbn 5 1 50 5 55 9 59))
Out[59]:
----------------------------------------------------------------------{CMBN 5}
<1 * 50>
<5 * 55>
<9 * 59>
------------------------------------------------------------------------------
In [60]:
(cat:? ccn combn)
Out[60]:
----------------------------------------------------------------------{CMBN 4}
<5 * 45>
<9 * 49>
------------------------------------------------------------------------------
In [61]:
(cat:? ccn (cat:? ccn combn))
Out[61]:
----------------------------------------------------------------------{CMBN 3}
------------------------------------------------------------------------------
In [62]:
(cat:? upper-shift 0 6)
Out[62]:
----------------------------------------------------------------------{CMBN 1}
<1 * 16>
------------------------------------------------------------------------------
In [63]:
(cat:? lower-shift 5 51)
Out[63]:
----------------------------------------------------------------------{CMBN 4}
<1 * 41>
------------------------------------------------------------------------------
In [64]:
(cat:? lower-shift (cat:? lower-shift 5 51))
Out[64]:
----------------------------------------------------------------------{CMBN 3}
<1 * 31>
------------------------------------------------------------------------------
In [64]:
(cat:def comb1 (cat:cmbn 1 1 10 2 11 3 12 4 13))
Out[64]:
----------------------------------------------------------------------{CMBN 1}
<1 * 10>
<2 * 11>
<3 * 12>
<4 * 13>
------------------------------------------------------------------------------
In [64]:
(cat:def identity? (cat:cmps upper-shift lower-shift))
Out[64]:
[K9 Morphism (degree 0): K5 -> K5]
In [64]:
(cat:degr identity?)
Out[64]:
0
In [64]:
(cat:? identity? comb1)
Out[64]:
----------------------------------------------------------------------{CMBN 1}
<1 * 10>
<2 * 11>
<3 * 12>
<4 * 13>
------------------------------------------------------------------------------
In [64]:
(cat:2cmbn-sbtr (cat:cmpr ccn) comb1 (cat:? identity? comb1))
Out[64]:
----------------------------------------------------------------------{CMBN 1}
------------------------------------------------------------------------------
In [64]:
(cat:def upper-shift2 (cat:cmps upper-shift upper-shift))
Out[64]:
[K10 Morphism (degree 2): K5 -> K5]
In [64]:
(cat:degr upper-shift2)
Out[64]:
2
In [64]:
(cat:? upper-shift2 comb1)
Out[64]:
----------------------------------------------------------------------{CMBN 3}
<1 * 30>
<2 * 31>
<3 * 32>
<4 * 33>
------------------------------------------------------------------------------
In [64]:
(cat:def twice-up-shift (cat:add upper-shift upper-shift))
Out[64]:
[K11 Morphism (degree 1): K5 -> K5]
In [64]:
(cat:degr twice-up-shift)
Out[64]:
1
In [64]:
(cat:? twice-up-shift comb1)
Out[64]:
----------------------------------------------------------------------{CMBN 2}
<2 * 20>
<4 * 21>
<6 * 22>
<8 * 23>
------------------------------------------------------------------------------
In [64]:
(cat:def up-d (cat:cmps upper-shift (cat:dffr1 ccn)))
Out[64]:
[K12 Morphism (degree 0): K5 -> K5]
In [64]:
(cat:def d-up (cat:cmps (cat:dffr1 ccn) upper-shift))
Out[64]:
[K13 Morphism (degree 0): K5 -> K5]
In [64]:
(cat:? up-d 1 11)
Out[64]:
----------------------------------------------------------------------{CMBN 1}
<1 * 11>
------------------------------------------------------------------------------
In [64]:
(cat:? d-up 1 11)
Out[64]:
----------------------------------------------------------------------{CMBN 1}
------------------------------------------------------------------------------
In [64]:
(cat:def comb3 (cat:cmbn 1 1 10 2 11 3 12 4 13 5 14 6 15))
Out[64]:
----------------------------------------------------------------------{CMBN 1}
<1 * 10>
<2 * 11>
<3 * 12>
<4 * 13>
<5 * 14>
<6 * 15>
------------------------------------------------------------------------------
In [64]:
(cat:? up-d comb3)
Out[64]:
----------------------------------------------------------------------{CMBN 1}
<2 * 11>
<4 * 13>
<6 * 15>
------------------------------------------------------------------------------
In [64]:
(cat:? d-up comb3)
Out[64]:
----------------------------------------------------------------------{CMBN 1}
<1 * 10>
<3 * 12>
<5 * 14>
------------------------------------------------------------------------------
1.4.4 Accessing $\texttt{Kenzo}$ objects¶
In [64]:
(cat:k 1)
Out[64]:
[K1 Chain-Complex]
In [64]:
(cat:kd 1)
Object: [K1 Chain-Complex] Origin: (Z-CHCM)
Out[64]:
NIL
In [64]:
(cat:k 3)
Out[64]:
[K3 Cohomology-Class on K1 of degree 1]
In [64]:
(cat:kd 3)
Object: [K3 Cohomology-Class on K1 of degree 1] Origin: (ZERO MORPHISM ON ZCC)
Out[64]:
NIL
In [64]:
(cat:kd 8)
Object: [K8 Morphism (degree -1): K5 -> K5] Origin: (CCN SHIFT -10)
Out[64]:
NIL
In [64]:
(cat:kd 5)
Object: [K5 Chain-Complex] Origin: (CCN)
Out[64]:
NIL
In [64]:
(cat:kd 9)
Object: [K9 Morphism (degree 0): K5 -> K5] Origin: (2MRPH-CMPS [K7 Morphism (degree 1): K5 -> K5] [K8 Morphism (degree -1): K5 -> K5] GNRT)
Out[64]:
NIL
In [64]:
(cat:kd2 9)
Object: [K9 Morphism (degree 0): K5 -> K5] Origin: (2MRPH-CMPS [K7 Morphism (degree 1): K5 -> K5] [K8 Morphism (degree -1): K5 -> K5] GNRT) Object: [K8 Morphism (degree -1): K5 -> K5] Origin: (CCN SHIFT -10) Object: [K7 Morphism (degree 1): K5 -> K5] Origin: (CCN SHIFT 10)
Out[64]:
(9 8 7)