The goal of this problem is to design a regular expression f


The goal of this problem is to design a regular expression for addition. For simplicity, as on the homework problem, we will consider binary strings in reverse so that addition works left to right. Let sigma_s = {[0 0 0], [0 0 1], [0 1 0], [0 1 1], [1 0 0], [1 1 0], [1 1 1]}. A string of symbols in sigma gives three rows of 0s and 1s. Consider each row to be a binary number in reverse and let C = {infinity sigma_3 | the bottom row of w is the sum of the top two rows}. For example (adding left to right): [1 1 0] [1 0 0] [0 0 1] B, but [1 0 1] [0 0 1] B. In the first example, the first column has a carry-out, the second column has a carry-in and carry-out, and the third column has a carry-in. Give a regular expression for the set of all strings that have only columns with no carry-in or carry-out, i.e., the set of strings that have no carries when adding the first two rows. List the column in sigma_3 that have both a carry-in and a carry-out. Which columns in sigma_3 can follow a column in (b) to end a string in C? Give a regular expression that generates C.

Solution

Now the logic inside the loop can be simplified. We\'re adding three bits, setting one bit of sum, and calculating the carry.

iFnally, I would recommend renaming BinAdd to AddBinary,

 The goal of this problem is to design a regular expression for addition. For simplicity, as on the homework problem, we will consider binary strings in reverse

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site