语义计算
A few months ago, I published an article about an obscure mathematical concept which can be used to describe high-level semantic information. The gist is that certain algebraic structures (particularly the free commutative magma) can represent any discrete high-level semantic concept using an arbitrary reference frame of initial concepts. This model leads to a unique programming paradigm and file format detailed in this Medium article and Google Colab notebook:
几个月前,我发表了一篇有关模糊数学概念的文章,该数学概念可用于描述高级语义信息。 要点是,某些代数结构(尤其是自由交换岩浆 )可以使用初始概念的任意参考框架表示任何离散的高级语义概念。 此模型导致独特的编程范例和文件格式,在这篇中型文章和Google Colab笔记本中有详细介绍:
After thinking some more about this topic, I realized that a similar concept emerges in the mathematical model of quantum computing. While this explanation will require some prior knowledge of linear algebra and quantum mechanics, I will do my best to explain this in a way that can be vaguely understood by everyone.
在对这个话题进行了更多思考之后,我意识到在量子计算的数学模型中也出现了类似的概念。 尽管这种解释需要线性代数和量子力学的一些先验知识,但我将尽我所能地以每个人都可以理解的方式进行解释。
Any classical and quantum algorithm can be represented via a matrix M which maps some given input state x to a corresponding output y, represented by the equation y = Mx. The key difference between computing models can be seen in the limitations of the matrices and vectors.
任何经典算法和量子算法都可以通过矩阵M表示,矩阵M将某些给定的输入状态x映射到相应的输出y ,由等式y = Mx表示 。 计算模型之间的关键区别可以从矩阵和向量的局限性中看出。
Classical computers require M to be a logical matrix and impart a one-hot restriction on x and y. For instance, the number 3 can be represented as [00010000…] (three zeros and then one 1). For clarity, we can drop trailing zeros, e.g. [0001…] = 3.
古典计算机要求M为逻辑矩阵 ,并对x和y施加一重限制。 例如,数字3可以表示为[00010000…] (三个零然后一个1)。 为了清楚起见,我们可以删除尾随的零,例如[0001…] = 3 。
Notice that this model represents zero as [10…] and one as [01…]. In bra-ket notation, this is usually written as |0⟩ = [10] and |1⟩ = [01]. From here, we can find the physical binary representation by thinking of x as the Kronecker product of the binary representation of the number.
注意,该模型将零表示为[10…] ,将一个表示为[01…] 。 用括弧 表示法 ,通常写为|0⟩= [10]和|1⟩= [01] 。 从这里,我们可以通过将x视为数字的二进制表示形式的Kronecker乘积来找到物理二进制表示形式。
The number 6 is 110 in binary, which is written as |0⟩ ⊗|1⟩ ⊗|1⟩ or more concisely |011⟩. The order of the bits is flipped because our vector [0000001…] begins from the left rather than the right like typical counting numbers.
数字6是二进制形式的110 ,它写成|0⟩ |1⟩ |1⟩或更简而言|011⟩ 。 因为我们的向量[0000001…]从左开始而不是像典型的计数数字一样从右开始,所以位的顺序被翻转。
0 │0⟩ │0⟩ │0⟩ │0⟩ ...
1 │1⟩ │0⟩ │0⟩ │0⟩ ...
2 │0⟩ │1⟩ │0⟩ │0⟩ ...
3 │1⟩ │1⟩ │0⟩ │0⟩ ...
4 │0⟩ │0⟩ │1⟩ │0⟩ ...
5 │1⟩ │0⟩ │1⟩ │0⟩ ...
6 │0⟩ │1⟩ │1⟩ │0⟩ ...
7 │1⟩ │1⟩ │1⟩ │0⟩ ...
8 │0⟩ │0⟩ │0⟩ │1⟩ ...
9 │1⟩ │0⟩ │0⟩ │1⟩ ...
While this is quite a complex way to think about algorithms, it lays the groundwork for understanding the logic of both quantum computing and semantic polymorphism.
尽管这是一种考虑算法的复杂方法,但它为理解量子计算和语义多态性的逻辑奠定了基础。
Unlike their classical counterparts, quantum computers are able to work with any combination of numbers simultaneously and in specific proportions via quantum superposition. In other words, it is possible to run algorithms on a wave function of bit configurations, each with a rotation-like phase and relative magnitude. The catch is that while x is far more flexible, M must be a unitary matrix and y can only be measured indirectly based on the probability distribution generated by the algorithm.
与经典计算机不同,量子计算机能够通过量子叠加以特定比例同时处理数字的任何组合。 换句话说,可以对位配置的波动函数运行算法,每个位配置都具有类似旋转的相位和相对大小。 问题是,尽管x灵活得多,但M必须是一个ary矩阵,而y只能根据算法生成的概率分布间接测量。
If you are looking for ways to better understand this computational model, I highly recommend Michael Nelsen’s Quantum Computing for the Determined YouTube series:
如果您正在寻找更好地理解这种计算模型的方法,我强烈建议Michael Nelsen的“确定的 YouTube”系列的“ 量子计算 ”:
Now is where things begin to get interesting for those already familiar with the above topics. The vectors |0⟩ and |1⟩ form a basis in a two-dimensional space, and each Kronecker product doubles the number of dimensions in the system. As such, we end up with a countably infinite dimensionality.
现在对于已经熟悉上述主题的人来说,事情开始变得有趣起来。 向量|0⟩和|1⟩在二维空间中形成基础 ,并且每个Kronecker乘积使系统中的维数加倍。 这样,我们最终得到了无限的维度。
The key concept that fascinates me is the ability to reinterpret each dimension as an entirely different chain of Kronecker products. By abstracting away the underlying architecture of bits or qubits, we can, for example, relabel the entire system using a three-dimensional basis of |0⟩, |1⟩, and |2⟩.
使我着迷的关键概念是能够将每个维度重新解释为完全不同的Kronecker产品链。 通过抽象化位或量子位的基础架构,例如,我们可以使用|0⟩ , |1⟩的三维基础重新标记整个系统。 和|2⟩ 。
Natural numbers reinterpreted as a ternary tree. 自然数重新解释为三叉树。0 │0⟩ │0⟩ │0⟩ ...
1 │1⟩ │0⟩ │0⟩ ...
2 │2⟩ │0⟩ │0⟩ ...
3 │0⟩ │1⟩ │0⟩ ...
4 │1⟩ │1⟩ │0⟩ ...
5 │2⟩ │1⟩ │0⟩ ...
6 │0⟩ │2⟩ │0⟩ ...
7 │1⟩ │2⟩ │0⟩ ...
8 │2⟩ │2⟩ │0⟩ ...
9 │0⟩ │0⟩ │1⟩ ...
In this sense, we can easily “simulate” any other basis simply by using a different numerical base for our vector indices. This concept has significant potential for discovering new quantum algorithms and languages.
从这个意义上讲,我们可以简单地通过对向量索引使用不同的数字基础来“模拟”任何其他基础。 这个概念对于发现新的量子算法和语言具有巨大的潜力。
Since the quantum computing ecosystem has not yet reached this level of abstraction, I made an experimental language designed around reinterpreting the dimensions of quantum systems. You can learn more by browsing the GitHub repository, skimming this article, or running the online examples.
由于量子计算生态系统尚未达到这种抽象水平,因此我设计了一种实验语言,旨在重新解释量子系统的维度。 您可以通过浏览GitHub存储库 ,浏览本文或运行在线示例来了解更多信息 。
FunQy :: High-Level Quantum Computing FunQy ::高级量子计算Let’s take this a step further. Since we can choose any interpretation of the space, it is possible to represent increasingly unusual structures.
让我们更进一步。 由于我们可以选择对空间的任何解释,因此有可能代表越来越不寻常的结构。
Natural numbers as a free commutative submagma. 自然数作为自由的可交换子岩浆。These systems can be simulated by one another by choosing a one-to-one mapping between states. In these examples, we use the natural numbers to define an arbitrary total order for each system. In practical situations, one might derive a total order based on the physical location of each qudit in the architecture.
通过选择状态之间的一对一映射,可以相互模拟这些系统。 在这些示例中,我们使用自然数为每个系统定义任意总顺序 。 在实际情况下,可能会基于体系结构中每个Qudit的物理位置来得出总顺序。
In essence, this layout is the semantic “file format” described in the previously mentioned notebook. We can now move on to explore how a sense of logical polymorphism emerges from this structure.
本质上,此布局是前面提到的笔记本中描述的语义“文件格式”。 现在,我们可以继续探索如何从这种结构中产生一种逻辑多态性。
As a brief recap of the relevant information in the notebook, it is possible to use the counting system shown above to recursively define concepts using a discrete semantic basis. Inspired by RDF and Hexastore, the system is designed for semantic representation and querying. Instead of using the slightly anthropocentric notion of subject-verb-object triples, we focus on a general formulation which corresponds to an infinite undirected recursively defined graph. In doing so, a “query” directly corresponds to an algorithm derived from the abstract high-level interpretation of a given model.
作为笔记本中相关信息的简要概述,可以使用上面显示的计数系统使用离散语义基础来递归定义概念。 受RDF和Hexastore的启发,该系统旨在进行语义表示和查询。 而不是使用主语-动词-宾语三元组的稍微以人为中心的概念,我们将重点放在对应于无限无向递归定义图的一般表述上。 在这种情况下,“查询”直接对应于从给定模型的抽象高级解释中得出的算法。
It turns out that in a quantum context, semantic models show some fascinating and useful behavior. Typically, given an initial state and a set of rules, one may continue to expand the state to encompass the full logical implications of the system. However, upon introducing the ability to superpose states and rules, the model generates a probability distribution as though each rule operated on all possible logical structures. Likewise, phase shifting can be used to distinguish between different types of logical outcomes. For instance, an input concept which uses the complex unit vector i
can be interpreted as “this concept is definitely outside of the model.” After applying quantum phase estimation, one can identify the extent to which a statement is expected to be within the model assuming unknown as the default conclusion.
事实证明,在量子上下文中,语义模型显示出一些有趣而有用的行为。 通常,在给定初始状态和一组规则的情况下,可以继续扩展状态以涵盖系统的全部逻辑含义。 但是,一旦引入了叠加状态和规则的能力,该模型就会生成概率分布,就好像每个规则都在所有可能的逻辑结构上进行操作一样。 同样, 相移可用于区分不同类型的逻辑结果。 例如,使用复数单位向量i
的输入概念可以解释为“此概念肯定在模型之外。” 在应用了量子相位估计之后 ,人们可以在未知的假设为默认结论的情况下,确定陈述在模型中的预期程度。
TLDR: you can interpret quantum superposition as a probability distribution of logical assertions. Likewise, you can use the phase of a quantum state to distinguish between two types of conclusions, such as “known to be true” and “known to be false” assuming unknown for everything else.
TLDR :您可以将量子叠加解释为逻辑断言的概率分布。 同样,您可以使用量子态的相位来区分两种类型的结论,例如“已知为真”和“已知为假”,并假设其他所有条件均未知。
In summary, it’s possible to design more intuitive quantum algorithms by relabeling the individual states of a quantum system, and this approach is ideal for expressing higher-order logic and semantic information.
总而言之,可以通过重新标记量子系统的各个状态来设计更直观的量子算法,并且该方法非常适合表示高阶逻辑和语义信息。
I hope that this article has given you some ideas and inspiration for your next project.
我希望本文能为您的下一个项目提供一些想法和启发。
Cheers!
干杯!
翻译自: https://medium.com/@ryanvandersmith/how-semantic-polymorphism-works-in-quantum-computing-65949e1ce6c5
语义计算