Shortlex ordering of lists. #
Given a relation r
on α
, the shortlex order on List α
is defined by L < M
iff
L.length < M.length
L.length = M.length
andL < M
under the lexicographic ordering overr
on lists
Main results #
We show that if r
is well-founded, so too is the shortlex order over r
See also #
Related files are:
Mathlib/Data/List/Lex.lean
: Lexicographic order onList α
.Mathlib/Data/DFinsupp/WellFounded.lean
: Well-foundedness of lexicographic orders onDFinsupp
andPi
.
shortlex ordering #
Given a relation r
on α
, the shortlex order on List α
, for which
[a0, ..., an] < [b0, ..., b_k]
if n < k
or n = k
and [a0, ..., an] < [b0, ..., bk]
under the lexicographic order induced by r
.
Equations
Instances For
theorem
List.Shortlex.of_lex
{α : Type u_1}
{r : α → α → Prop}
{s t : List α}
(len_eq : s.length = t.length)
(h_lex : Lex r s t)
:
Shortlex r s t
If two lists s
and t
have the same length, s
is smaller than t
under the shortlex order
over a relation r
when s
is smaller than t
under the lexicographic order over r
instance
List.Shortlex.isTrichotomous
{α : Type u_1}
{r : α → α → Prop}
[IsTrichotomous α r]
:
IsTrichotomous (List α) (Shortlex r)
theorem
List.Shortlex.wf
{α : Type u_1}
{r : α → α → Prop}
(h : WellFounded r)
:
WellFounded (Shortlex r)