Skip to main content

Language

Symbol

A symbol is an atomic unit of the language. We usually just use characters starting from aa or use numbers.

Sentence

A sentence is a sequence of symbols. We usually use s,u,v,w,x,y,zs, u, v, w, x, y, z as notation for a sentence. That is, for example, u=aaaau=aaaa.

Language

Language is a set of sentences. Usually noted as L\mathcal{L}.

At Operator

We can use n@wn@w to take the nn th symbol of sentence ww, starting from zero. For example,

0@(abc)=a0@(abc) = a

Vocabulary

A vocabulary is a set of symbols. Usually noted as V\mathcal{V}.

Length of the Sentence

The length of a sentence is how many symbols it has. Noted as v|v| for sentence vv.

Empty Sentence

An empty sentence is a sentence with no words. It is unique and often noted as λ\lambda, λ=0|\lambda| = 0.

Concatenation

The concatenation of two sentences uu and vv is denoted as uvuv.

n@uv={n@un<unu@vnun@uv = \begin{cases} n@u & n < |u| \\ n-|u|@v & n \geq |u| \end{cases}

Prefix and Suffix

ss is a suffix of yy if and only if there exists such xx that, xs=yxs=y.

ss is a prefix of yy if and only if there exists such xx that, sx=ysx=y.

Substring

ss is a substring of yy if and only if there exists such xx and zz that, xsz=yxsz=y.

Sentence with Single Symbol

If a sentence has only one symbol, we can use the symbol to denote the sentence. For example, aa can be a sentence with one symbol aa.

Repeat

If a sentence uu is nn times concatenation to vv, then we note, u=vnu = v^n.

We define, u0=λu^0 = \lambda.

Reverse

wRw^R is the reverse of sentence ww, where wR=w|w^R| = |w|, but i@wR=(nj1)@wi@w^R = (n-j-1)@w

Concatenation with Vocabulary

If we concatenate a sentence ww to a vocabulary V\mathcal{V}, it yields a language set.

wV={wssV}w\mathcal{V} = \{ ws | s \in \mathcal{V} \}

Language Concatenation

The concatenation of two language L1\mathcal{L}_1 and L2\mathcal{L}_2 yields a new language, such that every sentence is a concatenation of a sentence in L1\mathcal{L}_1 and a sentence in L2\mathcal{L}_2.

Similarly, if the concatenation happens multiple times, we note it as exponentiation.

Vocabulary as Language

We define,

λV\lambda \mathcal{V}

As the corresponding language set of a vocabulary. We still note this language V\mathcal{V}.

Closure

The star closure of a language results in all the possible sentence that can be built by concatenation.

That is,

L=n=0Ln\mathcal{L}^* = \bigcup_{n=0}^{\infty} \mathcal{L}^n

For positive closure, it removes the empty sentence.

L+=n=1Ln\mathcal{L}^+ = \bigcup_{n=1}^{\infty} \mathcal{L}^n