-
Notifications
You must be signed in to change notification settings - Fork 373
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
feat(Algebra/Order/Hom): add quantale homomorphism #19291
base: master
Are you sure you want to change the base?
Changes from all commits
455a748
a60b10f
c488a7d
33a33c9
7913f82
0f08888
1190a65
b623b56
15babb8
50a1500
1ec5d12
2734c4a
af98150
8bc9f44
120eafe
03e05ad
b8c27e8
27a9144
1551fe7
547941a
3e9b865
47e3aa2
0f080dc
4a75852
206c5e4
7723983
a81f90e
70d0f50
c23bd96
338f754
8397c31
8e4e77b
a673241
3ccf5f3
ca29e95
8f2416b
cb533ec
1e1595d
9082b68
6d1141e
db7ada1
80e96f3
803078c
c602733
e7799fd
96ed693
dc50f88
c72a23f
cf1b028
2f0ddb0
a38d957
1a85bc0
ea22c9a
0eb1511
e312d98
aaa58b0
b359e2a
0fe63c1
8c9c4ea
f65082f
f6279c8
4cf572f
7f482d5
cbc174e
73c85fa
2f972bc
f453afb
4fc415d
0ee4973
bc155ea
4f7564f
e64091f
5c2f66b
75061bd
5d04d47
0e45960
2cd70aa
910a712
afdeacd
b70701f
81ffa5a
90f6b6f
42e849e
5d8e0be
ba025f8
03c4b15
56d7d15
ac623f0
27f739e
405922b
0b7645d
2c4c8d8
a7eb6cc
57b01f3
5631270
9de5f05
6adb04d
5201d35
f42ed4d
e29a83b
fc8c7c1
7e23b01
5189bc2
037409a
7e83e08
461c696
5a91b58
d7b78b1
ac28c76
efe3e33
64000c5
3a3587f
65dd0a6
156396e
e6e78c4
62e2feb
e5d71f1
41d9266
4fbad90
98939ff
45793ac
7534e27
c2866c7
383621d
88ee52a
7a2c1cc
e578735
9947593
38ca938
038cba2
55fbdb6
8671b83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,207 @@ | ||||||
/- | ||||||
Copyright (c) 2024 Pieter Cuijpers. All rights reserved. | ||||||
Released under Apache 2.0 license as described in the file LICENSE. | ||||||
Authors: Pieter Cuijpers | ||||||
-/ | ||||||
import Mathlib.Algebra.Group.Hom.Defs | ||||||
import Mathlib.Algebra.Order.Hom.Monoid | ||||||
import Mathlib.Algebra.Order.Quantale | ||||||
import Mathlib.Order.Hom.CompleteLattice | ||||||
|
||||||
/-! | ||||||
# Quantale homomorphism classes | ||||||
|
||||||
This file defines morphisms between (additive) quantales | ||||||
|
||||||
## Types of morphisms | ||||||
|
||||||
* `AddQuantaleHom`: Additive quantale homomorphisms | ||||||
* `QuantaleHom`: Quantale homomorphisms | ||||||
|
||||||
As isomorphism, `OrderMonoidIso` as defined in `Mathlib.Algebra.Order.Hom.Monoid` | ||||||
works also for (additive) Quantales, so we do not need to add any theory for them here. | ||||||
|
||||||
We do add theorems for identity and composition of (additive) quantale homs, as well | ||||||
as a theorem showing that any function that maps everything to `⊥` is a quantale hom. | ||||||
|
||||||
## Notation | ||||||
|
||||||
* `→ₙ+q`: Bundled additive (non-unital) quantale homs. | ||||||
* `→ₙ*q`: Bundled (non-unital) quantale homs. | ||||||
|
||||||
## Implementation notes | ||||||
|
||||||
The implementation follows largely the style of `Mathlib.Algebra.Order.Hom.Monoid`. | ||||||
|
||||||
There's a coercion from bundled homs to functions, and the canonical notation is to use the bundled hom | ||||||
as a function via this coercion. | ||||||
|
||||||
In the file `Mathlib.Algebra.Order.Hom.Monoid` it is mentioned that there used to be classes: | ||||||
`OrderAddMonoidHomClass` etc., but that in #10544 there was a migration from these typeclasses to | ||||||
assumptions like `[FunLike F M N] [MonoidHomClass F M N] [OrderHomClass F M N]`. | ||||||
We follow that approach here as well, and only define `AddQuantaleHom` without needing | ||||||
`AddQuantaleHomClass`. | ||||||
|
||||||
## Tags | ||||||
|
||||||
quantale, ordered semigroup, complete lattice | ||||||
|
||||||
-/ | ||||||
|
||||||
open Function | ||||||
|
||||||
variable {F α β γ δ : Type*} | ||||||
|
||||||
section AddQuantale | ||||||
|
||||||
/-- `α →ₙ+q β` is the type of monotone functions `α → β` that preserve the `AddQuantale` | ||||||
structure. | ||||||
|
||||||
When possible, instead of parametrizing results over `(f : α →ₙ+q β)`, | ||||||
you should parametrize over | ||||||
`(F : Type*) [FunLike F M N] [AddHomClass F M N] [CompleteLatticeHomClass F M N] (f : F)`. -/ | ||||||
structure AddQuantaleHom (α β : Type*) | ||||||
[AddSemigroup α] [CompleteLattice α] [AddSemigroup β] [CompleteLattice β] | ||||||
extends α →ₙ+ β, sSupHom α β | ||||||
|
||||||
/-- Converts an AddQuantaleHom to a sSupHom -/ | ||||||
add_decl_doc AddQuantaleHom.tosSupHom | ||||||
|
||||||
/-- Infix notation for `AddQuantaleHom`. -/ | ||||||
infixr:25 " →ₙ+q " => AddQuantaleHom | ||||||
|
||||||
-- Instances and lemmas are defined below through `@[to_additive]`. | ||||||
|
||||||
end AddQuantale | ||||||
|
||||||
section Quantale | ||||||
|
||||||
/-- `α →ₙ*q β` is the type of monotone functions `α → β` that preserve the `Quantale` | ||||||
structure. | ||||||
|
||||||
When possible, instead of parametrizing results over `(f : α →ₙ*q β)`, | ||||||
you should parametrize over | ||||||
`(F : Type*) [FunLike F M N] [MulHomClass F M N] [CompleteLatticeHomClass F M N] (f : F)`. -/ | ||||||
@[to_additive existing] | ||||||
structure QuantaleHom (α β : Type*) | ||||||
[Semigroup α] [CompleteLattice α] [Semigroup β] [CompleteLattice β] | ||||||
extends α →ₙ* β, sSupHom α β | ||||||
|
||||||
/-- Converts a QuantaleHom to a sSupHom -/ | ||||||
add_decl_doc QuantaleHom.tosSupHom | ||||||
|
||||||
/-- Infix notation for `QuantaleHom`. -/ | ||||||
infixr:25 " →ₙ*q " => QuantaleHom | ||||||
|
||||||
variable [Semigroup α] [Semigroup β] [CompleteLattice α] [CompleteLattice β] [FunLike F α β] | ||||||
|
||||||
/-- Turn an element of a type `F` satisfying `MulHomClass F α β` and `sSupHomClass F α β` | ||||||
into an actual `QuantaleHom`. This is declared as the default coercion from `F` to `α →ₙ*q β`. -/ | ||||||
@[to_additive (attr := coe) | ||||||
"Turn an element of a type `F` satisfying `AddHomClass F α β` and `sSupHomClass F α β` | ||||||
into an actual `AddQuantaleHom`. This is declared as the default coercion from `F` to `α →ₙ+q β`."] | ||||||
def QuantaleHom.ofClass [MulHomClass F α β] [sSupHomClass F α β] (f : F) : | ||||||
PieterCuijpers marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
α →ₙ*q β := { (f : α →ₙ* β) with map_sSup' := sSupHomClass.map_sSup f } | ||||||
|
||||||
end Quantale | ||||||
|
||||||
namespace QuantaleHom | ||||||
|
||||||
variable [Semigroup α] [Semigroup β] [Semigroup γ] [Semigroup δ] | ||||||
[CompleteLattice α] [CompleteLattice β] [CompleteLattice γ] [CompleteLattice δ] | ||||||
{f g : α →ₙ*q β} | ||||||
|
||||||
@[to_additive] | ||||||
instance : FunLike (α →ₙ*q β) α β where | ||||||
coe f := f.toFun | ||||||
coe_injective' f g h := by | ||||||
obtain ⟨⟨ _ ⟩, _⟩ := f | ||||||
congr | ||||||
|
||||||
@[to_additive] | ||||||
instance : MulHomClass (α →ₙ*q β) α β where | ||||||
map_mul f _ _ := f.map_mul' _ _ | ||||||
|
||||||
@[to_additive] | ||||||
instance : sSupHomClass (α →ₙ*q β) α β where | ||||||
map_sSup f := f.map_sSup' | ||||||
|
||||||
@[to_additive] | ||||||
instance : OrderHomClass (α →ₙ*q β) α β where | ||||||
map_rel f := by apply (f : OrderHom α β).monotone' | ||||||
|
||||||
@[to_additive (attr := ext)] | ||||||
theorem ext (h : ∀ a, f a = g a) : f = g := | ||||||
DFunLike.ext f g h | ||||||
|
||||||
@[to_additive] | ||||||
theorem toFun_eq_coe (f : α →ₙ*q β) : f.toFun = (f : α → β) := rfl | ||||||
|
||||||
@[to_additive (attr := simp)] | ||||||
theorem coe_mk (f : α →ₙ* β) (h) : mk f h = f := rfl | ||||||
|
||||||
@[to_additive (attr := simp)] | ||||||
theorem mk_coe (f : α →ₙ*q β) (h) : mk (f : α →ₙ* β) h = f := rfl | ||||||
|
||||||
section Id | ||||||
|
||||||
/-- The identity map as a quantale homomorphism. -/ | ||||||
@[to_additive "The identity map as an additive quantale homomorphism."] | ||||||
protected def id : α →ₙ*q α where | ||||||
toFun x := x | ||||||
map_mul' _ _ := rfl | ||||||
map_sSup' _ := by simp_all only [Set.image_id'] | ||||||
|
||||||
@[to_additive (attr := simp)] | ||||||
theorem coe_id : ⇑(.id : α →ₙ*q α) = id := rfl | ||||||
|
||||||
@[to_additive] | ||||||
instance : Inhabited (α →ₙ*q α) := ⟨.id⟩ | ||||||
|
||||||
end Id | ||||||
|
||||||
section Comp | ||||||
|
||||||
/-- Composition of `QuantaleHom`s as a `QuantaleHom`. -/ | ||||||
@[to_additive "Composition of `AddQuantaleHom`s as an `AddQuantaleHom`"] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
def comp (f : β →ₙ*q γ) (g : α →ₙ*q β) : α →ₙ*q γ := | ||||||
{f.toMulHom.comp (g : α →ₙ* β), f.tosSupHom.comp (g : sSupHom α β) with } | ||||||
|
||||||
@[to_additive (attr := simp)] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
theorem coe_comp (f : β →ₙ*q γ) (g : α →ₙ*q β) : (f.comp g : α → γ) = f ∘ g := | ||||||
rfl | ||||||
|
||||||
@[to_additive (attr := simp)] | ||||||
theorem comp_apply (f : β →ₙ*q γ) (g : α →ₙ*q β) (a : α) : (f.comp g) a = f (g a) := | ||||||
rfl | ||||||
|
||||||
@[to_additive (attr := simp)] | ||||||
theorem comp_assoc (f : γ →ₙ*q δ) (g : β →ₙ*q γ) (h : α →ₙ*q β) : | ||||||
(f.comp g).comp h = f.comp (g.comp h) := | ||||||
rfl | ||||||
|
||||||
@[to_additive (attr := simp)] | ||||||
theorem comp_id (f : α →ₙ*q β) : f.comp (@QuantaleHom.id α _ _) = f := | ||||||
rfl | ||||||
|
||||||
@[to_additive (attr := simp)] | ||||||
theorem id_comp (f : α →ₙ*q β) : (@QuantaleHom.id β _ _).comp f = f := | ||||||
rfl | ||||||
|
||||||
end Comp | ||||||
|
||||||
section Bot | ||||||
|
||||||
/-- `⊥` is the quantale homomorphism sending all elements to `⊥`. -/ | ||||||
@[to_additive "`⊥` is the quantale homomorphism sending all elements to `⊥`."] | ||||||
instance [IsQuantale β] : Bot (α →ₙ*q β) := ⟨{ (⊥ : sSupHom α β) with | ||||||
map_mul' := by | ||||||
simp only [sSupHom.toFun_eq_coe, sSupHom.bot_apply, IsQuantale.mul_bot, implies_true] | ||||||
}⟩ | ||||||
|
||||||
@[to_additive (attr := simp)] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
theorem coe_bot [IsQuantale β] : ⇑(⊥ : α →ₙ*q β) = ⊥ := rfl | ||||||
|
||||||
end Bot | ||||||
|
||||||
end QuantaleHom |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,6 +437,7 @@ | |
"Mathlib.Algebra.Star.Module": ["Mathlib.Algebra.Module.LinearMap.Star"], | ||
"Mathlib.Algebra.Ring.CentroidHom": ["Mathlib.Algebra.Algebra.Defs"], | ||
"Mathlib.Algebra.Order.Quantale": ["Mathlib.Tactic.Variable"], | ||
"Mathlib.Algebra.Order.Hom.Quantale": ["Mathlib.Algebra.Order.Hom.Monoid"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this necessary? |
||
"Mathlib.Algebra.Order.CauSeq.Basic": ["Mathlib.Data.Setoid.Basic"], | ||
"Mathlib.Algebra.MonoidAlgebra.Basic": | ||
["Mathlib.LinearAlgebra.Finsupp.SumProd"], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is broken in this sentence?