{"id":14966213,"url":"https://github.com/yiyunliu/mltt-consistency","last_synced_at":"2025-10-25T16:30:38.178Z","repository":{"id":202659859,"uuid":"707855872","full_name":"yiyunliu/mltt-consistency","owner":"yiyunliu","description":"Logical relation for predicative CC omega with booleans and an intensional identity type","archived":false,"fork":false,"pushed_at":"2024-12-27T05:26:19.000Z","size":8315,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T21:51:55.091Z","etag":null,"topics":["coq","coq-formalization","dependent-type-theory","dependent-types","logical-relation"],"latest_commit_sha":null,"homepage":"","language":"TeX","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/yiyunliu.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,"publiccode":null,"codemeta":null}},"created_at":"2023-10-20T20:20:16.000Z","updated_at":"2024-11-12T05:34:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"864cf0fd-e890-4641-8a8f-f9dbdcf38f5b","html_url":"https://github.com/yiyunliu/mltt-consistency","commit_stats":{"total_commits":381,"total_committers":6,"mean_commits":63.5,"dds":0.3123359580052494,"last_synced_commit":"40d53a78e49e41ef040a3ebadca2376859745ea2"},"previous_names":["yiyunliu/mltt-consistency"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiyunliu%2Fmltt-consistency","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiyunliu%2Fmltt-consistency/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiyunliu%2Fmltt-consistency/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiyunliu%2Fmltt-consistency/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiyunliu","download_url":"https://codeload.github.com/yiyunliu/mltt-consistency/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238174109,"owners_count":19428626,"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":["coq","coq-formalization","dependent-type-theory","dependent-types","logical-relation"],"created_at":"2024-09-24T13:36:01.197Z","updated_at":"2025-10-25T16:30:38.165Z","avatar_url":"https://github.com/yiyunliu.png","language":"TeX","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mechanized consistency proof for MLTT\nThis repository contains a very short weak normalization (for closed\nand open terms) proof of Martin-Löf\ntype theory in Coq (~ 1500 LoC excluding code produced by Autosubst 2). You need\n[Autosubst2](https://github.com/uds-psl/autosubst2) (only if\nyou plan to change [syntax.sig](syntax.sig)),\n[stdpp](https://gitlab.mpi-sws.org/iris/stdpp), [Coq-Equations](https://github.com/mattam82/Coq-Equations),\nand [CoqHammer](https://github.com/lukaszcz/coqhammer) to build the\nproject.\n\nThe repository is known to compile with Coq 8.18.0. It\nwon't compile with earlier versions because I'm using a feature\nrelated to universe unification that wasn't introduced until\n8.18.0. If you annotate terms whose type involves `Prop`, then you\nmight be able to compile the code with an older Coq version.\n\nThe semantic interpretation is heavily inspired by\n\u003chttps://dl.acm.org/doi/10.1145/3167091\u003e. However, we leverage\nimpredicativity to define a countable universe hierarchy, rather than\ndefining a single predicative universe, where impredicativity turns\nout to be unnecessary (see \u003chttps://dl.acm.org/doi/10.1145/3636501.3636951\u003e).\n\nSee \u003chttps://github.com/ionathanch/TT-model\u003e for an Agda\nimplementation of the proof, which uses induction-recursion rather\nthan impredicativity to encode the countable universe hierarchy. The\nlogical relation from the linked repository currently can only be used\nto derive canonicity and consistency, but not weak normalization.\n\n\n## Language specification\nThe syntactic typing rules can be found in [typing.v](theories/typing.v).\n\nIn short, the system is most similar to the predicative part of\n$CC^\\omega$, which is notable for its untyped conversion rule and\ncumulativity.\nWe add extensions such as an intensional identity type, a\nnatural number base type, and a Void type. The Void type can instead be\nencoded as `0 = 1 ∈ Nat`. Likewise, we can encode a singleton type as\n`0 = 0 ∈ Nat`.\n\nOur subtyping relation is contravariant on the argument, unlike\n$CC^\\omega$ or Coq. The semantic model is enough to justify this more\nflexible design.\n\nThe $\\eta$-law for functions is supported (see the `eta` branch),\nthough it's not yet merged to the main branch because we need some\nminor clean-ups.\n\n# Eta law for surjective pairing\nMy other repository \u003chttps://github.com/yiyunliu/sp-eta-postpone\u003e\ncontains a development with type-directed surjective pairing. The\ndevelopment also proves strong normalization instead of weak\nnormalization, and it turns out that SN proof isn't any harder than\nweak normalization proof as long as you stick to Altenkirch's\ninductive characterization of SN terms.\n\nInjectivity of type constructors is baked into the declarative\nequational theory and its admissibility is not proven (I'm\ninvestigating a method of recovering the admissibility proof\nsyntactically [here](https://github.com/yiyunliu/TPOSR)).\n\nThe function\n[check_sub_r](https://github.com/yiyunliu/sp-eta-postpone/blob/437c97455e7d55255349d02b26071e831b1c2be3/theories/executable.v#L563)\nis a computable coq fixpoint and is proven to be both correct and\nterminating. You can extract and run the program if interested, and I\nmight write a simple type checker frontend if I ever decide to play\naround with bidirectional typing.\n\n## Install dependencies\nFirst, run `opam update` in the shell to update the package repository\nso your package manager knows where to fetch the dependencies.\n\n### Method 1: Opam install\nRun the following commands:\n```sh\nopam repo add coq-released https://coq.inria.fr/opam/released\nopam update\nopam install . --deps-only\n```\n\n### Method 2: Switch file\nThe [opam.switch](opam.switch) file allows you to recreate an opam\nswitch that is identical to our environment. To create a switch named `mltt`, run the following command when you have [opam.switch](opam.switch) available in your working directory:\n```\nopam switch import opam.switch --switch mltt --repositories=coq-released=https://coq.inria.fr/opam/released,default=https://opam.ocaml.org\n```\n\n## Build\nSimply run the following command:\n```sh\nmake\n```\nYou can pass the `-j[PROC]` flag to speed up the compilation by\nspawning multiple `Coq` processes at the same time to validate the\nfiles. Replace `[PROC]` with a positive integer that represents the\nnumber of processes you want to spawn, though you might want to lower\nthat number to reduce the memory consumption.\n\n## Axioms\nBoth syntactic and semantic soundness proofs rely on functional\nextensionality because it is required by the Autosubst 2\ninfrastructure.\n\nThe semantic soundness proof additionally requires propositional\nextensionality. Propositional extensionality is not neccesssary, but\nit makes automation more tractable.\n\nThe repository is otherwise free of axioms. Notably, manual\ngeneralization is favored over the `dependent induction` tactic to avoid\nreliance on axioms related to proof irrelevance.\n\n\n## Contents\n- [syntax.sig](syntax.sig): Syntax specification written in\nhigher-order abstract syntax. Used by the `as2-exe` executable to\nproduce the Coq syntax file [syntax.v](theories/Autosubst2/syntax.v)\n- [theories/Autosubst2](theories/Autosubst2): Header files/auto-generated syntax file from/by Autosubst 2\n- [join.v](theories/join.v): Reduction and subtyping\n- [typing.v](theories/typing.v): Syntactic typing rules\n- [normalform.v](theories/normalform.v): Properties related\n  to normal and neutral terms\n- [semtyping.v](theories/semtyping.v): Definition of the\n  logical relation and its properties\n- [soundness.v](theories/soundness.v): Semantic typing,\n  semantic soundness (i.e. the fundamental theorem), normalizaiton,\n  and consistency\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiyunliu%2Fmltt-consistency","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiyunliu%2Fmltt-consistency","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiyunliu%2Fmltt-consistency/lists"}