 
                
                
                
               
LEXICO   lexicographic_ordering_constraint-1 <…lexicographic_ordering_constraint-n>   ; 
            
LEXORDER   lexicographic_ordering_constraint-1 <…lexicographic_ordering_constraint-n>   ; 
            
where lexicographic_ordering_constraint is specified in the following form:
((variable-list-1) order_type (variable-list-2))
where variable-list-1 and variable-list-2 are variable lists of equal length. The keyword order_type signifies the type of ordering and can be one of two values: LEX_LE, which indicates lexicographically less than or equal
            to ( ), or LEX_LT, which indicates lexicographically less than (
), or LEX_LT, which indicates lexicographically less than ( ).
). 
         
The LEXICO statement specifies one or more lexicographic constraints. The lexicographic constraint  and the strict lexicographic constraint
 and the strict lexicographic constraint  are defined as follows. Given two
 are defined as follows. Given two  -tuples
-tuples  and
 and  , the
, the  -tuple
-tuple  is lexicographically less than or equal to
 is lexicographically less than or equal to  (
 ( ) if and only if
) if and only if 
         
| ![\[  \bigl (x_ i = y_ i \:  \forall i = 1, \dots , n\bigr ) \vee \left(\exists j \mbox{ with } 1 \leq j \leq n \mbox{ s.t. } x_ i = y_ i \: \forall i = 1, \dots , j\! -\! 1 \mbox{ and } x_ j < y_ j\right)  \]](images/orcpug_clp0073.png) | 
 The  -tuple
-tuple  is lexicographically less than
 is lexicographically less than  (
 ( ) if and only if
) if and only if  and
 and  . Equivalently,
. Equivalently,  if and only if
 if and only if 
         
| ![\[  \exists j \mbox{ with } 1 \leq j \leq n \mbox{ s.t. } x_ i = y_ i \: \forall i = 1, \dots , j\! -\! 1 \mbox{ and } x_ j < y_ j  \]](images/orcpug_clp0076.png) | 
Informally you can think of the lexicographic constraint  as sorting the
 as sorting the  -tuples in alphabetical order. Mathematically,
-tuples in alphabetical order. Mathematically,  is a partial order on a given subset of
 is a partial order on a given subset of  -tuples, and
-tuples, and  is a strict partial order on a given subset of
 is a strict partial order on a given subset of  -tuples (Brualdi, 2010).
-tuples (Brualdi, 2010). 
         
For example, you can express the lexicographic constraint  by using a LEXICO statement as follows:
 by using a LEXICO statement as follows: 
         
lexico( (x1-x6) lex_le (y1-y6) );
The assignment  ,
,  ,
,  ,
,  ,
,  ,
,  ,
,  ,
,  ,
,  ,
,  ,
,  , and
, and  satisfies this constraint because
 satisfies this constraint because  for
 for  and
 and  . The fact that
. The fact that  is irrelevant in this ordering.
 is irrelevant in this ordering. 
         
Lexicographic ordering constraints can be useful for breaking a certain kind of symmetry that arises in CSPs with matrices
            of decision variables. Frisch et al. (2002) introduce an optimal algorithm to establish GAC (generalized arc consistency) for the  constraint between two vectors of variables.
 constraint between two vectors of variables.