{ "metadata": { "language": "common-lisp", "name": "", "signature": "sha256:a754fbeaa1dab0ce169c2df3836c81485925a3dac487688816cd112a3bc45b33" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 1" ] }, { "cell_type": "code", "collapsed": false, "input": [ "(ql:quickload \"kenzo\")" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 1, "text": [ "(\"kenzo\")" ] } ], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:cat-init)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "---done---" ] }, { "metadata": {}, "output_type": "pyout", "prompt_number": 2, "text": [ "NIL" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "1.2.2 Ordering the generators" ] }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:f-cmpr 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 3, "text": [ "\"--------------------------------------------------------------[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", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:f-cmpr 123 789)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 3, "text": [ ":LESS" ] } ], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:s-cmpr 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 7, "text": [ "\"--------------------------------------------------------------[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", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:s-cmpr 'circulation 'circular)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 4, "text": [ ":GREATER" ] } ], "prompt_number": 4 }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:l-cmpr 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 8, "text": [ "\"--------------------------------------------------------------[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", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 8 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:l-cmpr '(1 a b) '(1 a))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 5, "text": [ ":GREATER" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "1.2.3 Functions handling combinations" ] }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:cmbn 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 9, "text": [ "\"--------------------------------------------------------------[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", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 9 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:def comb1 (cat:cmbn 1 1 'u 2 'v 3 'w 4 'z))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 6, "text": [ "\n", "----------------------------------------------------------------------{CMBN 1}\n", "<1 * U>\n", "<2 * V>\n", "<3 * W>\n", "<4 * Z>\n", "------------------------------------------------------------------------------\n" ] } ], "prompt_number": 6 }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:cmbn-non-zero-p 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 8, "text": [ "\"-----------------------------------------------------------------[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", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 8 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:cmbn-non-zero-p comb1)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 7, "text": [ "((1 . U) (2 . V) (3 . W) (4 . Z))" ] } ], "prompt_number": 7 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:cmbn-list comb1)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 10, "text": [ "((1 . U) (2 . V) (3 . W) (4 . Z))" ] } ], "prompt_number": 10 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:def term3 (third (cat:cmbn-list comb1)))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 11, "text": [ "(3 . W)" ] } ], "prompt_number": 11 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:cffc term3)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 12, "text": [ "3" ] } ], "prompt_number": 12 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:gnrt term3)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 13, "text": [ "W" ] } ], "prompt_number": 13 }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:cmbn-opps 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 14, "text": [ "\"--------------------------------------------------------------[function-doc]\n", "CMBN-OPPS\n", "Args: (cmbn)\n", "Returns the combination opposite combination of CMBN.\n", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 14 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:def mcomb1 (cat:cmbn-opps comb1))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 15, "text": [ "\n", "----------------------------------------------------------------------{CMBN 1}\n", "<-1 * U>\n", "<-2 * V>\n", "<-3 * W>\n", "<-4 * Z>\n", "------------------------------------------------------------------------------\n" ] } ], "prompt_number": 15 }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:n-cmbn 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 16, "text": [ "\"--------------------------------------------------------------[function-doc]\n", "N-CMBN\n", "Args: (n cmbn)\n", "Returns N times the combination CMBN. N must be non-zero.\n", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 16 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:def comb2 (cat:n-cmbn 10 comb1))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 17, "text": [ "\n", "----------------------------------------------------------------------{CMBN 1}\n", "<10 * U>\n", "<20 * V>\n", "<30 * W>\n", "<40 * Z>\n", "------------------------------------------------------------------------------\n" ] } ], "prompt_number": 17 }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:2cmbn-add 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 18, "text": [ "\"--------------------------------------------------------------[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", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 18 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:def cmb12 (cat:2cmbn-add #'cat:s-cmpr comb1 comb2))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 20, "text": [ "\n", "----------------------------------------------------------------------{CMBN 1}\n", "<11 * U>\n", "<22 * V>\n", "<33 * W>\n", "<44 * Z>\n", "------------------------------------------------------------------------------\n" ] } ], "prompt_number": 20 }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:2cmbn-sbtr 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 21, "text": [ "\"--------------------------------------------------------------[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", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 21 }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:ncmbn-add 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 22, "text": [ "\"--------------------------------------------------------------[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", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 22 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:ncmbn-add #'cat:s-cmpr\n", " comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2 comb1 comb2)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 23, "text": [ "\n", "----------------------------------------------------------------------{CMBN 1}\n", "<55 * U>\n", "<110 * V>\n", "<165 * W>\n", "<220 * Z>\n", "------------------------------------------------------------------------------\n" ] } ], "prompt_number": 23 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "1.3.1 The function build-chcm" ] }, { "cell_type": "heading", "level": 4, "metadata": {}, "source": [ "A first example of a chain complex" ] }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:def diabolo-cmpr #'cat:s-cmpr)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 24, "text": [ "#" ] } ], "prompt_number": 24 }, { "cell_type": "code", "collapsed": false, "input": [ "(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))))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 25, "text": [ "#" ] } ], "prompt_number": 25 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:def diabolo-bspn 's0)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 26, "text": [ "S0" ] } ], "prompt_number": 26 }, { "cell_type": "code", "collapsed": false, "input": [ "(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\")))))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 28, "text": [ "#" ] } ], "prompt_number": 28 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:def diabolo-strt :GNRT)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 29, "text": [ ":GNRT" ] } ], "prompt_number": 29 }, { "cell_type": "code", "collapsed": false, "input": [ "(cat:def diabolo-orgn '(diabolo-for-example))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 30, "text": [ "(DIABOLO-FOR-EXAMPLE)" ] } ], "prompt_number": 30 }, { "cell_type": "code", "collapsed": false, "input": [ "(documentation 'cat:build-chcm 'function)" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 31, "text": [ "\"--------------------------------------------------------------[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: C_p -> 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", "------------------------------------------------------------------------------\"" ] } ], "prompt_number": 31 }, { "cell_type": "code", "collapsed": false, "input": [ "(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))" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 32, "text": [ "[K1 Chain-Complex]" ] } ], "prompt_number": 32 } ], "metadata": {} } ] }