《计算理论》知识整理
During ,I was involved in the Theory-of-Computation class guided by Yingchun Yang.
Mrs. Yang do not teach well, so I had to learn by myself and tried to summary something.
Set and Language
- The Diagonalization Principle
- is the binary relation on set .
- is the diagonal set for : .
- Let
- Then D is distinct from each .
- if is a finite alphabet, then is countably infinite set (Lexicographically).
- Kleene Star: $$\begin{aligned} L^{\ast} &={w \in \Sigma^{*}: w=w_{1} \cdots w_{k}, k \geq 0, w_{1}, \cdots, w_{k} \in L} \ &=L^{0} \cup L^{1} \cup L^{2} \cup \cdots \ L^{+}&=L^{1} \cup L^{2} \cup L^{3} \cup \cdots \end{aligned}$$
Regular Language Finite Automata
- Definition: The Regular Expressions are all strings over the alphabet that can be obtained as follows:
- and is a regular expression.
- If and are regular expressions, then so are .
- Nothing is regular expression unless it follows from 1 through 2.
- The function is defined as follows:
- and for each
- If and are regular expressions, then
Example:
- Definition: The class of regular languages over an alphabet is defined to consist of all languages such that for some regular expression a over i.e. the class of regular languages over an alphabet is precisely the closure of the set of languages: ${ { \sigma }: \sigma \in \Sigma } \cup { \emptyset } $.
- Definition: A Deterministic Finite Automata is a quintuple where
- is a finite set of states
- is an alphabet
- is the initial state
- is the set of final states
- transition function
- Definition: A Nondeterministic Finite Automata is a quintuple where
- is a finite set of states
- is an alphabet
- is the initial state is the set of final states.
- transition relation, is a subset of
- Theorem: For each NFA, there is an equivalent DFA.
- Key idea: Every subset of becomes a single state in the new machine.
- Construction: For any NFA , construct an equivalent DFA :
- For each and , let and for some
- Claim: For any string and any states , (for some set containing ).
Use Mathematical Induction to prove this claim.
- Closure Properties of Regular Languages: The class of languages accepted by FA is closed under:
- Union
- use NFA to simply prove it.
- Note: Any finite union of regular sets is regular. Infinite unions may not be regular.
- Concatenation
- Kleene star
- Complementation
- Simply reverse the Final State.
- Intersection
- Prove1:
- Prove2:
- Example: Show is not regular.
- Proof: If is regular, then so would be But is not regular language.
- Union
- Theorem: A language is regular iff it is accepted by a .
- : Simply use the above properties.
-
- Definition: For and , define and for any prefix of , , .
- i.e. Each string which satisfies that use to reach just with the help of .
- Lemma: are regular languages.
- Construct the new equivalent FA that has the only initial state and the only final state. is the regular language we construct.
- Theorem: (Pumping Theorem) Let be a regular language. Exist an integer such that any string with can be written as such that:
- for each
Example: Show is not regular.
Proof:- Assume regular. and and where and (any as long meets the condition).
- By Pumping theorem, for each that is, is prime for each .
- However, let then
Context-Free Language PushDown Automata
- Definition: A Context-Free Grammar is a quadruple where
- is an alphabet;
- is the set of terminal symbols;
- is the start symbol;
- is the set of rules, a finite subset of
Example: Let , then
- Definition: A PushDown Automata is a sextuple , where
- is a finite set of states
- is an alphabet (the input symbols)
- is an alphabet (the stack symbols)
- is the initial state
- is the set of final states
- transition relation, is a subset of .
- execution: reading a symbol
Consider Then the PDA can:- enter some state
- replace by on the top of the stack
- advance the tape head
Note:
1. If , then is the top and is the bottom.
2. PDA receives strings when reach the final state and its stack is empty.
- Theorem: The class of languages accepted by PDA is exactly the class of CFL.
-
- Build state PDA and simply change each grammar to each transition relation.
-
- Definition: A PDA is simple if the following is true: Whenever is a transition of the PDA and is not the start state, then and .
-
- Closure Properties: The CFL are closed under Union, Concatenation, and Kleene star.
- Theorem: The Intersection of a CFL with a regular language is a CFL.
- Pumping Theorem for CFL.
- Lemma: The yield of any parse tree of G of height has length at most .
- Theorem: Let be a CFG. Then any string of length greater than can be rewritten as in such way that
- Example: Show that is not CFL.
- Proof:
- Case : contains occurrences of all three symbols at least one of must contain at least two of them order error in .
- Case : contains occurrences of some but not all of them has unequal number of and
Turing Machine
- Definition: A Turing Machine is a quintuple where
- is a finite set of states
- is an alphabet containing and but not containing the symbols and
- is the initial state
- is the set of halting states
- be the transition function:
- if then
- and if then
-
Notation for Turing Machine
- (or simply
a
): The machine with two states that only to write on the tape. - and (or simply
L
andR
): The machine with two states that only move left or right. - Machine Combination: . If the scanned symbol when halting is , starts up.
- (or simply
-
Example:
-
Multiple tapes Turing Machine
- Definition: Let be an integer. A -tape TM is a quintuple . The transition function $ \delta:(K-H) \times \sum^{k} \rightarrow K \times(\sum \cup{\leftarrow, \rightarrow})^{k}$.
- Conventionally, the input string is placed on the first tape, as well as the output string.
- Example:2-tapes copy machine:
- Theorem: Any tapes TM has a corresponding standard machine so that:
- , they halt in the same state and output same string.
- If halts on input after steps, then halts on input after a number of steps which is
More concepts
-
Recursive
- decides if the following is true:
- iff accepts (ends in the configuration)
- iff rejects (ends in the configuration)
- A language is recursive if a that decides .
- Example: The Turing Machine shown below decides .
- Definition: Let be a function . computes function if .
- A function is recursive if a TM computes .
- Example: .
- Properties:
- The recursive language is are closed under Union, Intersection, and Complement.
- .The recursive language is recursive enumerable.
- decides if the following is true:
-
Recursive Enumerable
- Definition: Let is a TM. Let be an alphabet and
- semidecides if for the following is true: halts on input .
- A language is recursively enumerable(r.e.), iff TM that semidecides
- means can not halt.
- Definition: Let is a TM. Let be an alphabet and
-
grammar
- Definition: A grammar (or unrestricted grammar) is a quadruple where
- is an alphabet;
- is the set of terminal symbols ( is called the set of nonterminal symbols).
- is the start symbol
- is the set of rules, a finite subset of
- Theorem: A language is generated by a grammar if and only if it is recursively enumerable.
- Definition: Let be a grammar, and let be a function. computes , if for all the following is true:
- A function is called grammatically computable iff there is a grammar that computes it.
- Theorem: A function is recursive iff and only if it is grammatically computable.
- Definition: A grammar (or unrestricted grammar) is a quadruple where
-
primitive recursive function
- The primitive recursive functions are all basic functions (the -ary zero function, the -th -ary identity function, the successor function), and all functions that can be obtained by them by any number of successive applications of composition and recursive definition.
- Example
- Definition: A primitive recursive predicate is a primitive recursive function that only takes values 0 and .
- . is also primitive recursive if others are.
- If is primitive recursive predicate, then are primitive recursive predicates.
- Example:
- Note: The set of primitive recursive function is proper subset of the set of recursive function.
- Prove: List all the primitive recursive function . Assume , so is computable but not primitive recursive.
- Definition: A function is -recursive if it can be obtained from the basic functions by the operations of composition, recursive definition, and minimalization of minimalizable functions.
- Theorem: A function is -recursive iff it is recursive (that is, computable by a TM).
Undecidability
-
Church - Turing thesis: Intuitive notation of “computable” = Formal notation of “computable functions by TM” .
- A problem is decidable iff it is recursive.
-
There is no program, no algorithm for solving the halting problem.
-
Theorem: Let The language is not recursive (but r.e.).
- Therefore, the class of recursive languages is a strict subset of the class of recursively enumerable languages.
- Proof:
- recursive recursive, where
Who decides surely decides . - recursive recursive.
The class of recursive languages is closed under complement. - is not even a r.e. language.
- recursive recursive, where
- Note that is r.e.
- Properties of Recursive Languages
- is recursive iff and are both r.e…
- Left Right: Simple.
- Right Left: Left two run simultaneously, either of them will stop finally.
- is recursive iff and are both r.e…
- Definition: We say that a Turing machine enumerates the language iff for some fixed state of , . A language is Turing-enumerable iff there is a Turing machine that enumerates it.
- A language is recursively enumerable iff it is Turing-enumerable.
- A language is recursively iff it is lexicographically Turing-enumerable.
- Rice Theorem: If is a class of recursively enumerable languages such that is neither empty nor the set of all indices, then is undecidable.
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.