{"id":49878967,"url":"https://github.com/paytonison/tot","last_synced_at":"2026-05-15T13:13:52.851Z","repository":{"id":355803245,"uuid":"1229668703","full_name":"paytonison/tot","owner":"paytonison","description":"A tiny total programming language prototype in Python with a conservative termination checker.","archived":false,"fork":false,"pushed_at":"2026-05-05T09:26:42.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-05T11:23:59.285Z","etag":null,"topics":["ai-assisted-development","halting-problem","interpreter","language-design","programming-language","python","termination-analysis","total-programming"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/paytonison.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-05T09:17:33.000Z","updated_at":"2026-05-05T09:30:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/paytonison/tot","commit_stats":null,"previous_names":["paytonison/tot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/paytonison/tot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paytonison%2Ftot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paytonison%2Ftot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paytonison%2Ftot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paytonison%2Ftot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paytonison","download_url":"https://codeload.github.com/paytonison/tot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paytonison%2Ftot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33067699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["ai-assisted-development","halting-problem","interpreter","language-design","programming-language","python","termination-analysis","total-programming"],"created_at":"2026-05-15T13:13:52.462Z","updated_at":"2026-05-15T13:13:52.844Z","avatar_url":"https://github.com/paytonison.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tot\n\nTot is a tiny experimental total programming language implemented as a\nself-contained Python prototype. It accepts only programs whose termination can\nbe proven by a conservative checker, then interprets the accepted programs.\n\nTot does not solve the general halting problem. Instead, it avoids the\nimpossible case by narrowing the language so unknown programs stay outside the\ntotal core.\n\n## Status\n\n- Prototype implementation, not a production language.\n- Nat-focused syntax and runtime values.\n- No third-party Python dependencies.\n- Accepted programs are intended to halt.\n- `Unknown` is a rejection result, not a warning.\n\n## Termination Verdicts\n\n| Verdict       | Result   | Meaning                                               |\n| ------------- | -------- | ----------------------------------------------------- |\n| `Halts`       | Accepted | The checker recognized a termination proof.           |\n| `DoesNotHalt` | Rejected | The checker found an obvious non-terminating pattern. |\n| `Unknown`     | Rejected | The checker could not prove termination.              |\n\nThe core rule is simple: only `Halts` programs run.\n\n## Why This Experiment Matters\n\nTot is more than a toy programming language. It is a compact demonstration of\nAI-assisted research, language design, and agentic implementation.\n\nThe project began with a discussion about one of the central limits of\ncomputation: the halting problem. Rather than treating the impossible case as a\ndead end, the design reframed the problem around total programming: accept only\nprograms whose termination can be proven, and reject everything else as either\nnon-halting or unknown.\n\nThat idea was then turned into an implementation brief and handed to Codex,\nwhich produced the working Python prototype, including the lexer, parser, AST,\ntermination checker, interpreter, examples, and `.tot` source convention.\n\nThe result is a small but complete artifact: a theoretical computing problem\nbecame a language-design concept, then a working executable prototype.\n\nThis matters because it demonstrates the new shape of software creation with\nadvanced AI systems. The human role was not merely to “prompt” a model. The\nhuman role was to identify the problem, frame the constraints, guide the design,\nevaluate the result, and turn the output into a coherent public project.\n\nTot is intentionally small. That is the point. Its value is not scale. Its value\nis compression.\n\nIn one tiny repository, it shows:\n\n- theoretical problem framing,\n- practical constraint selection,\n- programming language design,\n- agent delegation,\n- implementation synthesis,\n- executable validation,\n- and public presentation.\n\nTot is a miniature proof-of-concept for human-directed AI research and\ndevelopment: abstract computer science converted into working software through a\nhuman/AI cognitive loop.\n\n## Requirements\n\n- Python 3.10 or newer\n\n## Quick Start\n\nRun the built-in examples:\n\n```sh\npython3 tot.py\n```\n\nRun a Tot source file:\n\n```sh\npython3 tot.py path/to/program.tot\n```\n\nWhen every function is proven terminating, Tot prints `accepted`. If the\naccepted program contains `main`, the interpreter runs it and prints the return\nvalue.\n\n## Language Features\n\nTot currently supports:\n\n- `Nat` parameters, local variables, assignments, and return values\n- Integer and boolean literals\n- Arithmetic operators: `+`, `-`, `*`, `/`\n- Comparison operators: `==`, `!=`, `\u003c`, `\u003e`, `\u003c=`, `\u003e=`\n- Boolean operators: `\u0026\u0026`, `||`\n- `if` / `else` conditionals\n- Bounded `for` loops\n- Restricted `while` loops with explicit `decreases` hints\n- Restricted recursion with a declared decreasing argument\n- `//` line comments\n\nAll function parameters and return values are declared as `Nat`.\n\n## Termination Model\n\nThe checker returns a `Verdict` for each function:\n\n```python\nclass Verdict(Enum):\n    Halts = \"Halts\"\n    DoesNotHalt = \"DoesNotHalt\"\n    Unknown = \"Unknown\"\n```\n\nA program is accepted only when every function receives `Halts`. The checker is\nintentionally conservative, so programs that a human can see are terminating may\nstill be rejected if Tot cannot prove them with its current syntactic rules.\n\n## Examples\n\n### Accepted Bounded Loop\n\n```tot\nfn sum_to(n: Nat) -\u003e Nat {\n    let acc: Nat = 0;\n\n    for i in 0..n {\n        acc = acc + i;\n    }\n\n    return acc;\n}\n\nfn main() -\u003e Nat {\n    return sum_to(5);\n}\n```\n\nThis is accepted because the `for` loop has a finite bound.\n\n```text\nmain() =\u003e 10\n```\n\n### Accepted Recursive Function\n\n```tot\nfn factorial(n: Nat) -\u003e Nat decreases n {\n    if n == 0 {\n        return 1;\n    } else {\n        return n * factorial(n - 1);\n    }\n}\n\nfn main() -\u003e Nat {\n    return factorial(5);\n}\n```\n\nThis is accepted because the recursive call visibly decreases `n`, which is a\nnatural number.\n\n```text\nmain() =\u003e 120\n```\n\n### Accepted While Loop\n\n```tot\nfn countdown(n: Nat) -\u003e Nat {\n    while n \u003e 0 decreases n {\n        n = n - 1;\n    }\n\n    return n;\n}\n\nfn main() -\u003e Nat {\n    return countdown(100);\n}\n```\n\nThis is accepted because the loop condition is a recognized countdown and the\nbody directly decreases the declared measure.\n\n```text\nmain() =\u003e 0\n```\n\n### Rejected Infinite Loop\n\n```tot\nfn doom() -\u003e Nat {\n    while true {\n    }\n\n    return 0;\n}\n```\n\nTot rejects this program as an obvious infinite loop:\n\n```text\ndoom: DoesNotHalt - obvious while true loop\nrejected\n```\n\n### Rejected Unknown Loop\n\n```tot\nfn maybe(n: Nat) -\u003e Nat {\n    while n \u003e 0 {\n        n = n - 1;\n    }\n\n    return n;\n}\n```\n\nA human can see that this halts, but Tot currently requires an explicit\n`decreases` hint for `while` loops.\n\n```text\nmaybe: Unknown - while loop lacks a decreases proof\nrejected\n```\n\n### Rejected Recursive Growth\n\n```tot\nfn grow(n: Nat) -\u003e Nat decreases n {\n    return grow(n + 1);\n}\n```\n\nThe function claims that `n` is the decreasing measure, but the recursive call\nincreases it. Tot rejects the program.\n\n```text\ngrow: Unknown - recursive call is not visibly decreasing\nrejected\n```\n\n## Checker Rules\n\nTot v0 recognizes a small set of proof patterns:\n\n- Bounded `for` loops are considered terminating when their bounds terminate.\n- `while true` without an immediate guaranteed return is classified as\n  `DoesNotHalt`.\n- `while` loops need a `decreases` variable.\n- Countdown conditions must visibly test the decreasing variable against zero.\n- Loop bodies must directly assign `x = x - positive_integer`.\n- Recursive functions need a declared `decreases` parameter.\n- Recursive calls must pass `x - positive_integer` for that parameter.\n- Calls to other functions are allowed only after those functions are proven\n  total.\n\nThe checker does not perform general theorem proving. It accepts a deliberately\nsmall, syntactic subset.\n\n## Source Layout\n\n```text\n.\n├── README.md\n└── tot.py\n```\n\n`tot.py` contains the lexer, parser, AST definitions, termination checker,\ninterpreter, built-in examples, and command-line entry point.\n\n## Limitations\n\nTot is not:\n\n- A proof that the halting problem is decidable\n- A production programming language\n- A complete formal verification system\n- A replacement for proof assistants or verification-oriented languages\n\nIt is a small prototype demonstrating how a compiler can enforce termination by\nrefusing to run programs outside a conservative accepted subset.\n\n## Possible Next Steps\n\n- Add a focused test suite and golden files.\n- Improve parser and checker error messages.\n- Add richer type checking.\n- Support richer ranking functions.\n- Analyze mutual recursion.\n- Add structural recursion over lists or trees.\n- Document the termination checker formally.\n- Add editor tooling or syntax highlighting.\n\n## License\n\nNo license file is currently included.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaytonison%2Ftot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaytonison%2Ftot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaytonison%2Ftot/lists"}