Stream: General

Topic: Cook Levin library


view this post on Zulip Craig Alan Feinstein (Jun 15 2025 at 17:05):

I’ve been trying to use AI to prove a simple theorem using the Cook Levin library - if a Turing machine outputs a certain bit at a certain location, then the Turing machine must read that bit. Chat GPT and Claude AI haven’t been able to do it. Anyone know how to do this?

view this post on Zulip Yiran Duan (Jun 18 2025 at 11:29):

Hi,

I'm interested in your question as well, and just to check whether I've understood it correctly: I can prove the following lemma by simp, is it somewhat relevant to what you are proving?

lemma "|.| (act (w, Stay) tape) = w"
  by simp

view this post on Zulip Craig Alan Feinstein (Jun 20 2025 at 01:54):

Yiran, the way I understand that statement, it means "If you write symbol w to a tape without moving the head, then reading from the tape returns w". When I asked my question, I meant if the Turing machine outputs w, then beforehand it must have read bit w. To give an idea of what I had in mind, I would like to use this to prove in Isabelle that if a Turing machine take the OR function of n bits and all n bits are zero, then the Turing machine must read all of the bits beforehand.

view this post on Zulip Yiran Duan (Jun 21 2025 at 22:31):

Thank you for explaning it again! So is it something like the following (I randomly chose some tm_copy_paste as an example)?

lemma aux:
  assumes "t < 10"
  shows "fst (execute tm_copy_paste start_cfg t) = 0 ∧
         (execute tm_copy_paste start_cfg t) <#> 0 = t"

Here's more details including my definition for tm_copy_paste and start_cfg, where I managed to prove this lemma above in my awkward way.

Scratch.thy

edit: provide a name for the lemma

view this post on Zulip Yiran Duan (Jun 21 2025 at 22:54):

Lemma aux is much stronger than (what I understood from) your statement, but I guess it provides a way to easily prove your goal. However if the ultimate goal is to prove that the turing machine terminates with some results, I think there might be better ways without having to prove such intermediate lemmas explicitly (but that's beyond my current experience with the Cook_Levin entry; I would be happy if I get the chance to learn about it in this discussion)

view this post on Zulip Craig Alan Feinstein (Jun 22 2025 at 09:43):

Yiran, It isn’t exactly what I was thinking, but it probably will be helpful. My question seems conceptually easy and obvious at first, but I couldn’t get ai to do it and it isn’t always true. What if Turing machine M prints out bit x? Then one might think M has to read bit x. But then what if it is mathematically provable that another bit y equals bit x. Then the Turing machine doesn’t have to read bit x. It could just read bit y and print it out. So there have to be extra assumptions.

view this post on Zulip Craig Alan Feinstein (Jun 22 2025 at 20:12):

Yiran, to give a better example of what I have in mind, suppose you want to determine whether there exists a nonzero x such that given square matrix A, Ax=0, where A and x are composed of zeroes and ones and we are using mod 2 arithmetic. You don’t have to check all possibilities for x to get the answer. You can do Gaussian elimination on A to see if it is non singular. In other words if you consider a bit y for each x as to whether Ax = 0 and take the or operators of these bits y you get the answer, but you don’t have to do it this way and in fact it is better that you don’t do it this way. This is why you need extra assumptions for what I’m trying to do in Isabelle to work, namely that there are no other ways of formulating the problem other than taking the or operator. Does this make sense?

view this post on Zulip Craig Alan Feinstein (Jun 23 2025 at 01:45):

Also, look up “adversary argument” as this is the type of argument that is necessary for this to work.

view this post on Zulip Craig Alan Feinstein (Jun 24 2025 at 01:24):

Another problem I just realized is that to output bit x, a Turing machine can read not x. So technically the Turing machine doesn’t have to read bit x.

view this post on Zulip Craig Alan Feinstein (Jun 24 2025 at 01:57):

But I think the assertion is correct in spirit.

view this post on Zulip Craig Alan Feinstein (Jun 27 2025 at 20:18):

A better way of phrasing it - before a Turing machine outputs bit x, it must “know” what bit x is. Similar to before a person speaks, he has to know what he is going to say.


Last updated: Jun 30 2025 at 01:55 UTC