Computational Complexity Review
1. Turing Machines @ Automata by Jeff UllmanPermalink
1.1 IntroductionPermalink
Questions:
- How to show that certain tasks are impossible, or in some cases, possible but intractable?
- Intractable means solvable but only by very slow algorithms
- What can be solved by computer algorithms?
Turing machine (TM):
- In some sense an ultimate automaton.
- A formal computing model that can compute anything we can do with computer or with any other realistic model that we might think of as computing.
- TMs define the class of recursively enumerable languages which thus the largest class of languages about which we can compute anything.
- There is another smaller class called recursive languages that can be thought of as modeling algorithms–computer programs that answer a particular question and then finish.
1.2 DataPermalink
Data types:
int
,float
,string
, etc.- But at another level, there is only one type
string of bit
.- It is more convenient to think of binary strings as integers.
- Programs are also strings and thus strings of bits.
- The fact that programs and data are at heart the same thing is what let us build a powerful theory about what is not computable.
“The
- Integers
- “Data” can also be mapped to
(with some tricks from coding or cryptography)- Then it makes sense to talk about “the
data”
- Then it makes sense to talk about “the
- E.g. “the
string”:- Text strings (ASCII or Unicode)
Binary strings Integers- A small glitch: If you think simply of binary integers, then
“the string” “the string” “the string”
- A small glitch: If you think simply of binary integers, then
- This can be fixed by prepending a
to the string before converting to an integer. Thus, “the string” ( ) “the string” ( ) “the string” ( )
- Text strings (ASCII or Unicode)
- E.g. “the
proof”:- A formal proof is a sequence of logical expressions.
- We can encode mathematical expressions of any kind in Unicode.
- Convert expression to a binary string and then an integer.
- Problems:
- A proof is a sequence of expressions, so we need a way to separate them.
- Also, we need to indicate which expressions are given and which follow from previous expressions.
- Quick-and-dirty way to introduce special symbols into binary strings:
- Given a binary string, precede each bit by 0. E.g.:
becomes .
- Use strings of two or more
’s as the special symbols. E.g.:- Let
mean “start of expression” - Let
mean “end of expression”
- Let
- Given a binary string, precede each bit by 0. E.g.:
- E.g.
- A formal proof is a sequence of logical expressions.
1.3 Orders of infinityPermalink
- There aren’t more “data” than there are integers.
- While the number is infinite, you may aware that there are different orders of infinity, and the integers is of the smallest one.
- E.g. there are more real numbers than there are integers, so there are more real numbers than there are “programs” (think of programs as data).
- This immediately tells you that some real numbers cannot be computed by programs.
- E.g. there are more real numbers than there are integers, so there are more real numbers than there are “programs” (think of programs as data).
1.3.1 Finite setsPermalink
- A finite set has a particular integer that is the count of the number of members–the cardinality.
- E.g.
- E.g.
- It is impossible to find a 1-to-1 mapping between a finite set and a proper subset of itself.
1.3.2 Infinite SetsPermalink
- Formally, an infinite set is a set for which there is a 1-to-1 mapping between itself and a proper subset of itself.
- E.g. the positive integers
is an infinite set.- There is a 1-to-1 mapping
between this set and a proper subset (the set of even integers).
- There is a 1-to-1 mapping
- E.g. the positive integers
1.3.3 Countable SetsPermalink
- A countable set is a set with a 1-to-1 mapping with the positive integers.
Hence, all countable sets are infinite.
- E.g. set of all integers:
- Thus, order is
, i.e. integer is integer is- etc.
- E.g. set of binary strings, set of Java programs.
- E.g. pairs of integers
- Order the pairs of positive integers first by sum, then by first component:
- Order the pairs of positive integers first by sum, then by first component:
1.3.4 EnumerationsPermalink
- An enumeration of a set is a 1-to-1 mapping between the set and the positive integers.
- Thus, we have seen enumerations for strings, programs, proofs, and pairs of integers.
1.3.5 Set of all languages over some fixed alphabetPermalink
Question: Are the languages over
Answer: No. Proof by Diagonalization (a table of
Suppose we could enumerate all languages over
Consider the language:
Clearly,
Thus,
Let
- If so,
is not in by definition of . - If not, then
is in by definition of .
We have a contradiction:
This is really bad; there are more languages than programs:
- The set of all programs are countable
- The set of all languages are not countable
1.4 Turing-MachinePermalink
Turing-Machine Theory:
- One important purpose of the theory of Turing machines is to prove that certain specific languages have no membership algorithm.
- The first step is to prove certain languages about Turing machines themselves have no membership algorithm.
- Reductions are used to prove more common questions undecidable.
Picture of a Turing Machine:
- Finite number of states.
- Infinite tape with cells containing tape symbols chosen from a finite alphabet.
- Tape head: always points to one of the tape cells.
- Action: based on the state and the tape symbol under the head, a TM can
- change state
- overwrite the current symbol
- move the head one cell left or right
Why Turing Machines? Why not represent computation by C programs or something like that?
- You can develop a theory about programs without using Turing machines, but it is easier to prove things about TM’s, because they are so simple.
- And yet they are as powerful as any computer.
- In fact, TMs are more powerful than any computer, since they have infinite memory
- Yes, we could always buy more storage for a computer.
- But the universe is finite so where are you going to get the atoms from which to build all of those discs?
- However, once you accept that the universe is finite, the limitation doesn’t seem to be effecting what we can compute in practice.
- So we are not going to argue that a computer is weaker than a Turing machine in a meaningful way.
- In fact, TMs are more powerful than any computer, since they have infinite memory
1.4.1 Turing-Machine FormalismPermalink
A TM is typically described by:
- A finite set of states,
- An input alphabet,
- symbol 和 alphabet 的关系是
- symbol 和 alphabet 的关系是
- A tape alphabet,
- A transition function,
- A start state,
- A blank symbol,
- All tape except for the input is blank initially.
is never an input symbol.
- A set of final states,
Conventions:
are input symbols. are tape symbols. are strings of input symbols. are strings of tape symbols.
Transition Function
- Arguments:
- Current state
- Current tape symbol
- Current state
- Return value (when
in not undefined): is a state is the new tape symbol (to replace the current symbol on the tape head) is a direction, or
TM Example:
- Description:
- This TM scans its input (all binary bits) left to right, looking for a 1.
- If it finds 1, it changes it to a 0, goes to final state
, and halts. - If it reaches a blank, it changes it to a 1 and moves left.
- Formalism:
- States
. - Input symbols
. - Tape symbols
. . . .
- States
- Example tape:
; starts from the first 0 , , move right , , move right , , move left , , move right , , move right , undefined, halt.
Instantaneous Descriptions of a Turing Machine:
- Initially, a TM has a tape consisting of a string of input symbols surrounded by an infinity of blanks in both directions.
- The TM is in the start state, and the head is at the leftmost input symbol.
- TM ID’s: (我觉得更合适的名字应该叫 TM State ID)
- An ID is a string
, where string from the leftmost nonblank to tape head (exclusive) string from the tape head (inclusive) to the rightmost nonblanks.- I.e. the symbol to the right of
is the one being scanned.
- I.e. the symbol to the right of
- If an ID is in the form of
, it is scanning a .
- As for PDA’s (Pushdown automaton) we may use symbols
to represent “ becomes in one move” and to represent “ becomes in zero or more moves,”。
- Example: The moves of the previous TM are
- An ID is a string
- Formal Definition of Moves:
- If
, then- If
is the blank , then
- If
, then- For any
, - In addition,
- For any
- If
1.4.2 Languages of a TMPermalink
There are actually two ways to define the language of a TM:
- A TM defines a language by final state.
- Or, a TM can accept a language by halting.
Equivalence of Accepting and Halting:
- If
, then there is a TM such that . - If
, then there is a TM such that .
Proof:
Final State => Halting:
- Modify
to become as follows:- For each final state of
, remove any moves, so halts in that state. - Avoid having
accidentally halt.- Introduce a new state
, which runs to the right forever; that is for all symbols . - If
is not a final state, and is undefined, let .
- Introduce a new state
- For each final state of
Halting => Final State:
- Modify
to become as follows:- Introduce a new state
, the only final state of . has no moves.- If
is undefined for any state and symbol , define it by .
- Introduce a new state
Recursively Enumerable Languages:
- We now see that the classes of languages defined by TM’s using final state and halting are the same.
- This class of languages (that can be defined in both those ways) is called the recursively enumerable languages.
- Why this name? The term actually predates the Turing machine and refers to another notion of computation of functions.
Recursive Languages:
- A proper subset of Recursively Enumerable Languages.
- An algorithm formally is a TM accepting (a language) by final state that halts on any input regardless of whether that input is accepted or not.
- 注意这里的逻辑,algorithm 是 TM 而不是 language.
- If
for some TM that is an algorithm, we say is a recursive language.- In other words, the language that is accepted by final state by some algorithm is a recursive language.
- Why this name? Again, don’t ask; it is a term with a history.
- Example: Every CFL (Context-free language) is a recursive language.
- By the CYK algorithm.
2. Decidability @ Automata by Jeff UllmanPermalink
Central Ideas:
- TMs can be enumerated, so we can talk about “the
TM”.- Thus possible to diagonalize over TMs, showing a language that cannot be the language of any TM.
- Establish the principle that a problem is really a language.
- Therefore some specific problems do not have TMs.
Binary-Strings from TM’s:
- We shall restrict ourselves to TM’s with input alphabet
. - Assign positive integers to the three classes of elements involved in moves:
- States:
(start state), (final state), , etc. - Symbols:
(0), (1), (blank), , etc. - Directions:
(L) and (R).
- States:
- Suppose
. - Represent this rule by string
. ( 表示 个连续的 )- Key point: since integers
are all , there cannot be two consecutive ’s in these strings.
- Key point: since integers
- Represent a TM by concatenating the codes for each of its moves, separated by
as punctuation.- That is:
- Note: if bianry string
cannot be parsed as a TM, assume the TM accepts nothing.
- That is:
Diagonalization:
- Table of Acceptance (denoted by
):- TM
String means the TM does not accept the string. otherwise.
- TM
- Construct a 0/1 sequence
, where cannot be a row in .- Question: Let’s suppose
. What does it mean if appears in the row of the table ? - Answer: It means the
TM exactly accepts the binary strings.
- Let’s give a name to this language–the diagonalization language
. - We have shown that
is not a recursively enumerable language; i.e., it has no TM.- There are no more TMs than integers.
exists but we cannot always tell whether a given binary string is in .
Problems:
- Informally, a “problem” is a yes/no (the output) question about an infinite set of possible instances (the input).
- Example: “Does graph G have a Hamilton cycle (cycle that touches each node exactly once)?
- Each undirected graph is an instance of the “Hamilton-cycle problem.”
- Formally, a problem is a language.
- Each string encodes some instance.
- The string is in the language if and only if the answer to this instance of the problem is “yes.”
- Example: A Problem About Turing Machines
- We can think of the language
as a problem. - 如果 table
的 string 是 TM 自身的 binary string 的话,这个 problem 就成了 “Does this TM not accept its own code?”
- We can think of the language
Decidable Problems:
- A problem is decidable if there is an algorithm to answer it.
- Recall: An “algorithm,” formally, is a TM that halts on all inputs, accepted or not.
- Put another way, “decidable problem” = “recursive language.”
- Otherwise, the problem is undecidable.
Bullseye Picture:
- 最中心的集合:Decidable problems = Recursive languages
- 外一圈:Recursively enumerable languages
- Languages accepted by TMs with no guarantee that they will halt on inputs they never accept
- Recursively enumerable languages
Recursive languages
- 最外层:Not recursively enumerable languages,比如
- Languages that have no TM at all.
- Recursively enumerable languages 的补集
Examples: Real-world Undecidable Problems
- Can a particular line of code in a program ever be executed?
- Is a given context-free grammar ambiguous?
- Do two given CFG’s generate the same language?
The Universal Language:
- An example of a recursively enumerable, but not recursive language
- We call it
, of a universal Turing machine, or call it Universal TM language. - UTM inputs include:
- a binary string representing some TM
, and - a binary string
for
- a binary string representing some TM
- UTM accepts
if and only if accepts . - E.g. JVM
- JVM takes a coded Java program and input for the program and executes the program on the input.
Designing the UTM:
- Inputs are of the form:
- Note: A valid TM code never has
, so we can split from . - The UTM must accept its input if and only if
is a valid TM code and accepts .
- Note: A valid TM code never has
- UTM is a multi-tape machine:
- Tape 1 holds the input
- Tape 1 is never changed, i.e. never overwritten.
- Tape 2 represents the current tape of
during the simulation of with input - Tape 3 holds the state of
.
- Tape 1 holds the input
- Step 1: The UTM checks that
is a valid code for a TM.- E.g., all moves have five components, no two moves have the same state/symbol as first two components.
- If
is not valid, its language is empty, so the UTM immediately halts without accepting.
- Step 2: Assuming the code for
is valid, the UTM next examines to see how many of its own tape cells it needs to represent one symbol of .- How to do this: we discover the longest block of
s representing a tape symbol and add one cell to that for a marker (e.g. ) between symbols of ’s tape. - Thus if say
is the highest numbered symbol then we’ll use 8 squares to represent one symbol of .- Symbol
will be represented s and blanks followed by a marker outside. - For example, here’s how we would represent
: .
- Symbol
- How to do this: we discover the longest block of
- Step 3: Initialize Tape 2 to represent the tape of
with input , and initialize Tape 3 to hold the start state (always so it is represented by a single ). - Step 4: Simulate
.- Look for a move on Tape 1 that matches the state on Tape 3 and the tape symbol under the head on Tape 2.
- If we cannot find one then apparently
halts without accepting so UTM does so as well.
- If we cannot find one then apparently
- If found, change the symbol and move the head on Tape 2 and change the State on Tape 3.
- If
accepts (i.e. halts), the UTM also accepts (i.e. halts).
- Look for a move on Tape 1 that matches the state on Tape 3 and the tape symbol under the head on Tape 2.
Proof That
- We designed a TM for
, so it is surely RE. - Proof by contradiction:
- Suppose
were recursive, which means we could design a UTM that always halted. - Then we could also design an algorithm for
, as follows.- Given input
, we can decide if by the following steps.- Check that
is a valid TM code.- If not, then
’s language is empty, so .
- If not, then
- If valid, use the hypothetical algorithm to decide whether
is . - If so, then
; else .
- Check that
- Given input
- But we already know there is no algorithm for
. - Thus, our assumption that there was an algorithm for
is wrong. is RE, but not recursive.
- Suppose
这个证明需要好好解读与总结:
- 什么是 language?
- TM
的 language - Tape 的本质是什么?是 string 呀
- 我们说 TM
accepts a language,那么同样也可以说 TM accepts a string,然后所有 accept 的 string 构成了 的 language
- TM
- 什么是 algorithm?
- algorithm 是个 TM, which always halts on any input regardless of whether that input is accepted or not
- always halts 是什么意思?你可以理解为 “always generate an output”
- accept 输出 1
- reject 输出 0
- 明显,infinite loop 不可能是一个 algorithm
- always halts 是什么意思?你可以理解为 “always generate an output”
- algorithm 是个 TM, which always halts on any input regardless of whether that input is accepted or not
- 什么是 problem?
- problem is a language
- TM accept a language => algorithm accepts a problem
- 但是我们一般不这么说,因为我们常用的说法是 algorithm solves a problem
- 反过来,a problem is solved by algorithm,也就相当于 “我们可以为 problem 这个 language 找到一个 always halt 的 TM,即找到一个 algorithm”
- 能找到 algorithm 的 problem => Decidable Problem, i.e. Recursive language
- 能找到 TM (但不保证是 algorithm) 的 problem => Recursively enumerable language
- 能找到 TM,但确定不是 algorithm 的 problem => The Universal Language
- 连 TM 都找不到的 problem => Not recursively enumerable language
的两面性- 如果 TM
的 binary string 是 ,那么 可以表示 TM 可以表示一个 plain string
- 那么我们可以同时有 “
accepts ” 和 “ is accepted by ” 这两种逻辑
- 如果 TM
的两种解读- 首先它是个 language,然后 language 可以看做一个集合;然后 problem 也是 language,所以也把
抽象成一个问题描述 - 貌似默认是把 Acceptance table
的 string 限定为 TM 的 binary string 的话(相当于是 这样的一张表),那么:- 你理解为 string 的集合或者 TM 的集合都行,因为
的两面性 - 原来的定义是
,请自行体会一下是不是可以这么理解
- 你理解为 string 的集合或者 TM 的集合都行,因为
is a problem “Does this TM not accept its own code?”
- 首先它是个 language,然后 language 可以看做一个集合;然后 problem 也是 language,所以也把
- If
is not a valid TM code:- 有点无赖地,我们把这样的
看做一种特殊的 TM ’s language is empty- =>
accepts nothing- =>
cannot accept- =>
- =>
- =>
- =>
- 有点无赖地,我们把这样的
没有 algorithm 意味着什么?- 给定一个
,没有 algorithm 确定是否有 accepts - 还是回到 “
accepts ” 这个逻辑上,然后我们可以把 写成 ,所以针对这个输入,没有 algorithm 可以确定是否有 accepts
- 给定一个
3. Extensions and properties of Turing machines @ Automata by Jeff UllmanPermalink
17.1 Programming TricksPermalink
Programming Trick: Multiple Tracks
- Enable us to leave markers on the tape so TM can find their way back to an important place.
- If there are
tracks => Treat each symbol as a vector of size- E.g.
. represents symbol ; represents blank; represents symbol
- E.g.
Programming Trick: Marking
tracks for data; 1 track for marks- Almost all tape cells hold blank in this mark track, but several hold special symbols (marks) that allow the TM to find particular places on the tape.
- E.g.
represents an unmarked , a marked and an unmarked ( is a mark)
Programming Trick: Caching in the State
- Treat state as a vector.
- First component is the “control state,” i.e. the orginal state
- Other components are used as a cache to hold values the TM needs to remember.
例子待续
17.2 RestrictionsPermalink
Semi-infinite Tape: 待续
17.3 ExtensionsPermalink
Multitape TM:
- To simulate a
-Tape TM, use tracks ( tracks 仍然视为一个 tape; -Tape 是要有 个 head 的) - For every 2 tracks simulating 1 tape:
- 1 track for tape data
- 1 track for tape head (use mark
to indicate the head position)
- 待续
Nondeterministic TM:
- Allow TM to have more than 1 choice of move at each step for any <state, symbol> pair.
- Each choice is a <state,symbol,direction> triple, as for the deterministic TM.
- Simulating a NTM by a DTM: 待续
How a TM can simulate a
- Very large
stores => a significant factor in big-data world, like google's big table. - 待续
17.4 Closure Properties of Recursive and RE LanguagesPermalink
待续
4. Specific undecidable problemsPermalink
Rice’s theorem: tells us that almost every question we can ask about the recursively enumerable languae is undecidable.
Properties of Languages:
- Any set of languages is a property of languages.
- Example: The infiniteness property is the set of infinite languages.
- If a language
“has property infiniteness”, it means “ ” - In what follows, we’ll focus on properties of RE languages, because we can’t represent other languages by TM’s.
- We shall think of a property as a problem about Turing machines.
- 我们可以认为 property
。从这个角度看,property 是一个关于 languages 的 language;进一步,property 是一个 problem。- 这个 problem 可以描述为:Given a language, does it have property
? - 那尽然 property 是一个 problem,我们就可以说 “property is decidable/undecidable”
- 这个 problem 可以描述为:Given a language, does it have property
- 又因为
可以由 TM 产生,所以我们进一步定义:For any property , we can define a language , the set of binary strings for TM such that has property .- 简单说就是
- 我们可以把
视为这样的一个 problem:Given a code for a TM, does it define a language with that property ?
- 简单说就是
- 我们可以认为 property
- There are two (trivial) properties
for which is decidable.- The always-false property, which contains no RE languages.
- E.g. “this language is not RE.”
- How do we decide this property? I.e. the algorithm for this property is: Given an input
, ignore it and say no (reject). - Empty language is a RE language.
- The always-true property, which contains every RE language.
- E.g. “this language is RE.”
- How do we decide this property? I.e. the algorithm for this property is: Given an input
, ignore it and say yes (accept).
- The always-false property, which contains no RE languages.
- Rice’s Theorem: For every other (i.e. non-trivial) property
, is undecidable.
Reductions:
- A reduction from language
to language is an algorithm (TM that always halts) that takes a string and converts it to a string , with the property that: is in if and only if is in . - The value of having such a reduction is that it tells us
is no harder than , at least as far as decidability is concerned. - TM’s as Transducers
- We have regarded TM’s as acceptors of strings.
- But we could just as well visualize TM’s as having an output tape, where a string is written prior to the TM halting.
- If we reduce
to , and is decidable, then the algorithm for + the algorithm of the reduction shows that is also decidable.- Normally used in the contrapositive (逆否命题).
- If we know
is not decidable, then cannot be decidable.
- More powerful forms of reduction: if there is an algorithm for
, then there is an algorithm for .- E.g. we reduced
to
- E.g. we reduced
- More in NP-completeness discussion on Karp vs. Cook reductions
- The simple reduction is called a Karp reduction.
- More general kinds of reductions are called Cook reductions.
Proof of Rice’s Theorem
- Proof Skeleton
- We shall show that for every nontrivial property
of the RE languages, is undecidable. - We show how to reduce
to . - Since we know
is undecidable, it follows that is also undecidable.
- We shall show that for every nontrivial property
- The Reduction
- The input to
, is a TM and an input for . Then our reduction algorithm produces the code for a TM . - Define property
.- Thus
has property if and only if accepts .- “
has property ” 也就意味着 “ accepts a language with property ”
- “
- That is
if and only if .
- Thus
has two tapes, used for:- Simulates another TM
on ’s own input, say- The transducer (which in fact is
) does not deal with or see
- The transducer (which in fact is
- Simulates
on .- Note: neither
, , nor is input to .
- Note: neither
- Simulates another TM
- Assume that the empty language
does not have property .- If it does, consider the complement of
, say . then has property . - If we could prove that
are undecidable, then must be undecidable. That is if were a recursive language, then so would be since the recursive languages are closed under complementation.
- If it does, consider the complement of
- Let
be any language with property , and let be a TM that accepts .
- The input to
- Design of
- On the second tape,
writes and then simulate on . - If
accepts , then simulate on the input on the first tape. accepts its input if and only if accepts , i.e. .- If
does not accept , never gets to the stage where it simulate , and therefore accept nothing. - In this case,
defines an empty language, which does not have property .
- If
- Suppose
accepts .- Then
simulates and therefore accepts if and only if is in . - That is,
, has property , and .
- Then
- Suppose
does not accept .- Then
never starts the simulation of , and never accepts its input . - Thus,
, and does not have property . - That is,
.
- Then
- Thus, the algorithm that converts
and to is a reduction of to .- Thus,
is undecidable.
- Thus,
- On the second tape,
5. Turing Machines @ Erickson §6Permalink
6.1 Why Bother?Permalink
Admittedly, Turing machines are a terrible model for thinking about fast computation; simple operations that take constant time in the standard random-access model can require arbitrarily many steps on a Turing machine. Worse, seemingly minor variations in the precise definition of “Turing machine” can have significant impact on problem complexity. As a simple example (which will make more sense later), we can reverse a string of n bits in
But here we are not interested in finding fast algorithms, or indeed in finding algorithms at all, but rather in proving that some problems cannot be solved by any computational means. Such a bold claim requires a formal definition of “computation” that is simple enough to support formal argument, but still powerful enough to describe arbitrary algorithms. Turing machines are ideal for this purpose. In particular, Turing machines are powerful enough to simulate other Turing machines, while still simple enough to let us build up this self-simulation from scratch, unlike more complex but efficient models like the standard random-access machine.
(Arguably, self-simulation is even simpler in Church’s
6.2 Formal DefinitionsPermalink
- Three distinct special states
. - A transition function
.
7. Turing Machines @ Computational Complexity by Mike RosulekPermalink
Languages and UTM (Lecture 1 & 2)Permalink
Language:
- A language is a subset of
(actually it could be any subset of ) - A language
is a set of “yes-instances” is a “yes-instance” if
- Language
is Turing-recognizable (“recursively enumerable / r.e.”) if TM , such that accepts rejects or runs forever
- Language
is Turing-decidable (“recursive”) if TM , such that accepts rejects
- An algorithm formally is a TM which
- halts on any input regardless of whether that input is accepted or not, and
- accepts (a language) by final state
- In other words, language
is Turing-decidable (“recursive”) if an algorithm for . - If
is a TM, define
Programming conventions:
- Programming a TM for real is cruel!
- Describe a TM “program” in terms of tape modifications & head movements
- “Mark” cells on the tape (e.g.,
)
E.g. TM algorithm for
- “Mark” first char (e.g.,
), remember that char in internal state - If char to the right is “marked” or blank, then accept; else scan right until blank or a “marked” char
- If
, reject; else mark it - Scan left to leftmost unmarked char; if no more unmarked chars, accept; else repeat from step #1
Universal Machines:
- TMs can be encoded as strings (“code is data”)
- Convention: every string encodes some TM
: encoding of a TM : encoding of a TM and a string
is Turing-recognizable (RE)- Suppose there such a TM
that accept , i.e. . .- In other words,
recognizes , i.e.
- Suppose there such a TM
- TM
can recognizes , which means it can simulate any TM ! Thus call it a “universal TM”
Design of Universal TM:
- On input
, use 3 tapes:- one for description of
- one for
’s work tape contents - one for
’s current state
- one for description of
- Transitions:
- Legal to say “simulate execution of
on input ” in our TM pseudocode! – If halts on , the simulation will also halt – “Simulate execution of on input for steps” also possible (always halts)- Can simulate
steps of a TM in steps
- Can simulate
Diagonalization and Reduction (Lecture 2 & 3)Permalink
Diagonalization:
is not Turing-decidable (“recursive”)- Likewise,
- Likewise,
- 这里的
即前面 Jeff Ullman 的
(Turing) Reductions:
- Motivation:
- Let’s not use diagonalization technique every time to prove something undecidable!
- Instead, “reduce” one problem to another.
- What does “Alg decides lang” mean?
- Language
is a collection of yes-instances.- An
that is/satisfies “blab blah blah” is a yes-instance.
- An
- An algorithm is in nature a TM, so we can say “an algorithm
”. - If we say “
decides ”, it means:- Imagine
as a function,- The datatype of the parameter to
is the the one of the elements of . E.g.- if
, elements are ’s. Therefore the function signature is ; - if
, elements are ’s. Therefore the function signature is .
- if
if is/satisfies “blab blah blah” otherwise
- The datatype of the parameter to
- If we say “go find an algorithm for language”, it means:
- go find an
such that - go find an
such that if is/satisfies “blab blah blah”
- go find an
- Language
- Definition:
- We say
(“ Turing-reduces to ”) if there is an algorithm that decides using a (hypothetical) algorithm that decides .
- We say
- Inference:
- CASE 1: implication
- Ground Truth:
is decidable - Goal: To prove
is also decidable - Method: Construct an algorithm
for which satisfies is decidable so there must exist an algorithm for- Call
inside - In this way we prove that
holds.
- Ground Truth:
- CASE 2: contrapositive
- Ground Truth:
is undecidable - Goal: To prove
is also undecidable - Method: Assume
is decidable. Under this assumption, show we can construct an algorithm for which satisfies , i.e. holds.- In this way we imply that
is decidable. - However, we already know that
is undecidable. - Therefore the assumption is invalid.
- In this way we imply that
- Ground Truth:
- CASE 1: implication
- E.g. show that
is undecidable.- Choose
as is .- Assume there exists an algorithm
.
- Assume there exists an algorithm
- Construct an algorithm
using :- Signature:
- For every single pair of input
:- Construct an TM
- 根据
的语义, 要么 accept ,要么 reject - CASE 1: If
accepts , .- Therefore
. - I.e.
accept every . - I.e.
accept everything. - I.e.
(全集) - I.e.
. - I.e.
.
- Therefore
- CASE 2: If
rejects , .- Therefore
. - I.e.
rejects every . - I.e.
accept nothing. - I.e.
- I.e.
. - I.e.
.
- Therefore
- 根据
- If
- I.e.
- 一路反推到 CASE 2,我们有
rejects - 此时我们的
要 return no
- I.e.
- If
- I.e.
- 一路反推到 CASE 1,我们有
accepts - 此时我们的
要 return yes
- I.e.
- Construct an TM
- Signature:
- Now we showed
. We assumed is decidable, so is also decidable, which is against the truth. Therefore the assumption is invalid and is undecidable. - 最难的地方在 “Construct an algorithm
using ” 这一步,请结合 和 综合考虑。一般的的套路是:- 根据
的输入做一个临时变量,然后把这个临时变量当做 的输入。- 这个临时变量要满足
的 signature - 如果临时变量是一个 TM,比如上面的
,在处理自身的输入 时要见机行事- 如果能直接
或者 无疑是最好的 - 如果不能,考虑
这样的形式
- 如果能直接
- 这个临时变量要满足
- 然后根据
的输出决定 的输出。
- 根据
- Choose
// Reduce L_acc to L_empty
M_acc(<M_i,x_j>) {
M*_ij = TurningMachine(z) {
return M_i(x_j)
}
return !M_empty(M*_ij)
}
// General form of reduction algorithm for L_acc
M_acc(<M_i,x_j>) {
M*_ij = TurningMachine(z) {
if(M_i(x_j) = yes) {
return f_1(z)
} else {
return f_2(z)
}
}
return f_3(M_2(M*_ij))
}
Rice’s Theorem (Lecture 4)Permalink
Rice’s Theorem.
- Non-trivial means:
that has property ;- also
that does not has property . - I.e. “是否有 property
” 这个问题并不是永真或者永假
In other words, given encoding of
- Can’t decide whether
is empty - Can’t decide whether some special
- Can’t decide whether
is finite - etc.
Define
Claim.
Proof.
- By “non-trivial”:
- Suppose
does not have property . that has property .
- Suppose
- For every single pair of input
, construct an TM , such that on input- If
- return
- return
- else return No
- If
- If
, return Yes; else No - 逻辑是:
- If
accepts , 等价于 ,此时 应该具有 property . - If
rejects , 等价于 ,此时 应该不具有 property
- If
Kolmogorov Complexity (or, “optimal compression is hard!”) (Lecture 5 & 6) @ Algorithmic Information Theory and Kolmogorov ComplexityPermalink
Problem:
- 假设 compress
得到 ,decompress 得到 - 假设有一个 decompression algorithm
that - How small
can be compressed? - Here
denotes the length of a binary string
- How small
- In other words, the complexity of
is defined as the length of the shortest description of if each binary string is considered as a description of
Optimal decompression algorithm:
- The definition of
depends on . - For the trivial decompression algorithm
we have . - One can try to find better decompression algorithms, where “better” means “giving smaller complexities”
Definition 1. An algorithm
Theorem 1. There exists an decompression algorithm
Such an algorithm is described as asymptotically optimal.
- The complexity
with respect to an asymptotically optimal is called Kolmogorov complexity. - Assume that some asymptotically optimal decompression algorithm
is fixed, the Kolmogorov complexity of a string is denoted by ( ).- The complexity
can be interpreted as the amount of information in or the “compressed size” of .
- The complexity
The construction of optimal decompression algorithm:
- The idea of the construction is used in the so-called “self-extracting archives”. Assume that we want to send a compressed version of some file to our friend, but we are not sure he has the decompression program. What to do? Of course, we can send the program together with the compressed file. Or we can append the compressed file to the end of the program and get an executable file which will be applied to its own contents during the execution.
- 待补充。
Basic properties of Kolmogorov complexity:
- 待补充。
Algorithmic properties of
- 结合 Berry Paradox 补充
Complexity and incompleteness:
- 不懂
Algorithmic properties of
- 不懂
An encodings-free definition of complexity:
- 不懂
Axioms of complexity:
- 不懂
Kolmogorov Complexity (or, “optimal compression is hard!”) (Lecture 5 & 6) @ WikipediaPermalink
DefinitionPermalink
If
We could, alternatively, choose an encoding for Turing machines
Any string
function GenerateFixedString()
return s
If a description of
Invariance theoremPermalink
Informal treatmentPermalink
Theorem. Given any description language
Proof: Any description
The length of
A more formal treatmentPermalink
Theorem. If
Proof: By symmetry, it suffices to prove that there is some constant
Now, suppose there is a program in the language
function InterpretL2(string p)
return p()
Running InterpretL2
on input p
returns the result of running p
.
Thus, if InterpretL2(P)
returns the string
- The length of the program
InterpretL2
, which we can take to be the constant . - The length of
which by definition .
This proves the desired upper bound.
Basic resultsPermalink
In the following discussion, let
Theorem. There is a constant
Theorem. There exist strings of arbitrarily large Kolmogorov complexity. Formally: for each
Proof: Otherwise all of the infinitely many possible finite strings could be generated by the finitely many programs with a complexity below
Theorem.
Chain rule for Kolmogorov complexity:
It states that the shortest program that reproduces
CompressionPermalink
A string
A string incompressible by 1 is said to be simply incompressible––by the pigeonhole principle, which applies because every compressed string maps to only one uncompressed string, incompressible strings must exist, since there are
There are
There remain at least
Chaitin’s incompleteness theoremPermalink
We know that, in the set of all possible strings, most strings are complex in the sense that they cannot be described in any significantly “compressed” way. However, it turns out that the fact that a specific string is complex cannot be formally proven, if the complexity of the string is above a certain threshold.
Theorem. There exists a constant
can be proven within the axiomatic system
Proof by contradiction using Berry’s paradox. 略
Time/space complexity classes: P & NP @ class (Lecture 7)Permalink
Resource bounds:
has (worst case) running time if string , halts after at most steps. has (worst case) space usage if string , writes on at most tape cells.
Basic Complexity Class:
for “deterministic”- Formally,
if there is a TM and a constant such that decides , and runs in time ;- i.e., for all
(of length at least 1), halts in at most steps.
- i.e., for all
- E.g.
- Language / decision problem = set of strings (yes-instances)
- Complexity class = set of languages
Standard Complexity Classes:
- 如果把
看做 property 的话, 可以简单描述为 “deterministic poly time” - “deterministic” = “deterministically solvable in time” = “solvable in time by a deterministical TM”
- 如果把
Translating from “Complexity Theory Speak”:
- Is
?- Can problem
be solved using polynomial space?
- Can problem
- Is
?- Can every problem solvable in polynomial space also be solved in polynomial time?
- This is true:
Relationships between Complexity Classes:
- This follows from the observation that a TM cannot write on more than a constant number of cells per move.
- If
, then
Complementation @ Complement Classes and the Polynomial Time Hierarchy:
- 这里先声明下,全集可以表示为
、 或者 - The complement of a decision problem
, denoted , is the set of “No”-instances of .- 一般来说,我们可以认为
- 严格来说,
where is the set of well-formed strings describing “Yes” and “No” instances. That is, .- 只是通常会限定
- 只是通常会限定
- 举个例子:Every positive integer
is either composite (合数) or prime (质数)- 如果限定
- 如果仅限定
- 因为 1 既不是 prime 也不是 composite
- 如果限定
- 一般来说,我们可以认为
- The complement of a complexity class is the set of complements of languages in the class.
- 注意
和 没有半毛钱的关系 并不能说明
- Theorem 1.
- Theorem 2.
- Closure under complementation means:
- We say such class
are “closed under complementation”.
- We say such class
- Theorem 3. If
is a deterministic time or space complexity class, then .- E.g.
- 翻译一下:如果
can be solved by in poly time can also be solved by in poly time - vise versa
- 翻译一下:如果
- Why? For any class
defined by a deterministic TM , just switch accpet/reject behavior and you get a TM that decide- i.e.
, in the same bound of time or space.
- i.e.
- E.g.
可以描述为 nondeterministic polynomial time- “nondeterministic” = “nondeterministically solvable in time” = “solvable in time by a nondeterministical TM”
- Definition 1. A problem is assigned to the
class if it is solvable in polynomial time by a nondeterministic TM. - Definition 2.
, where halts in polynomial time, as a function of alone. : instance : proof / witness / solution- 简单理解就是,我们没有办法直接确定是否有
(nondeterministic),只能通过 是否满足 的条件来判断这个 是否有
- 举例待补充
- Definition.
, where- 等价于
- 等价于
halts in polynomial time, as a function of alone.
- 举例待补充
Theorem 1.
Proof: Take any
Define
Theorem 2.
Proof: Ditto.
Closure Properties of
- If
, then - If
, then
Karp reductions, NP hardness/completeness (Lecture 8)Permalink
Karp Reduction: Define
is at least as hard as EVERY problem in- If you could solve
in poly-time then
is -hard
which means:
is (one of) the hardest problem in- It’s impossible to prove
by solving in poly-time, because
Theorem. If
Proof:
- If
and - If
and - Suppose
is -compelte; then
“Canonical” NP-complete Problem
Claim.
Proof: Can be checked in poly time as a function of length of
Claim.
Proof:
Define
Cook-Levin Theorem & Natural NP-complete problems (Lecture 9 & 10)Permalink
Cook-Levin Theorem.
How to
- For a long clause in
, say , - Introduce
and break it into .- If
is TRUE, then must be TRUE - If
is FALSE, then must be TRUE - which means, one of
and must be true
- If
- Further break into:
NP in terms of nondeterministic computation (Lecture 11)Permalink
Nondeterministic TM:
- In state
, reading char , transition is a set of possible / legal actions.- Thus we can draw a graph of configurations for a Nondet TM on a given input
. - 注意 configuration graph 不是 general 的,不是针对所有的 input
的;而是对每一个特定的 ,我们都可以画一个 configuration graph - configuration graph 也可以称为 computation tree
- Thus we can draw a graph of configurations for a Nondet TM on a given input
- Nondeterministic TM is just imaginary, not a realistic model for computation. Just convenient for computational theory.
Nondeterministic TM acceptance:
- 在 configuration tree 中,每一个 internal node(非 leaf) 都是一个 configuration
- A configuration can have many outgoing edges in the configuration graph.
- 我们称每个可以走的 outgoing edge 为一个 choice
- Define computation thread on
: a path start at- 所以每个 computation thread 都可以看做一个 sequence of choices
- Define accepting thread: a computation thread eventually reaches
- NTM accepts
an accepting thread on - NTM rejects
an accepting thread on all threads rejects - Running time of NTM on
: max of steps among all threads - Space usage of NTM on
: max tape usage among all threads
Pitfalls of NTM:
- Nondeterministic “algorithm” defined in terms of local behavior within each thread
- Acceptance/rejection defined in terms of global/collective behavior of all threads
- Threads can’t “communicate” with each other
Claim: for
Proof: 略
Hierarchy theorems (Lecture 12 & 13)Permalink
Complexity Separations–the holy grail of computational complexity:
- Containments:
, etc - Separations:
?
Deterministic Hierarchy:
How to prove
- Better Diagonalization
- 略
Deterministic Time Hierarchy Theorem:
- Thus,
Deterministic Space Hierarchy Theorem:
- Ditto
- Thus,
Non-deterministic Hierarchy:
How to prove
- Delayed/lazy Diagonalization
- 略
Non-deterministic Time Hierarchy Theorem:
- Thus,
Non-deterministic Space Hierarchy Theorem:
- Ditto
- Thus,
Ladner’s theorem & NP-intermediate problems (Lecture 14)Permalink
Questions:
- Most natural problems are in
or -complete. - Any problem between
and -complete?
Ladner’s theorem:
- If
then we can construct such that: -complete
Claim: all finite languages are in
Proof: A finite language is a finite list of all yes-instances. Build an algorithm to compare input to this list and running time is bounded.
Claim: if
Proof: 注意这里
- If
(比方说 只有 三个 literal 并只有两个 clause), convert to an instance in - If
, by definition.
Ladner’s theorem 证明略
Polynomial hierarchy (Lecture 15)Permalink
Question:
problem: problem: runs in poly( ) time
- What about problems like
?
Polynomial Hierarchy:
- Define
problem: - Define
problem:- Generally, 这里的
应该是一个 Nondet TM runs in poly( ) time
- Generally, 这里的
- E.g.
of quantifiers doesn’t matter. E.g.- Obviously,
- But also
, so
- Obviously,
Properties (for all
Proof of
Suppose
Then
Polynomial Hierarchy:
- Define
- Conjecture: for all
: . - Since
for all , we have . Each or is called a level in the hierarchy.
Theorem: If
Proof: (1) If
Take any
Using the same
Since
Reconstruct
(2) If
Oracle computations and a characterization of PH (Lecture 16 & 17)Permalink
Let
- We call the “one-step” (not necessarily
, but a guaranteed time bound) algorithm to an oracle. - E.g. we can declare an oracle to solve
in poly time.
Similarly, if
Oracle complexity classes:
- Let
be a decision problem, then - Let
be a complexity class, then- Differenet threads of an
computation can ask different oracle queries for
- Differenet threads of an
Note: Overloaded Notation!
: special TM with oracle for a specific decision problem : complexity class with oracle for a specific decision problem : complexity class with oracle for any decision problem
Claim: If
Proof: By Karp reduction.
注意,我们的确是有
Claim:
Proof: By induction on
(1) [
Take any
Goal: show
Using the same
Choose
- Non-deterministically guess
- 不同的 guess of
对应不同的一条 computation thread
- 不同的 guess of
- Call oracle to see
. - Accept
if oracle says yes.- 相当于我们穷举了所有
的取值,并 query - 如果有某个 query 返回了 YES,说明
an accepting thread NTM accepts - 如果所有的 query 都返回 NO,说明
an accepting thread NTM rejects
- 相当于我们穷举了所有
(2) [
Suppose there is a
Goal: show
For simplicity, assume that each thread of
Suppose on input
CASE 1: on accepting thread
CASE 2: on accepting thread
Because
Space complexity (in terms of configuration graphs) (Lecture 18)Permalink
Configuration graphs:
- Two tapes:
- Read-only input tape
- Read-write work tape (calculate space usage on this tape)
- Transition:
: state : content of work tape- Here,
space usage of the TM
- Here,
: input tape head : work tape head
- Possible
of configurations- Suppose
uses space on input of length , as long as- Note that since the input is fixed and the input tape is read-only, we do not need to consider all possible length-
strings that can be written on the input tape.
- Suppose
Inclusions
- We alread had
Proof:
Let
Construct
M'(x):
run (orignal) M on x for C_M(n) steps
if M accepted x
return YES
else
return NO
runs in time- If
hasn’t halted in steps, it must be in an infinite loop
-completeness (Lecture 18 & 19)Permalink
Canonical
To prove that
- Show that
- If
, then is decided by some TM that uses space. Show via
TQBF
is -complete- 证明待补充
is also -complete- So
Geography Game
- What does “Play 1 has winning strategy” mean?
winning trategy, 所以 Play 1 是不能乱走的,是 winning moves,但是你得下出来才行- 那对 Player 2 而言,你无论怎么下都是输,所以是
moves of Player 2
- 后略
Regex Universality
- 略
Connectivity problems / Savitch’s theorem (Lecture 20)Permalink
- Karp reductions don’t make sense for defining
-completeness - Define log-space reduction
: a log-space computable function such that- What does “log-space computable function” mean?
requires memory to be computed- This restriction does NOT apply to the size of output
- The TM computating
has:- read-only input tape
- unidirectional output tape (“write-once”)
-length read/write work tape- TM cannot “cheat” and use output tape as storage
- Assume
is represented by an adjacency matrix - Vertices are named
- It takes
bits to write a single vertex name - Log-space is only enough to store
number of vertex names
- It takes
Claim:
Proof:
(1)
Idea: start from
CONN(G, s, t):
_curr = s
for i = 1 to n:
guess _next from {1,2,...,n}
if no _curr → _next edge:
reject
if _next == t:
accept
_curr = _next
reject
- Scan adjacency matrix cells one by one to detect
_curr → _next
edge - 2 variables:
_curr
and_next
space
(2)
Reduction strategy: Let
Idea:
- Let
be the configuration graph of on be the start configuration be the (unique) accepting configuration
Each configuration can be represented using
for each configuration i:
for each configuration j:
Output 1 if there is a legal transition from i to j, and 0 otherwise
(if i or j is not a legal state, simply output 0)
The algorithm requires i
and j
, and to check for a legal transition.
Corollary:
Proof: Take any
We can construct an algorithm for
A(x):
run BFS on f(x) to see whether exists s → t path
So
Summary:
- By the hierarchy theorems (and Savitch’s theorem, below) we know
, and . But we cannot prove that any of the inclusions above is strict.
Claim:
Proof: Define a recursive algorithm Path(a,b,i)
to seek “is there a
Path(a,b,i):
if i == 0:
check (a,b) edge in adjacency matrix
else:
for each vertex v
if Path(a,v,i-1) && Path(v,b,i-1)
accept
reject
- Call
Path(s, t, log n)
to check - Space Usage
- depth of recursion:
- stack frame of each iteration: space to write down
a,b,i,v
- Totally:
- depth of recursion:
Savitch’s theorem:
- Implies that “Nondeterminisim saves at most quadratic amount of space”
Proof: 待续
Corollary 7: If
Corollary 8:
参 Katz §7
Counting complexity / / -completeness / Parsimonious Reductions (Lecture 21)Permalink
Complexity of Counting:
- So far in the class: decision problems
- This unit: counting problems
Counting complexity classes
- For this lecture, “function” means
( for “Natural number”) - If
is a Nondet TM, define:- 注意这是一个 function,不是一个 decision problem
- 这个 function 即是一个 counting problem
- 实际应用时,
可以是一个 problem,e.g. : given boolean formula , determine of satisfying assignments of
- A function
is if a TM running in poly time such that
Claim:
Proof: Idea: given
M(x):
compute f(x) # in poly time
nondet guess positive integer i
accept if i <= f(x)
In this way,
优化策略:searching space 可能会很大,比如
Claim:
Proof: Equal to prove
Let
accepting threads of on accepting threads of on
(1)
Define
M_fg(x):
nondet guess bit b
if b == 0:
return M_f(x)
else:
return M_g(x)
相当于把
(2)
Define
M_fg(x):
run M_f(x)
if M_f(x) reached an accepting thread
return M_g(x)
相当于把
Claim: if
Proof: Already known that
- Not equivalent definitions, but both commonly used
- Def. 1:
is -hard if a poly time algorithm for implies (thus ) - Def. 2:
is -hard if via a parsimonious reduction
- Def. 1:
Parsimonious Reduction
- Let
& be counting problems (functions) if there a poly-time function such that
Claim: if
Claim: The counting version of any
Proof: Use
If
Claim:
Proof: Use
Given arbitrary
Let
and can represent .
待续。 Katz §23 需要大量补充进来
-completeness of the permanent (Lecture 22)Permalink
暂略
Randomized complexity classes / Amplification (Lecture 23)Permalink
2 ways to define a randomized TM (以下综合 slides、Katz §12 和 Trevisan §5.1):
- [“Lazy”] Deterministic TM with two transitions functions
- A random one is applied at each step
- [“Upfront”] Deterministic TM with an additional read-only “random tape”
- Each cell of this random tape is initialized randomly (with 0/1)
- Only finite portion of this random tape can actually be used
- Each cell of this random tape is initialized randomly (with 0/1)
- Randomized TM
你看做接受两个输入比较好理解:- For a fixed
, is the deterministic result with random choices - Then what is
?- [“Lazy”] The
bit of determines which transition function is used at the step - [“Upfront”]
is the value written on ’s random tape. - 也就是说,给定
,我们在穷举 :- 对某些
, - 对某些
, - 这样一来就存在一个 frequency 即
。概率就这么出来了。 - 如果你给了一个新的
,那么会有一组新的 和 ,概率也会不同- 也就是说,同一个
值,不一定有
- 也就是说,同一个
- 对某些
- [“Lazy”] The
- How long is
? I.e. is polynomial in the input length
- 如果给定
,把 看做一个变量,那么 即是一个 distribution induced by uniform- 你也可以把
看做是一个 Nondet TM,每一个 对应一条 computation thread
- 你也可以把
- For a fixed
- Randomized TM
runs in poly time (poly in )- 这个很好理解,因为
- 这个很好理解,因为
PPT = probabilistic, polynomial-time
- An algorithm
is probabilistic polynomial time (PPT) if it uses randomness (i.e, flips coins) and its running time is bounded by some polynomial in the input size. - Alternatively, “expected poly time” means
a polynomial (这里指 “多項式”) such that
= languages of the form: ( is a PPT TM, hereafter)- 注意:
时的 和 时的 是两套不同的 distribution,所以 时的 和 时的 没有任何关系,相加也不为 1。这个概念完整点写是这样的: (同时 ) (同时 )
- 注意:
- 换个角度陈述:
if a PPT TM such that: - Trevisan §5.1 的表述更好理解:
a PPT TM and a polynomial such that: has one-sided error.
题外话:我们还可以类似地定义
a PPT TM and a polynomial such that:
Claim:
Explaination: I can always “amplify”
def M'(x):
run M(x) independently t times
accept if any trial accepts
注意
所以
- 只要有一次
,我就可以 100% 判断- 我们称这个判断为 “no false positive”,i.e. 只要是判断为 positive 的(i.e. 判断
),一定是 true positive(i.e. 与 ground truth 吻合)。 - 同理,
是 “no false negative”.
- 我们称这个判断为 “no false positive”,i.e. 只要是判断为 positive 的(i.e. 判断
- 一次
无法判断一定有
注:写上面两段话时,我还没有领悟到 Trevisan §5.1 的概念更好理解。我自己写的
注二:Trevisan §5.1 的概念同时也跟方便理解 “什么是 error”?
- 我们期待的效果是像
一样: - 实际情况达不到的话,假设:
- 那么 error 可以这么计算:
-side error = -side error = =
- 这样就很好理解
的 one-sided error - 下面的
是 2-sided error;而且两边 error 相等,i.e.- 我们可以笼统地称
的 error = ,即不用特定指是哪一边。
- 我们可以笼统地称
= languages of the form:- Trevisan §5.1 的表述更好理解:
a PPT TM and a polynomial such that: has 2-sided error
How to amplify
def M'(x):
run M(x) independently t times
take the majority output
Chernoff Bound: How to calculate
- IID
- 我们总说是 independent and identically distributed random variables,换个方法断句可能更好理解一些:identically distributed, independent r.v.
- 假设有这么一个试验:在单次试验
中,我们要抛 次硬币,分别得到 这 个结果 - 执行
次试验,我们可以得到 组值,分别是 。 - 于是这
组值构成 个 distribution,也就是 个 r.v.- 这
个 r.v. 是 identical 的。在这里抛硬币的例子里,大家都是 Bernoulli;不可能 是 Bernoulli 然后 是 Gaussian. - 这
个 r.v. 是 independent 的。明显,第一次抛并不会影响第二次抛。
- 这
- Suppose
are IID and (this is how they are “identical”), then Chernoff Bound states that .- 简单理解就是,
is exponentially small - 这个其实就是 quantile 的理论,见下图
- 简单理解就是,
我们回头算
- Suppose
is the event of “obtaining wrong answer in trial of ”, so . - Let
and
- Let
and then
Katz §12 很精彩,值得一看
Relations between randomized complexity classes (Lecture 24)Permalink
a PPT TM and a polynomial such that: is unrealistic cannot be amplified
Lemma.
证明我就不详说了,反正一定可以 amplify 到。这个 Lemma 主要是为了证明 Sipser-Lautemann Theorem 服务的。
Sipser-Lautemann Theorem:
Proof:
所以一旦我们证明了
下面我们全力证明
暂略。
Non-uniformity in terms of circuits & advice / (Lecture 25)Permalink
Question: Does it help to have a different algorithm for each input length?
Non-uniformity
- TM is a “uniform” model of computation–a single TM handles all inputs.
- A circuit only handle input with a fixed length.
Circuits
- A circuit
has -bit input and is constructed with AND gates, OR gates and NOT gates. - A circuit
computes a function - Define
and max path length from input to output - Define Circuit family
has -bit input accepts if- i.e.
is decided by
- i.e.
- Size of
is such that
decision problems accepted by circuit family of size
Claim: Every language (even undecidable) is in
Proof: Suppose
Use the identity
The size of the circuit is:
注意解题技巧:我们这里说的
Relationship between
- Possibly
Theorem (Cook-Levin) Take any poly-time TM
注:
Theorem (Karp-Lipton-Sipser) If
Definition:
注意:这里是
你可以想象成有一个 advice pool
= problems solvable with a 1-bit advice = problems solvable with a -bit advice = problems solvable with a -bit advice
Claim:
Proof:
(1)
Take any
Let
def M(x, a_n):
interpret a_n as circuit
evaluates it on x
(2)
Take any
According to Theorem (Cook-Levin), any poly-time TM can be written as a poly-size circuit, so define
Karp-Lipton theorem / Meyer’s theorem (Lecture 26)Permalink
Karp-Lipton theorem If
Idea: First use
Then use
Proof: If
So
Meyer’s theorem If
Note: Weird sequences:
is closed under complememt. Therefore if , then also- Already known that
by time hierarchy theorem
Proof: Given
: On input , is in this state after steps : On input , ’s tape head is at this index after steps : On input , ’s tape has this character at index after steps are numbers (because of ), so required bits to write them down- Suppose the maximum step number is
We can imagine
\(
Comments