Fin n
forms a bounded linear order #
This file contains the linear ordered instance on Fin n
.
Fin n
is the type whose elements are natural numbers smaller than n
.
This file expands on the development in the core library.
Main definitions #
Fin.orderIsoSubtype
: coercion to{i // i < n}
as anOrderIso
;Fin.valEmbedding
: coercion to natural numbers as anEmbedding
;Fin.valOrderEmb
: coercion to natural numbers as anOrderEmbedding
;Fin.succOrderEmb
:Fin.succ
as anOrderEmbedding
;Fin.castLEOrderEmb h
:Fin.castLE
as anOrderEmbedding
, embedFin n
intoFin m
whenh : n ≤ m
;Fin.castOrderIso
:Fin.cast
as anOrderIso
, order isomorphism betweenFin n
andFin m
provided thatn = m
, see alsoEquiv.finCongr
;Fin.castAddOrderEmb m
:Fin.castAdd
as anOrderEmbedding
, embedFin n
intoFin (n+m)
;Fin.castSuccOrderEmb
:Fin.castSucc
as anOrderEmbedding
, embedFin n
intoFin (n+1)
;Fin.addNatOrderEmb m i
:Fin.addNat
as anOrderEmbedding
, addm
oni
on the right, generalizesFin.succ
;Fin.natAddOrderEmb n i
:Fin.natAdd
as anOrderEmbedding
, addsn
oni
on the left;Fin.revOrderIso
:Fin.rev
as anOrderIso
, the antitone involution given byi ↦ n-(i+1)
Instances #
Equations
- Fin.instLinearOrder = LinearOrder.liftWithOrd Fin.val ⋯ ⋯ ⋯ ⋯
Equations
- Fin.instBoundedOrder = BoundedOrder.mk
Extra instances to short-circuit type class resolution #
These also prevent non-computable instances being used to construct these instances non-computably.
Equations
- Fin.instPartialOrder = inferInstance
Miscellaneous lemmas #
Monotonicity #
Order isomorphisms #
castOrderIso eq i
embeds i
into an equal Fin
type.
Equations
- Fin.castOrderIso eq = { toFun := Fin.cast eq, invFun := Fin.cast ⋯, left_inv := ⋯, right_inv := ⋯, map_rel_iff' := ⋯ }
Instances For
Alias of Fin.castOrderIso
.
castOrderIso eq i
embeds i
into an equal Fin
type.
Equations
Instances For
Alias of Fin.symm_castOrderIso
.
Alias of Fin.castOrderIso_refl
.
While in many cases Fin.castOrderIso
is better than Equiv.cast
/cast
, sometimes we want to
apply a generic lemma about cast
.
Alias of Fin.castOrderIso_toEquiv
.
While in many cases Fin.castOrderIso
is better than Equiv.cast
/cast
, sometimes we want to
apply a generic lemma about cast
.
Order embeddings #
The inclusion map Fin n → ℕ
is an order embedding.
Equations
- Fin.valOrderEmb n = { toEmbedding := Fin.valEmbedding, map_rel_iff' := ⋯ }
Instances For
Fin.succ
as an OrderEmbedding
Equations
- Fin.succOrderEmb n = OrderEmbedding.ofStrictMono Fin.succ ⋯
Instances For
Fin.castLE
as an OrderEmbedding
.
castLEEmb h i
embeds i
into a larger Fin
type.
Equations
Instances For
Fin.castAdd
as an OrderEmbedding
.
castAddEmb m i
embeds i : Fin n
in Fin (n+m)
. See also Fin.natAddEmb
and Fin.addNatEmb
.
Equations
Instances For
Fin.castSucc
as an OrderEmbedding
.
castSuccOrderEmb i
embeds i : Fin n
in Fin (n+1)
.
Equations
- Fin.castSuccOrderEmb = OrderEmbedding.ofStrictMono Fin.castSucc ⋯
Instances For
Fin.addNat
as an OrderEmbedding
.
addNatOrderEmb m i
adds m
to i
, generalizes Fin.succ
.
Equations
- Fin.addNatOrderEmb m = OrderEmbedding.ofStrictMono (fun (x : Fin n) => x.addNat m) ⋯
Instances For
Fin.succAbove p
as an OrderEmbedding
.
Equations
- p.succAboveOrderEmb = OrderEmbedding.ofStrictMono p.succAbove ⋯
Instances For
Uniqueness of order isomorphisms #
Two strictly monotone functions from Fin n
are equal provided that their ranges
are equal.