lecture 11multi version timestamp ordering protocol

35
Theory of Computation Lecture #10 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 35

Upload: sun-java

Post on 16-Sep-2015

240 views

Category:

Documents


0 download

DESCRIPTION

Multi Version Timestamp Ordering Protocol

TRANSCRIPT

  • Theory of ComputationLecture #10

    Sarmad Abbasi

    Virtual University

    Sarmad Abbasi (Virtual University) Theory of Computation 1 / 35

  • Lecture 10: Overview

    Undecidability of the Halting ProblemRussells ParadoxReducibilityUndecidable ProblemsLinear bounded automata

    Sarmad Abbasi (Virtual University) Theory of Computation 2 / 35

  • Acceptance Problem for TMs

    Let us define

    ATM = {M,w : M is a TM that accepts w}.This is called the acceptance problem for TMs or the halting problem.We also call this the Halting Problem. We showed that this problem isundecidable.

    Sarmad Abbasi (Virtual University) Theory of Computation 3 / 35

  • Undecidability of the Halting Problem

    TheoremATM is not decidable.

    The language ATM is undecidable. There is no TH H such that on inputM,w

    1 H accepts if M accepts w .2 H rejects if M does not accept w .

    Sarmad Abbasi (Virtual University) Theory of Computation 4 / 35

  • Undecidability of the Halting Problem

    If H exists we can use H to construct D as follows:

    1 On input M.2 Convert M into M, M3 Run H on M, M.4 Output the opposite of what H does; that is

    If H accepts reject, if H rejects accept.

    Once we have constructed D we will ask how it behaves on its owndescription.

    Sarmad Abbasi (Virtual University) Theory of Computation 5 / 35

  • Undecidability of the Halting Problem

    Assume that H exists. We use H to construct D. This is easy D simplyconverts its input M into M, M and calls H. It returns the answerthat is opposite of the one given by H.

    1 H accepts M,w exactly when M accepts w .2 D rejects M exactly when M accepts M.3 D rejects D exactly when D accepts D.

    This leads to a contradiction.

    Sarmad Abbasi (Virtual University) Theory of Computation 6 / 35

  • Russells Paradox

    In a town called Seville there lives a barber.A man Seville is shaved by the barber if and only if the man does notshave himself?"

    QuestionDoes the barber of Seville shaves himself.

    Sarmad Abbasi (Virtual University) Theory of Computation 7 / 35

  • Russells Paradox

    Students are asked to make a list in which they can include the namesof anyone (including themselves) in a class room. Is there a particularstudent wrote the names of those people in the class who did notinclude their own names in their own list?

    QuestionDoes that particular student write his/her own name on his/her list?

    Sarmad Abbasi (Virtual University) Theory of Computation 8 / 35

  • Russells Paradox

    Is it possible to have an enumerator that enumerates the description ofall the enumerators that do not enumerate their own description.Suppose such an enumerator F exists.

    QuestionDoes F enumerate its own description?

    Sarmad Abbasi (Virtual University) Theory of Computation 9 / 35

  • Russells Paradox

    1 D that accepts (the description of) those TMs that do not accepttheir own description.

    2 Barber who shaves all those people who do not shave themselves.3 Student who lists all those students who do not list themselves.4 Enumerator that enumerates (the description of) all those

    enumerators that do not enumerate themselves.

    Such objects cannot exist.

    Sarmad Abbasi (Virtual University) Theory of Computation 10 / 35

  • Reducibility

    Suppose u have a language B in your mind and you can prove that

    If I can make a decider for B the I can make a decider for the haltingproblem.

    Sarmad Abbasi (Virtual University) Theory of Computation 11 / 35

  • Reducibility

    Now suppose some one claims that they have a decider for thelanguage B. Then I can claim that I have a decider for ATM. Which isabsurd.From this we can conclude that B is also undecidable as we know thatATM is undecidable.

    Sarmad Abbasi (Virtual University) Theory of Computation 12 / 35

  • Reducibility

    HALTTM = {M,w : M is a TM that halts on w}.

    TheoremHALTTM is undecidable.

    Sarmad Abbasi (Virtual University) Theory of Computation 13 / 35

  • Reducibility

    Suppose that HALTTM is decidable and R decides HALTTM. If we haveR then we have no problem on TM that loop endlessly. We can alwayscheck if a TM will loop endlessly on a given input using R. We can useR to make a decider for ATM. We know that ATM is undecidable. Wehave a contradiction and that is why R cannot exist.

    Sarmad Abbasi (Virtual University) Theory of Computation 14 / 35

  • Reducibility

    Given R we can construct S which decides ATM that operates asfollows:On input M,w

    1 Run TM R on input M,w.2 If R rejects, reject.3 If R accepts, simulate M on w until it halts.4 If M has accepted w , accept; if M has rejected w , reject.

    Note that S will reject M,w even if M loops on w .

    Sarmad Abbasi (Virtual University) Theory of Computation 15 / 35

  • Emptiness problem for TMs

    ETM = {M : L(M) = }.

    TheoremETM is undecidable.

    Sarmad Abbasi (Virtual University) Theory of Computation 16 / 35

  • Emptiness problem

    Suppose that ETM is decidable and R decides ETM. R accepts M if thelanguage of M is empty. We can use R to make a decider S for ATM.We know that ATM is undecidable. We have a contradiction and that iswhy R cannot exist. How can we construct S?

    Sarmad Abbasi (Virtual University) Theory of Computation 17 / 35

  • Emptiness problem

    S gets M,w as an input. The first idea is to run R on input M andcheck if it accepts. If it does, we know that L(M) is empty and thereforethat M does not accept w . But, if R rejects we only know that thelanguage of R is not empty. We do not know anything about what itdoes on w . So the idea does not work. We have to come up withanother idea.

    Sarmad Abbasi (Virtual University) Theory of Computation 18 / 35

  • Emptiness problem

    Given M and w let us consider M1:1 On input x2 If x 6= w , reject.3 If x = w , run M on input w and accept if M accepts w .

    What is L(M1)?

    Sarmad Abbasi (Virtual University) Theory of Computation 19 / 35

  • Emptiness problem

    L(M1) ={ , if M does not accept w ;

    {w}, if M accepts w .

    Sarmad Abbasi (Virtual University) Theory of Computation 20 / 35

  • Emptiness problem

    Given R we can now we can construct S which decides ATM thatoperates as follows:On input M,w

    1 Run TM R on input M,w.2 Construct M13 Run R on M14 If R accepts M1, reject. If it rejects M1 accept.

    Sarmad Abbasi (Virtual University) Theory of Computation 21 / 35

  • Emptiness problem

    S is a decider for ATM. Since S does not exist we conclude that R doesnot exist. So ETM is undecidable.

    Sarmad Abbasi (Virtual University) Theory of Computation 22 / 35

  • Regular languages and TMs

    REGTM = {M : L(M) is regular}.

    TheoremREGTM is undecidable.

    Sarmad Abbasi (Virtual University) Theory of Computation 23 / 35

  • Regular languages and TMs

    Suppose that REGTM is decidable and R decides REGTM. R accepts allTMs that accept a regular language and reject all TMs that do notaccept a regular language. How can we use R to construct a deciderfor ATM? Note that S has to get as input M,w and has to decide if Maccepts w . The idea is as follows:

    Sarmad Abbasi (Virtual University) Theory of Computation 24 / 35

  • Regular languages and TMs

    S gets M,w as an input. Given M and w we will construct a machineM2 such that

    L(M2) ={

    is regular, if M accpets w ;not regular , if M does not w .

    Sarmad Abbasi (Virtual University) Theory of Computation 25 / 35

  • Regular languages and TMs

    Given M and w let us consider M2:1 On input x2 If x = 0n1n then accept.3 else run M on input w and accept x if M accepts w .

    What is L(M2)?

    Sarmad Abbasi (Virtual University) Theory of Computation 26 / 35

  • Regular languages and TMs

    L(M2) ={ {0n1n : n 0}, if M does not accept w ;

    {0,1}, if M accepts w .

    Sarmad Abbasi (Virtual University) Theory of Computation 27 / 35

  • Regular languages and TMs

    Given R we can now we can construct S which decides ATM thatoperates as follows:On input M,w

    1 Construct M22 Run R on M23 If R accepts M2, accept. If it rejects M2 reject.

    Sarmad Abbasi (Virtual University) Theory of Computation 28 / 35

  • Regular languages and TMs

    S is a decider for ATM. Since S does not exist we conclude that R doesnot exist. So REGTM is undecidable.

    Sarmad Abbasi (Virtual University) Theory of Computation 29 / 35

  • Equivalence problem for TMs

    So far we have only used ATM to show that other problems areundecidable. Let us do something different. Let us define:

    EQTM = {M1,M2 : L(M1) = L(M2)}.

    TheoremEQTM is undecidable.

    Sarmad Abbasi (Virtual University) Theory of Computation 30 / 35

  • Equivalence problem for TMs

    Suppose that EQTM is decidable and R decides EQTM. ETM is theproblem of determining whether the language of a TM is empty. EQTMis the problem of determining whether the languages of two TMs arethe same. If one of these languages is forced to be the empty set, weend up with the problem of determining whether the language of theother machine is empty.

    ETM is a special case of EQTM.

    Sarmad Abbasi (Virtual University) Theory of Computation 31 / 35

  • Equivalence problem for TMs

    Suppose R decides EQTM. We design S to decide ETM.S gets M as an input. Let M0 be a machine that rejects all inputs.

    Sarmad Abbasi (Virtual University) Theory of Computation 32 / 35

  • Equivalence problem for TMs

    On input M1 Run R on M,M02 If R accepts, accept. If it rejects , reject.

    It is easy to see that the language of S is ETM. As, ETM is undecidableso is EQTM.

    Sarmad Abbasi (Virtual University) Theory of Computation 33 / 35

  • Linear Bounded Automata

    An LBA L is a restricted type of TM. Its tape head is not permitted tomove off the portion of the tape containing the input.Here is a diagram of an LBA:

    Sarmad Abbasi (Virtual University) Theory of Computation 34 / 35

  • Linear Bounded Automata

    As you can see the input portion of the tape is the only tape that theLBA is allowed to move its head on.

    Sarmad Abbasi (Virtual University) Theory of Computation 35 / 35