Skip to content
Tape‑n‑Trace
PracticeSearch 26 tools

Strings and languages

Hopcroft 2e, §1.5 — the vocabulary the rest of the subject is written in.

Alphabet

An alphabet Σ is a finite, non-empty set of symbols. Σ = {0, 1} is the binary alphabet; Σ = {a, b, c} is another. A symbol is atomic — it has no parts.

String

A string over Σ is a finite sequence of symbols from Σ. Its length |w| is how many symbols it has, counting repeats: |0110| = 4.

The empty string ε is the string of length zero. It is a string like any other — it is not "nothing", and it is not the same as the empty set. Half the marks lost on this topic come from that one confusion.

Powers of an alphabet

Σk is the set of strings of length exactly k. So Σ1 is essentially Σ itself, Σ2 is every pair, and:

Σ0 = {ε}

One element, not zero — whatever the alphabet is, there is exactly one string of length 0 over it.

Σ* and Σ⁺

Σ* is the set of all strings over Σ: Σ0 ∪ Σ1 ∪ Σ2 ∪ … It is infinite for any non-empty alphabet, though every string in it is finite. Σ⁺ is the same set without ε.

A language over Σ is any subset of Σ*. That is the whole definition — which is why "is this language regular?" is a question worth a whole module.

Try it

Change the alphabet and the bound. Watch the count, not just the list.

15 strings of length at most 3 over an alphabet of 2 symbols. |Σ≤k| = 1 + |Σ| + |Σ|² + … + |Σ|k

  1. ε
  2. 0
  3. 1
  4. 00
  5. 01
  6. 10
  7. 11
  8. 000
  9. 001
  10. 010
  11. 011
  12. 100
  13. 101
  14. 110
  15. 111

Concatenation

If x and y are strings, xy is x followed by y, and |xy| = |x| + |y|. Concatenation is associative, and ε is its identity: εw = wε = w.

The same thing, spelled differently

The question papers and the textbook do not always agree on names. These all mean the same thing, and this tool accepts either spelling.

TextbookAlso written
DFA — deterministic finite automatonDFSM, deterministic finite state machine, deterministic finite acceptor, FSA
NFA — nondeterministic finite automatonNDFSM, NDFA, nondeterministic finite state machine, non-deterministic finite automaton
ε-NFA — nondeterministic finite automaton with ε-transitionsepsilon-NFA, e-NFA, NFA with epsilon moves, ε-NDFSM
PDA — pushdown automatonNPDA, nondeterministic pushdown automaton, push-down automaton
DPDA — deterministic pushdown automatondeterministic PDA, deterministic push-down automaton
ID — instantaneous descriptioninstantaneous description, configuration
TM — Turing machineTuring Machine, DTM, deterministic Turing machine
CFG — context-free grammarcontext free grammar, CFL grammar
CNF — Chomsky normal formChomsky Normal Form, chomsky normal form
GNF — Greibach normal formGreibach Normal Form
regular expression — regular expressionRE, regex, regexp