feat(Computability): Framework for encoding arbitrary types on Turing machines

未关闭
#590 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Digger-Rockwell 已经在做这个了。

开始于 2026年11月18日。

  • #5 来自 @Digger-Rockwell —— 未关闭
  • #1249 来自 @Digger-Rockwell —— 未关闭

评估

难度
5/5
预计耗时
一周以上
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
领域
compilers

调研方向

从 Cslib/Computability/Turing/SingleTapeTM.lean 中的第一个 TODO 开始,并阅读现有的 TimeComputable 和 PolyTimeComputable 定义。当引入 TapeEncodable 以及 encode、decode 和往返正确性,并添加平凡的 List Symbol 实例后,阶段 1 即完成。

由索引模型根据 Issue 内容生成。

描述

Description:

This issue addresses the first TODO in Cslib/Computability/Turing/SingleTapeTM.lean:

"Encoding of types in lists to represent computations on arbitrary types."

Currently, TimeComputable and PolyTimeComputable are restricted to functions of type List Symbol → List Symbol. To expand this to standard computable functions (e.g., over Nat, Bool, pairs, and eventually Rat for Computable Analysis), we need a standardized way to represent arbitrary types on the TM tape.

Proposed Architecture

I propose introducing a TapeEncodable typeclass that bundles the encoding function, the decoding function, and the proof of round-trip correctness:

class TapeEncodable (α : Type) (Symbol : Type) where
  encode : α → List Symbol
  decode : List Symbol → Option α
  decode_encode_eq : ∀ (a : α), decode (encode a) = some a
Implementation Plan

I would like to break this into a few manageable PRs:

  • Phase 1 (This week): Introduce the TapeEncodable typeclass and provide the trivial instance for List Symbol.

  • Phase 2: Provide basic instances (e.g., for Bool, Nat, and α × β).

  • Phase 3: Generalize TimeComputable and PolyTimeComputable to accept arbitrary types α and β given [TapeEncodable α Symbol] and [TapeEncodable β Symbol].

I will start with PR 1.

主要语言
Lean
星标
847
派生
234
平均合并
2 天 21 小时
30 天内合并 PR
49

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

leanprover/cslib 的其他 Issue

查看 leanprover/cslib 的全部 Issue

相似的 Issue

更多 Compilers Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。