Computable and Computably Enumerable Languages
Total Page:16
File Type:pdf, Size:1020Kb
Computable and computably enumerable languages Peter Mayr Computability Theory, February 1, 2021 Definition � A DTM M with input alphabetΣ is halting if M halts on everyw Σ . ∈ ∗ � If M is halting, it decides its languageL(M). � L is computable (also decidable, recursive) if there exists a halting DTMM such thatL=L(M). � L is computably enumerable (c.e.) (also semi-decidable, recursively enumerable) if there exists a DTMM such that L=L(M). Note � Even ifM is not halting,L(M) may still be computable by a different DTM. � regular computable c.e. ⇒ ⇒ Theorem L is computable iffL and its complement L¯ is c.e. Proof. : LetL=L(M) for a halting DTMM. ⇒ � ThenL is c.e. by definition. � Also L¯=L(M �) is c.e. withM � likeM but with accept and reject stateflipped. : LetM = (Q ,...,δ ),M = (Q ,...,δ ) be DTMs with ⇐ 1 1 1 2 2 2 L=L(M 1), L¯=L(M 2). ConstructM to runM 1,M 2 in parallel on inputw: � statesQ 1 Q 2 × � tape alphabetΓ 1 Γ 2 × � transition functionδ 1 δ 2 × � accept states t 1 Q 2 (M1 accepts) { } × � reject statesQ 1 t2 (M 2 accepts) × { } ThenM is halting andL(M)=L. Closure properties of computable languages Theorem The class of computable languages is closed under complements, union, intersection, concatenation, ∗. Proof. Construct the corresponding DTMs. Question Which operations preserve c.e. languages? Why “enumerable”? Definition An enumerator is a DTMM with� Γ, ∈ � a working tape and � an output tape on whichM moves only right (or stays) and writes only symbols fromΓ . \{ } The generated language Gen(M) ofM is the set of all words thatM writes on the output tape when starting with empty tapes. Consecutive words are separated by�. Example IfM writes�1�11�111�... , then Gen(M)=L(�,1, 11,...). Theorem L is c.e. iff there exists an enumerator withL =Gen(M). Proof. : LetL=L(N) for a DTMN. ⇒ Idea: Construct an enumeratorM that runs through allw Σ ∈ ∗ and printsw ifN accepts it. M loops through all pairs (m,n) N 2 (countable!): ∈ � For (m,n),M construct them-th wordw m overΣ in length-lex order. � ThenN runs n steps with inputw m. IfN accepts, thenM ≤ printsw m. Then Gen(M)=L(N). Proof. : LetL =Gen(M) for an enumeratorM. ⇐ The following DTMN acceptsL: � On inputw,N startsM to enumerateL. � Ifw appears in output ofM,N acceptsw. � Else,N loops. Note � Being able to generate a languageL is equivalent to being able to acceptL (but not necessarily to reject its non-elements). � GeneratingL is “easier” than decidingL. Why “computable”? For setsX A andB we callf:X Ba partial function from ⊆ → A toB with domain(f)=X , denotedf:A B. → p Example + √x can be viewed as partial functionR p R with domainR . → 0 Definition A partial functionf:Σ Σ is computable if there exists a ∗ →p ∗ DTMM such that x,y Σ :(s,x ..., 0) (t,y ..., 0) iff ∀ ∈ ∗ � M∗ x domain(f ) andf(x)=y. ∈ Theorem f:Σ Σ is computable iff its graph ∗ →p ∗ 2 L := (x,y) (Σ ∗) :x domain(f),f(x)=y f { ∈ ∈ } is c.e. Proof. : HW ⇒ : AssumeL =Gen(N) for some enumeratorN. ⇐ f ConstructM that computesf(x) as follows: � M startsN to enumerate all pairs (a,b) L f . ∈ � If (x,y) appears for somey, thenM returnsy. � ElseM loops. Note Computing a function is the same as accepting its graph..