Regular Languages are the simplest family of formal languages.
Can be defined in different ways:
Regular Expression (regexp) is a string $r$ defined with the terminal alphabet $\Sigma$
containing some metasymbols
$r,s,t$ are regexp
$r=s^$ <!---->
star *
concatenation .
union $\cup$ or |
By admitting the use of set-theoretic operations Intersection, Complement and Difference we obtain the so called Extended regular expressions.
A language is regular if it is generated by a regular expression
regexp | language |
---|---|
$\varepsilon \;\text{or}\;\varnothing$ | ${\varepsilon}$ |
$a\in\Sigma$ | ${a}$ |
$s \cup t \; \text{or} \; s \mid t$ | $L_s \cup L_t$ |
$s.t \; \text{or} \; st$ | $L_s.L_t$ |
$s^*$ | ${L_s}^*$ |
The regexp $e$ that generates the language of integers, possibly signed
$e={(+\cup - \cup\varepsilon)dd}^$ $L_e={+,-,\varepsilon}{d}{d}^$
Family of regular languages or REG:
Is the collection of all regular languages.
Family of finite languages or FIN:
Is the collection of all languages of finite cardinality.
Every finite language is regular as it is the union of a finite number of finite strings.
But family of regular languages contains also languages of infinite cardinality.
$$FIN\subset REG$$
Isolate the subexpressions and put them into evidence $$ (a_1\cup (b_2b_3))^\;\;\;\;c_4^+ \cup (a_5 \cup (b_6b_7))$$ $$ a_1\cup (b_2b_3)\;\;\;\;\;\;c_4^+\;\;\;\;a_5 \cup (b_6b_7)$$ $$ a_1\;\;\;\;b_2b_3\;\;\;\;\;\;c_4^\;\;\;\;a_5 \;\;(b_6b_7)$$ $$ a_1\;\;\;\;b_2\;\;\;b_3\;\;\;\;\;\;c_4^\;\;\;\;a_5 \;\;\;b_6\;\;\;b_7$$ <<!---->
A family of languages is said to be closed with respect to an operator $\theta$ if the result language belongs to the same family as the operand languages.
The $REG$ family is closed with respect to:
therefore it is closed also with respect to derived operators
Regular languages are also closed with respect to mirroring
This means that combining two regular languages with one of the said operators, we obtain another regular language.
#####The family $REG$ of the regular languages is the smallest family of languages such that both the following properties hold:
The $LIB$ family of the context-free languages is closed w.r.t. concatenation, union and star but is not the smallest of such family, in fact: $$REG \subset LIB$$