Lexicographic order

In mathematics, the lexicographic or lexicographical order (also known as lexical order, or dictionary order) is a generalization of the alphabetical order of the dictionaries to sequences of ordered symbols or, more generally, of elements of a totally ordered set.

There are several variants and generalizations of the lexicographical ordering. One variant applies to sequences of different lengths by comparing the lengths of the sequences before considering their elements.

Another variant, widely used in combinatorics, orders subsets of a given finite set by assigning a total order to the finite set, and converting subsets into increasing sequences, to which the lexicographical order is applied.

A generalization defines an order on an n-ary Cartesian product of partially ordered sets; this order is a total order if and only if all factors of the Cartesian product are totally ordered.

Definition

The words in a lexicon (the set of words used in some language) have a conventional ordering, used in dictionaries and encyclopedias, that depends on the underlying ordering of the alphabet of symbols used to build the words. The lexicographical order is one way of formalizing word order given the order of the underlying symbols.

The formal notion starts with a finite set A, often called the alphabet, which is totally ordered. That is, for any two symbols a and b in A that are not the same symbol, either a < b or b < a.

The words of A are the finite sequences of symbols from A, including words of length 1 containing a single symbol, words of length 2 with 2 symbols, and so on, even including the empty sequence with no symbols at all. The lexicographical order on the set of all these finite words orders the words as follows:

  1. Given two different words of the same length, say a = a1a2...ak and b = b1b2...bk, the order of the two words depends on the alphabetic order of the symbols in the first place i where the two words differ (counting from the beginning of the words): a < b if and only if ai < bi in the underlying order of the alphabet A.
  2. If two words have different lengths, the usual lexicographical order pads the shorter one with "blanks" (a special symbol that is treated as smaller than every element of A) at the end until the words are the same length, and then the words are compared as in the previous case.

However, in combinatorics, another convention is frequently used for the second case, whereby a shorter sequence is always smaller than a longer sequence. This variant of the lexicographical order is sometimes called shortlex order.

In lexicographical order, the word "Thomas" appears before "Thompson" because they first differ at the fifth letter ('a' and 'p'), and letter 'a' comes before the letter 'p' in the alphabet. Because it is the first difference, in this case the 5th letter is the "most significant difference" for alphabetical ordering.

An important property of the lexicographical order is that for each n, the set of words of length n is well-ordered by the lexicographical order (provided the alphabet is finite); that is, every decreasing sequence of words of length n is finite (or equivalently, every non-empty subset has a least element).[1][2] It is not true that the set of all finite words is well-ordered; for example, the infinite set of words {b, ab, aab, aaab, ... } has no lexicographically earliest element.

Numeral systems and dates

The lexicographical order is used not only in dictionaries, but also commonly for numbers and dates.

One of the drawbacks of the Roman numeral system is that it is not always immediately obvious which of two numbers is the smaller. On the other hand, with the positional notation of the Hindu–Arabic numeral system, comparing numbers is easy, because the natural order on natural numbers is the same as the variant shortlex of the lexicographic order. In fact, with positional notation, a natural number is represented by a sequence of numerical digits, and a natural number is larger than another one if either it has more digits (ignoring leading zeroes) or the number of digits is the same and the first (most significant) digit which differs is larger.

For real numbers written in decimal notation, a slightly different variant of the lexicographical order is used: the parts on the left of the decimal point are compared as before; if they are equal, the parts at the right of the decimal point are compared with the lexicographical order. The padding 'blank' in this context is a trailing "0" digit.

When negative numbers are also considered, one has to reverse the order for comparing negative numbers. This is not usually a problem for humans, but it may be for computers (testing the sign takes some time). This is one of the reasons for adopting two's complement representation for representing signed integers in computers.

Another example of a non-dictionary use of lexicographical ordering appears in the ISO 8601 standard for dates, which expresses a date as YYYY-MM-DD. This formatting scheme has the advantage that the lexicographical order on sequences of characters that represent dates coincides with the chronological order: an earlier CE date is smaller in the lexicographical order than a later date up to year 9999. This date ordering makes computerized sorting of dates easier by avoiding the need for a separate sorting algorithm.

Monoid of words

The monoid of words over an alphabet A is the free monoid over A. That is, the elements of the monoid are the finite sequences (words) of elements of A (including the empty sequence, of length 0), and the operation (multiplication) is the concatenation of words. A word u is a prefix (or 'truncation') of another word v if there exists a word w such that v = uw. By this definition, the empty word () is a prefix of every word, and every word is a prefix of itself (with w ); care must be taken if these cases are to be excluded.

With this terminology, the above definition of the lexicographical order becomes more concise: Given a partially or totally ordered set A, and two words a and b over A such that b is non-empty, then one has a < b under lexicographical order, if at least one of the following conditions is satisfied:

  • a is a prefix of b
  • there exists words u, v, w (possibly empty) and elements x and y of A such that
x < y
a = uxv
b = uyw

Notice that, due to the prefix condition in this definition, where is the empty word.

If is a total order on then so is the lexicographic order on the words of However, in general this is not a well-order, even if the alphabet is well-ordered. For instance, if A = {a, b}, the language {anb | n ≥ 0, b > ε} has no least element in the lexicographical order: ... < aab < ab < b.

Since many applications require well orders, a variant of the lexicographical orders is often used. This well-order, sometimes called shortlex or quasi-lexicographical order, consists in considering first the lengths of the words (if length(a) < length(b), then ), and, if the lengths are equal, using the lexicographical order. If the order on A is a well-order, the same is true for the shortlex order.[2][3]

Cartesian products

The lexicographical order defines an order on an n-ary Cartesian product of ordered sets, which is a total order when all these sets are themselves totally ordered. An element of a Cartesian product is a sequence whose th element belongs to for every As evaluating the lexicographical order of sequences compares only elements which have the same rank in the sequences, the lexicographical order extends to Cartesian products of ordered sets.

Specifically, given two partially ordered sets and the lexicographical order on the Cartesian product is defined as

The result is a partial order. If and are each totally ordered, then the result is a total order as well. The lexicographical order of two totally ordered sets is thus a linear extension of their product order.

One can define similarly the lexicographic order on the Cartesian product of an infinite family of ordered sets, if the family is indexed by the natural numbers, or more generally by a well-ordered set. This generalized lexicographical order is a total order if each factor set is totally ordered.

Unlike the finite case, an infinite product of well-orders is not necessarily well-ordered by the lexicographical order. For instance, the set of countably infinite binary sequences (by definition, the set of functions from natural numbers to also known as the Cantor space ) is not well-ordered; the subset of sequences that have precisely one (that is, { 100000..., 010000..., 001000..., ... }) does not have a least element under the lexicographical order induced by because 100000... > 010000... > 001000... > ... is an infinite descending chain.[1] Similarly, the infinite lexicographic product is not Noetherian either because 011111... < 101111... < 110111 ... < ... is an infinite ascending chain.

Functions over a well-ordered set

The functions from a well-ordered set to a totally ordered set may be identified with sequences indexed by of elements of They can thus be ordered by the lexicographical order, and for two such functions and the lexicographical order is thus determined by their values for the smallest such that

If is also well-ordered and is finite, then the resulting order is a well-order. As shown above, if is infinite this is not the case.

Finite subsets

Orderings of the 3-subsets of represented as sets of red squares, increasing sequences (in blue), or by their indicator functions, converted in decimal notation (in grey). The grey numbers are also the rank of the subsets in all subsets of numbered in colexicographical order, and starting from 0. The lexicographical (lex) and colexicographical (colex) orders are on the top and the corresponding reverse orders (rev) on the bottom
One passes from an order to its reverse order, either by reading bottom-up instead of up-bottom, or by exchanging red and white colors.

In combinatorics, one has often to enumerate, and therefore to order the finite subsets of a given set For this, one usually chooses an order on Then, sorting a subset of is equivalent to convert it into an increasing sequence. The lexicographic order on the resulting sequences induces thus an order on the subsets, which is also called the lexicographical order.

In this context, one generally prefer to sort first the subsets by cardinality, such as in the shortlex order. Therefore, in the following, we will consider only orders on subsets of fixed cardinal.

For example, using the natural order of the integers, the lexicographical ordering on the subsets of three elements of is

123 < 124 < 125 < 126 < 134 < 135 < 136 < 145 < 146 < 156 <
234 < 235 < 236 < 245 < 246 < 256 < 345 < 346 < 356 < 456.

For ordering finite subsets of a given cardinality of the natural numbers, the colexicographical order (see below) is often more convenient, because all initial segments are finite, and thus the colexicographical order defines an order isomorphism between the natural numbers and the set of sets of natural numbers. This is not the case for the lexicographical order, as, with the lexicographical order, we have, for example, for every

Group orders of Zn

Let be the free Abelian group of rank whose elements are sequences of integers, and operation is the addition. A group order on is a total order, which is compatible with addition, that is

The lexicographical ordering is a group order on

The lexicographical ordering may also be used to characterize all group orders on [4][5] In fact, linear forms with real coefficients, define a map from into which is injective if the forms are linearly independent (it may be also injective if the forms are dependent, see below). The lexicographic order on the image of this map induces a group order on Robbiano's theorem is that every group order may be obtained in this way.

More precisely, given a group order on there exist an integer and linear forms with real coefficients, such that the induced map from into has the following properties;

  • is injective;
  • the resulting isomorphism from to the image of is an order isomorphism when the image is equipped with the lexicographical order on

Colexicographic order

Orderings of the 24 permutations of {1,...,5} that are 5-cycles (in blue). The inversion vectors (in red) of permutations in colex order are in revcolex order, and vice versa.

The colexicographic or colex order is a variant of the lexicographical order that is obtained by reading finite sequences from the right to the left instead of reading them from the left to the right. More precisely, whereas the lexicographical order between two sequences is defined by

a1a2...ak <lex b1b2 ... bk if ai < bi for the first i where ai and bi differ,

the colexicographical order is defined by

a1a2...ak <colex b1b2...bk if ai < bi for the last i where ai and bi differ

In general, the difference between the colexicographical order and the lexicographical order is not very significant. However, when considering increasing sequences, typically for coding subsets, the two orders differ significantly.

For example, for ordering the increasing sequences (or the sets) of two natural integers, the lexicographical order begins by

12 < 13 < 14 < 15 < ... < 23 < 24 < 25 < ... < 34 < 35 < ... < 45 < ...,

and the colexicographic order begins by

12 < 13 < 23 < 14 < 24 < 34 < 15 < 25 < 35 < 45 < ....

The main property of the colexicographical order for increasing sequences of a given length is that every initial segment is finite. In other words, the colexicographical order for increasing sequences of a given length induces an order isomorphism with the natural numbers, and allows enumerating these sequences. This is frequently used in combinatorics, for example in the proof of the Kruskal–Katona theorem.

Monomials

When considering polynomials, the order of the terms does not matter in general, as the addition is commutative. However, some algorithms, such as polynomial long division, require the terms to be in a specific order. Many of the main algorithms for multivariate polynomials are related with Gröbner bases, concept that requires the choice of a monomial order, that is a total order, which is compatible with the monoid structure of the monomials. Here "compatible" means that if the monoid operation is denoted multiplicatively. This compatibility implies that the product of a polynomial by a monomial does not change the order of the terms. For Gröbner bases, a further condition must be satisfied, namely that every non-constant monomial is greater than the monomial 1. However this condition is not needed for other related algorithms, such as the algorithms for the computation of the tangent cone.

As Gröbner bases are defined for polynomials in a fixed number of variables, it is common to identify monomials (for example ) with their exponent vectors (here [1, 3, 0, 1, 2]). If n is the number of variables, every monomial order is thus the restriction to of a monomial order of (see above § Group orders of for a classification).

One of these admissible orders is the lexicographical order. It is, historically, the first to have been used for defining Gröbner bases, and is sometimes called pure lexicographical order for distinguishing it from other orders that are also related to a lexicographical order.

Another one consists in comparing first the total degrees, and then resolving the conflicts by using the lexicographical order. This order is not widely used, as either the lexicographical order or the degree reverse lexicographical order have generally better properties.

The degree reverse lexicographical order consists also in comparing first the total degrees, and, in case of equality of the total degrees, using the reverse of the colexicographical order. That is, given two exponent vectors, one has if either or

For this ordering, the monomials of degree one have the same order as the corresponding indeterminates (this would not be the case if the reverse lexicographical order would be used). For comparing monomials in two variables of the same total degree, this order is the same as the lexicographic order. This is not the case with more variables. For example, for exponent vectors of monomials of degree two in three variables, one has for the degree reverse lexicographic order:

For the lexicographical order, the same exponent vectors are ordered as

A useful property of the degree reverse lexicographical order is that a homogeneous polynomial is a multiple of the least indeterminate if and only if its leading monomial (its greater monomial) is a multiple of this least indeterminate.

See also

References

  1. ^ a b Egbert Harzheim (2006). Ordered Sets. Springer. pp. 88–89. ISBN 978-0-387-24222-4.
  2. ^ a b Franz Baader; Tobias Nipkow (1999). Term Rewriting and All That. Cambridge University Press. pp. 18–19. ISBN 978-0-521-77920-3.
  3. ^ Calude, Cristian (1994). Information and randomness. An algorithmic perspective. EATCS Monographs on Theoretical Computer Science. Springer-Verlag. p. 1. ISBN 3-540-57456-5. Zbl 0922.68073.
  4. ^ Robbiano, L. (1985). Term orderings on the polynomial ring. In European Conference on Computer Algebra (pp. 513-517). Springer Berlin Heidelberg.
  5. ^ Weispfenning, Volker (May 1987), "Admissible Orders and Linear Forms", SIGSAM Bulletin, 21 (2), New York, NY, USA: ACM: 16–18, doi:10.1145/24554.24557, S2CID 10226875.

Read other articles:

Agus Suwage adalah seorang perupa yang lahir pada 14 April 1959.[1] Banyak ide-ide nya dituangkan dalam karya-karya yang besar. Bahkan ketika usianya tak lagi muda, Agus Suwage merayakan 50 tahun eksistensinya melalui pameran retropektif yang menampilkan 99 karya sejak tahun 1985 hingga 2009. Seorang perupa yang dikenal dengan ide-ide aneh seperti karya terbarunya Passion of Play. Hasil karyanya berupa enam patung berpakaian putih yang merefleksikan wajah wajah para pesohor di bidang...

 

PajanganKapanewonPeta lokasi Kapanewon PajanganNegara IndonesiaProvinsiDaerah Istimewa YogyakartaKabupatenBantulPemerintahan • PanewuDrs. AbaniPopulasi • Total- jiwaKode Kemendagri34.02.07 Kode BPS3402160 Luas33,25 km²Desa/kelurahan3 Pajangan (Jawa: ꦥꦗꦁꦔꦤ꧀, translit. Pajangan) adalah sebuah kepanewon atau setingkat kecamatan di Kabupaten Bantul, Provinsi Daerah Istimewa Yogyakarta, Indonesia. Kecamatan ini menjadi lokasi dari kampus baru UIN ...

 

Jewish partisan unit during World War II Bielski PartisansFormationSpring 1942TypeUnderground organizationRegion German-occupied Poland(today Belarus)LeaderBielski brothers (Tuvia, Alexander, Asael, Aron) The Bielski partisans were a unit of Jewish partisans who rescued Jews from extermination and fought the German occupiers and their collaborators around Novogrudok and Lida in German-occupied Poland (now western Belarus). The partisan unit was named after the Bielskis, a family of Polish Jew...

1942 Maine gubernatorial election ← 1940 September 14, 1942 1944 →   Nominee Sumner Sewall George W. Lane, Jr. Party Republican Democratic Popular vote 118,047 58,558 Percentage 66.84% 33.16% County resultsSewall:      50–60%      60–70%      70–80% Governor before election Sumner Sewall Republican Elected Governor Sumner Sewall Republican The 1942 Maine gubernatorial election too...

 

Merchant ship crewman Steward's assistantA steward's assistant works closely with the chief cook and chief steward.GeneralOther namesWaiter, messman, galley utilityman, GS.DepartmentSteward's departmentReports toChief steward, Chief cookDutiesFood handler, cleaning, stocking.RequirementsMerchant Mariner's Document or equivalent.WatchstandingWatchstanderNo. A steward's assistant (SA) is an unlicensed, entry-level crewmember in the Steward's department of a merchant ship. This position can also...

 

Jarrod Bowen Bowen bermain untuk West Ham United pada 2023Informasi pribadiNama lengkap Jarrod BowenTanggal lahir 20 Desember 1996 (umur 27)Tempat lahir Leominster, InggrisTinggi 175 cm (5 ft 9 in)[1]Posisi bermain Gelandang sayap kanan, penyerangInformasi klubKlub saat ini West Ham UnitedNomor 20Karier junior Leominster Minors0000–2014 Hereford UnitedKarier senior*Tahun Tim Tampil (Gol)2014 Hereford United 8 (1)2014–2020 Hull City 124 (52)2020– West Ham Uni...

2 Tawarikh 6Kitab Tawarikh (Kitab 1 & 2 Tawarikh) lengkap pada Kodeks Leningrad, dibuat tahun 1008.KitabKitab 2 TawarikhKategoriKetuvimBagian Alkitab KristenPerjanjian LamaUrutan dalamKitab Kristen14← pasal 5 pasal 7 → 2 Tawarikh 6 (atau II Tawarikh 6, disingkat 2Taw 6) adalah bagian dari Kitab 2 Tawarikh dalam Alkitab Ibrani dan Perjanjian Lama di Alkitab Kristen. Dalam Alkitab Ibrani termasuk dalam bagian Ketuvim (כְּתוּבִים, tulisan).[1][2] Teks Na...

 

Questa voce o sezione sull'argomento calcio è priva o carente di note e riferimenti bibliografici puntuali. Sebbene vi siano una bibliografia e/o dei collegamenti esterni, manca la contestualizzazione delle fonti con note a piè di pagina o altri riferimenti precisi che indichino puntualmente la provenienza delle informazioni. Puoi migliorare questa voce citando le fonti più precisamente. Segui i suggerimenti del progetto di riferimento. Ungheria Uniformi di gara Casa Trasferta Sport ...

 

King of Aragon from 1458 to 1479 This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: John II of Aragon – news · newspapers · books · scholar · JSTOR (April 2017) (Learn how and when to remove this message) John IIJohn as a Knight of the Golden FleeceMiniature from the southern Netherlands, 1473King of Aragon (mo...

Juan Carlos Mareco and co-star Mariquita Gallegos in Otras pinochadas (1965). In this Spanish name, the first or paternal surname is Mareco and the second or maternal family name is Iturburúa. Juan Carlos Mareco Iturburúa (January 20, 1926 – October 8, 2009[1]) was a Uruguayan actor and radio and television talk show host. He achieved fame in Spain, Chile and Argentina from the 1960s onwards in comedy roles and as a television host in a variety of genres. Biog...

 

1886 Pennsylvania gubernatorial election ← 1882 November 2, 1886 (1886-11-02) 1890 →   Nominee James A. Beaver Chauncey Forward Black Party Republican Democratic Popular vote 412,285 369,634 Percentage 50.3% 45.1% County results Beaver:      40–50%      50–60%      60–70% Black:      40–50%      50–60%  ...

 

Type of altitude above mean sea level Geopotential height or geopotential altitude is a vertical coordinate referenced to Earth's mean sea level (assumed zero geopotential) that represents the work involved in lifting one unit of mass over one unit of length through a hypothetical space in which the acceleration of gravity is assumed constant.[1] In SI units, a geopotential height difference of one meter implies the vertical transport of a parcel of one kilogram; adopting the standard...

Ujung selatan Île Saint-Louis, dilihat dari Pont de la Tournelle. Île Saint-Louis merupakan satu dari pulau alami di sungai Seine, di Paris, Prancis (pulau lainnya Île de la Cité, Île des Cygnes adalah buatan). Pulau ini dinamai setelah Raja Louis IX dari Prancis (Saint Louis). Pulau ini terhubung dengan seluruh Paris oleh jembatan menuju kedua tepi sungai dan oleh Pont Saint Louis ke Île de la Cité. Pulau ini pernah digunakan untuk memberi makan ternak pasar dan pengumpulan kayu. Sala...

 

Air National GuardDistintivo dell'Air National Guard Descrizione generaleAttiva18 settembre 1947 - oggi[1] Nazione Stati Uniti TipoAeronautica militare RuoloRiserva militare Dimensione107.100 riservisti, 15.252 militari attivi (dati 2019)[1][2] Quartier generaleWashington[1] Battaglie/guerreGuerra di CoreaGuerra del VietnamOperazione Urgent FuryGuerra freddaGuerra in AfghanistanGuerra del GolfoGuerra del KosovoOperazione Enduring FreedomGuerra in Iraq Sito...

 

American politician Silas Hemenway JennisonSilas Hemenway Jenison (or Jennison), circa 183714th Governor of VermontIn officeNovember 2, 1835 – October 15, 1841LieutenantDavid M. Camp (1836 on)Preceded byWilliam A. PalmerSucceeded byCharles Paine11th Lieutenant Governor of VermontIn office1835–1836GovernorHimselfPreceded byLebbeus EgertonSucceeded byDavid M. CampMember of the Vermont House of RepresentativesIn office1829–1835 Personal detailsBornSilas Hemenway Jensen(179...

This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) This article's factual accuracy may be compromised due to out-of-date information. Please help update this article to reflect recent events or newly available information. (February 2020) This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may ...

 

Varieties of English native to the United States U.S. English redirects here. For the political organization, see U.S. English (organization). For the English language throughout North America, see North American English. For other uses, see American English (disambiguation). American EnglishRegionUnited StatesNative speakers242 million, all varieties of English in the United States (2019)67.3 million L2 speakers of English in the United States (2019)Language familyIndo-European Germanic...

 

Extinct genus of fishes This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Campbellodus – news · newspapers · books · scholar · JSTOR (May 2024) (Learn how an...

American missionary (1871–1944) William T. VernonWilliam Tecumseh VernonBorn(1871-07-11)11 July 1871[1]Lebanon, Missouri, U.S.Died25 July 1944(1944-07-25) (aged 73)[2]Kansas City, Kansas, U.S.OccupationMinisterPolitical partyRepublicanSpouseEmily J. EmbryParentRev. Adam Vernon William Tecumseh Vernon (July 11, 1871 – July 25, 1944) was an American educator, minister and bishop in the African Methodist Episcopal Church who served as president of Western University begi...

 

Жюль Вандорен Общая информация Родился 30 декабря 1908(1908-12-30)Армантьер, Франция Умер 7 января 1985(1985-01-07) (76 лет)Кале, Франция Гражданство Франция Рост 180 см Позиция защитник Клубная карьера[* 1] 1928—1939 Олимпик Лилль 180 (2) 1939—1941 Ред Стар ? (?) 1941—1943 Реймс ? (?) Национальная сборна...