order.category.NonemptyFinLinOrdMathlib.Order.Category.NonemptyFinLinOrd

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

feat(order/category): Forgetful functor NonemptyFinLinOrd ⥤ FinPartOrd (#18948)

Also fix a wrong docstring

Diff
@@ -5,6 +5,7 @@ Authors: Johan Commelin
 -/
 import data.fintype.order
 import data.set.finite
+import order.category.FinPartOrd
 import order.category.LinOrd
 import category_theory.limits.shapes.images
 import category_theory.limits.shapes.regular_mono
@@ -17,6 +18,9 @@ import category_theory.limits.shapes.regular_mono
 
 This defines `NonemptyFinLinOrd`, the category of nonempty finite linear orders with monotone maps.
 This is the index category for simplicial objects.
+
+Note: `NonemptyFinLinOrd` is *not* a subcategory of `FinBddDistLat` because its morphisms do not
+preserve `⊥` and `⊤`.
 -/
 
 universes u v
@@ -68,6 +72,9 @@ instance (α : NonemptyFinLinOrd) : nonempty_fin_lin_ord α := α.str
 instance has_forget_to_LinOrd : has_forget₂ NonemptyFinLinOrd LinOrd :=
 bundled_hom.forget₂ _ _
 
+instance has_forget_to_FinPartOrd : has_forget₂ NonemptyFinLinOrd FinPartOrd :=
+{ forget₂ := { obj := λ X, FinPartOrd.of X, map := λ X Y, id } }
+
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
 @[simps] def iso.mk {α β : NonemptyFinLinOrd.{u}} (e : α ≃o β) : α ≅ β :=
@@ -80,7 +87,7 @@ between them. -/
 @[simps] def dual : NonemptyFinLinOrd ⥤ NonemptyFinLinOrd :=
 { obj := λ X, of Xᵒᵈ, map := λ X Y, order_hom.dual }
 
-/-- The equivalence between `FinPartOrd` and itself induced by `order_dual` both ways. -/
+/-- The equivalence between `NonemptyFinLinOrd` and itself induced by `order_dual` both ways. -/
 @[simps functor inverse] def dual_equiv : NonemptyFinLinOrd ≌ NonemptyFinLinOrd :=
 equivalence.mk dual dual
   (nat_iso.of_components (λ X, iso.mk $ order_iso.dual_dual X) $ λ X Y f, rfl)
@@ -182,3 +189,9 @@ end NonemptyFinLinOrd
 lemma NonemptyFinLinOrd_dual_comp_forget_to_LinOrd :
   NonemptyFinLinOrd.dual ⋙ forget₂ NonemptyFinLinOrd LinOrd =
     forget₂ NonemptyFinLinOrd LinOrd ⋙ LinOrd.dual := rfl
+
+/-- The forgetful functor `NonemptyFinLinOrd ⥤ FinPartOrd` and `order_dual` commute. -/
+def NonemptyFinLinOrd_dual_comp_forget_to_FinPartOrd :
+  NonemptyFinLinOrd.dual ⋙ forget₂ NonemptyFinLinOrd FinPartOrd ≅
+    forget₂ NonemptyFinLinOrd FinPartOrd ⋙ FinPartOrd.dual :=
+{ hom := { app := λ X, order_hom.id }, inv := { app := λ X, order_hom.id } }

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -162,7 +162,7 @@ theorem mono_iff_injective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
   let g₂ : X ⟶ A := ⟨fun x => a₂, fun x₁ x₂ h => by rfl⟩
   change g₁ (ULift.up (0 : Fin 1)) = g₂ (ULift.up (0 : Fin 1))
   have eq : g₁ ≫ f = g₂ ≫ f := by ext x; exact h
-  rw [cancel_mono] at eq 
+  rw [cancel_mono] at eq
   rw [Eq]
 #align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrd.mono_iff_injective
 -/
@@ -214,7 +214,7 @@ instance : SplitEpiCategory NonemptyFinLinOrd.{u} :=
     by
     have H : ∀ y : Y, Nonempty (f ⁻¹' {y}) :=
       by
-      rw [epi_iff_surjective] at hf 
+      rw [epi_iff_surjective] at hf
       intro y
       exact Nonempty.intro ⟨(hf y).some, (hf y).choose_spec⟩
     let φ : Y → X := fun y => (H y).some.1
Diff
@@ -172,7 +172,7 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
     Epi f ↔ Function.Surjective f := by
   constructor
   · intro
-    by_contra' hf'
+    by_contra! hf'
     rcases hf' with ⟨m, hm⟩
     let Y : NonemptyFinLinOrd.{u} := ⟨ULift (Fin 2)⟩
     let p₁ : B ⟶ Y :=
Diff
@@ -3,12 +3,12 @@ Copyright (c) 2020 Johan Commelin. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johan Commelin
 -/
-import Mathbin.Data.Fintype.Order
-import Mathbin.Data.Set.Finite
-import Mathbin.Order.Category.FinPartOrd
-import Mathbin.Order.Category.LinOrd
-import Mathbin.CategoryTheory.Limits.Shapes.Images
-import Mathbin.CategoryTheory.Limits.Shapes.RegularMono
+import Data.Fintype.Order
+import Data.Set.Finite
+import Order.Category.FinPartOrd
+import Order.Category.LinOrd
+import CategoryTheory.Limits.Shapes.Images
+import CategoryTheory.Limits.Shapes.RegularMono
 
 #align_import order.category.NonemptyFinLinOrd from "leanprover-community/mathlib"@"fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19"
 
@@ -30,151 +30,151 @@ universe u v
 
 open CategoryTheory CategoryTheory.Limits
 
-#print NonemptyFinLinOrd /-
+#print NonemptyFiniteLinearOrder /-
 /-- A typeclass for nonempty finite linear orders. -/
-class NonemptyFinLinOrd (α : Type _) extends Fintype α, LinearOrder α where
+class NonemptyFiniteLinearOrder (α : Type _) extends Fintype α, LinearOrder α where
   Nonempty : Nonempty α := by infer_instance
-#align nonempty_fin_lin_ord NonemptyFinLinOrd
+#align nonempty_fin_lin_ord NonemptyFiniteLinearOrder
 -/
 
-attribute [instance] NonemptyFinLinOrd.nonempty
+attribute [instance] NonemptyFiniteLinearOrder.nonempty
 
-#print NonemptyFinLinOrd.toBoundedOrder /-
-instance (priority := 100) NonemptyFinLinOrd.toBoundedOrder (α : Type _) [NonemptyFinLinOrd α] :
-    BoundedOrder α :=
+#print NonemptyFiniteLinearOrder.toBoundedOrder /-
+instance (priority := 100) NonemptyFiniteLinearOrder.toBoundedOrder (α : Type _)
+    [NonemptyFiniteLinearOrder α] : BoundedOrder α :=
   Fintype.toBoundedOrder α
-#align nonempty_fin_lin_ord.to_bounded_order NonemptyFinLinOrd.toBoundedOrder
+#align nonempty_fin_lin_ord.to_bounded_order NonemptyFiniteLinearOrder.toBoundedOrder
 -/
 
-#print PUnit.nonemptyFinLinOrd /-
-instance PUnit.nonemptyFinLinOrd : NonemptyFinLinOrd PUnit where
-#align punit.nonempty_fin_lin_ord PUnit.nonemptyFinLinOrd
+#print PUnit.nonemptyFiniteLinearOrder /-
+instance PUnit.nonemptyFiniteLinearOrder : NonemptyFiniteLinearOrder PUnit where
+#align punit.nonempty_fin_lin_ord PUnit.nonemptyFiniteLinearOrder
 -/
 
-#print Fin.nonemptyFinLinOrd /-
-instance Fin.nonemptyFinLinOrd (n : ℕ) : NonemptyFinLinOrd (Fin (n + 1)) where
-#align fin.nonempty_fin_lin_ord Fin.nonemptyFinLinOrd
+#print Fin.nonemptyFiniteLinearOrder /-
+instance Fin.nonemptyFiniteLinearOrder (n : ℕ) : NonemptyFiniteLinearOrder (Fin (n + 1)) where
+#align fin.nonempty_fin_lin_ord Fin.nonemptyFiniteLinearOrder
 -/
 
-#print ULift.nonemptyFinLinOrd /-
-instance ULift.nonemptyFinLinOrd (α : Type u) [NonemptyFinLinOrd α] :
-    NonemptyFinLinOrd (ULift.{v} α) :=
+#print ULift.nonemptyFiniteLinearOrder /-
+instance ULift.nonemptyFiniteLinearOrder (α : Type u) [NonemptyFiniteLinearOrder α] :
+    NonemptyFiniteLinearOrder (ULift.{v} α) :=
   { LinearOrder.lift' Equiv.ulift (Equiv.injective _) with }
-#align ulift.nonempty_fin_lin_ord ULift.nonemptyFinLinOrd
+#align ulift.nonempty_fin_lin_ord ULift.nonemptyFiniteLinearOrder
 -/
 
-instance (α : Type _) [NonemptyFinLinOrd α] : NonemptyFinLinOrd αᵒᵈ :=
+instance (α : Type _) [NonemptyFiniteLinearOrder α] : NonemptyFiniteLinearOrder αᵒᵈ :=
   { OrderDual.fintype α with }
 
-#print NonemptyFinLinOrdCat /-
+#print NonemptyFinLinOrd /-
 /-- The category of nonempty finite linear orders. -/
-def NonemptyFinLinOrdCat :=
-  Bundled NonemptyFinLinOrd
-#align NonemptyFinLinOrd NonemptyFinLinOrdCat
+def NonemptyFinLinOrd :=
+  Bundled NonemptyFiniteLinearOrder
+#align NonemptyFinLinOrd NonemptyFinLinOrd
 -/
 
-namespace NonemptyFinLinOrdCat
+namespace NonemptyFinLinOrd
 
-instance : BundledHom.ParentProjection @NonemptyFinLinOrd.toLinearOrder :=
+instance : BundledHom.ParentProjection @NonemptyFiniteLinearOrder.toLinearOrder :=
   ⟨⟩
 
-deriving instance LargeCategory, ConcreteCategory for NonemptyFinLinOrdCat
+deriving instance LargeCategory, ConcreteCategory for NonemptyFinLinOrd
 
-instance : CoeSort NonemptyFinLinOrdCat (Type _) :=
+instance : CoeSort NonemptyFinLinOrd (Type _) :=
   Bundled.hasCoeToSort
 
-#print NonemptyFinLinOrdCat.of /-
+#print NonemptyFinLinOrd.of /-
 /-- Construct a bundled `NonemptyFinLinOrd` from the underlying type and typeclass. -/
-def of (α : Type _) [NonemptyFinLinOrd α] : NonemptyFinLinOrdCat :=
+def of (α : Type _) [NonemptyFiniteLinearOrder α] : NonemptyFinLinOrd :=
   Bundled.of α
-#align NonemptyFinLinOrd.of NonemptyFinLinOrdCat.of
+#align NonemptyFinLinOrd.of NonemptyFinLinOrd.of
 -/
 
-#print NonemptyFinLinOrdCat.coe_of /-
+#print NonemptyFinLinOrd.coe_of /-
 @[simp]
-theorem coe_of (α : Type _) [NonemptyFinLinOrd α] : ↥(of α) = α :=
+theorem coe_of (α : Type _) [NonemptyFiniteLinearOrder α] : ↥(of α) = α :=
   rfl
-#align NonemptyFinLinOrd.coe_of NonemptyFinLinOrdCat.coe_of
+#align NonemptyFinLinOrd.coe_of NonemptyFinLinOrd.coe_of
 -/
 
-instance : Inhabited NonemptyFinLinOrdCat :=
+instance : Inhabited NonemptyFinLinOrd :=
   ⟨of PUnit⟩
 
-instance (α : NonemptyFinLinOrdCat) : NonemptyFinLinOrd α :=
+instance (α : NonemptyFinLinOrd) : NonemptyFiniteLinearOrder α :=
   α.str
 
-#print NonemptyFinLinOrdCat.hasForgetToLinOrd /-
-instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
+#print NonemptyFinLinOrd.hasForgetToLinOrd /-
+instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrd LinOrd :=
   BundledHom.forget₂ _ _
-#align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
+#align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrd.hasForgetToLinOrd
 -/
 
-#print NonemptyFinLinOrdCat.hasForgetToFinPartOrd /-
-instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
+#print NonemptyFinLinOrd.hasForgetToFinPartOrd /-
+instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrd FinPartOrd
     where forget₂ :=
     { obj := fun X => FinPartOrd.of X
       map := fun X Y => id }
-#align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
+#align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrd.hasForgetToFinPartOrd
 -/
 
-#print NonemptyFinLinOrdCat.Iso.mk /-
+#print NonemptyFinLinOrd.Iso.mk /-
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
 @[simps]
-def Iso.mk {α β : NonemptyFinLinOrdCat.{u}} (e : α ≃o β) : α ≅ β
+def Iso.mk {α β : NonemptyFinLinOrd.{u}} (e : α ≃o β) : α ≅ β
     where
   hom := e
   inv := e.symm
   hom_inv_id' := by ext; exact e.symm_apply_apply x
   inv_hom_id' := by ext; exact e.apply_symm_apply x
-#align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrdCat.Iso.mk
+#align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrd.Iso.mk
 -/
 
-#print NonemptyFinLinOrdCat.dual /-
+#print NonemptyFinLinOrd.dual /-
 /-- `order_dual` as a functor. -/
 @[simps]
-def dual : NonemptyFinLinOrdCat ⥤ NonemptyFinLinOrdCat
+def dual : NonemptyFinLinOrd ⥤ NonemptyFinLinOrd
     where
   obj X := of Xᵒᵈ
   map X Y := OrderHom.dual
-#align NonemptyFinLinOrd.dual NonemptyFinLinOrdCat.dual
+#align NonemptyFinLinOrd.dual NonemptyFinLinOrd.dual
 -/
 
-#print NonemptyFinLinOrdCat.dualEquiv /-
+#print NonemptyFinLinOrd.dualEquiv /-
 /-- The equivalence between `NonemptyFinLinOrd` and itself induced by `order_dual` both ways. -/
 @[simps Functor inverse]
-def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat :=
+def dualEquiv : NonemptyFinLinOrd ≌ NonemptyFinLinOrd :=
   Equivalence.mk dual dual
     (NatIso.ofComponents (fun X => Iso.mk <| OrderIso.dualDual X) fun X Y f => rfl)
     (NatIso.ofComponents (fun X => Iso.mk <| OrderIso.dualDual X) fun X Y f => rfl)
-#align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrdCat.dualEquiv
+#align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrd.dualEquiv
 -/
 
-#print NonemptyFinLinOrdCat.mono_iff_injective /-
-theorem mono_iff_injective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
+#print NonemptyFinLinOrd.mono_iff_injective /-
+theorem mono_iff_injective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
     Mono f ↔ Function.Injective f :=
   by
   refine' ⟨_, concrete_category.mono_of_injective f⟩
   intro
   intro a₁ a₂ h
-  let X : NonemptyFinLinOrdCat.{u} := ⟨ULift (Fin 1)⟩
+  let X : NonemptyFinLinOrd.{u} := ⟨ULift (Fin 1)⟩
   let g₁ : X ⟶ A := ⟨fun x => a₁, fun x₁ x₂ h => by rfl⟩
   let g₂ : X ⟶ A := ⟨fun x => a₂, fun x₁ x₂ h => by rfl⟩
   change g₁ (ULift.up (0 : Fin 1)) = g₂ (ULift.up (0 : Fin 1))
   have eq : g₁ ≫ f = g₂ ≫ f := by ext x; exact h
   rw [cancel_mono] at eq 
   rw [Eq]
-#align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrdCat.mono_iff_injective
+#align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrd.mono_iff_injective
 -/
 
-#print NonemptyFinLinOrdCat.epi_iff_surjective /-
-theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
+#print NonemptyFinLinOrd.epi_iff_surjective /-
+theorem epi_iff_surjective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
     Epi f ↔ Function.Surjective f := by
   constructor
   · intro
     by_contra' hf'
     rcases hf' with ⟨m, hm⟩
-    let Y : NonemptyFinLinOrdCat.{u} := ⟨ULift (Fin 2)⟩
+    let Y : NonemptyFinLinOrd.{u} := ⟨ULift (Fin 2)⟩
     let p₁ : B ⟶ Y :=
       ⟨fun b => if b < m then ULift.up 0 else ULift.up 1, fun x₁ x₂ h =>
         by
@@ -206,10 +206,10 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
       Fin.one_eq_zero_iff, Nat.succ_succ_ne_one] using h
   · intro h
     exact concrete_category.epi_of_surjective f h
-#align NonemptyFinLinOrd.epi_iff_surjective NonemptyFinLinOrdCat.epi_iff_surjective
+#align NonemptyFinLinOrd.epi_iff_surjective NonemptyFinLinOrd.epi_iff_surjective
 -/
 
-instance : SplitEpiCategory NonemptyFinLinOrdCat.{u} :=
+instance : SplitEpiCategory NonemptyFinLinOrd.{u} :=
   ⟨fun X Y f hf =>
     by
     have H : ∀ y : Y, Nonempty (f ⁻¹' {y}) :=
@@ -233,9 +233,9 @@ instance : SplitEpiCategory NonemptyFinLinOrdCat.{u} :=
         simpa only [h', lt_self_iff_false] using h
       simpa only [hφ] using f.monotone (le_of_lt h)⟩
 
-instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrdCat.{u} :=
+instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrd.{u} :=
   ⟨fun X Y f => by
-    let I : NonemptyFinLinOrdCat.{u} := ⟨Set.image (coeFn f) ⊤, ⟨⟩⟩
+    let I : NonemptyFinLinOrd.{u} := ⟨Set.image (coeFn f) ⊤, ⟨⟩⟩
     let e : X ⟶ I := ⟨fun x => ⟨f x, ⟨x, by tidy⟩⟩, fun x₁ x₂ h => f.monotone h⟩
     let m : I ⟶ Y := ⟨fun y => y, by tidy⟩
     haveI : epi e := by rw [epi_iff_surjective]; tidy
@@ -247,21 +247,21 @@ instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrdCat.{u} :=
           m
           e }⟩
 
-end NonemptyFinLinOrdCat
+end NonemptyFinLinOrd
 
-#print nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat /-
-theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat :
-    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat LinOrdCat =
-      forget₂ NonemptyFinLinOrdCat LinOrdCat ⋙ LinOrdCat.dual :=
+#print nonemptyFinLinOrd_dual_comp_forget_to_linOrd /-
+theorem nonemptyFinLinOrd_dual_comp_forget_to_linOrd :
+    NonemptyFinLinOrd.dual ⋙ forget₂ NonemptyFinLinOrd LinOrd =
+      forget₂ NonemptyFinLinOrd LinOrd ⋙ LinOrd.dual :=
   rfl
-#align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat
+#align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrd_dual_comp_forget_to_linOrd
 -/
 
 #print nonemptyFinLinOrdDualCompForgetToFinPartOrd /-
 /-- The forgetful functor `NonemptyFinLinOrd ⥤ FinPartOrd` and `order_dual` commute. -/
 def nonemptyFinLinOrdDualCompForgetToFinPartOrd :
-    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat FinPartOrd ≅
-      forget₂ NonemptyFinLinOrdCat FinPartOrd ⋙ FinPartOrd.dual
+    NonemptyFinLinOrd.dual ⋙ forget₂ NonemptyFinLinOrd FinPartOrd ≅
+      forget₂ NonemptyFinLinOrd FinPartOrd ⋙ FinPartOrd.dual
     where
   hom := { app := fun X => OrderHom.id }
   inv := { app := fun X => OrderHom.id }
Diff
@@ -180,7 +180,7 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
         by
         simp only
         split_ifs with h₁ h₂ h₂
-        any_goals apply Fin.zero_le
+        any_goals apply Fin.zero_le'
         · exfalso
           exact h₁ (lt_of_le_of_lt h h₂)
         · rfl⟩
@@ -189,7 +189,7 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
         by
         simp only
         split_ifs with h₁ h₂ h₂
-        any_goals apply Fin.zero_le
+        any_goals apply Fin.zero_le'
         · exfalso
           exact h₁ (h.trans h₂)
         · rfl⟩
@@ -197,12 +197,12 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
       congr
       rw [← cancel_epi f]
       ext a : 2
-      simp only [comp_apply, OrderHom.coe_fun_mk]
+      simp only [comp_apply, OrderHom.coe_mk]
       split_ifs with h₁ h₂ h₂
       any_goals rfl
       · exfalso; exact h₂ (le_of_lt h₁)
       · exfalso; exact hm a (eq_of_le_of_not_lt h₂ h₁)
-    simpa only [OrderHom.coe_fun_mk, lt_self_iff_false, if_false, le_refl, if_true, ULift.up_inj,
+    simpa only [OrderHom.coe_mk, lt_self_iff_false, if_false, le_refl, if_true, ULift.up_inj,
       Fin.one_eq_zero_iff, Nat.succ_succ_ne_one] using h
   · intro h
     exact concrete_category.epi_of_surjective f h
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2020 Johan Commelin. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johan Commelin
-
-! This file was ported from Lean 3 source module order.category.NonemptyFinLinOrd
-! leanprover-community/mathlib commit fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Fintype.Order
 import Mathbin.Data.Set.Finite
@@ -15,6 +10,8 @@ import Mathbin.Order.Category.LinOrd
 import Mathbin.CategoryTheory.Limits.Shapes.Images
 import Mathbin.CategoryTheory.Limits.Shapes.RegularMono
 
+#align_import order.category.NonemptyFinLinOrd from "leanprover-community/mathlib"@"fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19"
+
 /-!
 # Nonempty finite linear orders
 
Diff
@@ -106,15 +106,19 @@ instance : Inhabited NonemptyFinLinOrdCat :=
 instance (α : NonemptyFinLinOrdCat) : NonemptyFinLinOrd α :=
   α.str
 
+#print NonemptyFinLinOrdCat.hasForgetToLinOrd /-
 instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
   BundledHom.forget₂ _ _
 #align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
+-/
 
+#print NonemptyFinLinOrdCat.hasForgetToFinPartOrd /-
 instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
     where forget₂ :=
     { obj := fun X => FinPartOrd.of X
       map := fun X Y => id }
 #align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
+-/
 
 #print NonemptyFinLinOrdCat.Iso.mk /-
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
@@ -139,6 +143,7 @@ def dual : NonemptyFinLinOrdCat ⥤ NonemptyFinLinOrdCat
 #align NonemptyFinLinOrd.dual NonemptyFinLinOrdCat.dual
 -/
 
+#print NonemptyFinLinOrdCat.dualEquiv /-
 /-- The equivalence between `NonemptyFinLinOrd` and itself induced by `order_dual` both ways. -/
 @[simps Functor inverse]
 def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat :=
@@ -146,6 +151,7 @@ def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat :=
     (NatIso.ofComponents (fun X => Iso.mk <| OrderIso.dualDual X) fun X Y f => rfl)
     (NatIso.ofComponents (fun X => Iso.mk <| OrderIso.dualDual X) fun X Y f => rfl)
 #align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrdCat.dualEquiv
+-/
 
 #print NonemptyFinLinOrdCat.mono_iff_injective /-
 theorem mono_iff_injective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
Diff
@@ -106,19 +106,15 @@ instance : Inhabited NonemptyFinLinOrdCat :=
 instance (α : NonemptyFinLinOrdCat) : NonemptyFinLinOrd α :=
   α.str
 
-#print NonemptyFinLinOrdCat.hasForgetToLinOrd /-
 instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
   BundledHom.forget₂ _ _
 #align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
--/
 
-#print NonemptyFinLinOrdCat.hasForgetToFinPartOrd /-
 instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
     where forget₂ :=
     { obj := fun X => FinPartOrd.of X
       map := fun X Y => id }
 #align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
--/
 
 #print NonemptyFinLinOrdCat.Iso.mk /-
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
Diff
@@ -112,11 +112,13 @@ instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
 #align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
 -/
 
+#print NonemptyFinLinOrdCat.hasForgetToFinPartOrd /-
 instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
     where forget₂ :=
     { obj := fun X => FinPartOrd.of X
       map := fun X Y => id }
 #align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
+-/
 
 #print NonemptyFinLinOrdCat.Iso.mk /-
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
@@ -256,6 +258,7 @@ theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat :
 #align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat
 -/
 
+#print nonemptyFinLinOrdDualCompForgetToFinPartOrd /-
 /-- The forgetful functor `NonemptyFinLinOrd ⥤ FinPartOrd` and `order_dual` commute. -/
 def nonemptyFinLinOrdDualCompForgetToFinPartOrd :
     NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat FinPartOrd ≅
@@ -264,4 +267,5 @@ def nonemptyFinLinOrdDualCompForgetToFinPartOrd :
   hom := { app := fun X => OrderHom.id }
   inv := { app := fun X => OrderHom.id }
 #align NonemptyFinLinOrd_dual_comp_forget_to_FinPartOrd nonemptyFinLinOrdDualCompForgetToFinPartOrd
+-/
 
Diff
@@ -161,7 +161,7 @@ theorem mono_iff_injective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
   let g₂ : X ⟶ A := ⟨fun x => a₂, fun x₁ x₂ h => by rfl⟩
   change g₁ (ULift.up (0 : Fin 1)) = g₂ (ULift.up (0 : Fin 1))
   have eq : g₁ ≫ f = g₂ ≫ f := by ext x; exact h
-  rw [cancel_mono] at eq
+  rw [cancel_mono] at eq 
   rw [Eq]
 #align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrdCat.mono_iff_injective
 -/
@@ -213,7 +213,7 @@ instance : SplitEpiCategory NonemptyFinLinOrdCat.{u} :=
     by
     have H : ∀ y : Y, Nonempty (f ⁻¹' {y}) :=
       by
-      rw [epi_iff_surjective] at hf
+      rw [epi_iff_surjective] at hf 
       intro y
       exact Nonempty.intro ⟨(hf y).some, (hf y).choose_spec⟩
     let φ : Y → X := fun y => (H y).some.1
@@ -224,7 +224,7 @@ instance : SplitEpiCategory NonemptyFinLinOrdCat.{u} :=
     · intro a b
       contrapose
       intro h
-      simp only [not_le] at h⊢
+      simp only [not_le] at h ⊢
       suffices b ≤ a by
         apply lt_of_le_of_ne this
         intro h'
Diff
@@ -42,10 +42,12 @@ class NonemptyFinLinOrd (α : Type _) extends Fintype α, LinearOrder α where
 
 attribute [instance] NonemptyFinLinOrd.nonempty
 
+#print NonemptyFinLinOrd.toBoundedOrder /-
 instance (priority := 100) NonemptyFinLinOrd.toBoundedOrder (α : Type _) [NonemptyFinLinOrd α] :
     BoundedOrder α :=
   Fintype.toBoundedOrder α
 #align nonempty_fin_lin_ord.to_bounded_order NonemptyFinLinOrd.toBoundedOrder
+-/
 
 #print PUnit.nonemptyFinLinOrd /-
 instance PUnit.nonemptyFinLinOrd : NonemptyFinLinOrd PUnit where
@@ -116,6 +118,7 @@ instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
       map := fun X Y => id }
 #align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
 
+#print NonemptyFinLinOrdCat.Iso.mk /-
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
 @[simps]
@@ -126,6 +129,7 @@ def Iso.mk {α β : NonemptyFinLinOrdCat.{u}} (e : α ≃o β) : α ≅ β
   hom_inv_id' := by ext; exact e.symm_apply_apply x
   inv_hom_id' := by ext; exact e.apply_symm_apply x
 #align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrdCat.Iso.mk
+-/
 
 #print NonemptyFinLinOrdCat.dual /-
 /-- `order_dual` as a functor. -/
Diff
@@ -42,12 +42,6 @@ class NonemptyFinLinOrd (α : Type _) extends Fintype α, LinearOrder α where
 
 attribute [instance] NonemptyFinLinOrd.nonempty
 
-/- warning: nonempty_fin_lin_ord.to_bounded_order -> NonemptyFinLinOrd.toBoundedOrder is a dubious translation:
-lean 3 declaration is
-  forall (α : Type.{u1}) [_inst_1 : NonemptyFinLinOrd.{u1} α], BoundedOrder.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α (NonemptyFinLinOrd.toLinearOrder.{u1} α _inst_1))))))
-but is expected to have type
-  forall (α : Type.{u1}) [_inst_1 : NonemptyFinLinOrd.{u1} α], BoundedOrder.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α (NonemptyFinLinOrd.toLinearOrder.{u1} α _inst_1)))))))
-Case conversion may be inaccurate. Consider using '#align nonempty_fin_lin_ord.to_bounded_order NonemptyFinLinOrd.toBoundedOrderₓ'. -/
 instance (priority := 100) NonemptyFinLinOrd.toBoundedOrder (α : Type _) [NonemptyFinLinOrd α] :
     BoundedOrder α :=
   Fintype.toBoundedOrder α
@@ -122,12 +116,6 @@ instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
       map := fun X Y => id }
 #align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
 
-/- warning: NonemptyFinLinOrd.iso.mk -> NonemptyFinLinOrdCat.Iso.mk is a dubious translation:
-lean 3 declaration is
-  forall {α : NonemptyFinLinOrdCat.{u1}} {β : NonemptyFinLinOrdCat.{u1}}, (OrderIso.{u1, u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (Preorder.toHasLe.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (PartialOrder.toPreorder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (SemilatticeInf.toPartialOrder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (Lattice.toSemilatticeInf.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (LinearOrder.toLattice.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (NonemptyFinLinOrd.toLinearOrder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (NonemptyFinLinOrdCat.nonemptyFinLinOrd.{u1} α))))))) (Preorder.toHasLe.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (PartialOrder.toPreorder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (SemilatticeInf.toPartialOrder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (Lattice.toSemilatticeInf.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (LinearOrder.toLattice.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (NonemptyFinLinOrd.toLinearOrder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (NonemptyFinLinOrdCat.nonemptyFinLinOrd.{u1} β)))))))) -> (CategoryTheory.Iso.{u1, succ u1} NonemptyFinLinOrdCat.{u1} NonemptyFinLinOrdCat.largeCategory.{u1} α β)
-but is expected to have type
-  forall {α : NonemptyFinLinOrdCat.{u1}} {β : NonemptyFinLinOrdCat.{u1}}, (OrderIso.{u1, u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (Preorder.toLE.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (PartialOrder.toPreorder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (SemilatticeInf.toPartialOrder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (Lattice.toSemilatticeInf.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (DistribLattice.toLattice.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (instDistribLattice.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (NonemptyFinLinOrd.toLinearOrder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (NonemptyFinLinOrdCat.instNonemptyFinLinOrdα.{u1} α)))))))) (Preorder.toLE.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (PartialOrder.toPreorder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (SemilatticeInf.toPartialOrder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (Lattice.toSemilatticeInf.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (DistribLattice.toLattice.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (instDistribLattice.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (NonemptyFinLinOrd.toLinearOrder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (NonemptyFinLinOrdCat.instNonemptyFinLinOrdα.{u1} β))))))))) -> (CategoryTheory.Iso.{u1, succ u1} NonemptyFinLinOrdCat.{u1} instNonemptyFinLinOrdCatLargeCategory.{u1} α β)
-Case conversion may be inaccurate. Consider using '#align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrdCat.Iso.mkₓ'. -/
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
 @[simps]
@@ -149,12 +137,6 @@ def dual : NonemptyFinLinOrdCat ⥤ NonemptyFinLinOrdCat
 #align NonemptyFinLinOrd.dual NonemptyFinLinOrdCat.dual
 -/
 
-/- warning: NonemptyFinLinOrd.dual_equiv -> NonemptyFinLinOrdCat.dualEquiv is a dubious translation:
-lean 3 declaration is
-  CategoryTheory.Equivalence.{u1, u1, succ u1, succ u1} NonemptyFinLinOrdCat.{u1} NonemptyFinLinOrdCat.largeCategory.{u1} NonemptyFinLinOrdCat.{u1} NonemptyFinLinOrdCat.largeCategory.{u1}
-but is expected to have type
-  CategoryTheory.Equivalence.{u1, u1, succ u1, succ u1} NonemptyFinLinOrdCat.{u1} NonemptyFinLinOrdCat.{u1} instNonemptyFinLinOrdCatLargeCategory.{u1} instNonemptyFinLinOrdCatLargeCategory.{u1}
-Case conversion may be inaccurate. Consider using '#align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrdCat.dualEquivₓ'. -/
 /-- The equivalence between `NonemptyFinLinOrd` and itself induced by `order_dual` both ways. -/
 @[simps Functor inverse]
 def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat :=
Diff
@@ -135,12 +135,8 @@ def Iso.mk {α β : NonemptyFinLinOrdCat.{u}} (e : α ≃o β) : α ≅ β
     where
   hom := e
   inv := e.symm
-  hom_inv_id' := by
-    ext
-    exact e.symm_apply_apply x
-  inv_hom_id' := by
-    ext
-    exact e.apply_symm_apply x
+  hom_inv_id' := by ext; exact e.symm_apply_apply x
+  inv_hom_id' := by ext; exact e.apply_symm_apply x
 #align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrdCat.Iso.mk
 
 #print NonemptyFinLinOrdCat.dual /-
@@ -178,9 +174,7 @@ theorem mono_iff_injective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
   let g₁ : X ⟶ A := ⟨fun x => a₁, fun x₁ x₂ h => by rfl⟩
   let g₂ : X ⟶ A := ⟨fun x => a₂, fun x₁ x₂ h => by rfl⟩
   change g₁ (ULift.up (0 : Fin 1)) = g₂ (ULift.up (0 : Fin 1))
-  have eq : g₁ ≫ f = g₂ ≫ f := by
-    ext x
-    exact h
+  have eq : g₁ ≫ f = g₂ ≫ f := by ext x; exact h
   rw [cancel_mono] at eq
   rw [Eq]
 #align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrdCat.mono_iff_injective
@@ -219,10 +213,8 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
       simp only [comp_apply, OrderHom.coe_fun_mk]
       split_ifs with h₁ h₂ h₂
       any_goals rfl
-      · exfalso
-        exact h₂ (le_of_lt h₁)
-      · exfalso
-        exact hm a (eq_of_le_of_not_lt h₂ h₁)
+      · exfalso; exact h₂ (le_of_lt h₁)
+      · exfalso; exact hm a (eq_of_le_of_not_lt h₂ h₁)
     simpa only [OrderHom.coe_fun_mk, lt_self_iff_false, if_false, le_refl, if_true, ULift.up_inj,
       Fin.one_eq_zero_iff, Nat.succ_succ_ne_one] using h
   · intro h
@@ -240,8 +232,7 @@ instance : SplitEpiCategory NonemptyFinLinOrdCat.{u} :=
       exact Nonempty.intro ⟨(hf y).some, (hf y).choose_spec⟩
     let φ : Y → X := fun y => (H y).some.1
     have hφ : ∀ y : Y, f (φ y) = y := fun y => (H y).some.2
-    refine' is_split_epi.mk' ⟨⟨φ, _⟩, _⟩
-    swap
+    refine' is_split_epi.mk' ⟨⟨φ, _⟩, _⟩; swap
     · ext b
       apply hφ
     · intro a b
@@ -260,9 +251,7 @@ instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrdCat.{u} :=
     let I : NonemptyFinLinOrdCat.{u} := ⟨Set.image (coeFn f) ⊤, ⟨⟩⟩
     let e : X ⟶ I := ⟨fun x => ⟨f x, ⟨x, by tidy⟩⟩, fun x₁ x₂ h => f.monotone h⟩
     let m : I ⟶ Y := ⟨fun y => y, by tidy⟩
-    haveI : epi e := by
-      rw [epi_iff_surjective]
-      tidy
+    haveI : epi e := by rw [epi_iff_surjective]; tidy
     haveI : strong_epi e := strong_epi_of_epi e
     haveI : mono m := concrete_category.mono_of_injective _ (by tidy)
     exact
Diff
@@ -42,12 +42,16 @@ class NonemptyFinLinOrd (α : Type _) extends Fintype α, LinearOrder α where
 
 attribute [instance] NonemptyFinLinOrd.nonempty
 
-#print NonemptyFinLinOrd.toBoundedOrder /-
+/- warning: nonempty_fin_lin_ord.to_bounded_order -> NonemptyFinLinOrd.toBoundedOrder is a dubious translation:
+lean 3 declaration is
+  forall (α : Type.{u1}) [_inst_1 : NonemptyFinLinOrd.{u1} α], BoundedOrder.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α (NonemptyFinLinOrd.toLinearOrder.{u1} α _inst_1))))))
+but is expected to have type
+  forall (α : Type.{u1}) [_inst_1 : NonemptyFinLinOrd.{u1} α], BoundedOrder.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α (NonemptyFinLinOrd.toLinearOrder.{u1} α _inst_1)))))))
+Case conversion may be inaccurate. Consider using '#align nonempty_fin_lin_ord.to_bounded_order NonemptyFinLinOrd.toBoundedOrderₓ'. -/
 instance (priority := 100) NonemptyFinLinOrd.toBoundedOrder (α : Type _) [NonemptyFinLinOrd α] :
     BoundedOrder α :=
   Fintype.toBoundedOrder α
 #align nonempty_fin_lin_ord.to_bounded_order NonemptyFinLinOrd.toBoundedOrder
--/
 
 #print PUnit.nonemptyFinLinOrd /-
 instance PUnit.nonemptyFinLinOrd : NonemptyFinLinOrd PUnit where
@@ -118,7 +122,12 @@ instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
       map := fun X Y => id }
 #align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
 
-#print NonemptyFinLinOrdCat.Iso.mk /-
+/- warning: NonemptyFinLinOrd.iso.mk -> NonemptyFinLinOrdCat.Iso.mk is a dubious translation:
+lean 3 declaration is
+  forall {α : NonemptyFinLinOrdCat.{u1}} {β : NonemptyFinLinOrdCat.{u1}}, (OrderIso.{u1, u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (Preorder.toHasLe.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (PartialOrder.toPreorder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (SemilatticeInf.toPartialOrder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (Lattice.toSemilatticeInf.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (LinearOrder.toLattice.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (NonemptyFinLinOrd.toLinearOrder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} α) (NonemptyFinLinOrdCat.nonemptyFinLinOrd.{u1} α))))))) (Preorder.toHasLe.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (PartialOrder.toPreorder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (SemilatticeInf.toPartialOrder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (Lattice.toSemilatticeInf.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (LinearOrder.toLattice.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (NonemptyFinLinOrd.toLinearOrder.{u1} (coeSort.{succ (succ u1), succ (succ u1)} NonemptyFinLinOrdCat.{u1} Type.{u1} NonemptyFinLinOrdCat.hasCoeToSort.{u1} β) (NonemptyFinLinOrdCat.nonemptyFinLinOrd.{u1} β)))))))) -> (CategoryTheory.Iso.{u1, succ u1} NonemptyFinLinOrdCat.{u1} NonemptyFinLinOrdCat.largeCategory.{u1} α β)
+but is expected to have type
+  forall {α : NonemptyFinLinOrdCat.{u1}} {β : NonemptyFinLinOrdCat.{u1}}, (OrderIso.{u1, u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (Preorder.toLE.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (PartialOrder.toPreorder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (SemilatticeInf.toPartialOrder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (Lattice.toSemilatticeInf.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (DistribLattice.toLattice.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (instDistribLattice.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (NonemptyFinLinOrd.toLinearOrder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} α) (NonemptyFinLinOrdCat.instNonemptyFinLinOrdα.{u1} α)))))))) (Preorder.toLE.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (PartialOrder.toPreorder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (SemilatticeInf.toPartialOrder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (Lattice.toSemilatticeInf.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (DistribLattice.toLattice.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (instDistribLattice.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (NonemptyFinLinOrd.toLinearOrder.{u1} (CategoryTheory.Bundled.α.{u1, u1} NonemptyFinLinOrd.{u1} β) (NonemptyFinLinOrdCat.instNonemptyFinLinOrdα.{u1} β))))))))) -> (CategoryTheory.Iso.{u1, succ u1} NonemptyFinLinOrdCat.{u1} instNonemptyFinLinOrdCatLargeCategory.{u1} α β)
+Case conversion may be inaccurate. Consider using '#align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrdCat.Iso.mkₓ'. -/
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
 @[simps]
@@ -133,7 +142,6 @@ def Iso.mk {α β : NonemptyFinLinOrdCat.{u}} (e : α ≃o β) : α ≅ β
     ext
     exact e.apply_symm_apply x
 #align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrdCat.Iso.mk
--/
 
 #print NonemptyFinLinOrdCat.dual /-
 /-- `order_dual` as a functor. -/
Diff
@@ -4,12 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johan Commelin
 
 ! This file was ported from Lean 3 source module order.category.NonemptyFinLinOrd
-! leanprover-community/mathlib commit 75be6b616681ab6ca66d798ead117e75cd64f125
+! leanprover-community/mathlib commit fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Data.Fintype.Order
 import Mathbin.Data.Set.Finite
+import Mathbin.Order.Category.FinPartOrd
 import Mathbin.Order.Category.LinOrd
 import Mathbin.CategoryTheory.Limits.Shapes.Images
 import Mathbin.CategoryTheory.Limits.Shapes.RegularMono
@@ -22,6 +23,9 @@ import Mathbin.CategoryTheory.Limits.Shapes.RegularMono
 
 This defines `NonemptyFinLinOrd`, the category of nonempty finite linear orders with monotone maps.
 This is the index category for simplicial objects.
+
+Note: `NonemptyFinLinOrd` is *not* a subcategory of `FinBddDistLat` because its morphisms do not
+preserve `⊥` and `⊤`.
 -/
 
 
@@ -108,6 +112,12 @@ instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
 #align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
 -/
 
+instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
+    where forget₂ :=
+    { obj := fun X => FinPartOrd.of X
+      map := fun X Y => id }
+#align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
+
 #print NonemptyFinLinOrdCat.Iso.mk /-
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
@@ -141,7 +151,7 @@ lean 3 declaration is
 but is expected to have type
   CategoryTheory.Equivalence.{u1, u1, succ u1, succ u1} NonemptyFinLinOrdCat.{u1} NonemptyFinLinOrdCat.{u1} instNonemptyFinLinOrdCatLargeCategory.{u1} instNonemptyFinLinOrdCatLargeCategory.{u1}
 Case conversion may be inaccurate. Consider using '#align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrdCat.dualEquivₓ'. -/
-/-- The equivalence between `FinPartOrd` and itself induced by `order_dual` both ways. -/
+/-- The equivalence between `NonemptyFinLinOrd` and itself induced by `order_dual` both ways. -/
 @[simps Functor inverse]
 def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat :=
   Equivalence.mk dual dual
@@ -263,3 +273,12 @@ theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat :
 #align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat
 -/
 
+/-- The forgetful functor `NonemptyFinLinOrd ⥤ FinPartOrd` and `order_dual` commute. -/
+def nonemptyFinLinOrdDualCompForgetToFinPartOrd :
+    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat FinPartOrd ≅
+      forget₂ NonemptyFinLinOrdCat FinPartOrd ⋙ FinPartOrd.dual
+    where
+  hom := { app := fun X => OrderHom.id }
+  inv := { app := fun X => OrderHom.id }
+#align NonemptyFinLinOrd_dual_comp_forget_to_FinPartOrd nonemptyFinLinOrdDualCompForgetToFinPartOrd
+
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johan Commelin
 
 ! This file was ported from Lean 3 source module order.category.NonemptyFinLinOrd
-! leanprover-community/mathlib commit e8ac6315bcfcbaf2d19a046719c3b553206dac75
+! leanprover-community/mathlib commit 75be6b616681ab6ca66d798ead117e75cd64f125
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -17,6 +17,9 @@ import Mathbin.CategoryTheory.Limits.Shapes.RegularMono
 /-!
 # Nonempty finite linear orders
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This defines `NonemptyFinLinOrd`, the category of nonempty finite linear orders with monotone maps.
 This is the index category for simplicial objects.
 -/
Diff
@@ -26,36 +26,48 @@ universe u v
 
 open CategoryTheory CategoryTheory.Limits
 
+#print NonemptyFinLinOrd /-
 /-- A typeclass for nonempty finite linear orders. -/
 class NonemptyFinLinOrd (α : Type _) extends Fintype α, LinearOrder α where
   Nonempty : Nonempty α := by infer_instance
 #align nonempty_fin_lin_ord NonemptyFinLinOrd
+-/
 
 attribute [instance] NonemptyFinLinOrd.nonempty
 
+#print NonemptyFinLinOrd.toBoundedOrder /-
 instance (priority := 100) NonemptyFinLinOrd.toBoundedOrder (α : Type _) [NonemptyFinLinOrd α] :
     BoundedOrder α :=
   Fintype.toBoundedOrder α
 #align nonempty_fin_lin_ord.to_bounded_order NonemptyFinLinOrd.toBoundedOrder
+-/
 
+#print PUnit.nonemptyFinLinOrd /-
 instance PUnit.nonemptyFinLinOrd : NonemptyFinLinOrd PUnit where
 #align punit.nonempty_fin_lin_ord PUnit.nonemptyFinLinOrd
+-/
 
+#print Fin.nonemptyFinLinOrd /-
 instance Fin.nonemptyFinLinOrd (n : ℕ) : NonemptyFinLinOrd (Fin (n + 1)) where
 #align fin.nonempty_fin_lin_ord Fin.nonemptyFinLinOrd
+-/
 
+#print ULift.nonemptyFinLinOrd /-
 instance ULift.nonemptyFinLinOrd (α : Type u) [NonemptyFinLinOrd α] :
     NonemptyFinLinOrd (ULift.{v} α) :=
   { LinearOrder.lift' Equiv.ulift (Equiv.injective _) with }
 #align ulift.nonempty_fin_lin_ord ULift.nonemptyFinLinOrd
+-/
 
 instance (α : Type _) [NonemptyFinLinOrd α] : NonemptyFinLinOrd αᵒᵈ :=
   { OrderDual.fintype α with }
 
+#print NonemptyFinLinOrdCat /-
 /-- The category of nonempty finite linear orders. -/
 def NonemptyFinLinOrdCat :=
   Bundled NonemptyFinLinOrd
 #align NonemptyFinLinOrd NonemptyFinLinOrdCat
+-/
 
 namespace NonemptyFinLinOrdCat
 
@@ -67,15 +79,19 @@ deriving instance LargeCategory, ConcreteCategory for NonemptyFinLinOrdCat
 instance : CoeSort NonemptyFinLinOrdCat (Type _) :=
   Bundled.hasCoeToSort
 
+#print NonemptyFinLinOrdCat.of /-
 /-- Construct a bundled `NonemptyFinLinOrd` from the underlying type and typeclass. -/
 def of (α : Type _) [NonemptyFinLinOrd α] : NonemptyFinLinOrdCat :=
   Bundled.of α
 #align NonemptyFinLinOrd.of NonemptyFinLinOrdCat.of
+-/
 
+#print NonemptyFinLinOrdCat.coe_of /-
 @[simp]
 theorem coe_of (α : Type _) [NonemptyFinLinOrd α] : ↥(of α) = α :=
   rfl
 #align NonemptyFinLinOrd.coe_of NonemptyFinLinOrdCat.coe_of
+-/
 
 instance : Inhabited NonemptyFinLinOrdCat :=
   ⟨of PUnit⟩
@@ -83,10 +99,13 @@ instance : Inhabited NonemptyFinLinOrdCat :=
 instance (α : NonemptyFinLinOrdCat) : NonemptyFinLinOrd α :=
   α.str
 
+#print NonemptyFinLinOrdCat.hasForgetToLinOrd /-
 instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
   BundledHom.forget₂ _ _
 #align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
+-/
 
+#print NonemptyFinLinOrdCat.Iso.mk /-
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
 @[simps]
@@ -101,7 +120,9 @@ def Iso.mk {α β : NonemptyFinLinOrdCat.{u}} (e : α ≃o β) : α ≅ β
     ext
     exact e.apply_symm_apply x
 #align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrdCat.Iso.mk
+-/
 
+#print NonemptyFinLinOrdCat.dual /-
 /-- `order_dual` as a functor. -/
 @[simps]
 def dual : NonemptyFinLinOrdCat ⥤ NonemptyFinLinOrdCat
@@ -109,7 +130,14 @@ def dual : NonemptyFinLinOrdCat ⥤ NonemptyFinLinOrdCat
   obj X := of Xᵒᵈ
   map X Y := OrderHom.dual
 #align NonemptyFinLinOrd.dual NonemptyFinLinOrdCat.dual
+-/
 
+/- warning: NonemptyFinLinOrd.dual_equiv -> NonemptyFinLinOrdCat.dualEquiv is a dubious translation:
+lean 3 declaration is
+  CategoryTheory.Equivalence.{u1, u1, succ u1, succ u1} NonemptyFinLinOrdCat.{u1} NonemptyFinLinOrdCat.largeCategory.{u1} NonemptyFinLinOrdCat.{u1} NonemptyFinLinOrdCat.largeCategory.{u1}
+but is expected to have type
+  CategoryTheory.Equivalence.{u1, u1, succ u1, succ u1} NonemptyFinLinOrdCat.{u1} NonemptyFinLinOrdCat.{u1} instNonemptyFinLinOrdCatLargeCategory.{u1} instNonemptyFinLinOrdCatLargeCategory.{u1}
+Case conversion may be inaccurate. Consider using '#align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrdCat.dualEquivₓ'. -/
 /-- The equivalence between `FinPartOrd` and itself induced by `order_dual` both ways. -/
 @[simps Functor inverse]
 def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat :=
@@ -118,6 +146,7 @@ def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat :=
     (NatIso.ofComponents (fun X => Iso.mk <| OrderIso.dualDual X) fun X Y f => rfl)
 #align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrdCat.dualEquiv
 
+#print NonemptyFinLinOrdCat.mono_iff_injective /-
 theorem mono_iff_injective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
     Mono f ↔ Function.Injective f :=
   by
@@ -134,7 +163,9 @@ theorem mono_iff_injective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
   rw [cancel_mono] at eq
   rw [Eq]
 #align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrdCat.mono_iff_injective
+-/
 
+#print NonemptyFinLinOrdCat.epi_iff_surjective /-
 theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
     Epi f ↔ Function.Surjective f := by
   constructor
@@ -176,6 +207,7 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
   · intro h
     exact concrete_category.epi_of_surjective f h
 #align NonemptyFinLinOrd.epi_iff_surjective NonemptyFinLinOrdCat.epi_iff_surjective
+-/
 
 instance : SplitEpiCategory NonemptyFinLinOrdCat.{u} :=
   ⟨fun X Y f hf =>
@@ -220,9 +252,11 @@ instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrdCat.{u} :=
 
 end NonemptyFinLinOrdCat
 
+#print nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat /-
 theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat :
     NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat LinOrdCat =
       forget₂ NonemptyFinLinOrdCat LinOrdCat ⋙ LinOrdCat.dual :=
   rfl
 #align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat
+-/
 
Diff
@@ -83,7 +83,7 @@ instance : Inhabited NonemptyFinLinOrdCat :=
 instance (α : NonemptyFinLinOrdCat) : NonemptyFinLinOrd α :=
   α.str
 
-instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrd :=
+instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
   BundledHom.forget₂ _ _
 #align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
 
@@ -220,9 +220,9 @@ instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrdCat.{u} :=
 
 end NonemptyFinLinOrdCat
 
-theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linOrd :
-    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat LinOrd =
-      forget₂ NonemptyFinLinOrdCat LinOrd ⋙ LinOrd.dual :=
+theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat :
+    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat LinOrdCat =
+      forget₂ NonemptyFinLinOrdCat LinOrdCat ⋙ LinOrdCat.dual :=
   rfl
-#align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrdCat_dual_comp_forget_to_linOrd
+#align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat
 
Diff
@@ -4,13 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johan Commelin
 
 ! This file was ported from Lean 3 source module order.category.NonemptyFinLinOrd
-! leanprover-community/mathlib commit 0bd2ea37bcba5769e14866170f251c9bc64e35d7
+! leanprover-community/mathlib commit e8ac6315bcfcbaf2d19a046719c3b553206dac75
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Data.Fintype.Order
 import Mathbin.Data.Set.Finite
-import Mathbin.Order.Category.LinearOrder
+import Mathbin.Order.Category.LinOrd
 import Mathbin.CategoryTheory.Limits.Shapes.Images
 import Mathbin.CategoryTheory.Limits.Shapes.RegularMono
 
@@ -83,9 +83,9 @@ instance : Inhabited NonemptyFinLinOrdCat :=
 instance (α : NonemptyFinLinOrdCat) : NonemptyFinLinOrd α :=
   α.str
 
-instance hasForgetToLinearOrder : HasForget₂ NonemptyFinLinOrdCat LinearOrderCat :=
+instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrd :=
   BundledHom.forget₂ _ _
-#align NonemptyFinLinOrd.has_forget_to_LinearOrder NonemptyFinLinOrdCat.hasForgetToLinearOrder
+#align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
 
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
@@ -110,7 +110,7 @@ def dual : NonemptyFinLinOrdCat ⥤ NonemptyFinLinOrdCat
   map X Y := OrderHom.dual
 #align NonemptyFinLinOrd.dual NonemptyFinLinOrdCat.dual
 
-/-- The equivalence between `FinPartialOrder` and itself induced by `order_dual` both ways. -/
+/-- The equivalence between `FinPartOrd` and itself induced by `order_dual` both ways. -/
 @[simps Functor inverse]
 def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat :=
   Equivalence.mk dual dual
@@ -220,9 +220,9 @@ instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrdCat.{u} :=
 
 end NonemptyFinLinOrdCat
 
-theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linearOrderCat :
-    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat LinearOrderCat =
-      forget₂ NonemptyFinLinOrdCat LinearOrderCat ⋙ LinearOrderCat.dual :=
+theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linOrd :
+    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat LinOrd =
+      forget₂ NonemptyFinLinOrdCat LinOrd ⋙ LinOrd.dual :=
   rfl
-#align NonemptyFinLinOrd_dual_comp_forget_to_LinearOrder nonemptyFinLinOrdCat_dual_comp_forget_to_linearOrderCat
+#align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrdCat_dual_comp_forget_to_linOrd
 

Changes in mathlib4

mathlib3
mathlib4
chore: split Subsingleton,Nontrivial off of Data.Set.Basic (#11832)

Moves definition of and lemmas related to Set.Subsingleton and Set.Nontrivial to a new file, so that Basic can be shorter.

Diff
@@ -10,7 +10,7 @@ import Mathlib.Order.Category.FinPartOrd
 import Mathlib.Order.Category.LinOrd
 import Mathlib.CategoryTheory.Limits.Shapes.Images
 import Mathlib.CategoryTheory.Limits.Shapes.RegularMono
-import Mathlib.Data.Set.Basic
+import Mathlib.Data.Set.Subsingleton
 
 #align_import order.category.NonemptyFinLinOrd from "leanprover-community/mathlib"@"fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19"
 
chore: Split Data.{Nat,Int}{.Order}.Basic in group vs ring instances (#11924)

Scatter the content of Data.Nat.Basic across:

  • Data.Nat.Defs for the lemmas having no dependencies
  • Algebra.Group.Nat for the monoid instances and the few miscellaneous lemmas needing them.
  • Algebra.Ring.Nat for the semiring instance and the few miscellaneous lemmas following it.

Similarly, scatter

  • Data.Int.Basic across Data.Int.Defs, Algebra.Group.Int, Algebra.Ring.Int
  • Data.Nat.Order.Basic across Data.Nat.Defs, Algebra.Order.Group.Nat, Algebra.Order.Ring.Nat
  • Data.Int.Order.Basic across Data.Int.Defs, Algebra.Order.Group.Int, Algebra.Order.Ring.Int

Also move a few lemmas from Data.Nat.Order.Lemmas to Data.Nat.Defs.

Before pre_11924

After post_11924

Diff
@@ -3,6 +3,7 @@ Copyright (c) 2020 Johan Commelin. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johan Commelin
 -/
+import Mathlib.Algebra.Order.Ring.CharZero
 import Mathlib.Data.Fintype.Order
 import Mathlib.Data.Set.Finite
 import Mathlib.Order.Category.FinPartOrd
doc(Order): remove some mathlib3 names in docs (#11953)
Diff
@@ -257,7 +257,7 @@ theorem nonemptyFinLinOrd_dual_comp_forget_to_linOrd :
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrd_dual_comp_forget_to_linOrd
 
-/-- The forgetful functor `NonemptyFinLinOrd ⥤ FinPartOrd` and `order_dual` commute. -/
+/-- The forgetful functor `NonemptyFinLinOrd ⥤ FinPartOrd` and `OrderDual` commute. -/
 def nonemptyFinLinOrdDualCompForgetToFinPartOrd :
     NonemptyFinLinOrd.dual ⋙ forget₂ NonemptyFinLinOrd FinPartOrd ≅
       forget₂ NonemptyFinLinOrd FinPartOrd ⋙ FinPartOrd.dual
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -164,7 +164,7 @@ theorem mono_iff_injective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrd.mono_iff_injective
 
--- porting note: added to ease the following proof
+-- Porting note: added to ease the following proof
 lemma forget_map_apply {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) (a : A) :
     (forget NonemptyFinLinOrd).map f a = (f : OrderHom A B).toFun a := rfl
 
chore: more backporting of simp changes from #10995 (#11001)

Co-authored-by: Patrick Massot <patrickmassot@free.fr> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -204,7 +204,7 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
         exact h₂ (le_of_lt h₁)
       · exfalso
         exact hm a (eq_of_le_of_not_lt h₂ h₁)
-    simp [DFunLike.coe] at h
+    simp [Y, DFunLike.coe] at h
   · intro h
     exact ConcreteCategory.epi_of_surjective f h
 set_option linter.uppercaseLean3 false in
chore: add issue number to instance was not necessary porting notes (#10671)

Adds issue number (#10670) to porting notes claiming instance was not necessary.

Diff
@@ -143,7 +143,7 @@ instance {A B : NonemptyFinLinOrd.{u}} : FunLike (A ⟶ B) A B where
     ext x
     exact congr_fun h x
 
--- porting note: this instance was not necessary in mathlib
+-- porting note (#10670): this instance was not necessary in mathlib
 instance {A B : NonemptyFinLinOrd.{u}} : OrderHomClass (A ⟶ B) A B where
   map_rel f _ _ h := f.monotone h
 
refactor(Data/FunLike): use unbundled inheritance from FunLike (#8386)

The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike is EquivLike, since that has a custom coe_injective' field that is easier to implement. All other classes should take FunLike or EquivLike as a parameter.

Zulip thread

Important changes

Previously, morphism classes would be Type-valued and extend FunLike:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

After this PR, they should be Prop-valued and take FunLike as a parameter:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  [FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

(Note that A B stay marked as outParam even though they are not purely required to be so due to the FunLike parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam is slightly faster.)

Similarly, MyEquivClass should take EquivLike as a parameter.

As a result, every mention of [MyHomClass F A B] should become [FunLike F A B] [MyHomClass F A B].

Remaining issues

Slower (failing) search

While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul is more expensive. This is due to suboptimal processing of arguments. For example:

variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)

theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y

example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _

Before this PR, applying map_mul f gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Since M and N are out_params, [MulHomClass F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found.

After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Now [FunLike F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found, before trying MulHomClass F M N which fails. Since the Mul hierarchy is very big, this can be slow to fail, especially when there is no such Mul instance.

A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N] because MulHomClass fails or succeeds much faster than the others.

As a consequence, the simpNF linter is much slower since by design it tries and fails to apply many map_ lemmas. The same issue occurs a few times in existing calls to simp [map_mul], where map_mul is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.

simp not firing sometimes

This affects map_smulₛₗ and related definitions. For simp lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw can find every argument to map_smulₛₗ successfully but simp can't: leanprover/lean4#3701.

Missing instances due to unification failing

Especially in the category theory library, we might sometimes have a type A which is also accessible as a synonym (Bundled A hA).1. Instance synthesis doesn't always work if we have f : A →* B but x * y : (Bundled A hA).1 or vice versa. This seems to be mostly fixed by keeping A B as outParams in MulHomClass F A B. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1 instead of using the syntax in the discrimination tree.)

Workaround for issues

The timeouts can be worked around for now by specifying which map_mul we mean, either as map_mul f for some explicit f, or as e.g. MonoidHomClass.map_mul.

map_smulₛₗ not firing as simp lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ a simp lemma instead of the generic map_smulₛₗ. Writing simp [map_smulₛₗ _] also works.

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -137,12 +137,14 @@ def dualEquiv : NonemptyFinLinOrd ≌ NonemptyFinLinOrd where
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrd.dualEquiv
 
--- porting note: this instance was not necessary in mathlib
-instance {A B : NonemptyFinLinOrd.{u}} : OrderHomClass (A ⟶ B) A B where
+instance {A B : NonemptyFinLinOrd.{u}} : FunLike (A ⟶ B) A B where
   coe f := ⇑(show OrderHom A B from f)
   coe_injective' _ _ h := by
     ext x
     exact congr_fun h x
+
+-- porting note: this instance was not necessary in mathlib
+instance {A B : NonemptyFinLinOrd.{u}} : OrderHomClass (A ⟶ B) A B where
   map_rel f _ _ h := f.monotone h
 
 theorem mono_iff_injective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
chore(*): shake imports (#10199)
  • Remove Data.Set.Basic from scripts/noshake.json.
  • Remove an exception that was used by examples only, move these examples to a new test file.
  • Drop an exception for Order.Filter.Basic dependency on Control.Traversable.Instances, as the relevant parts were moved to Order.Filter.ListTraverse.
  • Run lake exe shake --fix.
Diff
@@ -9,6 +9,7 @@ import Mathlib.Order.Category.FinPartOrd
 import Mathlib.Order.Category.LinOrd
 import Mathlib.CategoryTheory.Limits.Shapes.Images
 import Mathlib.CategoryTheory.Limits.Shapes.RegularMono
+import Mathlib.Data.Set.Basic
 
 #align_import order.category.NonemptyFinLinOrd from "leanprover-community/mathlib"@"fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19"
 
chore(*): rename FunLike to DFunLike (#9785)

This prepares for the introduction of a non-dependent synonym of FunLike, which helps a lot with keeping #8386 readable.

This is entirely search-and-replace in 680197f combined with manual fixes in 4145626, e900597 and b8428f8. The commands that generated this change:

sed -i 's/\bFunLike\b/DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoFunLike\b/toDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/import Mathlib.Data.DFunLike/import Mathlib.Data.FunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bHom_FunLike\b/Hom_DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean     
sed -i 's/\binstFunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bfunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoo many metavariables to apply `fun_like.has_coe_to_fun`/too many metavariables to apply `DFunLike.hasCoeToFun`/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean

Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -201,7 +201,7 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
         exact h₂ (le_of_lt h₁)
       · exfalso
         exact hm a (eq_of_le_of_not_lt h₂ h₁)
-    simp [FunLike.coe] at h
+    simp [DFunLike.coe] at h
   · intro h
     exact ConcreteCategory.epi_of_surjective f h
 set_option linter.uppercaseLean3 false in
chore: rename by_contra' to by_contra! (#8797)

To fit with the "please try harder" convention of ! tactics.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -170,7 +170,7 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
   constructor
   · intro
     dsimp only [Function.Surjective]
-    by_contra' hf'
+    by_contra! hf'
     rcases hf' with ⟨m, hm⟩
     let Y := NonemptyFinLinOrd.of (ULift (Fin 2))
     let p₁ : B ⟶ Y :=
chore: Remove Cat suffixes (#3730)

These names needn't change in the first place.

Diff
@@ -6,7 +6,7 @@ Authors: Johan Commelin
 import Mathlib.Data.Fintype.Order
 import Mathlib.Data.Set.Finite
 import Mathlib.Order.Category.FinPartOrd
-import Mathlib.Order.Category.LinOrdCat
+import Mathlib.Order.Category.LinOrd
 import Mathlib.CategoryTheory.Limits.Shapes.Images
 import Mathlib.CategoryTheory.Limits.Shapes.RegularMono
 
@@ -15,7 +15,7 @@ import Mathlib.CategoryTheory.Limits.Shapes.RegularMono
 /-!
 # Nonempty finite linear orders
 
-This defines `NonemptyFinLinOrdCat`, the category of nonempty finite linear
+This defines `NonemptyFinLinOrd`, the category of nonempty finite linear
 orders with monotone maps. This is the index category for simplicial objects.
 
 Note: `NonemptyFinLinOrd` is *not* a subcategory of `FinBddDistLat` because its morphisms do not
@@ -28,85 +28,85 @@ universe u v
 open CategoryTheory CategoryTheory.Limits
 
 /-- A typeclass for nonempty finite linear orders. -/
-class NonemptyFinLinOrd (α : Type*) extends Fintype α, LinearOrder α where
+class NonemptyFiniteLinearOrder (α : Type*) extends Fintype α, LinearOrder α where
   Nonempty : Nonempty α := by infer_instance
-#align nonempty_fin_lin_ord NonemptyFinLinOrd
+#align nonempty_fin_lin_ord NonemptyFiniteLinearOrder
 
-attribute [instance] NonemptyFinLinOrd.Nonempty
+attribute [instance] NonemptyFiniteLinearOrder.Nonempty
 
-instance (priority := 100) NonemptyFinLinOrd.toBoundedOrder (α : Type*) [NonemptyFinLinOrd α] :
-    BoundedOrder α :=
+instance (priority := 100) NonemptyFiniteLinearOrder.toBoundedOrder (α : Type*)
+  [NonemptyFiniteLinearOrder α] : BoundedOrder α :=
   Fintype.toBoundedOrder α
-#align nonempty_fin_lin_ord.to_bounded_order NonemptyFinLinOrd.toBoundedOrder
+#align nonempty_fin_lin_ord.to_bounded_order NonemptyFiniteLinearOrder.toBoundedOrder
 
-instance PUnit.nonemptyFinLinOrd : NonemptyFinLinOrd PUnit where
-#align punit.nonempty_fin_lin_ord PUnit.nonemptyFinLinOrd
+instance PUnit.nonemptyFiniteLinearOrder : NonemptyFiniteLinearOrder PUnit where
+#align punit.nonempty_fin_lin_ord PUnit.nonemptyFiniteLinearOrder
 
-instance Fin.nonemptyFinLinOrd (n : ℕ) : NonemptyFinLinOrd (Fin (n + 1)) where
-#align fin.nonempty_fin_lin_ord Fin.nonemptyFinLinOrd
+instance Fin.nonemptyFiniteLinearOrder (n : ℕ) : NonemptyFiniteLinearOrder (Fin (n + 1)) where
+#align fin.nonempty_fin_lin_ord Fin.nonemptyFiniteLinearOrder
 
-instance ULift.nonemptyFinLinOrd (α : Type u) [NonemptyFinLinOrd α] :
-    NonemptyFinLinOrd (ULift.{v} α) :=
+instance ULift.nonemptyFiniteLinearOrder (α : Type u) [NonemptyFiniteLinearOrder α] :
+    NonemptyFiniteLinearOrder (ULift.{v} α) :=
   { LinearOrder.lift' Equiv.ulift (Equiv.injective _) with }
-#align ulift.nonempty_fin_lin_ord ULift.nonemptyFinLinOrd
+#align ulift.nonempty_fin_lin_ord ULift.nonemptyFiniteLinearOrder
 
-instance (α : Type*) [NonemptyFinLinOrd α] : NonemptyFinLinOrd αᵒᵈ :=
+instance (α : Type*) [NonemptyFiniteLinearOrder α] : NonemptyFiniteLinearOrder αᵒᵈ :=
   { OrderDual.fintype α with }
 
 /-- The category of nonempty finite linear orders. -/
-def NonemptyFinLinOrdCat :=
-  Bundled NonemptyFinLinOrd
+def NonemptyFinLinOrd :=
+  Bundled NonemptyFiniteLinearOrder
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd NonemptyFinLinOrdCat
+#align NonemptyFinLinOrd NonemptyFinLinOrd
 
-namespace NonemptyFinLinOrdCat
+namespace NonemptyFinLinOrd
 
-instance : BundledHom.ParentProjection @NonemptyFinLinOrd.toLinearOrder :=
+instance : BundledHom.ParentProjection @NonemptyFiniteLinearOrder.toLinearOrder :=
   ⟨⟩
 
-deriving instance LargeCategory for NonemptyFinLinOrdCat
+deriving instance LargeCategory for NonemptyFinLinOrd
 
 -- Porting note: probably see https://github.com/leanprover-community/mathlib4/issues/5020
-instance : ConcreteCategory NonemptyFinLinOrdCat :=
+instance : ConcreteCategory NonemptyFinLinOrd :=
   BundledHom.concreteCategory _
 
-instance : CoeSort NonemptyFinLinOrdCat (Type*) :=
+instance : CoeSort NonemptyFinLinOrd Type* :=
   Bundled.coeSort
 
-/-- Construct a bundled `NonemptyFinLinOrdCat` from the underlying type and typeclass. -/
-def of (α : Type*) [NonemptyFinLinOrd α] : NonemptyFinLinOrdCat :=
+/-- Construct a bundled `NonemptyFinLinOrd` from the underlying type and typeclass. -/
+def of (α : Type*) [NonemptyFiniteLinearOrder α] : NonemptyFinLinOrd :=
   Bundled.of α
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd.of NonemptyFinLinOrdCat.of
+#align NonemptyFinLinOrd.of NonemptyFinLinOrd.of
 
 @[simp]
-theorem coe_of (α : Type*) [NonemptyFinLinOrd α] : ↥(of α) = α :=
+theorem coe_of (α : Type*) [NonemptyFiniteLinearOrder α] : ↥(of α) = α :=
   rfl
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd.coe_of NonemptyFinLinOrdCat.coe_of
+#align NonemptyFinLinOrd.coe_of NonemptyFinLinOrd.coe_of
 
-instance : Inhabited NonemptyFinLinOrdCat :=
+instance : Inhabited NonemptyFinLinOrd :=
   ⟨of PUnit⟩
 
-instance (α : NonemptyFinLinOrdCat) : NonemptyFinLinOrd α :=
+instance (α : NonemptyFinLinOrd) : NonemptyFiniteLinearOrder α :=
   α.str
 
-instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
+instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrd LinOrd :=
   BundledHom.forget₂ _ _
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
+#align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrd.hasForgetToLinOrd
 
-instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd where
+instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrd FinPartOrd where
   forget₂ :=
     { obj := fun X => FinPartOrd.of X
       map := @fun X Y => id }
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
+#align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrd.hasForgetToFinPartOrd
 
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
 @[simps]
-def Iso.mk {α β : NonemptyFinLinOrdCat.{u}} (e : α ≃o β) : α ≅ β where
+def Iso.mk {α β : NonemptyFinLinOrd.{u}} (e : α ≃o β) : α ≅ β where
   hom := (e : OrderHom _ _)
   inv := (e.symm : OrderHom _ _)
   hom_inv_id := by
@@ -116,40 +116,40 @@ def Iso.mk {α β : NonemptyFinLinOrdCat.{u}} (e : α ≃o β) : α ≅ β where
     ext x
     exact e.apply_symm_apply x
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrdCat.Iso.mk
+#align NonemptyFinLinOrd.iso.mk NonemptyFinLinOrd.Iso.mk
 
 /-- `OrderDual` as a functor. -/
 @[simps]
-def dual : NonemptyFinLinOrdCat ⥤ NonemptyFinLinOrdCat where
+def dual : NonemptyFinLinOrd ⥤ NonemptyFinLinOrd where
   obj X := of Xᵒᵈ
   map := OrderHom.dual
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd.dual NonemptyFinLinOrdCat.dual
+#align NonemptyFinLinOrd.dual NonemptyFinLinOrd.dual
 
-/-- The equivalence between `NonemptyFinLinOrdCat` and itself induced by `OrderDual` both ways. -/
+/-- The equivalence between `NonemptyFinLinOrd` and itself induced by `OrderDual` both ways. -/
 @[simps functor inverse]
-def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat where
+def dualEquiv : NonemptyFinLinOrd ≌ NonemptyFinLinOrd where
   functor := dual
   inverse := dual
   unitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X
   counitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrdCat.dualEquiv
+#align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrd.dualEquiv
 
 -- porting note: this instance was not necessary in mathlib
-instance {A B : NonemptyFinLinOrdCat.{u}} : OrderHomClass (A ⟶ B) A B where
+instance {A B : NonemptyFinLinOrd.{u}} : OrderHomClass (A ⟶ B) A B where
   coe f := ⇑(show OrderHom A B from f)
   coe_injective' _ _ h := by
     ext x
     exact congr_fun h x
   map_rel f _ _ h := f.monotone h
 
-theorem mono_iff_injective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
+theorem mono_iff_injective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
     Mono f ↔ Function.Injective f := by
   refine' ⟨_, ConcreteCategory.mono_of_injective f⟩
   intro
   intro a₁ a₂ h
-  let X := NonemptyFinLinOrdCat.of (ULift (Fin 1))
+  let X := NonemptyFinLinOrd.of (ULift (Fin 1))
   let g₁ : X ⟶ A := ⟨fun _ => a₁, fun _ _ _ => by rfl⟩
   let g₂ : X ⟶ A := ⟨fun _ => a₂, fun _ _ _ => by rfl⟩
   change g₁ (ULift.up (0 : Fin 1)) = g₂ (ULift.up (0 : Fin 1))
@@ -159,20 +159,20 @@ theorem mono_iff_injective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
   rw [cancel_mono] at eq
   rw [eq]
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrdCat.mono_iff_injective
+#align NonemptyFinLinOrd.mono_iff_injective NonemptyFinLinOrd.mono_iff_injective
 
 -- porting note: added to ease the following proof
-lemma forget_map_apply {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) (a : A) :
-    (forget NonemptyFinLinOrdCat).map f a = (f : OrderHom A B).toFun a := rfl
+lemma forget_map_apply {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) (a : A) :
+    (forget NonemptyFinLinOrd).map f a = (f : OrderHom A B).toFun a := rfl
 
-theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
+theorem epi_iff_surjective {A B : NonemptyFinLinOrd.{u}} (f : A ⟶ B) :
     Epi f ↔ Function.Surjective f := by
   constructor
   · intro
     dsimp only [Function.Surjective]
     by_contra' hf'
     rcases hf' with ⟨m, hm⟩
-    let Y := NonemptyFinLinOrdCat.of (ULift (Fin 2))
+    let Y := NonemptyFinLinOrd.of (ULift (Fin 2))
     let p₁ : B ⟶ Y :=
       ⟨fun b => if b < m then ULift.up 0 else ULift.up 1, fun x₁ x₂ h => by
         simp only
@@ -205,9 +205,9 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
   · intro h
     exact ConcreteCategory.epi_of_surjective f h
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd.epi_iff_surjective NonemptyFinLinOrdCat.epi_iff_surjective
+#align NonemptyFinLinOrd.epi_iff_surjective NonemptyFinLinOrd.epi_iff_surjective
 
-instance : SplitEpiCategory NonemptyFinLinOrdCat.{u} :=
+instance : SplitEpiCategory NonemptyFinLinOrd.{u} :=
   ⟨fun {X Y} f hf => by
     have H : ∀ y : Y, Nonempty (f ⁻¹' {y}) := by
       rw [epi_iff_surjective] at hf
@@ -231,10 +231,10 @@ instance : SplitEpiCategory NonemptyFinLinOrdCat.{u} :=
       have H : f (φ b) ≤ f (φ a) := f.monotone (le_of_lt h)
       simpa only [hφ] using H⟩
 
-instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrdCat.{u} :=
+instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrd.{u} :=
   ⟨fun {X Y} f => by
-    letI : NonemptyFinLinOrd (Set.image f ⊤) := ⟨by infer_instance⟩
-    let I := NonemptyFinLinOrdCat.of (Set.image f ⊤)
+    letI : NonemptyFiniteLinearOrder (Set.image f ⊤) := ⟨by infer_instance⟩
+    let I := NonemptyFinLinOrd.of (Set.image f ⊤)
     let e : X ⟶ I := ⟨fun x => ⟨f x, ⟨x, by tauto⟩⟩, fun x₁ x₂ h => f.monotone h⟩
     let m : I ⟶ Y := ⟨fun y => y.1, by tauto⟩
     haveI : Epi e := by
@@ -245,19 +245,19 @@ instance : HasStrongEpiMonoFactorisations NonemptyFinLinOrdCat.{u} :=
     haveI : Mono m := ConcreteCategory.mono_of_injective _ (fun x y h => Subtype.ext h)
     exact ⟨⟨I, m, e, rfl⟩⟩⟩
 
-end NonemptyFinLinOrdCat
+end NonemptyFinLinOrd
 
-theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat :
-    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat LinOrdCat =
-      forget₂ NonemptyFinLinOrdCat LinOrdCat ⋙ LinOrdCat.dual :=
+theorem nonemptyFinLinOrd_dual_comp_forget_to_linOrd :
+    NonemptyFinLinOrd.dual ⋙ forget₂ NonemptyFinLinOrd LinOrd =
+      forget₂ NonemptyFinLinOrd LinOrd ⋙ LinOrd.dual :=
   rfl
 set_option linter.uppercaseLean3 false in
-#align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat
+#align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrd_dual_comp_forget_to_linOrd
 
 /-- The forgetful functor `NonemptyFinLinOrd ⥤ FinPartOrd` and `order_dual` commute. -/
 def nonemptyFinLinOrdDualCompForgetToFinPartOrd :
-    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat FinPartOrd ≅
-      forget₂ NonemptyFinLinOrdCat FinPartOrd ⋙ FinPartOrd.dual
+    NonemptyFinLinOrd.dual ⋙ forget₂ NonemptyFinLinOrd FinPartOrd ≅
+      forget₂ NonemptyFinLinOrd FinPartOrd ⋙ FinPartOrd.dual
     where
   hom := { app := fun X => OrderHom.id }
   inv := { app := fun X => OrderHom.id }
chore: only four spaces for subsequent lines (#7286)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -163,7 +163,7 @@ set_option linter.uppercaseLean3 false in
 
 -- porting note: added to ease the following proof
 lemma forget_map_apply {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) (a : A) :
-  (forget NonemptyFinLinOrdCat).map f a = (f : OrderHom A B).toFun a := rfl
+    (forget NonemptyFinLinOrdCat).map f a = (f : OrderHom A B).toFun a := rfl
 
 theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
     Epi f ↔ Function.Surjective f := by
style: fix wrapping of where (#7149)
Diff
@@ -96,8 +96,8 @@ instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
 
-instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
-    where forget₂ :=
+instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd where
+  forget₂ :=
     { obj := fun X => FinPartOrd.of X
       map := @fun X Y => id }
 set_option linter.uppercaseLean3 false in
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -28,13 +28,13 @@ universe u v
 open CategoryTheory CategoryTheory.Limits
 
 /-- A typeclass for nonempty finite linear orders. -/
-class NonemptyFinLinOrd (α : Type _) extends Fintype α, LinearOrder α where
+class NonemptyFinLinOrd (α : Type*) extends Fintype α, LinearOrder α where
   Nonempty : Nonempty α := by infer_instance
 #align nonempty_fin_lin_ord NonemptyFinLinOrd
 
 attribute [instance] NonemptyFinLinOrd.Nonempty
 
-instance (priority := 100) NonemptyFinLinOrd.toBoundedOrder (α : Type _) [NonemptyFinLinOrd α] :
+instance (priority := 100) NonemptyFinLinOrd.toBoundedOrder (α : Type*) [NonemptyFinLinOrd α] :
     BoundedOrder α :=
   Fintype.toBoundedOrder α
 #align nonempty_fin_lin_ord.to_bounded_order NonemptyFinLinOrd.toBoundedOrder
@@ -50,7 +50,7 @@ instance ULift.nonemptyFinLinOrd (α : Type u) [NonemptyFinLinOrd α] :
   { LinearOrder.lift' Equiv.ulift (Equiv.injective _) with }
 #align ulift.nonempty_fin_lin_ord ULift.nonemptyFinLinOrd
 
-instance (α : Type _) [NonemptyFinLinOrd α] : NonemptyFinLinOrd αᵒᵈ :=
+instance (α : Type*) [NonemptyFinLinOrd α] : NonemptyFinLinOrd αᵒᵈ :=
   { OrderDual.fintype α with }
 
 /-- The category of nonempty finite linear orders. -/
@@ -70,17 +70,17 @@ deriving instance LargeCategory for NonemptyFinLinOrdCat
 instance : ConcreteCategory NonemptyFinLinOrdCat :=
   BundledHom.concreteCategory _
 
-instance : CoeSort NonemptyFinLinOrdCat (Type _) :=
+instance : CoeSort NonemptyFinLinOrdCat (Type*) :=
   Bundled.coeSort
 
 /-- Construct a bundled `NonemptyFinLinOrdCat` from the underlying type and typeclass. -/
-def of (α : Type _) [NonemptyFinLinOrd α] : NonemptyFinLinOrdCat :=
+def of (α : Type*) [NonemptyFinLinOrd α] : NonemptyFinLinOrdCat :=
   Bundled.of α
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd.of NonemptyFinLinOrdCat.of
 
 @[simp]
-theorem coe_of (α : Type _) [NonemptyFinLinOrd α] : ↥(of α) = α :=
+theorem coe_of (α : Type*) [NonemptyFinLinOrd α] : ↥(of α) = α :=
   rfl
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd.coe_of NonemptyFinLinOrdCat.coe_of
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2020 Johan Commelin. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johan Commelin
-
-! This file was ported from Lean 3 source module order.category.NonemptyFinLinOrd
-! leanprover-community/mathlib commit fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.Fintype.Order
 import Mathlib.Data.Set.Finite
@@ -15,6 +10,8 @@ import Mathlib.Order.Category.LinOrdCat
 import Mathlib.CategoryTheory.Limits.Shapes.Images
 import Mathlib.CategoryTheory.Limits.Shapes.RegularMono
 
+#align_import order.category.NonemptyFinLinOrd from "leanprover-community/mathlib"@"fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19"
+
 /-!
 # Nonempty finite linear orders
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -153,8 +153,8 @@ theorem mono_iff_injective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
   intro
   intro a₁ a₂ h
   let X := NonemptyFinLinOrdCat.of (ULift (Fin 1))
-  let g₁ : X ⟶ A := ⟨fun _ => a₁, fun _ _  _ => by rfl⟩
-  let g₂ : X ⟶ A := ⟨fun _ => a₂, fun _ _  _ => by rfl⟩
+  let g₁ : X ⟶ A := ⟨fun _ => a₁, fun _ _ _ => by rfl⟩
+  let g₂ : X ⟶ A := ⟨fun _ => a₂, fun _ _ _ => by rfl⟩
   change g₁ (ULift.up (0 : Fin 1)) = g₂ (ULift.up (0 : Fin 1))
   have eq : g₁ ≫ f = g₂ ≫ f := by
     ext
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊢ -> some_tactic at h ⊢
  • some_tactic at h -> some_tactic at h
Diff
@@ -225,7 +225,7 @@ instance : SplitEpiCategory NonemptyFinLinOrdCat.{u} :=
     · intro a b
       contrapose
       intro h
-      simp only [not_le] at h⊢
+      simp only [not_le] at h ⊢
       suffices b ≤ a by
         apply lt_of_le_of_ne this
         rintro rfl
feat: port Order.Category.HeytAlgCat (#5021)

Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>

Diff
@@ -69,6 +69,7 @@ instance : BundledHom.ParentProjection @NonemptyFinLinOrd.toLinearOrder :=
 
 deriving instance LargeCategory for NonemptyFinLinOrdCat
 
+-- Porting note: probably see https://github.com/leanprover-community/mathlib4/issues/5020
 instance : ConcreteCategory NonemptyFinLinOrdCat :=
   BundledHom.concreteCategory _
 
feat: change ConcreteCategory.hasCoeToFun to FunLike (#4693)
Diff
@@ -195,8 +195,8 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
       congr
       rw [← cancel_epi f]
       ext a
-      simp only [coe_of, FunctorToTypes.map_comp_apply]
-      simp only [forget_map_apply]
+      simp only [coe_of, comp_apply]
+      change ite _ _ _ = ite _ _ _
       split_ifs with h₁ h₂ h₂
       any_goals rfl
       · exfalso
chore: review of automation in category theory (#4793)

Clean up of automation in the category theory library. Leaving out unnecessary proof steps, or fields done by aesop_cat, and making more use of available autoparameters.

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -133,8 +133,8 @@ set_option linter.uppercaseLean3 false in
 def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat where
   functor := dual
   inverse := dual
-  unitIso := NatIso.ofComponents (fun X => Iso.mk <| OrderIso.dualDual X) (fun _ => rfl)
-  counitIso := NatIso.ofComponents (fun X => Iso.mk <| OrderIso.dualDual X) (fun _ => rfl)
+  unitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X
+  counitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd.dual_equiv NonemptyFinLinOrdCat.dualEquiv
 
Diff
@@ -4,12 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johan Commelin
 
 ! This file was ported from Lean 3 source module order.category.NonemptyFinLinOrd
-! leanprover-community/mathlib commit e8ac6315bcfcbaf2d19a046719c3b553206dac75
+! leanprover-community/mathlib commit fa4a805d16a9cd9c96e0f8edeb57dc5a07af1a19
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathlib.Data.Fintype.Order
 import Mathlib.Data.Set.Finite
+import Mathlib.Order.Category.FinPartOrd
 import Mathlib.Order.Category.LinOrdCat
 import Mathlib.CategoryTheory.Limits.Shapes.Images
 import Mathlib.CategoryTheory.Limits.Shapes.RegularMono
@@ -19,6 +20,9 @@ import Mathlib.CategoryTheory.Limits.Shapes.RegularMono
 
 This defines `NonemptyFinLinOrdCat`, the category of nonempty finite linear
 orders with monotone maps. This is the index category for simplicial objects.
+
+Note: `NonemptyFinLinOrd` is *not* a subcategory of `FinBddDistLat` because its morphisms do not
+preserve `⊥` and `⊤`.
 -/
 
 
@@ -94,6 +98,13 @@ instance hasForgetToLinOrd : HasForget₂ NonemptyFinLinOrdCat LinOrdCat :=
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd.has_forget_to_LinOrd NonemptyFinLinOrdCat.hasForgetToLinOrd
 
+instance hasForgetToFinPartOrd : HasForget₂ NonemptyFinLinOrdCat FinPartOrd
+    where forget₂ :=
+    { obj := fun X => FinPartOrd.of X
+      map := @fun X Y => id }
+set_option linter.uppercaseLean3 false in
+#align NonemptyFinLinOrd.has_forget_to_FinPartOrd NonemptyFinLinOrdCat.hasForgetToFinPartOrd
+
 /-- Constructs an equivalence between nonempty finite linear orders from an order isomorphism
 between them. -/
 @[simps]
@@ -117,7 +128,7 @@ def dual : NonemptyFinLinOrdCat ⥤ NonemptyFinLinOrdCat where
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd.dual NonemptyFinLinOrdCat.dual
 
-/-- The equivalence between `FinPartOrdCat` and itself induced by `OrderDual` both ways. -/
+/-- The equivalence between `NonemptyFinLinOrdCat` and itself induced by `OrderDual` both ways. -/
 @[simps functor inverse]
 def dualEquiv : NonemptyFinLinOrdCat ≌ NonemptyFinLinOrdCat where
   functor := dual
@@ -244,3 +255,13 @@ theorem nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat :
   rfl
 set_option linter.uppercaseLean3 false in
 #align NonemptyFinLinOrd_dual_comp_forget_to_LinOrd nonemptyFinLinOrdCat_dual_comp_forget_to_linOrdCat
+
+/-- The forgetful functor `NonemptyFinLinOrd ⥤ FinPartOrd` and `order_dual` commute. -/
+def nonemptyFinLinOrdDualCompForgetToFinPartOrd :
+    NonemptyFinLinOrdCat.dual ⋙ forget₂ NonemptyFinLinOrdCat FinPartOrd ≅
+      forget₂ NonemptyFinLinOrdCat FinPartOrd ⋙ FinPartOrd.dual
+    where
+  hom := { app := fun X => OrderHom.id }
+  inv := { app := fun X => OrderHom.id }
+set_option linter.uppercaseLean3 false in
+#align NonemptyFinLinOrd_dual_comp_forget_to_FinPartOrd nonemptyFinLinOrdDualCompForgetToFinPartOrd
chore: refactor of concrete categories (#3900)

I think the ports

didn't quite get things right, and also have some variation between them. This PR tries to straighten things out.

Major changes:

  • Have the coercion to type be via X.\a, and put attribute @[coe] on this.
  • Make sure the coercion from morphisms to functions means that simp lemmas about the underlying bundled morphisms apply directly.
    • This means we drop lemmas like
    lemma Hom.map_mul {X Y : MonCat} (f : X ⟶ Y) (x y : X) : ((forget MonCat).map f) (x * y) = f x * f y
    
    • But at the expense of adding lemmas like
    lemma coe_comp {X Y Z : MonCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl
    

Overall I'm pretty happy, and it allows me to unstick the long stuck https://github.com/leanprover-community/mathlib4/pull/3105.

This is not everything I want to do to refactor these files, but once I was satisfied that I can move forward with RingCat, I want to get this merged so we can unblock porting progress. I'll promise to come back to this soon! :-)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -184,7 +184,7 @@ theorem epi_iff_surjective {A B : NonemptyFinLinOrdCat.{u}} (f : A ⟶ B) :
       congr
       rw [← cancel_epi f]
       ext a
-      simp only [forget_obj_eq_coe, coe_of, FunctorToTypes.map_comp_apply]
+      simp only [coe_of, FunctorToTypes.map_comp_apply]
       simp only [forget_map_apply]
       split_ifs with h₁ h₂ h₂
       any_goals rfl
feat: port Order.Category.NonemptyFinLinOrd (#3282)

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Dependencies 6 + 293

294 files ported (98.0%)
117392 lines ported (98.2%)
Show graph

The unported dependencies are