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.succas anOrderEmbedding;Fin.castLEOrderEmb h:Fin.castLEas anOrderEmbedding, embedFin nintoFin mwhenh : n ≤ m;Fin.castOrderIso:Fin.castas anOrderIso, order isomorphism betweenFin nandFin mprovided thatn = m, see alsoEquiv.finCongr;Fin.castAddOrderEmb m:Fin.castAddas anOrderEmbedding, embedFin nintoFin (n+m);Fin.castSuccOrderEmb:Fin.castSuccas anOrderEmbedding, embedFin nintoFin (n+1);Fin.addNatOrderEmb m i:Fin.addNatas anOrderEmbedding, addmonion the right, generalizesFin.succ;Fin.natAddOrderEmb n i:Fin.natAddas anOrderEmbedding, addsnonion the left;Fin.revOrderIso:Fin.revas anOrderIso, the antitone involution given byi ↦ n-(i+1)
Instances #
Alias of Fin.coe_max.
Alias of Fin.coe_min.
Equations
- Fin.instLinearOrder = Function.Injective.linearOrder Fin.val ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- Fin.instBoundedOrder = { top := Fin.rev 0, le_top := ⋯, bot := 0, bot_le := ⋯ }
Equations
Extra instances to short-circuit type class resolution #
These also prevent non-computable instances being used to construct these instances non-computably.
Equations
Equations
Equations
Miscellaneous lemmas #
Monotonicity #
Alias of the reverse direction of Fin.natAdd_le_natAdd_iff.
Alias of the reverse direction of Fin.natAdd_lt_natAdd_iff.
Alias of the reverse direction of Fin.addNat_le_addNat_iff.
Alias of the reverse direction of Fin.addNat_lt_addNat_iff.
Alias of the reverse direction of Fin.castLE_le_castLE_iff.
Alias of the reverse direction of Fin.castLE_lt_castLE_iff.
Fin.predAbove p as an OrderHom.
Equations
- p.predAboveOrderHom = { toFun := p.predAbove, monotone' := ⋯ }
Instances For
predAbove is injective at the pivot
Order isomorphisms #
While in many cases Fin.castOrderIso is better than Equiv.cast/cast, sometimes we want to
apply a generic lemma about cast.
Fin.rev n as an order-reversing isomorphism.
Equations
- Fin.revOrderIso = { toEquiv := OrderDual.ofDual.trans Fin.revPerm, map_rel_iff' := ⋯ }
Instances For
Order embeddings #
The inclusion map Fin n → ℕ is an order embedding.
Equations
- Fin.valOrderEmb n = { toEmbedding := Fin.valEmbedding, map_rel_iff' := ⋯ }
Instances For
Equations
- Fin.OrderEmbedding.instInhabitedOrderEmbeddingNat = { default := Fin.valOrderEmb n }
The ordering on Fin n is a well order.
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.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) ⋯