{"id":47728300,"url":"https://github.com/bjesus/cmaelcd","last_synced_at":"2026-04-02T21:02:35.569Z","repository":{"id":337456108,"uuid":"1152789985","full_name":"bjesus/cmaelcd","owner":"bjesus","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-16T21:18:51.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-17T02:10:42.276Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bjesus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-08T12:47:11.000Z","updated_at":"2026-02-16T21:18:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bjesus/cmaelcd","commit_stats":null,"previous_names":["bjesus/cmaelcd"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bjesus/cmaelcd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjesus%2Fcmaelcd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjesus%2Fcmaelcd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjesus%2Fcmaelcd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjesus%2Fcmaelcd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjesus","download_url":"https://codeload.github.com/bjesus/cmaelcd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjesus%2Fcmaelcd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31316127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-04-02T21:02:33.990Z","updated_at":"2026-04-02T21:02:35.541Z","avatar_url":"https://github.com/bjesus.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CMAEL(CD) Tableau Solver\n\nA tableau-based satisfiability checker for **CMAEL(CD)** — Complete Multiagent Epistemic Logic with Common and Distributed knowledge.\n\nGiven a formula, the solver determines whether it is *satisfiable*: whether there exists a Kripke model and a state where the formula is true. It provides full tableau construction details, statistics, and graph visualization.\n\nAvailable as both a **command-line tool** and a **web interface**.\n\n## Based on\n\n\u003e **Tableau-based decision procedure for the multiagent epistemic logic with all coalitional operators for common and distributed knowledge**\n\u003e Mai Ajspur, Valentin Goranko, and Dmitry Shkatov (2012)\n\u003e [arXiv:1201.5346v1](https://arxiv.org/abs/1201.5346)\n\nThe implementation faithfully follows the paper's algorithm, including the restricted cut conditions (C1/C2) that dramatically reduce the state space without affecting correctness.\n\n## Formula syntax\n\nThe input syntax uses ASCII characters only — no special symbols needed:\n\n| Operator | Syntax | Meaning |\n|---|---|---|\n| Atom | `p`, `q`, `myProp` | Propositional variable |\n| Negation | `~p` | not p |\n| Conjunction | `(p \u0026 q)` | p and q |\n| Disjunction | `(p \\| q)` | p or q (desugars to `~(~p \u0026 ~q)`) |\n| Implication | `(p -\u003e q)` | p implies q (desugars to `~(p \u0026 ~q)`) |\n| Individual knowledge | `Ka p` | Agent *a* knows *p* (equivalent to `D{a} p`) |\n| Distributed knowledge | `D{a,b} p` | Distributed knowledge of coalition {a,b} |\n| Common knowledge | `C{a,b} p` | Common knowledge of coalition {a,b} |\n\nBinary connectives must be wrapped in parentheses: `(p \u0026 q)`, not `p \u0026 q`.\n\n## Getting started\n\n### Prerequisites\n\n[Bun](https://bun.sh) v1.0 or later.\n\n### Install\n\n```bash\nbun install\n```\n\n### Run tests\n\n```bash\nbun test\n```\n\n## Web interface\n\n### Build and serve locally\n\n```bash\nbun run build:web     # produces dist/index.html\nbun run serve.ts      # serves on http://localhost:3000\n```\n\n### Static deployment\n\nThe build produces a single self-contained `dist/index.html` file with the solver bundled inline. Deploy it to any static host (GitHub Pages, Netlify, Vercel, S3, etc.) — no server required.\n\nThe only external dependencies are KaTeX and viz.js loaded from CDN.\n\n### Features\n\n- Satisfiability checking with result banner\n- Toggle between restricted and unrestricted cut conditions\n- Tableau statistics across all three phases\n- List view showing all states and edges with KaTeX-rendered formulas\n- Graph view rendering the tableau as an interactive SVG via Graphviz (viz.js)\n- Fullscreen graph mode with pan and zoom (click graph to expand, Esc to close)\n- Example formulas from the paper (Examples 3, 4, 5)\n\n## CLI\n\n### One-shot mode\n\n```bash\nbun run src/index.ts \"(Ka p \u0026 ~Kb p)\"\n```\n\nExit code: `0` if satisfiable, `1` if unsatisfiable.\n\n### Options\n\n```\n--verbose, -v                     Show detailed output for all phases\n--dot [pretableau|initial|final]  Output DOT (Graphviz) graph\n--html                            Output standalone HTML visualization\n--no-restricted-cuts              Disable C1/C2 cut restrictions\n--interactive, -i                 Interactive REPL mode\n```\n\n### Examples\n\n```bash\n# Check satisfiability (SAT — agent a knows p, agent b doesn't)\nbun run src/index.ts \"(Ka p \u0026 ~Kb p)\"\n\n# Unsatisfiable — violates veridicality (knowledge implies truth)\nbun run src/index.ts \"(Ka p \u0026 ~p)\"\n\n# Paper Example 3 (unsatisfiable)\nbun run src/index.ts \"(~D{a,c} C{a,b} p \u0026 C{a,b} (p \u0026 q))\"\n\n# Verbose output showing all states in each phase\nbun run src/index.ts \"C{a,b} p\" --verbose\n\n# Generate DOT graph of the final tableau\nbun run src/index.ts \"(Ka p \u0026 ~Kb p)\" --dot final \u003e graph.dot\ndot -Tsvg graph.dot -o graph.svg\n\n# Interactive mode\nbun run src/index.ts --interactive\n```\n\n### Compiled binary\n\n```bash\nbun run build:cli     # produces ./cmael binary\n./cmael \"(Ka p \u0026 ~Kb p)\"\n```\n\n## How the algorithm works\n\nThe solver implements a three-phase tableau decision procedure:\n\n**Phase 1 — Construction (Pretableau).** Starting from the input formula, the algorithm builds a graph of *prestates* and *states*. Prestates are expanded into fully-expanded, downward-saturated states by decomposing formulas (splitting conjunctions, branching on disjunctions, handling modal operators). For each diamond formula in a state, a successor prestate is created. This continues until no new nodes are needed.\n\n**Phase 2 — Prestate Elimination.** Prestates are removed and edges rewired: if state *s* pointed to prestate *p*, and *p* expanded to state *t*, then *s* now points directly to *t*. This produces the *initial tableau*.\n\n**Phase 3 — State Elimination.** Defective states are iteratively removed in a dovetailed loop:\n- **E1:** States with diamond formulas but no matching successors are eliminated.\n- **E2:** Eventualities (from negated common knowledge, e.g. `~C{a,b} p`) must be *realized* via a finite witness path. States with unrealizable eventualities are eliminated.\n\nThe input formula is **satisfiable** iff the final tableau still contains a state with the input formula.\n\n## Project structure\n\n```\nsrc/\n  index.ts              CLI entry point\n  core/\n    types.ts            Formula AST, FormulaSet, tableau graph types\n    parser.ts           Recursive-descent parser\n    printer.ts          Pretty-printer (ASCII, Unicode, LaTeX)\n    classify.ts         Alpha/beta classification (Table 1 from paper)\n    formula.ts          Closure, extended closure, subformulas, agents\n    expansion.ts        FullExpansion (Def 9), Cut-Saturated Expansion (Def 14)\n    tableau.ts          Three-phase procedure: construction, prestate elim, state elim\n  viz/\n    text.ts             Text summary + DOT (Graphviz) output\n    html.ts             Standalone HTML page generator\n  browser/\n    index.ts            Browser entry point (exposes solver globally)\n  build-html.ts         Bundles browser entry into dist/index.html\ntests/\n  formula.test.ts       Unit tests (parser, classifier, closure, expansion)\n  examples.test.ts      Integration tests (paper examples, epistemic properties)\nserve.ts                Dev server (serves dist/index.html on port 3000)\ndist/\n  index.html            Built standalone web interface\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjesus%2Fcmaelcd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjesus%2Fcmaelcd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjesus%2Fcmaelcd/lists"}