奎因莫克拉斯基方法

The “Beyond the Source Code” series of posts will explore source code beyond its use as a set of instructions that direct a process or set of processes. We will dive in topics such as readability, metaprogramming, quines, and many other topics that look at source code in a different light. The motivation for this series comes from the idea of making source code work for developers, rather than the developers having to work against the source code.

“超越源代码”系列文章将探讨源代码,而不是将其用作指导一个过程或一组过程的指令集。 我们将探讨诸如可读性,元编程,quines之类的主题,以及许多其他以不同的眼光看待源代码的主题。 本系列的动机来自使开发人员可以使用源代码的想法,而不是开发人员必须对源代码进行工作。

In the previous article we dove into readability and understanding of source code, with a focus on self-documenting code, comments, and documentation automation.

在上一篇文章中,我们着重于对源代码的可读性和理解,重点是自文档代码,注释和文档自动化。

In this post, we will be exploring quines and self-replication. Quines are curious little programs that perform a single function — taking no input and only outputting a copy of themselves. They are an interesting topic of computer science as they have both philosophical and biological underpinnings. To understand quines, let’s take a step back and look at the concept of self-replicating programs and machines.

在这篇文章中,我们将探索奎因和自我复制。 Quines是执行单个功能的好奇小程序-不输入任何内容,仅输出其自身的副本。 它们是计算机科学的一个有趣主题,因为它们具有哲学和生物学基础。 要了解奎恩,让我们退后一步,看看自我复制程序和机器的概念。

我恐惧的世界 (A World I Fear)

A world I fear is one in which the following two statements hold true:

我担心的世界是以下两个说法正确的世界:

  1. The artificial intelligence (AI) singularity has happened, or the point when artificial intelligence matches that of humans.人工智能(AI)的奇异性已经发生,也就是人工智能与人类相匹配的时刻。
  2. 3D printers who are capable of the above intelligence, and have the capability of producing other 3D printers.具有上述能力并具有生产其他3D打印机的能力的3D打印机。

If these two statements were to be true, we would have self-aware machines capable of producing other self-aware machines, similar to human reproduction. Even worse, human reproduction requires the interaction between two individuals, while a self-replicating and self-aware 3D printer could be completely autonomous and independent. A self-replicating machine would create a far-greater rate of exponential population growth than the rate at which humans reproduce since a single machine could recreate infinite number of copies. Couple this with machine-to-machine communication networks capable of high-speed throughput, massive amounts of data available on the internet, and our reliance on machines and you have a recipe for disaster.

如果这两个陈述是正确的,我们将拥有能够产生其他类似于人类繁殖的自我意识机器的自我意识机器。 更糟糕的是,人类复制需要两个人之间的互动,而具有自我复制和自我意识的3D打印机可能是完全自主和独立的。 由于一台机器可以复制无限数量的副本,因此自动复制机将创造比人类繁殖更高的指数种群增长速度。 将此与具有高速吞吐能力的机器对机器通信网络,互联网上可用的大量数据以及我们对机器的依赖相结合,您会遭受灾难。

Luckily, machines don’t hold a candle to human intelligence (yet) and 3D printers are still relatively simplistic in their capabilities.

幸运的是,机器还没有吸引到人类的智慧,而且3D打印机的功能仍然相对简单。

自我复制 (Self-Reproduction)

Self-reproducing machines and programs have been theorized since the beginning of computer science and programming. John Von Neumann in the 1940s, without the use of a computer, designed the first known example of self-reproducing automata. Automata are programs or machines that act independently based on a set of internal rules and external stimuli. The word “automata” comes from the Greek word αὐτόματα, meaning “self-making.”

自计算机科学和程序设计开始以来,自我复制的机器和程序已得到理论化。 1940年代,约翰·冯·诺依曼(John Von Neumann)在没有使用计算机的情况下,设计了第一个已知的自我复制自动机示例 自动机是根据一组内部规则和外部刺激独立运行的程序或机器。 “自动机”一词来自希腊文αὐτόματα,意为“自我创造”。

This first example is known as Von Neumann’s “Universal Constructor.”

第一个示例称为冯·诺依曼(Von Neumann)的“通用构造函数”。

Original automaton: Renato Nobili and Umberto Pesavento
原始自动机:Renato Nobili和Umberto Pesavento

The Universal Constructor utilized the concept of cellular automata, which are grid-like maps of independent automata, or cells, that have a finite number of states and interact with each other. Capable of reproducing itself ad infinitum, the Universal Constructor had three components that lends to its reproductive behavior:

通用构造函数利用了细胞自动机的概念,它是独立自动机或单元格的网格状图,具有有限数量的状态并且彼此交互。 通用构造函数能够无限制地进行自我复制,它具有三个有助于其生殖行为的成分:

  • A description for the machine, that defines a program capable of self-replication.对机器的描述,它定义了能够自我复制的程序。
  • The “Universal Constructor” itself that can read any description and construct the program it defines.“通用构造函数”本身可以读取任何描述并构造其定义的程序。
  • A “Universal Copy” machine that is able to copy any description that it reads一台“通用复制”机器,能够复制其读取的任何描述

Given these components, it can be seen how the recursive self-reproducing behavior is created. A program is created with all of the above components, it’s description is copied using the Universal Copier, and the Universal Constructor reads the description copy and builds another one. Rinse and repeat, and you end up with an army of self-reproducing cellular automata capable of producing their own armies of cellular automata. Scary to think, these self-reproducing programs were designed in the 1940s, 44 years before the release of the first Terminator and the idea of Skynet. Even more so, a few years before the first digital computer, the ENIAC.

给定这些组件,可以看出如何创建递归自重生成行为。 将使用上述所有组件创建一个程序,使用通用复印机复制其描述,然后通用构造函数读取该描述副本并构建另一个。 冲洗并重复,您最终会得到一群能够自我复制的自动机,能够产生自己的自动机大军。 令人难以置信的是,这些自我复制程序是在1940年代设计的,即第一个终结者和天网的发布之前的44年。 更是如此,比第一台数字计算机ENIAC早了几年。

Interested to read more about the Universal Constructor? Here is a paper on it.

有兴趣阅读有关通用构造函数的更多信息吗? 这是一张纸。

奎因 (Quines)

Quines operate in the same context of self-reproducing automata, but are quite simpler. Similar to the three components that a Universal Constructor is comprised of, a Quine is made up of a program capable of outputting data (a Constructor and Copier of sorts), and a representation of the source code as data (the Description). Quines have a strict rule of not reading a copy of its own source code or requiring any input, and any quine that does so is known as a “cheating quine.” An example of a quine in Python (3.X) can be seen below:

奎因在自我复制自动机的相同上下文中运行,但非常简单。 与通用构造器所组成的三个组件相似,Quine由能够输出数据的程序(某种构造器和复印机)以及将源代码表示为数据(说明)组成。 Quines有严格的规则,不得读取其自身源代码的副本或需要任何输入,任何这样做的quine被称为“作弊quine”。 以下是Python(3.X)中的Quine的示例:

_='_=%r;print (_%%_)';print%_)

Notice the information density and size of this program — not a single smidgen of syntax goes to waste. Yet, this program does something philosophically remarkable. It is able to self-replicate and indirectly reference itself.

注意该程序的信息密度和大小-不会浪费任何语法。 但是,该程序在哲学上做得很出色。 它能够自我复制并间接引用自身。

Quines are a wonderful study into the world of metaprogramming, and what source code is capable of beyond being an instruction set for a process. Given the challenge of optimizing information density, programmers will often compete in a style of programming known as “code golf” to create the shortest possible quines with the least amount of code. These compact lilliputian programs carry much more weight from a theoretical perspective than they do in purpose and looks.

Quines是对元编程世界的一次精彩研究,而源代码除了可以作为过程的指令集之外,还能提供哪些源代码。 面对优化信息密度的挑战,程序员通常会以一种称为“代码高尔夫”的编程方式竞争以用最少的代码创建尽可能短的quines。 从理论上讲,这些紧凑的小人国节目具有比目标和外观更大的影响力。

The idea of being able to recreate self-replicating behavior in the smallest form possible is analogous to concepts in biology and “meaning of life” philosophical studies. Biologists have studied microscopic organisms capable of reproduction to understand life at the smallest scales, and philosophers continuously research the far corners of logic and understanding to understand the purpose of life. In fact, the concept of Quines was not discovered by a computer scientist, but derived from the work of a philosopher.

能够以最小的形式重现自我复制行为的想法类似于生物学和“生命的意义”哲学研究中的概念。 生物学家研究了能够繁殖的微观有机体,以最小的尺度了解生命,而哲学家不断研究逻辑和理解的各个角落,以理解生命的目的。 实际上,Quines的概念并不是由计算机科学家发现的,而是源于哲学家的工作。

威拉德·范·奥曼·奎因 (Willard Van Orman Quine)

Willard Van Orman Quine was an American philosopher in the 20th century best known for his work in logic and set theory. His work on the idea of “indirect self-reference” is essentially recursion from a philosophical point of view, or an object referring to itself indirectly. Quine demonstrated indirect self-reference with the following paradox:

威拉德·范·奥曼·奎因( Willard Van Orman Quine)是20世纪的美国哲学家,以其逻辑和集合论的研究而闻名。 他关于“间接自我指称”的工作本质上是从哲学角度出发的递归,或者是一个间接指称自己的客体。 Quine表现出间接的自我参照,存在以下悖论:

“yields falsehood when preceded by its quotation” yields falsehood when preceded by its quotation.

“在引用之前产生虚假”在引用之前产生虚假。

This became known as Quine’s paradox, and is the reason for the curious little programs’ name and origin.

这被称为Quine的悖论,并且是奇怪的小程序的名称和起源的原因。

An easier to understand example of indirect self-reference can be seen in the following sentence from this Wikipedia page.

在此Wikipedia页面的以下句子中,可以看到一个更容易理解的间接自引用示例。

"Is a sentence fragment" is a sentence fragment.

“是一个句子片段”是一个句子片段。

  • The quoted sentence itself is a sentence fragment.引用的句子本身是一个句子片段。
  • The self-reference identifies the preceding quotation as a sentence fragment.自引用将前面的引号标识为句子片段。
  • The full sentence itself is grammatically and syntactically correct in the English language.完整句子本身在英语上在语法和语法上都是正确的。

Isn’t it interesting how source code can go beyond the concepts of computer science and programming, and be used as reflections on philosophy and logic?

源代码如何超越计算机科学和编程的概念,并用作对哲学和逻辑的反思,这不是很有趣吗?

Taking the idea of self-replicating or self-referencing behavior, how can this be seen in computer programs today?

以自我复制或自我引用行为的想法,如何在当今的计算机程序中看到这一点?

蠕虫 (Worms)

We started off this article with a musing about a scary topic (end of the world caused by machines), so lets end with another one. A worm is a type of malware that seeks to infect as many computers as possible through self-replication. Often targeting a weak host on a network, a worm will then use its first host to spread to others in the same network. Due to the exponential growth that programs are capable of achieving when undergoing self-replication, worms are extremely dangerous and will usually damage entire networks rather than a single machine.

我们从对一个可怕的话题(由机器引起的世界末日)的沉思开始了这篇文章,因此让我们结束另一个话题。 蠕虫是一种恶意软件,它试图通过自我复制来感染尽可能多的计算机。 蠕虫通常针对网络上的弱主机,然后会使用其第一台主机传播到同一网络中的其他主机。 由于程序在进行自我复制时能够实现指数级增长,因此蠕虫非常危险,通常会损坏整个网络,而不是单个计算机。

An interesting example of a self-replicating worm is the Stuxnet worm of 2010. Designed to target industrial control systems (SCADA, supervisory control and data acquisition systems), Stuxnet is the likely culprit for causing a lot of damage to Iran’s nuclear program. As a worm, Stuxnet was capable of infinite replication to targeted host systems, and was therefore extremely difficult to stop and quarantine. Starting from an engineer’s computer, the worm quickly spread through centrifuges and industrial equipment, continuously replicating and causing damage along the way.

自复制蠕虫的一个有趣例子是2010年的Stuxnet蠕虫。Stuxnet旨在针对工业控制系统(SCADA,监督控制和数据采集系统),可能是对伊朗核计划造成重大损害的罪魁祸首。 作为蠕虫,Stuxnet能够无限复制到目标主机系统,因此极难停止和隔离。 该蠕虫从工程师的计算机开始,Swift在离心机和工业设备中传播,不断复制并造成破坏。

The concepts first visited in this article of machine takeovers and program replication start to become very real when worms are specifically designed to target industrial equipment and factory controls. This is where the line between the virtual and physical worlds really start to become blurred, when self-replicating non-tangible programs start to wreak havoc on physical world systems.

当蠕虫专门针对工业设备和工厂控制而设计时,在本文中机器访问和程序复制中首次访问的概念就变得非常现实。 当自我复制的非有形程序开始对物理世界系统造成严重破坏时,虚拟世界和物理世界之间的界限实际上开始变得模糊。

Let’s hope that self-replicating programs and behavior stay confined to the seemingly benign world of quines and universal constructors for years to come.

让我们希望,在以后的几年中,自我复制程序和行为将始终局限于看似良性的奎因和通用构造函数的世界。

翻译自: https://medium.com/@riptidedata/beyond-the-source-code-quines-and-self-replication-fab3e000696c

奎因莫克拉斯基方法


http://www.taodudu.cc/news/show-4484460.html

相关文章:

  • Paper:《The Illustrated Word2vec》翻译与解读
  • Mathematics for Computer Science 2
  • hdoj 2199 Can you solve this equation? 【二分枚举】
  • 六级真题单词
  • 【C/C++】从API学习STL algorithm 001(for_each、find、find_if、find_end、find_first_of 快到碗里来(◕ᴗ◕✿)
  • Falsehoods Programmers Believe About Names
  • 每个程序员都应该知道的那些事儿
  • CTF---Web入门第九题 FALSE
  • CTF-实验吧-FALSE
  • 五月单向历-
  • 盘点不可忽视的14家大数据创业公司
  • 推荐十三本书,附豆瓣评分
  • 分享2019年陆陆续续读过的书-附书单
  • 单片机测钳形电流表_钳形电流表,什么是钳形电流表,钳形电流表介绍--电子百科词库--科通芯城,IC及其他电子元器件交易型电商平台100%正品保证...
  • 淘淘商城第86讲——实现商品详情页面静态化方案时,你没遇到过java.lang.IllegalArgumentException或者java.lang.NullPointerException这种异常
  • 【编程】shell和python实现:如何做到让一个程序每1秒去做一件事情
  • 6-3 单链表结点删除 (20分)
  • 首届河南青少年读书成才奖颁发决定
  • 何志强:张尚昀式的当代好青年
  • 第三次作业吖
  • 从零开始学习Java设计模式 | 创建型模式篇:原型模式
  • 中国欲量产AI人才,本科招生爆发后如何培养?
  • 《智能控制导论》读书报告(课程作业)--常规控制的智能化
  • 从零开始学习Java设计模式 | 设计模式入门篇:设计模式概述
  • java 夏丽昀
  • PMP报考流程?
  • 考PMP必须参加培训吗?自己可以考吗?
  • PMP报考一定要报培训班吗?
  • php 生成vbs文件,用VBS实现PHP的md5_file函数代码
  • 菜刀

奎因莫克拉斯基方法_超越源代码奎因和自我复制相关推荐

  1. 数字电路:奎因·麦克拉斯基(Quine-McCluskey method)算法的Python实现

    感谢@xbaiseng提出了代码中存在的bug,笔者对有bug部分进行了修改. 对于四个变量及以下的组合电路最小化,我们一般采用卡诺图的方式(K-Map)进行化简.但对于四个变量以上的电路(或逻辑表达 ...

  2. 数字电路:奎因-麦克拉斯基算法

    在之前,我们使用卡诺图来找到一个系统的布尔表达式,但这只适用于变量较少的情况,如果遇见大量的变量,使用卡诺图化简的方式就会变得非常复杂,之前从四个变量升到五个变量就使得卡诺图多了整整一层,难以想象继续 ...

  3. 代码可读性_超越了源代码的可读性和理解

    代码可读性 The "Beyond the Source Code" series of posts will explore source code beyond its use ...

  4. python:实现奎因-麦克拉斯基算法(附完整源码)

    python:实现奎因-麦克拉斯基算法 from __future__ import annotationsfrom collections.abc import Sequencedef compar ...

  5. 变压器耦合和电容耦合_超越变压器和抱抱面的分类

    变压器耦合和电容耦合 In this post, I plan to explore aspects of cutting edge architectures in NLP like BERT/Tr ...

  6. java闹钟程序设计_JAVA课程设计_闹钟的设计与实现项目-报告_附源代码.doc

    JAVA课程设计_闹钟的设计与实现项目-报告_附源代码 第2章 MACROBUTTON AcceptAllChangesInDoc [双击此处键入1级标题] PAGE 2 - PAGE 1 - .. ...

  7. mockito mock void方法_一文让你快速上手 Mockito 单元测试框架(上)

    作者|mghio 编辑|包包 前言  在计算机编程中,单元测试是一种软件测试方法,通过该方法可以测试源代码的各个单元功能是否适合使用.为代码编写单元测试有很多好处,包括可以及早的发现代码错误,促进更改 ...

  8. Linux打开rtf文档,在linux下设置开机自动启动程序的方法_精品.rtf

    您所在位置:网站首页 > 海量文档 &nbsp>&nbsp计算机&nbsp>&nbsplinux/Unix相关 在linux下设置开机自动启动程序的方 ...

  9. w3c的ajax操作函数,关于ajax的使用方法_例题、ajax的数据处理

    AJAX 的 关于ajax的使用方法_例题.ajax的数据处理 需要注意的是,调用的封装的数据库,和jQuery的保存地址 一.注册 (1)写文本框来进行用户名的验证 //这个使用来显示提示信息的 ( ...

最新文章

  1. 2022-2028年中国手机配件行业发展前景战略及投资风险预测分析报告
  2. MySQL安装ODBC驱动出现126错误
  3. leetcode算法题--完美数
  4. 【朝夕技术专刊】Core3.1WebApi_Filter详解
  5. 怎么在mysql中打开表存信息,我应该如何存储用户的“收藏夹”在mySQL表?
  6. python那些事儿编程技巧_python一些编程技巧(持续更新)
  7. python选择某一行_Python常用语法有哪些 如何快速入门Python开发
  8. 玖云个人导航API工具网站源码
  9. oracle报表范例1 (转载)
  10. 固件是通用的吗_冷镦和冷挤压是一回事吗,两者有什么区别?
  11. 百度地图定位SDK 之构想
  12. R语言空间插值的几种方法及案例应用
  13. 【LaTex编译遇到问题】!pdfTeX error: pdflatex (file simhei.ttf): cannot open TrueType font file for reading
  14. log4j配置文件(详细)
  15. 扫盲 BT Sync——不仅是同步利器,而且是【分布式】网盘
  16. 面试之springboot是什么?
  17. Windows上必备的7个国产小众软件,每一个都是良心推荐,建议常备使用哦。
  18. 2017年个人目标及计划
  19. JAVA POI删除word里面的批注comment
  20. Access数据库教程_如何进行C#连接Access数据库的细节操作?

热门文章

  1. Image Segmentation Using Deep Learning: A Survery
  2. 稀疏矩阵的存储方法(DOK、LIL、COO、CSR, CRS)
  3. atm机存款场景图_怎么在自动存款机上存款?有图具体步骤的更好?
  4. 【2020 ACM Fellow 华人学者】 吕晨阳 圣路易斯华盛顿大学
  5. java课程设计qq_Java课程设计(qq聊天程序)
  6. laya air 碰撞事件 和 重力设置
  7. wxX11移植到arm板上
  8. weblogic BEA-170011
  9. Unity 物体自发光
  10. 老虎过河编程java_2017年拓展游戏《老虎过河》