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