..........................................NEXT PREVIOUS INDEX
 

 L04 FSA: Combining FSAs: Closure


                Combining FSAs:  Closure

o  Closure of language:
     If   s IN L  then  s*  IN  L*
   In other words, concatenation of any of the strings in L, any
   number of times and also accept empty string.

+  Ex.: Language L1 = ab(cab)*d = {abd, abcabd, abcabcabd...}

    + Closure of L1* is:
        {0, abd, abdabd, abdabdabd, abcabd, abdabcabd}

    + Partial closure of L1 (called L1+) is:
        {abd, abdabd, abdabdabd, abcabd, abdabcabd}

    + FSA for L1:
              a        b        d 
      ->(q0)-->--(q1)-->--(q2)-->--((q3))
           \               /
            \-------<-----/
                    c

    + FSA for L1+ (partial closure of L1):
      - Copy FSA for L1,
      - Add a 0-arc from every accepting state to the start state:

                     0
          ............<...............
          .                          .
          .   a        b        d    .
      ->(q0)-->--(q1)-->--(q2)-->--((q3))
           \               /
            \-------<-----/
                    c

    + FSA for L1* (closure of L1):
      - Introduce a new start state (q' below)
      - Put a 0-arc from the new start state to the old start state
           (q' to q0)
      - New start state is an accepting state, so that empty string
        is accepted.

                          0
                 ............<...............
                 .                          .
                 .   a        b        d    .
    ->((q'))->-(q0)-->--(q1)-->--(q2)-->--((q3))
                  \               /
                   \-------<-----/
                           c

o In summary, producing FSA for L*:
  - Copy the FSA for L
  - Connect from accepting states to initial state with 
    0-transitions (To take care of concatenation any number 
    of times)

  - To accept the empty string:
    Introduce a new initial state (q in figure above), as an
    accepting state, draw 0-transition to old initial state q0.
     
  * Note:  Essential to introduce a new initial state as 
    accepting state.  Wrong to make old initial state as 
    accepting state:

                     0
          ............<...............
          .                          .
          .   a        b        d    .
     ->((q0))->--(q1)-->--(q2)-->--((q3))
           \               /
            \-------<-----/
                    c

    The above wrongly  accepts the following strings too:
       abc(abc)* =  {abcabc, abcabcabc, ...}
     (The above should not be in the language L1*)
..........................................NEXT PREVIOUS INDEX