Skip to content
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

[Merged by Bors] - feat(computability/tm_to_partrec): prove finiteness #6955

Closed
wants to merge 5 commits into from

Conversation

digama0
Copy link
Member

@digama0 digama0 commented Mar 29, 2021

The proof in this file was incomplete, and I finally found the time to
finish it. tm_to_partrec.lean constructs a turing machine that can
simulate a given partial recursive function. Previously, the functional
correctness of this machine was proven, but it uses an infinite state
space so it is not a priori obvious that it is in fact a true (finite)
turing machine, which is important for the Church-Turing theorem. This
PR adds a proof that the machine is in fact finite.

@digama0 digama0 requested a review from gebner March 29, 2021 23:19
@digama0 digama0 added the awaiting-review The author would like community review of the PR label Mar 29, 2021
Copy link
Member

@gebner gebner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I don't have any comments on the technical contents, it seems to be as beautiful and elegant as Turing machines can be.

any_goals {
cases finset.insert_subset.1 HS₁ with h₁ h₂,
id { have h₃ := h₂ W } <|> try { simp [finset.subset_iff] at h₂ } },
{ exact supports_insert.2 ⟨⟨λ _, h₃, λ _, h₁⟩, q_ih H₁ h₂⟩ }, -- move
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should any_goals maybe preserve tags?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, but I'm not planning on doing anything about that in this PR.

src/computability/tm_to_partrec.lean Outdated Show resolved Hide resolved
states in `code_supp c k`, so this is a finite state machine. Even though the underlying type of
state labels `Λ'` is infinite, for a given partial recursive function `c` and continuation `k`,
only finitely many states are accessed, corresponding roughly to subterms of `c`. -/
theorem tr_supports (c k) : @TM2.supports _ _ _ _ _ ⟨tr_normal c k⟩ tr (code_supp c k) :=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-standard inhabited instance is a bit ugly here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TM2 functions assume that there is a single initial state given by the default on the type. For this proof we need a family of TMs with different starting points, so we have to override the inhabited instance in the statement.

@semorrison semorrison added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Apr 5, 2021
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Apr 30, 2021
The proof in this file was incomplete, and I finally found the time to
finish it. `tm_to_partrec.lean` constructs a turing machine that can
simulate a given partial recursive function. Previously, the functional
correctness of this machine is proven, but it uses an infinite state
space so it is not a priori obvious that it is in fact a true (finite)
turing machine, which is important for the Church-Turing theorem. This
PR adds a proof that the machine is in fact finite.
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Oct 28, 2021
@digama0 digama0 added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Oct 28, 2021
@gebner
Copy link
Member

gebner commented Oct 28, 2021

This was already looking good the last time.

bors d+

@bors
Copy link

bors bot commented Oct 28, 2021

✌️ digama0 can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@gebner
Copy link
Member

gebner commented Oct 28, 2021

bors r+

@github-actions github-actions bot added delegated The PR author may merge after reviewing final suggestions. ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Oct 28, 2021
bors bot pushed a commit that referenced this pull request Oct 28, 2021
The proof in this file was incomplete, and I finally found the time to
finish it. `tm_to_partrec.lean` constructs a turing machine that can
simulate a given partial recursive function. Previously, the functional
correctness of this machine was proven, but it uses an infinite state
space so it is not a priori obvious that it is in fact a true (finite)
turing machine, which is important for the Church-Turing theorem. This
PR adds a proof that the machine is in fact finite.
@bors
Copy link

bors bot commented Oct 28, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(computability/tm_to_partrec): prove finiteness [Merged by Bors] - feat(computability/tm_to_partrec): prove finiteness Oct 28, 2021
@bors bors bot closed this Oct 28, 2021
@bors bors bot deleted the tm_partrec branch October 28, 2021 18:57
ericrbg pushed a commit that referenced this pull request Nov 9, 2021
The proof in this file was incomplete, and I finally found the time to
finish it. `tm_to_partrec.lean` constructs a turing machine that can
simulate a given partial recursive function. Previously, the functional
correctness of this machine was proven, but it uses an infinite state
space so it is not a priori obvious that it is in fact a true (finite)
turing machine, which is important for the Church-Turing theorem. This
PR adds a proof that the machine is in fact finite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions. ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants