diff --git a/examples/Chapter7.ipynb b/examples/Chapter7.ipynb index a0eac40..34f2499 100644 --- a/examples/Chapter7.ipynb +++ b/examples/Chapter7.ipynb @@ -526,7 +526,644 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## A first set of helpful functions on simplicial sets" + "## A first set of helpful functions on simplicial sets\n", + "\n", + "We give now a first set of functions, methods or macros acting on simplicial set instances. \n", + "\n", + "``cat-init`` *[Function]*\n", + "> Clear in particular ``*smst-list*``, the list of user created simplicial sets and reset the global counter to 1.\n", + "\n", + "``smst`` *n* *[Function]*\n", + "> Retrieve in the list ``*smst-list*`` the simplicial set instance whose the Kenzo identification\n", + "is $n$. If it does not exist, return ``NIL``.\n", + "\n", + "``cmpr`` *smst absm1 absm2* *[Macro]*\n", + "> Compare the abstract simplices *absm1* and *absm2* with the comparison function associated with the simplicial set *smst*.\n", + "\n", + "``bspn`` *smst* *[Macro]*\n", + "> Return the base point of the simplicial set *smst*.\n", + "\n", + "``bndr`` *smst* ``&rest`` *[Macro]*\n", + "> Identical to the macro ``dffr`` (see the chain complex chapter). For simplicial sets, it is more traditional to use the term *boundary*.\n", + "\n", + "``dgnl`` *smst* ``&rest`` *[Macro]*\n", + "> Identical to the macro ``cprd`` (see the coalgebra chapter). For simplicial sets, this recalls the \n", + "Alexander-Witney diagonal.\n", + "\n", + "``face`` *smst i k gmsm-or-absm* *[Macro]*\n", + "> Versatile macro to apply the face operator $\\partial_i^k$ on the simplex *gmsm-or-absm* of the simplicial set *smst*. The name of the simplex parameter shows clearly that it may be either a geometric simplex or an abstract simplex. With only one argument (*smst*), return the function *face*. \n", + "In any other case, we recall that this application returns always an object of type ``ABSM``.\n", + "\n", + "``degenerate-p`` *absm* *[Macro]*\n", + "> Return ``t`` if the abstract simplex *asm* is degenerate, ``nil`` otherwise.\n", + "\n", + "``non-degenerate-p`` *absm* *[Macro]*\n", + "> Return ``t`` if the abstract simplex *asm* is non-degenerate, ``nil`` otherwise.\n", + "\n", + "``check-smst`` *smst dmns1* ``&optional`` *dmns2 (1+ dmns1)* *[Function]*\n", + "> Return ``t`` if the fundamental relations between the face operators $\\partial_i^k$\n", + "with $k=dmns1,\\ldots, dmns2-1$, applied on the effective simplicial set *smst*, are satisfied, otherwise ``nil``. If the optional parameter *dmns2* is omitted, the test is done only for\n", + "$k=dmns1$.\n", + "\n", + "## Examples\n", + "\n", + "After having created instances of the standard simplicial sets $\\Delta^2$ and $\\Delta^3$ ($\\Delta^\\mathbb{N}$ has been defined previously), let us test some simple functions. Note that, since the class of simplicial sets is a sub-class of the class of coalgebras, itself subclass of chain complexes, the functions defined on these classes are available." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def delta2 (delta-n 2))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def delta3 (delta-n 3))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(degenerate-p (absm 0 '(1 2 3)))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(degenerate-p (absm 5 '(0 1 2 3 4)))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(basis delta3 2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(basis delta2 0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " The set of simplices in any dimension for the simplicial set $\\Delta^\\mathbb{N}$ is infinite:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(basis delta-infty 1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Let us test the face function. We see that, though ``delta-infty`` is locally effective, nevertheless, we may work with its simplices:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(face delta-infty 2 4 '(0 1 2 3 4))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(face delta-infty 2 4 (absm 0 '(0 1 2 3 4)))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(face delta-infty 2 5 (absm (dgop-ext-int '(1)) '(0 1 2 3 4)))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(face delta-infty 2 5 (absm (dgop-ext-int '(3)) '(0 1 2 3 4)))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(bspn delta-infty)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The two following statement show that ``delta-infty`` may be considered also as a coalgebra and a chain complex." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(cprd delta-infty 4 '(0 1 2 3 4))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(? delta-infty 4 '(0 1 2 3 4))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The simplicial set ``diabolo-ss``, has also all the properties of a coalgebra and of a chain complex." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(basis diabolo-ss 1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(basis diabolo-ss 2)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(? diabolo-ss 2 (first *))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(? diabolo-ss *)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(dgnl diabolo-ss **)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## The function ``build-finite-ss``\n", + "\n", + "The function ``build-finite-ss`` is a powerful function simplifying the creation of a finite simplicial set. From the lisp point of view, it accepts only one argument, the structured list of the simplices and their faces. In this list, every non--degenerate simplex must be coded as a symbol given by the user. The structure of the list is the following:\n", + "\n", + "- **0** (in fact, optional)\n", + "- $<$Sequence of the vertices, the first item being the base point$>$,\n", + "- **1**\n", + "- $<$Sequence of description of simplices in dimension 1$>$,\n", + "- **2**\n", + "- $<$Sequence of description of simplices in dimension 2$>$,\n", + "- ... ... ... ... ... ...\n", + "- **n**\n", + "- $<$Sequence of description of simplices in dimension n$>$.\n", + "\n", + "where $<$Sequence of description of simplices in dimension k$>$ is a sequence of the following items:\n", + "\n", + "1. A symbol, the symbolic name of the simplex.\n", + "2. A list of faces of this simplex, describing the faces of the simplex. A face can be described in two ways:\n", + " - a symbol, the symbolic name of a {\\bf non-degenerate} simplex composing itself the face.\n", + " - or a list of the form ($i_k\\ i_{k-1}\\ \\ldots \\ i_1 \\ i_0$ ``symbol``) meaning that the degeneracy $\\eta_{i_k}\\eta_{i_{k-1}}\\ldots\\eta_{i_1}\\eta_{i_0}$ is to be applied to the non-degenerate simplex of name ``symbol`` to produce the actual (possibly degenerate) face. If the simplex face has dimension 0 (a vertex), the name of this vertex is sufficient in the face description because the program computes itself the unique possible degeneracy of the vertex, i.e. $\\eta_{k-2}\\ldots\\eta_0$. \n", + "\n", + "### Examples\n", + "\n", + "Let us give some examples to clarify the use of ``build-finite-ss``. In the first example, we use ``build-finite-ss`` to create a simplicial complex, corresponding to a triangulation of the torus. As the faces are never degenerated, the description of the faces is of simplified form." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(cl-jupyter-user:png-from-file \"torus2.png\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The vertices will be named ``v0``, ``v1``, ..., ``v6``, ``v0`` being the base point. The edges\n", + "will be named ``e01``, ``e02``, ..., ``e56``, the list of faces of the edge $e_{ij}$ being\n", + "$(v_j\\ v_i)$. The triangles will be named ``t013``, ``t015``, ..., ``t456``, the list of faces of\n", + "the triangle $t_{ijk}$ being $(e_{jk}\\ e_{ik}\\ e_{ij})$. With this convention of describing the simplices, the call to ``build-finite-ss`` is in simplified form:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def torus2\n", + " (build-finite-ss \n", + " '(v0 v1 v2 v3 v4 v5 v6 \n", + "\n", + " 1 e01 (v1 v0) e02 (v2 v0) e03 (v3 v0)\n", + " e04 (v4 v0) e05 (v5 v0) e06 (v6 v0)\n", + " e12 (v2 v1) e13 (v3 v1) e14 (v4 v1)\n", + " e15 (v5 v1) e16 (v6 v1) e23 (v3 v2)\n", + " e24 (v4 v2) e25 (v5 v2) e26 (v6 v2)\n", + " e34 (v4 v3) e35 (v5 v3) e36 (v6 v3)\n", + " e45 (v5 v4) e46 (v6 v4) e56 (v6 v5)\n", + "\n", + " 2 t013 (e13 e03 e01) t015 (e15 e05 e01) t024 (e24 e04 e02)\n", + " t026 (e26 e06 e02) t036 (e36 e06 e03) t045 (e45 e05 e04)\n", + " t125 (e25 e15 e12) t126 (e26 e16 e12) t134 (e34 e14 e13)\n", + " t146 (e46 e16 e14) t234 (e34 e24 e23) t235 (e35 e25 e23)\n", + " t356 (e56 e36 e35) t456 (e56 e46 e45) )))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "After verification of the coherence of the description of the faces, the function ``build-finite-ss`` calls adequately the function ``build-smst`` to create an instance of the class ``SIMPLICIAL SET`` subclass of the class ``CHAIN COMPLEX``. So that, it is easy for the user to obtain the homology groups of the torus, for instance in dimension 1:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(chcm-homology torus2 1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The function ``build-finite-ss`` calls internally some verification functions mentioned above to verify the coherence of the description of the simplicial set and gives an error message if the description of the simplicial set is incorrect. For instance:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def mm (build-finite-ss \n", + " '(s0 s1 s2 s3 \n", + " 1 0-1 (s1 s0) 1-2 (s2 s1) 2-3 (s3 s2)\n", + " 2 0-1-2 (2-3 1-2 0-1))\n", + " ))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In the following examples, we show the power of ``build-finite-ss`` for the description of classical surfaces as simplicial sets, and in each case we verify the well known homology groups of those surfaces. The examples of the torus or the dunce-hat must be compared, as to the simplicity of the definition, to the respective ones in the previous page and in the Homology chapter." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(cl-jupyter-user:png-from-file \"cylinss.png\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def cylinss (build-finite-ss \n", + " '(v0 v1 \n", + " 1 e0 (v1 v0) e1 (v1 v1) e2 (v0 v0) e3 (v1 v0)\n", + " 2 t0 (e1 e3 e0) t1 (e0 e3 e2)) ))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(dotimes (i 3) (chcm-homology cylinss i))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(cl-jupyter-user:png-from-file \"moebiuss.png\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def moebiuss (build-finite-ss \n", + " '(v0 v1 \n", + " 1 e0 (v1 v0) e1 (v0 v1) e2 (v1 v0) e3 (v0 v0)\n", + " 2 t0 (e1 e3 e0) t1 (e0 e2 e3)) ))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(dotimes (i 3) (chcm-homology moebiuss i))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(cl-jupyter-user:png-from-file \"toruss.png\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def toruss (build-finite-ss \n", + " '(v0\n", + " 1 e0 (v0 v0) e1 (v0 v0) e2 (v0 v0)\n", + " 2 t0 (e1 e2 e0) t1 (e0 e2 e1)) ))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(dotimes (i 3) (chcm-homology toruss i))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(cl-jupyter-user:png-from-file \"bottless.png\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def bottless (build-finite-ss \n", + " '(v0\n", + " 1 e0 (v0 v0) e1 (v0 v0) e2 (v0 v0)\n", + " 2 t0 (e1 e2 e0) t1 (e0 e1 e2)) ))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(dotimes (i 3) (chcm-homology bottless i))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(cl-jupyter-user:png-from-file \"ppss.png\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def ppss (build-finite-ss \n", + " '( *\n", + " 1 e (* *)\n", + " 2 t (e * e)) ))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(dotimes (i 3) (chcm-homology ppss i))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The user will note that the list of faces for the 2-simplex ``t``, is in simplified form. In particular, as the face 1 of ``t`` is the 0-degeneracy of the base point \"$*$\", it is sufficient to code the face 1 of ``t``by \"``*``\" instead of the complete form ``(0 *)``." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(cl-jupyter-user:png-from-file \"duncess.png\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(def duncess (build-finite-ss \n", + " '( *\n", + " 1 e (* *)\n", + " 2 t (e e e)) ))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "(dotimes (i 3) (chcm-homology duncess i))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Special simplicial sets\n", + "\n", + "The system provides useful functions to create interesting simplicial sets of constant usage. In particular, the user is advised from now to use the following version of the standard simplex implemented in ``Kenzo`` and not the one given previously for simplicity reason.\n", + "\n", + "### The standard simplex" ] } ], diff --git a/examples/bottless.png b/examples/bottless.png new file mode 100644 index 0000000..f847b03 Binary files /dev/null and b/examples/bottless.png differ diff --git a/examples/cylinss.png b/examples/cylinss.png new file mode 100644 index 0000000..e55f0e7 Binary files /dev/null and b/examples/cylinss.png differ diff --git a/examples/duncess.png b/examples/duncess.png new file mode 100644 index 0000000..6847363 Binary files /dev/null and b/examples/duncess.png differ diff --git a/examples/moebiuss.png b/examples/moebiuss.png new file mode 100644 index 0000000..c212027 Binary files /dev/null and b/examples/moebiuss.png differ diff --git a/examples/ppss.png b/examples/ppss.png new file mode 100644 index 0000000..5929f13 Binary files /dev/null and b/examples/ppss.png differ diff --git a/examples/torus2.png b/examples/torus2.png new file mode 100644 index 0000000..9d18cea Binary files /dev/null and b/examples/torus2.png differ diff --git a/examples/toruss.png b/examples/toruss.png new file mode 100644 index 0000000..784e7c0 Binary files /dev/null and b/examples/toruss.png differ