Transformers are Inherently Succinct | AGIDaily
AGI Daily
资讯日报词条论文人物新创
返回论文列表
摘要1 引言贡献。结构安排。2 预备知识2.1 线性时序逻辑例 1。2.2 带掩码的唯一硬注意力 Transformer注 2。注意力层。ReLU 层。Transformer。UHAT 接受的语言。2.3 布尔 RASP逐位置运算。注意力运算。2.4 循环神经网络(RNN)命题 3。2.5 大小度量与简洁性3 通过非空性问题看最短见证的大小例 4。定理 5。命题 6。命题 7。命题 8。证明概要。引理 9。推论 10。命题 11。证明。命题 12。推论 13。4 相对于其他语言表示的简洁性定理 14。证明。命题 15。证明概要。定理 16。推论 17。5 应用定理 18。证明。6 结束语相关工作。未来工作。致谢参考文献附录 A 第 3 节的证明A.1 命题 6 的证明A.2 引理 9 的证明A.3 命题 12 的证明
返回论文列表
目录

Transformers are Inherently Succinct

收录于 ICLR 2026 Outstanding Paper被引 3 次
打开论文来源

Transformers are Inherently Succinct

Transformer 天生具备简洁性

Pascal Bergsträßer Affiliation:  RPTU Kaiserslautern-Landau Affiliation:  Kaiserslautern, Germany Email:  bergstraesser@cs.uni-kl.de    Ryan Cotterell Affiliation:  ETH Zürich Affiliation:  Zürich, Switzerland Email:  ryan.cotterell@inf.ethz.ch    Anthony W. Lin Affiliation:  RPTU Kaiserslautern-Landau and MPI-SWS Affiliation:  Kaiserslautern, Germany Email:  lin@cs.uni-kl.de

Abstract

摘要

We propose succinctness as a measure of the expressive power of a transformer in describing a concept. To this end, we prove that transformers are highly expressive in that they can represent formal languages substantially more succinctly than standard representations of formal languages like finite automata and Linear Temporal Logic (LTL) formulas. As a by-product of this expressivity, we show that verifying properties of transformers is provably intractable (i.e. EXPSPACE-complete).

我们把简洁性(succinctness)当作衡量 Transformer 表达力的尺度。为此我们证明:Transformer 的表达力很强,描述形式语言时可以比有限自动机和线性时序逻辑(LTL)公式这类标准表示简洁得多。作为这种表达力的副产品,我们证明验证 Transformer 的性质是可证明难解的(即 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-完全)。

1 Introduction

1 引言

Transformers (Vaswani et al. 2017) are the underlying model behind the recent success of Large Language Models (LLMs). The past few years saw a large amount of theoretical development explaining the expressive power of transformers (Strobl et al. 2024; Barceló et al. 2024; Yang et al. 2024; Hahn 2020; Pérez et al. 2021; Chiang & Cholak 2022; Jerad et al. 2025), their trainability and length generalizability (Zhou et al. 2024; Huang et al. 2025; Chiang & Cholak 2022), and the extent to which one can formally verify them (Sälzer et al. 2025). Interestingly, it is known that transformers with fixed (finite) precision (Yang et al. 2024; Barceló et al. 2024; Jerad et al. 2025; Li & Cotterell 2025) recognize a well-known subclass of regular languages called star-free languages. Fixed-precision transformers are especially pertinent to real-world transformers, which are implemented on hardware with fixed (finite) precision.

Transformer(Vaswani et al. 2017)是近年大语言模型(LLM)成功背后的基础模型。过去几年里,大量理论研究解释了 Transformer 的表达力(Strobl et al. 2024;Barceló et al. 2024;Yang et al. 2024;Hahn 2020;Pérez et al. 2021;Chiang & Cholak 2022;Jerad et al. 2025),它们的可训练性与长度泛化(Zhou et al. 2024;Huang et al. 2025;Chiang & Cholak 2022),以及在多大程度上可以对其做形式化验证(Sälzer et al. 2025)。一个有趣的事实是:固定(有限)精度的 Transformer(Yang et al. 2024;Barceló et al. 2024;Jerad et al. 2025;Li & Cotterell 2025)认出的是正则语言里一类著名的子类,即星自由语言(star-free languages)。固定精度的 Transformer 尤其贴近现实中的实现,因为真实硬件只用固定(有限)精度运算。

Star-free languages form a rather small subclass of regular languages. More precisely, a star-free regular expression allows the intersection and complementation operators instead of the Kleene star. For this reason, the regular language a∗b∗a^{*}b^{*}a∗b∗ is star-free because it can be defined as ∅ˉ.b.a.∅ˉ‾\overline{\bar{\emptyset}.b.a.\bar{\emptyset}}∅ˉ​.b.a.∅ˉ​​. On the other hand, it is known that regular languages like (aa)∗(aa)^{*}(aa)∗ are not star-free (cf. see (Straubing 1994)). This is in contrast to Recurrent Neural Networks (RNN), which can recognize all regular languages (Siegelmann & Sontag 1995; Merrill et al. 2020). Thus, expressivity as language recognizers per se is perhaps not the most useful criterion for an LLM architecture.

星自由语言只是正则语言里相当小的一块。更精确地说,星自由正则表达式用交与补取代克莱尼星号。因此正则语言 a∗b∗a^{*}b^{*}a∗b∗ 是星自由的,因为它可以写成 ∅ˉ.b.a.∅ˉ‾\overline{\bar{\emptyset}.b.a.\bar{\emptyset}}∅ˉ​.b.a.∅ˉ​​。另一方面,像 (aa)∗(aa)^{*}(aa)∗ 这样的正则语言已知不是星自由的(参见 Straubing 1994)。这与循环神经网络(RNN)形成对比:RNN 可以认出全部正则语言(Siegelmann & Sontag 1995;Merrill et al. 2020)。因此,单把“能充当怎样的语言识别器”当作标准,对 LLM 架构来说也许并不是最有用的尺度。

In this paper, we propose succinctness as an alternative angle in understanding the “expressivity” of transformers. More precisely, the succinctness of a language LLL with respect to a class C\mathcal{C}C of language recognizers (e.g. transformers, automata, etc.) measures the smallest (denotational) size of T∈CT\in\mathcal{C}T∈C that recognizes LLL, i.e., how many symbols are used to describe TTT. Succinctness has been studied in logic in computer science (e.g. (Grohe & Schweikardt 2004; Stockmeyer 1974)) as an alternative (and more computational) measure of expressiveness, and has direct consequence in how computationally difficult it is to analyze a certain expression. For example, Linear Temporal Logic (LTL) (Pnueli 1977) is expressively equivalent to star-free regular languages (e.g. see (Libkin 2004)), as well as a subclass of deterministic finite automata called counter-free automata (McNaughton & Papert 1971). Despite this, it is known that LTL can be exponentially more succinct than finite automata (Sistla & Clarke 1985). In other words, certain concepts can be described considerably more succinctly by LTL formulas as by finite automata. This has various consequences, e.g., analyzing LTL formulas (e.g. checking whether they describe a trivial concept) is provably computationally more difficult than analyzing finite automata (Sistla & Clarke 1985).

本文提出用简洁性作为理解 Transformer“表达力”的另一条路径。更精确地说,语言 LLL 相对于一类语言识别器 C\mathcal{C}C(例如 Transformer、自动机等)的简洁性,量的是认出 LLL 的最小(指称)大小,也就是描述 T∈CT\in\mathcal{C}T∈C 用了多少符号。简洁性在计算机科学的逻辑里已被研究过(例如 Grohe & Schweikardt 2004;Stockmeyer 1974),它是一种更偏计算的表达力尺度,并直接影响分析某个表达式有多难。例如,线性时序逻辑(LTL)(Pnueli 1977)在表达力上等价于星自由正则语言(参见 Libkin 2004),也等价于确定性有限自动机的一个子类,即无计数自动机(counter-free automata)(McNaughton & Papert 1971)。尽管如此,已知 LTL 可以比有限自动机指数级更简洁(Sistla & Clarke 1985)。换句话说,某些概念用 LTL 公式来写,可以比用有限自动机短得多。这会带来多种后果,例如分析 LTL 公式(比如判断它是否描述平凡概念)在计算上可证明比分析有限自动机更难(Sistla & Clarke 1985)。

Contributions.

Our main result can be summarized as follows:

贡献。

本文的主要结果可以概括如下:

Transformers can describe concepts extremely succinctly.

Transformer 能把概念写得极短。

More precisely, we show that transformers are exponentially more succinct than LTL and RNN (so including state-of-the-art State-Space Models (SSMs), e.g., see (Gu & Dao 2023; Merrill et al. 2024)), and doubly exponentially more succinct than finite automata. This means that, with the same descriptional size, transformers can encode complex patterns that require exponentially (resp. doubly exponentially) larger descriptional sizes for LTL and RNN (resp. automata). As a by-product of this expressivity, one may surmise that analyzing transformers must be computationally challenging. We show this to be the case. That is, verifying simple properties about transformers (e.g. whether it recognizes a trivial language) is computationally difficult: EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-complete. That is, with standard complexity-theoretic assumptions, this cannot be done in better than double exponential time.

更精确地说,我们证明 Transformer 比 LTL 和 RNN(因此也包括最先进的状态空间模型(SSM),例如参见 Gu & Dao 2023;Merrill et al. 2024)指数级更简洁,比有限自动机则双指数级更简洁。这意味着:在同样的描述大小下,Transformer 能编码的复杂模式,换成 LTL 和 RNN(或自动机)需要指数级(或双指数级)更大的描述。作为这种表达力的副产品,人们会猜想分析 Transformer 在计算上必然很有挑战。我们证明情况确实如此。也就是说,验证关于 Transformer 的简单性质(例如它是否认出平凡语言)在计算上是困难的:EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-完全。在标准复杂性假设下,这做不到比双指数时间更好。

In fact, we also show matching upper bound on the succinctness gap for LTL (exponential) and automata (double exponential). That is, we provide a translation from fixed-precision transformers to exponential-sized LTL formulas. This significantly improves the previously shown doubly exponential translation by Yang et al. 2024. As a consequence, for any fixed-precision transformer, there is an LTL formula (resp. finite automaton) of (doubly) exponential size recognizing the same language.

事实上,我们也为相对于 LTL(指数)和自动机(双指数)的简洁性间隙给出了匹配的上界。也就是说,我们给出从固定精度 Transformer 到指数大小 LTL 公式的翻译。这显著改进了 Yang et al. 2024 先前给出的双指数翻译。因此,对任意固定精度 Transformer,都存在认出同一语言、大小为(双)指数的 LTL 公式(或有限自动机)。

In proving our succinctness results, we show how transformers can count from 0 up to 22n2^{2^{n}}22n, i.e., the so-called “(doubly exponentially) large counters”. This requires a subtle encoding of large counters using attention. We then prove that the resulting languages using LTL and RNN (resp. finite automata) require exponentially (resp. doubly exponentially) larger description.

在证明简洁性结果的过程中,我们说明 Transformer 如何能从 0 数到 22n2^{2^{n}}22n,也就是所谓的“(双指数)大计数器”。这需要用注意力对大计数器做细致编码。随后我们证明,用 LTL 和 RNN(或有限自动机)表示由此得到的语言,需要指数级(或双指数级)更长的描述。

What assumptions do we use in our results? We assume that transformers and RNN are of a fixed (finite) precision. This assumption is faithful to real-world implementations, which use only fixed-precision arithmetics. We also use Unique-Hard Attention Transformers (UHAT), which are known to be expressively the weakest class of transformers (Hao et al. 2022), e.g., their languages are known to be in a very low complexity class AC0\text{AC}^{0}AC0, whereas other classes of transformers (e.g. average-hard attention or softmax) can recognize languages beyond AC0\text{AC}^{0}AC0 (e.g. majority). Additionally, UHATs have also been used as transformer models in theoretical works of transformers (cf. (Yang et al. 2024; Jerad et al. 2025; Strobl et al. 2024; Hao et al. 2022; Li & Cotterell 2025; Hahn 2020; Barceló et al. 2024; Bergsträßer et al. 2024)).

我们的结果用了哪些假设?我们假定 Transformer 和 RNN 都是固定(有限)精度的。这一假设忠实于现实实现,因为它们只用固定精度算术。我们还使用唯一硬注意力 Transformer(Unique-Hard Attention Transformers,UHAT),它已知是表达力最弱的一类 Transformer(Hao et al. 2022):其语言落在很低的复杂度类 AC0\text{AC}^{0}AC0 里,而其他类的 Transformer(例如平均硬注意力或 softmax)可以认出超出 AC0\text{AC}^{0}AC0 的语言(例如多数)。此外,UHAT 也已被用作 Transformer 理论工作中的模型(参见 Yang et al. 2024;Jerad et al. 2025;Strobl et al. 2024;Hao et al. 2022;Li & Cotterell 2025;Hahn 2020;Barceló et al. 2024;Bergsträßer et al. 2024)。

Organization.

We recall some formal concepts (transformers, automata, and logic) in Section 2. We show in Section 3 how transformers can encode an exponential tiling problem. We show in Section 4 how this implies succinctness of UHATs relative to other representations. Applications of our results for reasoning about transformers are discussed in Section 5. We conclude the paper in Section 6.

结构安排。

我们在第 2 节回顾一些形式概念(Transformer、自动机和逻辑)。我们在第 3 节说明 Transformer 如何编码一个指数铺砖问题。我们在第 4 节说明这如何蕴含 UHAT 相对于其他表示的简洁性。关于用这些结果推理 Transformer 的应用见第 5 节。我们在第 6 节结束全文。

2 Preliminaries

2 预备知识

We often denote vectors by boldface letters and for a vector v=(v1,…,vd)\bm{v}=(v_{1},\dots,v_{d})v=(v1​,…,vd​) we write v[i,j]:=(vi,…,vj)\bm{v}[i,j]:=(v_{i},\dots,v_{j})v[i,j]:=(vi​,…,vj​) for all 1≤i≤j≤d1\leq i\leq j\leq d1≤i≤j≤d and if i=ji=ji=j, we simply write v(i)\bm{v}(i)v(i). We also write n\bm{n}n for a number nnn to denote a vector (n,…,n)(n,\dots,n)(n,…,n) of appropriate dimension.

我们常用粗体字母表示向量;对向量 v=(v1,…,vd)\bm{v}=(v_{1},\dots,v_{d})v=(v1​,…,vd​),对所有 1≤i≤j≤d1\leq i\leq j\leq d1≤i≤j≤d 写 v[i,j]:=(vi,…,vj)\bm{v}[i,j]:=(v_{i},\dots,v_{j})v[i,j]:=(vi​,…,vj​);若 i=ji=ji=j,则简写为 v(i)\bm{v}(i)v(i)。我们也用粗体 n\bm{n}n 表示由数字 nnn 构成的、维数合适的常向量 (n,…,n)(n,\dots,n)(n,…,n)。

An alphabet is a finite set Σ\SigmaΣ of symbols (a.k.a. tokens). We write Σ∗\Sigma^{*}Σ∗ for the set of all words (a.k.a. sequences, strings) of the form a1…ana_{1}\dots a_{n}a1​…an​, where n≥0n\geq 0n≥0 and ai∈Σa_{i}\in\Sigmaai​∈Σ for all i∈[1,n]i\in[1,n]i∈[1,n]. A language is a subset L⊆Σ∗L\subseteq\Sigma^{*}L⊆Σ∗. We assume familiarity with basic concepts in formal language theory and complexity theory (see e.g. (Kozen 1997; Sipser 1997)). In particular, we will deal with finite automata. We will also use the following complexity classes:

字母表是由符号(也称token)组成的有限集 Σ\SigmaΣ。我们把形如 a1…ana_{1}\dots a_{n}a1​…an​ 的全部词(也称序列、字符串)记为 Σ∗\Sigma^{*}Σ∗,其中 n≥0n\geq 0n≥0 且对所有 i∈[1,n]i\in[1,n]i∈[1,n] 有 ai∈Σa_{i}\in\Sigmaai​∈Σ。语言是子集 L⊆Σ∗L\subseteq\Sigma^{*}L⊆Σ∗。我们假定读者熟悉形式语言理论与复杂性理论的基本概念(例如参见 Kozen 1997;Sipser 1997)。尤其会用到有限自动机。我们还会用到下列复杂性类:

P⊆NP⊆PSPACE⊆EXP⊆NEXP⊆EXPSPACE.{\mathsf{P}}\subseteq{\mathsf{NP}}\subseteq{\mathsf{PSPACE}}\subseteq{\mathsf{EXP}}\subseteq{\mathsf{NEXP}}\subseteq{\mathsf{EXPSPACE}}.P⊆NP⊆PSPACE⊆EXP⊆NEXP⊆EXPSPACE.

The complexity classes P{\mathsf{P}}P and NP{\mathsf{NP}}NP correspond to problems solvable in polynomial (resp. nondeterminsitic polynomial) time, and are well-known. The complexity classes EXP{\mathsf{EXP}}EXP and NEXP{\mathsf{NEXP}}NEXP are similar to P{\mathsf{P}}P and NP{\mathsf{NP}}NP, but we allow the algorithm to use exponential time. The complexity classes PSPACE{\mathsf{PSPACE}}PSPACE and EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE correspond to problems solvable in polynomial (resp. exponential) space. The above inclusions are well-known (cf. (Sipser 1997)).

复杂性类 P{\mathsf{P}}P 和 NP{\mathsf{NP}}NP 分别对应可在多项式时间(或非确定性多项式时间)内求解的问题,它们广为人知。复杂性类 EXP{\mathsf{EXP}}EXP 和 NEXP{\mathsf{NEXP}}NEXP 与 P{\mathsf{P}}P 和 NP{\mathsf{NP}}NP 类似,但允许算法使用指数时间。复杂性类 PSPACE{\mathsf{PSPACE}}PSPACE 和 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE 分别对应可在多项式空间(或指数空间)内求解的问题。上述包含关系是熟知的(参见 Sipser 1997)。

2.1 Linear Temporal Logic

2.1 线性时序逻辑

A formula in Linear Temporal Logic (LTL) over the finite alphabet Σ\SigmaΣ has the following syntax:

定义在有限字母表 Σ\SigmaΣ 上的线性时序逻辑(LTL)公式,语法如下:

φ::=⊤∣⊥∣Qa(for all a∈Σ)∣φ∧φ∣φ∨φ∣¬φ∣φSφ∣φUφ\varphi::=\top\mid\bot\mid Q_{a}(\text{for all }a\in\Sigma)\mid\varphi\wedge\varphi\mid\varphi\vee\varphi\mid\neg\varphi\mid\varphi\mathbin{\textbf{S}}\varphi\mid\varphi\mathbin{\textbf{U}}\varphiφ::=⊤∣⊥∣Qa​(for all a∈Σ)∣φ∧φ∣φ∨φ∣¬φ∣φSφ∣φUφ

We define satisfaction of an LTL formula φ\varphiφ on a word w=a1…an∈Σ∗w=a_{1}\dots a_{n}\in\Sigma^{*}w=a1​…an​∈Σ∗ at position i∈[1,n]i\in[1,n]i∈[1,n], written w,i⊨φw,i\models\varphiw,i⊨φ, inductively (omitting ⊤\top⊤ (true) and ⊥\bot⊥ (false)):

我们归纳定义 LTL 公式 φ\varphiφ 在词 w=a1…an∈Σ∗w=a_{1}\dots a_{n}\in\Sigma^{*}w=a1​…an​∈Σ∗ 的位置 i∈[1,n]i\in[1,n]i∈[1,n] 上成立,写作 w,i⊨φw,i\models\varphiw,i⊨φ(略去 ⊤\top⊤(真)和 ⊥\bot⊥(假)):

Moreover, we define the shortcuts

此外,我们定义以下缩写

Pφ:=⊤SφFφ:=⊤UφXφ:=⊥UφGφ:=φ∧¬F¬φ.\textbf{P}\varphi:=\top\mathbin{\textbf{S}}\varphi\qquad\textbf{F}\varphi:=\top\mathbin{\textbf{U}}\varphi\qquad\textbf{X}\varphi:=\bot\mathbin{\textbf{U}}\varphi\qquad\textbf{G}\varphi:=\varphi\wedge\neg\textbf{F}\neg\varphi.Pφ:=⊤SφFφ:=⊤UφXφ:=⊥UφGφ:=φ∧¬F¬φ.

An LTL formula recognizes the language L(φ)L(\varphi)L(φ) of all words w∈Σ∗w\in\Sigma^{*}w∈Σ∗ such that w,k⊨φw,k\models\varphiw,k⊨φ, where kkk is either 111 or ∣w∣|w|∣w∣ depending on whether the first or last position is regarded the output position of φ\varphiφ.

一个 LTL 公式认出语言 L(φ)L(\varphi)L(φ),它由所有满足 w,k⊨φw,k\models\varphiw,k⊨φ 的词 w∈Σ∗w\in\Sigma^{*}w∈Σ∗ 组成,其中 kkk 是 111 或 ∣w∣|w|∣w∣,取决于把第一个还是最后一个位置看作 φ\varphiφ 的输出位置。

Example 1.

The star-free language $(ab)^{}$ can be defined in LTL as*

例 1。

星自由语言 $(ab)^{}$ 可以用 LTL 定义为*

G(Qa→XQb)∧G(Qb∧X⊤→XQa).\textbf{G}(Q_{a}\to\textbf{X}Q_{b})\wedge\textbf{G}(Q_{b}\wedge\textbf{X}\top\to\textbf{X}Q_{a}).G(Qa​→XQb​)∧G(Qb​∧X⊤→XQa​).

In words, at any aaa-position, the next letter is bbb. At any bbb-position that has a successor, the next letter is aaa.

用话说:在任意 aaa-位置,下一个字母是 bbb。在任意有后继的 bbb-位置,下一个字母是 aaa。

2.2 Masked unique hard-attention transformers

2.2 带掩码的唯一硬注意力 Transformer

Let Σ\SigmaΣ be a finite alphabet of tokens. A token embedding is a function emb ⁣:Σ→Qd\mathit{emb}\colon\Sigma\to\mathbb{Q}^{d}emb:Σ→Qd for some d>0d>0d>0. A token embedding naturally extends to a homomorphism Σ∗→(Qd)∗\Sigma^{*}\to(\mathbb{Q}^{d})^{*}Σ∗→(Qd)∗, where emb(a1…an)=emb(a1)…emb(an)\mathit{emb}(a_{1}\dots a_{n})=\mathit{emb}(a_{1})\dots\mathit{emb}(a_{n})emb(a1​…an​)=emb(a1​)…emb(an​) for a1,…,an∈Σa_{1},\dots,a_{n}\in\Sigmaa1​,…,an​∈Σ.

设 Σ\SigmaΣ 是有限的 token 字母表。token 嵌入是某个 d>0d>0d>0 上的函数 emb ⁣:Σ→Qd\mathit{emb}\colon\Sigma\to\mathbb{Q}^{d}emb:Σ→Qd。token 嵌入自然地延拓成同态 Σ∗→(Qd)∗\Sigma^{*}\to(\mathbb{Q}^{d})^{*}Σ∗→(Qd)∗,其中对 a1,…,an∈Σa_{1},\dots,a_{n}\in\Sigmaa1​,…,an​∈Σ 有 emb(a1…an)=emb(a1)…emb(an)\mathit{emb}(a_{1}\dots a_{n})=\mathit{emb}(a_{1})\dots\mathit{emb}(a_{n})emb(a1​…an​)=emb(a1​)…emb(an​)。

Remark 2.

In the following we define transformers over arbitrary rational numbers since our upper bounds even hold in this setting. We remark that all of our results also hold for the special case of fixed-precision real numbers, i.e., with a constant number of bits for a fixed transformer regardless of the input length. In fact, the lower bounds already hold for integers of fixed precision.

注 2。

下文我们在任意有理数上定义 Transformer,因为我们的上界在这一设定下已经成立。我们指出,全部结果对固定精度实数这一特殊情形同样成立,也就是:对固定的 Transformer,无论输入多长,都只用常数个比特。事实上,下界在固定精度整数上已经成立。

Attention layer.

A masked unique hard-attention (UHA) layer of width r>0r>0r>0 is defined by

注意力层。

宽度为 r>0r>0r>0 的带掩码唯一硬注意力(UHA)层由以下对象定义:

  • • three affine transformations A,B ⁣:Qr→QrA,B\colon\mathbb{Q}^{r}\to\mathbb{Q}^{r}A,B:Qr→Qr and C ⁣:Q2r→QsC\colon\mathbb{Q}^{2r}\to\mathbb{Q}^{s}C:Q2r→Qs with rational valued coefficients (i.e., each is of the form Qx+bQ\bm{x}+\bm{b}Qx+b where matrix QQQ and vector b\bm{b}b have only rational entries),
  • • 三个仿射变换 A,B ⁣:Qr→QrA,B\colon\mathbb{Q}^{r}\to\mathbb{Q}^{r}A,B:Qr→Qr 和 C ⁣:Q2r→QsC\colon\mathbb{Q}^{2r}\to\mathbb{Q}^{s}C:Q2r→Qs,系数取有理值(即每一个都形如 Qx+bQ\bm{x}+\bm{b}Qx+b,其中矩阵 QQQ 和向量 b\bm{b}b 的条目都是有理数),
  • • a mask predicate M ⁣:N×N→{⊤,⊥}M\colon\mathbb{N}\times\mathbb{N}\to\{\top,\bot\}M:N×N→{⊤,⊥}, which is defined by M(i,j):=⊤M(i,j):=\topM(i,j):=⊤ (no masking), M(i,j):=(j<i)M(i,j):=(j<i)M(i,j):=(j<i) (strict future masking), or M(i,j):=(j>i)M(i,j):=(j>i)M(i,j):=(j>i) (strict past masking), and
  • • 一个掩码谓词 M ⁣:N×N→{⊤,⊥}M\colon\mathbb{N}\times\mathbb{N}\to\{\top,\bot\}M:N×N→{⊤,⊥},定义为 M(i,j):=⊤M(i,j):=\topM(i,j):=⊤(不掩码)、M(i,j):=(j<i)M(i,j):=(j<i)M(i,j):=(j<i)(严格未来掩码),或 M(i,j):=(j>i)M(i,j):=(j>i)M(i,j):=(j>i)(严格过去掩码),以及
  • • a tie-breaking function τ\tauτ selecting one element of a finite non-empty subset of N\mathbb{N}N, which is either defined as min⁡\minmin (leftmost tie-breaking) or max⁡\maxmax (rightmost tie-breaking).
  • • 一个平局打破函数 τ\tauτ,它从 N\mathbb{N}N 的非空有限子集中选出一个元素,定义为 min⁡\minmin(最左平局打破)或 max⁡\maxmax(最右平局打破)。

We now show how a UHA layer works on a sequence v1,…,vn∈Qr\bm{v}_{1},\dots,\bm{v}_{n}\in\mathbb{Q}^{r}v1​,…,vn​∈Qr with n≥1n\geq 1n≥1. The score function is defined as the dot product S(vi,vj):=⟨A(vi),B(vj)⟩S(\bm{v}_{i},\bm{v}_{j}):=\langle A(\bm{v}_{i}),B(\bm{v}_{j})\rangleS(vi​,vj​):=⟨A(vi​),B(vj​)⟩ for all i,j∈[1,n]i,j\in[1,n]i,j∈[1,n]. For i∈[1,n]i\in[1,n]i∈[1,n] let Ui:={j∈[1,n]∣M(i,j)}U_{i}:=\{j\in[1,n]\mid M(i,j)\}Ui​:={j∈[1,n]∣M(i,j)} be the set of unmasked positions and Bi:={j∈Ui∣∀j′∈Ui ⁣:S(vi,vj)≥S(vi,vj′)}B_{i}:=\{j\in U_{i}\mid\forall j^{\prime}\in U_{i}\colon S(\bm{v}_{i},\bm{v}_{j})\geq S(\bm{v}_{i},\bm{v}_{j^{\prime}})\}Bi​:={j∈Ui​∣∀j′∈Ui​:S(vi​,vj​)≥S(vi​,vj′​)} be the set of unmasked positions that maximize the score function. We define the attention vector at position i∈[1,n]i\in[1,n]i∈[1,n] as ai:=vτ(Bi)\bm{a}_{i}:=\bm{v}_{\tau(B_{i})}ai​:=vτ(Bi​)​ if Ui≠∅U_{i}\neq\emptysetUi​=∅ and ai:=0\bm{a}_{i}:=\bm{0}ai​:=0 otherwise. The layer outputs the sequence C(v1,a1),…,C(vn,an)C(\bm{v}_{1},\bm{a}_{1}),\dots,C(\bm{v}_{n},\bm{a}_{n})C(v1​,a1​),…,C(vn​,an​).

现在说明 UHA 层如何作用在序列 v1,…,vn∈Qr\bm{v}_{1},\dots,\bm{v}_{n}\in\mathbb{Q}^{r}v1​,…,vn​∈Qr(n≥1n\geq 1n≥1)上。分数函数定义为点积 S(vi,vj):=⟨A(vi),B(vj)⟩S(\bm{v}_{i},\bm{v}_{j}):=\langle A(\bm{v}_{i}),B(\bm{v}_{j})\rangleS(vi​,vj​):=⟨A(vi​),B(vj​)⟩,对所有 i,j∈[1,n]i,j\in[1,n]i,j∈[1,n]。对 i∈[1,n]i\in[1,n]i∈[1,n],令 Ui:={j∈[1,n]∣M(i,j)}U_{i}:=\{j\in[1,n]\mid M(i,j)\}Ui​:={j∈[1,n]∣M(i,j)} 为未掩码位置的集合,并令 Bi:={j∈Ui∣∀j′∈Ui ⁣:S(vi,vj)≥S(vi,vj′)}B_{i}:=\{j\in U_{i}\mid\forall j^{\prime}\in U_{i}\colon S(\bm{v}_{i},\bm{v}_{j})\geq S(\bm{v}_{i},\bm{v}_{j^{\prime}})\}Bi​:={j∈Ui​∣∀j′∈Ui​:S(vi​,vj​)≥S(vi​,vj′​)} 为使分数函数取最大的那些未掩码位置。我们把位置 i∈[1,n]i\in[1,n]i∈[1,n] 处的注意力向量定义为:若 Ui≠∅U_{i}\neq\emptysetUi​=∅ 则 ai:=vτ(Bi)\bm{a}_{i}:=\bm{v}_{\tau(B_{i})}ai​:=vτ(Bi​)​,否则 ai:=0\bm{a}_{i}:=\bm{0}ai​:=0。该层输出序列 C(v1,a1),…,C(vn,an)C(\bm{v}_{1},\bm{a}_{1}),\dots,C(\bm{v}_{n},\bm{a}_{n})C(v1​,a1​),…,C(vn​,an​)。

ReLU layer.

A ReLU layer of width r>0r>0r>0 on input v1,…,vn∈Qr\bm{v}_{1},\dots,\bm{v}_{n}\in\mathbb{Q}^{r}v1​,…,vn​∈Qr applies for some k∈[1,r]k\in[1,r]k∈[1,r] the ReLU function to the kkk-th coordinate of each vi\bm{v}_{i}vi​, i.e., it outputs the sequence v1′,…,vn′\bm{v}^{\prime}_{1},\dots,\bm{v}^{\prime}_{n}v1′​,…,vn′​ where vi′:=(vi[1,k−1],max⁡{0,vi(k)},vi[k+1,n])\bm{v}^{\prime}_{i}:=(\bm{v}_{i}[1,k-1],\max\{0,\bm{v}_{i}(k)\},\bm{v}_{i}[k+1,n])vi′​:=(vi​[1,k−1],max{0,vi​(k)},vi​[k+1,n]). [Equivalently, one could instead allow a feed-forward network at the end of an encoder layer (see (Hao et al. 2022; Barceló et al. 2024)).]

ReLU 层。

宽度为 r>0r>0r>0 的 ReLU 层在输入 v1,…,vn∈Qr\bm{v}_{1},\dots,\bm{v}_{n}\in\mathbb{Q}^{r}v1​,…,vn​∈Qr 上,对某个 k∈[1,r]k\in[1,r]k∈[1,r],把 ReLU 函数作用到每个 vi\bm{v}_{i}vi​ 的第 kkk 个坐标,即输出序列 v1′,…,vn′\bm{v}^{\prime}_{1},\dots,\bm{v}^{\prime}_{n}v1′​,…,vn′​,其中 vi′:=(vi[1,k−1],max⁡{0,vi(k)},vi[k+1,n])\bm{v}^{\prime}_{i}:=(\bm{v}_{i}[1,k-1],\max\{0,\bm{v}_{i}(k)\},\bm{v}_{i}[k+1,n])vi′​:=(vi​[1,k−1],max{0,vi​(k)},vi​[k+1,n])。[等价地,也可以在编码器层末尾允许一个前馈网络(参见 Hao et al. 2022;Barceló et al. 2024)。]

Transformer.

A masked unique hard-attention transformer (UHAT) is a length-preserving function T ⁣:Σ∗→(Qs)∗\mathcal{T}\colon\Sigma^{*}\to(\mathbb{Q}^{s})^{*}T:Σ∗→(Qs)∗ defined by application of a token embedding followed by application of a fixed sequence of UHA layers and ReLU layers of matching width.

Transformer。

带掩码的唯一硬注意力 Transformer(UHAT)是一个保长函数 T ⁣:Σ∗→(Qs)∗\mathcal{T}\colon\Sigma^{*}\to(\mathbb{Q}^{s})^{*}T:Σ∗→(Qs)∗,由先做 token 嵌入、再依次应用一串宽度匹配的 UHA 层和 ReLU 层来定义。

Languages accepted by UHATs.

To view a UHAT T ⁣:Σ∗→(Qs)∗\mathcal{T}\colon\Sigma^{*}\to(\mathbb{Q}^{s})^{*}T:Σ∗→(Qs)∗ as a language recognizer, we assume that T\mathcal{T}T is given together with an acceptance vector t∈Qs\bm{t}\in\mathbb{Q}^{s}t∈Qs. The recognized language L(T)L(\mathcal{T})L(T) is then the set of words on which T\mathcal{T}T outputs a sequence v1,…,vn∈Qs\bm{v}_{1},\dots,\bm{v}_{n}\in\mathbb{Q}^{s}v1​,…,vn​∈Qs with ⟨t,vk⟩>0\langle\bm{t},\bm{v}_{k}\rangle>0⟨t,vk​⟩>0, where k∈[1,n]k\in[1,n]k∈[1,n] is either 1 or nnn depending on whether the fist or last position is regarded the output position of T\mathcal{T}T.

UHAT 接受的语言。

要把 UHAT T ⁣:Σ∗→(Qs)∗\mathcal{T}\colon\Sigma^{*}\to(\mathbb{Q}^{s})^{*}T:Σ∗→(Qs)∗ 看成语言识别器,我们假定 T\mathcal{T}T 还配有一个接受向量 t∈Qs\bm{t}\in\mathbb{Q}^{s}t∈Qs。认出的语言 L(T)L(\mathcal{T})L(T) 就是那些使 T\mathcal{T}T 输出序列 v1,…,vn∈Qs\bm{v}_{1},\dots,\bm{v}_{n}\in\mathbb{Q}^{s}v1​,…,vn​∈Qs 且 ⟨t,vk⟩>0\langle\bm{t},\bm{v}_{k}\rangle>0⟨t,vk​⟩>0 的词,其中 k∈[1,n]k\in[1,n]k∈[1,n] 是 111 或 nnn,取决于把第一个还是最后一个位置看作 T\mathcal{T}T 的输出位置。

2.3 Boolean RASP

2.3 布尔 RASP

As an intermediate step to prove EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-hardness for UHATs, we use Boolean RASP (B-RASP) as introduced by Yang et al. 2024, who showed that B-RASP is expressively equivalent to UHATs. A B-RASP program is defined as follows. Let w=a1…an∈Σ∗w=a_{1}\dots a_{n}\in\Sigma^{*}w=a1​…an​∈Σ∗ with n≥1n\geq 1n≥1 be an input word. For every a∈Σa\in\Sigmaa∈Σ there is an initial Boolean vector Qa∈{0,1}nQ_{a}\in\{0,1\}^{n}Qa​∈{0,1}n with Qa(i)=1Q_{a}(i)=1Qa​(i)=1 iff ai=aa_{i}=aai​=a for all i∈[1,n]i\in[1,n]i∈[1,n]. We number the initial vectors and call them P1,…,P∣Σ∣P_{1},\dots,P_{|\Sigma|}P1​,…,P∣Σ∣​. We now describe how vector Pt+1P_{t+1}Pt+1​ can be defined from vectors P1,…,PtP_{1},\dots,P_{t}P1​,…,Pt​ for t≥∣Σ∣t\geq|\Sigma|t≥∣Σ∣.

作为证明 UHAT 的 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-困难性的中间步骤,我们使用 Yang et al. 2024 引入的布尔 RASP(B-RASP);他们证明 B-RASP 在表达力上等价于 UHAT。B-RASP 程序定义如下。设输入词为 w=a1…an∈Σ∗w=a_{1}\dots a_{n}\in\Sigma^{*}w=a1​…an​∈Σ∗ 且 n≥1n\geq 1n≥1。对每个 a∈Σa\in\Sigmaa∈Σ,都有一个初始布尔向量 Qa∈{0,1}nQ_{a}\in\{0,1\}^{n}Qa​∈{0,1}n,使得对所有 i∈[1,n]i\in[1,n]i∈[1,n],Qa(i)=1Q_{a}(i)=1Qa​(i)=1 当且仅当 ai=aa_{i}=aai​=a。我们给这些初始向量编号,并称之为 P1,…,P∣Σ∣P_{1},\dots,P_{|\Sigma|}P1​,…,P∣Σ∣​。下面说明对 t≥∣Σ∣t\geq|\Sigma|t≥∣Σ∣,如何由向量 P1,…,PtP_{1},\dots,P_{t}P1​,…,Pt​ 定义向量 Pt+1P_{t+1}Pt+1​。

Position-wise operation.

The vector Pt+1P_{t+1}Pt+1​ can be defined by Pt+1(i):=R(i)P_{t+1}(i):=R(i)Pt+1​(i):=R(i) for some Boolean combination R(i)R(i)R(i) of {P1(i),…,Pt(i)}\{P_{1}(i),\dots,P_{t}(i)\}{P1​(i),…,Pt​(i)}.

逐位置运算。

向量 Pt+1P_{t+1}Pt+1​ 可以由 Pt+1(i):=R(i)P_{t+1}(i):=R(i)Pt+1​(i):=R(i) 定义,其中 R(i)R(i)R(i) 是 {P1(i),…,Pt(i)}\{P_{1}(i),\dots,P_{t}(i)\}{P1​(i),…,Pt​(i)} 的某个布尔组合。

Attention operation.

The vector Pt+1P_{t+1}Pt+1​ can be defined by either of

注意力运算。

向量 Pt+1P_{t+1}Pt+1​ 可以由下列二者之一定义

Pt+1(i):= ◀j[M(i,j),S(i,j)] V(i,j):D(i)Pt+1(i):= ▶j[M(i,j),S(i,j)] V(i,j):D(i)\displaystyle P_{t+1}(i):=\ \blacktriangleleft_{j}[M(i,j),S(i,j)]\ V(i,j):D(i) \\ \displaystyle P_{t+1}(i):=\ \blacktriangleright_{j}[M(i,j),S(i,j)]\ V(i,j):D(i)Pt+1​(i):= ◀j​[M(i,j),S(i,j)] V(i,j):D(i)Pt+1​(i):= ▶j​[M(i,j),S(i,j)] V(i,j):D(i)

where

其中

  • • M(i,j)M(i,j)M(i,j) is a mask predicate as in the definition of a UHAT,
  • • M(i,j)M(i,j)M(i,j) 是与 UHAT 定义中相同的掩码谓词,
  • • S(i,j)S(i,j)S(i,j) and V(i,j)V(i,j)V(i,j) are Boolean combinations of {P1(i),…,Pt(i)}∪{P1(j),…,Pt(j)}\{P_{1}(i),\dots,P_{t}(i)\}\cup\{P_{1}(j),\dots,P_{t}(j)\}{P1​(i),…,Pt​(i)}∪{P1​(j),…,Pt​(j)}, called score predicate and value predicate, respectively,
  • • S(i,j)S(i,j)S(i,j) 和 V(i,j)V(i,j)V(i,j) 是 {P1(i),…,Pt(i),P1(j),…,Pt(j)}\{P_{1}(i),\dots,P_{t}(i),P_{1}(j),\dots,P_{t}(j)\}{P1​(i),…,Pt​(i),P1​(j),…,Pt​(j)} 的布尔组合,分别称为分数谓词和值谓词,
  • • D(i)D(i)D(i) is a Boolean combination of {P1(i),…,Pt(i)}\{P_{1}(i),\dots,P_{t}(i)\}{P1​(i),…,Pt​(i)}, called default value predicate.
  • • D(i)D(i)D(i) 是 {P1(i),…,Pt(i)}\{P_{1}(i),\dots,P_{t}(i)\}{P1​(i),…,Pt​(i)} 的布尔组合,称为默认值谓词。

The semantics of an attention operation is as follows. For every i∈[1,n]i\in[1,n]i∈[1,n], let

注意力运算的语义如下。对每个 i∈[1,n]i\in[1,n]i∈[1,n],令

$$j_{i}:=\begin{cases}\min{j\in[1,n]\mid M(i,j)\text{ and }S(i,j)=1},&\text{for }\blacktriangleleft\
\max{j\in[1,n]\mid M(i,j)\text{ and }S(i,j)=1},&\text{for }\blacktriangleright.\end{cases}$$

We then define Pt+1(i):=V(i,ji)P_{t+1}(i):=V(i,j_{i})Pt+1​(i):=V(i,ji​) if jij_{i}ji​ exists and Pt+1(i):=D(i)P_{t+1}(i):=D(i)Pt+1​(i):=D(i) otherwise. Observe that ◀\blacktriangleleft◀ (resp. ▶\blacktriangleright▶) corresponds to leftmost (resp. rightmost) tie-breaking in UHATs.

然后我们定义:若 jij_{i}ji​ 存在则 Pt+1(i):=V(i,ji)P_{t+1}(i):=V(i,j_{i})Pt+1​(i):=V(i,ji​),否则 Pt+1(i):=D(i)P_{t+1}(i):=D(i)Pt+1​(i):=D(i)。注意 ◀\blacktriangleleft◀(或 ▶\blacktriangleright▶)分别对应 UHAT 中的最左(或最右)平局打破。

A B-RASP program is given by an alphabet Σ\SigmaΣ and a sequence of position-wise and attention operations. We can view a B-RASP program as a language recognizer by designating one Boolean vector YYY as the output vector and either the first or last position as the output position. Then an input word w=a1…anw=a_{1}\dots a_{n}w=a1​…an​ is accepted if and only if Y(k)=1Y(k)=1Y(k)=1, where kkk is the output position, i.e., k=1k=1k=1 or k=nk=nk=n.

一个 B-RASP 程序由字母表 Σ\SigmaΣ 以及一串逐位置运算和注意力运算给出。我们可以把 B-RASP 程序看成语言识别器:指定某个布尔向量 YYY 为输出向量,并把第一个或最后一个位置指定为输出位置。于是输入词 w=a1…anw=a_{1}\dots a_{n}w=a1​…an​ 被接受,当且仅当 Y(k)=1Y(k)=1Y(k)=1,其中 kkk 是输出位置,即 k=1k=1k=1 或 k=nk=nk=n。

2.4 Recurrent Neural Networks (RNN)

2.4 循环神经网络(RNN)

We use RNN as language acceptors, as in the work of Merrill et al. 2020; Weiss et al. 2024; Weiss et al. 2018. In particular, a Recurrent Neural Network (RNN) MMM can be viewed as a function g:(Rd×Σ)→Rdg:(\mathbb{R}^{d}\times\Sigma)\to\mathbb{R}^{d}g:(Rd×Σ)→Rd. As in the case of transformers, Σ\SigmaΣ is also mapped into Rk\mathbb{R}^{k}Rk (for some kkk) through a token embedding function emb\mathit{emb}emb (e.g. one-hot encoding) and the function ggg actually has domain Rd×Rk\mathbb{R}^{d}\times\mathbb{R}^{k}Rd×Rk. We have an input vector xˉ0∈Rd\bar{x}_{0}\in\mathbb{R}^{d}xˉ0​∈Rd and a final function f:Rd→{Acc,Rej}f:\mathbb{R}^{d}\to\{Acc,Rej\}f:Rd→{Acc,Rej}, to decide whether a vector xˉ∈Rd\bar{x}\in\mathbb{R}^{d}xˉ∈Rd is accepting. The semantics of acceptance is the same as that of automata, i.e., given w=a1⋯an∈Σ∗w=a_{1}\cdots a_{n}\in\Sigma^{*}w=a1​⋯an​∈Σ∗, we compute ddd-vectors xˉ1,…,xˉn\bar{x}_{1},\ldots,\bar{x}_{n}xˉ1​,…,xˉn​ such that g(xˉi,ai+1)=xˉi+1g(\bar{x}_{i},a_{i+1})=\bar{x}_{i+1}g(xˉi​,ai+1​)=xˉi+1​ for each i=0,…,n−1i=0,\ldots,n-1i=0,…,n−1. The string www is accepted by MMM if f(an)=Accf(a_{n})=Accf(an​)=Acc.

我们把 RNN 当作语言接受器来用,做法与 Merrill et al. 2020;Weiss et al. 2024;Weiss et al. 2018 一致。具体地说,一个循环神经网络(RNN) MMM 可以看成函数 g:(Rd×Σ)→Rdg:(\mathbb{R}^{d}\times\Sigma)\to\mathbb{R}^{d}g:(Rd×Σ)→Rd。与 Transformer 的情形一样,Σ\SigmaΣ 也通过 token 嵌入函数 emb\mathit{emb}emb(例如独热编码)映射到 Rk\mathbb{R}^{k}Rk(对某个 kkk),因而函数 ggg 的实际定义域是 Rd×Rk\mathbb{R}^{d}\times\mathbb{R}^{k}Rd×Rk。我们有输入向量 xˉ0∈Rd\bar{x}_{0}\in\mathbb{R}^{d}xˉ0​∈Rd,以及最终函数 f:Rd→{Acc,Rej}f:\mathbb{R}^{d}\to\{Acc,Rej\}f:Rd→{Acc,Rej},用来判定向量 xˉ∈Rd\bar{x}\in\mathbb{R}^{d}xˉ∈Rd 是否接受。接受语义与自动机相同:给定 w=a1⋯an∈Σ∗w=a_{1}\cdots a_{n}\in\Sigma^{*}w=a1​⋯an​∈Σ∗,我们计算 ddd 维向量 xˉ1,…,xˉn\bar{x}_{1},\ldots,\bar{x}_{n}xˉ1​,…,xˉn​,使得对每个 i=0,…,n−1i=0,\ldots,n-1i=0,…,n−1 有 g(xˉi,ai+1)=xˉi+1g(\bar{x}_{i},a_{i+1})=\bar{x}_{i+1}g(xˉi​,ai+1​)=xˉi+1​。若 f(an)=Accf(a_{n})=Accf(an​)=Acc,则称 MMM 接受字符串 www。

As a computational model, it is realistic to assume RNNs with a fixed precision, i.e., computation is always done over real numbers that can be represented with a constant kkk number of bits. The details of the actual representation are not important for our analysis. Therefore, the state-space QQQ of the above RNN can be mapped to ddd-vectors over {0,1}k\{0,1\}^{k}{0,1}k (instead of R\mathbb{R}R). The following proposition is now immediate.

作为计算模型,假定 RNN 具有固定精度是现实的,也就是计算始终在能用常数 kkk 个比特表示的实数上进行。具体表示细节对我们的分析并不重要。因此,上述 RNN 的状态空间 QQQ 可以映射到 {0,1}k\{0,1\}^{k}{0,1}k 上的 ddd 维向量(而不是 R\mathbb{R}R)。下面的命题现在是直接的。

Proposition 3.

An RNN g:(Rd×Σ)→Rdg:(\mathbb{R}^{d}\times\Sigma)\to\mathbb{R}^{d}g:(Rd×Σ)→Rd with fixed precision kkk can be represented by a finite automaton with 2kd2^{kd}2kd many states.

命题 3。

固定精度为 kkk 的 RNN g:(Rd×Σ)→Rdg:(\mathbb{R}^{d}\times\Sigma)\to\mathbb{R}^{d}g:(Rd×Σ)→Rd 可以用一个具有 2kd2^{kd}2kd 个状态的有限自动机来表示。

2.5 Size measures and succinctness

2.5 大小度量与简洁性

Let R\mathcal{R}R be a finite representation of a language, i.e., in our case a UHAT, LTL formula, finite automaton, RNN, or B-RASP program. We define the size of R\mathcal{R}R, denoted by ∣R∣|\mathcal{R}|∣R∣, as the length of its usual binary encoding. In measuring succinctness of RNN, we put the precision kkk in unary also as part of the size measure; since we do not want to compare a transformer that uses a fixed precision kkk and allow an RNN that uses a fixed precision 2k2^{k}2k. Let C1,C2\mathcal{C}_{1},\mathcal{C}_{2}C1​,C2​ be classes of finite representations of languages. We say that C1\mathcal{C}_{1}C1​ can be exponentially more succinct than C2\mathcal{C}_{2}C2​ if for every function f∈2o(n)f\in 2^{o(n)}f∈2o(n) there is an R1∈C1\mathcal{R}_{1}\in\mathcal{C}_{1}R1​∈C1​ such that any R2∈C2\mathcal{R}_{2}\in\mathcal{C}_{2}R2​∈C2​ representing the same language as R1\mathcal{R}_{1}R1​ has size ∣R2∣>f(∣R1∣)|\mathcal{R}_{2}|>f(|\mathcal{R}_{1}|)∣R2​∣>f(∣R1​∣). Similarly, we define doubly exponentially more succinct using functions f∈22o(n)f\in 2^{2^{o(n)}}f∈22o(n) instead. Intuitively, this means that any translation from C1\mathcal{C}_{1}C1​ to C2\mathcal{C}_{2}C2​ incurs, in the worst-case, an (doubly) exponential increase in size.

设 R\mathcal{R}R 是语言的一个有限表示,在我们这里也就是 UHAT、LTL 公式、有限自动机、RNN 或 B-RASP 程序。我们把 R\mathcal{R}R 的大小记为 ∣R∣|\mathcal{R}|∣R∣,定义为它通常的二进制编码长度。在度量 RNN 的简洁性时,我们把精度 kkk 以一元方式也计入大小,因为我们不想拿一个使用固定精度 kkk 的 Transformer,去和一个使用固定精度 2k2^{k}2k 的 RNN 相比。设 C1,C2\mathcal{C}_{1},\mathcal{C}_{2}C1​,C2​ 是语言有限表示的类。我们说 C1\mathcal{C}_{1}C1​ 可以比 C2\mathcal{C}_{2}C2​ 指数级更简洁,如果对每个函数 f∈2o(n)f\in 2^{o(n)}f∈2o(n),都存在 R1∈C1\mathcal{R}_{1}\in\mathcal{C}_{1}R1​∈C1​,使得任何表示同一语言的 R2∈C2\mathcal{R}_{2}\in\mathcal{C}_{2}R2​∈C2​ 都满足 ∣R2∣>f(∣R1∣)|\mathcal{R}_{2}|>f(|\mathcal{R}_{1}|)∣R2​∣>f(∣R1​∣)。类似地,把函数改成 f∈22o(n)f\in 2^{2^{o(n)}}f∈22o(n),就定义了双指数级更简洁。直观上,这意味着从 C1\mathcal{C}_{1}C1​ 到 C2\mathcal{C}_{2}C2​ 的任何翻译,在最坏情形下都会带来(双)指数的大小增长。

3 Size of smallest witness via non-emptiness problem

3 通过非空性问题看最短见证的大小

In this section we consider the problem of checking whether the language recognized by a UHAT or B-RASP program is non-empty. In particular, the technique is essentially a simulation of a Turing machine with an 2O(n)2^{O(n)}2O(n)-sized tape (for a given nnn). As we will see later, there are Turing machines such that the smallest (i.e. shortest) accepted string by the constructed UHAT is of length at least 22Ω(n)2^{2^{\Omega(n)}}22Ω(n).

本节考虑判断 UHAT 或 B-RASP 程序所认语言是否非空的问题。所用技术本质上是模拟一台磁带大小为 2O(n)2^{O(n)}2O(n) 的图灵机(对给定的 nnn)。后面会看到,存在一些图灵机,使得构造出的 UHAT 所接受的最短字符串长度至少为 22Ω(n)2^{2^{\Omega(n)}}22Ω(n)。

Example 4.

To illustrate the idea, we describe a B-RASP program that accepts strings of the form

例 4。

为说明想法,我们描述一个接受如下形式字符串的 B-RASP 程序

0000a1#0001a2#0010a3#…#1111a24#0000a_{1}\#0001a_{2}\#0010a_{3}\#\dots\#1111a_{2^{4}}\#0000a1​#0001a2​#0010a3​#…#1111a24​#

where ai∈{a,b,c}a_{i}\in\{a,b,c\}ai​∈{a,b,c} such that (aj,aj+1)∈H(a_{j},a_{j+1})\in H(aj​,aj+1​)∈H for all 1≤j<241\leq j<2^{4}1≤j<24. Here, H:={(a,b),(b,c),(b,a),(c,b)}H:=\{(a,b),(b,c),(b,a),(c,b)\}H:={(a,b),(b,c),(b,a),(c,b)} is a set of constraints specifying which symbols can be next to each other. For simplicity, we concentrate on the two main conditions: (i) checking that the bit counter is incremented and (ii) checking that the successive symbols are in HHH. To check (i), we use the following attention operation:

其中 ai∈{a,b,c}a_{i}\in\{a,b,c\}ai​∈{a,b,c},并且对所有 1≤j<241\leq j<2^{4}1≤j<24 有 (aj,aj+1)∈H(a_{j},a_{j+1})\in H(aj​,aj+1​)∈H。这里 H:={(a,b),(b,c),(b,a),(c,b)}H:=\{(a,b),(b,c),(b,a),(c,b)\}H:={(a,b),(b,c),(b,a),(c,b)} 是一组约束,规定哪些符号可以相邻。为简单起见,我们集中看两个主要条件:(i) 检查比特计数器是否递增;(ii) 检查相继符号是否属于 HHH。为检查 (i),我们使用如下注意力运算:

$$C_{+1}(i):=\ \blacktriangleright_{j}[j<i,Q_{#}(j)]\ \bigvee_{k=1}^{4}\big(\bigwedge_{r=1}^{k-1}\neg C_{r}(i)\wedge C_{r}(j)\big)\wedge C_{k}(i)\wedge\neg C_{k}(j)\ \wedge\
\ \big(\bigwedge_{r=k+1}^{4}C_{r}(i)\leftrightarrow C_{r}(j)\big):1$$

Assume iii is a #\##-position. Attention selects the rightmost #\##-position jjj left of position iii. Let b1i…b4ib_{1}^{i}\dots b_{4}^{i}b1i​…b4i​ and b1j…b4jb_{1}^{j}\dots b_{4}^{j}b1j​…b4j​ be the bit strings directly left of position iii and jjj, respectively. We assume that we already defined Ck(i)=bkiC_{k}(i)=b_{k}^{i}Ck​(i)=bki​ and Ck(j)=bkjC_{k}(j)=b_{k}^{j}Ck​(j)=bkj​ for all k∈[1,4]k\in[1,4]k∈[1,4]. Then the above value predicate checks that the binary number b1i…b4ib_{1}^{i}\dots b_{4}^{i}b1i​…b4i​ is the number b1j…b4jb_{1}^{j}\dots b_{4}^{j}b1j​…b4j​ incremented by 1. To check (ii), we can use the attention operation

假定 iii 是一个 #\##-位置。注意力选出 iii 左侧最右的 #\##-位置 jjj。设 b1i…b4ib_{1}^{i}\dots b_{4}^{i}b1i​…b4i​ 和 b1j…b4jb_{1}^{j}\dots b_{4}^{j}b1j​…b4j​ 分别是紧挨在位置 iii 和 jjj 左侧的比特串。我们假定已经对所有 k∈[1,4]k\in[1,4]k∈[1,4] 定义了 Ck(i)=bkiC_{k}(i)=b_{k}^{i}Ck​(i)=bki​ 和 Ck(j)=bkjC_{k}(j)=b_{k}^{j}Ck​(j)=bkj​。于是上述值谓词检查二进制数 b1i…b4ib_{1}^{i}\dots b_{4}^{i}b1i​…b4i​ 是否恰为 b1j…b4jb_{1}^{j}\dots b_{4}^{j}b1j​…b4j​ 加 1。为检查 (ii),可以使用注意力运算

M←(i):= ▶j[j<i,Qa(j)∨Qb(j)∨Qc(j)] ⋁(h,h′)∈HQh(j)∧Qh′(i):1.M_{\leftarrow}(i):=\ \blacktriangleright_{j}[j<i,Q_{a}(j)\vee Q_{b}(j)\vee Q_{c}(j)]\ \bigvee_{(h,h^{\prime})\in H}Q_{h}(j)\wedge Q_{h^{\prime}}(i):1.M←​(i):= ▶j​[j<i,Qa​(j)∨Qb​(j)∨Qc​(j)] (h,h′)∈H⋁​Qh​(j)∧Qh′​(i):1.

If iii is a position of a symbol aia_{i}ai​, attention picks the rightmost position jjj of a symbol aja_{j}aj​ to the left of iii and checks with the value predicate that (aj,ai)∈H(a_{j},a_{i})\in H(aj​,ai​)∈H.

若 iii 是某个符号 aia_{i}ai​ 的位置,注意力会选出 iii 左侧最右的符号位置 jjj(对应符号 aja_{j}aj​),并用值谓词检查 (aj,ai)∈H(a_{j},a_{i})\in H(aj​,ai​)∈H。

This allows us to succinctly recognize a language whose smallest string has length exponential in the number of bits of the binary counter. By stacking multiple such strings vertically and introducing vertical constraints in addition to the horizontal constraints HHH, we can even succinctly recognize languages whose smallest string has doubly exponential length.

这样我们就能简洁地认出一门语言,其最短字符串的长度对二进制计数器的比特数是指数级的。把多条这样的字符串纵向叠起来,并在水平约束 HHH 之外再引入竖直约束,我们甚至能简洁地认出最短字符串长度为双指数的语言。

We prove the following precise complexity bounds:

我们证明下列精确的复杂性界:

Theorem 5.

The non-emptiness problem for UHATs and B-RASP programs is EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-complete.

定理 5。

UHAT 与 B-RASP 程序的非空性问题是 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-完全的。

We start with the lower bound and show it first for B-RASP programs.

我们从下界开始,并先对 B-RASP 程序给出证明。

Proposition 6.

The non-emptiness problem for B-RASP programs is EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-hard.

命题 6。

B-RASP 程序的非空性问题是 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-难的。

For the proof we use the techniques illustrated in Example 4 and reduce from a so-called tiling problem. A tile is a quadruple t∈N04t\in\mathbb{N}_{0}^{4}t∈N04​, where we write t=⟨left(t),up(t),right(t),down(t)⟩t=\langle\mathit{left}(t),\mathit{up}(t),\mathit{right}(t),\mathit{down}(t)\ranglet=⟨left(t),up(t),right(t),down(t)⟩. The 2n2^{n}2n-tiling problem is defined as follows:

证明使用例 4 中展示的技术,并从所谓的铺砖问题做规约。一块砖是四元组 t∈N04t\in\mathbb{N}_{0}^{4}t∈N04​,我们写成 t=⟨left(t),up(t),right(t),down(t)⟩t=\langle\mathit{left}(t),\mathit{up}(t),\mathit{right}(t),\mathit{down}(t)\ranglet=⟨left(t),up(t),right(t),down(t)⟩。2n2^{n}2n-铺砖问题定义如下:

An integer n>0n>0n>0 in unary, a finite set TTT of tiles, and a tile tfin∈Tt_{\mathit{fin}}\in Ttfin​∈T

一个用一元写出的整数 n>0n>0n>0、一个有限砖集 TTT,以及一块砖 tfin∈Tt_{\mathit{fin}}\in Ttfin​∈T

Do there exist m>0m>0m>0 and a function τ ⁣:{1,…,2n}×{1,…,m}→T\tau\colon\{1,\dots,2^{n}\}\times\{1,\dots,m\}\to Tτ:{1,…,2n}×{1,…,m}→T such that

是否存在 m>0m>0m>0 和函数 τ ⁣:{1,…,2n}×{1,…,m}→T\tau\colon\{1,\dots,2^{n}\}\times\{1,\dots,m\}\to Tτ:{1,…,2n}×{1,…,m}→T,使得

1. τ(2n,m)=tfin\tau(2^{n},m)=t_{\mathit{fin}}τ(2n,m)=tfin​,

1. τ(2n,m)=tfin\tau(2^{n},m)=t_{\mathit{fin}}τ(2n,m)=tfin​,

2. down(τ(i,1))=up(τ(i,m))=0\mathit{down}(\tau(i,1))=\mathit{up}(\tau(i,m))=0down(τ(i,1))=up(τ(i,m))=0 for all 1≤i≤2n1\leq i\leq 2^{n}1≤i≤2n,

2. 对所有 1≤i≤2n1\leq i\leq 2^{n}1≤i≤2n,down(τ(i,1))=up(τ(i,m))=0\mathit{down}(\tau(i,1))=\mathit{up}(\tau(i,m))=0down(τ(i,1))=up(τ(i,m))=0,

3. left(τ(1,j))=right(τ(2n,j))=0\mathit{left}(\tau(1,j))=\mathit{right}(\tau(2^{n},j))=0left(τ(1,j))=right(τ(2n,j))=0 for all 1≤j≤m1\leq j\leq m1≤j≤m,

3. 对所有 1≤j≤m1\leq j\leq m1≤j≤m,left(τ(1,j))=right(τ(2n,j))=0\mathit{left}(\tau(1,j))=\mathit{right}(\tau(2^{n},j))=0left(τ(1,j))=right(τ(2n,j))=0,

4. right(τ(i,j))=left(τ(i+1,j))\mathit{right}(\tau(i,j))=\mathit{left}(\tau(i+1,j))right(τ(i,j))=left(τ(i+1,j)) for all 1≤i<2n1\leq i<2^{n}1≤i<2n and 1≤j≤m1\leq j\leq m1≤j≤m, and

4. 对所有 1≤i<2n1\leq i<2^{n}1≤i<2n 和 1≤j≤m1\leq j\leq m1≤j≤m,right(τ(i,j))=left(τ(i+1,j))\mathit{right}(\tau(i,j))=\mathit{left}(\tau(i+1,j))right(τ(i,j))=left(τ(i+1,j)),并且

5. up(τ(i,j))=down(τ(i,j+1))\mathit{up}(\tau(i,j))=\mathit{down}(\tau(i,j+1))up(τ(i,j))=down(τ(i,j+1)) for all 1≤i≤2n1\leq i\leq 2^{n}1≤i≤2n and 1≤j<m1\leq j<m1≤j<m?

5. 对所有 1≤i≤2n1\leq i\leq 2^{n}1≤i≤2n 和 1≤j<m1\leq j<m1≤j<m,up(τ(i,j))=down(τ(i,j+1))\mathit{up}(\tau(i,j))=\mathit{down}(\tau(i,j+1))up(τ(i,j))=down(τ(i,j+1))?

The following is shown in (Schwarzentruber 2019):

下列结果见(Schwarzentruber 2019):

Proposition 7.

The 2n2^{n}2n-tiling problem is EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-complete.

命题 7。

2n2^{n}2n-铺砖问题是 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-完全的。

The reduction to B-RASP uses an encoding of the function τ\tauτ as a sequence of strings which are of a similar form as in Example 4, but is substantially more involved. The key observation is that strict future masking with rightmost tie-breaking enables us to check conditions between successive tiles (condition 4) but also between the current tile and the tile at the most recent past occurrence of the same counter value (condition 5). The full proof can be found in Appendix A.

到 B-RASP 的规约把函数 τ\tauτ 编码成一串与例 4 形式相近的字符串,但要复杂得多。关键观察是:带最右平局打破的严格未来掩码,既能检查相继砖块之间的条件(条件 4),也能检查当前砖与“上一次出现同一计数器取值”处的砖之间的条件(条件 5)。完整证明见附录 A。

We observe that the B-RASP program constructed in the proof of Proposition 6 can easily be converted to UHAT, which yields the EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE lower bound also for UHAT.

我们观察到,命题 6 证明中构造的 B-RASP 程序可以容易地转成 UHAT,从而也对 UHAT 给出 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE 下界。

Proposition 8.

The non-emptiness problem for UHAT is EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-hard.

命题 8。

UHAT 的非空性问题是 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-难的。

Proof sketch.

We show that the B-RASP program constructed in the proof of Proposition 6 can be converted to a UHAT in polynomial time. To this end, note that Boolean operations can easily be simulated using affine transformations and ReLU. For the attention operations we use an attention layer. The value predicates V(i,j)V(i,j)V(i,j) can be simulated by copying the required components of the jjj-th vector, that was selected by attention, to the iii-th vector using the affine transformation whose result is forwarded and computing the result of the Boolean combination with additional ReLU layers. For the score predicates S(i,j)S(i,j)S(i,j) we note that they either only depend on jjj or they check whether some binary numbers at positions iii and jjj are equal. The former can be simulated using an additional preliminary layer that already computes the result of S(j)S(j)S(j) for every position jjj. For the latter we use Lemma 9. ∎

证明概要。

我们说明命题 6 证明中构造的 B-RASP 程序可以在多项式时间内转成 UHAT。为此注意,布尔运算很容易用仿射变换和 ReLU 来模拟。对注意力运算,我们使用一层注意力。值谓词 V(i,j)V(i,j)V(i,j) 可以这样模拟:用其结果会被向前传递的仿射变换,把注意力选出的第 jjj 个向量中所需分量复制到第 iii 个向量,再用额外的 ReLU 层计算布尔组合的结果。对分数谓词 S(i,j)S(i,j)S(i,j),我们注意到它们要么只依赖于 jjj,要么检查位置 iii 和 jjj 处的某些二进制数是否相等。前者可以用一个额外的预备层来模拟,该层已经为每个位置 jjj 算出 S(j)S(j)S(j) 的结果。后者我们使用引理 9。∎

The proof of the following Lemma can be found in Appendix A.

下列引理的证明见附录 A。

Lemma 9.

Given a mask predicate MMM and tie-breaking function τ\tauτ, there is an attention layer using MMM and τ\tauτ that on every sequence v1,…,vn∈{0,1}2d\bm{v}_{1},\dots,\bm{v}_{n}\in\{0,1\}^{2d}v1​,…,vn​∈{0,1}2d with vk=(bk,1,1−bk,1,…,bk,d,1−bk,d)\bm{v}_{k}=(b_{k,1},1-b_{k,1},\dots,b_{k,d},1-b_{k,d})vk​=(bk,1​,1−bk,1​,…,bk,d​,1−bk,d​) for all k∈[1,n]k\in[1,n]k∈[1,n] and for every i∈[1,n]i\in[1,n]i∈[1,n] picks attention vector ai=vj\bm{a}_{i}=\bm{v}_{j}ai​=vj​ such that bi,r=bj,rb_{i,r}=b_{j,r}bi,r​=bj,r​ for all r∈[1,d]r\in[1,d]r∈[1,d] if such an unmasked position jjj exists.

引理 9。

给定掩码谓词 MMM 和平局打破函数 τ\tauτ,存在使用 MMM 和 τ\tauτ 的注意力层,使得在每个序列 v1,…,vn∈{0,1}2d\bm{v}_{1},\dots,\bm{v}_{n}\in\{0,1\}^{2d}v1​,…,vn​∈{0,1}2d(对所有 k∈[1,n]k\in[1,n]k∈[1,n] 有 vk=(bk,1,1−bk,1,…,bk,d,1−bk,d)\bm{v}_{k}=(b_{k,1},1-b_{k,1},\dots,b_{k,d},1-b_{k,d})vk​=(bk,1​,1−bk,1​,…,bk,d​,1−bk,d​))上,对每个 i∈[1,n]i\in[1,n]i∈[1,n],若存在这样的未掩码位置 jjj,则选出注意力向量 ai=vj\bm{a}_{i}=\bm{v}_{j}ai​=vj​,满足对所有 r∈[1,d]r\in[1,d]r∈[1,d] 有 bi,r=bj,rb_{i,r}=b_{j,r}bi,r​=bj,r​。

We observe that the B-RASP program constructed in the proof of Proposition 6 only uses strict future masking and rightmost tie-breaking. Thus, the EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE lower bound already holds for UHATs that only use strict future masking and rightmost tie-breaking (similar for strict past masking and leftmost tie-breaking).

我们观察到,命题 6 证明中构造的 B-RASP 程序只用严格未来掩码和最右平局打破。因此,EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE 下界对只使用严格未来掩码和最右平局打破的 UHAT 已经成立(对严格过去掩码和最左平局打破同样如此)。

Corollary 10.

The non-emptiness problem for UHATs, where every layer uses strict future masking and rightmost tie-breaking (resp. strict past masking and leftmost tie-breaking), is already EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-hard.

推论 10。

每一层都使用严格未来掩码和最右平局打破(或严格过去掩码和最左平局打破)的 UHAT,其非空性问题已经是 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-难的。

We now prove the upper bounds in Theorem 5. To this end, we first note that any B-RASP program can be converted in exponential time into an LTL formula using the construction from (Yang et al. 2024). In Proposition 12 we prove that the same is true for UHATs, which improves the doubly exponential construction in (Yang et al. 2024) that translates UHATs to B-RASP programs first. This suffices to prove the exponential-space upper bounds in Theorem 5 since non-emptiness of languages given by LTL formulas can be checked in polynomial space (Sistla & Clarke 1985).

现在证明定理 5 中的上界。为此我们先指出,任何 B-RASP 程序都可以用 Yang et al. 2024 的构造在指数时间内转成 LTL 公式。我们在命题 12 中证明这对 UHAT 同样成立,这改进了 Yang et al. 2024 中先把 UHAT 译成 B-RASP 程序的双指数构造。这足以证明定理 5 中的指数空间上界,因为由 LTL 公式给出的语言,其非空性可以在多项式空间内判定(Sistla & Clarke 1985)。

For the translation from UHAT to LTL, we first have to make the crucial observation that the values occurring during the computation of a UHAT are not “too large”.

为了从 UHAT 译到 LTL,我们首先必须做出一个关键观察:UHAT 计算过程中出现的值并不会“太大”。

Proposition 11.

The values occurring in the computation of a UHAT T\mathcal{T}T can be represented with only a polynomial number of bits in the size of T\mathcal{T}T. Thus, rational numbers with fixed precision, that is polynomial in the size of T\mathcal{T}T, are sufficient.

命题 11。

UHAT T\mathcal{T}T 计算中出现的值只需用 ∣T∣|\mathcal{T}|∣T∣ 的多项式个比特来表示。因此,精度对 ∣T∣|\mathcal{T}|∣T∣ 为多项式的固定精度有理数就足够了。

Proof.

Clearly, ReLU layers do not increase the amount of bits needed since only the maximum with 0 is taken. Since our UHAT model is defined over rational numbers, we can represent each value with a binary number for the numerator and a binary number for the denominator. By taking the LCM, we can further assume that the denominators of the numbers in emb(Σ)\mathit{emb}(\Sigma)emb(Σ) are all equal. Note that the LCM of linearly many numbers of linear bit size can be represented with polynomially many bits. Similarly, for each attention layer we can assume that the denominators of all coefficients of the affine transformation, whose result is forwarded, are equal. This ensure that in the input sequence and after each layer the values have the same denominator. Next we argue that the numerators and denominators of all values that occur in the computation can be represented with a polynomial number of bits. The output of an attention layer is an affine transformation involving two input vectors. Here, the input values are only multiplied with constants, i.e., the values in the output only depend linearly on input values. Since the denominators of the values after multiplication with coefficients are all equal, addition does not incur an increase in bit length of the denominators. Therefore, a repeated application of linearly many attention layers can only lead to numerators and denominators whose values are at most exponential in the number of layers, i.e., can be represented with polynomially many bits. For the score function we observe that the dot product after an affine transformation only involves two input vectors. Thus, the number of bits needed to represent the result of the score function is still polynomial. A crucial observation is that the results after applying the score function are not forwarded to the next layer, which would introduce an exponential increase in size in the number of layers. ∎

证明。

显然,ReLU 层不会增加所需比特数,因为它只取与 0 的最大值。由于我们的 UHAT 模型定义在有理数上,每个值都可以用分子的二进制数和分母的二进制数来表示。再取最小公倍数,我们可以进一步假定 emb(Σ)\mathit{emb}(\Sigma)emb(Σ) 中各数的分母都相同。注意,线性多个、每个只有线性比特大小的数,其最小公倍数可以用多项式个比特表示。类似地,对每一层注意力,我们可以假定其结果会被向前传递的仿射变换中,所有系数的分母都相同。这保证输入序列以及每一层之后,各值都有相同的分母。接下来我们论证,计算中出现的所有值的分子和分母都可以用多项式个比特表示。注意力层的输出是涉及两个输入向量的仿射变换。这里,输入值只与常数相乘,也就是说输出中的值只线性依赖于输入值。由于与系数相乘后各值的分母都相同,加法不会增加分母的比特长度。因此,反复应用线性多层注意力,只能使分子和分母的值至多对层数呈指数增长,也就是可以用多项式个比特表示。对分数函数,我们观察到仿射变换之后的点积只涉及两个输入向量。因此,表示分数函数结果所需的比特数仍然是多项式的。一个关键观察是:分数函数作用后的结果并不会传到下一层,否则会在层数上引入指数级的大小增长。∎

By Proposition 11, we can already compute the results of the affine transformations and score functions during the construction of the LTL formula. This means that the LTL formula only has to simulate the position-wise behavior of attention layers, i.e., masking and selecting the position of the attention vector, but not the actual computation of values. The proof of the following proposition can be found in Appendix A.

由命题 11,我们在构造 LTL 公式时就已经能算出仿射变换和分数函数的结果。这意味着 LTL 公式只需模拟注意力层的逐位置行为,也就是掩码以及选出注意力向量的位置,而不必模拟值本身的计算。下列命题的证明见附录 A。

Proposition 12.

Given a UHAT that recognizes a language LLL, one can construct in exponential time an LTL formula recognizing LLL.

命题 12。

给定认出语言 LLL 的 UHAT,可以在指数时间内构造出认出 LLL 的 LTL 公式。

We remark that if we start with a UHAT, where every attention layer uses strict future masking and leftmost tie-breaking (resp. strict past masking and rightmost tie-breaking), then the LTL formula constructed in the proof of Proposition 12 only uses the P (resp. F) operator. It was shown in (Sistla & Clarke 1985) that the non-emptiness problem for the fragments of LTL that only allow P or F is NP{\mathsf{NP}}NP-complete. Thus, we obtain an improved complexity upper bound for such restricted UHATs.

我们指出,如果出发的 UHAT 中每一层注意力都使用严格未来掩码和最左平局打破(或严格过去掩码和最右平局打破),那么命题 12 证明中构造的 LTL 公式将只使用 P(或 F)算子。Sistla & Clarke 1985 证明,只允许 P 或 F 的 LTL 片段,其非空性问题是 NP{\mathsf{NP}}NP-完全的。因此,对这类受限 UHAT,我们得到更强的复杂性上界。

Corollary 13.

The non-emptiness problem for UHATs, where every attention layer uses strict future masking and leftmost tie-breaking (resp. strict past masking and rightmost tie-breaking), is in NEXP{\mathsf{NEXP}}NEXP.

推论 13。

每一层注意力都使用严格未来掩码和最左平局打破(或严格过去掩码和最右平局打破)的 UHAT,其非空性问题属于 NEXP{\mathsf{NEXP}}NEXP。

Note that it was already shown in (Jerad et al. 2025) that such restricted UHATs are equally expressive as the LTL fragment with only P (resp. F). However, the construction by Jerad et al. 2025 from UHAT to the LTL fragments incurs a doubly exponential blow-up, as opposed to our singly exponential translation.

需要指出,Jerad et al. 2025 已经证明这类受限 UHAT 与只含 P(或 F)的 LTL 片段表达力相同。不过,Jerad et al. 2025 从 UHAT 到这些 LTL 片段的构造会带来双指数膨胀,而我们的翻译只是单指数的。

4 Succinctness against other representations of languages

4 相对于其他语言表示的简洁性

We now study how succinctly transformers can represent languages compared to standard models from formal language theory.

现在我们研究:与形式语言理论中的标准模型相比,Transformer 表示语言能有多简洁。

We first compare transformers to LTL. One indication that transformers may be more succinct than LTL comes from Theorem 5, which shows that the non-emptiness problem for UHATs is EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-complete, whereas for LTL the corresponding problem is known to be PSPACE{\mathsf{PSPACE}}PSPACE-complete. The following result shows that this exponential gap also manifests in terms of succinctness.

我们先把 Transformer 和 LTL 作比较。Transformer 可能比 LTL 更简洁的一个迹象来自定理 5:UHAT 的非空性问题是 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-完全的,而 LTL 的对应问题已知是 PSPACE{\mathsf{PSPACE}}PSPACE-完全的。下列结果表明,这一指数级间隙也体现在简洁性上。

Theorem 14.

UHATs can be exponentially more succinct than LTL.

定理 14。

UHAT 可以比 LTL 指数级更简洁。

Proof.

We give a family {Ln}n≥1\{L_{n}\}_{n\geq 1}{Ln​}n≥1​ of languages such that LnL_{n}Ln​ is recognized by a UHAT of size polynomial in nnn but any LTL formula recognizing LnL_{n}Ln​ has size exponential in nnn. Let Mn\mathcal{M}_{n}Mn​ be a (deterministic) Turing machine that implements a binary counter with 2n2^{n}2n bits, i.e., when initialized with 02n0^{2^{n}}02n, it increments the binary number until it has written 12n1^{2^{n}}12n on its tape and accepts. Clearly, Mn\mathcal{M}_{n}Mn​ is of size polynomial in nnn, it uses an exponential number of tape cells in nnn, and the unique accepting run has length at least 22n2^{2^{n}}22n. In (van Emde Boas 1997) a reduction from Turing machines to tiling problem instances is presented that encodes configurations of Turing machines in its rows and a correct tiling corresponds to a valid execution of the Turing machine. We observe that the 2n2^{n}2n-tiling problem instance In\mathcal{I}_{n}In​ constructed from Mn\mathcal{M}_{n}Mn​ has size polynomial in nnn and it has the property that the smallest correct tiling has at least 22n2^{2^{n}}22n many rows. In the proof of Proposition 8 we showed that there is a UHAT Tn\mathcal{T}_{n}Tn​ of size polynomial in the size of In\mathcal{I}_{n}In​ that recognizes encodings of correct tilings of In\mathcal{I}_{n}In​. Thus, Tn\mathcal{T}_{n}Tn​ is of size polynomial in nnn and the smallest accepted word has length at least 22n2^{2^{n}}22n. We let LnL_{n}Ln​ be the language recognized by Tn\mathcal{T}_{n}Tn​. Let φn\varphi_{n}φn​ be an LTL formula that recognizes LnL_{n}Ln​. Since the smallest accepted word by any LTL formula has length at most exponential in the formula size (using an exponential conversion from LTL to finite automata similar to (Vardi & Wolper 1994)), it follows that the size of φn\varphi_{n}φn​ is at least exponential in nnn. ∎

证明。

我们给出一族语言 {Ln}n≥1\{L_{n}\}_{n\geq 1}{Ln​}n≥1​,使得 LnL_{n}Ln​ 可以被大小对 nnn 为多项式的 UHAT 认出,但任何认出 LnL_{n}Ln​ 的 LTL 公式大小都对 nnn 为指数。设 Mn\mathcal{M}_{n}Mn​ 是一台实现 2n2^{n}2n 比特二进制计数器的(确定性)图灵机:从 02n0^{2^{n}}02n 出发,它把这个二进制数递增,直到在纸带上写出 12n1^{2^{n}}12n 并接受。显然 Mn\mathcal{M}_{n}Mn​ 的大小对 nnn 为多项式,它使用对 nnn 为指数的纸带单元,并且唯一的接受运行长度至少为 22n2^{2^{n}}22n。van Emde Boas 1997 给出从图灵机到铺砖问题实例的规约,把图灵机的格局编进各行,正确的铺砖对应图灵机的一次合法执行。我们观察到,由 Mn\mathcal{M}_{n}Mn​ 构造的 2n2^{n}2n-铺砖问题实例 In\mathcal{I}_{n}In​ 大小对 nnn 为多项式,并且最小的正确铺砖至少有 22n2^{2^{n}}22n 行。在命题 8 的证明中我们说明,存在大小对 ∣In∣|\mathcal{I}_{n}|∣In​∣ 为多项式的 UHAT Tn\mathcal{T}_{n}Tn​,它认出 In\mathcal{I}_{n}In​ 的正确铺砖编码。因此 Tn\mathcal{T}_{n}Tn​ 的大小对 nnn 为多项式,且最短被接受词的长度至少为 22n2^{2^{n}}22n。令 LnL_{n}Ln​ 为 Tn\mathcal{T}_{n}Tn​ 认出的语言。设 φn\varphi_{n}φn​ 是认出 LnL_{n}Ln​ 的 LTL 公式。由于任何 LTL 公式所接受的最短词,长度至多对公式大小为指数(使用类似于 Vardi & Wolper 1994 的、从 LTL 到有限自动机的指数转换),可知 φn\varphi_{n}φn​ 的大小至少对 nnn 为指数。∎

Conversely, we can show that there is no language than can be represented by LTL significantly more succinct than by UHATs. Thus, we may even say that UHATs are exponentially more succinct than LTL.

反过来,我们可以证明:不存在一门语言,能被 LTL 表示得比 UHAT 显著更简洁。因此我们甚至可以说,UHAT 就是比 LTL 指数级更简洁。

Proposition 15.

Given an LTL formula φ\varphiφ, one can construct in polynomial time a UHAT that recognizes the same language as φ\varphiφ.

命题 15。

给定 LTL 公式 φ\varphiφ,可以在多项式时间内构造出认出同一语言的 UHAT。

Proof sketch.

From φ\varphiφ we construct a UHAT T\mathcal{T}T that on input www outputs in a dedicated component at position 1≤i≤∣w∣1\leq i\leq|w|1≤i≤∣w∣ a 1 if w,i⊨φw,i\models\varphiw,i⊨φ and a 0 otherwise. Then the claim can be proven by induction. If φ\varphiφ is an atomic formula or a Boolean combination, we can easily define T\mathcal{T}T. If φ=φ1Sφ2\varphi=\varphi_{1}\mathbin{\textbf{S}}\varphi_{2}φ=φ1​Sφ2​, we can assume by induction hypothesis that we already computed the truth value of φ1\varphi_{1}φ1​ and φ2\varphi_{2}φ2​ at every position, which we use to compute the truth value of ¬φ1∨φ2\neg\varphi_{1}\vee\varphi_{2}¬φ1​∨φ2​. We then use an attention layer with strict future masking and rightmost tie-breaking to get for every position iii the maximal position j<ij<ij<i where ¬φ1∨φ2\neg\varphi_{1}\vee\varphi_{2}¬φ1​∨φ2​ holds and output at position iii the truth value of φ2\varphi_{2}φ2​ from position jjj. The case where φ=φ1Uφ2\varphi=\varphi_{1}\mathbin{\textbf{U}}\varphi_{2}φ=φ1​Uφ2​ is similar using strict past masking and leftmost tie-breaking. ∎

证明概要。

我们由 φ\varphiφ 构造 UHAT T\mathcal{T}T,使得在输入 www 上,它在位置 1≤i≤∣w∣1\leq i\leq|w|1≤i≤∣w∣ 的一个指定分量输出 1 当且仅当 w,i⊨φw,i\models\varphiw,i⊨φ,否则输出 0。然后命题可以用归纳法证明。若 φ\varphiφ 是原子公式或布尔组合,我们很容易定义 T\mathcal{T}T。若 φ=φ1Sφ2\varphi=\varphi_{1}\mathbin{\textbf{S}}\varphi_{2}φ=φ1​Sφ2​,由归纳假设可以假定我们已经在每个位置算出了 φ1\varphi_{1}φ1​ 和 φ2\varphi_{2}φ2​ 的真值,并由此算出 ¬φ1∨φ2\neg\varphi_{1}\vee\varphi_{2}¬φ1​∨φ2​ 的真值。然后我们使用带严格未来掩码和最右平局打破的注意力层,对每个位置 iii 取出满足 ¬φ1∨φ2\neg\varphi_{1}\vee\varphi_{2}¬φ1​∨φ2​ 的最大位置 j<ij<ij<i,并在位置 iii 输出位置 jjj 处 φ2\varphi_{2}φ2​ 的真值。φ=φ1Uφ2\varphi=\varphi_{1}\mathbin{\textbf{U}}\varphi_{2}φ=φ1​Uφ2​ 的情形类似,只需改用严格过去掩码和最左平局打破。∎

We show next that compared to finite automata, UHATs can be even doubly exponentially more succinct. To see this, take the UHAT Tn\mathcal{T}_{n}Tn​ from the proof of Theorem 14 that is of size polynomial in nnn and the smallest accepted word has length at least 22n2^{2^{n}}22n. Since any automaton recognizing a non-empty language accepts a word of length at most linear in the automaton size, the smallest automaton that recognizes the same language as Tn\mathcal{T}_{n}Tn​ has size at least doubly exponential in nnn.

接下来我们说明,与有限自动机相比,UHAT 甚至可以双指数级更简洁。为此,取定理 14 证明中的 UHAT Tn\mathcal{T}_{n}Tn​:它的大小对 nnn 为多项式,且最短被接受词的长度至少为 22n2^{2^{n}}22n。由于任何认出非空语言的自动机都会接受一个长度至多对该自动机大小为线性的词,认出与 Tn\mathcal{T}_{n}Tn​ 相同语言的最小自动机,大小至少对 nnn 为双指数。

Theorem 16.

UHATs can be doubly exponentially more succinct than finite automata.

定理 16。

UHAT 可以比有限自动机双指数级更简洁。

Conversely, the best known construction from counter-free automata (that are equally expressive as LTL) to LTL incurs an exponential blow-up (Maler & Pnueli 1990). Thus, together with Proposition 15, we obtain an exponential-time translation from counter-free automata to UHATs. Note that also the translation in (Yang et al. 2024) from counter-free automata to UHATs increases the size exponentially, when using the results by Maler & Pnueli 1990.

反过来,从与 LTL 表达力相同的无计数自动机到 LTL 的已知最好构造会带来指数膨胀(Maler & Pnueli 1990)。因此,结合命题 15,我们得到从无计数自动机到 UHAT 的指数时间翻译。注意,Yang et al. 2024 中从无计数自动机到 UHAT 的翻译,在使用 Maler & Pnueli 1990 的结果时,大小同样会指数增长。

Finally, we combine Theorem 16 and Proposition 3 to obtain the following succinctness gap between UHATs and RNNs.

最后,我们把定理 16 和命题 3 合在一起,得到 UHAT 与 RNN 之间的如下简洁性间隙。

Corollary 17.

UHATs can be exponentially more succinct than RNNs.

推论 17。

UHAT 可以比 RNN 指数级更简洁。

5 Applications

5 应用

As a consequence of our results, we can show that reasoning about languages of UHATs (e.g. equivalence, emptiness, universality, etc.) is provably intractable. Contrast this to deterministic finite automata, where all these problems can be done in polynomial time (cf. (Kozen 1997)). In the following, we show the precise complexity for the equivalence problem, i.e., the problem of checking whether two given UHATs recognize the same language. That the universality problem is EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-complete can be proven similarly.

作为结果的推论,我们可以证明:对 UHAT 所认语言做推理(例如等价性、空性、全集性等)是可证明难解的。这与确定性有限自动机形成对比,后者的这些问题都可以在多项式时间内完成(参见 Kozen 1997)。下面我们给出等价性问题的精确复杂度,也就是判断两个给定 UHAT 是否认出同一语言。全集性问题是 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-完全的,可以用类似方法证明。

Theorem 18.

Equivalence of UHATs is EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-complete.

定理 18。

UHAT 的等价性是 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-完全的。

Proof.

To prove the lower bound, we reduce from the non-emptiness problem for UHATs, which by Theorem 5 is EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-complete. To this end, let T\mathcal{T}T be a given UHAT and fix a UHAT T0\mathcal{T}_{0}T0​ that recognizes the empty language. Then we have that T\mathcal{T}T and T0\mathcal{T}_{0}T0​ are equivalent if and only if T\mathcal{T}T recognizes the empty language.

证明。

为证下界,我们从 UHAT 的非空性问题做规约,由定理 5 它是 EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-完全的。为此,设 T\mathcal{T}T 是给定的 UHAT,并固定一个认出空语言的 UHAT T0\mathcal{T}_{0}T0​。于是 T\mathcal{T}T 与 T0\mathcal{T}_{0}T0​ 等价,当且仅当 T\mathcal{T}T 认出空语言。

For the upper bound let the UHATs T1\mathcal{T}_{1}T1​ and T2\mathcal{T}_{2}T2​ be given. We apply Proposition 12 to turn T1\mathcal{T}_{1}T1​ and T2\mathcal{T}_{2}T2​ in exponential time into LTL formulas φ1\varphi_{1}φ1​ and φ2\varphi_{2}φ2​, respectively. Now, T1\mathcal{T}_{1}T1​ and T2\mathcal{T}_{2}T2​ are equivalent if and only if φ1\varphi_{1}φ1​ and φ2\varphi_{2}φ2​ are equivalent. The latter can be decided in polynomial space (Sistla & Clarke 1985), which results in an exponential-space algorithm in total. ∎

为证上界,设给定 UHAT T1\mathcal{T}_{1}T1​ 和 T2\mathcal{T}_{2}T2​。我们应用命题 12,在指数时间内把 T1\mathcal{T}_{1}T1​ 和 T2\mathcal{T}_{2}T2​ 分别变成 LTL 公式 φ1\varphi_{1}φ1​ 和 φ2\varphi_{2}φ2​。于是 T1\mathcal{T}_{1}T1​ 与 T2\mathcal{T}_{2}T2​ 等价,当且仅当 φ1\varphi_{1}φ1​ 与 φ2\varphi_{2}φ2​ 等价。后者可以在多项式空间内判定(Sistla & Clarke 1985),总体上得到一个指数空间算法。∎

6 Concluding remarks

6 结束语

Related work.

Our work was inspired by the works of Yang et al. 2024; Barceló et al. 2024; Jerad et al. 2025; Li & Cotterell 2025, which exhibit a close connection between unique-hard attention transformers and star-free regular languages. In particular, these works also exploited the connection to LTL. However, none of these results investigated neither the issue of succinctness nor computational complexity of verification, which we establish in this paper.

相关工作。

我们的工作受到 Yang et al. 2024;Barceló et al. 2024;Jerad et al. 2025;Li & Cotterell 2025 的启发,这些工作展示了唯一硬注意力 Transformer 与星自由正则语言之间的紧密联系。它们尤其也利用了与 LTL 的联系。不过,这些结果都没有研究简洁性,也没有研究验证的计算复杂性,而这正是本文所确立的。

Sälzer et al. 2025 investigated the issue of verifying transformers of various precisions. In particular, it was shown that transformers of fixed precision are at least NEXP{\mathsf{NEXP}}NEXP-hard (i.e. hard for the class of problems solvable by nondeterministic algorithms that run in exponential time). The technique there implies that transformers are (singly) exponentially more succinct than finite automata. However, no conclusion can be derived as to their succinctness relative to representations like LTL or RNN. Our result substantially improve this by showing that transformers are doubly exponentially more succinct than automata, and exponentially more succinct than LTL and RNN. In addition, our work assumes a much simpler model in comparison to the results in (Sälzer et al. 2025). In particular, we use unique-hard attention, whereas in (Sälzer et al. 2025) a combination of softmax and hardmax is employed. Finally, our results use positional masking (as employed in (Yang et al. 2024; Jerad et al. 2025; Li & Cotterell 2025)) — as a simple class of Positional Embeddings (PEs) — in contrast to (Sälzer et al. 2025), which admits arbitrary PEs of fixed precision.

Sälzer et al. 2025 研究了不同精度 Transformer 的验证问题。尤其证明了固定精度 Transformer 至少是 NEXP{\mathsf{NEXP}}NEXP-难的(也就是对可用非确定性指数时间算法求解的问题类是困难的)。那里的技术蕴含 Transformer 比有限自动机(单)指数级更简洁。但是,关于它们相对于 LTL 或 RNN 这类表示的简洁性,得不出结论。我们的结果对此有实质改进:证明 Transformer 比自动机双指数级更简洁,比 LTL 和 RNN 指数级更简洁。此外,与 Sälzer et al. 2025 的结果相比,我们假定的模型简单得多。我们使用唯一硬注意力,而 Sälzer et al. 2025 使用 softmax 与 hardmax 的组合。最后,我们的结果使用位置掩码(与 Yang et al. 2024;Jerad et al. 2025;Li & Cotterell 2025 相同)——作为一类简单的位置嵌入(PE)——这与 Sälzer et al. 2025 允许任意固定精度 PE 形成对比。

Succinctness has also been studied in the context of linguistics. For example, according to Zipf’s law of abbreviation (Zipf 1935), frequently occuring concepts tend to have a succinct description. In particular, Hindu-Arabic numeral system — which evolves into our modern numeral system — allows an exponentially more succinct description than the Roman numeral system. According to Zipf’s law, the former potentially enables mathematics and computer science as we see today.

简洁性在语言学语境里也被研究过。例如,按照齐普夫的缩写定律(Zipf 1935),频繁出现的概念往往有更简洁的描述。尤其是印度-阿拉伯数字系统——它演变成我们今天的数字系统——允许比罗马数字系统指数级更简洁的描述。按照齐普夫定律,前者或许才使今天所见的数学与计算机科学成为可能。

Future work.

We mention the challenge of developing an automatic tool for analyzing, verifying, and explaining transformers. More broadly, this is an important problem for explainable AI, as thoroughly described in the survey (Huang et al. 2020). In particular, lots of practical advances have been made on verifying feed-forward neural networks (but not transformers) and some practical tools have been developed in the last decade (see also the results of the most recent annual VNN competition (Brix et al. 2024)). Despite the rather high complexity (EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-complete), we pose as a challenge to exploit techniques from automated verification (Clarke et al. 2018) (e.g. symbolic techniques, simulation, etc.) to verify transformers in practice.

未来工作。

我们提出一项挑战:开发用于分析、验证和解释 Transformer 的自动工具。更广泛地说,这对可解释人工智能是一个重要问题,Huang et al. 2020 的综述对此有详尽说明。尤其是,过去十年在验证前馈神经网络(但不是 Transformer)上已有许多实践进展,也开发了一些实用工具(另见最近一届年度 VNN 竞赛的结果,Brix et al. 2024)。尽管最坏复杂度相当高(EXPSPACE{\mathsf{EXPSPACE}}EXPSPACE-完全),我们仍把“把自动验证中的技术(Clarke et al. 2018),例如符号方法、模拟等,用到实践中的 Transformer 验证上”写成一项挑战。

Acknowledgments

We thank David Chiang, Marco Sälzer, and Andy Yang for helpful discussions. Pascal Bergsträßer and Anthony W. Lin are supported by Deutsche Forschungsgemeinschaft (grant number 522843867) and European Research Council (grant number 101089343).

致谢

我们感谢 David Chiang、Marco Sälzer 和 Andy Yang 的有益讨论。Pascal Bergsträßer 和 Anthony W. Lin 得到 Deutsche Forschungsgemeinschaft(项目号 522843867)以及 European Research Council(项目号 101089343)的资助。

References

参考文献

Barceló et al. (2024) Pablo Barceló, Alexander Kozachinskiy, Anthony Widjaja Lin, and Vladimir V. Podolskii. Logical languages accepted by transformer encoders with hard attention. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024 . OpenReview.net, 2024. URL https://openreview.net/forum?id=gbrHZq07mq .

Bergsträßer et al. (2024) Pascal Bergsträßer, Chris Köcher, Anthony Widjaja Lin, and Georg Zetzsche. The power of hard attention transformers on data sequences: A formal language theoretic perspective. In Amir Globersons, Lester Mackey, Danielle Belgrave, Angela Fan, Ulrich Paquet, Jakub M. Tomczak, and Cheng Zhang (eds.), Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems 2024, NeurIPS 2024, Vancouver, BC, Canada, December 10 - 15, 2024 , 2024. URL https://proceedings.neurips.cc/paper_files/paper/2024/file/af58a33861ac45472ea1cc5860d2b13e-Paper-Conference.pdf .

Brix et al. (2024) Christopher Brix, Stanley Bak, Taylor T. Johnson, and Haoze Wu. The fifth international verification of neural networks competition (vnn-comp 2024): Summary and results, 2024. URL https://arxiv.org/abs/2412.19985 .

Chiang & Cholak (2022) David Chiang and Peter Cholak. Overcoming a theoretical limitation of self-attention. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio (eds.), Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2022, Dublin, Ireland, May 22-27, 2022 , pp. 7654–7664. Association for Computational Linguistics, 2022. doi: 10.18653/V1/2022.ACL-LONG.527 . URL https://doi.org/10.18653/v1/2022.acl-long.527 .

Clarke et al. (2018) E.M. Clarke, O. Grumberg, D. Kroening, D. Peled, and H. Veith. Model Checking, second edition . Cyber Physical Systems Series. MIT Press, 2018. ISBN 9780262038836. URL https://books.google.de/books?id=ps-MEAAAQBAJ .

Grohe & Schweikardt (2004) Martin Grohe and Nicole Schweikardt. The succinctness of first-order logic on linear orders. In 19th IEEE Symposium on Logic in Computer Science (LICS 2004), 14-17 July 2004, Turku, Finland, Proceedings , pp. 438–447. IEEE Computer Society, 2004. doi: 10.1109/LICS.2004.1319638 . URL https://doi.org/10.1109/LICS.2004.1319638 .

Gu & Dao (2023) Albert Gu and Tri Dao. Mamba: Linear-time sequence modeling with selective state spaces. CoRR , abs/2312.00752, 2023. doi: 10.48550/ARXIV.2312.00752 . URL https://doi.org/10.48550/arXiv.2312.00752 .

Hahn (2020) Michael Hahn. Theoretical limitations of self-attention in neural sequence models. Trans. Assoc. Comput. Linguistics , 8:156–171, 2020. doi: 10.1162/TACL“˙A“˙00306 . URL https://doi.org/10.1162/tacl_a_00306 .

Hao et al. (2022) Yiding Hao, Dana Angluin, and Robert Frank. Formal language recognition by hard attention transformers: Perspectives from circuit complexity. Trans. Assoc. Comput. Linguistics , 10:800–810, 2022. doi: 10.1162/TACL“˙A“˙00490 . URL https://doi.org/10.1162/tacl_a_00490 .

Huang et al. (2020) Xiaowei Huang, Daniel Kroening, Wenjie Ruan, James Sharp, Youcheng Sun, Emese Thamo, Min Wu, and Xinping Yi. A survey of safety and trustworthiness of deep neural networks: Verification, testing, adversarial attack and defence, and interpretability. Computer Science Review , 37:100270, 2020. ISSN 1574-0137. doi: https://doi.org/10.1016/j.cosrev.2020.100270 . URL https://www.sciencedirect.com/science/article/pii/S1574013719302527 .

Huang et al. (2025) Xinting Huang, Andy Yang, Satwik Bhattamishra, Yash Raj Sarrof, Andreas Krebs, Hattie Zhou, Preetum Nakkiran, and Michael Hahn. A formal framework for understanding length generalization in transformers. In The Thirteenth International Conference on Learning Representations, ICLR 2025, Singapore, April 24-28, 2025 . OpenReview.net, 2025. URL https://openreview.net/forum?id=U49N5V51rU .

Jerad et al. (2025) Selim Jerad, Anej Svete, Jiaoda Li, and Ryan Cotterell. Unique hard attention: A tale of two sides. In Wanxiang Che, Joyce Nabende, Ekaterina Shutova, and Mohammad Taher Pilehvar (eds.), Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), ACL 2025, Vienna, Austria, July 27 - August 1, 2025 , pp. 977–996. Association for Computational Linguistics, 2025. doi: 10.18653/V1/2025.ACL-SHORT.76 . URL https://doi.org/10.18653/v1/2025.acl-short.76 .

Kozen (1997) Dexter Kozen. Automata and computability . Undergraduate texts in computer science. Springer, 1997. ISBN 978-0-387-94907-9. doi: 10.1007/978-1-4612-1844-9 .

Li & Cotterell (2025) Jiaoda Li and Ryan Cotterell. Characterizing the expressivity of transformer language models. CoRR , abs/2505.23623, 2025. doi: 10.48550/ARXIV.2505.23623 . URL https://doi.org/10.48550/arXiv.2505.23623 .

Libkin (2004) Leonid Libkin. Elements of finite model theory , volume 41. Springer, 2004.

Maler & Pnueli (1990) Oded Maler and Amir Pnueli. Tight bounds on the complexity of cascaded decomposition of automata. In 31st Annual Symposium on Foundations of Computer Science, St. Louis, Missouri, USA, October 22-24, 1990, Volume II , pp. 672–682. IEEE Computer Society, 1990. doi: 10.1109/FSCS.1990.89589 . URL https://doi.org/10.1109/FSCS.1990.89589 .

McNaughton & Papert (1971) Robert McNaughton and Seymour Papert. Counter‐free Automata . M.I.T. Press, Cambridge, Mass., 1971. ISBN 0262130769.

Merrill et al. (2020) William Merrill, Gail Weiss, Yoav Goldberg, Roy Schwartz, Noah A. Smith, and Eran Yahav. A formal hierarchy of RNN architectures. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault (eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020 , pp. 443–459. Association for Computational Linguistics, 2020. doi: 10.18653/V1/2020.ACL-MAIN.43 . URL https://doi.org/10.18653/v1/2020.acl-main.43 .

Merrill et al. (2024) William Merrill, Jackson Petty, and Ashish Sabharwal. The illusion of state in state-space models. In Forty-first International Conference on Machine Learning, ICML 2024, Vienna, Austria, July 21-27, 2024 . OpenReview.net, 2024. URL https://openreview.net/forum?id=QZgo9JZpLq .

Pérez et al. (2021) Jorge Pérez, Pablo Barceló, and Javier Marinkovic. Attention is turing-complete. J. Mach. Learn. Res. , 22:75:1–75:35, 2021. URL https://jmlr.org/papers/v22/20-302.html .

Pnueli (1977) Amir Pnueli. The temporal logic of programs. In 18th Annual Symposium on Foundations of Computer Science (SFCS 1977) , pp. 46–57, 1977. doi: 10.1109/SFCS.1977.32 . URL https://doi.org/10.1109/SFCS.1977.32 .

Sälzer et al. (2025) Marco Sälzer, Eric Alsmann, and Martin Lange. Transformer encoder satisfiability: Complexity and impact on formal reasoning. In The Thirteenth International Conference on Learning Representations, ICLR 2025, Singapore, April 24-28, 2025 . OpenReview.net, 2025. URL https://openreview.net/forum?id=VVO3ApdMUE .

Schwarzentruber (2019) François Schwarzentruber. The complexity of tiling problems. CoRR , abs/1907.00102, 2019. URL http://arxiv.org/abs/1907.00102 .

Siegelmann & Sontag (1995) Hava T. Siegelmann and Eduardo D. Sontag. On the computational power of neural nets. J. Comput. Syst. Sci. , 50(1):132–150, 1995. doi: 10.1006/JCSS.1995.1013 . URL https://doi.org/10.1006/jcss.1995.1013 .

Sipser (1997) Michael Sipser. Introduction to the theory of computation . PWS Publishing Company, 1997. ISBN 978-0-534-94728-6.

Sistla & Clarke (1985) A. Prasad Sistla and Edmund M. Clarke. The complexity of propositional linear temporal logics. J. ACM , 32(3):733–749, 1985. doi: 10.1145/3828.3837 . URL https://doi.org/10.1145/3828.3837 .

Stockmeyer (1974) Larry Joseph Stockmeyer. The complexity of decision problems in automata theory and logic . PhD thesis, Massachusetts Institute of Technology, 1974.

Straubing (1994) Howard Straubing. Finite Automata, Formal Logic, and Circuit Complexity . Progress in Theoretical Computer Science. Birkhäuser Boston, MA, 1 edition, 1994. ISBN 978-0-8176-3719-4. doi: 10.1007/978-1-4612-0289-9 . URL https://doi.org/10.1007/978-1-4612-0289-9 .

Strobl et al. (2024) Lena Strobl, William Merrill, Gail Weiss, David Chiang, and Dana Angluin. What formal languages can transformers express? A survey. Trans. Assoc. Comput. Linguistics , 12:543–561, 2024. doi: 10.1162/TACL“˙A“˙00663 . URL https://doi.org/10.1162/tacl_a_00663 .

van Emde Boas (1997) Peter van Emde Boas. The convenience of tilings. In Complexity, Logic, and Recursion Theory , pp. 331–363. CRC Press, 1997. doi: 10.1201/9780429187490 . URL https://doi.org/10.1201/9780429187490 .

Vardi & Wolper (1994) Moshe Y. Vardi and Pierre Wolper. Reasoning about infinite computations. Inf. Comput. , 115(1):1–37, 1994. doi: 10.1006/INCO.1994.1092 . URL https://doi.org/10.1006/inco.1994.1092 .

Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA , pp. 5998–6008, 2017. URL https://proceedings.neurips.cc/paper/2017/hash/3f5ee243547dee91fbd053c1c4a845aa-Abstract.html .

Weiss et al. (2018) Gail Weiss, Yoav Goldberg, and Eran Yahav. On the practical computational power of finite precision rnns for language recognition. In Iryna Gurevych and Yusuke Miyao (eds.), Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 2: Short Papers , pp. 740–745. Association for Computational Linguistics, 2018. doi: 10.18653/V1/P18-2117 . URL https://aclanthology.org/P18-2117/ .

Weiss et al. (2024) Gail Weiss, Yoav Goldberg, and Eran Yahav. Extracting automata from recurrent neural networks using queries and counterexamples (extended version). Mach. Learn. , 113(5):2877–2919, 2024. doi: 10.1007/S10994-022-06163-2 . URL https://doi.org/10.1007/s10994-022-06163-2 .

Yang et al. (2024) Andy Yang, David Chiang, and Dana Angluin. Masked hard-attention transformers recognize exactly the star-free languages. In Amir Globersons, Lester Mackey, Danielle Belgrave, Angela Fan, Ulrich Paquet, Jakub M. Tomczak, and Cheng Zhang (eds.), Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems 2024, NeurIPS 2024, Vancouver, BC, Canada, December 10 - 15, 2024 , 2024. URL http://papers.nips.cc/paper_files/paper/2024/hash/13d7f172259b11b230cc5da8768abc5f-Abstract-Conference.html .

Zhou et al. (2024) Hattie Zhou, Arwen Bradley, Etai Littwin, Noam Razin, Omid Saremi, Joshua M. Susskind, Samy Bengio, and Preetum Nakkiran. What algorithms can transformers learn? A study in length generalization. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024 . OpenReview.net, 2024. URL https://openreview.net/forum?id=AssIuHnmHX .

Zipf (1935) George Kingsley Zipf. The Psychobiology of Language: An Introduction to Dynamic Philology . Houghton Mifflin, Boston, MA, 1935.

Appendix A Proofs from Section 3

附录 A 第 3 节的证明

A.1 Proof of Proposition 6

A.1 命题 6 的证明

We reduce the 2n2^{n}2n-tiling problem to the non-emptiness problem for B-RASP. To this end, we use the following encoding of the function τ\tauτ as a word over the alphabet Σ:=T∪{0,1,#}\Sigma:=T\cup\{0,1,\#\}Σ:=T∪{0,1,#}. We define encτ ⁣:{1,…,2n}×{1,…,m}→Σ∗\mathit{enc}_{\tau}\colon\{1,\dots,2^{n}\}\times\{1,\dots,m\}\to\Sigma^{*}encτ​:{1,…,2n}×{1,…,m}→Σ∗ such that

我们把 2n2^{n}2n-铺砖问题规约到 B-RASP 的非空性问题。为此,我们使用函数 τ\tauτ 在字母表 Σ:=T∪{0,1,#}\Sigma:=T\cup\{0,1,\#\}Σ:=T∪{0,1,#} 上的如下编码。我们定义 encτ ⁣:{1,…,2n}×{1,…,m}→Σ∗\mathit{enc}_{\tau}\colon\{1,\dots,2^{n}\}\times\{1,\dots,m\}\to\Sigma^{*}encτ​:{1,…,2n}×{1,…,m}→Σ∗,使得

encτ(i,j):=⟨i−1⟩τ(i,j)#\mathit{enc}_{\tau}(i,j):=\langle i-1\rangle\tau(i,j)\#encτ​(i,j):=⟨i−1⟩τ(i,j)#

for all i∈[1,2n]i\in[1,2^{n}]i∈[1,2n] and j∈[1,m]j\in[1,m]j∈[1,m], where ⟨i−1⟩\langle i-1\rangle⟨i−1⟩ denotes the binary encoding of i−1i-1i−1 with nnn bits and most significant bit first. Then

对所有 i∈[1,2n]i\in[1,2^{n}]i∈[1,2n] 和 j∈[1,m]j\in[1,m]j∈[1,m] 成立,其中 ⟨i−1⟩\langle i-1\rangle⟨i−1⟩ 表示 i−1i-1i−1 的 nnn 比特二进制编码,最高有效位在前。于是

enc(τ):=encτ(1,1)…encτ(2n,1)encτ(2,1)…encτ(m,2n).\mathit{enc}(\tau):=\mathit{enc}_{\tau}(1,1)\dots\mathit{enc}_{\tau}(2^{n},1)\mathit{enc}_{\tau}(2,1)\dots\mathit{enc}_{\tau}(m,2^{n}).enc(τ):=encτ​(1,1)…encτ​(2n,1)encτ​(2,1)…encτ​(m,2n).

We construct a B-RASP program that accepts enc(τ)\mathit{enc}(\tau)enc(τ) if and only if τ\tauτ satisfies the conditions above.

我们构造一个 B-RASP 程序,它接受 enc(τ)\mathit{enc}(\tau)enc(τ) 当且仅当 τ\tauτ 满足上述条件。

Let n>0n>0n>0, a finite set TTT of tiles, and tfin∈Tt_{\mathit{fin}}\in Ttfin​∈T be given. The B-RASP program first checks whether the input is a word from ({0,1}nT#)∗(\{0,1\}^{n}T\#)^{*}({0,1}nT#)∗ using the following Boolean vectors:

给定 n>0n>0n>0、有限砖集 TTT 以及 tfin∈Tt_{\mathit{fin}}\in Ttfin​∈T。B-RASP 程序首先用下列布尔向量检查输入是否属于 ({0,1}nT#)∗(\{0,1\}^{n}T\#)^{*}({0,1}nT#)∗:

AT(i):= ▶j[j<i,1] ⋁t∈TQt(j):0AC,1(i):= ▶j[j<i,1] Q0(j)∨Q1(j):0AC,k(i):= ▶j[j<i,1] AC,k−1(j):0for k=2,…,nA#,1(i):= ▶j[j<i,1] Q#(j):1A#,k(i):= ▶j[j<i,1] A#,k−1(j):1for k=2,…,n+1Aenc(i):= (Q#(i)→AT(i))∧((⋁t∈TQt(i))→(⋀k=1nAC,k(i))∧A#,n+1(i))\displaystyle A_{T}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,1]\ \bigvee_{t\in T}Q_{t}(j):0 \\ \displaystyle A_{C,1}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,1]\ Q_{0}(j)\vee Q_{1}(j):0 \\ \displaystyle A_{C,k}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,1]\ A_{C,k-1}(j):0\qquad\text{for }k=2,\dots,n \\ \displaystyle A_{\#,1}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,1]\ Q_{\#}(j):1 \\ \displaystyle A_{\#,k}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,1]\ A_{\#,k-1}(j):1\qquad\text{for }k=2,\dots,n+1 \\ \displaystyle A_{\mathit{enc}}(i):= \\ \displaystyle\ \big(Q_{\#}(i)\to A_{T}(i)\big)\wedge\Big(\big(\bigvee_{t\in T}Q_{t}(i)\big)\to\big(\bigwedge_{k=1}^{n}A_{C,k}(i)\big)\wedge A_{\#,n+1}(i)\Big)AT​(i):= ▶j​[j<i,1] t∈T⋁​Qt​(j):0AC,1​(i):= ▶j​[j<i,1] Q0​(j)∨Q1​(j):0AC,k​(i):= ▶j​[j<i,1] AC,k−1​(j):0for k=2,…,nA#,1​(i):= ▶j​[j<i,1] Q#​(j):1A#,k​(i):= ▶j​[j<i,1] A#,k−1​(j):1for k=2,…,n+1Aenc​(i):= (Q#​(i)→AT​(i))∧((t∈T⋁​Qt​(i))→(k=1⋀n​AC,k​(i))∧A#,n+1​(i))

We use the vector

我们使用向量

A(i):= ▶j[j<i,¬Aenc(j)] 0:Aenc(i)A(i):=\ \blacktriangleright_{j}[j<i,\neg A_{\mathit{enc}}(j)]\ 0:A_{\mathit{enc}}(i)A(i):= ▶j​[j<i,¬Aenc​(j)] 0:Aenc​(i)

to check that Aenc(i)=1A_{\mathit{enc}}(i)=1Aenc​(i)=1 at every position iii, which is the case if and only if A(ℓ)=1A(\ell)=1A(ℓ)=1 where ℓ\ellℓ is the length of the input. Note that we still have to check that the symbol at position ℓ\ellℓ is #\##. But before that, we ensure that for every two consecutive binary numbers separated by #\## the encoded value increases by 1 or is set to 0 if 2n−12^{n}-12n−1 is reached.

来检查在每个位置 iii 都有 Aenc(i)=1A_{\mathit{enc}}(i)=1Aenc​(i)=1,这成立当且仅当 A(ℓ)=1A(\ell)=1A(ℓ)=1,其中 ℓ\ellℓ 是输入长度。注意我们仍需检查位置 ℓ\ellℓ 处的符号是 #\##。但在此之前,我们先保证:被 #\## 隔开的每两个相继二进制数,其编码值增加 1,或者在达到 2n−12^{n}-12n−1 时被置为 0。

C1(i):= ▶j[j<i,Q0(j)∨Q1(j)] Q1(j):0Ck(i):= ▶j[j<i,Q0(j)∨Q1(j)] Ck−1(j):0for k=2,…,nC+1(i):= ▶j[j<i,Q#(j)] ⋁k=1n(⋀r=1k−1¬Cr(i)∧Cr(j))∧Ck(i)∧¬Ck(j) ∧ (⋀r=k+1nCr(i)↔Cr(j)):0C1→0(i):= ▶j[j<i,Q#(j)] ⋀k=1n¬Ck(i)∧Ck(j):⋀k=1n¬Ck(i)C(i):= ▶j[j<i,Q#(j)∧¬C1→0(j)∧¬C+1(j)] 0:C1→0(i)∧C+1(i)\displaystyle C_{1}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{0}(j)\vee Q_{1}(j)]\ Q_{1}(j):0 \\ \displaystyle C_{k}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{0}(j)\vee Q_{1}(j)]\ C_{k-1}(j):0\qquad\text{for }k=2,\dots,n \\ \displaystyle C_{+1}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{\#}(j)]\ \bigvee_{k=1}^{n}\big(\bigwedge_{r=1}^{k-1}\neg C_{r}(i)\wedge C_{r}(j)\big)\wedge C_{k}(i)\wedge\neg C_{k}(j)\ \wedge \\ \displaystyle\ \big(\bigwedge_{r=k+1}^{n}C_{r}(i)\leftrightarrow C_{r}(j)\big):0 \\ \displaystyle C_{1\to 0}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{\#}(j)]\ \bigwedge_{k=1}^{n}\neg C_{k}(i)\wedge C_{k}(j):\bigwedge_{k=1}^{n}\neg C_{k}(i) \\ \displaystyle C(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{\#}(j)\wedge\neg C_{1\to 0}(j)\wedge\neg C_{+1}(j)]\ 0:C_{1\to 0}(i)\wedge C_{+1}(i)C1​(i):= ▶j​[j<i,Q0​(j)∨Q1​(j)] Q1​(j):0Ck​(i):= ▶j​[j<i,Q0​(j)∨Q1​(j)] Ck−1​(j):0for k=2,…,nC+1​(i):= ▶j​[j<i,Q#​(j)] k=1⋁n​(r=1⋀k−1​¬Cr​(i)∧Cr​(j))∧Ck​(i)∧¬Ck​(j) ∧ (r=k+1⋀n​Cr​(i)↔Cr​(j)):0C1→0​(i):= ▶j​[j<i,Q#​(j)] k=1⋀n​¬Ck​(i)∧Ck​(j):k=1⋀n​¬Ck​(i)C(i):= ▶j​[j<i,Q#​(j)∧¬C1→0​(j)∧¬C+1​(j)] 0:C1→0​(i)∧C+1​(i)

Now, C(ℓ)=1C(\ell)=1C(ℓ)=1 if and only if the binary numbers are as required.

现在,C(ℓ)=1C(\ell)=1C(ℓ)=1 当且仅当这些二进制数符合要求。

Next, we check that the input ends with 1ntfin#1^{n}t_{\mathit{fin}}\#1ntfin​#.

接下来,我们检查输入以 1ntfin#1^{n}t_{\mathit{fin}}\#1ntfin​# 结尾。

Bt(i):= ▶j[j<i,⋁t′∈TQt′(j)] Qt(j):0for all t∈TF(i):= Q#(i)∧Btfin(i)∧⋀k=1nCk(i)\displaystyle B_{t}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,\bigvee_{t^{\prime}\in T}Q_{t^{\prime}}(j)]\ Q_{t}(j):0\qquad\text{for all }t\in T \\ \displaystyle F(i):= \\ \displaystyle\ Q_{\#}(i)\wedge B_{t_{\mathit{fin}}}(i)\wedge\bigwedge_{k=1}^{n}C_{k}(i)Bt​(i):= ▶j​[j<i,t′∈T⋁​Qt′​(j)] Qt​(j):0for all t∈TF(i):= Q#​(i)∧Btfin​​(i)∧k=1⋀n​Ck​(i)

Then F(ℓ)=1F(\ell)=1F(ℓ)=1 if and only if the input ends with 1ntfin#1^{n}t_{\mathit{fin}}\#1ntfin​#.

于是 F(ℓ)=1F(\ell)=1F(ℓ)=1 当且仅当输入以 1ntfin#1^{n}t_{\mathit{fin}}\#1ntfin​# 结尾。

We continue by verifying conditions 2 and 3 of τ\tauτ.

我们继续验证 τ\tauτ 的条件 2 和 3。

E⊥(i):= ▶j[j<i,Q#(j)∧⋀k=1nCk(i)↔Ck(j)] 1:⋁t∈T ⁣:down(t)=0Bt(i)E⊤(i):= ▶j[j<i,Q#(j)∧((⋁t∈T ⁣:up(t)≠0Bt(j))∨⋀k=1n¬Ck(j))] (⋁t∈T ⁣:up(t)=0Bt(j)) ∧ (⋁t∈T ⁣:up(t)=0Bt(i)):0E⊢(i):= (⋀k=1n¬Ck(i))→(⋁t∈T ⁣:left(t)=0Bt(i))E⊣(i):= (⋀k=1nCk(i))→(⋁t∈T ⁣:right(t)=0Bt(i))E(i):= ▶j[j<i,Q#(j)∧¬(E⊥(j)∧E⊢(j)∧E⊣(j))] 0:E⊥(i)∧E⊤(i)∧E⊢(i)∧E⊣(i)\displaystyle E_{\bot}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{\#}(j)\wedge\bigwedge_{k=1}^{n}C_{k}(i)\leftrightarrow C_{k}(j)]\ 1:\bigvee_{t\in T\colon\mathit{down}(t)=0}B_{t}(i) \\ \displaystyle E_{\top}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{\#}(j)\wedge\big((\bigvee_{t\in T\colon\mathit{up}(t)\neq 0}B_{t}(j))\vee\bigwedge_{k=1}^{n}\neg C_{k}(j)\big)]\ \big(\bigvee_{t\in T\colon\mathit{up}(t)=0}B_{t}(j)\big)\ \wedge \\ \displaystyle\ \big(\bigvee_{t\in T\colon\mathit{up}(t)=0}B_{t}(i)\big):0 \\ \displaystyle E_{\vdash}(i):= \\ \displaystyle\ \big(\bigwedge_{k=1}^{n}\neg C_{k}(i)\big)\to\big(\bigvee_{t\in T\colon\mathit{left}(t)=0}B_{t}(i)\big) \\ \displaystyle E_{\dashv}(i):= \\ \displaystyle\ \big(\bigwedge_{k=1}^{n}C_{k}(i)\big)\to\big(\bigvee_{t\in T\colon\mathit{right}(t)=0}B_{t}(i)\big) \\ \displaystyle E(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{\#}(j)\wedge\neg(E_{\bot}(j)\wedge E_{\vdash}(j)\wedge E_{\dashv}(j))]\ 0:E_{\bot}(i)\wedge E_{\top}(i)\wedge E_{\vdash}(i)\wedge E_{\dashv}(i)E⊥​(i):= ▶j​[j<i,Q#​(j)∧k=1⋀n​Ck​(i)↔Ck​(j)] 1:t∈T:down(t)=0⋁​Bt​(i)E⊤​(i):= ▶j​[j<i,Q#​(j)∧((t∈T:up(t)=0⋁​Bt​(j))∨k=1⋀n​¬Ck​(j))] (t∈T:up(t)=0⋁​Bt​(j)) ∧ (t∈T:up(t)=0⋁​Bt​(i)):0E⊢​(i):= (k=1⋀n​¬Ck​(i))→(t∈T:left(t)=0⋁​Bt​(i))E⊣​(i):= (k=1⋀n​Ck​(i))→(t∈T:right(t)=0⋁​Bt​(i))E(i):= ▶j​[j<i,Q#​(j)∧¬(E⊥​(j)∧E⊢​(j)∧E⊣​(j))] 0:E⊥​(i)∧E⊤​(i)∧E⊢​(i)∧E⊣​(i)

Now, conditions 2 and 3 hold if and only if E(ℓ)=1E(\ell)=1E(ℓ)=1.

现在,条件 2 和 3 成立当且仅当 E(ℓ)=1E(\ell)=1E(ℓ)=1。

Finally, we ensure that conditions 4 and 5 are satisfied.

最后,我们确保条件 4 和 5 成立。

M↓(i):= ▶j[j<i,Q#(j)∧⋀k=1nCk(i)↔Ck(j)] ⋁t,t′∈T ⁣:down(t)=up(t′)Bt(i)∧Bt′(j):1M←(i):= ▶j[j<i,Q#(j)] (⋁k=1nCk(i))→(⋁t,t′∈T ⁣:left(t)=right(t′)Bt(i)∧Bt′(j)):1M(i):= ▶j[j<i,Q#(j)∧¬(M↓(j)∧M←(j))] 0:M↓(i)∧M←(i)\displaystyle M_{\downarrow}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{\#}(j)\wedge\bigwedge_{k=1}^{n}C_{k}(i)\leftrightarrow C_{k}(j)]\ \bigvee_{t,t^{\prime}\in T\colon\mathit{down}(t)=\mathit{up}(t^{\prime})}B_{t}(i)\wedge B_{t^{\prime}}(j):1 \\ \displaystyle M_{\leftarrow}(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{\#}(j)]\ \big(\bigvee_{k=1}^{n}C_{k}(i)\big)\to\big(\bigvee_{t,t^{\prime}\in T\colon\mathit{left}(t)=\mathit{right}(t^{\prime})}B_{t}(i)\wedge B_{t^{\prime}}(j)\big):1 \\ \displaystyle M(i):= \\ \displaystyle\ \blacktriangleright_{j}[j<i,Q_{\#}(j)\wedge\neg(M_{\downarrow}(j)\wedge M_{\leftarrow}(j))]\ 0:M_{\downarrow}(i)\wedge M_{\leftarrow}(i)M↓​(i):= ▶j​[j<i,Q#​(j)∧k=1⋀n​Ck​(i)↔Ck​(j)] t,t′∈T:down(t)=up(t′)⋁​Bt​(i)∧Bt′​(j):1M←​(i):= ▶j​[j<i,Q#​(j)] (k=1⋁n​Ck​(i))→(t,t′∈T:left(t)=right(t′)⋁​Bt​(i)∧Bt′​(j)):1M(i):= ▶j​[j<i,Q#​(j)∧¬(M↓​(j)∧M←​(j))] 0:M↓​(i)∧M←​(i)

Then M(ℓ)=1M(\ell)=1M(ℓ)=1 if and only if conditions 4 and 5 hold.

于是 M(ℓ)=1M(\ell)=1M(ℓ)=1 当且仅当条件 4 和 5 成立。

Thus, if we define the output vector to be the conjunction

因此,如果把输出向量定义为合取

Y(i):=A(i)∧C(i)∧F(i)∧E(i)∧M(i)Y(i):=A(i)\wedge C(i)\wedge F(i)\wedge E(i)\wedge M(i)Y(i):=A(i)∧C(i)∧F(i)∧E(i)∧M(i)

and say that the B-RASP program accepts if and only if Y(ℓ)=1Y(\ell)=1Y(ℓ)=1, then the B-RASP program recognizes the set of all enc(τ)\mathit{enc}(\tau)enc(τ) where τ\tauτ satisfies the conditions above. Hence, the language recognized by the B-RASP program is non-empty if and only if the 2n2^{n}2n-tiling problem has a solution.

并规定 B-RASP 程序接受当且仅当 Y(ℓ)=1Y(\ell)=1Y(ℓ)=1,那么该 B-RASP 程序认出所有满足上述条件的 enc(τ)\mathit{enc}(\tau)enc(τ)。因此,该 B-RASP 程序认出的语言非空,当且仅当 2n2^{n}2n-铺砖问题有解。

A.2 Proof of Lemma 9

A.2 引理 9 的证明

As affine transformations AAA and BBB we use the identity, i.e.,

作为仿射变换 AAA 和 BBB,我们使用恒等变换,即

S(vi,vj):=⟨vi,vj⟩=∑r=1d(bi,rbj,r+(1−bi,r)(1−bj,r))S(\bm{v}_{i},\bm{v}_{j}):=\langle\bm{v}_{i},\bm{v}_{j}\rangle=\sum_{r=1}^{d}\big(b_{i,r}b_{j,r}+(1-b_{i,r})(1-b_{j,r})\big)S(vi​,vj​):=⟨vi​,vj​⟩=r=1∑d​(bi,r​bj,r​+(1−bi,r​)(1−bj,r​))

which is equal to ∣{r∈[1,d]∣bi,r=bj,r}∣|\{r\in[1,d]\mid b_{i,r}=b_{j,r}\}|∣{r∈[1,d]∣bi,r​=bj,r​}∣ since

它等于 ∣{r∈[1,d]∣bi,r=bj,r}∣|\{r\in[1,d]\mid b_{i,r}=b_{j,r}\}|∣{r∈[1,d]∣bi,r​=bj,r​}∣,因为

$$b_{i,r}b_{j,r}+(1-b_{i,r})(1-b_{j,r})=\begin{cases}1,&\text{if }b_{i,r}=b_{j,r}\
0,&\text{otherwise.}\end{cases}$$

Thus, the score is maximized (equal to ddd) if bi,r=bj,rb_{i,r}=b_{j,r}bi,r​=bj,r​ for all r∈[1,d]r\in[1,d]r∈[1,d].

因此,若对所有 r∈[1,d]r\in[1,d]r∈[1,d] 都有 bi,r=bj,rb_{i,r}=b_{j,r}bi,r​=bj,r​,则分数取到最大值(等于 ddd)。

A.3 Proof of Proposition 12

A.3 命题 12 的证明

Let T\mathcal{T}T be a UHAT that recognizes a language L⊆Σ∗L\subseteq\Sigma^{*}L⊆Σ∗ and FFF be a set of binary representations of rational numbers that may occur during the computation of T\mathcal{T}T from Proposition 11. Our goal is to define for the ℓ\ellℓ-th layer of T\mathcal{T}T and every vector v∈Fs\bm{v}\in F^{s}v∈Fs, where sss is the output dimension of layer ℓ\ellℓ, an LTL formula φvℓ\varphi_{\bm{v}}^{\ell}φvℓ​ such that if T\mathcal{T}T is applied on input w∈Σw\in\Sigmaw∈Σ, then the ℓ\ellℓ-th layer outputs at position i∈[1,∣w∣]i\in[1,|w|]i∈[1,∣w∣] the vector v\bm{v}v if and only if w,i⊨φvℓw,i\models\varphi_{\bm{v}}^{\ell}w,i⊨φvℓ​. We define this formula inductively on the layer number ℓ\ellℓ. Let emb ⁣:Σ→(Qd)∗\mathit{emb}\colon\Sigma\to(\mathbb{Q}^{d})^{*}emb:Σ→(Qd)∗ be the token embedding of T\mathcal{T}T. For all v∈Fd\bm{v}\in F^{d}v∈Fd let

设 T\mathcal{T}T 是认出语言 L⊆Σ∗L\subseteq\Sigma^{*}L⊆Σ∗ 的 UHAT,并设 FFF 是命题 11 中、可能在 T\mathcal{T}T 的计算中出现的有理数的二进制表示集合。我们的目标是:对 T\mathcal{T}T 的第 ℓ\ellℓ 层以及每个向量 v∈Fs\bm{v}\in F^{s}v∈Fs(其中 sss 是第 ℓ\ellℓ 层的输出维数)定义一个 LTL 公式 φvℓ\varphi_{\bm{v}}^{\ell}φvℓ​,使得若把 T\mathcal{T}T 作用在输入 w∈Σw\in\Sigmaw∈Σ 上,则第 ℓ\ellℓ 层在位置 i∈[1,∣w∣]i\in[1,|w|]i∈[1,∣w∣] 输出向量 v\bm{v}v,当且仅当 w,i⊨φvℓw,i\models\varphi_{\bm{v}}^{\ell}w,i⊨φvℓ​。我们按层号 ℓ\ellℓ 归纳定义这一公式。设 emb ⁣:Σ→(Qd)∗\mathit{emb}\colon\Sigma\to(\mathbb{Q}^{d})^{*}emb:Σ→(Qd)∗ 是 T\mathcal{T}T 的 token 嵌入。对所有 v∈Fd\bm{v}\in F^{d}v∈Fd,令

$$\varphi_{\bm{v}}^{0}:=\begin{cases}\bigvee_{a\in\mathit{emb}^{-1}(\bm{v})}Q_{a},&\text{if }\mathit{emb}^{-1}(\bm{v})\neq\emptyset\
\bot,&\text{otherwise.}\end{cases}$$

We now define the formula for layer ℓ+1\ell+1ℓ+1. In case of a ReLU layer of width rrr, that applies ReLU to the kkk-th coordinate, we can simply define

现在定义第 ℓ+1\ell+1ℓ+1 层的公式。若是宽度为 rrr、把 ReLU 作用到第 kkk 个坐标的 ReLU 层,我们可以简单地定义

φvℓ+1:=⋁u∈F ⁣:max⁡{0,u}=v[k]φ(v[1,k−1],u,v[k+1,r])ℓ\varphi_{\bm{v}}^{\ell+1}:=\bigvee_{u\in F\colon\max\{0,u\}=\bm{v}[k]}\varphi_{(\bm{v}[1,k-1],u,\bm{v}[k+1,r])}^{\ell}φvℓ+1​:=u∈F:max{0,u}=v[k]⋁​φ(v[1,k−1],u,v[k+1,r])ℓ​

for all v∈Fr\bm{v}\in F^{r}v∈Fr. If layer ℓ+1\ell+1ℓ+1 is an attention layer with strict future masking and rightmost tie-breaking defined by the affine transformation C ⁣:Q2r→QsC\colon\mathbb{Q}^{2r}\to\mathbb{Q}^{s}C:Q2r→Qs and score function S ⁣:Q2r→QrS\colon\mathbb{Q}^{2r}\to\mathbb{Q}^{r}S:Q2r→Qr, we let

对所有 v∈Fr\bm{v}\in F^{r}v∈Fr。若第 ℓ+1\ell+1ℓ+1 层是带严格未来掩码和最右平局打破的注意力层,由仿射变换 C ⁣:Q2r→QsC\colon\mathbb{Q}^{2r}\to\mathbb{Q}^{s}C:Q2r→Qs 和分数函数 S ⁣:Q2r→QrS\colon\mathbb{Q}^{2r}\to\mathbb{Q}^{r}S:Q2r→Qr 定义,我们令

$$\varphi_{\bm{v}}^{\ell+1}:=\bigvee_{\begin{subarray}{c}\bm{u},\bm{a}\in F^{r}\colon\
C(\bm{u},\bm{a})=\bm{v}\end{subarray}}\varphi_{\bm{u}}^{\ell}\wedge\big((\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})<S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell})\mathbin{\textbf{S}}(\varphi_{\bm{a}}^{\ell}\wedge\neg\textbf{P}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})>S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell})\big)$$

for all v∈Fs\bm{v}\in F^{s}v∈Fs. To account for the special case, where the set of unmasked positions is empty, we take the disjunction of the previous formula and (¬P⊤)∧⋁u∈Fr ⁣:C(u,0)=vφuℓ(\neg\textbf{P}\top)\wedge\bigvee_{\bm{u}\in F^{r}\colon C(\bm{u},\bm{0})=\bm{v}}\varphi_{\bm{u}}^{\ell}(¬P⊤)∧⋁u∈Fr:C(u,0)=v​φuℓ​. We omit this special case in the following. If the layer uses leftmost tie-breaking, we adapt the formula as follows:

对所有 v∈Fs\bm{v}\in F^{s}v∈Fs。为处理未掩码位置集合为空这一特殊情形,我们取前一公式与 (¬P⊤)∧⋁u∈Fr ⁣:C(u,0)=vφuℓ(\neg\textbf{P}\top)\wedge\bigvee_{\bm{u}\in F^{r}\colon C(\bm{u},\bm{0})=\bm{v}}\varphi_{\bm{u}}^{\ell}(¬P⊤)∧⋁u∈Fr:C(u,0)=v​φuℓ​ 的析取。下文略去这一特殊情形。若该层使用最左平局打破,我们把公式改成:

$$\varphi_{\bm{v}}^{\ell+1}:=\bigvee_{\begin{subarray}{c}\bm{u},\bm{a}\in F^{r}\colon\
C(\bm{u},\bm{a})=\bm{v}\end{subarray}}\varphi_{\bm{u}}^{\ell}\wedge\big(\textbf{P}(\varphi_{\bm{a}}^{\ell}\wedge\neg\textbf{P}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})\geq S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell})\big)\wedge\big(\neg\textbf{P}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})>S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell})\big)$$

The case of strict past masking is similar, where we use U\mathbin{\textbf{U}}U instead of S\mathbin{\textbf{S}}S and F instead of P. If the layer uses no masking and rightmost tie-breaking, we distinguish three situations: the attention vector is at the current position, the attention vector is strictly to the left of the current position, or the attention vector is strictly to the right of the current position. For the situation, where the attention vector is at the current position, we use

严格过去掩码的情形类似,只需用 U\mathbin{\textbf{U}}U 代替 S\mathbin{\textbf{S}}S,用 F 代替 P。若该层不使用掩码且采用最右平局打破,我们区分三种情形:注意力向量就在当前位置,注意力向量严格位于当前位置左侧,或注意力向量严格位于当前位置右侧。对注意力向量就在当前位置的情形,我们使用

$$\bigvee_{\begin{subarray}{c}\bm{u}\in F^{r}\colon\
C(\bm{u},\bm{u})=\bm{v}\end{subarray}}\varphi_{\bm{u}}^{\ell}\wedge\big(\neg\textbf{P}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})>S(\bm{u},\bm{u})\end{subarray}}\varphi_{\bm{b}}^{\ell}\big)\wedge\big(\neg\textbf{F}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})\geq S(\bm{u},\bm{u})\end{subarray}}\varphi_{\bm{b}}^{\ell}\big) \tag{1}$$

For the situation, where the attention vector is strictly to the left of the current position, we use

对注意力向量严格位于当前位置左侧的情形,我们使用

$$\begin{split}\bigvee_{\begin{subarray}{c}\bm{u},\bm{a}\in F^{r}\colon\
C(\bm{u},\bm{a})=\bm{v}\wedge S(\bm{u},\bm{a})>S(\bm{u},\bm{u})\end{subarray}}&\varphi_{\bm{u}}^{\ell}\wedge\big(\neg\textbf{F}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})\geq S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell}\big)\
&\wedge\big((\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})<S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell})\mathbin{\textbf{S}}(\varphi_{\bm{a}}^{\ell}\wedge\neg\textbf{P}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})>S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell})\big).\end{split} \tag{2}$$

Similarly, for the situation, where the attention vector is strictly to the right of the current position, we use

类似地,对注意力向量严格位于当前位置右侧的情形,我们使用

$$\begin{split}\bigvee_{\begin{subarray}{c}\bm{u},\bm{a}\in F^{r}\colon\
C(\bm{u},\bm{a})=\bm{v}\wedge S(\bm{u},\bm{a})\geq S(\bm{u},\bm{u})\end{subarray}}&\varphi_{\bm{u}}^{\ell}\wedge\big(\neg\textbf{P}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})>S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell}\big)\
&\wedge\big(\textbf{F}(\varphi_{\bm{a}}^{\ell}\wedge\neg\textbf{F}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})\geq S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell})\big)\wedge\big(\neg\textbf{F}\bigvee_{\begin{subarray}{c}\bm{b}\in F^{r}\colon\
S(\bm{u},\bm{b})>S(\bm{u},\bm{a})\end{subarray}}\varphi_{\bm{b}}^{\ell})\big).\end{split} \tag{3}$$

Thus, in the case of no masking and rightmost tie-breaking, we define φvℓ+1\varphi_{\bm{v}}^{\ell+1}φvℓ+1​ as the disjunction of Eqs. 1, 2 and 3. The case where the layer uses no masking and leftmost tie-breaking is analogous.

因此,在不使用掩码且采用最右平局打破时,我们把 φvℓ+1\varphi_{\bm{v}}^{\ell+1}φvℓ+1​ 定义为公式 1、2 和 3 的析取。该层不使用掩码且采用最左平局打破的情形是类似的。

Finally, if there are mmm layers, where the last layer outputs vectors of dimension sss, and t∈Qs\bm{t}\in\mathbb{Q}^{s}t∈Qs is the acceptance vector of T\mathcal{T}T, we define the formula

最后,若共有 mmm 层,最后一层输出维数为 sss 的向量,且 t∈Qs\bm{t}\in\mathbb{Q}^{s}t∈Qs 是 T\mathcal{T}T 的接受向量,我们定义公式

$$\varphi:=\bigvee_{\bm{v}\in F^{s}\colon\
\langle\bm{t},\bm{v}\rangle>0}\varphi_{\bm{v}}^{m}.$$

Then w,k⊨φw,k\models\varphiw,k⊨φ if and only if w∈Lw\in Lw∈L, where kkk is the output position of T\mathcal{T}T.

于是 w,k⊨φw,k\models\varphiw,k⊨φ 当且仅当 w∈Lw\in Lw∈L,其中 kkk 是 T\mathcal{T}T 的输出位置。

It remains to argue that φ\varphiφ can be computed in exponential time. By Proposition 11, ∣F∣|F|∣F∣ is exponential in the size of T\mathcal{T}T and every representation in FFF is of polynomial size. Moreover, FFF can be computed in exponential time. The formulas φvℓ+1\varphi_{\bm{v}}^{\ell+1}φvℓ+1​ at every layer ℓ+1\ell+1ℓ+1 of width rrr depends on ∣F∣O(r)|F|^{O(r)}∣F∣O(r) many formulas from layer ℓ\ellℓ. Moreover, φvℓ+1\varphi_{\bm{v}}^{\ell+1}φvℓ+1​ can be computed in time polynomial in ∣F∣r⋅∣T∣|F|^{r}\cdot|\mathcal{T}|∣F∣r⋅∣T∣, since we only have to compute affine transformations on vectors from FrF^{r}Fr, where each component is of size polynomial in ∣T∣|\mathcal{T}|∣T∣. The formulas φvm\varphi_{\bm{v}}^{m}φvm​ at the last layer mmm depend on ∣F∣O(r′m)|F|^{O(r^{\prime}m)}∣F∣O(r′m) many formulas from layer 0, where r′r^{\prime}r′ is the maximum width of all layers. Thus, φvm\varphi_{\bm{v}}^{m}φvm​ has size exponential in ∣T∣|\mathcal{T}|∣T∣ and can be computed in exponential time. Therefore, also φ\varphiφ can be computed in exponential time.

剩下只需论证 φ\varphiφ 可以在指数时间内算出来。由命题 11,∣F∣|F|∣F∣ 对 ∣T∣|\mathcal{T}|∣T∣ 为指数,且 FFF 中每个表示都是多项式大小。此外,FFF 可以在指数时间内算出。每一层 ℓ+1\ell+1ℓ+1(宽度为 rrr)上的公式 φvℓ+1\varphi_{\bm{v}}^{\ell+1}φvℓ+1​ 依赖于来自第 ℓ\ellℓ 层的 ∣F∣O(r)|F|^{O(r)}∣F∣O(r) 个公式。而且,φvℓ+1\varphi_{\bm{v}}^{\ell+1}φvℓ+1​ 可以在 ∣F∣r⋅∣T∣|F|^{r}\cdot|\mathcal{T}|∣F∣r⋅∣T∣ 的多项式时间内算出,因为我们只需对 FrF^{r}Fr 中的向量做仿射变换,而每个分量的大小对 ∣T∣|\mathcal{T}|∣T∣ 为多项式。最后一层 mmm 上的公式 φvm\varphi_{\bm{v}}^{m}φvm​ 依赖于来自第 0 层的 ∣F∣O(r′m)|F|^{O(r^{\prime}m)}∣F∣O(r′m) 个公式,其中 r′r^{\prime}r′ 是所有层的最大宽度。因此 φvm\varphi_{\bm{v}}^{m}φvm​ 的大小对 ∣T∣|\mathcal{T}|∣T∣ 为指数,并且可以在指数时间内算出。所以 φ\varphiφ 也可以在指数时间内算出。