{ "info": { "author": "Pauli Rikula", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6" ], "description": "\n# python-category-equations\n\nCategory is way to represent and generate directed networks by using sinks, \nsources and connections from sources to sinks. With the tools provided here you can\ncreate and simplify category like equations for the given connector operator.\nOn the equations the underlaying '+' and '-' operations are basic set operations\ncalled union and discard and the multiplication operator '*' connects sources to sinks.\nThe equation system also has a Identity 'I' term and zerO -like termination term 'O'.\nFor futher details go https://en.wikipedia.org/wiki/Category_(mathematics)#Definition\n\n## Usage\n\n\nHere our connector operation is print function called 'debug' which\nprints an arrow between two objects:\n\n >>> debug('a', 'b')\n a -> b\n\n >>> debug('b', 'a')\n b -> a\n\n >>> debug('a', 'a')\n a -> a\n\nGet I and O singletons and class C, which use previously defined debug -function.\n\n >>> I, O, C = from_operator(debug)\n >>> I == I\n True\n >>> O == I\n False\n >>> C(1)\n C(1)\n\nThe items do have differing sinks and sources:\n\n >>> I.sinks\n {I}\n >>> I.sources\n {I}\n\n >>> O.sinks\n set()\n >>> O.sources\n set()\n\n >>> C(1).sinks\n {1}\n >>> C(1).sources\n {1}\n\n\nYou can write additions also with this notation\n\n >>> C(1,2) == C(1) + C(2)\n True\n\n\nThe multiplication connects sources to sinks like this:\n\n >>> (C(1,2) * C(3,4)).evaluate()\n 1 -> 3\n 1 -> 4\n 2 -> 3\n 2 -> 4\n\n >>> (C(3,4) * C(1,2)).sinks\n {3, 4}\n\n >>> (C(3,4) * C(1,2)).sources\n {1, 2}\n\nOr\n\n >>> C(1) * C(2, I) == C(1) + C(1) * C(2)\n True\n\n >>> (C(1) * C(2, I)).evaluate()\n 1 -> 2\n\n >>> (C(1) * C(2, I)).sinks\n {1}\n\n >>> (C(1) * C(2, I)).sources\n {1, 2}\n\nAnd writing C(1,2) instead of C(1) + C(2) works with multiplication too:\n\n >>> C(1,2) * C(3,4) == (C(1) + C(2)) * (C(3) + C(4))\n True\n\nThe order inside C(...) does not matter:\n\n >>> (C(1,2) * C(3,4)) == (C(2,1) * C(4,3))\n True\n\nOn the other hand you can not swap the terms like:\n\n >>> (C(1,2) * C(3,4)) == (C(3,4) * C(1,2))\n False\n\nBecause:\n\n >>> (C(3,4) * C(1,2)).evaluate()\n 3 -> 1\n 3 -> 2\n 4 -> 1\n 4 -> 2\n\nThe discard operation works like this:\n\n >>> (C(3,4) * C(1,2) - C(4) * C(1)).evaluate()\n 3 -> 1\n 3 -> 2\n 4 -> 2\n\nBut\n\n >>> (C(3,4) * C(1,2) - C(4) * C(1)) == C(3) * C(1,2) + C(4) * C(2)\n False\n\nBecause sinks and sources differ:\n\n >>> (C(3,4) * C(1,2) - C(4) * C(1)).sinks\n {3}\n >>> (C(3) * C(1,2) + C(4) * C(2)).sinks\n {3, 4}\n\nThe right form would have been:\n\n >>> (C(3,4) * C(1,2) - C(4) * C(1)) == C(3) * C(1,2) + C(4) * C(2) - C(4) * O - O * C(1)\n True\n\n\nThe identity I and zero O work together like usual:\n\n >>> I * I == I\n True\n >>> O * I * O == O\n True\n\n\nIdentity 'I' works as a tool for equation simplifying.\nFor example:\n\n >>> C(1,2) * C(3,4) * C(5) + C(1,2) * C(5) == C(1,2) * ( C(3,4) + I ) * C(5)\n True\n\nBecause:\n\n >>> (C(1,2) * C(3,4) * C(5) + C(1,2) * C(5)).evaluate()\n 1 -> 3\n 1 -> 4\n 1 -> 5\n 2 -> 3\n 2 -> 4\n 2 -> 5\n 3 -> 5\n 4 -> 5\n\nand\n\n >>> (C(1,2) * ( C(3,4) + I ) * C(5)).evaluate()\n 1 -> 3\n 1 -> 4\n 1 -> 5\n 2 -> 3\n 2 -> 4\n 2 -> 5\n 3 -> 5\n 4 -> 5\n\nIf two terms have the same middle part you can simplify equations\nvia terminating loose sinks or sources with O:\nFor example:\n\n >>> (C(1) * C(2) * C(4) + C(3) * C(4)).evaluate()\n 1 -> 2\n 2 -> 4\n 3 -> 4\n\n >>> (C(1) * C(2) * C(4) + O * C(3) * C(4)).evaluate()\n 1 -> 2\n 2 -> 4\n 3 -> 4\n\n >>> (C(1) * ( C(2) + O * C(3) ) * C(4)).evaluate()\n 1 -> 2\n 2 -> 4\n 3 -> 4\n\n >>> C(1) * C(2) * C(4) + O * C(3) * C(4) == C(1) * ( C(2) + O * C(3) ) * C(4)\n True\n\n\nNote that the comparison wont work without the O -term because the sinks differ:\n\n >>> C(1) * C(2) * C(4) + C(3) * C(4) == C(1) * ( C(2) + O * C(3) ) * C(4)\n False\n\n## Equation solving and minimizations\n\nThe module contains also (quite unefficient) simplify -method, which can be used to expression minimization:\n\n >>> I, O, C = from_operator(debug)\n >>> m = EquationMap(I, O, C)\n >>> a = C(1) + C(2)\n >>> simplify(a, 300, m)\n (C(1, 2), [C(1) + C(2), C(1, 2)])\n\n >>> b = C(1) * C(3) + C(2) * C(3)\n >>> simplified, path = simplify(b, 100, m)\n >>> simplified\n C(1, 2) * C(3)\n >>> for p in path:\n ... print(p)\n C(1) * C(3) + C(2) * C(3)\n (C(1) * I + C(2) * I) * C(3)\n (C(1) + C(2) * I) * C(3)\n (C(1) + C(2)) * C(3)\n C(1, 2) * C(3)\n\n\nFor proofs use the get_route:\n\n >>> I, O, C = from_operator(debug)\n >>> m = EquationMap(I, O, C)\n >>> a = C(1) * C(3) + C(2) * C(3)\n >>> b = C(1, 2) * C(3)\n >>> shortest, path = get_route(a,b, 100, m)\n >>> for p in path:\n ... print(p)\n C(1) * C(3) + C(2) * C(3)\n C(1) * C(3) + C(2) * I * C(3)\n (C(1) * I + C(2) * I) * C(3)\n (C(1) + C(2) * I) * C(3)\n (C(1) + C(2)) * C(3)\n C(1, 2) * C(3)\n\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kummahiih/python-category-equations", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "python-category-equations", "package_url": "https://pypi.org/project/python-category-equations/", "platform": "", "project_url": "https://pypi.org/project/python-category-equations/", "project_urls": { "Homepage": "https://github.com/kummahiih/python-category-equations" }, "release_url": "https://pypi.org/project/python-category-equations/0.7.2/", "requires_dist": null, "requires_python": "~=3.6", "summary": "python-category-equations", "version": "0.7.2" }, "last_serial": 5649864, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "a7a6b435e6b208a16e82a0b32d5d1a5a", "sha256": "db6c3502fc413a629790426d6cb59f61145aa04aa0adc828858eb93b0ddb1af4" }, "downloads": -1, "filename": "python_category_equations-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a7a6b435e6b208a16e82a0b32d5d1a5a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 6429, "upload_time": "2018-02-01T21:05:31", "url": "https://files.pythonhosted.org/packages/20/b1/114152e4d86f294f4d5d4c0ff6f2f16ccc3378e3ad4c5db057c1c22ba9cc/python_category_equations-0.2.0-py3-none-any.whl" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "31e3a4f6e2a5ec8437a3c962f1e89e76", "sha256": "6570d654b2da6b700fc151cfc63741b07adb7faf9045a8e33f155e03b4ff3dbf" }, "downloads": -1, "filename": "python_category_equations-0.3.0-py3.6.egg", "has_sig": false, "md5_digest": "31e3a4f6e2a5ec8437a3c962f1e89e76", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": "~=3.6", "size": 12400, "upload_time": "2018-02-10T17:18:32", "url": "https://files.pythonhosted.org/packages/ad/fa/40fac2fd6edb347edb9fb6cd2208364f88efd5da014807baab0c48409f64/python_category_equations-0.3.0-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "80f99ad43983bc89df45e747228e751f", "sha256": "0c9d1f1363b0ec5535d1d987011b5eba05a24a5151330eb62b7a76028bc92458" }, "downloads": -1, "filename": "python_category_equations-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "80f99ad43983bc89df45e747228e751f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 8315, "upload_time": "2018-02-10T17:18:47", "url": "https://files.pythonhosted.org/packages/02/af/e3781a0dcaf99321c1df49982ea639621542ab2f32c9d42202ce1353b48d/python_category_equations-0.3.0-py3-none-any.whl" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "69511d9d93b3215b600db7227362d7fe", "sha256": "992d740b1800fb75c55c7bcc8febb94d00034b6d30346759472566353854fb39" }, "downloads": -1, "filename": "python_category_equations-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "69511d9d93b3215b600db7227362d7fe", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 8302, "upload_time": "2018-02-10T17:24:50", "url": "https://files.pythonhosted.org/packages/4f/aa/f0be56e51e1b1efdd9129300a9859296d110e42131a0052567688f523c8c/python_category_equations-0.3.1-py3-none-any.whl" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "f2e1901655de976151d16790664bf4e4", "sha256": "4194a5d7b87c64c640f5d5db67607be0fa6bd83043004150b1ea391c8ca10358" }, "downloads": -1, "filename": "python_category_equations-0.3.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f2e1901655de976151d16790664bf4e4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 8301, "upload_time": "2018-02-10T17:29:42", "url": "https://files.pythonhosted.org/packages/57/5d/36d60d7ac9915182e7dea299afb62a4e3e759f01b447b0a5e7d18b22653d/python_category_equations-0.3.2-py3-none-any.whl" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "a31bf23b8f530e62f33a1c51f8e21a67", "sha256": "b7f8960a248cacd785c871b451373d3c7f7efbe01441e5f6e1ba4ed017da0d79" }, "downloads": -1, "filename": "python_category_equations-0.3.3-py3-none-any.whl", "has_sig": false, "md5_digest": "a31bf23b8f530e62f33a1c51f8e21a67", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 8429, "upload_time": "2018-03-11T13:41:43", "url": "https://files.pythonhosted.org/packages/42/c8/fbb7200ff6bc1efc1c4d0eb730d2de7f17767ce9c104528a9c1883a2f608/python_category_equations-0.3.3-py3-none-any.whl" } ], "0.3.6": [ { "comment_text": "", "digests": { "md5": "f63f59daa0883b8bcb6302fb8ba69e5d", "sha256": "1ebbb4d757b18fde69231c363d8abec1f665e9fd93bda212a6862e6f16238910" }, "downloads": -1, "filename": "python_category_equations-0.3.6-py3-none-any.whl", "has_sig": false, "md5_digest": "f63f59daa0883b8bcb6302fb8ba69e5d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 8638, "upload_time": "2018-03-18T16:33:34", "url": "https://files.pythonhosted.org/packages/b7/84/16d349ed3f92ac2d0795bc645417a08230c1756275648b9971ec799a127e/python_category_equations-0.3.6-py3-none-any.whl" } ], "0.3.7": [ { "comment_text": "", "digests": { "md5": "89f28399a8b8ef224e6896782e5a3574", "sha256": "7d8651d2ebc842d459ebee4d9c42c6bb99af64a2e805d726ab9e17b31aebbb61" }, "downloads": -1, "filename": "python_category_equations-0.3.7-py3-none-any.whl", "has_sig": false, "md5_digest": "89f28399a8b8ef224e6896782e5a3574", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 9734, "upload_time": "2018-03-18T19:19:32", "url": "https://files.pythonhosted.org/packages/4a/7b/3e5f781a4272e5b2dbeafb90cb8c55b1337d8319f410505211b26528d9bc/python_category_equations-0.3.7-py3-none-any.whl" } ], "0.3.8": [ { "comment_text": "", "digests": { "md5": "b1c02e953d295e3fb83fe91e0e633e82", "sha256": "e82088cf225677f2ffd32012e99f814650beba4e75afdd2335f73280f0473dd8" }, "downloads": -1, "filename": "python_category_equations-0.3.8-py3-none-any.whl", "has_sig": false, "md5_digest": "b1c02e953d295e3fb83fe91e0e633e82", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 9839, "upload_time": "2018-03-18T23:17:23", "url": "https://files.pythonhosted.org/packages/f4/3b/024e2d689b130a7cc9ce4560e00d5148a1539dd3093acc4cc14b5e63076b/python_category_equations-0.3.8-py3-none-any.whl" } ], "0.3.9": [ { "comment_text": "", "digests": { "md5": "c358e69f75488f5bfe985f6bad48c826", "sha256": "c679566e7ab23c06d0bab6588efdda4c31c61d1ea74910f8cc021d3471470b91" }, "downloads": -1, "filename": "python_category_equations-0.3.9-py3-none-any.whl", "has_sig": false, "md5_digest": "c358e69f75488f5bfe985f6bad48c826", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 8812, "upload_time": "2019-07-07T08:45:03", "url": "https://files.pythonhosted.org/packages/1c/2c/e9cf079e12fd32019acc16e7edd8803ee957046f0ab5e08bc97a59690660/python_category_equations-0.3.9-py3-none-any.whl" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "97e45ac3bd3b6a3171675d6db27535bf", "sha256": "ed8e6fe140e20e865fe20d4cac4931f1055aee2fc18d8e6b373fe02ee68f3fcf" }, "downloads": -1, "filename": "python_category_equations-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "97e45ac3bd3b6a3171675d6db27535bf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 14814, "upload_time": "2019-07-25T16:57:58", "url": "https://files.pythonhosted.org/packages/63/63/61f925ffd57be2422fba19c82a05afa784e51305d133a38893ebed9811af/python_category_equations-0.5.0-py3-none-any.whl" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "e66c3cfd8beb5d338eefb722ca6e6ea2", "sha256": "bc0c51d4fd0d7d1530d6041841d07c9c8f87a145ed58a83cc58bad65453ba846" }, "downloads": -1, "filename": "python_category_equations-0.6.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e66c3cfd8beb5d338eefb722ca6e6ea2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 15613, "upload_time": "2019-07-25T22:55:43", "url": "https://files.pythonhosted.org/packages/db/7d/94bc7aae2501eda1dd8de7596b7f4cee2ea3a4fdb1c1a06fa0e3b1dcf760/python_category_equations-0.6.0-py3-none-any.whl" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "d9b983ff0c067d9e77896005b2b2bddf", "sha256": "0056f9d74d68888926092bcbf03f3f3a7967124c019087e8b29f5a2984103418" }, "downloads": -1, "filename": "python_category_equations-0.7.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d9b983ff0c067d9e77896005b2b2bddf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 18176, "upload_time": "2019-08-07T22:25:55", "url": "https://files.pythonhosted.org/packages/58/14/cac8aa06bc12bb4da0cc622db2fcdd32dadcf5e866305a45df8a1d8ad530/python_category_equations-0.7.0-py3-none-any.whl" } ], "0.7.2": [ { "comment_text": "", "digests": { "md5": "43efe3ad4462b0cc0166f7f3df32feac", "sha256": "b2ed21a2db4e2938d9e8923f8294290f04cd565f6d78fe52de884378de4af949" }, "downloads": -1, "filename": "python_category_equations-0.7.2-py3-none-any.whl", "has_sig": false, "md5_digest": "43efe3ad4462b0cc0166f7f3df32feac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 18354, "upload_time": "2019-08-08T12:36:17", "url": "https://files.pythonhosted.org/packages/9e/52/874bfe89a4975b01cad40cecbca7308ac127bb71254f82865cb37344a9a9/python_category_equations-0.7.2-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "43efe3ad4462b0cc0166f7f3df32feac", "sha256": "b2ed21a2db4e2938d9e8923f8294290f04cd565f6d78fe52de884378de4af949" }, "downloads": -1, "filename": "python_category_equations-0.7.2-py3-none-any.whl", "has_sig": false, "md5_digest": "43efe3ad4462b0cc0166f7f3df32feac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.6", "size": 18354, "upload_time": "2019-08-08T12:36:17", "url": "https://files.pythonhosted.org/packages/9e/52/874bfe89a4975b01cad40cecbca7308ac127bb71254f82865cb37344a9a9/python_category_equations-0.7.2-py3-none-any.whl" } ] }