# INTRODUCTION TO COMPUTER THEORY COHEN PDF

and the theory of computation / John C. Martin.—4th ed. p. cm. Introduction to Languages and the Browse's Introduction to the Symptoms & Signs of Surgical . Introduction to Computer Theory by Daniel I. a. Cohen - Second Edition - Ebook download as PDF File .pdf), Text File .txt) or read book online. Introduction to. DANIEL. 1. A. OE. INTODSONT SOPUE. THEOR. INTRODUCTION TO COMPUTER THEORY. Daniel I. A. Cohen Hunter College City University of New York.

Author: | AUNDREA SHETTSLINE |

Language: | English, Spanish, German |

Country: | Romania |

Genre: | Technology |

Pages: | 479 |

Published (Last): | 22.03.2015 |

ISBN: | 430-8-37888-780-9 |

ePub File Size: | 17.60 MB |

PDF File Size: | 17.47 MB |

Distribution: | Free* [*Regsitration Required] |

Downloads: | 38073 |

Uploaded by: | COLTON |

Library of Congress Cataloging-in-Publication Data: Cohen, Daniel I. A., Introduction to computer theory. Includes Index 1. Electronic digital computers. Where can I get "Intro to Computer Theory by Daniel I.A Cohen 2nd Edition" ebook for free and legally? akbdBt CGbQVyUjh Introduction to Computer Theory 2nd Edition What sites can I download free PDF and E-books?. Feb 18, Download Introduction to Computer Theory by Daniel I.A Cohen PDF free - ALL YOU NEED.

The alphabet is the usual set of letters plus the apostrophe and hyphen. We begin with only one finite set of fundamental units out of which we build structures. If we wished to be supermeticulous. If a certain language L does not contain the word A and we wish to add it to L. We shall face j ust such a situation later. In this basic model. This language i s not the same as L.

It is a long list. If we have a method for producing a language and in a certain instance the method produces nothing. The most familiar example of a language for us is English. To some it makes computer theory seem more mathematical and to some this is an advantage. There is a subtle but important difference between the word that has no letters.

This has become a time-honored tradition. Since the goal in a textbook is not to minimize the space required to explain concepts but to maximize the chance of understanding. It is grammatically correct. For example. If we wish to make a fonnal definition of the language of the sentences in English. How could we be handed an infinite dictionary? It would have to be described to us in some manner. There are two problems with pure mathematical symbolism: It alienates some who for want of familiarity could otherwise understand the concepts being expressed.

I ate two apples. Mathematical symbolism is of value only when it is somehow better than seeing the same thought expressed in human language. This is because we could never produce a complete list of all possible words in this language.

Theoretical ly.

## solution-of-automata-theory-by-daniel-cohen.pdf - Solution...

This results in perfectly understandable communication. Of course. B ut even though there are tricks to overcome the searching problem as we shall soon see. I ate one apple. Only a language with finitely many words can be defined by an all-inclusive list called a dictionary. The belief that mathematical symbolism is more rigorous and therefore more accurate than English prose is quite ridiculous since every mathematical symbol was defined in English in the first place and every mathematical formula can be translated into English if need be.

Languages in the Abstract 9 In the preceding line. Meaning is something. If we go by the rules of grammar only. If we tried to define a language of infinitely many words by an infinite list. Let us call this alphabet r. We shall be like the bad teacher who is interested only in the correct spelling.

The set of rules defining English is a grammar in a very precise sense. If the Earth and the Moon ever collide. Earlier we mentioned that we could define a language by presenting the alphabet and then specifying which strings are words. English itself used to have a letter called "eth" that has thankfully disappeared.

To be an acceptable specification of a language. Let us consider some simple examples of languages. As we make clear in Part II of this book. Either they will be presented as an alphabet and the exhaustive list of all valid words. If we start with an alphabet having only one letter. In general. The word "specify" is trickier than we may at first suppose. They can either tell us how to test a string of alphabet letters that we might be presented with. We could have defined it so as to include A.

The words in this language are clearly analogous to the positive integers. Because of the way we have defined it. If we wanted to define the language L3 so that it includes the string word 0. Introduction to Defining Languages 11 where w e have identified letter j uxtaposition with algebraic multiplication. In this example. In English when we concatenate "house" and "boat.

In this language. Then to denote the word formed by concatenating a and h. Let us begin with the alphabet: We shall see that this is sometimes a messy business.

The integers have other mathematical properties. In these simple examples. We write this function using the word "length. This box serves the same purpose. When we present an example of a point in the text. In this way. In L3 it is very important not to confuse 0.

This may seem like belaboring a trivial point. Di scovering when th is does happen is left as a problem at the end of th is chapter. There is some inherent ambiguity in the phrase "any finite string. If a is a word in some language L. The language L3 does not include A. Introduction to Defining Languages 13 This is not necessari ly a better definition of L3. We shal l now generalize the use of the star operator to sets of words. In a dictionary.

This ordering i s cal led lexicographic order. When we say "infinite language. Whereas both orderings are useful for the problem of searching for a given word. In the language just above. This language we shall call the closure of the alphabet.

We shall usual ly follow this method of sequencing a language. Notice that when we wrote out the first several words in the language.

Any string without the substring bb that begins with an a can be factored into terms of ah and a. The substring bb is impossible. In the last example. The string. I By the phrase "double b. This is the only way to factor this string into factors of a and ab. When this happens. It is Also. The method is to begi n with. Unless we insist on cal l ing K leene c losure a very forgiving.

Most of the theorems in this book w ill be proven by the method of constructive algorithm. Obv iously. Symbol ical ly. The K leene closure always produces an infinite language unless the underlying set was one of the two examples above. On this l i st we write down how to form. Th is is the most i mportant tool in our whole study. We have just establ ished a mathematical fact by a method of proof that we have rarely seen in other courses.

A l which is a l so true but for a different reason. Let us ask the question. How did you form the word x1 7? Why don 't you j ust concatenate another factor of xx in front of this and then you w i l l have the word x that you wanted.

Let us say that we work our way successfu l l y up to xn. S uppose that somebody did not bel ieve this and needed conv incing. In cases where parentheses are letters of the alphabet. The method of prov ing that something exists by showing how to create it is called proof by constructive algorithm. We may have a difficult time sel l i ng powers of. Let us observe that if the alphabet has no letters.

If S is a set of strings not including A. I t can. If S is a language that does contain A. The Kleene closure of two sets can end up being the same language even if the two sets that we started with were not.

Anyone who does not think that the null string is confusing has missed something. It is already a problem. What happens if we apply the closure operator twice? This "plus operation" is sometimes called positive closure. Kleene Closure 17 rule of grammar anything goes. In this case. Even if the set S has infinitely many words.

Thi s should present no problem since every string in the closure of a set is a combination of only fi n i tely many words from the set. Let us say we concatenated aaha and haaa and aaha. I t i s analogous t o saying that if people are made up of molecules and molec ules are made up of atoms. From now on we shall let the closure operator apply to infinite sets as well as finite sets. Show that the words aahaa. Can any word in this language contain the substrings aaa or hhh?

What is the smallest word that is not in this language? Prove that for al l sets S. How many words is that? How many words does this language have of length 4? What can be said in general? How many words does this language have of length 2? Is the string ahhha a word in this language? Write out all the words in this language with six or fewer letters. Be careful. Can any word in this language be interpreted as a string of elements from S in two different ways? Can any word in this language have an odd total number of a 's?

I n how many ways can x 19 be written as the product of words in S? This means: How many different factorizations are there of x 1 9 into xx and xxx? Is abaabbabbaabb? I f what remains is not A t h i s means some letters are left. Find a string that disproves thi s algorithm. Prove that this cannot happen. Step I. Step 2. Is i t bigger than S?

If what remains is the string A. S uppose that for some language L we can always concatenate two words i n L and get another word in L if and only if the words are not the same. Give another description of this language. That is. A recursive definition i s characteristical ly a three-step process. Another way we might try i s this: There is a reason that the third defin ition is less popular than the others: I t is much harder to use in most practical applications.

Let us take an example. The third method we present is sneaky. Rule only elements in the set EVEN are those that can be produced from the two rules above. To prove that 14 i s i n EVEN by the second defi n ition. The set EVEN i s defined by these three rules: To show this using the first defi n ition. One standard way of defining this set is EVEN is the set of all positive whole numbers divisible by 2. EVEN using the recursive defi nition is a lengthier process.

Thi s. Whether or not we want a recursive definition depends on two things: By Rule Then by Rule 2. We can now prove that 1 4 is in EVEN in fewer steps: Rule 2 I f. Once more applying Rule 2. Now applying Rule 2 to 8. The set EVEN. We EVEN. B y Rule 2. Again by Rule 2. Before leaving this example. The fact that 6 i s in is in EVEN. In later chapters.

For instance. This does define some set. Since l. Let us consider the way pol ynomials are usually defined: A polynomial is a finite sum of terms. We could try: The symbol pq. But the problem is that there is no smallest positive real number x on which to build the rest of the set. On the plus side. As soon as we prove that the derivative of a number is 0 and that the derivative of x is I.

It is for this reason that recursive defi n i tions are important to us. The reason that these definitions are called "recursive" i s that one of the ru les used to define the set mentions the set itself. I n computer languages. Given a soldier. Thi s defi n ition clears up the matter: There are some advantages to this defi nition as wel l as the evident disadvantages. Thi s is a l i ttle more complicated to see if we had to prov ide a proof based on the c lassical definition.

These definitions have the same self-referential sense. S i nce the topic of this book i s computer theory. S uppose for a moment that we were studying calcu l us and we had j ust proven that the derivative of the sum of two functions is the sum of the derivatives and that the derivative of the product f:!? This becomes a theorem that c a n b e proven directly from the recursive defi nition.

Rule I Rule 2 O! Before proceeding to more serious matters. Are there stil l more? Rule I If S is a language. Are there more rules?

The thi rd contains the forbidden substring. An Important Language: The defi n ition can be written as: Rule I Rule 2 Any n umber positive. The fourth has a close parenthesis before the corresponding open parenthesis. Any AE formed by Rule 2 must begin and end with parentheses or begin with a minus sign. This definition determines the set AE i n a manner useful for prov ing many theorems about arithmetic expressions.

We imagine it in our mind broken down into its components. There is no doubt that the string is a word in AE. We return to this point in Part II. By apply ing Rule 2. If neither. One can add only carrots to the pot.

Let a shortest of these be a string called w. Arithmetic Expressions be introduced by Rule 2. One can add only meat to the pot. Even w i thout knowing exactly in what order the chefs v i si t the pot or how often. The long-winded but careful proof of the l ast theorem i s g iven to i l l ustrate that recursive defin itions can be conveniently employed in rigorous mathematical proofs. Our fi rst question is: Which was the last rule used in the production of w?

Thi s is easy to answer. Now we know that w. We shall show that it must have been Rule 3 iv. One can add only potatoes to the pot. This method of argument should sound fami liar. In computer science. But si nce both. Without too much difficulty. Rule 3 If p and q are WFFs. Rule 2 If p is a WFF. Rule I.

## A cohen introduction to computer theory 2nd edition

Any single Lati n letter is a WFF. As a final note in this section. U s i n g the second recursive definition of the s e t EVEN. Show that the fo l l owing is another recursive defi nition of the set EVEN: The version we shall defi ne here uses only negation -.

Some sequences of applications of these rules enable us to show that p. What would it mean? What are you. Write another recursive defini tion for the language L 1 of Chapter 2.

As with AE.. Using the second recurs ive defi n i tion of EVEN. The valid expressions in this l anguage are traditional ly called WFFs for well-formed formulas.

We shall be interested i n one particular branch of symbolic logic cal led sentential calculus or propositional calculus. Another common use for recursive defin i tions is to determ i ne what expressions are valid in symbolic logic.

Describe a good method for show i ng that is in EVEN. What i s the complete l i st of substri ngs of length 2 that cannot occur? Write a recursive definition for the set of al l polynomials in the two variables x and y. Show that if n is less than 3 1.

Defi ne the set of val id algebraic expressions ALEX as follows: Using any recursive definition of the set EVEN. I n this chapter. Show that there are infinite l y many different recursive defin itions for the set EVEN. The rules given earlier for the set AE allow for the peculi ar expressions 9 and. What is the longest forbidden substring that does not contain a shorter forbidden substring?

The language L defined in this way is a famous mathematical set. Rule 2 If xy: What is it? Prove it. Fix this problem. We defined L 1 i n Chapter 2 b y the symbols: As shorthand for thi s.

More preci sion and less guesswork are required. Let us reconsider the language L4 of Chapter 2: I and we presumed that we all understood exactly which values n could take. We might define a l anguage by the symbols: I and again we could presume that we all agree on what words are in this language.

We might even have defi ned the l anguage L2 by the symbols: I I n that chapter. I but now the symbols are becoming more of an IQ test than a clear defi n i tion. In this chapter. We can think of the star as an unknown power or undeterm i ned power.

If we want blanks to be in the alphabet. It represents an arbitrary concatenation of copies of that letter maybe none at a l l. It stands for any string of. We can apply the Kleene star to the whole string ah if we want. The star operator appl ied to a letter is analogous to the star operator appl ied to a set. This is why we use the word "language" in the equation. Since the star represents some kind of exponentiation.

No string can contain a blank unless a blank is a character in the alphabet l.

L 4 is then the set of all possible strings of. The 1 notation i s a convenience. Our symbo li sm e l iminates this ambiguity. It would be a subtle m istake to say onl y that this l anguage i s the set of all words that begin and end with an a and have only h 's in between. Notice that ha and aha are not in this language. I A l l the words in T begin with an a or a c and then are followed by some number of h's. Each set of choices is a word. We l e t the word "some" always mean "some o r no.

For every set of choices. The set of al l strings that can be produced by this method i s the language of the expression. Care should be taken so as not to confuse this with " as an exponent. A regular expression. This is a very powerful notation. A regular language is one that can be defined by a regular expression even though it may also have many other fine definitions.

This is a very important expression and we shall use it often. The second letter of each word in L is either an a or a h. The third letter of each word in L is either an a or a h.

As is no surprise to those who have read the title of this chapter. Formal Definition of Regular Expressions 35 The first letter of each word in L is either an a or a h. The same confusion occurs in everyday speech. The string "French" is both a word an adjective and a language-defining name a noun.

Both are regular expressions and both can be generated from the rules. Context and typography will guide us. The definition we have given for regular expressions contains one subtle but important omission: Every word in such a book is a book-definer.

This is a language of language-definers. Because of Rule 1. A itself is a regular expression. As with the recursive definition of arithmetic expressions. Do we really need to invent yet another symbol for the regular expression that defines the language with no words?

Would it simply be the regular expression with no characters. For any r. Rule 2 If r 1 and r2 are regular expressions. It is analogous to a book that lists all the books in print.

However difficult computer theory may seem. If we combine these two. We shall avoid this philosophical crisis by never using this symbolism and avoiding those who do. In other words. We have done this with languages as sets before. The only words left out are those that have only h's and the word A. We should note that this use of the plus sign is consistent with the principle that in these expressions plus means choice.

When we add sets to form a union. A a hhaah or ahb a ab or ahha a h If the only words left out of the language defined by the expression above are the words without a's A and strings of b's.

In the expression above. All told. The expressions below also describe the language of words with at least two a's: In this set are ahhhahh and aaaaa. We are taking the union of two sets. When these are included. There is a simpler expression that defines the same language. Its inception was certainly impelled if not provoked by war and its development was fa cilitated by the evolution of psycho-linguistics, and it has interacted symbiotically with all the aforementioned upheavals.

The history of the computer is a fascinating story; however, it is not the subject of this course. We are concerned instead with the theory of computers, which means that we shall form several mathematical models that will describe with varying degrees of accuracy parts of computers, types of computers, and similar machines.

The con cept of a "mathematical model" is itself a very modern construct. It is, in the broadest sense, a game that describes some important real-world behavior. Unlike games that are simula tions and used for practice or simply for fun, mathematical models abstract, simplify.

We may assert that chess is a mathematical model for war, but it is a very poor model because wars are not really won by the simple assassination of the leader of the opposing country. The adjective "mathematical " in this phrase does not necessari ly mean that classical mathematical tools such as Euclidean geometry or calculus will be employed.

Indeed, these areas are completely absent from the present volume. What is mathematical about the mod els we shall be creating and analyzing is that the only conclusions that we shall be allowed to draw are claims that can be supported by pure deductive reasoning; in other words, we are obliged to prove the truth about whatever we discover.

Most professions, even the sciences. While most of the world is correctly preoccupied by the question of how best to do something, we shall be completely absorbed with the question of whether certain tasks can be done at all. Our main concl usions will be of the form, "this can be done" or "this can never be done. The nature of our discussion will be the frontiers of capability in an absolute and time less sense. This is the excitement of mathematics. The fact that the mathematical models that we create serve a practical purpose through their application to computer science, both in the development of structures and techniques necessary and useful to computer programming and in the engineering of computer architecture, means that we are privi leged to be playing a game that is both fun and important to civilization at the same time.

The term computer is practically never encountered in this book - we do not even de fine the term until the final pages. The way we shall be studying about computers is to build mathematical models, which we shall call machines, and then to study their limitations by analyzing the types of inputs on which they operate successfu lly. The collection of these successful inputs we shall call the language of the machine, by analogy to humans who can understand instructions given to them in one language but not another.

Every time we intro duce a new machine we will learn its language, and every time we develop a new language we shall try to find a machine that corresponds to it. Thi s interplay between languages and machines will be our way of investigating problems and their potential solution by auto matic procedures, often called algorithms, which we shall describe in a little more detail shortly.

The history of the subject of computer theory is interesting. It was formed by fortunate coincidences, involving several seemingly unrelated branches of intellectual endeavor. A small series of contemporaneous discoveries, by very dissimilar people, separately moti vated, flowed together to become our subject.

Until we have established more of a founda tion, we can only describe in general terms the different schools of thought that have melded into this field. The most fundamental component of computer theory is the theory of mathematical logic.

As the twentieth century started, mathematics was facing a dilemma. Georg Cantor had recently invented the theory of sets unions, intersections, inclusion, cardinality, etc.

But at the same time he had discovered some very uncomfortable paradoxes - he created things that looked like contradictions in what seemed to be rigorously proven mathematical theorems.

Some of his unusual findings could be tolerated such as the idea that infinity comes in different sizes , but some could not such as the notion that some set is bigger than the universal set.

Thi s left a cloud over mathematics that needed to be resol ved. To some the obvious solution was to ignore the existence of set theory. Some others thought that set theory had a disease that needed to be cured, but they were not quite sure where the trouble was. The naive notion of a general "set" seemed quite reasonable and in nocent.

When Cantor provided sets with a mathematical notation, they should have become mathematical objects capable of having theorems about them proven. All the theorems that dealt with finite sets appeared to be unchallengeable, yet there were definite problems with the acceptabil ity of infinite sets. In other branches of mathematics the leap from the finite to the infinite can be made without violating intuitive notions. Calculus is full of infinite sums that act much the way finite sums do; for example, if we have an infinite sum of infinitesi mals that add up to 3, when we double each term, the total will be 6.

The Euclidean notion that the whole is the sum of its parts seems to carry over to infinite sets as well ; for example, when the even integers are united with the odd integers, the result i s the set of all integers. In the year 1 , Dav id Hilbert, as the greatest l iving mathematician, was invited to ad dress an international congress to predict what problems would be important in the century to come.

Either due to his influence alone, or as a result of his keen analysis, or as a tribute CHAPTER 1 Background to his gift for prophecy, for the most part he was completely correct. The 23 areas he indi cated in that speech have turned out to be the major thrust of mathematics for the twentieth century. Although the invention of the computer itself was not one of his predictions, several of his topics tum out to be of seminal importance to computer science.

First of all, he wanted the confusion in set theory resolved. He wanted a precise ax iomatic system built for set theory that would parallel the one that Euclid had laid down for geometry. In Euclid's classic texts, each true proposition is provided with a rigorous proof in which every line is either an axiom or follows from the axioms and previously proven theo rems by a specified small set of rules of inference. Hilbert thought that such an axiom sys tem and set of rules of inference could be developed to avoid the paradoxes Cantor and oth ers had found in set theory.

Second, Hilbert was not merely satisfied that every provable result should be true; he also presumed that every true result was provable. And even more significant, he wanted a methodology that would show mathematicians how to find this proof.

He had in his mind a specific model of what he wanted. In the nineteenth century, mathematicians had completely resolved the question of solv ing systems of linear equations. Given any algebraic problem having a specified number of linear equations, in a specified set of unknowns, with specified coefficients, a system had been developed called linear algebra that would guarantee one could decide weather the equations had any simultaneous solution at all, and find the solutions if they did exist.

Thi s would have been an even more satisfactory situation than existed in Euclidean geometry at the time. If we are presented with a correct Euclidean proposition relating line segments and angles in a certain diagram, we have no guidance as to how to proceed to pro duce a mathematically rigorous proof of its truth.

We have to be creative - we may make false starts, we may get completely lost, frustrated, or angry. Pretty horrible. There is a reason that the third definition is less popular than the others: It is much harder to use in most practical applications. To prove that 14 is in EVEN by the second definition we have to somehow come up with the number 7 and then.

Once more applying Rule 2. Whether or not we want a recursive definition depends on two things: For instance. In later chapters we shall be interested in certain sets that have no better definition than the recursive one. It should be understood that we mean we can apply Rule 2 also to the case where x and y stand for the same number.

Let us consider the way polynomials are usually defined: We can now prove that 14 is in EVEN in fewer steps: The set EVEN. Now let us consider a recursive definition that is designed for people who know algebraic notation but do not know what a polynomial is. Before leaving this example. This is a trivial conclusion from the second recursive definition. This is a little more complicated to see if we had to provide a proof based on the classical definition. In this way we can have proven that we can differentiate all polynomials without giving the best algorithm to do it.

It is for these reasons that recursive definitions are important to us. We could include rules for making the notation prettier. This becomes a theorem that can be proven directly from the recursive definition. It is true that we do not then know that the derivative of x' is nx'-'.

On the plus side. What is even more astounding is that we shall be able to prove that certain tasks are theoretically impossible for any computer remember: As soon as we prove that the derivative of a number is 0 and that the derivative of x is 1 we have automatically shown that we can differentiate all polynomials. Since the topic of this book is Computer Theory. There are some advantages to this definition as well as the evident disadvantages. By Rule 3 In fact.

Is it not: In computer languages.. If Q is any word in LI. Also in mathematics we often see the following definition of factorial: Rule 1 Rule 2 0! The reason that these definitions are called "recursive" is that one of the rules used to define the set mentions the set itself.. These definitions have the same self-referential sense. Rule 2 Rule 3 If x is in AE. Are there more rules? Q9 are also words in L 3. The definition can be written as: Rule 1 Any number positive. If x and y are in AE.

Are there still more? The most natural way of defining a valid arithmetic expression. By applying Rule 2 we could always put in enough parentheses to avoid any confusion if we so desired. This definition determines the set AE in a manner useful for proving many theorems about arithmetic expressions. We may never have seen a definition of "arithmetic expressions" before.

So we usually adopt conventions of operator hierarchy and left to right execution. We return to this point in Part 1I. There is no doubt that the string is a word in AE. Any AE formed by Rule 2 must begin and end with parentheses or begin with a minus sign. One can add only potatoes to the pot. Even without knowing exactly in what order the chefs visit the pot or how often.

We shall show that it must have been Rule 3 iv. One can add only meat to the pot. If it were Rule 3 iii. Let the shortest of these be a string called w. One can add only carrots to the pot.

Our first question is: Which was the last rule used in the production of w? This is easy to answer. Similarly we can eliminate all the other possibilities.

## Firewall (computing)

But since both x and y are AE's. In computer science it is usually called a "slash. Now we know that w. This method of argument should sound familiar. The long-winded but careful proof of the last theorem is given to illustrate that recursive definitions can be conveniently employed in rigorous mathematical proofs.

Admittedly, this was a trival example of the application of this method. Most people would be just as convinced by the following "proof. What would it mean? What are you, crazy or something? We should bear in mind that we are only on the threshold of investigating a very complex and profound subject and that in this early chapter we wish to introduce a feel for the techniques and viewpoints that will be relied on heavily later, under far less obvious circumstances.

We will use our learner's permit to spend a few hours driving around an empty parking lot before venturing onto the highway. Another common use for recursive definitions is to determine what expressions are valid in Symbolic Logic. We shall be interested in one particular branch of Symbolic Logic called the Sentential Calculus or the Propositional Calculus. The version we shall define here uses only negationand implication - along with the phrase variables, although conjunction and disjunction could easily be added to the system.

The valid expressions in this language are traditionally called WFF's for well-formed formulas. Rule 1 Rule 2 Rule 3. Any single Latin letter is a WFF, a b c d If p is a WFF, then so are p and -- p. If p and q are WFF's, then so is p -- q. As a final note in this section, we should be wary that we have sometimes. Write another recursive definition for the language L, of Chapter 2.

Describe a good method for showing that 2n is in EVEN. Show that the following is another recursive definition of the set EVEN. Rule 1 2 and 4 are in EVEN. Show that there are infinitely many different recursive definitions for the set EVEN. Using any recursive definition of the set EVEN, show that all the numbers in it end in the digits 0, 2, 4, 6, or 8.

Write a recursive definition for the set of all polynomials in the two variables x and y. Define the set of valid algebraic expressions ALEX as follows:. What is the complete list of substrings of length 2 that cannot occur? Are there any substrings of length 3 that cannot occur that do not contain forbidden substrings of length 2? What is the longest forbidden substring that does not contain a shorter forbidden substring?

The rules given above for the set AE, allow for the peculiar expressions 9. It is not really harmful to allow these in AE, but is there some modified definition of AE that eliminates this problem? Write out the full recursive definition for the propositional calculus that contains the symbols V and A as well as i and What are all the. Fix this problem. Use one of them to prove that the product of two powers of two is also a power of two.

We defined L, in Chapter 2 by the symbols: We might define a language by the symbols: More precision and less guesswork is required, especially where computers are concerned.

In this chapter we shall develop some new language-defining symbolism that will be much more precise than the ellipsis which is what the three dots. The language-defining symbols we are about to create are called regular expressions. We will define the term regular expression itself recursively.

The languages that are associated with these regular expressions are called regular languages and are also said to be defined by finite representation. These terms will make more sense when they are associated with concepts. Let us reconsider the language L 4 of Chapter 2. In that chapter we presented one method for indicating this set as the closure of a smaller set. We now introduce the use of the Kleene star applied not to a set but directly to the letter x and written as a superscript as if it were an exponent.

We can think of the star as an unknown power or undetermined power. It stands for any string of x's in the language L 4. The star operator applied to a letter is analogous to the star operator applied to a set. It represents an arbituary concatenation of copies of that letter maybe none at all.

This is why we use the word "language" in the equation. We could summarize this language by the English phrase "all words of the form one a followed by some number of b's maybe no b's at all.

The meaning is clear: No string can contain a blank unless a blank is a character in the alphabet 1. If we want blanks to be in the alphabet, we normally introduce some special symbol to stand for them, as blanks themselves are invisible to the naked eye.

We have now used a boldface letter without a star as well as with a star. We can apply the Kleene star to the string ab if we want, as follows: Parentheses are not letters in the alphabet of this language, so they can be used to indicate factoring without accidently changing the words. Since the star represents some kind of exponentiation, we use it as powers are used in algebra, where by universal understanding the expression xy2 means x y2 , not Xy 2.

It would be a subtle mistake to say only that this language is the set of all words that begin and end with an a and have only b's in between, because this description may also apply to the word "a," depending on how it is interpreted. Our symbolism eliminates this ambiguity. Notice that ba and aba are not in this language.

Notice also that there need not be the same number of a's and b's. We now introduce another use for the where x and y are strings of characters x or y". Care should be taken so as not to. All the words in T begin with an a or a c and then are followed by some number of b's. We should, of course, have said "some or no b's". We often drop the zerooption because it is tiresome. We let the word "some" always mean "some or no," and when we mean "some positive number of' we say that.

For every set of choices we have generated a particular string. The set of all strings produceable by this method is the language of the expression. Each set of choices is a word.

The first letter of each word in L is either an a or a b. The second letter of each word in L is either an a or a b. The third letter of each word in L is either an a or a b. This is a very important regular expression and we use it often.

Again this expression represents a language. This is a very powerful notation. We can describe all words that begin with the letter a simply as:. The only words left out are those that have only b's and the word A. For example, the word abbaab can be considered to be of this form in three ways: Another expression that denotes all the words with at least two a's is: We scan through some jungle of b's or no b's until we find the first a, then more b's or no b's , then the second a, then we finish up with anything.

In this set are abbbabb and aaaaa. We can write: To be careful about this point, we say that two regular expressions are equivalent if they describe the same language. The expressions below also describe the language of words with at least two a's. If we write. Such words as ba and bbaaaa are not included in this set. Since, however, we know that either the a comes before the b or the b comes before the a, we could define this set by the expression: There is a simpler expression that defines the same language.

These exceptions are all defined by the regular expression: U These language-defining expressions cannot be treated like algebraic symbols. The only words that do not contain both an a and a b in them somewhere are the words of all a's, all b's, or A.

When these are added into the language, we get everything. Therefore, the regular expression: We can then write: EXAMPLE All temptation to treat these language-defining expressions as if they were algebraic polynomials should be dispelled by these equivalences: It means that all the words that do not contain the substring ab which are accounted for in the first term are all a's, all b's, A, or some b's followed by some a's.

N Usually when we employ the star operator, we are defining an infinite language. We can represent a finite language by using the plus union sign alone. If L is a finite language that includes the null word A, then the expression that defines L must also employ the symbol A. Let V also contain the word A. Alternatively, we could define V by the expression: It is because of this analogy to algebra that we have denoted our disjunction by the plus sign instead of the union sign U or the symbolic logic sign V.

We have a hybrid system: But the analogies to algebra should be approached very suspiciously, since addition in algebra never means choice and algebraic multiplication has properties different from concatenation even though we sometimes conventionally refer to it as product: Rule 2 If r. Rule 1 Every letter of 1 can be made into a regular expression by writing it in boldface. As with the recursive definition of arithmetic expressions.

A is a regular expression. The same confusion occurs in everyday speech. The string "French" is both a word an adjective and a language-defining name a noun. English is much harder. Both are regular expressions and both can be generated. Every word in this book is a book-definer.

We have all the parts we need in order to define regular expressions recursively. It is analogous to a book that lists all the books in print. The symbols that appear in regular expressions are: Context and typography will guide us. This is a language of language definers. Because of Rule 1 we may have trouble in distinguishing when we write an a whether we mean a the letter in Y. However difficult Computer Theory may seem. The set of words in this language is the null set. Another example of excessive care is the worry about the language that contains no words at all.

Care should always be taken to produce the expression we actually want. The null word is a word. To make the identification between the regular expressions and their associated languages more explicit. The language of no words cannot technically be defined by a regular expression since Rule 1 starts by putting something into the language.

We finesse this point by saying that the language of no words is defined by the regular expression of no symbols. It might not be clear why we can not just leave the rules for associating a language with a regular expression on the informal level..

Some words in this language are ennuiverboten and souffl6Gesundheit Using regular expressions. The rules seem to show us how we can interpret the regular expression as a language. As we build up a regular expression from the rules.

As we might suspect. Rule 2 i The regular expression rl r 2 is associated with the language L. This is a question of meaning. We are now ready to give the rules for associating a language with every regular expression. In our next theorem we show that every finite language can be defined by a regular expression. The situation for languages with infinitely many words is different. Is there some way of telling when this happens? By "way" we mean. We have already seen examples where completely different regular expressions end up describing the same language.

As to the first and perhaps most important question. We may be centuries away from being able to do that. We present an algorithmic procedure in Chapter 12 to determine whether or not two regular expressions define the same language.

Before we can construct an algorithm for obtaining understanding we must have some good definition of what it means to understand. We prove in Chapter 11 that there are some languages that cannot be defined by any regular expression.

Another fundamental question is this: We have seen that every regular expression is associated with some language. The reason this trick only works for finite languages is that an infinite language would become a regular expression that is infinitely long.

We can think of it as arbitrary double letter arbitrary Let us now ask. A a b ab ba aba bab abab baba. The first term above clearly represents all words that have at least three a's in them.

One obvious fact is that all the words in the language of E must have at least two a's in them. But since all strings with three or more a's are themselves already strings with two or more a's. Let us break up the middle plus sign into its two cases: U It is possible by repeated application of the rules for forming regular expressions to produce an expression in which the star operator is applied to a subexpression that already has a star in it.

Some examples are: It cannot contain more than everything. The language defined by the regular expression on the right cannot contain any word with a double b. It starts with an undoubled pair either ab or ba. All words with an even number of a's and an even number of b's belong to the language of E.

If this were all we wanted to conclude. If the word ends before we find such a pair. The proof of this parallels our argument above. After this section of type 3 we could proceed with more sections of type.

Continue scanning by skipping over the double a's and double b's that get in the way until we find the balancing unmatched pair ab or ba to even off the count of a's and b's. We know that another undoubled pair will be coming up to balance off the initial one. If the first two letters are the same. All words in the language of E are made up of these three types of substrings and.

If the section started with a ba. Scan over the doubled letter pairs until we come to an unmatched pair such as ab or ba. One property of this section of the word is that it has an even number of a's and an even number of b's.

Consider a word w with even a's and even b's. The total effect is that every word of the language of E contains an even number of a's and an even number of b's. This must begin a substring of type 3. If it started with a ba and ended with an ab. First we come to a double a type. Then perhaps we come upon a pair of letters that are not the same. Let us have only one flag called the type 3-flag. This is another starred expression with a star inside.

Once we have found the balancing unmatched pair. Consider them bookends or open and close parentheses. We start both flags at 0 and check to be sure they are both 0 at the end. If the flag starts at 0. The typical word here starts with some b's. But there is another method that also works that uses only one flag-the method that corresponds to the discussion above.

**Other books:**

*UNDERSTANDING COMPUTERS PDF*

We will refer to this language again later. Every time an a is read. We are about to feed in a long string of a's and b's. We read the letters in two at a time. If they are the same. By "balancing" we do not mean it has to be the same unmatched pair: If it is 0 at the end. Then we finish up with a final a or we leave the last b's as they are. Let us consider this as a computer algorithm. This method will work.

One method is to keep two binary flags. E represents the language of all strings with even a's and even b's. This means each word contains the substring aaa or the substring bbb but not both. All strings that have an even number of a's and an odd number of b's. This means that every clump of a's contains 3 or 6 or 9 or All strings in which the total number of a's is divisible by three. All strings in which the letter b is never tripled.

All strings that do not have both the substrings bba and abb. All strings that have an odd number of a's and an odd number of b's.

This means that no word contains the substring bbb. All words in which a appears tripled. Let ri. All words that contain exactly three b's in total. All words that contain exactly two b's or exactly three b's. This will be the same as "proving a distributive law" for regular expressions. Show that the language associated with r. All words that contain at least one of the strings s. All words in which a is tripled or b is tripled. We have defined the product of two sets of strings in general.

Similarly we can define S3. If we apply this to the case where both factors are the same set. Arden Let R. Explain why we can take any pair of equivalent regular expressions and replace the letter a in both with any regular expression R and the letter b with any regular expression S and the resulting regular expressions will have the same language.

Prove the following statements. After a certain number of rolls. Usually it is then some other child's turn to throw the dice and make his or her move. Pieces are set up on a playing board. Depending on the number. The child has no options about changing the board. Everything is determined by the dice. The game changes from one state to another in a fashion determined by the input of a certain number.

We call this a final state. We could eliminate the opponent and have the one child move first the white pieces and then the black. We should allow for the possibility that after a number is entered the game is still in the same state as it was before.

Let us look at all possible positions of the pieces on the board and call them states. For each possible number there is one and only one resulting state. Dice are thrown or a wheel is spun. There might be Whether or not the white pieces win the game is dependent entirely on what sequence of numbers is generated by the dice. A child has a simple computer input device. Two machines are in the same state if their output pages look the same and their memories look the same cell by cell.

Some sequences of input instructions may lead to success printing the 7 and some may not. In the first example.

## Solutions by Chapter

Nothing else. Printing the 7 is what is. Success is entirely determined by the sequence of inputs. If all goes well. Here the board is the computer and the different arrangements of pieces on the board correspond to the different arrangements of O's and l's in the cells of memory. Let us put this game back on the shelf and take another example. No choice is involved. As in the case of the board-game. We can consider this process to be similar to the boardgame.

We can then define a certain language as the set of strings of those letters that lead to success. This is the language with words that are all programs that print a 7. The most general model. Each instruction is executed as soon as it is read. No knowledge is required of the state the machine was in six instructions ago.

The computer is also deterministic. Beginning with the initial state which we presume to be unique some input sequences of numbers lead to victory for the first child and some do not. One small difference between these two situations is that in the child's game the number of pieces of input is determined by whether either player has yet reached a final state whereas with the computer the number of pieces of input is a matter of choice made before run time.

Either the program will work or it won't. It is automatic involuntary and mechanical not willful. The child writes a program. In Computer Theory these are also called halting states or terminal states or accepting states. We can then define a language to be the set of all words over this alphabet that lead to success. Instead of writing out the whole phrase "finite automaton" it is customary to refer to one by its initials.

From state y and input a go to state x. Suppose that the input alphabet has only the two letters a and b. The term FA is read by naming its letters. Even so. From state x and input a go to state y. It does not do anything like print output or play music.An a then takes us to state 2. There are four edges labeled a. Let the following be the rules of transition: As always. I ate two apples.

### Related Posts:

- INTRODUCTION TO FINANCIAL ACCOUNTING 9TH EDITION PDF
- AN INTRODUCTION TO THEORIES OF PERSONALITY 8TH EDITION PDF
- COMPUTER AWARENESS BOOK BY ALOK KUMAR
- COMPUTER GRAPHICS FOR JAVA PROGRAMMERS PDF
- DISTRIBUTED COMPUTING SUNITA MAHAJAN AND SEEMA SHAH EBOOK
- COMPUTER NETWORKS TEXTBOOK BY TANENBAUM PDF
- EBOOK COMPUTER GRAPHICS BY BAKER
- COMPUTER APTITUDE QUESTIONS ANSWERS PDF
- CBSE COMPUTER BOOK FOR CLASS 9
- MODERN ARNIS PDF
- METAL GEAR SOLID ART BOOK
- ESCAPING REALITY EPUB
- NAMAZ WITH URDU TRANSLATION PDF
- LINUX VOICE MAGAZINE PDF
- THE DSLR FILMMAKERS HANDBOOK REAL-WORLD PRODUCTION TECHNIQUES PDF