Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: port Order.Category.HeytAlgCat #5021

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
79f5f56
feat: port Order.Category.BddLat
joneugster Jun 13, 2023
9eb7464
Initial file copy from mathport
joneugster Jun 13, 2023
ca3f522
automated fixes
joneugster Jun 13, 2023
814d90e
rename file
joneugster Jun 13, 2023
17496c2
feat: Free functor `Lat ⥤ BddLat`
YaelDillies May 11, 2023
0acea27
Update Mathlib/Order/Hom/Lattice.lean
YaelDillies May 19, 2023
cbc0240
fixes
joneugster Jun 13, 2023
571e29e
rename to BddLatCat
joneugster Jun 13, 2023
1cc39a8
fixes
joneugster Jun 13, 2023
dc43a54
typo
joneugster Jun 13, 2023
eeffc7c
feat: port Order.Category.BddDistLat
joneugster Jun 13, 2023
edf9934
Initial file copy from mathport
joneugster Jun 13, 2023
70c6b3c
automated fixes
joneugster Jun 13, 2023
6f3f407
Merge branch 'port/Order.Category.BddLat' into port/Order.Category.Bd…
joneugster Jun 13, 2023
7ab3c63
rename file
joneugster Jun 13, 2023
692091d
add Cat everywhere
joneugster Jun 13, 2023
d21f720
fixes
joneugster Jun 13, 2023
c45b10c
feat: port Order.Category.HeytAlg
joneugster Jun 13, 2023
28146e8
Initial file copy from mathport
joneugster Jun 13, 2023
7e909f2
automated fixes
joneugster Jun 13, 2023
a851cfe
Merge branch 'port/Order.Category.BddDistLat' into port/Order.Categor…
joneugster Jun 13, 2023
1cced5c
rename file
joneugster Jun 13, 2023
1c3112c
add Cat everywhere
joneugster Jun 13, 2023
d0f996c
add porting note issue in other files
joneugster Jun 13, 2023
e6a1246
fixes
joneugster Jun 13, 2023
ef6d433
Update Mathlib/Order/Category/HeytAlgCat.lean
joneugster Jun 14, 2023
9daa56b
Merge remote-tracking branch 'origin/master' into port/Order.Category…
joneugster Jun 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2248,10 +2248,13 @@ import Mathlib.Order.Bounded
import Mathlib.Order.BoundedOrder
import Mathlib.Order.Bounds.Basic
import Mathlib.Order.Bounds.OrderIso
import Mathlib.Order.Category.BddDistLatCat
import Mathlib.Order.Category.BddLatCat
import Mathlib.Order.Category.BddOrdCat
import Mathlib.Order.Category.DistLatCat
import Mathlib.Order.Category.FinPartOrd
import Mathlib.Order.Category.FrmCat
import Mathlib.Order.Category.HeytAlgCat
import Mathlib.Order.Category.LatCat
import Mathlib.Order.Category.LinOrdCat
import Mathlib.Order.Category.NonemptyFinLinOrdCat
Expand Down
4 changes: 4 additions & 0 deletions Mathlib/Algebra/Category/Ring/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ deriving instance LargeCategory for SemiRingCat

--Porting note: deriving fails for ConcreteCategory, adding instance manually.
--deriving instance LargeCategory, ConcreteCategory for SemiRingCat
-- see https://github.com/leanprover-community/mathlib4/issues/5020

instance : ConcreteCategory SemiRingCat := by
dsimp [SemiRingCat]
Expand Down Expand Up @@ -168,6 +169,7 @@ instance : BundledHom.ParentProjection @Ring.toSemiring :=

-- Porting note: Another place where mathlib had derived a concrete category
-- but this does not work here, so we add the instance manually.
-- see https://github.com/leanprover-community/mathlib4/issues/5020
deriving instance LargeCategory for RingCat

instance : ConcreteCategory RingCat := by
Expand Down Expand Up @@ -260,6 +262,7 @@ instance : BundledHom.ParentProjection @CommSemiring.toSemiring :=
⟨⟩

-- Porting note: again, deriving fails for concrete category instances.
-- see https://github.com/leanprover-community/mathlib4/issues/5020
deriving instance LargeCategory for CommSemiRingCat

instance : ConcreteCategory CommSemiRingCat := by
Expand Down Expand Up @@ -369,6 +372,7 @@ instance : BundledHom.ParentProjection @CommRing.toRing :=
⟨⟩

-- Porting note: deriving fails for concrete category.
-- see https://github.com/leanprover-community/mathlib4/issues/5020
deriving instance LargeCategory for CommRingCat

instance : ConcreteCategory CommRingCat := by
Expand Down
1 change: 1 addition & 0 deletions Mathlib/MeasureTheory/Category/MeasCat.lean
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ instance unbundledHom : UnbundledHom @Measurable :=
deriving instance LargeCategory for MeasCat

-- Porting note: `deriving instance ConcreteCategory for MeasCat` didn't work. Define it manually.
-- see https://github.com/leanprover-community/mathlib4/issues/5020
instance : ConcreteCategory MeasCat := by
unfold MeasCat
infer_instance
Expand Down
126 changes: 126 additions & 0 deletions Mathlib/Order/Category/BddDistLatCat.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/-
Copyright (c) 2022 Yaël Dillies. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies

! This file was ported from Lean 3 source module order.category.BddDistLat
! leanprover-community/mathlib commit e8ac6315bcfcbaf2d19a046719c3b553206dac75
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Order.Category.BddLatCat
import Mathlib.Order.Category.DistLatCat

/-!
# The category of bounded distributive lattices

This defines `BddDistLatCat`, the category of bounded distributive lattices.

Note that this category is sometimes called [`DistLat`](https://ncatlab.org/nlab/show/DistLat) when
being a lattice is understood to entail having a bottom and a top element.
-/

set_option linter.uppercaseLean3 false

universe u

open CategoryTheory

/-- The category of bounded distributive lattices with bounded lattice morphisms. -/
structure BddDistLatCat where
toDistLatCat : DistLatCat
[isBoundedOrder : BoundedOrder toDistLatCat]
#align BddDistLat BddDistLatCat

namespace BddDistLatCat

instance : CoeSort BddDistLatCat (Type _) :=
⟨fun X => X.toDistLatCat⟩

instance (X : BddDistLatCat) : DistribLattice X :=
X.toDistLatCat.str

attribute [instance] BddDistLatCat.isBoundedOrder

/-- Construct a bundled `BddDistLatCat` from a `BoundedOrder` `DistribLattice`. -/
def of (α : Type _) [DistribLattice α] [BoundedOrder α] : BddDistLatCat :=
-- Porting note: was `⟨⟨α⟩⟩`
-- see https://github.com/leanprover-community/mathlib4/issues/4998
⟨{α := α}⟩
#align BddDistLat.of BddDistLatCat.of

@[simp]
theorem coe_of (α : Type _) [DistribLattice α] [BoundedOrder α] : ↥(of α) = α :=
rfl
#align BddDistLat.coe_of BddDistLatCat.coe_of

instance : Inhabited BddDistLatCat :=
⟨of PUnit⟩

/-- Turn a `BddDistLatCat` into a `BddLatCat` by forgetting it is distributive. -/
def toBddLat (X : BddDistLatCat) : BddLatCat :=
BddLatCat.of X
#align BddDistLat.to_BddLat BddDistLatCat.toBddLat

@[simp]
theorem coe_toBddLat (X : BddDistLatCat) : ↥X.toBddLat = ↥X :=
rfl
#align BddDistLatCat.coe_to_BddLat BddDistLatCat.coe_toBddLat

instance : LargeCategory.{u} BddDistLatCat :=
InducedCategory.category toBddLat

instance : ConcreteCategory BddDistLatCat :=
InducedCategory.concreteCategory toBddLat

instance hasForgetToDistLat : HasForget₂ BddDistLatCat DistLatCat where
forget₂ :=
-- Porting note: was `⟨X⟩`
-- see https://github.com/leanprover-community/mathlib4/issues/4998
{ obj := fun X => { α := X}
joneugster marked this conversation as resolved.
Show resolved Hide resolved
map := fun {X Y} => BoundedLatticeHom.toLatticeHom }
#align BddDistLat.has_forget_to_DistLat BddDistLatCat.hasForgetToDistLat

instance hasForgetToBddLat : HasForget₂ BddDistLatCat BddLatCat :=
InducedCategory.hasForget₂ toBddLat
#align BddDistLat.has_forget_to_BddLat BddDistLatCat.hasForgetToBddLat

theorem forget_bddLat_latCat_eq_forget_distLatCat_latCat :
forget₂ BddDistLatCat BddLatCat ⋙ forget₂ BddLatCat LatCat =
forget₂ BddDistLatCat DistLatCat ⋙ forget₂ DistLatCat LatCat :=
rfl
#align BddDistLat.forget_BddLat_Lat_eq_forget_DistLat_Lat BddDistLatCat.forget_bddLat_latCat_eq_forget_distLatCat_latCat

/-- Constructs an equivalence between bounded distributive lattices from an order isomorphism
between them. -/
@[simps]
def Iso.mk {α β : BddDistLatCat.{u}} (e : α ≃o β) : α ≅ β where
hom := (e : BoundedLatticeHom α β)
inv := (e.symm : BoundedLatticeHom β α)
hom_inv_id := by ext; exact e.symm_apply_apply _
inv_hom_id := by ext; exact e.apply_symm_apply _
#align BddDistLat.iso.mk BddDistLatCat.Iso.mk

/-- `OrderDual` as a functor. -/
@[simps]
def dual : BddDistLatCat ⥤ BddDistLatCat where
obj X := of Xᵒᵈ
map {X Y} := BoundedLatticeHom.dual
#align BddDistLat.dual BddDistLatCat.dual

/-- The equivalence between `BddDistLatCat` and itself induced by `OrderDual` both ways. -/
@[simps functor inverse]
def dualEquiv : BddDistLatCat ≌ BddDistLatCat 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
#align BddDistLat.dual_equiv BddDistLatCat.dualEquiv

end BddDistLatCat

theorem bddDistLatCat_dual_comp_forget_to_distLatCat :
BddDistLatCat.dual ⋙ forget₂ BddDistLatCat DistLatCat =
forget₂ BddDistLatCat DistLatCat ⋙ DistLatCat.dual :=
rfl
#align BddDistLat_dual_comp_forget_to_DistLat bddDistLatCat_dual_comp_forget_to_distLatCat
Loading