{"id":13749201,"url":"https://github.com/brendanzab/rust-nbe-for-mltt","last_synced_at":"2025-09-08T18:34:13.506Z","repository":{"id":34112636,"uuid":"158456679","full_name":"brendanzab/rust-nbe-for-mltt","owner":"brendanzab","description":"Normalization by evaluation for Martin-Löf Type Theory with dependent records","archived":false,"fork":false,"pushed_at":"2022-06-08T00:00:07.000Z","size":883,"stargazers_count":90,"open_issues_count":0,"forks_count":7,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-05-22T21:34:51.464Z","etag":null,"topics":["bidirectional-typechecking","debruijn-indices","dependent-record-types","dependent-records","dependent-types","normalization-by-evaluation","rust","semantic-typechecking","type-checker","type-inference","type-system","type-theory","unification"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brendanzab.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}},"created_at":"2018-11-20T22:00:23.000Z","updated_at":"2024-03-30T11:08:13.000Z","dependencies_parsed_at":"2022-09-16T15:12:39.707Z","dependency_job_id":null,"html_url":"https://github.com/brendanzab/rust-nbe-for-mltt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brendanzab/rust-nbe-for-mltt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brendanzab%2Frust-nbe-for-mltt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brendanzab%2Frust-nbe-for-mltt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brendanzab%2Frust-nbe-for-mltt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brendanzab%2Frust-nbe-for-mltt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brendanzab","download_url":"https://codeload.github.com/brendanzab/rust-nbe-for-mltt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brendanzab%2Frust-nbe-for-mltt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274229372,"owners_count":25245188,"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-08T02:00:09.813Z","response_time":121,"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":["bidirectional-typechecking","debruijn-indices","dependent-record-types","dependent-records","dependent-types","normalization-by-evaluation","rust","semantic-typechecking","type-checker","type-inference","type-system","type-theory","unification"],"created_at":"2024-08-03T07:00:56.896Z","updated_at":"2025-09-08T18:34:13.450Z","avatar_url":"https://github.com/brendanzab.png","language":"Rust","funding_links":[],"categories":["Projects"],"sub_categories":["Libraries"],"readme":"# rust-nbe-for-mltt\n\nThis originally started as a Rust port of Danny Gratzer's implementation of\n[Normalization by Evaluation for Martin-Löf Type Theory][nbe-for-mltt], but it\nhas a slightly different architecture and some additional language features.\nThe algorithm for the insertion and unification of metavariables was partly\ntaken from Andras Korvacs' [Minimal TT Exampls][minimal-tt-examples] and\n[smalltt][smalltt] (although gluing is not yet implemented here).\nIt will probably become the basis for a new front-end for\n[Pikelet](https://github.com/pikelet-lang/pikelet).\n\nIn traditional type checking and normalization that uses [DeBruijn indices][de-bruijn-indices],\nyou are required to shift variable indices whenever you open up binders. This\nis extremely expensive, and rules out future optimizations, like [using\nvisitors][visitors] to reduce the number of intermediate allocations as the AST\nis traversed. This implementation avoids these problems by using a \"semantic\ntype checking\"  algorithm that uses DeBruijn indices for the core syntax, and\nDeBruijn levels in the syntax of the semantic domain.\n\n| Syntax        | Binding method              | Example                         |\n|---------------|-----------------------------|---------------------------------|\n| Concrete      | Nominal                     | `λz. (λy. y (λx. x)) (λx. z x)` |\n| Core          | Nameless (DeBruijn Indices) | `λ . (λ . 0 (λ . 0)) (λ . 1 0)` |\n| Domain        | Nameless (DeBruijn Levels)  | `λ . (λ . 1 (λ . 2)) (λ . 0 1)` |\n\n[nbe-for-mltt]: https://github.com/jozefg/nbe-for-mltt\n[minimal-tt-examples]: https://github.com/AndrasKovacs/minimal-tt-examples\n[smalltt]: https://github.com/AndrasKovacs/smalltt\n[de-bruijn-indices]: https://en.wikipedia.org/wiki/De_Bruijn_index\n[visitors]: https://github.com/pikelet-lang/pikelet/issues/75\n\n## TODO\n\n- [x] Convert data types to Rust\n- [x] Port NbE and bidirectional type checking\n- [x] Add a parser for the concrete syntax\n- [x] Desugaring of concrete syntax to core syntax\n- [x] Resugaring of core syntax to concrete syntax\n- [ ] Pretty printing\n    - [x] Basic pretty printing\n    - [x] Preserve pretty names through type checking and normalization\n    - [ ] Unfold metavariables when pretty printing values\n    - [ ] Attempt to avoid unfolding variables when pretty printing values\n- [x] Add a REPL\n- [x] Add span information to ASTs to improve diagnostics\n- [ ] Pattern matching elaboration\n    - [x] Simple cases\n    - [ ] Nested cases\n    - [ ] Multiple scrutinees\n    - [ ] Lambda case\n- [x] Dependent record types\n- [x] Primitive operations\n- [ ] Unification\n    - [x] Basic unification\n    - [x] Function eta rules\n    - [x] Record eta rules\n    - [ ] [Pruning](https://gitter.im/pikelet-lang/Lobby?at=5cd519e60f381d0a768e7811)\n    - [ ] [Skolemization](https://gitter.im/pikelet-lang/Lobby?at=5cd129ca6a84d76ed85bbefd)\n- [x] Metavariable insertion\n- [ ] Integration tests\n  - [ ] Parse (pass)\n  - [ ] Parse (fail)\n  - [x] Elaboration (pass)\n  - [ ] Elaboration (fail)\n  - [ ] Normalization tests\n  - [x] Sample modules\n- [ ] Error recovery in:\n  - [x] Lexer\n  - [ ] Parser\n  - [ ] Elaborator\n  - [ ] Validator\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrendanzab%2Frust-nbe-for-mltt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrendanzab%2Frust-nbe-for-mltt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrendanzab%2Frust-nbe-for-mltt/lists"}