{"id":31423992,"url":"https://github.com/xieyuheng/mugda","last_synced_at":"2025-09-30T03:11:06.675Z","repository":{"id":61669960,"uuid":"544565290","full_name":"xieyuheng/mugda","owner":"xieyuheng","description":"An implementation of the mugda paper","archived":false,"fork":false,"pushed_at":"2025-07-20T06:37:44.000Z","size":3140,"stargazers_count":3,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-16T14:08:18.574Z","etag":null,"topics":["agda","halting-problem","mugda","termination-checking","type-checker"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/xieyuheng.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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-02T19:45:45.000Z","updated_at":"2025-07-20T06:37:48.000Z","dependencies_parsed_at":"2023-01-29T18:00:23.877Z","dependency_job_id":"b52eb966-a023-4235-a2ec-d6b1719f0c64","html_url":"https://github.com/xieyuheng/mugda","commit_stats":{"total_commits":388,"total_committers":1,"mean_commits":388.0,"dds":0.0,"last_synced_commit":"15e39d0b7e997f513527fb825f19df97b0ff9527"},"previous_names":["cicada-lang/mugda.sexp","xieyuheng/mugda","cicada-lang/mugda"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/xieyuheng/mugda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fmugda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fmugda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fmugda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fmugda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xieyuheng","download_url":"https://codeload.github.com/xieyuheng/mugda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fmugda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276236173,"owners_count":25608051,"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","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["agda","halting-problem","mugda","termination-checking","type-checker"],"created_at":"2025-09-30T03:11:05.959Z","updated_at":"2025-09-30T03:11:06.670Z","avatar_url":"https://github.com/xieyuheng.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mugda\n\n\u003e Recursion is not an option.\n\u003e\n\u003e -- [\"The Little Typer\"](https://mitpress.mit.edu/9780262536431/the-little-typer)\n\nAn implementation of the Mugda paper -- [\"Termination Checking for a Dependently Typed Language\"](docs/papers/termination-checking-for-a-dependently-typed-language--karl-mehltretter.pdf), 2007, by Karl Mehltretter.\n\nThe \"Mu\" of the name \"Mugda\"\ncomes from [μ-operator (mu-operator)](https://en.wikipedia.org/wiki/%CE%9C_operator)\nof [general recursive function](https://en.wikipedia.org/wiki/General_recursive_function).\n\n## Notes\n\n### Zero arity data constructor\n\nWhen using zero arity data constructor, we must write them in `()`.\nFor example, `zero` and `(zero)` are the same.\n\nBut when using zero arity data constructor in pattern, we must write them in `()`.\nFor example, we should not write `zero` but write `(zero)`,\notherwise the interpreter can not distinguish pattern variable\nfrom this zero arity data constructor.\n\n### Syntax of inductive datatype definition\n\nThe syntax of inductive datatype definition -- `(data)`,\nis learnt from [\"The Little Typer\"](https://mitpress.mit.edu/9780262536431/the-little-typer).\n\n## Usages\n\n### Command line tool\n\nInstall it by the following command:\n\n```sh\nnpm install -g @xieyuheng/mugda\n```\n\nThe command-line program is called `mu`.\n\nopen a REPL:\n\n```sh\nmu repl\n```\n\nor just:\n\n```sh\nmu\n```\n\nRun a file:\n\n```sh\nmu run tests/basic/id.test.mu\n```\n\nRun a file and watch file change:\n\n```sh\nmu run tests/basic/id.test.mu --watch\n```\n\n## Examples\n\nPlease see [**tests/**](tests/) and [**std/**](std/) for more examples.\n\n### Boolean\n\n```scheme\n(data Boolean () ()\n  [true () Boolean]\n  [false () Boolean])\n\n(fn if (Pi ([A Type]) (-\u003e Boolean A A A))\n  [(A (true) a b) a]\n  [(A (false) a b) b])\n\n(define and (-\u003e Boolean Boolean Boolean)\n  (lambda (a b)\n    (if Boolean a b false)))\n\n(define or (-\u003e Boolean Boolean Boolean)\n  (lambda (a b)\n    (if Boolean a true b)))\n\n(and true true)\n(and true false)\n(and false true)\n(and false false)\n\n(or true true)\n(or true false)\n(or false true)\n(or false false)\n```\n\n### Nat\n\n```scheme\n(data Nat () ()\n  [zero () Nat]\n  [add1 ([prev Nat]) Nat])\n\n(fn add (-\u003e Nat Nat Nat)\n  [(x (zero)) x]\n  [(x (add1 y)) (add1 (add x y))])\n\nadd\n(add (add1 zero))\n(add (add1 zero) (add1 zero))\n```\n\n### List\n\n```scheme\n(data List ([+ A Type]) ()\n  [null () (List A)]\n  [cons ([head A] [tail (List A)]) (List A)])\n\n(import \"../nat/index.mu\" Nat zero add1)\n\n(fn length (Pi ([A Type]) (-\u003e (List A) Nat))\n  [(A (null A)) zero]\n  [(A (cons A head tail)) (add1 (length A tail))])\n\n(length Nat (null Nat))\n(length Nat (cons Nat zero (null Nat)))\n(length Nat (cons Nat zero (cons Nat zero (null Nat))))\n```\n\n## Development\n\n```sh\nnpm install           # Install dependencies\nnpm run build         # Compile `src/` to `lib/`\nnpm run build:watch   # Watch the compilation\nnpm run format        # Format the code\nnpm run test          # Run test\nnpm run test:watch    # Watch the testing\n```\n\n## Thanks\n\nThank you, Karl Mehltretter, for writing this paper.\n\n## License\n\n[GPLv3](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxieyuheng%2Fmugda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxieyuheng%2Fmugda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxieyuheng%2Fmugda/lists"}