1.7 KiB
Strings and languages:
- An alphabet is a finite set of symbols, such as {1,2,3} or {0,1}
- A string is an alphabet
\sum
is a finite sequence of symblols from\sum
, for example 010010 and 10010101 are strings over the alphabet {0,1} - A languge is a set of strings
- L1 = {00, 01, 10, 11}
- L2 = {a^n | n is an integer non-negative} Notation: a to the power of n just means a repeated n times
Examples
L_8 = \{a^m b^n | m,n \in \mathbb{z}^{nonneg}\}
So valid strings would be aaabbb, aaabbbb, ab, abb
L_9 = \{a^n b^n | n \in \mathbb{z}^{nonneg}\}
So valid strings would be aabb, ab, aaaabbbb, aaaaaabbbbbb
$L_{11} = {w \in {a, b}^* | \text{The number of "a"s is equal to the number of "b"s}}$ This would include everything that L9 includes, but allows for the alphabet can be out of order
You can also written this as
L_{11} = \{w \in \{a, b\}^* | n_a(w) = n_b(w)\}
You can extend the repetition notation (exponent) to include multiple symbols by wrapping it in parentheses
Example:
L_{12} = \{(ab)^n | n \in \mathbb{z}^{nonneg}\}
This means we need to be careful as $L_{13} = {ab^n | n \in \mathbb{z}^{nonneg}}$ is different, as L12 is asking for repetition of ab, while L13 is assigning a prefix of a and repetition of b
L_{14} = \{a^i b^j c^k | i,j,k \in \mathbb{z}^{nonneg}, j = 2i + 3k\}
So this means that for any number of "a"s and "c"s, the number of "b"s is predetermined if you have selected your "a"s and "c"s
Intro to functions and relations
Informally, a function (f) descrives an input output situation (A -> B) For every input element a in A, there is exactly one ouput element b in B
f maps a to b
A is the domain of f B is the co-domain of f