prefixclosure
Prefix closure, or prefixclosure, is a concept in formal languages. For a language L that is a subset of Σ*, the prefix closure Pref(L) is the set of all prefixes of strings in L. Formally, Pref(L) = { w ∈ Σ* | ∃ v ∈ Σ* with w v ∈ L }. Equivalently, Pref(L) consists of every finite initial segment of any string in L. The empty string ε is a prefix of every nonempty string, so ε ∈ Pref(L) whenever L ≠ ∅. If L is empty, Pref(L) = ∅.
Examples help illustrate the idea. If L = { a^n | n ≥ 0 }, then Pref(L) = a*, the set of
Properties and constructions. If L is a regular language, then Pref(L) is also regular. A standard construction
Applications. Prefix closures are used to analyze extendability of partially read inputs, to study prefix-closed properties