Presentation is loading. Please wait.

Presentation is loading. Please wait.

111 Computability, etc. Recap. Present homework. Grammar and machine equivalences. Turing history Homework: Equivalence assignments. Presentation proposals,

Similar presentations


Presentation on theme: "111 Computability, etc. Recap. Present homework. Grammar and machine equivalences. Turing history Homework: Equivalence assignments. Presentation proposals,"— Presentation transcript:

1 111 Computability, etc. Recap. Present homework. Grammar and machine equivalences. Turing history Homework: Equivalence assignments. Presentation proposals, preparation. Keep up on postings.

2 111 Recap Define different types of machines. –abstract machines Machines are fed (my term) strings in a specified alphabet. Machines scan the strings and say yes or no (accept or reject) Each machine accepts strings in a certain pattern. We call the set of strings in that pattern a language.

3 111 Recap Repeat: a language is a SET of strings. This set may be finite or infinite. –the empty set is a language, with no actual members==elements This set may or may not include the empty string

4 111 Homework Define a FSA, alphabet {A,blank}, that accepts strings with even number of As. Define a second FSA that accepts strings with an odd number of As. Define a PDA, alphabet {A, blank,(, ),+} that accepts A, A+A, (A+A), (A+(A+A)) etc. NOT A+, not unbalanced ( and ). HOLD OFF ON THIS ONE: SEE HOMEWORK! Define TM that subtracts 1. If input is zero, then tape is cleared. Define Turing machine to subtract two numbers a and b, represented by a+1 1s followed by a blank followed by b+1 1s –if (a>=b), put (a-b) + 1 1s on the tape –if a<b, leave zero 1s in the tape OR return something else if a<b ???

5 111 Turing machine can perform a function or define same type of machine plus accepting and rejecting states and say a TM defines a language L if strings in the language L make the machine stop in an accepting state and strings NOT in L stop in a rejecting state.

6 111 Decidability A TM that always halts is called a decider. –TM can keep going, that is, loop… A language is Turing-decidable if a decider TM recognizes it.

7 111 Univeral Turing Machine Consider the input where M is [some encoding for] a Turing Machine and w is a string. Claim: it is possible to define a TM U such that U simulates M on w! This is analogous to a general purpose computer. –may have contributed to idea of stored program computing

8 111 Halting problem Consider a universal Turing machine U. Now, if a M loops on a w, so would U. U is not a decider! Put another way: the set ATM = { | M is a TM and M accepts w} is undecidable. It can be proven that there does not exist a TM that always halts, that says yes or no on all inputs.

9 111 Recap There are different definitions/constructions/concepts that define the same set of functions or languages. So-called recursive functions (more next) correspond to computable (TM) functions. Languages defined by a Regular Expression (look it up) are languages recognized by a FSA. Languages defined by a Context Free Grammar (look it up) are languages recognized by a PDA. Some proofs of equivalence are easy and some more substantial. –Will not focus on proofs, BUT these are possible topics for presentations.

10 111 Recursive functions Define a set of functions by specifying a starter set and then ways of adding new functions. Functions can be on vectors. Stick to integers. Starter set identify function and projection I(x) = x and P i (x1,x2,…xn) = xi Add 1: A(x) = x+1 Constant: C k (x) = k

11 111 Ways to add Composition: if F and G are recursive (and F produces the right size vector, then the composition G F (first you do F and then G to the result) is recursive. Primitive recursion: Given functions F and G, define H H(0,x1, x2, …, xn) = F(x1, x2, … xn) and H(y+1, x1, x2, … xn)= G(y,x1, …,xn, H(x1,x2,…,xn)) Minimal inverse: Given a function F, then the function H defined by H(x) = y such that F(y) = x and y is the smallest integer such that that is true.

12 111 Equivalence! If there exists a TM for a function F, then F is recursive. If a function F is recursive (that is, in this set), then [you can define] a TM that performs F.

13 111 Grammars A grammar G is a –set of symbols, divided in final symbols and auxiliary symbols –(finite) set of production rules of the form string of symbols => string of symbols final symbols have no production rules of the form f => … In this exposition, we view certain strings of letters as single symbols. –one auxiliary is called the started symbol s –The language generated (defined by) G is all the strings of final symbols generated by a sequence starting with s

14 111 Example Think of auxiliaries as parts of speech and final symbols as (whole) words Let s be sentence vp be verb phrase np be noun phrase n be noun v be verb do be direct object adj be adjective adv be adverb

15 111 Example Think of parts of speech s => np vp np => adj n | n vp => v | v adv | v do | v do adv do => n n => boy | girl | dog | cheese v => walks | runs | jumps | eats adj => short | tall | spotted adv => fast | slowly

16 111 Try To construct the parse tree for tall girl walks short boy eats cheese slowly

17 111 Context free grammar Production rules are of the form auxiliary symbol => string of symbols

18 111 So what isn't CFG? There also can be rules of the form aPb => …. where P is an auxiliary symbol. Think of it as: P in the context of a and b produces something. So this is NOT context-free.

19 111 Example CFG S => T T => a T => a + T T => (T) What language does this produce (list the terms)?

20 111 Regular grammar All rules are of the form: auxiliary symbol => final symbol or auxiliary symbol => single final symbol followed by an auxiliary symbol

21 111 So a regular grammar is CFG!

22 111 Regular grammars & FSA Any language accepted by a regular grammar is accepted by a FSA and Any language accepted by a FSA is accepted by a regular grammar. Said a different way: If a language L is accepted by a regular grammar G, we can define a FSA that accepts it AND if a language L is accepted by a FSA, we can define a regular grammar that accepts it.

23 111 Informal proof Have a Grammar G with production rules of the accepted form. Define a FSA with one state for each auxiliary symbol, plus one more state. Make the initial state the one corresponding to the initial symbol. Add one more state, F and let it be the final state. If P=>aQ, where P and Q are auxiliaries and a is a symbol in the final alphabet, make an edge from P to Q, with label a. If P=>a, make an edge going from P to F with label a.

24 111 Cont. Given a FSA, define a grammar with auxiliary symbols corresponding to the states. The initial symbol is the one corresponding to the initial state. Add production rules P=>aQ for all edges from P to Q. Change all production rules P=>aF to P=>a.

25 111 Closure Regular languages are closed with respect to various operations, including concatenation. If M is a regular language and N is a regular language, then we can define MN is the language made up of all the strings of the form s m s n where s n where s m is in M and s n is in N. Then MN also is regular.

26 111 Closure If M and N are regular languages then so is the union of M and N. This is defined as the set of strings that are in M or are in N (or both). This also is a regular language.

27 111 Regular expressions Yet another equivalent definition! A regular expression over an alphabet is a pattern defined using letters from the alphabet combined using notation for union, concatenation, wild card, counts. The regular expession defines a set of strings, that is, a language

28 111 CFG and PDA Same equivalence here.

29 111 Turing history Invented what came to be called Turing machines. Proved various things about them, including Halting problem Worked in Bletchley Park during WWII: built a machine to help decode German codes (codes changed). Given medal (in secret) Worked in general area, including spending time at Princeton with Van Neumann, others. Wrote papers on computer chess, notion of Turing test Arrested & convicted for homosexual acts. Made to take hormone drugs. Appeared to be okay… Committed suicide

30 111 Homework Pick 1: Please think about it first instead of or before trying to look it up. Informal proofs are okay. –CFG and PDA equivalence If you believe this, then there does exist a PDA for the homework problem. –Regular expression and (either) FSA or Regular grammar equivalence Possibilities for presentation topics in Turing work, history Keep up postings Shai videos


Download ppt "111 Computability, etc. Recap. Present homework. Grammar and machine equivalences. Turing history Homework: Equivalence assignments. Presentation proposals,"

Similar presentations


Ads by Google