Foundations · Lesson 1
Words
A word over an alphabet is a finite sequence of letters of . We write a word of length as
with each . The length of is written .
Words are written without separators: the word 001001 is the sequence of six letters 0, 0, 1, 0, 0, 1, not a single number.
We group words by length: is the set of length- words, the set of all finite words (all lengths), and the set of all nonempty words. More precisely:
In particular, contains the empty word (it has length ), while does not.
The empty word
The word with no letters is the empty word, written . Its length is . It is a word over every alphabet.
Concatenation
Given two words and , their concatenation is the word formed by writing all of followed by all of . For example, 01 · 001 = 01001, and for every word .
Length is additive under concatenation: . For example, .
1-based indexing
Positions in a word are numbered starting from , matching the notation for the factor from position to position :
If , then : an empty range is the empty word.
For example, in 001001 we have , , and . The empty range equals .
Try it: inspect a word
Select a range in the word below and read off the letters at those positions: