ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

[转载] Is my cat Turing-complete?(我的猫猫图灵完备吗?)

2021-12-18 13:34:42  阅读:255  来源: 互联网

标签:complete her Turing cat Peluche memory


作者: Chloé Lourseyre
编辑: Peter Fordham
许可: CC-BY 4.0
原文: https://belaycpp.com/2021/11/24/is-my-cat-turing-complete/

Is my cat Turing-complete?

NOVEMBER 24, 2021CHLOÉ `SENUA` LOURSEYRE

This article is an adaptation of a Lightning Talk I gave at CppCon2021. A link to the video will be given here as soon as it’s available.
I'll touch on a lighter subject this week, nonetheless quite important: is my cat Turing-complete?

Meet Peluche

Peluche (meaning “plush” in French) is a smooth cat that somehow lives in my house.

She will be our test subject today.

Is Peluche Turing-complete?

What is Turing-completeness

Turing-completeness is the notion that if a device can emulate a Turing machine, then it can perform any kind of computation1.
It means that any machine that implements the eight following instructions is a computer (and can thus execute any kind of computation):

  • . and , : Inputting and outputting a value
  • + and - : Increase and decrease the value contained in a memory cell2.
  • > and < : Shift the current memory tape left or right.
  • [ and ] : Performing loops.

So, if Peluche can perform these eight instructions, we can consider her Turing-complete.

Proof of the Turing-completeness

Input and output

First, I tried to poke Peluche if I could get a reaction.

She looked at me, then just turned around.

So here it is: I poked her, and I got a reaction. So she can process inputs and give outputs.
Input/output confirmed!

Increase and decrease memory value

The other day, I came back from work to this:

Kibbles everywhere;
But then I took a closer look and realized that the slabs could be numbered, like this:

This looks pretty much like a memory tape to me! Since she can spill kibbles on the tiles and then eat them directly from the floor, she can increase and decrease the values contained in a given memory cell.
Increase/decrease confirmed!

Shift the current memory cell left or right

Another time, I was doing the dishes and inadvertently spilled some water on Peluche. She began to run everywhere around the kitchen, making a huge mess.

If you look close (at the tip of the red arrow), you may notice that while making this mess, she displaced her bowl.
Displacing her bowl means she will spill her kibbles in another tile. This counts as shifting the memory head to edit another memory cell.
Shift of the memory tape confirmed!

Perform loops

So, after this mess, I (obviously) had to clean up.
No more than five minutes later, I went back to the kitchen to this:

Yeah… she can DEFINITELY perform loops…
Loops confirmed!
We have just proven that Peluche is, indeed, Turing-complete. So now, how can we use her to perform high-performance computations?

What to do with her?

Now that I’ve proven that Peluche is Turing-complete, I can literally do anything with her!
Thus, I tried to give her simple code to execute3:

标签:complete,her,Turing,cat,Peluche,memory
来源: https://www.cnblogs.com/winterreisender/p/15704824.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有