kenzo/examples/Chapter1.ipynb
2016-02-11 22:31:41 -05:00

83 KiB

In [1]:
(ql:quickload 'kenzo)
To load "kenzo":
  Load 1 ASDF system:
    kenzo

; Loading "kenzo"

Out[1]:
(KENZO)
In [2]:
(in-package "CAT")
Out[2]:
#<PACKAGE "CAT">
In [3]:
(cat-init)
---done---
Out[3]:
NIL

Chain Complexes

Introduction

A chain complex $(C_p, d_p)$ is a collection of free $\mathbb{Z}$-modules $(C_p)$, one for each $p \in \mathbb{Z}$, together with a homomorphism $d_p : C_p \rightarrow C_{p-1}$, such that, for all $p$, $d_{p-1} \circ d_p = 0$. (See, for example, P.J. Giblin in Graph, Surface and Homology, Chapman and Hall Math. series, 1981.)

In the Kenzo program, a morphism $f=(f_p)$, of degree $k$, from a chain complex $(C_p, d_p)$ to another $(C'_p, d'_p)$ is a collection of homomorphisms

$$f_p : C_p \rightarrow C'_{p+k}.$$

This is expressed by the following diagram, generally not assumend commutative.

$$ \begin{aligned} \cdots & \leftarrow & C_{p-1} & \quad\xleftarrow{d_p} & C_p & \quad\xleftarrow{d_{p+1}} & C_{p+1} & \quad\leftarrow & \cdots \\ & & f_{p-1} \Bigg\downarrow & & f_p \Bigg\downarrow & & f_{p+1} \Bigg\downarrow \\ \cdots & \leftarrow & C'_{p+k-1} & \quad\xleftarrow{d'_{p+k}} & C'_{p+k} & \quad\xleftarrow{d'_{p+k+1}} & C'_{p+k+1} & \quad\leftarrow & \cdots \end{aligned} $$

Three types of morphisms are most generally considered.

  1. $k=0$. If the commutativity relation $d'_p\circ f_p=f_{p-1}\circ d_p$ holds for every $p$, then the morphism $f$ is an ordinary chain complex morphism or chain map.
  2. $k=-1$. If $(C_p,d_p)=(C'_p,d'_p)$ and $f_p=d_p$, then $f$ is the differential of the chain complex $(C_p,d_p)$ and, in fact, this differential is implemented in the ${\tt Kenzo}$ program as a morphism of degree $-1$.
  3. $k=+1$. In this case, $f$ is usually a homotopy operator, that is, some relation $$d'_{p+1}\circ f_p+f_{p-1}\circ d_p=g_p-g'_p$$ is satisfied for two (ordinary) chain complex morphisms $g$ and $g'$.

For technical reasons, these three types of morphisms have been implemented in the $\texttt{Kenzo}$ program in a unique type.

Generators, terms, and combinations

To become familiar with the Lisp functions implementing the chain complexes, the best is to begin with an example. Simplicial complexes are good candidates for this purpose, and we shall take as a typical example the following simplicial complex.

In [4]:
(cl-jupyter-user:png-from-file "diabolo.png")
Out[4]:
No description has been provided for this image

In this simplicial complex, called here diabolo, there are 3 associated chain groups.

  • $C_0$, the free $\mathbb{Z}$-module on the set of vertices $\{s_0,s_1,s_2,s_3,s_4,s_5\}$
  • $C_1$, the free $\mathbb{Z}$-module on the set of edges $\{s_{01},s_{02},s_{12},s_{23},s_{34},s_{35}, s_{45}\}$
  • $C_2$, the free $\mathbb{Z}$-module on the set of triangles (here a singleton) $\{s_{345}\}$

The elements of either of those groups $C_p$ are linear integer combinations of the corresponding basis (set of $\sigma_i$'s), i.e., elements of the form $$\sum\lambda_i\sigma_i, \quad \lambda_i\in\mathbb{Z}.$$ An element $\sigma_i$ of any basis is also called a generator and in our specific case this generator will be represented by a Lisp symbol. For instance, $s_{45}$ will be translated into s45. However, the user should be aware that in more realistic usage of the software, generators may be of any type. A product such as $\lambda_i\sigma_i$ is called a term and a sum of terms, a combination.

Representation of a combination

A combination is represented internally in the system by a structure having the following general form:

$$\#\texttt{S(CMBN}\quad\texttt{DEGREE P}\quad\texttt{LIST (}\texttt{(}\lambda_1\cdot\sigma_1\texttt{)}\dots\texttt{(}\lambda_k\cdot\sigma_k\texttt{)))}$$ and containing

  1. The degree of the combination corresponding to the index $p\in\mathbb{Z}$ of the group $C_p$ to which this combination belongs.
  2. The list of the internal representation of the terms, namely the list of pairs $(\lambda_i\cdot\sigma_i)$.

This choice of representation implaies that only homogeneous combinations will be considered. A type CMBN and a printing method are provided with this internal representation. The external form of a combination is shown in the examples.

Ordering the generators

In order to speed up the execution of algorithms involving combinations, the list of pairs $(\lambda_i.\sigma_i)$ is ordered by an adequate ordering function (ex: the lexicographical ordering n the symbols). For programming convenience, an enumerated type CMPR has been defined:

(deftype cmpr() '(member :less :equal :greater))

A number of macros, functions and methods have been defined on usual sets (symbols, numbers, lists, etc.) taking their value in the set [:less, :equal, :greater]. Of course, the user may define its own function for a particular case. There exists functions to compare various couples of usual items:

Function (f-cmpr n1 n2)

Return :less, :equal, :greater, according to the result of the canonical comparison of both integers n1 and n2.

Function (s-cmpr symbol1 symbol2)

Return :less, :equal, :greater, according to the result of the lisp comparison functions on the strings (symbol-name symbol1) and (symbol-name symbol2)

Function (l-cmpr list1 list2)

Return :less, :equal, :greater, according to the lexicographical ordering of the two lists list1 and list2 representing legal generators in this implementation.

Examples

In [5]:
(f-cmpr 123 789)
Out[5]:
:LESS
In [6]:
(s-cmpr 'circulation 'circular)
Out[6]:
:GREATER
In [7]:
(s-cmpr 'qwerty 'qwerty)
Out[7]:
:EQUAL
In [8]:
(l-cmpr '(1 a b) '(1 a))
Out[8]:
:GREATER

1.2.3 Functions handling combinations

The software provides a set of functions, methods, and macros to create or modify combinations.

Macro (term-cmbn dgr cf gnr)

Construct the combination of degree dgr with unique term cf * gnr.

Function (cmbn dgr cf1 gnr1 cf2 gnr2 ... cfn gnrn)

Construct a combination of degree dgr, sum of the terms $cf_i * gnr_i$. The sequence of pairs $\lbrace cf_i\ gnr_i\rbrace$ has an undefinite length and may be void. In this case, the combination is a null combination of degree dgr.

Function (cmbn-p object)

Test is object is a legal combination.

Macro `(cmbn-degr cmbn)

Get the degree (an integer) of the combination cmbn.

Macro (cmbn-list cmbn)

Get the list of the terms of the combination cmbn. Beware: a term is not a Kenzo object. One may select the coefficient (an integer) or the generator - a Kenzo object - respectively by the macros cffc and gnrt.

Function (zero-cmbn dgr)

Create an instance of a null combination in the degree dgr.

Function (zero-pure-dffr cmbn)

Create a null combination of degree $degr(cmbn) - 1$.

Macro (cmbn-zero-p cmbn)

Test if cmbn is a null combination in any degree.

Macro (cmbn-non-zero-p cmbn)

Test if cmbn is a non-null combination in any degree.

Function (cmbn-opps cmbn)

Create a combination opposite to cmbn.

Function (n-cmbn n cmbn)

Create a combination multiple of cmbn by the factor n.

Function (2cmbn-add cmpr cmbn1 cmbn2)

Create a combination, sum of both combinations cmbn1 and cmbn2. The first argument, cmpr, must be a function or macro relevant to compare the generators of the involved combinations, in order to return an ordered combination.

Function (ncmbn-add cmpr cmbn1 cmbn2 ... cmbnk)

Create a combination, sum of the indefinite number of combinations $cmbn_i$. As to the first argument, cmpr, see the function 2cmbn-add.

Function (2n-2cmbn cmpr n1 cmbn1 n2 cmbn2)

Build the combination n1 * cmbn1 + n2 * cmbn2. Both integers n1 and n2 must be non null. As to the first argument, cmpr, see the function 2cmbn-add.

Function (2cmbn-sbtr cmpr cmbn1 cmbn2)

Create a combination, difference of cmbn1 and cmbn2. As to the first argument, cmpr, see the function 2cmbn-add.

Examples

In [9]:
(def comb1 (cmbn 1 1 'u 2 'v 3 'w 4 'z))
Out[9]:
----------------------------------------------------------------------{CMBN 1}
<1 * U>
<2 * V>
<3 * W>
<4 * Z>
------------------------------------------------------------------------------
In [10]:
(cmbn-non-zero-p comb1)
Out[10]:
T
In [11]:
(cmbn-list comb1)
Out[11]:
((1 . U) (2 . V) (3 . W) (4 . Z))
In [12]:
(def term3 (third *))  ;; not a Kenzo object!
Out[12]:
(3 . W)
In [13]:
(cffc term3)
Out[13]:
3
In [14]:
(gnrt term3)
Out[14]:
W
In [15]:
(def mcomb1 (cmbn-opps comb1))
Out[15]:
----------------------------------------------------------------------{CMBN 1}
<-1 * U>
<-2 * V>
<-3 * W>
<-4 * Z>
------------------------------------------------------------------------------
In [16]:
(def comb2 (n-cmbn 10 comb1))
Out[16]:
----------------------------------------------------------------------{CMBN 1}
<10 * U>
<20 * V>
<30 * W>
<40 * Z>
------------------------------------------------------------------------------
In [17]:
(def cmb12 (2cmbn-add #'s-cmpr comb1 comb2))
Out[17]:
----------------------------------------------------------------------{CMBN 1}
<11 * U>
<22 * V>
<33 * W>
<44 * Z>
------------------------------------------------------------------------------
In [18]:
(2cmbn-sbtr #'s-cmpr comb1 cmb12)
Out[18]:
----------------------------------------------------------------------{CMBN 1}
<-10 * U>
<-20 * V>
<-30 * W>
<-40 * Z>
------------------------------------------------------------------------------
In [19]:
(ncmbn-add #'s-cmpr
           comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2)
Out[19]:
----------------------------------------------------------------------{CMBN 1}
<55 * U>
<110 * V>
<165 * W>
<220 * Z>
------------------------------------------------------------------------------

Representation of a chain complex

A chain complex is implemented as an instance of a CLOS class, the class CHAIN-COMPLEX, whose definition is

(DEFCLASS CHAIN-COMPLEX ()
    ((cmpr  :type cmprf :initarg :cmpr  :reader cmpr1)
     (basis :type basis :initarg :basis :reader basis1)
     ;; BaSe GeNerator
     (bsgn :type gnrt :initarg :bsgn :reader bsgn)
     ;; DiFFeRential
     (dffr :type morphism :initarg :dffr :reader dffr1)
     ;; GRound MoDule
     (grmd :type chain-complex :initarg :grmd :reader grmd)
     ;; EFfective HoMology
     (efhm :type homotopy-equivalence :initarg :efhm :reader efhm)
     ;; IDentification NuMber
     (idnm :type fixnum :initform (incf *idnm-counter*) :reader idnm)
     ;; ORiGiN
     (orgn :type list :initarg :orgn :reader orgn)))

This class has 8 slots:

  1. cmpr, a comparison function or method for generators with a range in the set [:less, :equal, :greater]. It is very important to note that the generators to be compared are assumed to be of the same degree, i.e. they must belong to the same group $C_p$. As an exception with the general policy of the software, this degree is not explicitly precised. The implementor has chosen to avoid additional tests because in real problems the program spends a lot of time comparing generators.
  2. basis, a lisp function giving the distinguished ordered basis of the free $\mathbb{Z}$-modules ($C_p$). (Recall that in the software, only free chain complexes are considered.) When some components of the chain complex are not finitely generated, we say that the chain complex is locally effective. In this case the value of this slot must be the keyword locally-effective.
  3. bsgn, a lisp object of any type representing a distinguished generator in dimension 0, the base generator.
  4. dffr, the differential morphism, instance of the class MORPHISM, defined hereafter. The pure lisp function corresponding to the differential homomorphism for each $p$ ($d_p : C_p \rightarrow C_{p-1}$) is defined in the instance morphism object and not directly in the instance chain complex object.
  5. idnm, an integer, number plate for this object. This is generated by the system in a sequential way, each time a new Kenzo object is created.
  6. orgn, a list containing a comment to recall to the user the origin of the object. This comment must be chosen with care because, when the user creates a new chain complex instance, the system Kenzo uses the comment list information to search in a specific list (here *chcm-list*) if the object has not been already built. So, one avoids the duplication of instances of the same object.

The two slots grmd and efhm will be explained later. The accessors of the slots are the functions whose name appears after the specifier :reader in the class definition. A printing method has been associated to the class CHAIN-COMPLEX and the external representation of a chain complex instance is a string like [Kn Chain-Complex], where n is the number plate of this Kenzo object.

The function build-chcm

To facilitate the construction of instances of the class CHAIN-COMPLEX and to free the user to call the standard constructor make-instance, the software provides the function

build-chcm :cmpr cmpr :basis basis :bsgn bsgn :intr-dffr intr-dffr :strt strt :orgn orgn

defined with keyword parameters. The returned value is an instance of the class CHAIN-COMPLEX. In particular, this function frees the user to build himself the instance of the class MORPHISM corresponding to the differential homomorphism. The keyword arguments of build-chcm are:

  • cmpr, the comparison function for generators.
  • basis, the function defining the distinguished basis of the free $\mathbb{Z}$-modules $C_p$ or the keyword :locally-effective.
  • bsgn, a generator, the base point of the underlying set.
  • intr-dffr, a lisp function defining the differential homomorphism for each $p$ ($d_p : C_p \rightarrow C_{p-1}$).
  • strt, one of the two values: :gnrt or :cmbn, defining the mapping strategy of the differential homomorphism, either by generator or by combination. The default is :gnrt. The real connection between the arguments intr-dffr and strtwill be detailed hereafter through typical examples. The general idea is the following: if the strategy is :gnrt, the :intr-dffr argument function uses two arguments, namely a degree and a generator of this degree and computes the boundary combination of this generator. If the strategy is :cmbn, the :intr-dffr argument function uses a combination as argument and computes the boundary combination of this argument. We recall that a combination contains its own degree.
  • orgn, a list containing a relevant and carefully chosen comment about the origin of the chain complex. If, during a Lisp session, the user wishes to modify any slot of an existing chain complex, by calling again build-chcm, he must change also the comment, otherwise the new version of the object will not be created. This remark is valid for any kind of instantiation of Kenzo objects. For avoiding such a constraint, one may use the function cat-init, before the redefinition.

After creation of an instance of chain complex, the function build-chcm pushes this object in the list of already created chain complexes *chcm-list*.

A first example of a chain complex

Let us consider our small example diabolo. We shall give the same name to the corresponding chain complex instance. Let us define, one by one, the values of the key parameters, though it is possible to put them directly in the build-chcm call. First, the function s-cmpr, already seen above, is the natural choice to compare generators, which are here, lisp symbols:

In [20]:
(def diabolo-cmpr #'s-cmpr)
Out[20]:
#<FUNCTION S-CMPR>

The function for the basis consists in enumerating the distinguished basis as lisp lists according to the degree:

In [21]:
(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[21]:
#<FUNCTION (LAMBDA (DMN) :IN "/home/gerd/git/cl-jupyter/cl-jupyter.lisp") {1006A2E96B}>

For the base point, we may choose any vertex:

In [22]:
(def diabolo-bspn 's0)
Out[22]:
S0

The lisp function for the differential homomorphism, also called boundary homomorphism, computes the boundary of each generator, in this case, according to the classical (simplicial) rule:

$$ {\bf d}[{s_0s_1\ldots s_n}] = \sum_{i=0}^n{(-1)^is_0s_1\ldots\widehat{s_i}\ldots s_n}.$$

It must be noted that our differential uses a predefined choice for the order of the vertices.

In [23]:
(def diabolo-pure-dffr
         #'(lambda (dmn gnr)
                   (unless (<= 0 dmn 2)
                       (error "Incorrect dimension for diabolo-dp."))
                   (case dmn
                       (0 (cmbn -1))  ; Note the null combination of degree -1
                       (1 (case gnr
                              (s01 (cmbn 0 -1 's0 1 's1))
                              (s02 (cmbn 0 -1 's0 1 's2))
                              (s12 (cmbn 0 -1 's1 1 's2))
                              (s23 (cmbn 0 -1 's2 1 's3))
                              (s34 (cmbn 0 -1 's3 1 's4))
                              (s35 (cmbn 0 -1 's3 1 's5))
                              (s45 (cmbn 0 -1 's4 1 's5))))
                       (2 (case gnr
                              (s345 (cmbn 1 1 's34 -1 's35 1 's45))))
                       (otherwise (error "Bad generator for complex diabolo")))))
Out[23]:
#<FUNCTION (LAMBDA (DMN GNR) :IN "/home/gerd/git/cl-jupyter/cl-jupyter.lisp") {1006C1AB5B}>

The strategy is by generator and the comment recalls the name of the problem:

In [24]:
(def diabolo-strt :GNRT)
Out[24]:
:GNRT
In [25]:
(def diabolo-orgn '(diabolo-for-example))
Out[25]:
(DIABOLO-FOR-EXAMPLE)

The effective call to build-chcm is now reduced to:

In [26]:
(def diabolo (build-chcm :cmpr diabolo-cmpr :basis diabolo-basis
                         :bsgn diabolo-bspn :intr-dffr diabolo-pure-dffr
                         :strt diabolo-strt :orgn diabolo-orgn))
Out[26]:
[K1 Chain-Complex]

The value of the symbol diabolo is the CHAIN-COMPLEX instance which is here the first created Kenzo object. The string [K1 Chain-Complex] is printed by the printing method associated to the class.

Simple functions handling chain complexes

Function (cat-init)

Clear among others, the list *chcm-list*, list of user created chain complexes and reset the global counter to 1. The existing objects and in particular here the chain complexes, are not destroyed but they will not enter any more in account during the search process for duplicated objects. This remark is general for the other types of objects saved in specific lists.

Functions (chcm n)

Return from the list *chcm-list* the chain complex instance whose the Kenzo identification is n; if it does not exist, return NIL.

Macro (cmpr object item1 item2)

Apply the comparison function associated to the chain complex object to the two generators item1 and item2.

Macro `(basis object n :dgnr)

With only one argument (object), get the function attached to the slot basis of the chain complex object. With two arguments, get the distinguished basis of the group of degree n in the chain complex object. If the chain complex is locally effective, this function returns an error because, in some degrees, the corresponding set of generators is probably infinite. With a third argument, the keyword :dgnr, get also the degenerate elements of the basis in degree n.

Macro (dffr chcm &rest)

Versatile macro to apply the differential morphism of the chain complex chcm either to a combination or a generator with a degree, respectively (dffr chcm cmbn) or (dffr chcm degr gnrt). The macro ?, described later, may be used for the same purpose.

Function (z-chcm)

Build the unit chain complex (see hereafter).

Examples

Let us apply some accessors functions and the simple functions above to the chain complex diabolo. First, we see that the list *chcm-list* contains only one element, namely the chain complex just created.

In [27]:
*chcm-list*
Out[27]:
([K1 Chain-Complex])
In [28]:
(chcm 1)
Out[28]:
[K1 Chain-Complex]
In [29]:
(orgn diabolo)
Out[29]:
(DIABOLO-FOR-EXAMPLE)
In [30]:
(idnm diabolo)
Out[30]:
1
In [31]:
(basis diabolo 0)
Out[31]:
(S0 S1 S2 S3 S4 S5)
In [32]:
(basis diabolo 1)
Out[32]:
(S01 S02 S12 S23 S34 S35 S45)
In [33]:
(basis diabolo 2)
Out[33]:
(S345)
In [34]:
(basis diabolo 10)
Out[34]:
NIL
In [35]:
(dffr diabolo 2 's345)
Out[35]:
----------------------------------------------------------------------{CMBN 1}
<1 * S34>
<-1 * S35>
<1 * S45>
------------------------------------------------------------------------------
In [36]:
(dffr diabolo *)
Out[36]:
----------------------------------------------------------------------{CMBN 0}
------------------------------------------------------------------------------

An important trivial case: the unit chain complex, $\mathbb{Z}$

The unit chain complex, has a unique non null component, namely a $\mathbb{Z}$-module of degree 0 generated by a unique generator, called here :Z-gnrt. It is defined by the following call to build-chcm:

In [37]:
(def ZCC
    (the chain-complex
         (build-chcm
          :cmpr #'(lambda (gnrt1 gnrt2)
                          (declare (ignore gnrt1 gnrt2))
                          (the cmpr :equal))
          :basis #'(lambda (n)
                           (the list
                                (if (zerop n) '(:Z-gnrt) +empty-list+)))
          :bsgn :Z-gnrt
          :intr-dffr #'(lambda (cmbn)
                               (the cmbn (zero-cmbn (1- (cmbn-degr cmbn)))))
          :strt :cmbn
          :orgn '(zcc-constant))))
Out[37]:
[K3 Chain-Complex]

In this definition,

  1. The :cmpr keyword argument is a function returning :equal on any pair on generators (because there is a unique generator!).
  2. The :basis keyword argument is a lisp function returning the null basis (the constant +empty-list+ = ()) for $p \not= 0$ and the list (:Z-gnrt), for $p=0$.
  3. The base generator is of course Z-gnrt.
  4. The :intr-dffr keyword argument is a lisp function defining the differential which, to any combination of degre $p$ of the chain complex, returns a null combination of degree $p-1$. This simple lisp function is also provided in Kenzo and is called zero-intr-dffr.
  5. The :strt keyword argument is the combination strategy (:cmbn).
  6. The :orgn keyword argument is the comment list (zcc-constant).

In the software Kenzo, the chain complex instance ZCC may be built, when needed, by the lisp statement: (z-chcm). This statement may be used freely each time one needs this chain complex, since the system recognizes if it has already been created.

The chain complex circle

On the model of the previous chain complex, one may define a function circle for building a chain complex having the same homology as the circle.

In [38]:
(defun CIRCLE ()
    (the chain-complex
         (build-chcm
          :cmpr #'(lambda (gnrt1 gnrt2)
                          (declare (ignore gnrt1 gnrt2))
                          (the cmpr :equal))
          :basis #'(lambda (dmns)
                           (the list
                                (case dmns (0 '(*)) (1 '(s1))
                                    (otherwise +empty-list+))))
          :bsgn '*
          :intr-dffr #'zero-intr-dffr
          :strt :cmbn
          :orgn '(circle))))
REDEFINITION-WITH-DEFUN: 
  #<SB-KERNEL:REDEFINITION-WITH-DEFUN {10041AEEF3}>
Out[38]:
CIRCLE

Morphisms

In [39]:
(documentation 'morphism 'type)
Out[39]:
"----------------------------------------------------------------[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 type CHAIN-COMPLEX, the source chain complex of this
   morphism. Its reader function is SORC.

2. TRGT, an object of type CHAIN-COMPLEX, the target chain complex of this
   morphism. Its reader function is TRGT.

3. DEGR, an integer, the degree of the morphism. Its reader function is DEGR.

4. INTR, a Lisp INTeRnal function implementing the morphism, taking account
   of the strategy STRT. Its reader function is INTR.

5. STRT, a symbol, one of :GNRT or :CMBN. Its reader function is STRT.

   If this slot is :GNRT, the implementation of INTR is a function:
     (function (degr gnrt) cmbn)
   and for any call of this function, the result is stored in the slot
   RSLTS to avoid later a possibly long recalculation for  the same
   argument.

   If this slot is :CMBN, the implementation of INTR is a function:
     (function (cmbn) cmbn)
   and the RSLTS slot is not used. Think for example to an identity or
   null function, where storing a result is wasted time.

6. ???-CLNM, an integer updated by the system for internal statistics. Its
   reader function is ???-CLNM.

7. ?-CLNM, another integer maintained by the system for internal pusposes. Its
   reader function is ?-CLNM.

8. RSLTS, an array of length +MAXIMAL-DIMENSION+ reserved by the system for
   caching intermediate results. Its reader function is RSLTS.

9. IDNM, an integer, a system-generated identifier for this object. Its reader
   function is IDNM.

10. ORGN, a list which is the copy of a Lisp statement, in principle the
    statement which was at the origin of the creation of this Kenzo object.
    A caching process, using this slot, prevents the creation of multiple
    copies of the same mathematical object, which is important for efficiency.
    It is used also for debugging and analyzing the program.
-----------------------------------------------------------------------------"

The function $\texttt{build-mprh}$

In [40]:
(documentation 'build-mrph 'function)
Out[40]:
"--------------------------------------------------------------[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 which is the copy of a Lisp statement, in principle the
            statement which was at the origin of the creation of this Kenzo
            object. A caching process, using this slot, prevents the creation
            of multiple copies of the same mathematical object, which is
            important for efficiency. It is used also for debugging and
            analyzing the program.

Use this function instead of creating instances via the standard constructor
MAKE-INSTANCE.
------------------------------------------------------------------------------"

The differential homomorphism in a chain complex instance

In [41]:
(cat-init)
---done---
Out[41]:
NIL
In [42]:
(def ZCC (z-chcm))
Out[42]:
[K1 Chain-Complex]
In [43]:
(def zero-morphism (build-mrph :sorc ZCC
                               :trgt ZCC
                               :degr -1
                               :intr #'(lambda (comb)
                                               (cmbn (1- (degr comb))))
                               :strt :cmbn
                               :orgn '(zero morphism on ZCC)))
Out[43]:
[K3 Cohomology-Class on K1 of degree 1]
In [44]:
(def id-morphism (build-mrph :sorc ZCC
                             :trgt ZCC
                             :degr 0
                             :intr #'identity
                             :strt :cmbn
                             :orgn '(identity morphism on ZCC)))
Out[44]:
[K4 Cohomology-Class on K1 of degree 0]

Applying morphisms

Functions defining morphisms

In [45]:
(def ccn-boundary #'(lambda (dgr gnr)
                            (if (evenp (+ dgr gnr))
                                (cmbn (1- dgr) 1 (- gnr 10))
                                (cmbn (1- dgr)))))
Out[45]:
#<FUNCTION (LAMBDA (DGR GNR) :IN "/home/gerd/git/cl-jupyter/cl-jupyter.lisp") {100454E2CB}>
In [46]:
(def ccn (build-chcm :cmpr #'f-cmpr
                     :basis #'(lambda (n) (<a-b< (* 10 n) (* 10 (1+ n))))
                     :bsgn 0
                     :intr-dffr ccn-boundary
                     :strt :gnrt
                     :orgn '(ccn)))
Out[46]:
[K5 Chain-Complex]
In [47]:
(def upper-shift (build-mrph
                  :sorc ccn :trgt ccn :strt :gnrt :degr +1
                  :intr #'(lambda (d gn) (cmbn (1+ d) 1 (+ gn 10)))
                  :orgn '(ccn shift +10)))
Out[47]:
[K7 Morphism (degree 1): K5 -> K5]
In [48]:
(def lower-shift (build-mrph
                  :sorc ccn :trgt ccn :strt :gnrt :degr -1
                  :intr #'(lambda (d gn) (cmbn (1- d) 1 (- gn 10)))
                  :orgn '(ccn shift -10)))
Out[48]:
[K8 Morphism (degree -1): K5 -> K5]
In [49]:
(? ccn 2 22)
Out[49]:
----------------------------------------------------------------------{CMBN 1}
<1 * 12>
------------------------------------------------------------------------------
In [50]:
(? ccn *)
Out[50]:
----------------------------------------------------------------------{CMBN 0}
------------------------------------------------------------------------------
In [51]:
(def combn (cmbn 5 1 50 5 55 9 59))
Out[51]:
----------------------------------------------------------------------{CMBN 5}
<1 * 50>
<5 * 55>
<9 * 59>
------------------------------------------------------------------------------
In [52]:
(? ccn combn)
Out[52]:
----------------------------------------------------------------------{CMBN 4}
<5 * 45>
<9 * 49>
------------------------------------------------------------------------------
In [53]:
(? ccn *)
Out[53]:
----------------------------------------------------------------------{CMBN 3}
------------------------------------------------------------------------------
In [54]:
(? upper-shift 0 6)
Out[54]:
----------------------------------------------------------------------{CMBN 1}
<1 * 16>
------------------------------------------------------------------------------
In [55]:
(? lower-shift 5 51)
Out[55]:
----------------------------------------------------------------------{CMBN 4}
<1 * 41>
------------------------------------------------------------------------------
In [56]:
(? lower-shift (? lower-shift 5 51))
Out[56]:
----------------------------------------------------------------------{CMBN 3}
<1 * 31>
------------------------------------------------------------------------------
In [57]:
(def comb1 (cmbn 1 1 10 2 11 3 12 4 13))
Out[57]:
----------------------------------------------------------------------{CMBN 1}
<1 * 10>
<2 * 11>
<3 * 12>
<4 * 13>
------------------------------------------------------------------------------
In [58]:
(def identity? (cmps upper-shift lower-shift))
Out[58]:
[K9 Morphism (degree 0): K5 -> K5]
In [59]:
(degr identity?)
Out[59]:
0
In [60]:
(? identity? comb1)
Out[60]:
----------------------------------------------------------------------{CMBN 1}
<1 * 10>
<2 * 11>
<3 * 12>
<4 * 13>
------------------------------------------------------------------------------
In [61]:
(2cmbn-sbtr (cmpr ccn) comb1 *)
Out[61]:
----------------------------------------------------------------------{CMBN 1}
------------------------------------------------------------------------------
In [62]:
(def upper-shift2 (cmps upper-shift upper-shift))
Out[62]:
[K10 Morphism (degree 2): K5 -> K5]
In [63]:
(degr upper-shift2)
Out[63]:
2
In [64]:
(? upper-shift2 comb1)
Out[64]:
----------------------------------------------------------------------{CMBN 3}
<1 * 30>
<2 * 31>
<3 * 32>
<4 * 33>
------------------------------------------------------------------------------
In [65]:
(def twice-up-shift (add upper-shift upper-shift))
Out[65]:
[K11 Morphism (degree 1): K5 -> K5]
In [66]:
(degr twice-up-shift)
Out[66]:
1
In [67]:
(? twice-up-shift comb1)
Out[67]:
----------------------------------------------------------------------{CMBN 2}
<2 * 20>
<4 * 21>
<6 * 22>
<8 * 23>
------------------------------------------------------------------------------
In [68]:
(def up-d (cmps upper-shift (dffr1 ccn)))
Out[68]:
[K12 Morphism (degree 0): K5 -> K5]
In [69]:
(def d-up (cmps (dffr1 ccn) upper-shift))
Out[69]:
[K13 Morphism (degree 0): K5 -> K5]
In [70]:
(? up-d 1 11)
Out[70]:
----------------------------------------------------------------------{CMBN 1}
<1 * 11>
------------------------------------------------------------------------------
In [71]:
(? d-up 1 11)
Out[71]:
----------------------------------------------------------------------{CMBN 1}
------------------------------------------------------------------------------
In [72]:
(def comb3 (cmbn 1 1 10 2 11 3 12 4 13 5 14 6 15))
Out[72]:
----------------------------------------------------------------------{CMBN 1}
<1 * 10>
<2 * 11>
<3 * 12>
<4 * 13>
<5 * 14>
<6 * 15>
------------------------------------------------------------------------------
In [73]:
(? up-d comb3)
Out[73]:
----------------------------------------------------------------------{CMBN 1}
<2 * 11>
<4 * 13>
<6 * 15>
------------------------------------------------------------------------------
In [74]:
(? d-up comb3)
Out[74]:
----------------------------------------------------------------------{CMBN 1}
<1 * 10>
<3 * 12>
<5 * 14>
------------------------------------------------------------------------------

Accessing Kenzo objects

Up to now, we have seen two kinds of Kenzo objects stored in specific lists and retrievable by a number, namely the chain complexes and the morphisms. The retrieval functions are specific to the object: chcm for a chain complex, mrph for a morphism. The same scheme will be applied for others kinds of objects: reductions, homotopy equivalences, coalgebras, algebras, simplicial morphism, etc, each having its specific list. But, in fact the numbering is independent of the type of the object and is incremented each time an object is created. Three general functions are at the disposal of the user to get information about the n-th Kenzo object: K, KD, and KD2. They may be useful for debugging purpose.

Function K

In [75]:
(documentation 'k 'function)
Out[75]:
"--------------------------------------------------------------[function-doc]
K
Args: (idnm)
Returns the IDNM-th Kenzo object.
------------------------------------------------------------------------------"
In [76]:
(k 1)
Out[76]:
[K1 Chain-Complex]

Function KD

In [77]:
(documentation 'kd 'function)
Out[77]:
"--------------------------------------------------------------[function-doc]
KD
Args: (idnm)
Return the type of Kenzo object number IDNM and print the comment list
(SLOT :ORGN) of the object.
------------------------------------------------------------------------------"
In [78]:
(kd 1)
Object: [K1 Chain-Complex]
  Origin: (Z-CHCM)

Out[78]:
NIL
In [79]:
(k 3)
Out[79]:
[K3 Cohomology-Class on K1 of degree 1]
In [80]:
(kd 3)
Object: [K3 Cohomology-Class on K1 of degree 1]
  Origin: (ZERO MORPHISM ON ZCC)

Out[80]:
NIL
In [81]:
(kd 8)
Object: [K8 Morphism (degree -1): K5 -> K5]
  Origin: (CCN SHIFT -10)

Out[81]:
NIL
In [82]:
(kd 5)
Object: [K5 Chain-Complex]
  Origin: (CCN)

Out[82]:
NIL
In [83]:
(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[83]:
NIL

Function KD2

In [84]:
(documentation 'kd2 'function)
Out[84]:
"--------------------------------------------------------------[function-doc]
KD2
Args: (idnm)
Return the type of Kenzo object number IDNM, print the comment list
(SLOT :ORGN) of the object and, recursively, return the same information
for all Kenzo objects of the same type in relation with this object. Return
the list of object numbers.
------------------------------------------------------------------------------"
In [85]:
(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[85]:
(9 8 7)