Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
/- | |
Copyright (c) 2021 Oliver Nash. All rights reserved. | |
Released under Apache 2.0 license as described in the file LICENSE. | |
Authors: Oliver Nash | |
-/ | |
import algebra.algebra.basic | |
/-! | |
# Morphisms of non-unital algebras | |
This file defines morphisms between two types, each of which carries: | |
* an addition, | |
* an additive zero, | |
* a multiplication, | |
* a scalar action. | |
The multiplications are not assumed to be associative or unital, or even to be compatible with the | |
scalar actions. In a typical application, the operations will satisfy compatibility conditions | |
making them into algebras (albeit possibly non-associative and/or non-unital) but such conditions | |
are not required to make this definition. | |
This notion of morphism should be useful for any category of non-unital algebras. The motivating | |
application at the time it was introduced was to be able to state the adjunction property for | |
magma algebras. These are non-unital, non-associative algebras obtained by applying the | |
group-algebra construction except where we take a type carrying just `has_mul` instead of `group`. | |
For a plausible future application, one could take the non-unital algebra of compactly-supported | |
functions on a non-compact topological space. A proper map between a pair of such spaces | |
(contravariantly) induces a morphism between their algebras of compactly-supported functions which | |
will be a `non_unital_alg_hom`. | |
TODO: add `non_unital_alg_equiv` when needed. | |
## Main definitions | |
* `non_unital_alg_hom` | |
* `alg_hom.to_non_unital_alg_hom` | |
## Tags | |
non-unital, algebra, morphism | |
-/ | |
universes u v w wβ wβ wβ | |
variables (R : Type u) (A : Type v) (B : Type w) (C : Type wβ) | |
set_option old_structure_cmd true | |
/-- A morphism respecting addition, multiplication, and scalar multiplication. When these arise from | |
algebra structures, this is the same as a not-necessarily-unital morphism of algebras. -/ | |
structure non_unital_alg_hom [monoid R] | |
[non_unital_non_assoc_semiring A] [distrib_mul_action R A] | |
[non_unital_non_assoc_semiring B] [distrib_mul_action R B] | |
extends A β+[R] B, A ββ* B | |
infixr ` βββ `:25 := non_unital_alg_hom _ | |
notation A ` βββ[`:25 R `] ` B := non_unital_alg_hom R A B | |
attribute [nolint doc_blame] non_unital_alg_hom.to_distrib_mul_action_hom | |
attribute [nolint doc_blame] non_unital_alg_hom.to_mul_hom | |
/-- `non_unital_alg_hom_class F R A B` asserts `F` is a type of bundled algebra homomorphisms | |
from `A` to `B`. -/ | |
class non_unital_alg_hom_class (F : Type*) (R : out_param Type*) (A : out_param Type*) | |
(B : out_param Type*) [monoid R] | |
[non_unital_non_assoc_semiring A] [non_unital_non_assoc_semiring B] | |
[distrib_mul_action R A] [distrib_mul_action R B] | |
extends distrib_mul_action_hom_class F R A B, mul_hom_class F A B | |
-- `R` becomes a metavariable but that's fine because it's an `out_param` | |
attribute [nolint dangerous_instance] non_unital_alg_hom_class.to_mul_hom_class | |
namespace non_unital_alg_hom_class | |
variables [semiring R] | |
[non_unital_non_assoc_semiring A] [module R A] | |
[non_unital_non_assoc_semiring B] [module R B] | |
@[priority 100] -- see Note [lower instance priority] | |
instance {F : Type*} [non_unital_alg_hom_class F R A B] : linear_map_class F R A B := | |
{ map_smulββ := distrib_mul_action_hom_class.map_smul, | |
..βΉnon_unital_alg_hom_class F R A BβΊ } | |
end non_unital_alg_hom_class | |
namespace non_unital_alg_hom | |
variables {R A B C} [monoid R] | |
variables [non_unital_non_assoc_semiring A] [distrib_mul_action R A] | |
variables [non_unital_non_assoc_semiring B] [distrib_mul_action R B] | |
variables [non_unital_non_assoc_semiring C] [distrib_mul_action R C] | |
/-- see Note [function coercion] -/ | |
instance : has_coe_to_fun (A βββ[R] B) (Ξ» _, A β B) := β¨to_funβ© | |
@[simp] lemma to_fun_eq_coe (f : A βββ[R] B) : f.to_fun = βf := rfl | |
initialize_simps_projections non_unital_alg_hom (to_fun β apply) | |
lemma coe_injective : | |
@function.injective (A βββ[R] B) (A β B) coe_fn := | |
by rintro β¨f, _β© β¨g, _β© β¨hβ©; congr | |
instance : non_unital_alg_hom_class (A βββ[R] B) R A B := | |
{ coe := to_fun, | |
coe_injective' := coe_injective, | |
map_smul := Ξ» f, f.map_smul', | |
map_add := Ξ» f, f.map_add', | |
map_zero := Ξ» f, f.map_zero', | |
map_mul := Ξ» f, f.map_mul' } | |
@[ext] lemma ext {f g : A βββ[R] B} (h : β x, f x = g x) : f = g := | |
coe_injective $ funext h | |
lemma ext_iff {f g : A βββ[R] B} : f = g β β x, f x = g x := | |
β¨by { rintro rfl x, refl }, extβ© | |
lemma congr_fun {f g : A βββ[R] B} (h : f = g) (x : A) : f x = g x := h βΈ rfl | |
@[simp] lemma coe_mk (f : A β B) (hβ hβ hβ hβ) : | |
((β¨f, hβ, hβ, hβ, hββ© : A βββ[R] B) : A β B) = f := | |
rfl | |
@[simp] lemma mk_coe (f : A βββ[R] B) (hβ hβ hβ hβ) : | |
(β¨f, hβ, hβ, hβ, hββ© : A βββ[R] B) = f := | |
by { ext, refl, } | |
instance : has_coe (A βββ[R] B) (A β+[R] B) := | |
β¨to_distrib_mul_action_homβ© | |
instance : has_coe (A βββ[R] B) (A ββ* B) := β¨to_mul_homβ© | |
@[simp] lemma to_distrib_mul_action_hom_eq_coe (f : A βββ[R] B) : | |
f.to_distrib_mul_action_hom = βf := | |
rfl | |
@[simp] lemma to_mul_hom_eq_coe (f : A βββ[R] B) : f.to_mul_hom = βf := | |
rfl | |
@[simp, norm_cast] lemma coe_to_distrib_mul_action_hom (f : A βββ[R] B) : | |
((f : A β+[R] B) : A β B) = f := | |
rfl | |
@[simp, norm_cast] lemma coe_to_mul_hom (f : A βββ[R] B) : | |
((f : A ββ* B) : A β B) = f := | |
rfl | |
lemma to_distrib_mul_action_hom_injective {f g : A βββ[R] B} | |
(h : (f : A β+[R] B) = (g : A β+[R] B)) : f = g := | |
by { ext a, exact distrib_mul_action_hom.congr_fun h a, } | |
lemma to_mul_hom_injective {f g : A βββ[R] B} | |
(h : (f : A ββ* B) = (g : A ββ* B)) : f = g := | |
by { ext a, exact mul_hom.congr_fun h a, } | |
@[norm_cast] lemma coe_distrib_mul_action_hom_mk (f : A βββ[R] B) (hβ hβ hβ hβ) : | |
((β¨f, hβ, hβ, hβ, hββ© : A βββ[R] B) : A β+[R] B) = | |
β¨f, hβ, hβ, hββ© := | |
by { ext, refl, } | |
@[norm_cast] lemma coe_mul_hom_mk (f : A βββ[R] B) (hβ hβ hβ hβ) : | |
((β¨f, hβ, hβ, hβ, hββ© : A βββ[R] B) : A ββ* B) = β¨f, hββ© := | |
by { ext, refl, } | |
@[simp] protected lemma map_smul (f : A βββ[R] B) (c : R) (x : A) : | |
f (c β’ x) = c β’ f x := map_smul _ _ _ | |
@[simp] protected lemma map_add (f : A βββ[R] B) (x y : A) : | |
f (x + y) = (f x) + (f y) := map_add _ _ _ | |
@[simp] protected lemma map_mul (f : A βββ[R] B) (x y : A) : | |
f (x * y) = (f x) * (f y) := map_mul _ _ _ | |
@[simp] protected lemma map_zero (f : A βββ[R] B) : f 0 = 0 := map_zero _ | |
instance : has_zero (A βββ[R] B) := | |
β¨{ map_mul' := by simp, | |
.. (0 : A β+[R] B) }β© | |
instance : has_one (A βββ[R] A) := | |
β¨{ map_mul' := by simp, | |
.. (1 : A β+[R] A) }β© | |
@[simp] lemma coe_zero : ((0 : A βββ[R] B) : A β B) = 0 := rfl | |
@[simp] lemma coe_one : ((1 : A βββ[R] A) : A β A) = id := rfl | |
lemma zero_apply (a : A) : (0 : A βββ[R] B) a = 0 := rfl | |
lemma one_apply (a : A) : (1 : A βββ[R] A) a = a := rfl | |
instance : inhabited (A βββ[R] B) := β¨0β© | |
/-- The composition of morphisms is a morphism. -/ | |
def comp (f : B βββ[R] C) (g : A βββ[R] B) : A βββ[R] C := | |
{ .. (f : B ββ* C).comp (g : A ββ* B), | |
.. (f : B β+[R] C).comp (g : A β+[R] B) } | |
@[simp, norm_cast] lemma coe_comp (f : B βββ[R] C) (g : A βββ[R] B) : | |
(f.comp g : A β C) = (f : B β C) β (g : A β B) := | |
rfl | |
lemma comp_apply (f : B βββ[R] C) (g : A βββ[R] B) (x : A) : | |
f.comp g x = f (g x) := | |
rfl | |
/-- The inverse of a bijective morphism is a morphism. -/ | |
def inverse (f : A βββ[R] B) (g : B β A) | |
(hβ : function.left_inverse g f) (hβ : function.right_inverse g f) : | |
B βββ[R] A := | |
{ .. (f : A ββ* B).inverse g hβ hβ, | |
.. (f : A β+[R] B).inverse g hβ hβ } | |
@[simp] lemma coe_inverse (f : A βββ[R] B) (g : B β A) | |
(hβ : function.left_inverse g f) (hβ : function.right_inverse g f) : | |
(inverse f g hβ hβ : B β A) = g := | |
rfl | |
/-! ### Operations on the product type | |
Note that much of this is copied from [`linear_algebra/prod`](../../linear_algebra/prod). -/ | |
section prod | |
variables (R A B) | |
/-- The first projection of a product is a non-unital alg_hom. -/ | |
@[simps] | |
def fst : A Γ B βββ[R] A := | |
{ to_fun := prod.fst, | |
map_zero' := rfl, map_add' := Ξ» x y, rfl, map_smul' := Ξ» x y, rfl, map_mul' := Ξ» x y, rfl } | |
/-- The second projection of a product is a non-unital alg_hom. -/ | |
@[simps] | |
def snd : A Γ B βββ[R] B := | |
{ to_fun := prod.snd, | |
map_zero' := rfl, map_add' := Ξ» x y, rfl, map_smul' := Ξ» x y, rfl, map_mul' := Ξ» x y, rfl } | |
variables {R A B} | |
/-- The prod of two morphisms is a morphism. -/ | |
@[simps] def prod (f : A βββ[R] B) (g : A βββ[R] C) : (A βββ[R] B Γ C) := | |
{ to_fun := pi.prod f g, | |
map_zero' := by simp only [pi.prod, prod.zero_eq_mk, map_zero], | |
map_add' := Ξ» x y, by simp only [pi.prod, prod.mk_add_mk, map_add], | |
map_mul' := Ξ» x y, by simp only [pi.prod, prod.mk_mul_mk, map_mul], | |
map_smul' := Ξ» c x, by simp only [pi.prod, prod.smul_mk, map_smul, ring_hom.id_apply] } | |
lemma coe_prod (f : A βββ[R] B) (g : A βββ[R] C) : β(f.prod g) = pi.prod f g := rfl | |
@[simp] theorem fst_prod (f : A βββ[R] B) (g : A βββ[R] C) : | |
(fst R B C).comp (prod f g) = f := by ext; refl | |
@[simp] theorem snd_prod (f : A βββ[R] B) (g : A βββ[R] C) : | |
(snd R B C).comp (prod f g) = g := by ext; refl | |
@[simp] theorem prod_fst_snd : prod (fst R A B) (snd R A B) = 1 := | |
coe_injective pi.prod_fst_snd | |
/-- Taking the product of two maps with the same domain is equivalent to taking the product of | |
their codomains. -/ | |
@[simps] def prod_equiv : ((A βββ[R] B) Γ (A βββ[R] C)) β (A βββ[R] B Γ C) := | |
{ to_fun := Ξ» f, f.1.prod f.2, | |
inv_fun := Ξ» f, ((fst _ _ _).comp f, (snd _ _ _).comp f), | |
left_inv := Ξ» f, by ext; refl, | |
right_inv := Ξ» f, by ext; refl } | |
variables (R A B) | |
/-- The left injection into a product is a non-unital algebra homomorphism. -/ | |
def inl : A βββ[R] A Γ B := prod 1 0 | |
/-- The right injection into a product is a non-unital algebra homomorphism. -/ | |
def inr : B βββ[R] A Γ B := prod 0 1 | |
variables {R A B} | |
@[simp] theorem coe_inl : (inl R A B : A β A Γ B) = Ξ» x, (x, 0) := rfl | |
theorem inl_apply (x : A) : inl R A B x = (x, 0) := rfl | |
@[simp] theorem coe_inr : (inr R A B : B β A Γ B) = prod.mk 0 := rfl | |
theorem inr_apply (x : B) : inr R A B x = (0, x) := rfl | |
end prod | |
end non_unital_alg_hom | |
/-! ### Interaction with `alg_hom` -/ | |
namespace alg_hom | |
variables {R A B} [comm_semiring R] [semiring A] [semiring B] [algebra R A] [algebra R B] | |
@[priority 100] -- see Note [lower instance priority] | |
instance {F : Type*} [alg_hom_class F R A B] : non_unital_alg_hom_class F R A B := | |
{ map_smul := map_smul, | |
..βΉalg_hom_class F R A BβΊ } | |
/-- A unital morphism of algebras is a `non_unital_alg_hom`. -/ | |
def to_non_unital_alg_hom (f : A ββ[R] B) : A βββ[R] B := | |
{ map_smul' := map_smul f, .. f, } | |
instance non_unital_alg_hom.has_coe : has_coe (A ββ[R] B) (A βββ[R] B) := | |
β¨to_non_unital_alg_homβ© | |
@[simp] lemma to_non_unital_alg_hom_eq_coe (f : A ββ[R] B) : f.to_non_unital_alg_hom = f := | |
rfl | |
@[simp, norm_cast] lemma coe_to_non_unital_alg_hom (f : A ββ[R] B) : | |
((f : A βββ[R] B) : A β B) = f := | |
rfl | |
end alg_hom | |