-
Notifications
You must be signed in to change notification settings - Fork 54
feat: Single Tape Turing Machines #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Single Tape Turing Machines #269
Conversation
This PR adds `Reduction.relates{In,Within}Steps`, functions that
communicate whether a relation forms a directed path of length (at most)
`n` between two elements.
Specifically, it includes:
* Definitions of these functions
* Theorems about reflexivity and transitivity
* Theorems that track the growth of ancillary functions with respect to
the relation
These are a prerequisite to defining time bounds, perhaps for multiple
models of computation, but in particular for Turing machines, see PR
#269.
---------
Co-authored-by: Chris Henson <[email protected]>
Co-authored-by: Chris Henson <[email protected]>
Co-authored-by: Chris Henson <[email protected]>
…/cslib into single-tape-turing-machines
|
I am experiencing some kind of CI error with |
Are you passing the |
|
No, the error message just told me to run The file 'Cslib.lean' is out of date: run |
The docs upstream are likely out of date given how recent this change is. |
|
It looks like you've addressed my suggestions, thank you! Do you mind identifying some of the theorems you are repeatedly passing to |
|
Ok I have gone and added grind annotations to the point where I think I haven't used any one lemma more than once, so I guess that's the letter of what you've said. I haven't looked heavily into the different variety of grind annotations though, so I'm a bit nervous that I've left ones out, but I also don't want to add too many annotations (would that cause grind to explode or something?). LMK if you want me to do more research into how to annotate so I can give the best annotations here. |
|
Like for example It would seem nice if this would be triggered whenever Edit, I guess this is what grind_pattern is for! |
Yeah in this case I think what you're asking for is |
|
Can you also please use Edit: I am not sure when, but I remember hearing there will be something like |
chenson2018
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the contribution! I think all my feedback has been addressed. I will wait to merge in case @fmontesi has any comments.
I have now marked this ready for review but it's quite a large PR, reviewers please tell me if I should reorganize things or submit in a different way.
This PR adds a model of Single Tape Turing machines, which inputs and outputs
List αfor a finite alphabet typeα, with the following features:Cslib/Foundations/DataStackTape, a stack-like data structure for optional alphabet symbols that extends infinitely (in one direction) with blank (none) symbols. Represented as a finite list that tructates the infinite stream of none elementsBiTape, a bidirectionally infinite Tape, made from twoStackTapeCslib/Computability/Machines/SingleTapeTuring/Basic.leanstructuresrepresenting computability within a time bound, and polynomial time computability.This PR was authored with the support of Claude Code and Project Numina's Lean MCP fork
My Design Notes
While Mathlib has a definition of polynomial time computability based on a more complicated model of TMs, I think it makes sense to have one based on a simple single-tape model here.
Longer term, I would like to try to create a unified framework for talking about TMs with variable amounts of tapes / stacks, so that we can eventually prove theorems about the time and space overhead incurred by switching from one model to another (e.g. 2 tape TMs simulate k-tape TMs with log overhead, 1 tape TMs simulate 2-tape TMs with quadratic overhead, 2-stack machines simulate 1 tape TMs ).
I ultimately did not reuse much if any of the Mathlib infrastructure around
Tapes, because of the injectivity issue I described in the docstring.