69 lines
2.3 KiB
Markdown
69 lines
2.3 KiB
Markdown
---
|
|
created: 2026-04-08 08:52
|
|
course: "[[29593850 - Automationtheory]]"
|
|
topic: "#languages #string #character #kleene #regularExpressions"
|
|
related: "[[29593850 - Automationtheory]]"
|
|
type: lecture
|
|
status: 🔴
|
|
tags:
|
|
- university
|
|
---
|
|
## 📌 Summary
|
|
|
|
> [!abstract]
|
|
> Overview of lecture 1 on `Wednesday, 2026/Apr/08`
|
|
|
|
---
|
|
|
|
## 📝 Content
|
|
|
|
### Alphabets
|
|
Alphabets are formal, non-empty, sets of symbols (usually lowercase letters). They are denoted by $Sigma$.
|
|
|
|
$Sigma = {a, b}$
|
|
> Alphabet $Sigma$ contains the characters $a$ and $b$.
|
|
|
|
### Strings
|
|
A string is a set of letters. If there is an alphabet $Sigma = {a,b}$ then `abba` is a string made from that alphabet.
|
|
The empty string is denoted by $epsilon$, this is the neutral element.
|
|
### Concatenation
|
|
String can be concatenated, where one string is appended to another.
|
|
$"apple" dot "pie" = "applepie"$
|
|
|
|
$&x = "apple" \ &y = "pie" \ &x dot y = "applepie"$
|
|
|
|
Order of operations / Brackets do _not matter_.
|
|
Any string concatenated with the empty string $epsilon$ will result in itself.
|
|
|
|
### Exponentiation
|
|
|
|
|
|
### Reversing / Mirroring
|
|
For a string $x = a_1 a_2 ... a_(n-1) a_n$ of length $n$, it's _mirrored string_ is given by
|
|
$$ x^("Rev") = a_n a_(n-1)...a_2 a_1$$
|
|
|
|
### Kleene Star
|
|
Denoted by $Sigma^*$. The Kleene Star (or _Kleene Closure_) gives an infinite amount of strings made up of the characters of the alphabet.
|
|
|
|
$$
|
|
Sigma^* {a, b} = {epsilon, a, b, "aa", "ab", "ba", "bb", "aaa", "aab", ...}
|
|
$$
|
|
> Example of the Kleene Star of the alphabet ${a, b}$
|
|
### Formal Languages
|
|
A formal _language_ of the alphabet $Sigma$ is a subset $L$ of $Sigma^*$
|
|
|
|
### Finite representation of languages
|
|
**Goal:** Represent a language using _finite_ information
|
|
#### Using set notation
|
|
$S = {a^n b^m bar n, m >= 0} = {epsilon, a, b, "aa", "ab", ...}$
|
|
> This is very inefficient.
|
|
|
|
#### Using regular expressions
|
|
A _regular expression_ $r$ over an alphabet $Sigma$ is defined recursively:
|
|
- $emptyset, epsilon$ and each $a in Sigma$ are regular expression, which represent the Languages $L(emptyset) = emptyset, L(epsilon) = {epsilon}$ and $L(a) = {a}$
|
|
- If $r$ and $s$ are regular expressions then
|
|
- $(r+s)$
|
|
<mark style="background: #FF5582A6;"> - !! Complete from leture notes</mark>
|
|
|
|
### Regular languages
|
|
A language $L$ that can be described by a regular expression $r$ (i. e. $L(r) = L$) is called _regular_. |