Write a regular expression for binary strings with at least two 0s but not consecutive 0s. 1*01+01*

Write a regular expression that matches all strings over the alphabet {a, b, c} that contain: Starts and ends with a
a(a*b*c*)a /( a / a(a/b)*a)
At most one a
b*c*/b*c* a b*c*
At least two a's
b*c* a b*c* a b*c*
An even number of a's
(b*c* a b*c* a b*c*)+
Number of a's plus number of b's is even

Write a regular expression to describe all dates of the form Month DD, YYYY, where Month consists of any string of upper or lower case letters, the date is 1 or 2 digits, and the year is exactly 4 digits. The comma and spaces are required.

Write a regular expression for each of the following:
Strings over the alphabet {a, b, c} where the first a precedes the first b. c*a[ac]*b[abc]*
Strings over the alphabets {a, b, c} with an even number of a’s. (b*c* a b*c* a b*c*)+ / (aa/b/c)*
Binary numbers that are multiples of four.
( 1/0 1/0 1/0 1/0)* / (0*[01]*00 | 0+)
Binary numbers that are greater than 101001.
Strings over the alphabet {a, b, c} thar don’t contain the contiguous substring baa. ([ac]*b(c/a[^a])[ac]*b*)+/[ac]+

Identify the lexeme that makes up the tokens in the following programs. Give reasonable attribute vcalues for the tokens. Pascal
Function max ( i, j : integer) : integer ; {
return maximium of integers i and j }
begin
if i > j then max := i
else max := j
end;
C
Int max ( i, j) int i, j;
/* return maximium of integers I and j */
{ return i > j? i:j; }

Draw the Transition Diagram for relational operators.

...
REGULAREXPRESSIONS AND IT’S APPLICATIONS
REGULAREXPRESSIONS
A regularexpression is a specific pattern that provides concise and flexible means to "match" (specify and recognize) strings of text, such as particular characters, words, or patterns of characters. Common abbreviations for "regularexpression” include regex and regexp. It is a Compact mechanism for defining a language.
OPERANDS OF REGULAREXPRESSION
The empty string ε
Single characters of the underlying alphabet
Shorthand for groups of characters
(Letter for A-Z or a-z, digit for 0-9, etc.)
Legal regularexpressions (an operator might be applied to the result of an operator)
REGULAREXPRESSION OPERATORS
PRECEDENCE OF OPERATORS
APPLICATION: WEB SEARCH ENGINES
One use of regularexpressions that used to be very common was in web search engines. Archie, one of the first search engines, used regularexpressions exclusively to search through a database of filenames on public FTP servers. Once the World Wide Web started to take form, the first search engines for it also used regularexpressions to search through their indexes. Regularexpressions were...

...RegularExpressions
This ppt is the work by Dr. Costas Busch, used with permission, and
available from
http://csc.lsu.edu/~busch/courses/theorycomp/fall2008/
1
RegularExpressionsRegularexpressions
describe regular languages
Example:
(a b c) *
describes the language
a, bc * , a, bc, aa, abc, bca,...
2
Recursive Definition
Primitive regularexpressions: , ,
Given regular expressionsr1
r2
and
r1 r2
r1 r2
r1 *
Are regularexpressions
r1
3
Examples
A regularexpression:
a b c * (c )
Not a regularexpression:
a b
4
Languages of RegularExpressions
L r
r
: language of regularexpression
Example
L (a b c) * , a, bc, aa, abc, bca,...
5
Definition
For primitive regularexpressions:
L
L
L a a
6
Definition (continued)
For regular expressionsr1
andr2
L r1 r2 L r1 L r2
L r1 r2 L r1 L r2
L r1 * L r1 *
L r1 L r1
7
Example
Regularexpression: a b a *
L a b a * L a b L a *
L a b L a *
L a L b L a *
a b a *...

...CS 3133 Foundations of Computer Science
C term 2014
Solutions of the Sample Problems for the Midterm
Exam
1. Give a regularexpression that represents the set of strings over Σ =
{a, b} that contain the substring ab and the substring ba.
Solution:
a+ b+ a(a ∪ b)∗ ∪ b+ a+ b(a ∪ b)∗
(20 points)
2. Consider the following grammar G:
S → SAB|λ
A → aA|a
B → bB|λ
(a) Give a leftmost derivation of abbaab.
(b) Build the derivation tree for the derivation in part (1).
(c) What is L(G)?
Solution:
1
(a) The following is a leftmost derivation of abbaab:
S
⇒ SAB
⇒ SABAB
⇒ ABAB
⇒ aBAB
⇒ abBAB
⇒ abbBAB
⇒ abbAB
⇒ abbaAB
⇒ abbaaB
⇒ abbaabB
⇒ abbaab
(b)
S
A
S
S
A
B
a
a
B
b
A
b
B
B
a
b
B
(c)
L(G) = a(a ∪ b)∗ ∪ λ
(20 points)
3. Construct a regular grammar over the alphabet Σ = {a, b, c, d} whose
language is the set of strings that contain exactly two b-s.
Solution:
The following is a regular grammar over {a, b, c, d} whose language is
the set of strings containing exactly two b-s:
S → aS | cS | dS | bB
B → aB | cB | dB | bC
C → aC | cC | dC | λ
2
(20 points)
4. Consider the following grammar G:
S → aSA|λ
A → bA|λ
(a) Give a regularexpression for L(G).
(b) Is G ambiguous? Explain your answer.
Solution:
(a) The following is a regularexpression for L(G):
a+ b∗ ∪ λ
(b) Yes...

...1
Equivalence of Finite Automata and RegularExpressions
Finite Automata Recognize Regular Languages Theorem 1. L is a regular language iﬀ there is a regularexpression R such that L(R) = L iﬀ there is a DFA M such that L(M ) = L iﬀ there is a NFA N such that L(N ) = L. i.e., regularexpressions, DFAs and NFAs have the same computational power. Proof. • Givenregularexpression R, will construct NFA N such that L(N ) = L(R)
• Given DFA M , will construct regularexpression R such that L(M ) = L(R)
2
RegularExpressions to NFA
RegularExpressions to Finite Automata . . . to Non-determinstic Finite Automata Lemma 2. For any regex R, there is an NFA NR s.t. L(NR ) = L(R). Proof Idea We will build the NFA NR for R, inductively, based on the number of operators in R, #(R). • Base Case: #(R) = 0 means that R is ∅, , or a (from some a ∈ Σ). We will build NFAs for these cases. • Induction Hypothesis: Assume that for regularexpressions R, with #(R) < n, there is an NFA NR s.t. L(NR ) = L(R). • Induction Step: Consider R with #(R) = n. Based on the form of R, the NFA NR will be built using the induction hypothesis.
RegularExpression to NFA Base Cases If R is an elementary...

...Implementations of:
Finite automata
Regularexpression
Pushdown automata
Engineering applications of finite automata
The study of automata has been acquiring increasing importance for engineers in many fields. For some time, the capabilities of these automata have been of the greatest interest to logicians and mathematicians. However, the expanding literature on the use of finite automata as probabilistic models demonstrates the growing interest in the application of these mechanisms to engineering phenomena.
We, the authors, became interested in these probabilistic models in an effort to develop a general self-adaptive control scheme based on the prediction of the future of the process to be controlled. Conceivably, an adequate model of a particular process could be generated by simply observing the process parameters. With this goal in mind we began an investigation of several different modeling techniques. The ability to model stochastic data was our primary concern. We feel that the results of several modeling experiments presented here may be of interest to our readers, and we hope to encourage the use of these techniques, especially in control applications.
We have seen an example of use of finite automata in describing the operation of a simplified version of vending machine. Many other systems operating in practice can also be modeled by finite automata such as control...

...More Applications
of
the Pumping Lemma
This ppt is the work by Dr. Costas Busch, used with permission, and
available from
http://csc.lsu.edu/~busch/courses/theorycomp/fall2008/
1
The Pumping Lemma:
• Given a infinite regular language
L
• there exists an integerm
| w | m
with length
• for any string w L
• we can write w x
• with
|x y| m
• such that:
Fall 2006
(critical length
yz
and |
i
xy z L
Costas Busch - RPI
y | 1
i 0, 1, 2, ...
2
Non-regular languages
R
L {vv : v *}
Regular languages
Fall 2006
Costas Busch - RPI
3
Theorem:The language
R
L {vv : v *}
{a, b}
is not regular
Proof:
Fall 2006
Use the Pumping Lemma
Costas Busch - RPI
4
R
L {vv : v *}
Assume for contradiction
that L is a regular language
Since L is infinite
we can apply the Pumping Lemma
Fall 2006
Costas Busch - RPI
5
R
L {vv : v *}
Let
m
be the critical length for L
Pick a string w
such that: w
L
and length
We pick
Fall 2006
| w | m
m m m m
w a b b a
Costas Busch - RPI
6
From the Pumping Lemma:
m
m
m
we can write: w a b b a
with lengths:
m
x y z
| x y | m, | y |1
m
m m m
w xyz a...aa...a...ab...bb...ba...a
x
Thus:
Fall 2006
y
z
k
y a , 1 k m
Costas Busch - RPI
7
m m m m
x y z a b b a
k
y a , 1 k m
From the Pumping Lemma: x
i
y z L
i 0, 1, 2, ...
Thus:
Fall 2006
2
xy z L
Costas Busch - RPI
8
m m m m
x y z a...

...
Artistic Expression in “The Storyteller’s Daughter”
Erin Lowry
Instructor: Cynthia Williams
ENG317: International Voices
November 3, 2014
Artistic Expression is a way in which an artist, whether writer, painter, musician, or even just a regular person expresses themselves through art and imagination. We have all long read stories or heard songs that come from someone’s heart and maybe imagination. But what we don’t realize when we hear, read or see these expressions is that for some they are much more personal and may very well be based on something true and close to their hearts.
How many times have you gone to a museum and stared at a painting and wondered what the artist was thinking of; or where and whom? This is an example of artistic expression. Or maybe your favorite song that you listen to over and over again. These artists that put these things out there for all of us to see, hear, and read, they are putting their stories out for us to feel the way they feel.
Well when Saira Shah wrote her short story “The Storyteller’s Daughter”, she was doing just that. She wanted us to feel the way she felt when her father told her stories of his native homeland of Afghan. Saira was told these stories or at least what she thought was fairytales beginning at a young age. Her father was so proud of his heritage and his homeland that he wanted to share it with her.
He told her of a “magical...

...+ 13| = –7
5x + 13 = -7
5x = -20
X = -4
Simplify the expression below.
6n2 - 5n2 + 7n2
6 – 5 + 7 = 8
=8n2
The total cost for 8 bracelets, including shipping was $54. The shipping charge was $6. Write an equation that models the cost of each bracelet.
8 x + 6 = 54 $8.00 each bracelets
The total cost for 8 bracelets, including shipping was $54. The shipping charge was $6. Determine the cost for each bracelet. Show your work
8x+6 =54
8x=54-6
8x = 48
X = 6
Solve the inequality. Show your work.
6y – 8 ≤ 10
5. 6y – 8 ≤ 10
6y ≤ 10 +8
6y ≤ 18
y ≤ 18/6
=y ≤ 3
The figures above are similar. Find the missing length. Show your work.
x = 1.8 in
What is 30% of 70? Show your work.
30 divied by100 = .30
70 times 0.3(30% as a decimal) which will be 21
=21
Simplify the expression below.
-5-8
(16x9)/(21x8)=144/168 divided by 12=12/14=6/7
8. 6/7
Which property is illustrated by 6 x 5 = 5 x 6?
commutative property of multiplication
Evaluate the expression for the given values of the variables. Show your work.
4t + 2u2 – u3; t = 2 and u = 1
4t + 2u2 – u3; t = 2 and u = 1
4 (2) + 2 (1) 2 – (1) 3
8 + 2 – 1 = 1
Solve the inequality. Show your work.
|r + 3| ≥ 7
R + 3 = 7, r = - 10 and r =4
What percent of 60 is 12? Show your work.
20% of 60. 12 / 60 * 100 = 20
Simplify the expression...