2870 字
14 分钟
Theory of Computation Quick Reference Notes
持续更新中。
Theory of Computation
- (Models) What is computation?
- (Computability) What can be computed?
- (Complexity) What can be computed efficiently?
Complexity Notation
| Notation | Analogy |
- Big O notation: Let . We write if .
- notation: Let and . We write if , that is, the constant and the threshold may depend on .
- notation: Let
. We write𝑓 , 𝑔 : ℝ → ℝ if𝑓 ( 𝑥 ) = ˜𝑂 ( 𝑔 ( 𝑥 ) ) . In other words,( ∃ 𝑐 > 0 ) ( ∃ 𝑁 ) ( ∀ 𝑥 ≥ 𝑁 ) ( | 𝑓 ( 𝑥 ) | ≤ ( log 𝑥 ) 𝑐 ⋅ | 𝑔 ( 𝑥 ) | ) hides polylogarithmic ( ˜𝑂 ) terms.log 𝑂 ( 1 ) 𝑛
Alphabets and Languages
-
Alphabet (字母表) : An alphabet is a set of symbols.
- Binary alphabet (二进制字母表) :
.{ 0 , 1 }
- Binary alphabet (二进制字母表) :
-
String (字符串) : A string over an alphabet is a finite sequence of symbols from the alphabet.
- Empty string (空串) :
.𝜖 - Length (长度) : The length of a string is its length as a sequence. Denote the length of a string
by𝑤 .| 𝑤 | : the set of all strings over an alphabetΣ ∗ .Σ : the set of strings of lengthΣ 𝑛 over an alphabet𝑛 .Σ - Concatenation (连接) : Two strings over the same alphabet can be combined to form a third by the operation of concatenation. The concatenation of strings
and𝑥 is denoted by𝑦 .𝑥 𝑦
- Empty string (空串) :
-
Language (语言) : A language is a set of strings over an alphabet, denoted by
.𝐿 ∈ Σ ∗ - Since languages are sets, the usual set operations apply: union (
, 并) , intersection (∪ , 交) , and difference (∩ , 差) .\ - Complement (补) : Let
. The complement of𝐿 ∈ Σ ∗ , denoted by𝐿 , is𝐿 .Σ ∗ \ 𝐿 - Concatenation (连接) : If
,𝐿 1 are languages, the concatenation of𝐿 2 and𝐿 1 is defined by𝐿 2 .𝐿 1 𝐿 2 or 𝐿 1 ∘ 𝐿 2 = { 𝑤 = 𝑥 𝑦 : 𝑥 ∈ 𝐿 1 , 𝑦 ∈ 𝐿 2 } - Kleene star (Kleene 星号) : Let
. The Kleene star of𝐿 ∈ Σ ∗ is defined by𝐿 .𝐿 ∗ = { 𝑤 = 𝑤 1 … 𝑤 𝑘 : 𝑘 ≥ 0 , 𝑤 𝑖 ∈ 𝐿 } - Kleene plus (Kleene 加号) : We write
for the language𝐿 + . Equivalently,𝐿 𝐿 ∗ .𝐿 + = { 𝑤 = 𝑤 1 … 𝑤 𝑘 : 𝑘 ≥ 1 , 𝑤 𝑖 ∈ 𝐿 }
- Since languages are sets, the usual set operations apply: union (
Problem Encodings
-
Decision problem (判定问题) : asks a yes/no question about the input. It can be represented as a language
, where the answer for input𝐿 ⊆ Σ ∗ is yes if𝑥 , and no if𝑥 ∈ 𝐿 .𝑥 ∉ 𝐿 - Reduction to decision problems: computation, search, and optimization problems can all be reduced to decision problem.
-
Computation problem (计算问题) : asks to compute some output from the input, not just a yes/no answer. It can be represented as a partial function (部分函数)
.𝑓 : Σ ∗ → Σ ∗ ∪ { undefined } - Reducing computation to decision: Let
. Define𝑓 : Σ ∗ → Σ ∗ . We can compute𝐿 𝑓 = { ( 𝑥 , 𝑖 , 𝑏 ) : the 𝑖 -th bit of 𝑓 ( 𝑥 ) is 𝑏 } by making𝑓 ( 𝑥 ) queries to an oracle for𝑂 ( | 𝑓 ( 𝑥 ) | ) , one query per bit of𝐿 𝑓 . So solving the decision problem𝑓 ( 𝑥 ) lets us solve the computation problem𝐿 𝑓 .𝑓
- Reducing computation to decision: Let
-
Search problem (搜索问题) : asks to find a solution satisfying some property. Formally, given
, find𝑥 ∈ { 0 , 1 } ∗ such that𝑦 ∈ { 0 , 1 } ∗ holds, where𝑅 ( 𝑥 , 𝑦 ) is a relation.𝑅 - Reducing search to decision: Define
. Once𝐿 𝑅 = { ( 𝑥 , 𝑦 𝑝 ) : 𝑦 𝑝 is a prefix of some 𝑦 satisfying 𝑅 ( 𝑥 , 𝑦 ) } can be decided, we can find𝐿 𝑅 by𝑦 queries, extending the prefix𝑂 ( | 𝑦 | ) one bit at a time.𝑦 𝑝
- Reducing search to decision: Define
-
Optimization problem (优化问题) : asks to find a solution that maximizes or minimizes some objective. Formally,
, whereOPT ( 𝑥 ) = max { 𝑐 ( 𝑥 , 𝑦 ) : 𝑅 ( 𝑥 , 𝑦 ) } is a relation and𝑅 is a cost function.𝑐 - Reducing optimization to decision: Define
. By binary search,𝐿 OPT = { ( 𝑥 , 𝑘 ) : ∃ 𝑦 such that 𝑅 ( 𝑥 , 𝑦 ) and 𝑐 ( 𝑥 , 𝑦 ) ≥ 𝑘 } can be computed by makingOPT ( 𝑥 ) queries to𝑂 ( | OPT ( 𝑥 ) | ) .𝐿 OPT
- Reducing optimization to decision: Define
- Reasonable encoding: we only consider encodings that are polynomial-time interconvertible. Under this restriction, the choice of encoding does not affect the complexity class a problem belongs to.
Finite Automata
- The Finite automaton is the simplest computation model, one without memory.
-
A Finite automaton (有限自动机) is a 5-tuple
, where( 𝑄 , Σ , 𝛿 , 𝑞 0 , 𝐹 ) is a finite set called the states (状态) .𝑄 is a finite set called the alphabet (字母表) .Σ is the transition function (转移函数) .𝛿 is the start state (初始状态) .𝑞 0 ∈ 𝑄 is the set of accept states (接受状态) .𝐹 ⊆ 𝑄
- Deterministic Finite Automaton (DFA, 确定型有限自动机) :
.𝛿 is 𝑄 × Σ → 𝑄 -
Non-deterministic Finite Automaton (NFA, 非确定型有限自动机) :
.𝛿 is 𝑄 × Σ → 2 𝑄 -arrow (𝜖 -转移) :𝜖 . It allows the NFA to change state without reading any input symbol.𝛿 is 𝑄 × ( Σ ∪ { 𝜀 } ) → 2 𝑄
-
Accepting a string: Let
be a finite automaton and𝑀 = ( 𝑄 , Σ , 𝛿 , 𝑞 0 , 𝐹 ) a string where each𝑤 = 𝑤 1 𝑤 2 … 𝑤 𝑛 .𝑤 𝑖 ∈ Σ accepts𝑀 if there exists a sequence of states𝑤 such that𝑟 0 , 𝑟 1 , … , 𝑟 𝑛 ∈ 𝑄 ,𝑟 0 = 𝑞 0 , for𝛿 ( 𝑟 𝑖 , 𝑤 𝑖 + 1 ) = 𝑟 𝑖 + 1 ,𝑖 = 0 , 1 , … , 𝑛 − 1 .𝑟 𝑛 ∈ 𝐹
- Accepting a language: If
is the set of all strings that a finite automaton𝐿 accepts, we say𝑀 recognizes (识别) or accepts (接受)𝑀 , and we write𝐿 .𝐿 ( 𝑀 ) = 𝐿 - Equivalence of NFAs and DFAs : Use the power set (幂集) . An NFA may be in several states at once, so the DFA tracks the set of all states the NFA could currently be in. A state of the new DFA is therefore a set of NFA states, i.e., an element of
.𝒫︀ ( 𝑄 )
Regular Language
-
Regular language (正则语言) : A language is called a regular language if some finite automaton recognizes it.
.Regular Languages ⊂ P ⊂ Decidable Languages ⊂ All Languages
- Regular operations (正则运算) : union, intersection, difference, complement, concatenation, star…
-
Closure property (闭包性质) of regular languages : if
are regular languages, then so are𝐿 1 , 𝐿 2 ,𝐿 ,𝐿 1 ∪ 𝐿 2 ,𝐿 1 ∩ 𝐿 2 ,𝐿 1 ∘ 𝐿 2 , and𝐿 1 ∗ . Each closure is proved by constructing a finite automaton that recognizes the resulting language.𝐿 1 \ 𝐿 2 - Closure under union and intersection: Use the Cartesian product (笛卡尔积) construction.
- Closure under concatenation: Connect every accept state of
to the start state of𝑁 1 by an𝑁 2 -arrow, so that𝜖 may switch from the𝑁 part to the𝑁 1 part after having read any𝑁 2 .𝑥 ∈ 𝐿 1 - Closure under star: Add
-arrows from every accept state back to the start state so that the machine may repeat the loop any number of times.𝜖
Nonregular Languages
- Almost all languages are non-regular: Every regular language is described by some DFA, and each DFA can be encoded as a finite string. Since there are only countably many such strings, there are only countably many regular languages. The set of all languages is
, and since𝒫︀ ( Σ ∗ ) is countably infinite,Σ ∗ , which is uncountable. Since| 𝒫︀ ( Σ ∗ ) | = 2 ℵ 0 , almost all languages are non-regular.ℵ 0 < 2 ℵ 0 -
Pumping lemma (泵引理) : If
is a regular language, then there exists𝐿 such that, for any string𝑝 ∈ ℕ with𝑠 ∈ 𝐿 , we can write| 𝑠 | ≥ 𝑝 , where𝑠 = 𝑥 𝑦 𝑧 , such that𝑥 , 𝑦 , 𝑧 ∈ Σ ∗ for all𝑥 𝑦 𝑖 𝑧 ∈ 𝐿 ,𝑖 ≥ 0 , and| 𝑦 | > 0 .| 𝑥 𝑦 | ≤ 𝑝
- Applying the pumping lemma: The lemma is a tool to disprove regularity: assume
is regular, then pump a long string𝐿 and show that some𝑠 ∈ 𝐿 falls outside the language – a contradiction.𝑥 𝑦 𝑖 𝑧
Regular Expressions
- Regular expression (regex, RE, 正则表达式) : an intuitive way to describe patterns in strings. Practical regex tools are built on (and extend) it, and it describes exactly the regular languages.
-
Syntax (语法) :
is a regular expression if𝑅 is𝑅 - a symbol
, for some𝑠 ,𝑠 ∈ Σ ,𝜖 ,∅ , where( 𝑅 1 ∪ 𝑅 2 ) are regular expressions,𝑅 1 , 𝑅 2 , where( 𝑅 1 𝑅 2 ) are regular expressions,𝑅 1 , 𝑅 2 , where( 𝑅 1 ) ∗ is a regular expression.𝑅 1
- a symbol
-
Semantics (语义) : The language
of a regular expression𝐿 ( 𝑅 ) is defined by𝑅 , for𝐿 ( 𝑠 ) = { 𝑠 } ,𝑠 ∈ Σ ,𝐿 ( 𝜖 ) = { 𝜖 } ,𝐿 ( ∅ ) = ∅ ,𝐿 ( 𝑅 1 ∪ 𝑅 2 ) = 𝐿 ( 𝑅 1 ) ∪ 𝐿 ( 𝑅 2 ) ,𝐿 ( 𝑅 1 𝑅 2 ) = 𝐿 ( 𝑅 1 ) ∘ 𝐿 ( 𝑅 2 ) .𝐿 ( 𝑅 1 ∗ ) = 𝐿 ( 𝑅 1 ) ∗
-
Theorem: A language is regular if and only if some regular expression describes it.
- Regular expression → NFA: Build the NFA by induction, following how the regular expression is built. Three base cases (a single symbol,
,𝜖 ) and three ways to combine smaller NFAs (union, concatenation, star) – exactly the closure constructions.∅ - DFA/NFA → regular expression: Convert the NFA into a generalized NFA (GNFA, 广义 NFA) , whose arrows are labeled by regular expressions, then remove states one by one until only
and𝑞 start remain; the label on the last arrow is the answer.𝑞 accept
- Regular expression → NFA: Build the NFA by induction, following how the regular expression is built. Three base cases (a single symbol,
Turing Machines
- Hilbert’s program (希尔伯特纲领) : After the crisis in the foundations of mathematics around 1900 (e.g. Russell’s paradox, 1901), Hilbert’s answer in the 1920s was to formalize all of mathematics: a fixed list of axioms (公理) and rules of inference (推理规则) , in which a proof is a finite string of symbols, checkable mechanically. The goal was to show that mathematics is complete, consistent, and decidable.
| Hilbert’s goal | Answer | Who |
| Complete? | No | Gödel, 1931 |
| Consistent (provably)? | No | Gödel, 1931 |
| Decidable? | No | Turing / Church, 1936 |
-
The Entscheidungsproblem (判定问题, Hilbert & Ackermann, 1928) : Is there an algorithm that, given any statement of first-order logic, decides whether it is provable?
- To answer “yes” it suffices to write down one algorithm; to answer “no” one must rule out every possible algorithm, which needs a precise definition of “algorithm” – and that is exactly what the Turing machine supplies.
-
Turing machine (TM, 图灵机) : a 7-tuple
, where( 𝑄 , Σ , Γ , 𝛿 , 𝑞 0 , 𝑞 accept , 𝑞 reject ) are all finite sets and𝑄 , Σ , Γ is the set of states (状态) ,𝑄 is the input alphabet (输入字母表) , not containing the blank symbolΣ ,⊔ is the tape alphabet (纸带字母表) , whereΓ and⊔ ⊆ Γ ,Σ ⊆ Γ is the transition function (转移函数) ,𝛿 : 𝑄 × Γ → 𝑄 × Γ × { 𝐿 , 𝑅 } is the start state (初始状态) ,𝑞 0 ∈ 𝑄 is the accept state (接受状态) , and𝑞 accept ∈ 𝑄 is the reject state (拒绝状态) , where𝑞 reject ∈ 𝑄 .𝑞 reject ≠ 𝑞 accept
- One step of the computation has three parts: read the symbol in the current cell; write a new symbol there and update the state; move the head one cell left or right.
- Configuration (格局) : records everything needed to continue the computation: the current state, the full tape contents, and the head position. Formally, a configuration is written as
, where𝑢 𝑞 𝑣 is the current state,𝑞 ∈ 𝑄 , the tape contains𝑢 , 𝑣 ∈ Γ ∗ followed by blanks, and the head is on the first symbol of𝑢 𝑣 .𝑣
-
Acceptance:
accepts (接受) input𝑀 if there exists a sequence of configurations𝑤 such that𝐶 0 , 𝐶 1 , … , 𝐶 𝑘 is the start configuration: state𝐶 0 , with𝑞 0 written on the tape and the head at the leftmost cell,𝑤 - each
yields𝐶 𝑖 , that is,𝐶 𝑖 + 1 follows from𝐶 𝑖 + 1 by one application of𝐶 𝑖 , and𝛿 is an accepting configuration: its state is𝐶 𝑘 .𝑞 accept
- Recognizable language (可识别语言) : The set of strings that
accepts is the language recognized by𝑀 , denoted𝑀 .𝐿 ( 𝑀 ) is recognizable if there is a TM𝐿 such that𝑀 .𝐿 ( 𝑀 ) = 𝐿 - Deciding a language: Let
be a language,𝐿 ⊆ { 0 , 1 } ∗ a Turing machine, and𝑀 .𝑇 : ℕ → ℕ decides (判定)𝑀 in time𝐿 if for every𝑇 ( 𝑛 ) ,𝑥 ∈ { 0 , 1 } ∗ halts within𝑀 steps, if𝑇 ( | 𝑥 | ) then𝑥 ∈ 𝐿 accepts𝑀 , and if𝑥 then𝑥 ∉ 𝐿 rejects𝑀 .𝑥 -
Decidable language (可判定语言) :
is decidable if some Turing machine decides𝐿 .𝐿 - On an input, a Turing machine may accept, reject, or loop forever. A TM that decides a language always halts – it never loops forever.
- Every decidable language is recognizable; the converse is not true. For example, the halting problem is recognizable but not decidable.
- Computational Turing machine (计算图灵机) : a 6-tuple
, where( 𝑄 , Σ , Γ , 𝛿 , 𝑞 0 , 𝑞 end ) is the end state (终止状态) .𝑞 end ∈ 𝑄 computes𝑀 if, on every input𝑓 : Σ ∗ → Σ ∗ ,𝑤 ∈ Σ ∗ halts in𝑀 with𝑞 end on its tape.𝑓 ( 𝑤 ) - Computable function (可计算函数) : Let
be a possibly partial function.𝑓 : { 0 , 1 } ∗ → { 0 , 1 } ∗ ∪ { undefined } computes𝑀 within time𝑓 if for every𝑇 ( 𝑛 ) with𝑥 ∈ { 0 , 1 } ∗ ,𝑓 ( 𝑥 ) ≠ undefined halts on𝑀 within𝑥 steps, with exactly𝑇 ( | 𝑥 | ) on its tape.𝑓 ( 𝑥 ) is computable if some TM computes it.𝑓
Variants of Turing Machines
- The Turing machine model is robust: the basic model and all the variants below have the same computational power, that is, they recognize (or decide) the same class of languages, and each can simulate the other with at most a polynomial slowdown, that is,
steps become𝑇 ( 𝑛 ) steps.poly ( 𝑇 ( 𝑛 ) ) - Stay option: allow
, where𝛿 : 𝑄 × Γ → 𝑄 × Γ × { 𝐿 , 𝑅 , 𝑆 } means the head remains in place. If𝑆 decides𝑀 in time𝐿 , then𝑇 ( 𝑛 ) is decidable in time𝐿 by a standard Turing machine.𝑂 ( 𝑇 ( 𝑛 ) ) - Change of alphabet: let
and𝐿 ⊆ { 0 , 1 } . If𝑇 ( 𝑛 ) ≥ 𝑛 2 is decided in time𝐿 by a Turing machine with tape alphabet𝑇 ( 𝑛 ) , thenΓ is decided in time𝐿 by a Turing machine with tape alphabet𝑂 ( log | Γ | ⋅ 𝑇 ( 𝑛 ) ) .{ 0 , 1 , ⊔ } - One-way Turing machine (单向图灵机) : a Turing machine whose tape is infinite in only one direction.
- Multitape Turing machine (多带图灵机) :
, with one head per tape. In state𝛿 : 𝑄 × Γ 𝑘 → 𝑄 × Γ 𝑘 × { 𝐿 , 𝑅 , 𝑆 } 𝑘 , if head𝑞 reads𝑖 for every𝑎 𝑖 , the machine enters𝑖 , and each head𝑞 ′ writes𝑖 and moves in direction𝑏 𝑖 . The input𝐷 𝑖 is on tape 1; tapes𝑥 are blank. All heads start on cell 0 in state2 , … , 𝑘 .𝑞 0 -
RAM Turing machine (RAM 图灵机) : a
-tape Turing machine( 𝑘 + 1 ) with𝑀 = ( 𝑄 , Σ , Γ , 𝛿 , 𝑞 0 , 𝑞 accept , 𝑞 reject , 𝑄 access ) - tapes
as work tapes (工作带) (tape 1 holds the input) and tape1 , … , 𝑘 as the address tape (地址带) ;𝑘 + 1 - a memory
, initially𝐴 : ℕ → Γ for all𝐴 [ 𝑖 ] = ⊔ ;𝑖 - a set of access states
.𝑄 access ⊆ 𝑄 ∖ { 𝑞 accept , 𝑞 reject } -
contains two special symbolsΓ andRd . WhenWr enters a state in𝑀 :𝑄 access - Read: if the address tape contains
, the address tape is erased andbin ( 𝑖 ) Rd is written into its first cell.𝐴 [ 𝑖 ] - Write: if the address tape contains
, thenbin ( 𝑖 ) Wr 𝛼 is set to𝐴 [ 𝑖 ] and the address tape is erased.𝛼 - Otherwise, nothing happens.
- Read: if the address tape contains
- Each access counts as one step.
- The transition function is that of an ordinary
-tape machine; the memory( 𝑘 + 1 ) never appears in𝐴 , it is used only through access states.𝛿
- tapes
: letDTIME . A language𝑇 : ℕ → ℕ is in𝐿 ⊆ { 0 , 1 } ∗ if there exists a multitape Turing machineDTIME ( 𝑇 ( 𝑛 ) ) that decides𝑀 in time𝐿 .𝑂 ( 𝑇 ( 𝑛 ) ) :P .P = ⋃ 𝑐 ≥ 1 DTIME ( 𝑛 𝑐 ) = DTIME ( 𝑛 ) ∪ DTIME ( 𝑛 2 ) ∪ DTIME ( 𝑛 3 ) ∪ … does not depend on the choice of Turing machine model, since these models can all simulate each other in polynomial time.𝑃 -
Two Conjectures (猜想) : with
,CLIQUE = { ⟨ 𝐺 , 𝑘 ⟩ : graph 𝐺 has a clique (团) of size 𝑘 } , equivalentlyP ≠ NP .CLIQUE ∉ P .CLIQUE ∉ DTIME ( 𝑛 )
- Summary: every variant is simulated with at most polynomial overhead, so the class of decidable languages is the same, and
is the same, whichever model we use.𝑃
| Variant | Simulated in time | Proof idea |
| Stay option | stay = right, then left | |
| Alphabet | encode each symbol in |
|
| One-way TM | fold the tape into two tracks | |
| Multitape TM | ||
| RAM TM | add a memory tape holding a list of (address, value) pairs |
Church–Turing Thesis
-
From C to a Turing machine: every RISC-V RV32I instruction can be simulated by a multitape RAM TM in
steps, so every C program running in time𝑂 ( 1 ) is compiled to RV32I (𝑇 ( 𝑛 ) steps), simulated by a multitape RAM TM (𝑇 ( 𝑛 ) ), merged onto a multitape TM (𝑂 ( 𝑇 ( 𝑛 ) ) ), and encoded over the alphabet𝑂 ( 𝑇 ( 𝑛 ) 2 ) on a single-tape TM ({ 0 , 1 } ). That is, Every C program running in time𝑂 ( 𝑇 ( 𝑛 ) 4 ) can be simulated by a single-tape TM over𝑇 ( 𝑛 ) in time{ 0 , 1 } – polynomial.𝑂 ( 𝑇 ( 𝑛 ) 4 ) - Other models equivalent to Turing machines:
| Model | Idea |
| Register Machine (寄存器机) | INC/DEC/JZ on counters (计数器) |
| λ-calculus (λ 演算) / SKI | β-reduction (β-归约) |
| μ-Recursive Functions (μ-递归函数) | prim. recursion + μ (原始递归 + μ) |
| Post / Markov Systems | string rewriting |
| Cellular Automata (元胞自动机) | local rules |
| Boolean Circuits (布尔电路) | circuit families |
- Church–Turing Thesis (CTT, 丘奇–图灵论题) : every function that is effectively computable is computable by a Turing machine.
- Strong Church–Turing Thesis (强丘奇–图灵论题) : any reasonable model of computation can be simulated by a Turing machine with at most polynomial overhead. Possibly false: quantum computers.
- Physical Church–Turing Thesis (物理丘奇–图灵论题) : every function that can be computed by a physical system is computable by a Turing machine.
Universal Turing Machine
-
Why a universal Turing machine (UTM, 通用图灵机) ?
- One machine runs every program, so no special hardware per algorithm.
- Encoding machines as strings lets us prove computability results.
- Origin of the stored-program computer (von Neumann architecture, 1945).
- Stored-program computer (存储程序计算机) : instructions and data share one memory, so a program is just data interpreted as instructions. The UTM is the model, a computer is the realization. Calculators, traffic light controllers and elevator controllers are not universal (fixed logic); laptops, desktops and smartphones are.
- Encoding a Turing machine as a string: assume every string
represents some Turing machine𝛼 ∈ { 0 , 1 } ∗ (if𝑀 𝛼 is invalid,𝛼 always rejects), and every Turing machine is represented by infinitely many strings.𝑀 𝛼 - Theorem: there is a 2-tape Turing machine
such that for all𝑈 ,𝑥 , 𝛼 ∈ { 0 , 1 } ∗ , with the same outcome (accept, reject, or run forever). Moreover, if𝑈 ( 𝑥 , 𝛼 ) = 𝑀 𝛼 ( 𝑥 ) halts on𝑀 𝛼 within𝑥 steps, then𝑇 halts within𝑈 steps.𝑂 ( 𝑇 log 𝑇 )