22 KiB
22 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 [3]:
(cat:f-cmpr 123 789)
Out[3]:
:LESS
In [7]:
(documentation 'cat:s-cmpr 'function)
Out[7]:
"--------------------------------------------------------------[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 [4]:
(cat:s-cmpr 'circulation 'circular)
Out[4]:
:GREATER
In [8]:
(documentation 'cat:l-cmpr 'function)
Out[8]:
"--------------------------------------------------------------[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 [5]:
(cat:l-cmpr '(1 a b) '(1 a))
Out[5]:
: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 [6]:
(cat:def comb1 (cat:cmbn 1 1 'u 2 'v 3 'w 4 'z))
Out[6]:
----------------------------------------------------------------------{CMBN 1}
<1 * U>
<2 * V>
<3 * W>
<4 * Z>
------------------------------------------------------------------------------
In [8]:
(documentation 'cat:cmbn-non-zero-p 'function)
Out[8]:
"-----------------------------------------------------------------[macro-doc] CMBN-NON-ZERO-P Args: (cmbn) Tests if the combination CMBN is a non-null combination of any degree. ------------------------------------------------------------------------------"
In [7]:
(cat:cmbn-non-zero-p comb1)
Out[7]:
((1 . U) (2 . V) (3 . W) (4 . Z))
In [10]:
(cat:cmbn-list comb1)
Out[10]:
((1 . U) (2 . V) (3 . W) (4 . Z))
In [11]:
(cat:def term3 (third (cat:cmbn-list comb1)))
Out[11]:
(3 . W)
In [12]:
(cat:cffc term3)
Out[12]:
3
In [13]:
(cat:gnrt term3)
Out[13]:
W
In [14]:
(documentation 'cat:cmbn-opps 'function)
Out[14]:
"--------------------------------------------------------------[function-doc] CMBN-OPPS Args: (cmbn) Returns the combination opposite combination of CMBN. ------------------------------------------------------------------------------"
In [15]:
(cat:def mcomb1 (cat:cmbn-opps comb1))
Out[15]:
----------------------------------------------------------------------{CMBN 1}
<-1 * U>
<-2 * V>
<-3 * W>
<-4 * Z>
------------------------------------------------------------------------------
In [16]:
(documentation 'cat:n-cmbn 'function)
Out[16]:
"--------------------------------------------------------------[function-doc] N-CMBN Args: (n cmbn) Returns N times the combination CMBN. N must be non-zero. ------------------------------------------------------------------------------"
In [17]:
(cat:def comb2 (cat:n-cmbn 10 comb1))
Out[17]:
----------------------------------------------------------------------{CMBN 1}
<10 * U>
<20 * V>
<30 * W>
<40 * Z>
------------------------------------------------------------------------------
In [18]:
(documentation 'cat:2cmbn-add 'function)
Out[18]:
"--------------------------------------------------------------[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 [20]:
(cat:def cmb12 (cat:2cmbn-add #'cat:s-cmpr comb1 comb2))
Out[20]:
----------------------------------------------------------------------{CMBN 1}
<11 * U>
<22 * V>
<33 * W>
<44 * Z>
------------------------------------------------------------------------------
In [21]:
(documentation 'cat:2cmbn-sbtr 'function)
Out[21]:
"--------------------------------------------------------------[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 [22]:
(documentation 'cat:ncmbn-add 'function)
Out[22]:
"--------------------------------------------------------------[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 [23]:
(cat:ncmbn-add #'cat:s-cmpr comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2)
Out[23]:
----------------------------------------------------------------------{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 [24]:
(cat:def diabolo-cmpr #'cat:s-cmpr)
Out[24]:
#<Compiled-function CAT:S-CMPR #x302001B0009F>
In [25]:
(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[25]:
#<Anonymous Function #x302001CD7EBF>
In [26]:
(cat:def diabolo-bspn 's0)
Out[26]:
S0
In [28]:
(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[28]:
#<Anonymous Function #x302001D729CF>
In [29]:
(cat:def diabolo-strt :GNRT)
Out[29]:
:GNRT
In [30]:
(cat:def diabolo-orgn '(diabolo-for-example))
Out[30]:
(DIABOLO-FOR-EXAMPLE)
In [31]:
(documentation 'cat:build-chcm 'function)
Out[31]:
"--------------------------------------------------------------[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 [32]:
(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[32]:
[K1 Chain-Complex]