automata assignments

Upload: poojaa-juneja

Post on 01-Jun-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 automata assignments

    1/24

    QNo1.What is the diference between the strings and the words o a language?Answer:A

    string is any combination of the letters of an alphabet where as the words of a language are the

    strings that are always made according to certain rules used to dene that language.For example if

    we take

    Alphabet = { a , b !ere a , b are the letters of this alphabet.

    As you can see we can make a lot of strings from these letters a and b.

    For example a,b,aa,ab,ba,bb,aaa,aab,aba,baa,"""""""""""""""""""" and so on.

    #ut when we dene a language o$er this alphabet ha$ing no asand only odd number ofbs. %hen

    the wordsof this language would ha$e only those stringsthat ha$e only odd number of bsand

    no as.some example words of our dened language are

    b , bbb , bbbbb , bbbbbbb ,"""""""""""..and so on.

    &o we can say that all the words are strings but all the strings may not be the words ofalanguage.!ence strings are any combination of letters of an alphabet and the words of a language

    are strings made according to some rule.QNo.2 What is the diference between an Alphabet and an element o a set. Whether

    Alphabet is an element o a set or it is a set itsel?

    Answer:An Alphabet is a set in itself. %he elements of an Alphabet are called letters .

    For example

    #inary Alphabet = {',(

    !ere ',( are the letters of binary alphabet.

    #inary Alphabet is $ery important because it the Alphabet used by the computer.

    &et of )atural )umbers

    )={(,*,+,,-,"""""""""""""..

    !ere (,*,+"""""""""""""". are the elements of set of )atural )umbers.

    QNo. What is Null !tring "#$ ?

    Answer:%he string with ero occurrences of symbols /letters0 from 1.

    2t is denoted by /&mall 3reek letter 4ambda0 5 or /6apital 3reek letter 4ambda0 7, is called an

    empty string or null string.

    %he capital lambda will mostly be used to denote the empty string, in further discussion.

    QNo.% What is &A'(N)*+,- ?

    Answer:%he language consisting of 7 /)ull &tring0 and the strings s defined o$er an Alphabet

    such that

    8e$/s0=s.

  • 8/9/2019 automata assignments

    2/24

    &ome example words of this language are

    aa

    As 8e$/aa0 = aa

    aba

    As 8e$/aba0 = aba

    bbb

    As 8e$/bbb0 = bbb

    aabaa

    As 8e$/aabaa0 = aabaa

    bbbaaabbb

    As 8e$/ bbbaaabbb 0 = bbbaaabbb

    2t is to be noted that the words of 9A42):8;hile dening an alphabet of letters consisting of more than one symbols, no letter

    should be started with any other the letter of the same alphabet i.e. one letter should not be the

    prex of another. !owe$er, a letter may be ended in the letter of same alphabet i.e. one letter may

    be the su?x of another.

    = { a , b / @alid Alphabet0

    = { a , b , cd / @alid Alphabet0

    = { a , b , ac / 2n$alid Alphabet0

    QNo 0. What is A'+' ?

    Answer:A43;4 /A43;rithmic 4anguage0 is one of se$eral high le$el languages designed

    specically for programming scientic computations. 2t started out in the late (-'Bs, rst

    formalied in a report titled A43;4 -C, and then progressed through reports A43;4 D', and A43;4

    DC. 2t was designed by an international committee to be a uni$ersal language. %heir original

    conference, which took place in Eurich, was one of the rst formal attempts to address the issue of

    software portability. A43;4Bs machine independence permitted the designers to be more creati$e,

    but it made implementation much more di?cult. Although A43;4 ne$er reached the le$el of

    commercial popularity of F;8%8A) and 6;#;4, it is considered the most important language of its

    era in terms of its inuence on later language de$elopment. A43;4Bs lexical and syntactic

    structures became so popular that $irtually all languages designed since ha$e been referred to asGA43;4 H likeIJ that is they ha$e been hierarchical in structure with nesting of both en$ironments

  • 8/9/2019 automata assignments

    3/24

    and control structures.

    QNo. What are the !e3uential +perators?

    Answer:!e3uencing +perators:&eKuencing operatorsa LL b &eKuence

  • 8/9/2019 automata assignments

    4/24

    2f = {x

    %hen S = {7, x, xx, xxx, xxxx, ".

    2f = {',(

    %hen S = {7, ', (, '', '(, (', ((, ".

    2f = {aa#, c

    %hen S = {7, aa#, c, aa#aa#, aa#c, caa#, cc, ".

    )oteQ

    4anguages generated by Rleene &tar 6losure of set of strings, are innite languages. /#y innitelanguage, it is supposed that the language contains innite many words, each of nite length0

    QNo12.

  • 8/9/2019 automata assignments

    5/24

    computer science, a niteNstate machine /F&e can also show transitions on

    reading any strings in %3s but it is not possible in FABs. 2n 3%3 :irected edges connecting

    some pair of states are labeled with regular expressions . 2t may be noted that in 3%3, the

    labels of transition edges are corresponding regular expressions. 2n %3 we write strings and

    in 3%3 we are bound to write 8. $ery FA is also a %3 but not e$ery %3 is FA.

    Q No. What is the diference between 8As and Es .Wh7 we need Es when we

    ha/e 8As?

    %he %ransition 3raphs /%30 diTer from FA in the following areas

    %3Bs are generaliations of FABs.

    %3Bs can change state without an input / )ull transition0.

    6an read more than one letter /words of the language they are accepting0 along the

    transition edges at a time.

    6an ha$e a regular expression as a edge label.

    6an ha$e more then one start state.

    >e ha$e been gi$en more freedom in %3Bs. #ut this freedom is on the cost of more memory

    and processing power it means that if we implement %3Bs on computer using some

    programming language it will need more memory and processing power of computer than

    used in the implementation of FABs.

    Q No.% What is the concept o the nion o 8As ?

    >hen we take Wnion of two FABs it means that resultant FABs should accept all the words that

    were accepted by the two FABs indi$idually. 2t is like taking union of two sets, the resultant set

    contain members of both sets.

    For example

    4et A ={(,+,-,X,

  • 8/9/2019 automata assignments

    6/24

    and

    # = {',*,,D,C,('

    then, A W # = { ',(,*,+,,-,D,X,C,,('

    you can see that A W # contain elements of both sets similar is the case with 8As.

    Q No. What is the diference between is E and E ?

    2n %3, there are letter transitions for the strings. >hile in 3%3, one can write whole 8 as a

    transition from one state to another one.

    Q No.0 Fow one can create *- o a particular language?

    First thing about 8 and FA is that there is no hard and fast formula or method to generate

    these. ;ne can generate them by its mental approach. And this mental approach can be

    acKuired through only 98A6%26.

    !ere are some useful tips to write 8Bs,

    Y

    4et our language consist of the words of length three exactly o$er alphabet = {a,b

    then it consists of the words

    4 = {aaa, aab, aba,abb,baa,bab,bba,bbb.

    2ts 8 can be simply written as

    8 = aaa Z aab Z aba Z abb Z baa Z bab Z bba Z bbb

    which simply means that our language consists of onl7these words.

    &o we can make 8 for a nite language by writing its all words with Z operator between

    them.

    Y

    >e should also keep the null stringin our mind. 2f our language generates null string than

    our 8 should also generate it0

    For example language ha$ing all the words of e$en length has null string in it as well so we

    can write its 8 as follows

    8 = //aZb0/aZb00S

    %his 8 also generates null string.

    2f a language generates all strings starting with a. then strings will be of type

  • 8/9/2019 automata assignments

    7/24

    a , aa, ab, aab, aaa, aba, abb,".

    !ere 8 should start with [aB and then all strings including null. &o this will be /a Z b0S and

    complete 8 is a /aZ b0S.

    &imilarly languages of strings ending in b will ha$e 8 /a Z b0Sb.

    Q No. What is the diagrammaticall7 diference between 8As and Es?

    %he main diTerences between FABs and %3Bs are as follows

    Y

    Y

    Y

    Q No.4 What is the corresponding 8A or *- Gaa""aBb$"aBb$$

    8 is aa//a Z b0/a Z b00S. 2ts corresponding FA is as follows.

    Q No.6 What is diference between 8As and N8As. Are the7 opposite to each other

    ?

    FA stands for nite automata while )FA stands for nonNdeterministic nite automata

    2n FA there must be a transition for each letter of the alphabet from each state. &o in FA

    number of transitions must be eKual to /number of states S number of letter in alphabet0.

    >hile in )FA there may be more than one transition for a letter from a state. And nally

    e$ery FA is an )FA while e$ery )FA may be an FA or not.

    Q No.19 )iferentiate between "aDb$ and "aBb$?

    /a, b0 = 8epresents a and b.

    /a Z b0 = 8epresents either a or b.

    FAVBs about 4ectures (( to (-

    Q No.1 What is the diference between hows 8A and E .Wh7 we need Es when we

    ha/e 8As?%he %ransition 3raphs /%30 diTer from FA in the following areas

    Y %3Bs can change state without an input / )ull transition0.

    >e ha$e been gi$en more freedom in %3Bs. #ut this freedom is on the cost of more memory

    and processing power it means that if we implement %3Bs on computer using some

    programming language it will need more memory and processing power of computer than used

    in the implementation of FABs.

    Q No.2 What is the concept o the nion o 8As ?

    >hen we take Wnion of two FABs it means that resultant FABs should accept all the words that

    were accepted by the two FABs indi$idually. 2t is like taking union of two sets the resultant set

    contain members of both sets.

  • 8/9/2019 automata assignments

    8/24

    For example

    4et A ={(,+,-,X,

    and

    # = {',*,,D,C,('

    then, A W # = { ',(,*,+,,-,D,X,C,,('

    you can see that A W # contain elements of both sets similar is the case with FABs.

    Q No. What is the diference between E and E ?

    2n %3, there are transitions for the strings. >hile in 3%3, one can write whole 8 as a transition

    from one state to another one.

    Q No.% Fow to create a *- o a particular 'anguage?

    8egular expression is used to express the innite or nite language, these 8 are made in such

    a way that these can generate the strings of that uniKue language also for the cross check that

    the dened 8 is of a specied language that 8 should accept all the string of that language

    and all language strings should be accepted by that 8.

    Q No. Fow diagrams o 8As are created ?

    2t depends upon the Kuestion how many states in$ol$e in a FA. %here is not any formal

    procedure to design FA for a language. %his ability \ust impro$es with time and practice.

    $ery FA is also a %3 but not e$ery %3 is FA. 2n e$ery FA, e$ery state shows transition of allletters of gi$en alphabet but in any %3 it is not must. 2n %3, we may or may not show all letters

    transition according to reKuirement. >e can also show transitions on reading any strings in %3s

    but it is not possible in FAs.

    Q No.0 Fow one can create *- o a particular language?

    First thing about 8 and FA is that there is no hard and fast formula or method to generate

    these. ;ne can generate them by their mental approach. And this mental approach can be

    acKuired through only 98A6%26.

    2 am gi$ing you few tips. 2 hope those will help you.

    2f we ha$e a nite language then it will always be regular and will not ha$e S in 8.

    e.g. 4={aaa, aba, bb. 4 language generates gi$en three strings then its 8 will be

    /aaa Z aba Z bb. &o in nite language Z of all strings can be itBs 8.

    2f we ha$e an innite language, then there will be S in itBs 8.

  • 8/9/2019 automata assignments

    9/24

    >e should also keep the null string in our mind.

    For practice \ust try to create 8 of simple languages. :onBt try to confuse yourself with

    complex languages.

    For example if a language generates all strings starting with a. then strings will be of type

    a , aa, ab, aab, aaa, aba, abb,".

    !ere 8 should start with [aB and then all strings including null. &o this will be /a Z b0S and

    complete 8 is a /aZ b0S.

    &imilarly languages of strings ending in b will ha$e 8 /a Z b0Sb.

    2 hope now you will be able to generate the 8 of simpler languages. 3radually, increase thecomplexity of languages to become a perfect in 8Bs.

    )ow as similar to 8, FA of nite language will not ha$e any loop in it.

    2f language is innite then there will always be at least one loop in its FA.

    From 8, if you want to generate its FA, then rst get the smallest strings and generate their FA

    and then gradually get the strings of bigger length and keep amending the created FA. After

    some practice, you will be able to generate the FABs.

    And the last thing nobody can do the new task accurately for the rst time. 9ractice is the key

    to success. 2n the start you will ha$e lot of mistakes but after practice you will be able to clear

    all of them.

    Q No. What is the diference between 8As Dand Es ?

    %here are two or three big diTerences between FABs and %3Bs.

    2n FA there can be maximum one initial or starting state while in %3 there may be more than

    one initial state.

    2n FA there can be transition for letters only while in %3 transitions from a state to another one

    can be for strings.

    2n FA there must be transition from each state for each letter /deterministic0 while in %3 there

    may be no transition for specic letter from a state and there may be more than one path for a

    string or letter from a state.

    Q No.4 What is the e@act denition o 8A ?

    :enitionQ

  • 8/9/2019 automata assignments

    10/24

    A Finite automaton /FA0, is a collection of the followings

    Finite number of states, ha$ing one initial and some /maybe none0 nal states.

    Finite set of input letters /]0 from which input strings are formed.

    Finite set of transitions i.e. for each state and for each input letter there is a transition showing

    how to mo$e from one state to another.

    Q No.6 What is the diference between E and E ?

    2n %3, there are transitions for the strings. >hile in 3%3, one can write whole 8 as a transition

    from one state to another one.

    For 8 =aa//aZb0/aZb00S what will be its corresponding FA ^

    8 is aa//a Z b0/a Z b00S. 2ts corresponding FA is as follows.

    Q No.19 What is the diference between 8A and N8A ?

    FA stands for nite automata while )FA stands for nonNdeterministic nite automata

    2n FA there must be a transition for each letter of the alphabet from each state. &o in FA

    number of transitions must be eKual to /number of states S number of letter in alphabet0.

    >hile in )FA there may be a transition for a letter from a state. 2n )FA there may be more than

    one transition for a letter from a state. And nally e$ery FA is an )FA while e$ery )FA may bean FA.

    FAQ

    )FAQ

    Q No.11 What is the method to understanding 8As and N8As

    Firstly we know that an FA is used to describe a language. )ow a language consists of strings.

    FA will describe the specic language only if it accepts all the strings of that particular

    language and all the strings generated by the FA are in the language. &o conrmation is of two

    ways.

    )ow, how to tra$erse the FA. 2t is $ery easy. $ery FA has one initial state /state with Nsign0.

    From e$ery state of FA there is one transition for e$ery letter of the alphabet. 8ead the string

    letter by letter and mo$e according to transitions from state to state. 2f the string ends in the

    nal state /state with a Z sign0, that particular string will be accepted otherwise re\ected.

    &o, e$ery string ending in nal state will be accepted by FA and will be a word of the language.

    For )FA, there may be no path or more than one path for a letter from a specic state. As

    similar to FA \ust start tra$ersing from the initial state and if the string ends in the nal state, it

  • 8/9/2019 automata assignments

    11/24

  • 8/9/2019 automata assignments

    12/24

    6onsider two FABs gi$en below

    aabb

    abab

    U*ZU(N`*Z`(NFA(FA*

    !ere FA( accepts all strings ending in a and FA* accepts all strings ending b.

    An FA corresponding to FA(WFA* will accept all the strings ending in a or ending in b. for example,

    aba,bbaaab,bbb

    An FA corresponding to FA(FA* will accept all the strings whose rst substring belongs to FA( and

    second substring belongs to FA*. for example, ababab, bbabbb.

    An FA corresponding to FA(S will accepts all the strings of FA( including null string. if FA(

    represents 8 r( then FA(S will correspond to 8 r(S.

    FAVBs about 4ectures *( to *-

    Automata %heory FAVBs about 4ectures *( to *-Q No 1.Fow ,oore and ,eal7 machine worCs

    in >omputer ,emor7 what is their importance in >omputing ?

  • 8/9/2019 automata assignments

    13/24

    particular inputs gi$en.

    %he output is a function of both the 9resent 2nputs and the 9resent &tates.

    2n addition to the outputs, the circuit must also generate an update to the memory components so

    that the state of the machine can also be changed with respect to the new inputs. %he update is

    called the )ext &tate Function and is also a function of the 9resent 2nputs and the 9resent &tates.

    #oth the output functions and the )ext &tate Functions are combinational circuits.

    E=f/`,&t0

    &=g/`,&t0

    %he superscript t indicates the present time period while the superscript /tZ(0 indicates the next

    time period.

    %he characteristic of a seKuential circuit is completely dened by a state transition diagram that

    enumerates all possible transitions for e$ery possible input combination.

    Q No 1.What is the concept o &umping 'emma ( and (( and what is the diference

    between pumping 'emma 1 and pumping 'emma 2 ?2n fact 942 M 9422 are same /A way to

    recognie )on 8egular language0. %he only diTerence is that the conditions in pumping lemma

    22 are more stricter than 9umping 4emma 2 some language that are di?cult to proof )on

    8egular by 9umping 4emma 2 are pro$ed )on 8egular by pumping 4emma 22 easily.

    Further mare in pumping lemma 2 we ha$e to generate all words to of a language but in

    9umping 4emma 22 we ha$e to generate a single word to pro$e a language non regular.

    xplanationQ

    &ome languages like 9A42):8;

  • 8/9/2019 automata assignments

    14/24

    pro$ed non regular, so there was the need of pumping lemma $ersion $ersion *.

    )ow consider for the word

    bbabb

    if we take )=*

    %hen by pumping y /let we take it b 0 two times results in

    bbbbabb

    %hat word is not in 9A42):8;

  • 8/9/2019 automata assignments

    15/24

    FAVBs about 4ectures +( to +-

    Q No 1.What is the diference between semiword and word please also

    gi/e an e@ample regarding this? Word:

    A word is complete combinations of terminals only e.g. abba or ab or a or null string.

    !emiword:

    A semiword is a string of terminals /may be none0 concatenated with exactly one

    nonterminal on the right i.e. a semi word, in general, is of the following form

    /terminal0/terminal0 N /terminal0/nonterminal0

    For example

    aaaaaa# , aabbaaaA , A.

    >hat is the diTerence between deri$ation tree and total tree ^

    A :eri$ation tree is the one that shows how to deri$e any specic word of the

    language described by 6F3 but %otal 4anguage %ree shows all words of the

    4anguage described by 6F3 on it

    Q No 2.What does mean the 'ANA- (! >'+!-)?

    >hen we say that a 4anguage is closed it is always with respect to certainoperation.

    A simple example may be that the set of integers is closed under addition. 2t means

    when we take two numbers from set of integers say +, X the result of their addition

    would also be in the set of integers.

    &imilarly if the result of an operation on the words of a language results in the word

    of the same language we say that the language is closed under that operation.

    Q No .What are the &roductions?

    9roductions are the grammatical rules and regulations. %hese rules express the

    beha$ior of 6F3. Wsing production in 6F3 terminals are con$erted into nonNterminals

    and when all the terminals are con$erted using productions, a word is acKuired.

    Q No %.What is the diference between concatenation and intersection o

    two 8As also what is the diference among nion o two 8As and addition

    o them?

    2n intersection of two FABs only those strings are accepted which are independently

    accepted by both FABs, while in concatenation of two FABs only those strings will be

    accepted in which rst part of string is accepted by rst FA and remaining part of

    string is accepted by the second FA.

  • 8/9/2019 automata assignments

    16/24

    >hile taking union of two FABs one can represent it using Z sign. &o /FA( W FA*0 and

    /FA Z FA*0 both are same. %here is no diTerence between them.

    FAVBs about 4ectures +D to '

    Automata %heoryFAVBs about 4ectures +D to '

    Q No 1.What is the )iference between Nullable and Null production? Fow

    to maCe eliminate Nullable and or Null &roductions rom the >8 ?

    %he production of the form

    nonterminal 4

    is said to be null production.-@ampleQ

    6onsider the following 6F3

    & aAOb#O4, A aaO4, # a&

    !ere & 4 and A 4 are null productions.

    A production is called nullable production there is a deri$ation that starts at )on

    %erminal and leads to 4 i.e.

    S > aA | bB | aa

    A-> C | bb

    C> 4!ere A nullable )on %erminal due to )ullable production AL 6 as 6 leads

    to null.

    -@ample:

    6onsider the following 6F3

    & `U, ` Eb, U b>

    E A#, > E, A aAObAO4

    # #aO#bO4.

    !ere A 4 and # 4 are null productions, while E A#, > E are nullable

    productions.

    ,ethodQ

    :elete all the )ull productions and add new productions e.g.6onsider the following productions of a certain 6F3 ` a)b)a, ) 4, delete the

    production ) 4 and using the production

  • 8/9/2019 automata assignments

    17/24

    ` a)b)a, add the following new productions

    ` a)ba, ` ab)a and ` aba

    %hus the new 6F3 will contain the following productions ` )baOab)aOabaOa)b)a

    NoteQ 2t is to be noted that ` a)b)a will still be included in the new 6F3.

    ,ethodQ

    6onsider the following 6F3

    & `U, ` Eb, U b>

    E A#, > E, A aAObAO4

    # #aO#bO4.

    !ere A 4 and # 4 are null productions, while E A#, > E are nullable

    productions. %he new 6F3 after, applying the method, will be

    & `U

    ` EbOb

    U b>Ob

    E A#OAO#

    > E

    A aAOaObAOb

    # #aOaO#bOb

    Note: >hile adding new productions all )ullable productions should be handled

    with care. All )ullable productions will be used to add new productions, but only the

    )ull production will be deleted

    Q No 2. (s it possible to maCe >8 or in@ and post@ e@pressions using

    deri/ation tree ?

    :eri$ation tree is only used to deri$e words of language that is described by a 6F3.

    Ues, we can create 6F3 for languages inx expressions, postx expressions.

    Q No what is the uses o push down automata in computing ?

    9:A is \ust an enhancement in FAs. i.e ; and &!F )+WN

  • 8/9/2019 automata assignments

    18/24

    !E+*- ?

    )o diTerence at all. #oth terms are used to describe memory structure attached

    with FAs to store some characters in it.

    Q No Fow we can distinguish between H>8I and H>N8I in the 3uestions

    ?

    6homsky )ormal Form /6)F0

    2f a 6F3 has only productions of the form

    nonterminal string of two nonterminals

    or

    )onterminal H one terminal

    %hen the 6F3 is said to be in 6homsky )ormal Form /6)F0.

    %hus if the gi$en 6F3 is in the form specied abo$e it will be called in 6)F.

    Q No 0.What is meant b7 the terms stacC consistence and input tape

    consistence ?

    %erm !tacC consistentmeans we can pop any character from the top of the stack

    only. 9:A should not be able to pop any character other than that is present on the

    top of the stack.

    %erm Eape consistentmeans we can read only the rst letter on the tape not anyother letter of the tape after the rst one.

    Q No What is the concept o unit production ?

    %he productions of the form

    one )onterminal H one )onterminal

    Are called unit productions.

    For example

    & H A /Wnit 9roduciton0

    AH a O b

    !ere there is no need of Wnit 9roduction & A. we can directly write

    & N a O b

    Q No 4 Wh7 >onte@t 8ree rammars are called H>onte@t 8ree?6ontext Free 3rammars are called context free because the words of the languages

  • 8/9/2019 automata assignments

    19/24

    of 6ontext Free 3rammars ha$e words like GaaabbbI/9A42):8;hen compiler reads it,it would be in the form of string. %he compiler would calculate its decimal eKui$alent

    so that we can perform mathematical functions on it. 2n calculating its decimal $alue

    , weight of rst H1Iis diTerent than the second G(I it means it is conte@t

    sensiti/e/depends on in which position the G(I has appeared0.

    i.e.

    1*102+4*101+1*100=14

    /$alue of one is (''0 /$alue of one is \ust one0

    %hat is not the case with the words of 6ontext Free 4anguages. /%he $alue of GaIisalways same in whate$er position HaIappears0.

    Q No 6. What is nit &roduction?

    %he production in which one nonNterminal leads to only one nonNterminal.

    Q No 19.What is 'et most )eri/ation in >8?

    2t is a method of generation of strings from a 6F3 starting from left most letter of

    the string.

    FAVBs about 4ectures ( to -

    Q No 1.i/e a e@ample o con/erting a >8 to >N8?6onsider the 6F3 gi$en

    below

    & A#6

    A aa O b

    # c

    6d

    2ts 6)F will be

    & :6

    : A#

    A O ba

    #c

    6d

    Q No 2.(n the lecture %1 Js e@ampleD we ha/e con/erted &)A to con/ersion

    orm and a word Jaaaabb is deri/ed rom this con/ersion orm &)A. What

    are the deri/ation steps.

    %he 9:A con$erted to con$ersion form has some specic features that are important

    to understand rst. %hese features are

    %he states named &%A8%, 8A:, !8 and A669% are called \oints of the machine.

    >ith the help of the con$ersion form we ha$e been able to achie$e that 9;9 state

  • 8/9/2019 automata assignments

    20/24

    has only one path out of it and the path taking /multiple paths0 decisions take place

    only on the 8A: state.

    %he word [aaaabbB is generated as follows from the 9:A

    &%A8%N9;9N9W&!

    %his step pops and then pushes it to ensure that stack contains at the

    beginning.

    8A:(N9;9DN9W&! N9W&! a

    As rst time after reading GaI there is at the top of stack so we will follow path

    segment 8A:(N9;9DN9W&! N9W&! a

    8A:(N9;9-N9W&! aN9W&! a

    )ow a is on the top of the stack so we will follow 8A:(N9;9-N9W&! aN9W&! a

    8A:(N9;9-N9W&! aN9W&! a

    Again following same segment for a

    8A:(N9;9-N9W&! aN9W&! a

    Again following same segment for a

    8A:(N9;9(N !8N9;9*

    As we read b on input tape.

    8A:*N9;9(N!8N9;9*

    As we read b on input tape.

    8A:*N9;9+NA669%.

    As we read from the input tape

    Q No .Fow to diferentiate between HwantedI and Hunwanted branchI ?

    >hen we deri$e a word in %op down parsing beginning with the starting )on

    %erminal the branches of the tree that do not lead to our reKuired word are left aside

    these branches are called unwanted branches.

  • 8/9/2019 automata assignments

    21/24

    For example for 6F3

    &HLAA

    AHLa O b

    2f we want to generate the word GaaI we will lea$e the branch generated by the

    production ALb.

    Q No %.What is the diference between intersection and union o a

    language?

    2ntersection of two languages will consist of all those words which are in both

    languages while union of two languages will consist of all those words which are

    present in at least one language.

    &ymbol for intersection is and for union is W.

    Q No .What is the diference between >onte@t ree languages and regular

    languages?

    8egular languages can be represented by FABs because we do not need any memory

    to recognie /accept or re\ect them on FA0 them but there is another class of

    languages that can not be represented by FABs because these languages reKuire

    that we ha$e some memory /with the help of memory we can store letters of the

    string we are checking so that we can compare them with next coming letters in the

    string0.

    For example language anbn reKuires that we must store aBs and then compare their

    count with next coming bBs so that we can check whether aBs are eKual to bBs or not.

    :ue to this reason we use 6ontext Free 3rammars to represent them because we

    can-t write 8Bs for them.

    &o 6ontext Free 4anguages represent a broader category this category also include

    regular languages as subcategory. 2t means that context free languages include

    regular languages as well as some other languages.

    Q No 0.What is the diference between ,oore and ,eale7 machines?

    2n

  • 8/9/2019 automata assignments

    22/24

    iii. >orking string

    i$. &emi >ord means

    !tacC consistencemeans that in the 9:A con$erted in the con$ersion form, when

    we follow a path segment /which is formed by combining startD read or here

    state with ne@t readD here or accept state on the path$along the 9:A its pop

    state should ha$e the path for the same letter that is present on the top of the stack

    at that stage. 2f this doesnBt happen our 9:A will crash because in con$ersion form

    of the 9:A the pop state has only one letter path, so if we could not be able to nd

    that letter on the top of the stack our 9:A will crash /if will not nd path where to go

    from that state0

    WorCing stringmeans the string present on the input tape.

    K5able &aths means that when we follow a certain seKuence of rows from the row

    table to generate a path for a word form start state to accept state. %he path

    /seKuence of rows0 should be stack as well as \oint consistent it means that rows

    should end at the same read or here state /\oin consistency 0 and the rows should beable to pop the letter from the top that is indicated in the pop state of the row.!emi word is the string of terminals it may be null string ending with a )on

    terminals on the right.

    For example some semi words are

    aa&

    aabbA

    #

    (s Automata Eheor7 is a &rogramming !ubLect or theoretical?

    Automata theory is the study of abstractcomputing de$ices, or GmachinesI. %his

    topic goes back to the days before digital computers and describeswhat is possible

    to compute using an abstract machine.%hese ideas directly apply to creating

    compilers, programming languages, and designing applications. %hey also pro$ide a

    formal framework to analye new types of computing de$ices, e.g. biocomputers or

    Kuantum computers>hat are practical xamples of the implications of Automata %heory and

    the formal 4anguages^

    3rammars and languages are closely related to automata theory and are

    the basis of many important software components likeQ Y 6ompilers and interpreters

    Y %ext editors and processors

    Y %ext searching

    Y &ystem $erication

    What are the E7pes o Automata?

  • 8/9/2019 automata assignments

    23/24

    Y %he %ypes of Automata %heory are

    Y Finite Automata Y 8egular 4anguages

    Y 4inearNbounded Automata

    Y 6ontext &ensiti$e 4anguages

    Y 9ushN:own Automata Y 6ontext Free 4anguages

    Y %uring

  • 8/9/2019 automata assignments

    24/24

    re$erse /('0 = '(

    VuestionQ )ene !trings?

    AnswerQ

    6oncatenation of nite letters from the alphabet is called a string.

    e.g 2f = {a,b then a language 4 can be defined as4 = {a, abab, aaabb,

    ababababababababab,"""""

    itBs mean all words with aBs more or eKual to bBs

    VuestionQ )ene empt7 or null strings?

    AnswerQ

    6oncatenation of nite letters from the alphabet is called a string.&ometimes a string

    with no symbol at all is used, denoted by /&mall 3reek letter 4ambda0 5 or /6apital

    3reek letter 4ambda0 7, is called an empty string or null string.

    VuestionQ )iference between string and word?

    AnswerQ

    Any combination of letters of alphabet that follows rules of language is called a word.

    A string is a nite seKuence of symbols from an alphabet.

    VuestionQ

    Ehere are as man7 palindromes o length 2n as there are o length 2n51D

    please e@plain?

    AnswerQ

    2f we try to create palindromes then middle elements /* in e$en palindromes M ( in

    odd palindrome0 does not cause any change in no. of palindromes:ening the

    language 9A42):8;