{"id":15570466,"url":"https://github.com/cipherboy/cmsh","last_synced_at":"2025-04-24T00:25:09.232Z","repository":{"id":147153693,"uuid":"173201915","full_name":"cipherboy/cmsh","owner":"cipherboy","description":"High-level interfaces over @msoos's CryptoMiniSat.","archived":false,"fork":false,"pushed_at":"2024-03-14T01:02:16.000Z","size":366,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T05:11:27.551Z","etag":null,"topics":["circuit","cnf","cryptominisat","cryptominisat5","golang","high-level","python","sat","satisfiability"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cipherboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-02-28T23:16:36.000Z","updated_at":"2024-03-11T08:56:29.000Z","dependencies_parsed_at":"2024-03-14T02:24:46.100Z","dependency_job_id":null,"html_url":"https://github.com/cipherboy/cmsh","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherboy%2Fcmsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherboy%2Fcmsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherboy%2Fcmsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherboy%2Fcmsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cipherboy","download_url":"https://codeload.github.com/cipherboy/cmsh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250536858,"owners_count":21446815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuit","cnf","cryptominisat","cryptominisat5","golang","high-level","python","sat","satisfiability"],"created_at":"2024-10-02T17:42:24.744Z","updated_at":"2025-04-24T00:25:09.176Z","avatar_url":"https://github.com/cipherboy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `cmsh`\n\nHigh-level Python interface over [Mate Soos's](https://github.com/msoos)\n[`CryptoMiniSat`](https://github.com/msoos/cryptominisat).\n\n\tCopyright (C) 2019 Alexander Scheel\n\tLicensed under the terms of the GPLv3.\n\n[GPLv3](LICENSE) | [Building Instructions](docs/building.md) |\n[API Documentation](docs/api.md) | [Design](docs/design.md) |\n[Version 0.4](https://github.com/cipherboy/cmsh/releases)\n\n## Dependencies\n\nThe only dependencies are CryptoMiniSat, Python, and a working C++ compiler\nwith C++20 support.\n\n## Building\n\n(For more complete documentation, refer to [`building.md`](docs/building.md))\n\nTo build `cmsh`, first build CryptoMiniSat with Gaussian Elimination support:\n\n\tmake cms\n\nThis will pull down the latest CryptoMiniSat and build it with Gaussian\nElimination support. If you wish to build at a specific release version\ninstead of latest HEAD, run:\n\n\tcd msoos_cryptominisat \u0026\u0026 git checkout \u003cREVISION\u003e \u0026\u0026 cd ..\n\tmake distclean cms\n\nThen, build `cmsh`:\n\n\tmake clean all check\n\nTo install:\n\n\tcd build/\n\tpip3 install --user -e .\n\n## Usage\n\n(For more complete documentation, refer to [`api.md`](docs/api.md))\n\nA single CryptoMiniSat SATSolver instance is exposed by a `Model`:\n\n```python\nimport cmsh\n\nm = cmsh.Model()\n```\n\nVariables can be created with `Model.var()`:\n\n```python\na = m.var()\nb = m.var()\n```\n\nAsserting a variable is true is done via `Model.add_assert(...)`:\n\n```python\nstmt = a ^ -b\nm.add_assert(stmt)\n```\n\nSolutions can be seen by calling `Model.solve()` and printing the\ncorresponding variables:\n\n```python\nprint(a, b)\nprint(m.solve())\nprint(a, b)\n```\n\nVariables can also be coerced to `int` (to get the corresponding CNF\nidentifier) or `bool` (to get the value after solving):\n\n```python\nprint(int(a))\nprint(bool(b))\n```\n\nNote that `int(Variable)` can be less than zero if Variable is a negation of\nanother value:\n\n```python\nc = m.var()\nnot_c = -c\n\nprint(int(c), int(not_c))\n```\n\nLogic also works with mixed types:\n\n```python\nstmt2 = (c == True) | (c == -a)\nm.add_assert(stmt2)\nm.solve()\nprint(a, b, c)\n```\n\nThere are also vectors!\n\n```python\nvec = m.vec(4)\nm.add_assert(vec == 3)\nm.solve()\n\nprint(vec, int(vec))\n```\n\n## Contributing\n\nCool! \\o/ Happy to have help. The core of `cmsh` is done; mostly it is the\nhard parts that remain (see the shortcomings section in the design document\nfor ideas). Nearly every project could use more tests and benchmarks so I'd\ndefinitely merge those. I wouldn't be too adverse to build system improvements\neither. Send a PR, file an issue, or shoot me an email if your interested, I'm\nnot particularly picky about these types of things or processes. I'd also take\nconstructive code review comments or feedback about using it in your own\nprojects.\n\nHappy hacking!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcipherboy%2Fcmsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcipherboy%2Fcmsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcipherboy%2Fcmsh/lists"}