{"id":13993135,"url":"https://github.com/gihanmarasingha/miu_language","last_synced_at":"2026-02-28T01:02:21.421Z","repository":{"id":178363785,"uuid":"281705989","full_name":"gihanmarasingha/miu_language","owner":"gihanmarasingha","description":"A decision procedure for the formal system MIU, written in Lean 3.18.4","archived":false,"fork":false,"pushed_at":"2020-08-18T22:58:48.000Z","size":126,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-22T17:46:15.636Z","etag":null,"topics":["decision-procedure","lean","leanprover","miu"],"latest_commit_sha":null,"homepage":"","language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gihanmarasingha.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}},"created_at":"2020-07-22T14:52:44.000Z","updated_at":"2024-05-30T23:08:52.000Z","dependencies_parsed_at":"2024-01-18T04:23:55.743Z","dependency_job_id":null,"html_url":"https://github.com/gihanmarasingha/miu_language","commit_stats":null,"previous_names":["gihanmarasingha/miu_language"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/gihanmarasingha/miu_language","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gihanmarasingha%2Fmiu_language","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gihanmarasingha%2Fmiu_language/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gihanmarasingha%2Fmiu_language/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gihanmarasingha%2Fmiu_language/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gihanmarasingha","download_url":"https://codeload.github.com/gihanmarasingha/miu_language/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gihanmarasingha%2Fmiu_language/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29922071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"ssl_error","status_checked_at":"2026-02-27T19:37:41.463Z","response_time":57,"last_error":"SSL_read: 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":["decision-procedure","lean","leanprover","miu"],"created_at":"2024-08-09T14:02:14.711Z","updated_at":"2026-02-28T01:02:19.383Z","avatar_url":"https://github.com/gihanmarasingha.png","language":"Lean","funding_links":[],"categories":["Lean"],"sub_categories":[],"readme":"# An MIU Decision Procedure in Lean\n\nThe [MIU formal system](https://en.wikipedia.org/wiki/MU_puzzle) was introduced by Douglas\nHofstadter in the first chapter of his 1979 book,\n[Gödel, Escher, Bach](https://en.wikipedia.org/wiki/G%C3%B6del,_Escher,_Bach).\nThe system is defined by four rules of inference, one axiom, and an alphabet of three symbols:\n`M`, `I`, and `U`.\n\nHofstadter's central question is: can the string `\"MU\"` be derived?\n\nIt transpires that there is a simple decision procedure for this system. A string is derivable if\nand only if it starts with `M`, contains no other `M`s, and the number of `I`s in the string is\ncongruent to 1 or 2 modulo 3.\n\nThe principal aim of this project is to give a Lean proof that the derivability of a string is a\ndecidable predicate.\n\n## The MIU System\n\nIn Hofstadter's description, an _atom_ is any one of `M`, `I` or `U`. A _string_ is a finite\nsequence of zero or more symbols. To simplify notation, we write a sequence `[I,U,U,M]`,\nfor example, as `IUUM`.\n\nThe four rules of inference are:\n\n1. xI → xIU,\n2. Mx → Mxx,\n3. xIIIy → xUy,\n4. xUUy → xy,\n\nwhere the notation α → β is to be interpreted as 'if α is derivable, then β is derivable'.\n\nAdditionally, he has an axiom:\n\n* `MI` is derivable.\n\nIn Lean, it is natural to treat the rules of inference and the axiom on an equal footing via an\ninductive data type `derivable` designed so that `derviable x` represents the notion that the string\n`x` can be derived from the axiom by the rules of inference. The axiom is represented as a\nnonrecursive constructor for `derivable`. This mirrors the translation of Peano's axiom '0 is a\nnatural number' into the nonrecursive constructor `zero` of the inductive type `nat`.\n\n```lean\ninductive derivable : miustr → Prop\n| mk : derivable \"MI\"\n| r1 {x} : derivable (x ++ [I]) → derivable (x ++ [I, U])\n| r2 {x} : derivable (M :: x) → derivable (M :: x ++ x)\n| r3 {x y} : derivable (x ++ [I, I, I] ++ y) → derivable (x ++ U :: y)\n| r4 {x y} : derivable (x ++ [U, U] ++ y) → derivable (x ++ y)\n```\n\nWith the above definition, we can, for example, prove that `\"UMIU\"` is derivable, assuming `\"UMI\"` is derivable.\n```lean\nexample (h : derivable \"UMI\") : derivable \"UMIU\" :=\nbegin\n  change (\"UMIU\" : miustr) with [U,M] ++ [I,U],\n  exact derivable.r1 h, -- Rule 1\nend\n```\n\n## References\n\n* Jeremy Avigad, Leonardo de Moura and Soonho Kong, [_Theorem Proving in Lean_](https://leanprover.github.io/theorem_proving_in_lean/).\n* Douglas R Hofstadter (1979). _Gödel, Escher, Bach: an eternal golden braid_, New York, Basic Books.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgihanmarasingha%2Fmiu_language","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgihanmarasingha%2Fmiu_language","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgihanmarasingha%2Fmiu_language/lists"}