• Aucun résultat trouvé

Cursus: M1, computer-science Code UE: JEIN8602

N/A
N/A
Protected

Academic year: 2022

Partager "Cursus: M1, computer-science Code UE: JEIN8602"

Copied!
3
0
0

Texte intégral

(1)

Cursus: M1, computer-science Code UE: JEIN8602

Subject: Formal languages theory Date: August 11th 2018

Duration: 3H

Documents: authorized

Lectures by: Mr G´eraud S´enizergues

The exercises are independant one from each other. Thus each mathematical symbol (G, L, . . .) has a single definite meaning inside each exercise, but might have different meanings from an exercise to another.

It is not required to solve all the exercises. Every correct solution to an exercise will give (around) 4 points.

Exercice 1 [/4] We consider the finite automaton A described on figure 1. Note that 0 is

0 1 2 3

a a a

a b

b

b

Figure 1: finite automaton A

the only initial state and 3 is the only final state.

0- Describe accepting computations of A over the words:

aaa, ba, abbba, babba.

1- Construct a regular expression for the language L

A

recognized by the automaton A.

Explain the successive steps of your construction.

(2)

Exercice 2 [/4] Let us consider the regular expression:

e := (ac)

b(a ∪ (bc)

)

Construct, by Glushkov’s method, a finite automaton recognizing L

e

. Explain the successive steps of your construction.

Exercice 3 [/5]

We consider the context-free grammar G := (A, N, R) where A = {a, b}, N = {S

0

, S

1

, S

2

} and R consists of the following rules:

S

0

→ aS

1

S

0

→ bS

2

S

1

→ aS

1

S

1

→ bS

2

S

2

→ aS

2

S

2

→ ε

The start symbol of G is S

0

.

1- Construct a finite automaton A recognizing L(G, S

0

).

2- Construct a finite automaton B recognizing

t

L(G, S

0

) i.e. the set of all mirror images of the words of L(G, S

0

).

3- Construct a complete deterministic finite automaton C recognizing

t

L(G, S

0

).

4- Construct the minimal complete deterministic finite automaton D recognizing

t

L(G, S

0

).

Exercice 4 [/4]

1- For each of the following languages over the terminal alphabet {a, b, c, d}, construct a context-free grammar that generates the language L

i

:

L

1

:= {a

p

b

q

| p ≥ 0, q ≥ 0}

L

2

:= {a

p

b

q

| p ≥ 0, q ≥ 0, p = q}

L

3

:= {a

p

b

q

| p ≥ 0, q ≥ 0, p > q}

L

4

:= {(ac)

p

(bd)

q

| p ≥ 0, q ≥ 0, p > q}

L

5

:= {(ac)

p

(bd)

q

| p ≥ 0, q ≥ 0, p 6= q}

2- Construct a non-ambiguous context-free grammar generating the language L

3

. 3- Construct a non-ambiguous context-free grammar generating the language L

4

. 4- Construct a non-ambiguous context-free grammar generating the language L

5

.

2

(3)

Exercice 5 [/4] We consider the context-free grammar G := (A, N, R) where A = {a, b}, N = {S, T, U, V, W, X, Y, Z } and R consists of the following rules:

S → ST S → T S → U T → bT T → aV X T → ε U → bU U → abW U → ε V → bT V → U V

W → bU X W → T U V X → aXU X → bT Y Z

Y → aY b Y → aW Z → XU Z → aZY

The start symbol of G is S.

1- What are the productive non-terminals of G ? 2- What are the useful non-terminals of G ?

3- Transform the grammar G into an equivalent grammar G

where every non-terminal is productive and useful.

4- Is the language L(G, S) empty ? 5- Is the language L(G, S) infinite ?

Exercice 6 [/5] We consider the context-free grammar G := (A, N, R) where A = {a, b}, N = {S, T, U, V, W } and R consists of the following rules:

S → ST U S → Sa S → SbW S → a T → aU

U → bT U → bU U → b W → W ab W → W bb W → ε

1- Show that L(G, W ) is regular. Give a regular expression for this language.

2- Show that L(G, T ), L(G, U ) are regular. Give regular expressions for these languages.

3- We consider the context-free grammar H := (A

, N

, R

) where A

= {a, b, t, u, w}, N

= {S} and R

consists of the following rules:

S → Stu S → Sa S → Sbw S → a

Give a regular expression for L(H, S ).

4- Give a regular expression for L(G, S).

5- Does there exists a simple grammar generating the language L(G, S) ? Hint: a and aa both belong to L(G, S).

6- Let c be a letter not in {a, b}. Give a simple grammar K generating the language L(G, S) ·c.

3

Références

Documents relatifs

They also agreed to develop, strengthen and implement effectively their national food safety programmes; to continue to monitor and evaluate their food safety activities; and

Subject: Formal languages theory Date: 26 August 2014.

Subject: Formal languages theory Date: 05 July 2013..

Thus each mathematical symbol (G, L,. .) has a single definite meaning inside each exercise, but might have different meanings from an exercise to another.. It is not required to

Subject: Formal languages theory Date: 20 March 2016..

Thus each mathematical symbol (G, L,. .) has a single definite meaning inside each exercise, but might have different meanings from an exercise to another.. It is not required to

And while much of the professional development that a scientist undergoes is seemingly about ‘ learning the lay of the land ’ , the truth of the matter is that a key feature

University of Zurich (UZH) Fall 2012 MAT532 – Representation theory..