Lably
Skip to content

Nested word

Formal language concept

  • 9 min read
  • 6 chapters

Related on Lably

Through Computer science, String (computer science) and Natural number

Formal definition

To define nested words, first define matching relations. For a nonnegative integer ℓ, the notation [ℓ] denotes the set {1,2,…,ℓ−1,ℓ}, with the special case [0]=∅.

A matching relation ↝ of length ℓ≥0 is a subset of {−∞,1,2,…,ℓ−1,ℓ}×{1,2,…,ℓ−1,ℓ,∞} such that:

  1. all nesting edges are forward, that is, if i ↝ j then i < j;
  2. nesting edges never have a finite position in common, that is, for −∞ < i < ∞, there is at most one position h such that h ↝ i, and there is at most one position j such that i ↝ j; and
  3. nesting edges never cross, that is, there are no i < i ′ ≤ j < j ′ such that both i ↝ j and i ′ ↝ j ′.

A position i is referred to as

  • a call position, if i ↝ j for some j,
  • a pending call if i ↝ ∞,
  • a return position, if h ↝ i for some h,
  • a pending return if −∞ ↝ i, and
  • an internal position in all remaining cases.

A nested word of length ℓ over an alphabet Σ is a pair (w,↝), where w is a word, or string, of length ℓ over Σ and ↝ is a matching relation of length ℓ.

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Computing and communication