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

2652 lines
83 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"To load \"kenzo\":\n",
" Load 1 ASDF system:\n",
" kenzo\n",
"\n",
"; Loading \"kenzo\"\n",
"\n"
]
},
{
"data": {
"text/plain": [
"(KENZO)"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(ql:quickload 'kenzo)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"#<PACKAGE \"CAT\">"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(in-package \"CAT\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"---done---"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat-init)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chain Complexes\n",
"\n",
"## Introduction\n",
"\n",
"A *chain complex* $(C_p, d_p)$ is a collection of free $\\mathbb{Z}$-modules $(C_p)$, one for each\n",
"$p \\in \\mathbb{Z}$, together with a homomorphism $d_p : C_p \\rightarrow C_{p-1}$, such\n",
"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.)\n",
"\n",
"__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\n",
"\n",
"$$f_p : C_p \\rightarrow C'_{p+k}.$$\n",
"\n",
"This is expressed by the following diagram, generally __not assumend commutative__.\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"\\cdots & \\leftarrow & C_{p-1} & \\quad\\xleftarrow{d_p} & C_p & \\quad\\xleftarrow{d_{p+1}} & C_{p+1} & \\quad\\leftarrow & \\cdots \\\\\n",
" & & f_{p-1} \\Bigg\\downarrow & & f_p \\Bigg\\downarrow & & f_{p+1} \\Bigg\\downarrow \\\\\n",
"\\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}\n",
"$$\n",
"\n",
"Three types of morphisms are most generally considered.\n",
"\n",
"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*.\n",
"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$.\n",
"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'$.\n",
"\n",
"For technical reasons, these three types of morphisms have been implemented in the $\\texttt{Kenzo}$ program\n",
"in a unique type.\n",
"\n",
"\n",
"## Generators, terms, and combinations\n",
"\n",
"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."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAj0AAAD5CAYAAADMd4SKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAACh1SURBVHhe7d0LkFZlHcfxB8UL4zXNdIwIgUlNnbyPl10kdVzM+wyjLFqhKQZYluGik5YllUs2XlJINKGpWHSYvOdCyiQgGmrmJTVjsVHSNK+paSoSv2fPf3n27Hn3Avteznm+n5m3c3tfzXfPe87/PM/vPGfAmrUcAABAwW2UTAEAAAqNogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBogcAAESBoicSS5cudQMGDOh4jR49OtnS2bx58/z2SZMmJWsAACgGip4IrFy50tXX1ydL7RYsWNClsNFyY2NjsgQA+WcXcvbq7oLO3oPiouiJwPz58/20ubnZrVmzxrW1tfnlhQsX+qmMGDHCzZw50w0fPjxZAwD5phbu9IWcjnPTp09PltYp1fqNYqHoicjUqVN9q8+wYcN88bNixYpkSzsVQ9OmTUuWACDf5s6d66ctLS3+mLdkyRK/vGjRIj81KoLU+o3io+iJQFNTUzLnfEuOmm/VshNSAaRiCACKxlp76urqfPHT2trql0WtQbognDhxYrIGRUbREwn90MOuK7XqpAsfACiSKVOmJHPr8jrpbqzx48f7Y+OMGTOSNSgyip6IqDUnbOJV4aOrHAAoIuvKD6kbywofhZp1HJwzZ45fRvFR9ERAP3Bd4eguBlETb0NDg58HgKJT4aOXsj2iwkf5RoWaRXe3hndtaZ4LwmKi6ImAmm9F/drWxGuhPRVAAFBE6sIPC5ixY8dyh2rkKHoioB+6XeGE0s2+AFAkEyZM8FNrydFL3VkqfKzrK3wZzXNBWEwD1v5xOfMBAApJt6Pr7iyjgic9XIdRUSScFouLogcAAESB7i0AABAFih4AABAFih4AABAFih4AABAFgswReu655zoeuHf44Ye7XXbZxc8DQNFx/IsbRU9EnnzySXfssce6V1991W266aZ+3QcffOA++clPujvvvNPtueeefh0AFA3HPwhFTyT0gz/ssMPc6tWr3VtvvZWsbbfNNtu4jTfe2N1333388AEUDsc/GIqeSAwdOtS98MIL7uOPP07WdLbRRhu5IUOG+KZfACgSjn8wBJkjoB+ymnRL/eBF2/SeV155JVkDAPnH8Q8hip4IKLQ3aNCgZKm0LbbYwi1evDhZAoD84/iHEEVPJHrTi/nRRx916e8GgLzj+AdD0RMB3Zb53nvvJUul6T16LwAUBcc/hCh6IqBxKHbYYQcf1itF2wYOHOgeeuihZA0A5F9vj396D2P2FB93b0VCt2yOHDnSj0vx7rvvJmvbqS97k002cW+++aZf/uY3v+muuuoqPw8AeaNj2YMPPuhf999/v9txxx3dHXfc4Y9/77//fvKudjr+adwe5Xm4Zb34KHoiosLnmGOO8Xco2J99wIAB7lOf+pS76667XGtrqzv//PP9+n333ddde+217qCDDvLLAFCLPvzwQ/fYY4+5v/zlL52mb7/9tt++9957uwsuuMB3X2n6xhtv+OOfWnfC4x8FTxwoeiKkWzhvvPFGP3/GGWd0atLVldHkyZPdn//8Z7/805/+1E2ZMsXPA0C1vfzyyx2FjRU5Tz31VLK1q/POO88df/zxyZJzL730kmtsbPTzK1eupEsrMhQ9kTr99NP9dPbs2X6api6un//8537+xBNPdNdcc4379Kc/7ZcBoBreeecd19zc7I9H1h3fnf3228/97Gc/S5bWGTVqlJ9y+osPQeYIPfHEE37sCr00n+Xqq692N910k38uza233ur22Wcfd/PNNydbAaDyttxyS3fppZe6Rx55xF155ZXuiCOOSLZ0pRzPqaeemiwB7Sh6IqT+6+eff96/NF/KySef7JuO1dLz73//251yyinu3HPPTbYCQHUMGzbMH4vuueeeTl1XoaOPPtpnE4EQRU9kNPhWWOhovrsBudSldcstt/hsj6gFSE3Gyv4AQLU88MAD/lh0++23J2vWUbGjogdIo+iJjIqcpUuXJkvOz3fX2mMUZtZBRgcThZwPPvhgd/nllydbAaBydOw55JBD/LFojz32cJdcckmyxfnhN770pS/57i0gjaInMlkFTm+KHtHt6+pL/8Y3vuGXdXv7SSed5P75z3/6ZQAoJx1rdMyxoTV0F5aG1lDm0KjgOfLII5MloDOKnoiUatVJt/70hJAzgErTMUZj7uiYs9122/lA89lnn+23bb311m6rrbbyt5/TrYXuUPRERMVNVn4nnfPp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jtyyPXbXPnz/fTzlhQNLFsVh+R/tR2K0U3vqrk4ieYK3t1oUQmjVrVjLX3nKjjI91h02bNq1L65AyPVqfpv1UhVfYcmkFWdi1izhNmDDBT7U/Wfe+FTXad2yf0/6nbbbf2edQQGuv/lFgzc3N6tvq8lr7o0/esSZz+9qr82QrYrP2pJC5T4Qv7VehcFtLS8uatYVIx3JDQ0PHvOiz2r9snV76d4b0zwi32/6YXm/Cf1+4HkgfA8Njn6T3xfS+jWIZoP9Z+4dGgemqO7y1WFc5YVBZV9paZ9QFphYhAACKhKIHAABEgUwPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIAkUPAACIgHP/B7khz1wG257bAAAAAElFTkSuQmCC",
"text/plain": [
"#<CL-JUPYTER-USER::PNG-BYTES {10062E7BA3}>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cl-jupyter-user:png-from-file \"diabolo.png\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this simplicial complex, called here *diabolo*, there are 3 associated chain groups.\n",
"\n",
"* $C_0$, the free $\\mathbb{Z}$-module on the set of vertices $\\{s_0,s_1,s_2,s_3,s_4,s_5\\}$\n",
"* $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}\\}$\n",
"* $C_2$, the free $\\mathbb{Z}$-module on the set of triangles (here a singleton) $\\{s_{345}\\}$\n",
"\n",
"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\n",
"$$\\sum\\lambda_i\\sigma_i, \\quad \\lambda_i\\in\\mathbb{Z}.$$\n",
"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*.\n",
"\n",
"### Representation of a combination\n",
"\n",
"A combination is represented internally in the system by a structure having the following general form:\n",
"\n",
"$$\\#\\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{)))}$$\n",
"and containing\n",
"\n",
"1. The degree of the combination corresponding to the index $p\\in\\mathbb{Z}$ of the group $C_p$ to which this combination belongs.\n",
"2. The list of the internal representation of the terms, namely the list of pairs $(\\lambda_i\\cdot\\sigma_i)$.\n",
"\n",
"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.\n",
"\n",
"### Ordering the generators\n",
"\n",
"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:\n",
"```lisp\n",
"(deftype cmpr() '(member :less :equal :greater))\n",
"```\n",
"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:\n",
"\n",
"> *Function* `(f-cmpr n1 n2)`\n",
">> Return `:less`, `:equal`, `:greater`, according to the result of the canonical comparison of both integers `n1` and `n2`.\n",
"\n",
"> *Function* `(s-cmpr symbol1 symbol2)`\n",
">> Return `:less`, `:equal`, `:greater`, according to the result of the lisp comparison functions on the strings `(symbol-name symbol1)` and `(symbol-name symbol2)`\n",
"\n",
"> *Function* `(l-cmpr list1 list2)`\n",
">> Return `:less`, `:equal`, `:greater`, according to the lexicographical ordering of the two lists `list1`\n",
"and `list2` representing legal generators in this implementation.\n",
"\n",
"#### Examples"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
":LESS"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(f-cmpr 123 789)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
":GREATER"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(s-cmpr 'circulation 'circular)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
":EQUAL"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(s-cmpr 'qwerty 'qwerty)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
":GREATER"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(l-cmpr '(1 a b) '(1 a))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1.2.3 Functions handling combinations\n",
"\n",
"The software provides a set of functions, methods, and macros to create or modify combinations.\n",
"\n",
"> *Macro* `(term-cmbn dgr cf gnr)`\n",
">> Construct the combination of degree `dgr` with unique term `cf * gnr`.\n",
"\n",
"> *Function* `(cmbn dgr cf1 gnr1 cf2 gnr2 ... cfn gnrn)`\n",
">> 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`. \n",
"\n",
"> *Function* `(cmbn-p object)`\n",
">> Test is `object` is a legal combination.\n",
"\n",
"> *Macro* `(cmbn-degr cmbn)\n",
">> Get the degree (an integer) of the combination `cmbn`.\n",
"\n",
"> *Macro* `(cmbn-list cmbn)`\n",
">> 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`.\n",
"\n",
"> *Function* `(zero-cmbn dgr)`\n",
">> Create an instance of a null combination in the degree `dgr`.\n",
"\n",
"> *Function* `(zero-pure-dffr cmbn)`\n",
">> Create a null combination of degree $degr(cmbn) - 1$.\n",
"\n",
"> *Macro* `(cmbn-zero-p cmbn)`\n",
">> Test if `cmbn` is a null combination in any degree.\n",
"\n",
"> *Macro* `(cmbn-non-zero-p cmbn)`\n",
">> Test if `cmbn` is a non-null combination in any degree.\n",
"\n",
"> *Function* `(cmbn-opps cmbn)`\n",
">> Create a combination opposite to `cmbn`.\n",
"\n",
"> *Function* `(n-cmbn n cmbn)`\n",
">> Create a combination multiple of `cmbn` by the factor `n`.\n",
"\n",
"> *Function* `(2cmbn-add cmpr cmbn1 cmbn2)`\n",
">> 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.\n",
"\n",
"> *Function* `(ncmbn-add cmpr cmbn1 cmbn2 ... cmbnk)`\n",
">> Create a combination, sum of the indefinite number of combinations $cmbn_i$. As to the first argument, `cmpr`, see the function `2cmbn-add`.\n",
"\n",
"> *Function* `(2n-2cmbn cmpr n1 cmbn1 n2 cmbn2)`\n",
">> Build the combination `n1 * cmbn1 + n2 * cmbn2`. Both integers `n1` and `n2` must be\n",
"non null. As to the first argument, `cmpr`, see the function `2cmbn-add`.\n",
"\n",
"> *Function* `(2cmbn-sbtr cmpr cmbn1 cmbn2)`\n",
">> Create a combination, difference of `cmbn1` and `cmbn2`. As to the first argument, `cmpr`, see the function `2cmbn-add`.\n",
"\n",
"#### Examples"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * U>\n",
"<2 * V>\n",
"<3 * W>\n",
"<4 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def comb1 (cmbn 1 1 'u 2 'v 3 'w 4 'z))"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"T"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cmbn-non-zero-p comb1)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"((1 . U) (2 . V) (3 . W) (4 . Z))"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cmbn-list comb1)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(3 . W)"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def term3 (third *)) ;; not a Kenzo object!"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"3"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cffc term3)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"W"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(gnrt term3)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<-1 * U>\n",
"<-2 * V>\n",
"<-3 * W>\n",
"<-4 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def mcomb1 (cmbn-opps comb1))"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<10 * U>\n",
"<20 * V>\n",
"<30 * W>\n",
"<40 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def comb2 (n-cmbn 10 comb1))"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<11 * U>\n",
"<22 * V>\n",
"<33 * W>\n",
"<44 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def cmb12 (2cmbn-add #'s-cmpr comb1 comb2))"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<-10 * U>\n",
"<-20 * V>\n",
"<-30 * W>\n",
"<-40 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(2cmbn-sbtr #'s-cmpr comb1 cmb12)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<55 * U>\n",
"<110 * V>\n",
"<165 * W>\n",
"<220 * Z>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(ncmbn-add #'s-cmpr\n",
" comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Representation of a chain complex\n",
"\n",
"A chain complex is implemented as an instance of a `CLOS` class, \n",
"the class `CHAIN-COMPLEX`, whose definition is\n",
"\n",
"```lisp\n",
"(DEFCLASS CHAIN-COMPLEX ()\n",
" ((cmpr :type cmprf :initarg :cmpr :reader cmpr1)\n",
" (basis :type basis :initarg :basis :reader basis1)\n",
" ;; BaSe GeNerator\n",
" (bsgn :type gnrt :initarg :bsgn :reader bsgn)\n",
" ;; DiFFeRential\n",
" (dffr :type morphism :initarg :dffr :reader dffr1)\n",
" ;; GRound MoDule\n",
" (grmd :type chain-complex :initarg :grmd :reader grmd)\n",
" ;; EFfective HoMology\n",
" (efhm :type homotopy-equivalence :initarg :efhm :reader efhm)\n",
" ;; IDentification NuMber\n",
" (idnm :type fixnum :initform (incf *idnm-counter*) :reader idnm)\n",
" ;; ORiGiN\n",
" (orgn :type list :initarg :orgn :reader orgn)))\n",
"```\n",
"\n",
"This class has 8 slots:\n",
"\n",
"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.\n",
"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`.\n",
"3. `bsgn`, a lisp object of any type representing a distinguished generator in dimension 0, the base generator. \n",
"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.\n",
"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.\n",
"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.\n",
"\n",
"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]`, \n",
"where `n` is the number plate of this `Kenzo` object.\n",
"\n",
"\n",
"### The function `build-chcm`\n",
"\n",
"To facilitate the construction of instances of the class `CHAIN-COMPLEX` and to free the user to call\n",
"the standard constructor `make-instance`, the software provides the function\n",
"\n",
"```lisp\n",
"build-chcm :cmpr cmpr :basis basis :bsgn bsgn :intr-dffr intr-dffr :strt strt :orgn orgn\n",
"```\n",
"\n",
"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:\n",
"\n",
"- `cmpr`, the comparison function for generators.\n",
"- `basis`, the function defining the distinguished basis of the free $\\mathbb{Z}$-modules $C_p$ or the keyword `:locally-effective`.\n",
"- `bsgn`, a generator, the base point of the underlying set.\n",
"- `intr-dffr`, a **lisp function** defining the differential homomorphism for each $p$ ($d_p : C_p \\rightarrow C_{p-1}$).\n",
"- `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 `strt`will 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.\n",
"- `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.\n",
"\n",
"After creation of an instance of chain complex, the function `build-chcm` pushes this\n",
"object in the list of already created chain complexes `*chcm-list*`.\n",
"\n",
"#### A first example of a chain complex\n",
"\n",
"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:"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"#<FUNCTION S-CMPR>"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def diabolo-cmpr #'s-cmpr)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The function for the basis consists in enumerating the distinguished basis as lisp lists according to the degree:"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"#<FUNCTION (LAMBDA (DMN) :IN \"/home/gerd/git/cl-jupyter/cl-jupyter.lisp\") {1006A2E96B}>"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def diabolo-basis #'(lambda (dmn)\n",
" (case dmn\n",
" (0 '(s0 s1 s2 s3 s4 s5))\n",
" (1 '(s01 s02 s12 s23 s34 s35 s45))\n",
" (2 '(s345))\n",
" (otherwise nil))))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For the base point, we may choose any vertex:"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"S0"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def diabolo-bspn 's0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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:\n",
"\n",
"$$ {\\bf d}[{s_0s_1\\ldots s_n}] = \\sum_{i=0}^n{(-1)^is_0s_1\\ldots\\widehat{s_i}\\ldots s_n}.$$\n",
"\n",
"It must be noted that our differential uses a predefined choice for the order of the vertices."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"#<FUNCTION (LAMBDA (DMN GNR) :IN \"/home/gerd/git/cl-jupyter/cl-jupyter.lisp\") {1006C1AB5B}>"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def diabolo-pure-dffr\n",
" #'(lambda (dmn gnr)\n",
" (unless (<= 0 dmn 2)\n",
" (error \"Incorrect dimension for diabolo-dp.\"))\n",
" (case dmn\n",
" (0 (cmbn -1)) ; Note the null combination of degree -1\n",
" (1 (case gnr\n",
" (s01 (cmbn 0 -1 's0 1 's1))\n",
" (s02 (cmbn 0 -1 's0 1 's2))\n",
" (s12 (cmbn 0 -1 's1 1 's2))\n",
" (s23 (cmbn 0 -1 's2 1 's3))\n",
" (s34 (cmbn 0 -1 's3 1 's4))\n",
" (s35 (cmbn 0 -1 's3 1 's5))\n",
" (s45 (cmbn 0 -1 's4 1 's5))))\n",
" (2 (case gnr\n",
" (s345 (cmbn 1 1 's34 -1 's35 1 's45))))\n",
" (otherwise (error \"Bad generator for complex diabolo\")))))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The strategy is by generator and the comment recalls the name of the problem:"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
":GNRT"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def diabolo-strt :GNRT)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(DIABOLO-FOR-EXAMPLE)"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def diabolo-orgn '(diabolo-for-example))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The effective call to `build-chcm` is now reduced to:"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K1 Chain-Complex]"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def diabolo (build-chcm :cmpr diabolo-cmpr :basis diabolo-basis\n",
" :bsgn diabolo-bspn :intr-dffr diabolo-pure-dffr\n",
" :strt diabolo-strt :orgn diabolo-orgn))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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.\n",
"\n",
"### Simple functions handling chain complexes\n",
"\n",
"> *Function* `(cat-init)`\n",
">> 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. \n",
"\n",
"> *Functions* `(chcm n)`\n",
">> Return from the list `*chcm-list*` the chain complex instance whose the Kenzo identification is `n`; if it does not exist, return `NIL`.\n",
"\n",
"> *Macro* `(cmpr object item1 item2)`\n",
">> Apply the comparison function associated to the chain complex `object` to the two generators `item1` and `item2`.\n",
"\n",
"> *Macro* `(basis object n :dgnr)\n",
">> 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`.\n",
"\n",
"> *Macro* `(dffr chcm &rest)`\n",
">> 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.\n",
"\n",
"> *Function* `(z-chcm)`\n",
">> Build the unit chain complex (see hereafter).\n",
"\n",
"#### Examples\n",
"\n",
"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."
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"([K1 Chain-Complex])"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"*chcm-list*"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K1 Chain-Complex]"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(chcm 1)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(DIABOLO-FOR-EXAMPLE)"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(orgn diabolo)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(idnm diabolo)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(S0 S1 S2 S3 S4 S5)"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(basis diabolo 0)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(S01 S02 S12 S23 S34 S35 S45)"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(basis diabolo 1)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(S345)"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(basis diabolo 2)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(basis diabolo 10)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * S34>\n",
"<-1 * S35>\n",
"<1 * S45>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(dffr diabolo 2 's345)"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 0}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(dffr diabolo *)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### An important trivial case: the unit chain complex, $\\mathbb{Z}$\n",
"\n",
"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`:"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K3 Chain-Complex]"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def ZCC\n",
" (the chain-complex\n",
" (build-chcm\n",
" :cmpr #'(lambda (gnrt1 gnrt2)\n",
" (declare (ignore gnrt1 gnrt2))\n",
" (the cmpr :equal))\n",
" :basis #'(lambda (n)\n",
" (the list\n",
" (if (zerop n) '(:Z-gnrt) +empty-list+)))\n",
" :bsgn :Z-gnrt\n",
" :intr-dffr #'(lambda (cmbn)\n",
" (the cmbn (zero-cmbn (1- (cmbn-degr cmbn)))))\n",
" :strt :cmbn\n",
" :orgn '(zcc-constant))))"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"In this definition,\n",
"\n",
"1. The `:cmpr` keyword argument is a function returning `:equal` on any pair on generators (because there is a unique generator!).\n",
"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$.\n",
"3. The base generator is of course `Z-gnrt`.\n",
"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`.\n",
"5. The `:strt` keyword argument is the combination strategy (`:cmbn`).\n",
"6. The `:orgn` keyword argument is the comment list `(zcc-constant)`.\n",
"\n",
"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."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The chain complex `circle`\n",
"\n",
"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."
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"REDEFINITION-WITH-DEFUN: \n",
" #<SB-KERNEL:REDEFINITION-WITH-DEFUN {10041AEEF3}>\n"
]
},
{
"data": {
"text/plain": [
"CIRCLE"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(defun CIRCLE ()\n",
" (the chain-complex\n",
" (build-chcm\n",
" :cmpr #'(lambda (gnrt1 gnrt2)\n",
" (declare (ignore gnrt1 gnrt2))\n",
" (the cmpr :equal))\n",
" :basis #'(lambda (dmns)\n",
" (the list\n",
" (case dmns (0 '(*)) (1 '(s1))\n",
" (otherwise +empty-list+))))\n",
" :bsgn '*\n",
" :intr-dffr #'zero-intr-dffr\n",
" :strt :cmbn\n",
" :orgn '(circle))))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Morphisms"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\"----------------------------------------------------------------[class-doc]\n",
"MORPHISM\n",
"Slots: (sorc trgt degr intr strt ???-clnm ?-clnm rslts idnm orgn)\n",
"Intances of this class represent morphisms between chain complexes, and the\n",
"differential homomorphism of a chain complex is treated as a morphism of\n",
"degree -1. The class has 10 slots:\n",
"\n",
"1. SORC, an object of type CHAIN-COMPLEX, the source chain complex of this\n",
" morphism. Its reader function is SORC.\n",
"\n",
"2. TRGT, an object of type CHAIN-COMPLEX, the target chain complex of this\n",
" morphism. Its reader function is TRGT.\n",
"\n",
"3. DEGR, an integer, the degree of the morphism. Its reader function is DEGR.\n",
"\n",
"4. INTR, a Lisp INTeRnal function implementing the morphism, taking account\n",
" of the strategy STRT. Its reader function is INTR.\n",
"\n",
"5. STRT, a symbol, one of :GNRT or :CMBN. Its reader function is STRT.\n",
"\n",
" If this slot is :GNRT, the implementation of INTR is a function:\n",
" (function (degr gnrt) cmbn)\n",
" and for any call of this function, the result is stored in the slot\n",
" RSLTS to avoid later a possibly long recalculation for the same\n",
" argument.\n",
"\n",
" If this slot is :CMBN, the implementation of INTR is a function:\n",
" (function (cmbn) cmbn)\n",
" and the RSLTS slot is not used. Think for example to an identity or\n",
" null function, where storing a result is wasted time.\n",
"\n",
"6. ???-CLNM, an integer updated by the system for internal statistics. Its\n",
" reader function is ???-CLNM.\n",
"\n",
"7. ?-CLNM, another integer maintained by the system for internal pusposes. Its\n",
" reader function is ?-CLNM.\n",
"\n",
"8. RSLTS, an array of length +MAXIMAL-DIMENSION+ reserved by the system for\n",
" caching intermediate results. Its reader function is RSLTS.\n",
"\n",
"9. IDNM, an integer, a system-generated identifier for this object. Its reader\n",
" function is IDNM.\n",
"\n",
"10. ORGN, a list which is the copy of a Lisp statement, in principle the\n",
" statement which was at the origin of the creation of this Kenzo object.\n",
" A caching process, using this slot, prevents the creation of multiple\n",
" copies of the same mathematical object, which is important for efficiency.\n",
" It is used also for debugging and analyzing the program.\n",
"-----------------------------------------------------------------------------\""
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'morphism 'type)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### The function $\\texttt{build-mprh}$"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\"--------------------------------------------------------------[function-doc]\n",
"BUILD-MRPH\n",
"Args: (&key sorc trgt degr intr strt orgn)\n",
"Returns an instance of the class MORPHISM. The keyword arguments are as\n",
"follows:\n",
"\n",
":SORC SORC, the source object, a CHAIN-COMPLEX type object\n",
"\n",
":TRGT TRGT, the target object, a CHAIN-COMPLEX type object\n",
"\n",
":DEGR DEGR, the degree of the morphism, an integer\n",
"\n",
":INTR INTR, the Lisp function defining the effective mapping\n",
"\n",
":STRT STRT, one of the keywords :GNRT or :CMBN, defining the mapping strategy\n",
" of the differential homomorphism, either by generator or by\n",
" combination. The default is :GNRT\n",
"\n",
":ORGN ORGN, a list which is the copy of a Lisp statement, in principle the\n",
" statement which was at the origin of the creation of this Kenzo\n",
" object. A caching process, using this slot, prevents the creation\n",
" of multiple copies of the same mathematical object, which is\n",
" important for efficiency. It is used also for debugging and\n",
" analyzing the program.\n",
"\n",
"Use this function instead of creating instances via the standard constructor\n",
"MAKE-INSTANCE.\n",
"------------------------------------------------------------------------------\""
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'build-mrph 'function)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The differential homomorphism in a chain complex instance"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"---done---"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(cat-init)"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K1 Chain-Complex]"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def ZCC (z-chcm))"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K3 Cohomology-Class on K1 of degree 1]"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def zero-morphism (build-mrph :sorc ZCC\n",
" :trgt ZCC\n",
" :degr -1\n",
" :intr #'(lambda (comb)\n",
" (cmbn (1- (degr comb))))\n",
" :strt :cmbn\n",
" :orgn '(zero morphism on ZCC)))"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K4 Cohomology-Class on K1 of degree 0]"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def id-morphism (build-mrph :sorc ZCC\n",
" :trgt ZCC\n",
" :degr 0\n",
" :intr #'identity\n",
" :strt :cmbn\n",
" :orgn '(identity morphism on ZCC)))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Applying morphisms\n",
"\n",
"### Functions defining morphisms"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"#<FUNCTION (LAMBDA (DGR GNR) :IN \"/home/gerd/git/cl-jupyter/cl-jupyter.lisp\") {100454E2CB}>"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def ccn-boundary #'(lambda (dgr gnr)\n",
" (if (evenp (+ dgr gnr))\n",
" (cmbn (1- dgr) 1 (- gnr 10))\n",
" (cmbn (1- dgr)))))"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K5 Chain-Complex]"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def ccn (build-chcm :cmpr #'f-cmpr\n",
" :basis #'(lambda (n) (<a-b< (* 10 n) (* 10 (1+ n))))\n",
" :bsgn 0\n",
" :intr-dffr ccn-boundary\n",
" :strt :gnrt\n",
" :orgn '(ccn)))"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K7 Morphism (degree 1): K5 -> K5]"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def upper-shift (build-mrph\n",
" :sorc ccn :trgt ccn :strt :gnrt :degr +1\n",
" :intr #'(lambda (d gn) (cmbn (1+ d) 1 (+ gn 10)))\n",
" :orgn '(ccn shift +10)))"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K8 Morphism (degree -1): K5 -> K5]"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def lower-shift (build-mrph\n",
" :sorc ccn :trgt ccn :strt :gnrt :degr -1\n",
" :intr #'(lambda (d gn) (cmbn (1- d) 1 (- gn 10)))\n",
" :orgn '(ccn shift -10)))"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 12>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? ccn 2 22)"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 0}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? ccn *)"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 5}\n",
"<1 * 50>\n",
"<5 * 55>\n",
"<9 * 59>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def combn (cmbn 5 1 50 5 55 9 59))"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 4}\n",
"<5 * 45>\n",
"<9 * 49>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? ccn combn)"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 3}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? ccn *)"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 16>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? upper-shift 0 6)"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 4}\n",
"<1 * 41>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? lower-shift 5 51)"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 3}\n",
"<1 * 31>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? lower-shift (? lower-shift 5 51))"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 10>\n",
"<2 * 11>\n",
"<3 * 12>\n",
"<4 * 13>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def comb1 (cmbn 1 1 10 2 11 3 12 4 13))"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K9 Morphism (degree 0): K5 -> K5]"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def identity? (cmps upper-shift lower-shift))"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(degr identity?)"
]
},
{
"cell_type": "code",
"execution_count": 60,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 10>\n",
"<2 * 11>\n",
"<3 * 12>\n",
"<4 * 13>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 60,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? identity? comb1)"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(2cmbn-sbtr (cmpr ccn) comb1 *)"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K10 Morphism (degree 2): K5 -> K5]"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def upper-shift2 (cmps upper-shift upper-shift))"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(degr upper-shift2)"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 3}\n",
"<1 * 30>\n",
"<2 * 31>\n",
"<3 * 32>\n",
"<4 * 33>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? upper-shift2 comb1)"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K11 Morphism (degree 1): K5 -> K5]"
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def twice-up-shift (add upper-shift upper-shift))"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(degr twice-up-shift)"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 2}\n",
"<2 * 20>\n",
"<4 * 21>\n",
"<6 * 22>\n",
"<8 * 23>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? twice-up-shift comb1)"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K12 Morphism (degree 0): K5 -> K5]"
]
},
"execution_count": 68,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def up-d (cmps upper-shift (dffr1 ccn)))"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K13 Morphism (degree 0): K5 -> K5]"
]
},
"execution_count": 69,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def d-up (cmps (dffr1 ccn) upper-shift))"
]
},
{
"cell_type": "code",
"execution_count": 70,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 11>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? up-d 1 11)"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? d-up 1 11)"
]
},
{
"cell_type": "code",
"execution_count": 72,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 10>\n",
"<2 * 11>\n",
"<3 * 12>\n",
"<4 * 13>\n",
"<5 * 14>\n",
"<6 * 15>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 72,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(def comb3 (cmbn 1 1 10 2 11 3 12 4 13 5 14 6 15))"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<2 * 11>\n",
"<4 * 13>\n",
"<6 * 15>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? up-d comb3)"
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"----------------------------------------------------------------------{CMBN 1}\n",
"<1 * 10>\n",
"<3 * 12>\n",
"<5 * 14>\n",
"------------------------------------------------------------------------------\n"
]
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(? d-up comb3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Accessing `Kenzo` objects\n",
"\n",
"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, \n",
"coalgebras, algebras, simplicial morphism, etc, each having its specific list. But, in fact the numbering is independent\n",
"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.\n",
"\n",
"#### Function `K`"
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\"--------------------------------------------------------------[function-doc]\n",
"K\n",
"Args: (idnm)\n",
"Returns the IDNM-th Kenzo object.\n",
"------------------------------------------------------------------------------\""
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'k 'function)"
]
},
{
"cell_type": "code",
"execution_count": 76,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K1 Chain-Complex]"
]
},
"execution_count": 76,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(k 1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Function `KD`"
]
},
{
"cell_type": "code",
"execution_count": 77,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\"--------------------------------------------------------------[function-doc]\n",
"KD\n",
"Args: (idnm)\n",
"Return the type of Kenzo object number IDNM and print the comment list\n",
"(SLOT :ORGN) of the object.\n",
"------------------------------------------------------------------------------\""
]
},
"execution_count": 77,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'kd 'function)"
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K1 Chain-Complex]\n",
" Origin: (Z-CHCM)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 78,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(kd 1)"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[K3 Cohomology-Class on K1 of degree 1]"
]
},
"execution_count": 79,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(k 3)"
]
},
{
"cell_type": "code",
"execution_count": 80,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K3 Cohomology-Class on K1 of degree 1]\n",
" Origin: (ZERO MORPHISM ON ZCC)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 80,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(kd 3)"
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K8 Morphism (degree -1): K5 -> K5]\n",
" Origin: (CCN SHIFT -10)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 81,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(kd 8)"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K5 Chain-Complex]\n",
" Origin: (CCN)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 82,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(kd 5)"
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K9 Morphism (degree 0): K5 -> K5]\n",
" Origin: (2MRPH-CMPS [K7 Morphism (degree 1): K5 -> K5] [K8 Morphism (degree -1): K5 -> K5] GNRT)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"NIL"
]
},
"execution_count": 83,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(kd 9)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Function `KD2`"
]
},
{
"cell_type": "code",
"execution_count": 84,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"\"--------------------------------------------------------------[function-doc]\n",
"KD2\n",
"Args: (idnm)\n",
"Return the type of Kenzo object number IDNM, print the comment list\n",
"(SLOT :ORGN) of the object and, recursively, return the same information\n",
"for all Kenzo objects of the same type in relation with this object. Return\n",
"the list of object numbers.\n",
"------------------------------------------------------------------------------\""
]
},
"execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(documentation 'kd2 'function)"
]
},
{
"cell_type": "code",
"execution_count": 85,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Object: [K9 Morphism (degree 0): K5 -> K5]\n",
" Origin: (2MRPH-CMPS [K7 Morphism (degree 1): K5 -> K5] [K8 Morphism (degree -1): K5 -> K5] GNRT)\n",
"\n",
"\n",
"Object: [K8 Morphism (degree -1): K5 -> K5]\n",
" Origin: (CCN SHIFT -10)\n",
"\n",
"\n",
"Object: [K7 Morphism (degree 1): K5 -> K5]\n",
" Origin: (CCN SHIFT 10)\n",
"\n"
]
},
{
"data": {
"text/plain": [
"(9 8 7)"
]
},
"execution_count": 85,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(kd2 9)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "SBCL Lisp",
"language": "lisp",
"name": "lisp"
},
"language_info": {
"codemirror_mode": "text/x-common-lisp",
"mimetype": "text/x-common-lisp",
"name": "common-lisp",
"pygments_lexer": "common-lisp",
"version": "X3J13"
}
},
"nbformat": 4,
"nbformat_minor": 0
}