26
Lecture # 16 Lecture # 16

Lecture # 16

  • Upload
    sorley

  • View
    31

  • Download
    0

Embed Size (px)

DESCRIPTION

Lecture # 16. Applications of Incrementing and Complementing machines. 1’s complementing and incrementing machines which are basically Mealy machines are very much helpful in computing. The incrementing machine helps in building a machine that can perform the addition of binary numbers. - PowerPoint PPT Presentation

Citation preview

Page 1: Lecture  # 16

Lecture # 16Lecture # 16

Page 2: Lecture  # 16

Applications of Incrementing and Complementing machines

1’s complementing and incrementing machines which are basically Mealy machines are very much helpful in computing.

The incrementing machine helps in building a machine that can perform the addition of binary numbers.

Using the complementing machine along with incrementing machine, one can build a machine that can perform the subtraction of binary numbers.

Page 3: Lecture  # 16

Equivalent machines

Two machines are said to be equivalent if they print the same output string when the same input string is run on them.

Two Moore machines may be equivalent. Similarly two Mealy machines may also be equivalent, but

A Moore machine can’t be equivalent to any Mealy machine. However, ignoring the extra character printed by the Moore machine, there exists a Mealy machine which is equivalent to the Moore machine.

Page 4: Lecture  # 16

Theorem Statement:

For every Moore machine there is a Mealy machine that is equivalent to it (ignoring the extra character printed by the Moore machine).

Proof:Let M be a Moore machine, then shifting the output characters corresponding to each state to the labels of corresponding incoming transitions, machine thus obtained will be a Mealy machine equivalent to M.

Page 5: Lecture  # 16

Note

It may be noted that while converting a Moore machine into an equivalent Mealy machine, the output character of a state will be ignored if there is no incoming transition at that state.

A loop at a state is also supposed to be an incoming transition.

Following is the example of converting a Moore machine into an equivalent Mealy machine

Page 6: Lecture  # 16

Example Consider the following Moore machine

Using the method described earlier, the above machine may be equivalent to the following Mealy machine

Page 7: Lecture  # 16

Example Cont…

Running the string abbabbba on both the machines, the output string can be determined by the following table

Page 8: Lecture  # 16

Example Cont…

Page 9: Lecture  # 16

Theorem

Statement:For every Mealy machine there is a Moore machine that is equivalent to it (ignoring the extra character printed by the Moore machine).

Page 10: Lecture  # 16

Proof Let M be a Mealy machine. At each state

there are two possibilities for incoming transitions

1. The incoming transitions have the same output character.

2. The incoming transitions have different output characters.

If all the transitions have same output characters, then shift that character to the corresponding state.

Page 11: Lecture  # 16

Proof cont…

If all the transitions have different output characters, then the state will be converted to as many states as the number of different output characters for these transitions, which shows that if this happens at state qi then qi will be converted to qi

1 and qi2 i.e. if at qi there

are the transitions with two output characters then qi

1 for one character and qi

2 for other character.

Page 12: Lecture  # 16

Proof cont…

Shift the output characters of the transitions to the corresponding new states qi

1 and qi2 . Moreover, these new

states qi1 and qi

2 should behave like qi as well. Continuing the process, the machine thus obtained, will be a Moore machine equivalent to Mealy machine M.

Following is a note

Page 13: Lecture  # 16

Note

It may be noted that if there is no incoming transition at certain state then any of the output characters may be associated with that state.

It may also be noted that if the initial state is converted into more than one new states then only one of these new states will be considered to be the initial state. Following is an example

Page 14: Lecture  # 16

Example

Consider the following Mealy machine

Page 15: Lecture  # 16

Example cont…

Shifting the output character 1 of transition b to q0

Page 16: Lecture  # 16

Example cont…

Shifting the output character 0 of transition a to q1

Page 17: Lecture  # 16

Example cont…

Shifting the output character 1 of transition b to q2

Page 18: Lecture  # 16

Example cont… Splitting q3 into q1

3 and q23

Page 19: Lecture  # 16

Example cont…

Running the string abbabbba on both the machines, the output strings can be determined by the following table

Page 20: Lecture  # 16

Regular languages

As already been discussed earlier that any language that can be expressed by a RE is said to be regular language,

so if L1 and L2 are regular languages then L1 + L2 , L1L2 and L1* are also regular languages.

This fact can be proved by the following two methods

Page 21: Lecture  # 16

(1) By Regular ExpressionsAs discussed earlier that if r1, r2 are regular expressions, corresponding to the languages L1 and L2 then the languages L1 + L2 , L1L2 and L1* generated by r1+ r2, r1r2 and r1*, are also regular languages.

(2) By TGsIf L1 and L2 are regular languages then L1 and L2 can also be expressed by some REs as well and hence using Kleene’s theorem, L1 and L2 can also be expressed by some TGs.

Following are the methods showing that there exist TGs corresponding to L1 + L2 , L1L2 and L1*

Page 22: Lecture  # 16

If L1 and L2 are expressed by TG1 and TG2 then following may be a TG accepting L1 + L2

Page 23: Lecture  # 16

If L1 and L2 are expressed by following TG1 and TG2

then following may be a TG accepting L1L2

also a TG accepting L1* may be as under

Page 24: Lecture  # 16

Example

Consider the following TGs

Page 25: Lecture  # 16

Example cont…

Following may be a TG accepting L1+

L2

Page 26: Lecture  # 16

also a TG accepting L1L2 may be

and a TG accepting L2*