{"id":31942125,"url":"https://github.com/effectfully/ouroboros","last_synced_at":"2026-02-18T03:03:11.983Z","repository":{"id":30928300,"uuid":"34486255","full_name":"effectfully/Ouroboros","owner":"effectfully","description":null,"archived":false,"fork":false,"pushed_at":"2015-07-16T10:11:51.000Z","size":180,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T09:26:10.093Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Agda","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/effectfully.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}},"created_at":"2015-04-23T23:07:01.000Z","updated_at":"2018-04-09T13:50:35.000Z","dependencies_parsed_at":"2022-09-03T22:11:13.618Z","dependency_job_id":null,"html_url":"https://github.com/effectfully/Ouroboros","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/effectfully/Ouroboros","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectfully%2FOuroboros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectfully%2FOuroboros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectfully%2FOuroboros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectfully%2FOuroboros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/effectfully","download_url":"https://codeload.github.com/effectfully/Ouroboros/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effectfully%2FOuroboros/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29566659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T00:47:08.760Z","status":"online","status_checked_at":"2026-02-18T02:00:09.468Z","response_time":162,"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":[],"created_at":"2025-10-14T09:26:08.166Z","updated_at":"2026-02-18T03:03:06.974Z","avatar_url":"https://github.com/effectfully.png","language":"Agda","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Ouroboros\n\nThis repository contains some thoughts about representing dependent type theory in dependent type theory.\n\n## Weakening\n\nWeakening is defined as a type-preserving renaming.\n\nThis function drops `i` elements from a context, starting from the right.\n\n```\nrdrop : ∀ {n} -\u003e (i : Fin n) -\u003e Con n -\u003e Con (n ∸ toℕ i)\nrdrop  zero     Γ      = Γ\nrdrop (suc n)  (Γ , σ) = rdrop n Γ\n```\n\nThis function inserts a type into a context at the `i` position, starting from the right.\nIt also weakens all traversed types to make them indexed by the new context.\n\n```\nrinsert : ∀ {n} i (Γ : Con n) -\u003e Type (rdrop i Γ) -\u003e Con (suc n)\nrinsert  zero    Γ      τ = Γ , τ\nrinsert (suc i) (Γ , σ) τ = rinsert i Γ τ , Weaken i σ\n```\n\nThis function weakens a type. Each time we go under a binder (`_Π_` in this case), we increase the \"weakening index\" (I don't know what the right wording is).\n\n```\nWeaken : ∀ {n} i {Γ : Con n} {σ} -\u003e Type Γ -\u003e Type (rinsert i Γ σ)\nWeaken i  type   = type\nWeaken i (σ Π τ) = Weaken i σ Π Weaken (suc i) τ\nWeaken i (↑ t)   = ↑ (weaken i t)\n```\n\nThis function weakens a term. `ƛ_` is the binder now.\n\n```\nweaken : ∀ {n} i {Γ : Con n} {σ τ} -\u003e Γ ⊢ τ -\u003e rinsert i Γ σ ⊢ Weaken i τ\nweaken i (ƛ b)   = ƛ (weaken (suc i) b)\nweaken i (↓ σ)   = ↓ (Weaken i σ)\nweaken i (var v) = var (weaken-var i v)\n```\n\nThis function weakens a variable. If the weakening index is `zero`, then the variable points to the untouched part of the context, and hence we need to increment it, because the context now contains an additional type, that must be skipped. If the weakening index is `suc i` for some `i` and the variable points to the head of the context, then we don't need to weaken it, since the context is changed somewhere forward. In the remaining case we just call `weaken-var` recursively.\n\n``` \nweaken-var : ∀ {n} i {Γ : Con n} {σ τ} -\u003e Γ ∋ τ -\u003e rinsert i Γ σ ∋ Weaken i τ\nweaken-var  zero             v     = vs v\nweaken-var (suc i)  {Γ , σ}  vz    = H.subst (_∋_ _) Pop-Weaken\n                                        vz\nweaken-var (suc i)  {Γ , σ} (vs v) = H.subst (_∋_ _) Pop-Weaken\n                                       (vs (weaken-var i v))\n```\n\nA quick illustation taken from the `Tests` module:\n\n```\ntest-4 : Type (ε , type , type Π type , type)\ntest-4 = ↑ (var (vs vs vz)) Π ↑ (var (vs vz)) Π type Π ↑ (var vz)\n\ntest-6 : Weaken (suc (suc zero)) {σ = type} test-4\n         ≡ (↑ (var (vs vs vs vz)) Π ↑ (var (vs vz)) Π type Π ↑ (var vz))\ntest-6 = refl\n```\n\nHere `Weaken` does what expected, i.e. inserts `type` to the context of `test-4` at the second position, starting from zero and from the right:\n\n```\nε {- 3 -} , type {- 2 -} , type Π type {- 1 -} , type {- 0 -}\n```\n\ntransforming the context into `ε , type , type , (type Π type) , type`. The only variable, that points to the untouched part of the context is `vs vs vs vz`, which was `vs vs vz` previously. Other variables remain unchanged. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffectfully%2Fouroboros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feffectfully%2Fouroboros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffectfully%2Fouroboros/lists"}