Assignment 1: Mathematical Methods in Linguistics

advertisement
Torbjörn Lager
Dept. of Linguistics
Stockholm University
Assignment 2: Mathematical Methods in Linguistics
You are allowed to refer to the literature. You are not allowed to cooperate with your fellow students.
No further leads will be provided; I will answer questions of clarifications only.
Deadline is 26/11 2001.
Good luck!
Languages and Automata
Problem 1
The automaton A in the diagram to the right generates a language L.
1. Characterize L informally. I.e. is it finite or infinite?
Does it contain the empty string? Give a few
examples of strings that are members of L.
b
b
1
2
a
c
2. Is A deterministic or indeterministic? Motivate!
If it is indeterministic, determinize it!
Also, make sure your new automaton is minimal.
b
a
3. Write a regular expression describing the language that
L generates. Make sure your expression becomes as simple
as possible.
0
4. Construct a regular grammar that generates L.
5. Construct a context free grammar that generates L. (Only the simplest possible answer here
will be considered correct.)
Problem 2
Draw state diagrams for the automata corresponding to the following regular expressions. Your
automata must be minimal and deterministic. For 2) and 3) you must also describe how you came to
your conclusions.
1. [a b c][a|b|c]a*b*c*
2. [(a)(b) ~[?*]]|c
3. [[a|b|c]*[d|””]][[c|b|a]*(d)]
NB: ”” denotes the empty string language
Problem 3
Given is the following language over  = {a, b, c, d}, containing just four strings:
{”abcba”, ”a”, ”aba”, ”bcb”}
1. Is this a regular language? Motivate!
2. Is it a context free language? Motivate!
3. Construct a grammar or a regular expression describing the language.
Problem 4
The languages L1, L2 and L3 are regular languages. Will (L1  L2)  L3 be a regular language?
Motivate you answer!
Problem 5
Write a context free grammar which generates the language consisting of strings with an even number
of a’s followed by an even number of b’s, and where the b’s are twice as many as the a’s. For
example, the following strings are elements in this language: {”aabbbb”, ”aaaabbbbbbbb”, …}.
Problem 6
[På svenska för en gångs skull!:] Svenska bilar har registreringnummer som består av tre stora
bokstäver A-Z följt av tre siffror 0-9. Sedan finns en rad undantag: Inga bilnummer får innehålla
bokstaven ’I’. Det finns inga bilnummer som börjar med en bokstav efter S (dvs inga skyltar på
formen T*****, U*****, ...). Dessutom är det vissa ord som är bannlysta: FAN, DUM, TAJ (m.fl.
men det räcker med att ni bryr er om dessa.)
1. Skriv ett regulärt uttryck som beskriver mängden av alla giltiga svenska bilnummer.
2. Skriv ett regulärt uttryck som beskriver mängden av alla ogiltiga svenska bilnummer.
Ni får gärna använda er av differensoperatorn, ’any’-symbolen, etc.
Download