Discussion:
Looking for a "Turing Machine" interpreter
(too old to reply)
Jeff Barnett
2020-09-07 21:41:52 UTC
Permalink
I'm looking for a LISP program that takes as input the symbolic
definition of a Turing Machine and a datum representing the initial tape
contents. It then emulates that machine on its input for a while and
either detects a halt or asks, after a specified number of steps,
whether to continue. The state the machine is in and the current
contents of the tape and where the "head" is at are made available in
after both a halt or popup.

I prefer code in Common Lisp and has very little extra baggage so that
the interpretation code is very transparent. I have no interest in
extensive interface and statistic collection.

Any pointers to LISP source code that at least loosely fits the above
description is most appreciated.
--
Jeff Barnett
Stefan Monnier
2020-09-07 22:17:14 UTC
Permalink
I'm looking for a LISP program that takes as input the symbolic definition
of a Turing Machine and a datum representing the initial tape contents.
Since I don't think there's a sufficiently standard definition of
"Turing Machine", I'd choose one that's easier to implement in Common
Lisp, so I'd do:

(defun my-tm-interpreter (input-data)
(eval input-data))

You can find an extensive documentation of the form of the input-data
accepted by this Turing Machine interpreter at your local CLHS.


Stefan
Jeff Barnett
2020-09-08 03:29:58 UTC
Permalink
Post by Stefan Monnier
I'm looking for a LISP program that takes as input the symbolic definition
of a Turing Machine and a datum representing the initial tape contents.
Since I don't think there's a sufficiently standard definition of
"Turing Machine", I'd choose one that's easier to implement in Common
(defun my-tm-interpreter (input-data)
(eval input-data))
You can find an extensive documentation of the form of the input-data
accepted by this Turing Machine interpreter at your local CLHS.
Thanks but no thanks. I know there are several formats for a TM
specification, all more or less equally useful. I actually hope to find
what I originally ask for. I'm sure that code exits so I'm trying to
avoid working.
--
Jeff Barnett
Madhu
2020-09-08 04:10:49 UTC
Permalink
Post by Jeff Barnett
I'm looking for a LISP program that takes as input the symbolic
definition of a Turing Machine and a datum representing the initial
tape contents. It then emulates that machine on its input for a while
and either detects a halt or asks, after a specified number of steps,
whether to continue. The state the machine is in and the current
contents of the tape and where the "head" is at are made available in
after both a halt or popup.
I prefer code in Common Lisp and has very little extra baggage so that
the interpretation code is very transparent. I have no interest in
extensive interface and statistic collection.
Any pointers to LISP source code that at least loosely fits the above
description is most appreciated.
These are the first few hits I got from google

https://github.com/fmdkdd/turisp (CL)

http://www.lysator.liu.se/~davidk/elisp/turing.el (GNU ELISP)

https://github.com/dieggsy/turing-machine (GNU ELISP + GNU emacs interface)

There are 100s of "Turing machine" projects on github. a few of those
are curated under https://github.com/topics/turing-machine
but i didn't spot any lisp ones on the first page.
smh
2020-09-08 09:56:21 UTC
Permalink
Years ago I wrote a Turing emulator as a demo in/of CLIM. The demo animated the tape and transitions of the the FSM, which the Turing programmer provided as a state transition table. The CLIM animation part was a lot easier to write than the Turing FSM itself, but I did code a unary multiply and even a working factorial.

These days the animation would better be done in some more current and supported user interface platform, but the Turing implementation would be salvageable. The hard part is coding and debugging the FSMs which are coded as 2-dimension arrays.

I've put the code on google drive:

https://drive.google.com/file/d/1DUCuwaVR5ElQSD8poKfxRXmmLjNprkJF/view?usp=sharing
Madhu
2020-09-08 14:27:17 UTC
Permalink
Post by smh
Years ago I wrote a Turing emulator as a demo in/of CLIM. The demo
animated the tape and transitions of the the FSM, which the Turing
programmer provided as a state transition table. The CLIM animation
part was a lot easier to write than the Turing FSM itself, but I did
code a unary multiply and even a working factorial.
These days the animation would better be done in some more current and
supported user interface platform, but the Turing implementation would
be salvageable. The hard part is coding and debugging the FSMs which
are coded as 2-dimension arrays.
https://drive.google.com/file/d/1DUCuwaVR5ElQSD8poKfxRXmmLjNprkJF/view?usp=sharing
Are you sure you want to make the Original Poster accept the Terms of
Service and Privacy Policies of Google and to be wittingly or
unwittingly subject to their agenda just in order to be access your
code? Are you really morally comfortable with that?
Samuel W. Flint
2020-09-08 12:59:09 UTC
Permalink
JB> I'm looking for a LISP program that takes as input the symbolic
JB> definition of a Turing Machine and a datum representing the
JB> initial tape contents. It then emulates that machine on its
JB> input for a while and either detects a halt or asks, after a
JB> specified number of steps, whether to continue. The state the
JB> machine is in and the current contents of the tape and where the
JB> "head" is at are made available in after both a halt or popup.

What symbolic representation? What representation of data?

Because, tbqh, this sounds like a homework assignment I did a couple of
years ago (though everyone else did theirs in Java or Python). So,
assuming you use a sufficiently simple representation, you should be
able to implement this fairly easily.

JB> I prefer code in Common Lisp and has very little extra baggage
JB> so that the interpretation code is very transparent. I have no
JB> interest in extensive interface and statistic collection.

JB> Any pointers to LISP source code that at least loosely fits the
JB> above description is most appreciated. -- Jeff Barnett

Sam
--
Samuel W. Flint
4096R/FA13D704
(F50D 862B 4F65 5943 A8C2 EF0E 86C9 3E7A FA13 D704)
Jeff Barnett
2020-09-08 17:04:47 UTC
Permalink
Post by Samuel W. Flint
JB> I'm looking for a LISP program that takes as input the symbolic
JB> definition of a Turing Machine and a datum representing the
JB> initial tape contents. It then emulates that machine on its
JB> input for a while and either detects a halt or asks, after a
JB> specified number of steps, whether to continue. The state the
JB> machine is in and the current contents of the tape and where the
JB> "head" is at are made available in after both a halt or popup.
What symbolic representation? What representation of data?
Because, tbqh, this sounds like a homework assignment I did a couple of
years ago (though everyone else did theirs in Java or Python). So,
assuming you use a sufficiently simple representation, you should be
able to implement this fairly easily.
Not a homework problem. However, I know it should be straightforward but
I do not have a Lisp on my computer at the moment. I used Franz for
years but got tired of the cost. There is an idiot (maybe a troll) in
some of the other newsgroups that is trying to write an x86 emulator
with an extended memory model so he can use it as a UTM. He wants to
demonstrate a working halt decider and has been at it for a long time. I
thought I might send a list of simple Lisp programs available on the web
so he can cut the BS.
--
Jeff Barnett
Stefan Monnier
2020-09-08 19:46:01 UTC
Permalink
memory model so he can use it as a UTM. He wants to demonstrate a working
halt decider and has been at it for a long time. I thought I might send
a list of simple Lisp programs available on the web so he can cut the BS.
I'd be very surprised if it cuts the BS. I think it'll instead prove
him right (in his opinion). It's like cults that predict the end of
the world.

IOW you're just wasting your time,


Stefan
Paul Rubin
2020-09-08 23:46:46 UTC
Permalink
wants to demonstrate a working halt decider and has been at it for a
long time. I thought I might send a list of simple Lisp programs
available on the web so he can cut the BS.
No need for something that complicated. Find a simple program that
searches for a counterexample to Goldbach's conjecture, and ask him if
it halts.

Extra credit: ask if his halt decider can also decide the Twin Prime
conjecture (answer: it can't, if it is just a pure halt decider).
Madhu
2020-09-09 01:34:56 UTC
Permalink
Post by Paul Rubin
wants to demonstrate a working halt decider and has been at it for a
long time. I thought I might send a list of simple Lisp programs
available on the web so he can cut the BS.
No need for something that complicated. Find a simple program that
searches for a counterexample to Goldbach's conjecture, and ask him if
it halts.
Extra credit: ask if his halt decider can also decide the Twin Prime
conjecture (answer: it can't, if it is just a pure halt decider).
I assumed Jeff was asking for the edification of a much younger
generation. His goal is while noble but perhaps may still be somewhat
noble.

However I doubt the truth of the halting problem can be illustrated
through a tape TM simulator. The construction of the diagonal has to be
understood mathematically. But once that has been understood by NN I do
not see the reason to deride NN with righteous "perpetual machine
skepticism" - there may yet be an interesting class of programs for
which his halt decider may work. This is CS after all and the bread and
butter of funding that i've seen has been on research on solvable cases
Paul Rubin
2020-09-09 02:28:19 UTC
Permalink
Post by Madhu
However I doubt the truth of the halting problem can be illustrated
through a tape TM simulator. The construction of the diagonal has to be
understood mathematically.
How about with a poem?

http://www.lel.ed.ac.uk/~gpullum/loopsnoop.html
none) (albert
2020-09-09 07:58:26 UTC
Permalink
Post by Madhu
Post by Paul Rubin
wants to demonstrate a working halt decider and has been at it for a
long time. I thought I might send a list of simple Lisp programs
available on the web so he can cut the BS.
No need for something that complicated. Find a simple program that
searches for a counterexample to Goldbach's conjecture, and ask him if
it halts.
Extra credit: ask if his halt decider can also decide the Twin Prime
conjecture (answer: it can't, if it is just a pure halt decider).
I assumed Jeff was asking for the edification of a much younger
generation. His goal is while noble but perhaps may still be somewhat
noble.
However I doubt the truth of the halting problem can be illustrated
through a tape TM simulator. The construction of the diagonal has to be
understood mathematically. But once that has been understood by NN I do
not see the reason to deride NN with righteous "perpetual machine
skepticism" - there may yet be an interesting class of programs for
which his halt decider may work. This is CS after all and the bread and
butter of funding that i've seen has been on research on solvable cases
An interesting take on this would be :
- suppose there is a counter example to the hail storm problem to be
found. N <-3N+1 We think there isn't, but maybe there is.
- suppose there is a terminating criterion found that is (sometimes)
more efficient than actually running a program.
- then such a program could actually solve a math problem

Finding out that a particular program halts would do nothing
for the halting problem though.

Groetjes Albert
--
This is the first day of the end of your life.
It may not kill you, but it does make your weaker.
If you can't beat them, too bad.
***@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Ben Bacarisse
2020-09-09 03:14:27 UTC
Permalink
Post by Paul Rubin
wants to demonstrate a working halt decider and has been at it for a
long time. I thought I might send a list of simple Lisp programs
available on the web so he can cut the BS.
No need for something that complicated. Find a simple program that
searches for a counterexample to Goldbach's conjecture, and ask him if
it halts.
I doubt that would ruffle a true crank's feathers. They might report:

$ decide goldbach
Loading program "goldbach".
Analysing...
Estimated time to decide: 478 years.
Working...

As it happens, the person in question does not claim to have a halt
decider (as you and I would use the term). They claim to have a
program, P, that can decide hating for just one specific case. Nothing
to see here, you might think, except that one case is the machine
designed to make P wrong.
--
Ben.
Tom Russ
2020-09-09 00:59:22 UTC
Permalink
Post by Jeff Barnett
There is an idiot (maybe a troll) in
some of the other newsgroups that is trying to write an x86 emulator
with an extended memory model so he can use it as a UTM. He wants to
demonstrate a working halt decider and has been at it for a long time. I
thought I might send a list of simple Lisp programs available on the web
so he can cut the BS.
Unlikely.
The best advice is "What to do when the trisector comes"
https://www.researchgate.net/publication/225381383_What_to_do_when_the_trisector_comes
Post by Jeff Barnett
--
Jeff Barnett
Jeff Barnett
2020-09-09 16:45:49 UTC
Permalink
Post by Tom Russ
Post by Jeff Barnett
There is an idiot (maybe a troll) in
some of the other newsgroups that is trying to write an x86 emulator
with an extended memory model so he can use it as a UTM. He wants to
demonstrate a working halt decider and has been at it for a long time. I
thought I might send a list of simple Lisp programs available on the web
so he can cut the BS.
Unlikely.
The best advice is "What to do when the trisector comes"
https://www.researchgate.net/publication/225381383_What_to_do_when_the_trisector_comes
I have that book! I tried unsuccessfully to track Dudley down. I wanted
to encourage him to do another book on internet cranks and offer to help
gather raw material. He would be in his mid 80's now and I could not
determine even if he was still alive. Perhaps Ben or someone else with
an interest will write that book.
--
Jeff Barnett
Ben Bacarisse
2020-09-09 22:43:04 UTC
Permalink
<cut>
Post by Jeff Barnett
Post by Tom Russ
The best advice is "What to do when the trisector comes"
https://www.researchgate.net/publication/225381383_What_to_do_when_the_trisector_comes
I have that book! I tried unsuccessfully to track Dudley down. I
wanted to encourage him to do another book on internet cranks and
offer to help gather raw material. He would be in his mid 80's now and
I could not determine even if he was still alive.
(I thought the book was called "The Trisectors" and "What to do when the
trisector comes" was the original paper in The Mathematical Intelligencer.)

It's a lovely paper, but from another era. The thing I remember most is
how quaint and polite it all was. Letters exchanged between professors
and retired admirals or deacons; that sort of thing. Widely publicised
meant writing to 100 people.

One curious difference (which may simply be down to what groups I read)
is that the modern targets are Turing, Gödel and Cantor, rather than
trisection, cube doubling and Fermat.

But the characterisation of the people who do this sort of thing remains
spot-on and I would be fascinated to know what Underwood Dudley would
think of the interactive Internet version of this phenomenon.
Post by Jeff Barnett
Perhaps Ben or
someone else with an interest will write that book.
Oh dear me no. I have experience of only a few and, sad to say, do not
follow what I know to be good advice. I see the interaction as a kind
of entertainment, an attitude that is both unproductive and morally
suspect. Every now and then I resolve that, if I reply at all, it will
be with a simple "there is a well-studied theorem that says that you are
mistaken", but the successful Internet cranks and the ones that have
discovered the right replies to goad people into engaging.
--
Ben.
Graham Cooper
2020-09-10 12:34:39 UTC
Permalink
Turing Machine is pretty EASY!

I wrote one in JAVASCRIPT once, here is a START





inittape 1

YES



91 inittape 1
N=1
inittape 1

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 2
N=2
inittape 2

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 3
N=3
inittape 3

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 4
N=4
inittape 4

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 5
N=5
inittape 5

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 6
N=6
inittape 6

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 7
N=7
inittape 7

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 8
N=8
inittape 8

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 9
N=9
inittape 9

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 10
N=10
inittape 10

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 11
N=11
inittape 11

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 12
N=12
inittape 12

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 13
N=13
inittape 13

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 14
N=14
inittape 14

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 15
N=15
inittape 15

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 16
N=16
inittape 16

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 17
N=17
inittape 17

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 18
N=18
inittape 18

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 5 inittape N
91 inittape 19
N=19
inittape 19

91 1 assert tape N 0
91 2 add N N 1
91 3 if
91 4 bigger 20 N
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif
91 6 endif



1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0




list tape

YES



5 list tape
E=tape
list tape

5 1 E F G H I J K L
375 tape F G H
F=1
G=0
H=
I=
tape 1 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
376 tape F G H
F=2
G=0
H=
I=
tape 2 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
377 tape F G H
F=3
G=0
H=
I=
tape 3 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
378 tape F G H
F=4
G=0
H=
I=
tape 4 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
379 tape F G H
F=5
G=0
H=
I=
tape 5 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
380 tape F G H
F=6
G=0
H=
I=
tape 6 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
381 tape F G H
F=7
G=0
H=
I=
tape 7 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
382 tape F G H
F=8
G=0
H=
I=
tape 8 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
383 tape F G H
F=9
G=0
H=
I=
tape 9 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
384 tape F G H
F=10
G=0
H=
I=
tape 10 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
385 tape F G H
F=11
G=0
H=
I=
tape 11 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
386 tape F G H
F=12
G=0
H=
I=
tape 12 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
387 tape F G H
F=13
G=0
H=
I=
tape 13 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
388 tape F G H
F=14
G=0
H=
I=
tape 14 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
389 tape F G H
F=15
G=0
H=
I=
tape 15 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
390 tape F G H
F=16
G=0
H=
I=
tape 16 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
391 tape F G H
F=17
G=0
H=
I=
tape 17 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
392 tape F G H
F=18
G=0
H=
I=
tape 18 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L
393 tape F G H
F=19
G=0
H=
I=
tape 19 0

5 2 print F
5 3 print G
5 4 print H
5 5 print I
5 6 print J
5 7 print K
5 8 print L
5 9 echo newline
5 10 clear F
5 11 clear G
5 12 clear H
5 13 clear I
5 14 clear J
5 15 clear K
5 16 clear L
5 17 next
5 18 list E
5 list tape
E=tape
list tape

5 1 E F G H I J K L



It takes 3 TABLES

tape 1 1
tape 2 0
tape 3 0

state 1 r 0 2 l 0 2
state 2 r 1 2 l 1 2

pointer 1



Try coding it at miniBASE.com !


*********************** CODE ************************

inittape N
-assert tape N 0
-add N N 1
-if
-bigger 20 N
-inittape N
-endif
Graham Cooper
2020-09-10 13:10:34 UTC
Permalink
Here is a picture of the TURING MACHINE TAPE !



Loading Image...
Zyni Moë
2020-09-08 15:59:10 UTC
Permalink
Post by Jeff Barnett
Any pointers to LISP source code that at least loosely fits the above
description is most appreciated.
Is terribly easy to write this. Here is one I have, rather too
complicated, not very finished but can work.

https://ln.sync.com/dl/5a02647d0/75mxr3ta-n9ymydu2-su64kn7p-wdjtzb4p

This link will go away in month or so.
--
the small snake
Jeff Barnett
2020-09-08 20:52:45 UTC
Permalink
I'm looking for a LISP program  that takes as input the symbolic
definition of a Turing Machine and a datum representing the initial tape
contents. It then emulates that machine on its input for a while and
either detects a halt or asks, after a specified number of steps,
whether to continue. The state the machine is in and the current
contents of the tape and where the "head" is at are made available in
after both a halt or popup.
I prefer code in Common Lisp and has very little extra baggage so that
the interpretation code is very transparent. I have no interest in
extensive interface and statistic collection.
Any pointers to LISP source code that at least loosely fits the above
description is most appreciated.
Thanks to everyone who took the time to reply.
--
Jeff Barnett
luserdroog
2020-09-10 21:40:03 UTC
Permalink
Post by Jeff Barnett
I'm looking for a LISP program that takes as input the symbolic
definition of a Turing Machine and a datum representing the initial tape
contents. It then emulates that machine on its input for a while and
either detects a halt or asks, after a specified number of steps,
whether to continue. The state the machine is in and the current
contents of the tape and where the "head" is at are made available in
after both a halt or popup.
I prefer code in Common Lisp and has very little extra baggage so that
the interpretation code is very transparent. I have no interest in
extensive interface and statistic collection.
Any pointers to LISP source code that at least loosely fits the above
description is most appreciated.
There was a challenge a few years ago on code golf.
https://codegolf.stackexchange.com/questions/8787/2381/turing-machine-simulator/

No lisp solution yet, but I'm sure one would be welcome.

Loading...