File: Mathlib/Order/Fin/Basic.lean

full_name: Fin.instLinearOrder
code: instance instLinearOrder : LinearOrder (Fin n) 
goal: LinearOrder (Fin n)

full_name: Fin.instBoundedOrder
code: instance instBoundedOrder [NeZero n] : BoundedOrder (Fin n) 
goal: BoundedOrder (Fin n)

full_name: Fin.instPartialOrder
code: instance instPartialOrder : PartialOrder (Fin n) 
goal: PartialOrder (Fin n)

full_name: Fin.instLattice
code: instance instLattice      : Lattice (Fin n)      
goal: Lattice (Fin n)

full_name: Fin.top_eq_last
code: lemma top_eq_last (n : ℕ) : ⊤ = Fin.last n 
goal: ⊤ = Fin.last n

full_name: Fin.bot_eq_zero
code: lemma bot_eq_zero (n : ℕ) : ⊥ = (0 : Fin (n + 1)) 
goal: ⊥ = 0

full_name: Fin.rev_bot
code: @[simp] theorem rev_bot [NeZero n] : rev (⊥ : Fin n) = ⊤ 
goal: ⊥.rev = ⊤

full_name: Fin.rev_top
code: @[simp] theorem rev_top [NeZero n] : rev (⊤ : Fin n) = ⊥ 
goal: ⊤.rev = ⊥

full_name: Fin.rev_zero_eq_top
code: theorem rev_zero_eq_top (n : ℕ) [NeZero n] : rev (0 : Fin n) = ⊤ 
goal: Fin.rev 0 = ⊤

full_name: Fin.rev_last_eq_bot
code: theorem rev_last_eq_bot (n : ℕ) : rev (last n) = ⊥ 
goal: (Fin.last n).rev = ⊥

full_name: Fin.strictMono_pred_comp
code: lemma strictMono_pred_comp (hf : ∀ a, f a ≠ 0) (hf₂ : StrictMono f) :
    StrictMono (fun a => pred (f a) (hf a)) 
goal: StrictMono fun a => (f a).pred ⋯

full_name: Fin.monotone_pred_comp
code: lemma monotone_pred_comp (hf : ∀ a, f a ≠ 0) (hf₂ : Monotone f) :
    Monotone (fun a => pred (f a) (hf a)) 
goal: Monotone fun a => (f a).pred ⋯

full_name: Fin.strictMono_castPred_comp
code: lemma strictMono_castPred_comp (hf : ∀ a, f a ≠ last n) (hf₂ : StrictMono f) :
    StrictMono (fun a => castPred (f a) (hf a)) 
goal: StrictMono fun a => (f a).castPred ⋯

full_name: Fin.monotone_castPred_comp
code: lemma monotone_castPred_comp (hf : ∀ a, f a ≠ last n) (hf₂ : Monotone f) :
    Monotone (fun a => castPred (f a) (hf a)) 
goal: Monotone fun a => (f a).castPred ⋯

full_name: Fin.strictMono_iff_lt_succ
code: /-- A function `f` on `Fin (n + 1)` is strictly monotone if and only if `f i < f (i + 1)`
for all `i`. -/
lemma strictMono_iff_lt_succ : StrictMono f ↔ ∀ i : Fin n, f (castSucc i) < f i.succ 
goal: StrictMono f ↔ ∀ (i : Fin n), f i.castSucc < f i.succ

full_name: Fin.monotone_iff_le_succ
code: /-- A function `f` on `Fin (n + 1)` is monotone if and only if `f i ≤ f (i + 1)` for all `i`. -/
lemma monotone_iff_le_succ : Monotone f ↔ ∀ i : Fin n, f (castSucc i) ≤ f i.succ 
goal: Monotone f ↔ ∀ (i : Fin n), f i.castSucc ≤ f i.succ

full_name: Fin.strictAnti_iff_succ_lt
code: /-- A function `f` on `Fin (n + 1)` is strictly antitone if and only if `f (i + 1) < f i`
for all `i`. -/
lemma strictAnti_iff_succ_lt : StrictAnti f ↔ ∀ i : Fin n, f i.succ < f (castSucc i) 
goal: StrictAnti f ↔ ∀ (i : Fin n), f i.succ < f i.castSucc

full_name: Fin.antitone_iff_succ_le
code: /-- A function `f` on `Fin (n + 1)` is antitone if and only if `f (i + 1) ≤ f i` for all `i`. -/
lemma antitone_iff_succ_le : Antitone f ↔ ∀ i : Fin n, f i.succ ≤ f (castSucc i) 
goal: Antitone f ↔ ∀ (i : Fin n), f i.succ ≤ f i.castSucc

full_name: Fin.val_strictMono
code: lemma val_strictMono : StrictMono (val : Fin n → ℕ) 
goal: StrictMono Fin.val

full_name: Fin.strictMono_succ
code: lemma strictMono_succ : StrictMono (succ : Fin n → Fin (n + 1)) 
goal: StrictMono Fin.succ

full_name: Fin.strictMono_castLE
code: lemma strictMono_castLE (h : n ≤ m) : StrictMono (castLE h : Fin n → Fin m) 
goal: StrictMono (Fin.castLE h)

full_name: Fin.strictMono_castAdd
code: lemma strictMono_castAdd (m) : StrictMono (castAdd m : Fin n → Fin (n + m)) 
goal: StrictMono (Fin.castAdd m)

full_name: Fin.strictMono_castSucc
code: lemma strictMono_castSucc : StrictMono (castSucc : Fin n → Fin (n + 1)) 
goal: StrictMono Fin.castSucc

full_name: Fin.strictMono_natAdd
code: lemma strictMono_natAdd (n) : StrictMono (natAdd n : Fin m → Fin (n + m)) 
goal: StrictMono (Fin.natAdd n)

full_name: Fin.strictMono_addNat
code: lemma strictMono_addNat (m) : StrictMono ((addNat · m) : Fin n → Fin (n + m)) 
goal: StrictMono fun x => x.addNat m

full_name: Fin.strictMono_succAbove
code: lemma strictMono_succAbove (p : Fin (n + 1)) : StrictMono (succAbove p) 
goal: StrictMono p.succAbove

full_name: Fin.succAbove_lt_succAbove_iff
code: lemma succAbove_lt_succAbove_iff : succAbove p i < succAbove p j ↔ i < j 
goal: p.succAbove i < p.succAbove j ↔ i < j

full_name: Fin.succAbove_le_succAbove_iff
code: lemma succAbove_le_succAbove_iff : succAbove p i ≤ succAbove p j ↔ i ≤ j 
goal: p.succAbove i ≤ p.succAbove j ↔ i ≤ j

full_name: Fin.predAbove_right_monotone
code: lemma predAbove_right_monotone (p : Fin n) : Monotone p.predAbove 
goal: Monotone p.predAbove

full_name: Fin.predAbove_left_monotone
code: lemma predAbove_left_monotone (i : Fin (n + 1)) : Monotone fun p ↦ predAbove p i 
goal: Monotone fun p => p.predAbove i

full_name: Fin.predAboveOrderHom
code: /--  `Fin.predAbove p` as an `OrderHom`. -/
@[simps!] def predAboveOrderHom (p : Fin n) : Fin (n + 1) →o Fin n 
goal: Fin (n + 1) →o Fin n

full_name: Fin.predAboveOrderHom_coe
code: /--  `Fin.predAbove p` as an `OrderHom`. -/
@[simps!] def predAboveOrderHom (p : Fin n) : Fin (n + 1) →o Fin n 
goal: p.predAboveOrderHom i = p.predAbove i

full_name: Fin.orderIsoSubtype_apply
code: /-- The equivalence `Fin n ≃ {i // i < n}` is an order isomorphism. -/
@[simps! apply symm_apply]
def orderIsoSubtype : Fin n ≃o {i // i < n} 
goal: Fin.orderIsoSubtype a = ⟨↑a, ⋯⟩

full_name: Fin.orderIsoSubtype
code: /-- The equivalence `Fin n ≃ {i // i < n}` is an order isomorphism. -/
@[simps! apply symm_apply]
def orderIsoSubtype : Fin n ≃o {i // i < n} 
goal: Fin n ≃o { i // i < n }

full_name: Fin.orderIsoSubtype_symm_apply
code: /-- The equivalence `Fin n ≃ {i // i < n}` is an order isomorphism. -/
@[simps! apply symm_apply]
def orderIsoSubtype : Fin n ≃o {i // i < n} 
goal: (RelIso.symm Fin.orderIsoSubtype) a = ⟨↑a, ⋯⟩

full_name: Fin.castOrderIso_symm_apply
code: /-- `Fin.cast` as an `OrderIso`.

`castOrderIso eq i` embeds `i` into an equal `Fin` type. -/
@[simps]
def castOrderIso (eq : n = m) : Fin n ≃o Fin m 
goal: (RelIso.symm (Fin.castOrderIso eq)) i = Fin.cast ⋯ i

full_name: Fin.castOrderIso
code: /-- `Fin.cast` as an `OrderIso`.

`castOrderIso eq i` embeds `i` into an equal `Fin` type. -/
@[simps]
def castOrderIso (eq : n = m) : Fin n ≃o Fin m 
goal: Fin n ≃o Fin m

full_name: Fin.castOrderIso_apply
code: /-- `Fin.cast` as an `OrderIso`.

`castOrderIso eq i` embeds `i` into an equal `Fin` type. -/
@[simps]
def castOrderIso (eq : n = m) : Fin n ≃o Fin m 
goal: (Fin.castOrderIso eq) i = Fin.cast eq i

full_name: Fin.symm_castOrderIso
code: @[simp]
lemma symm_castOrderIso (h : n = m) : (castOrderIso h).symm = castOrderIso h.symm 
goal: (Fin.castOrderIso h).symm = Fin.castOrderIso ⋯

full_name: Fin.castOrderIso_refl
code: @[simp]
lemma castOrderIso_refl (h : n = n := rfl) : castOrderIso h = OrderIso.refl (Fin n) 
goal: Fin.castOrderIso h = OrderIso.refl (Fin n)

full_name: Fin.castOrderIso_toEquiv
code: /-- While in many cases `Fin.castOrderIso` is better than `Equiv.cast`/`cast`, sometimes we want to
apply a generic lemma about `cast`. -/
lemma castOrderIso_toEquiv (h : n = m) : (castOrderIso h).toEquiv = Equiv.cast (h ▸ rfl) 
goal: (Fin.castOrderIso h).toEquiv = Equiv.cast ⋯

full_name: Fin.revOrderIso_apply
code: /-- `Fin.rev n` as an order-reversing isomorphism. -/
@[simps! apply toEquiv]
def revOrderIso : (Fin n)ᵒᵈ ≃o Fin n 
goal: ∀ (a : (Fin n)ᵒᵈ), Fin.revOrderIso a = (OrderDual.ofDual a).rev

full_name: Fin.revOrderIso
code: /-- `Fin.rev n` as an order-reversing isomorphism. -/
@[simps! apply toEquiv]
def revOrderIso : (Fin n)ᵒᵈ ≃o Fin n 
goal: (Fin n)ᵒᵈ ≃o Fin n

full_name: Fin.revOrderIso_toEquiv
code: /-- `Fin.rev n` as an order-reversing isomorphism. -/
@[simps! apply toEquiv]
def revOrderIso : (Fin n)ᵒᵈ ≃o Fin n 
goal: Fin.revOrderIso.toEquiv = OrderDual.ofDual.trans Fin.revPerm

full_name: Fin.revOrderIso_symm_apply
code: @[simp]
lemma revOrderIso_symm_apply (i : Fin n) : revOrderIso.symm i = OrderDual.toDual (rev i) 
goal: Fin.revOrderIso.symm i = OrderDual.toDual i.rev

full_name: Fin.valOrderEmb_apply
code: /-- The inclusion map `Fin n → ℕ` is an order embedding. -/
@[simps! apply]
def valOrderEmb (n) : Fin n ↪o ℕ 
goal: (Fin.valOrderEmb n) self = ↑self

full_name: Fin.valOrderEmb
code: /-- The inclusion map `Fin n → ℕ` is an order embedding. -/
@[simps! apply]
def valOrderEmb (n) : Fin n ↪o ℕ 
goal: Fin n ↪o ℕ

full_name: Fin.Lt.isWellOrder
code: /-- The ordering on `Fin n` is a well order. -/
instance Lt.isWellOrder (n) : IsWellOrder (Fin n) (· < ·) 
goal: IsWellOrder (Fin n) fun x x_1 => x < x_1

full_name: Fin.succOrderEmb
code: /-- `Fin.succ` as an `OrderEmbedding` -/
def succOrderEmb (n : ℕ) : Fin n ↪o Fin (n + 1) 
goal: Fin n ↪o Fin (n + 1)

full_name: Fin.coe_succOrderEmb
code: @[simp, norm_cast] lemma coe_succOrderEmb : ⇑(succOrderEmb n) = Fin.succ 
goal: ⇑(Fin.succOrderEmb n) = Fin.succ

full_name: Fin.castLEOrderEmb_apply
code: /-- `Fin.castLE` as an `OrderEmbedding`.

`castLEEmb h i` embeds `i` into a larger `Fin` type. -/
@[simps! apply toEmbedding]
def castLEOrderEmb (h : n ≤ m) : Fin n ↪o Fin m 
goal: (Fin.castLEOrderEmb h) i = Fin.castLE h i

full_name: Fin.castLEOrderEmb_toEmbedding
code: /-- `Fin.castLE` as an `OrderEmbedding`.

`castLEEmb h i` embeds `i` into a larger `Fin` type. -/
@[simps! apply toEmbedding]
def castLEOrderEmb (h : n ≤ m) : Fin n ↪o Fin m 
goal: (Fin.castLEOrderEmb h).toEmbedding = { toFun := Fin.castLE h, inj' := ⋯ }

full_name: Fin.castLEOrderEmb
code: /-- `Fin.castLE` as an `OrderEmbedding`.

`castLEEmb h i` embeds `i` into a larger `Fin` type. -/
@[simps! apply toEmbedding]
def castLEOrderEmb (h : n ≤ m) : Fin n ↪o Fin m 
goal: Fin n ↪o Fin m

full_name: Fin.castAddOrderEmb_toEmbedding
code: /-- `Fin.castAdd` as an `OrderEmbedding`.

`castAddEmb m i` embeds `i : Fin n` in `Fin (n+m)`. See also `Fin.natAddEmb` and `Fin.addNatEmb`. -/
@[simps! apply toEmbedding]
def castAddOrderEmb (m) : Fin n ↪o Fin (n + m) 
goal: (Fin.castAddOrderEmb m).toEmbedding = { toFun := Fin.castAdd m, inj' := ⋯ }

full_name: Fin.castAddOrderEmb
code: /-- `Fin.castAdd` as an `OrderEmbedding`.

`castAddEmb m i` embeds `i : Fin n` in `Fin (n+m)`. See also `Fin.natAddEmb` and `Fin.addNatEmb`. -/
@[simps! apply toEmbedding]
def castAddOrderEmb (m) : Fin n ↪o Fin (n + m) 
goal: Fin n ↪o Fin (n + m)

full_name: Fin.castAddOrderEmb_apply
code: /-- `Fin.castAdd` as an `OrderEmbedding`.

`castAddEmb m i` embeds `i : Fin n` in `Fin (n+m)`. See also `Fin.natAddEmb` and `Fin.addNatEmb`. -/
@[simps! apply toEmbedding]
def castAddOrderEmb (m) : Fin n ↪o Fin (n + m) 
goal: ∀ (a : Fin n), (Fin.castAddOrderEmb m) a = Fin.castAdd m a

full_name: Fin.castSuccOrderEmb_toEmbedding
code: /-- `Fin.castSucc` as an `OrderEmbedding`.

`castSuccOrderEmb i` embeds `i : Fin n` in `Fin (n+1)`. -/
@[simps! apply toEmbedding]
def castSuccOrderEmb : Fin n ↪o Fin (n + 1) 
goal: Fin.castSuccOrderEmb.toEmbedding = { toFun := Fin.castSucc, inj' := ⋯ }

full_name: Fin.castSuccOrderEmb_apply
code: /-- `Fin.castSucc` as an `OrderEmbedding`.

`castSuccOrderEmb i` embeds `i : Fin n` in `Fin (n+1)`. -/
@[simps! apply toEmbedding]
def castSuccOrderEmb : Fin n ↪o Fin (n + 1) 
goal: ∀ (a : Fin n), Fin.castSuccOrderEmb a = a.castSucc

full_name: Fin.castSuccOrderEmb
code: /-- `Fin.castSucc` as an `OrderEmbedding`.

`castSuccOrderEmb i` embeds `i : Fin n` in `Fin (n+1)`. -/
@[simps! apply toEmbedding]
def castSuccOrderEmb : Fin n ↪o Fin (n + 1) 
goal: Fin n ↪o Fin (n + 1)

full_name: Fin.addNatOrderEmb_toEmbedding
code: /-- `Fin.addNat` as an `OrderEmbedding`.

`addNatOrderEmb m i` adds `m` to `i`, generalizes `Fin.succ`. -/
@[simps! apply toEmbedding]
def addNatOrderEmb (m) : Fin n ↪o Fin (n + m) 
goal: (Fin.addNatOrderEmb m).toEmbedding = { toFun := fun x => x.addNat m, inj' := ⋯ }

full_name: Fin.addNatOrderEmb_apply
code: /-- `Fin.addNat` as an `OrderEmbedding`.

`addNatOrderEmb m i` adds `m` to `i`, generalizes `Fin.succ`. -/
@[simps! apply toEmbedding]
def addNatOrderEmb (m) : Fin n ↪o Fin (n + m) 
goal: ∀ (x : Fin n), (Fin.addNatOrderEmb m) x = x.addNat m

full_name: Fin.addNatOrderEmb
code: /-- `Fin.addNat` as an `OrderEmbedding`.

`addNatOrderEmb m i` adds `m` to `i`, generalizes `Fin.succ`. -/
@[simps! apply toEmbedding]
def addNatOrderEmb (m) : Fin n ↪o Fin (n + m) 
goal: Fin n ↪o Fin (n + m)

full_name: Fin.natAddOrderEmb
code: /-- `Fin.natAdd` as an `OrderEmbedding`.

`natAddOrderEmb n i` adds `n` to `i` "on the left". -/
@[simps! apply toEmbedding]
def natAddOrderEmb (n) : Fin m ↪o Fin (n + m) 
goal: Fin m ↪o Fin (n + m)

full_name: Fin.natAddOrderEmb_apply
code: /-- `Fin.natAdd` as an `OrderEmbedding`.

`natAddOrderEmb n i` adds `n` to `i` "on the left". -/
@[simps! apply toEmbedding]
def natAddOrderEmb (n) : Fin m ↪o Fin (n + m) 
goal: (Fin.natAddOrderEmb n) i = Fin.natAdd n i

full_name: Fin.natAddOrderEmb_toEmbedding
code: /-- `Fin.natAdd` as an `OrderEmbedding`.

`natAddOrderEmb n i` adds `n` to `i` "on the left". -/
@[simps! apply toEmbedding]
def natAddOrderEmb (n) : Fin m ↪o Fin (n + m) 
goal: (Fin.natAddOrderEmb n).toEmbedding = { toFun := Fin.natAdd n, inj' := ⋯ }

full_name: Fin.succAboveOrderEmb
code: /--  `Fin.succAbove p` as an `OrderEmbedding`. -/
@[simps! apply toEmbedding]
def succAboveOrderEmb (p : Fin (n + 1)) : Fin n ↪o Fin (n + 1) 
goal: Fin n ↪o Fin (n + 1)

full_name: Fin.succAboveOrderEmb_toEmbedding
code: /--  `Fin.succAbove p` as an `OrderEmbedding`. -/
@[simps! apply toEmbedding]
def succAboveOrderEmb (p : Fin (n + 1)) : Fin n ↪o Fin (n + 1) 
goal: p.succAboveOrderEmb.toEmbedding = { toFun := p.succAbove, inj' := ⋯ }

full_name: Fin.succAboveOrderEmb_apply
code: /--  `Fin.succAbove p` as an `OrderEmbedding`. -/
@[simps! apply toEmbedding]
def succAboveOrderEmb (p : Fin (n + 1)) : Fin n ↪o Fin (n + 1) 
goal: p.succAboveOrderEmb i = p.succAbove i

full_name: Fin.coe_orderIso_apply
code: /-- If `e` is an `orderIso` between `Fin n` and `Fin m`, then `n = m` and `e` is the identity
map. In this lemma we state that for each `i : Fin n` we have `(e i : ℕ) = (i : ℕ)`. -/
@[simp] lemma coe_orderIso_apply (e : Fin n ≃o Fin m) (i : Fin n) : (e i : ℕ) = i 
goal: ↑(e i) = ↑i

full_name: Fin.orderIso_subsingleton
code: instance orderIso_subsingleton : Subsingleton (Fin n ≃o α) 
goal: Subsingleton (Fin n ≃o α)

full_name: Fin.orderIso_subsingleton'
code: instance orderIso_subsingleton' : Subsingleton (α ≃o Fin n) 
goal: Subsingleton (α ≃o Fin n)

full_name: Fin.orderIsoUnique
code: instance orderIsoUnique : Unique (Fin n ≃o Fin n) 
goal: Unique (Fin n ≃o Fin n)

full_name: Fin.strictMono_unique
code: /-- Two strictly monotone functions from `Fin n` are equal provided that their ranges
are equal. -/
lemma strictMono_unique {f g : Fin n → α} (hf : StrictMono f) (hg : StrictMono g)
    (h : range f = range g) : f = g 
goal: f = g

full_name: Fin.orderEmbedding_eq
code: /-- Two order embeddings of `Fin n` are equal provided that their ranges are equal. -/
lemma orderEmbedding_eq {f g : Fin n ↪o α} (h : range f = range g) : f = g 
goal: f = g