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] - chore(*): bump to lean 3.34.0 #9824

Closed
wants to merge 129 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
8db6608
Snapshot
urkud Mar 25, 2021
346a2e2
Switch to a new tag
urkud Mar 26, 2021
a0326d8
Merge branch 'master' into coe-fn-backport
urkud Mar 26, 2021
7bfde98
migrate more
urkud Mar 26, 2021
da0284f
Fix simps
urkud Mar 28, 2021
e45c8fc
Fix here and there
urkud Mar 28, 2021
7ba9c9e
Fix
urkud Mar 28, 2021
9d9daee
Snapshot
urkud Mar 31, 2021
c4af640
Merge branch 'master' into coe-fn-backport
urkud Mar 31, 2021
3b84220
...
urkud Mar 31, 2021
15c2a6d
try fix elementwise
b-mehta Apr 1, 2021
5ae5ef4
fix more?
b-mehta Apr 1, 2021
2cbd529
fix more
b-mehta Apr 1, 2021
b584b10
Fix more
urkud Apr 1, 2021
1459c7a
Fix
urkud Apr 1, 2021
2ff65b1
Fix
urkud Apr 2, 2021
2fbc072
Fix
urkud Apr 3, 2021
2dd2c14
Fix
urkud Apr 3, 2021
c96d47c
Fix
urkud Apr 3, 2021
07d3c49
Fix
urkud Apr 3, 2021
b05bfaf
Fix
urkud Apr 3, 2021
18f569f
Fix
urkud Apr 3, 2021
dc0ef1a
Fix
urkud Apr 3, 2021
3788dda
Fix
urkud Apr 3, 2021
d381cad
Fix
urkud Apr 3, 2021
9e5bb36
Fix some tests
urkud Apr 3, 2021
2088ac1
Update lean
urkud Sep 12, 2021
1db6830
Merge branch 'master' into coe-fn-backport
urkud Sep 12, 2021
78482c4
Snapshot
urkud Sep 12, 2021
255dd48
Merge branch 'master' into coe-fn-backport
urkud Sep 17, 2021
e3df125
Update lean
urkud Sep 17, 2021
7be4ede
Revert whiespace
urkud Sep 17, 2021
d936e7b
Update `combinatorics/quiver.lean`
Vierkantor Sep 17, 2021
36604bc
Fix `data/finset/basic.lean`
Vierkantor Sep 17, 2021
4c35cd2
Fix `data/fintype/basic.lean`
Vierkantor Sep 17, 2021
fb69000
Use a `derive` to get `coe_to_sort`
Vierkantor Sep 17, 2021
fafab15
Fix some compile failures
urkud Sep 17, 2021
c33a3bd
Merge branch 'coe-fn-backport' of git://github.com/leanprover-communi…
urkud Sep 17, 2021
0e9759b
Fix `number_theory/dioph.lean`
Vierkantor Sep 17, 2021
12c6985
Fix data.real.basic
urkud Sep 17, 2021
e6917c6
Fix `group_theory/perm/cycles.lean`
Vierkantor Sep 18, 2021
9a63b71
Fix `combinatorics/derangements/basic.lean`
Vierkantor Sep 18, 2021
a10bb11
Fix `topology/fiber_bundle.lean`
Vierkantor Sep 18, 2021
70f8908
Fix `topology/continouous_function/basic.lean`
Vierkantor Sep 18, 2021
de2d84a
Fix `topology/discrete_quotient.lean`
Vierkantor Sep 18, 2021
5a51c08
Fix `linear_algebra/basic.lean`
Vierkantor Sep 18, 2021
6b5daf2
Fix `linear_algebra/basis.lean`
Vierkantor Sep 18, 2021
2615680
Fix `algebra/quaternion.lean`
Vierkantor Sep 18, 2021
ac1d087
Fix `algebra/non_unital_alg_hom.lean`
Vierkantor Sep 18, 2021
300d833
fix Module/adjunctions
semorrison Sep 20, 2021
cec74a0
Merge remote-tracking branch 'mathlib/master' into coe-fn-backport
Vierkantor Sep 22, 2021
c4a3b58
Fix `data/equiv/module.lean`
Vierkantor Sep 22, 2021
41b2e93
Fix `ring_theory/localization.lean`
Vierkantor Sep 22, 2021
31de3a4
Fix `topology/algebra/weak_dual_topology`
Vierkantor Sep 22, 2021
582d6e9
Fix `topology/homotopy.lean` (add param to `has_coe_to_fun`)
Vierkantor Sep 22, 2021
e3d8760
Fix `algebra/cateogry/FinVect.lean` (add param to `has_coe_to_sort`, …
Vierkantor Sep 22, 2021
0238c87
Add non-dependent versions of `coe_fn_coe_trans` and `coe_fn_coe_base`
Vierkantor Sep 22, 2021
8820f18
Use `coe_fn_coe_base'` to clean up proofs
Vierkantor Sep 22, 2021
a35c254
Fix `linear_algebra/alternating.lean`: `coe_inj` has become `coe_inje…
Vierkantor Sep 22, 2021
34ecd95
Merge remote-tracking branch 'mathlib/master' into coe-fn-backport
Vierkantor Sep 24, 2021
4e4d38a
Fix `topology/continuous_function/algebra.lean` (`coe_fn_coe_base'`)
Vierkantor Sep 28, 2021
dba2679
Fix `algebraic_topology/topological_simplex.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
307050a
Fix `data/complex/basic.lean` (number defaulting to ℕ)
Vierkantor Sep 28, 2021
4563292
Fix `analysis/normed_space/affine_isometry.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
46026fd
Fix `topology/category/CompHaus/default.lean` (new `has_coe_to_sort`)
Vierkantor Sep 28, 2021
76978ff
Fix `linear_algebra/special_linear_group.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
8756b40
Fix `topology/category/Profinite/default.lean` (new `has_coe_to_sort`)
Vierkantor Sep 28, 2021
f2ecc5e
Fix `topology/partition_of_unity.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
b464637
Fix `analysis/normed_space/SemiNormedGroup.lean` (`has_coe_to_sort`, …
Vierkantor Sep 28, 2021
21cfd88
Fix `number_theory/padics/padic_integers.lean` (number defaulting)
Vierkantor Sep 28, 2021
78062c1
Fix `measure_theory/measure/measure_space_def.lean` (new `has_coe_to_…
Vierkantor Sep 28, 2021
fb258a9
Fix `measure_theory/measure/measure_space.lean` (elaborator regression)
Vierkantor Sep 28, 2021
ee0f765
Fix `topology/continuous_function/stone_weierstrass.lean` (`coe_fn_co…
Vierkantor Sep 28, 2021
1f1a2f3
Fix `ring_theory/fractional_ideal.lean` (number defaulting)
Vierkantor Sep 28, 2021
0059ac7
Fix `ring_theory/hahn_series.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
98663c3
Fix `measure_theory/measure/finite_measure_weak_convergence.lean` (ne…
Vierkantor Sep 28, 2021
5ab91ca
Fix `measure_theory/measure/vector_measure.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
158ca52
Fix `measure_theory/measure/stieltjes.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
0472bcc
Fix `measure_theory/measure/content.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
27bc8b1
Fix `geometry/manifold/partition_of_unity.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
f10356f
Fix `geometry/manifold/derivation_bundle.lean` (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
c6ccb29
Fix `geometry/manifold/algebra/left_invariant_derivation.lean` (new `…
Vierkantor Sep 28, 2021
176412b
Fix `measure_theory/function/conditional_expectation.lean` (`coe_fn_c…
Vierkantor Sep 28, 2021
7b4a725
Fix `topology/metric_space/gromov_hausdorff_realized.lean` (proof got…
Vierkantor Sep 28, 2021
6b72e33
Fix some tests (new `has_coe_to_fun`)
Vierkantor Sep 28, 2021
d06a1b4
Merge remote-tracking branch 'mathlib/master' into coe-fn-backport
Vierkantor Sep 28, 2021
f506cde
Fix timeout by splitting proof
Vierkantor Sep 28, 2021
eef0139
Merge remote-tracking branch 'mathlib/master' into coe-fn-backport
Vierkantor Oct 12, 2021
488a498
Fix `order/jordan_holder.lean` (new `has_coe_to_fun`)
Vierkantor Oct 12, 2021
5fcc1c2
Fix `linear_algebra/general_linear_group.lean` (new `has_coe_to_fun`,…
Vierkantor Oct 12, 2021
86b8b87
Fix `topology/homotopy/basic.lean` (new `has_coe_to_fun`)
Vierkantor Oct 13, 2021
2c4308d
Fix `topology/homotopy/path.lean` (new `has_coe_to_fun`)
Vierkantor Oct 13, 2021
3f768b5
Fix `ring_theory/algebraic_independent` (timeout, split proof)
Vierkantor Oct 13, 2021
8ded770
Fix `ring_theory/perfection.lean` (timeout, by golfing and helping th…
Vierkantor Oct 13, 2021
20f1bcd
Fix `tactic/norm_{fin,swap}.lean` (new `has_coe_to_fun`)
Vierkantor Oct 13, 2021
9a2c6d8
Fix overlong line
Vierkantor Oct 13, 2021
40e7530
Merge remote-tracking branch 'mathlib/master' into coe-fn-backport
Vierkantor Oct 15, 2021
25e8750
Fix `counterexamples/philips.lean` (new `has_coe_to_fun`)
Vierkantor Oct 19, 2021
9fabfea
Merge remote-tracking branch 'mathlib/master' into coe-fn-backport
Vierkantor Oct 19, 2021
0ce4e33
Fix `analysis/box_integral/partition/additive.lean` (new `has_coe_to_…
Vierkantor Oct 19, 2021
9ae191f
initial attempt at adapting to lean/619 and lean/620
semorrison Oct 20, 2021
6c9d189
more fixes
semorrison Oct 20, 2021
08db829
more fixes
semorrison Oct 20, 2021
0476392
Generalize the lexicographic order to `has_lt`/`has_le`
Vierkantor Oct 20, 2021
b05a55c
Add `has_to_format` for `lex` (needed for using it in tactics)
Vierkantor Oct 20, 2021
29523a6
Explicitly use lexicographic order on pairs in `linarith`
Vierkantor Oct 20, 2021
484b8d0
Fix `testing/slim_check/testable.lean` (new `open`)
Vierkantor Oct 20, 2021
62b4859
Fix `linear_algebra/basic.lean` (new `open`)
Vierkantor Oct 20, 2021
5019dc3
Fix `topology/connected.lean` (smarter `by_contra`)
Vierkantor Oct 20, 2021
f5b5550
Fix `category_theory/simple.lean` (smarter `by_contra`)
Vierkantor Oct 20, 2021
e6209d2
Fix `category_theory/monad/products.lean` (new `open`)
Vierkantor Oct 20, 2021
2a26b30
Fix `src/topology/algebra/module.lean` (new `open`)
Vierkantor Oct 20, 2021
2c8a6f9
Fix `src/topology/metric_space/emetric_space.lean` (new `open`)
Vierkantor Oct 20, 2021
df59405
Fix `category_theory/linear/yoneda.lean` (new `open`)
Vierkantor Oct 20, 2021
a5e0182
Fix `topology/metric_space/gluing.lean` (new `open`)
Vierkantor Oct 20, 2021
28b34f7
Fix `src/group_theory/specific_groups/dihedral.lean` (smarter `by_con…
Vierkantor Oct 20, 2021
160e36e
Fix `src/algebra/lie/tensor_product.lean` (new `open`)
Vierkantor Oct 20, 2021
72c139e
fix `number_theory/fermat4` (smarter `by_contra`)
urkud Oct 20, 2021
31245ba
Fix `open` in a few files
urkud Oct 20, 2021
b38e6e5
Move `open`
urkud Oct 20, 2021
f843a6e
fix: structure_sheaf (fully qualified open)
semorrison Oct 20, 2021
c259297
fix: witt_vector/is_poly (move open)
semorrison Oct 20, 2021
0c531be
fix(ring_theory/jacobson): move open
semorrison Oct 20, 2021
570c595
fix(ring_theory/roots_of_unity): smarter by_contra
semorrison Oct 20, 2021
dee208c
fix(ring_theory/roots_of_unity): smarter by_contra
semorrison Oct 20, 2021
05dda76
fix(measure_theory/integral/mean_equalities): smarter by_contra
semorrison Oct 20, 2021
b61983d
fix(measure_theory/function/lp_space): smarter by_contra
semorrison Oct 20, 2021
a933e9e
fix(geometry/euclidean/basic): smarter by_contra
semorrison Oct 20, 2021
de6f78d
Update src/tactic/linarith/preprocessing.lean
urkud Oct 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion counterexamples/phillips.lean
Expand Up @@ -163,7 +163,7 @@ instance : inhabited (bounded_additive_measure α) :=
additive' := λ s t hst, by simp,
exists_bound := ⟨0, λ s, by simp⟩ }⟩

instance : has_coe_to_fun (bounded_additive_measure α) := ⟨_, λ f, f.to_fun⟩
instance : has_coe_to_fun (bounded_additive_measure α) _, set α → ℝ) := ⟨λ f, f.to_fun⟩

namespace bounded_additive_measure

Expand Down
2 changes: 1 addition & 1 deletion leanpkg.toml
@@ -1,7 +1,7 @@
[package]
name = "mathlib"
version = "0.1"
lean_version = "leanprover-community/lean:3.33.0"
lean_version = "leanprover-community/lean:3.34.0"
path = "src"

[dependencies]
6 changes: 4 additions & 2 deletions src/algebra/algebra/basic.lean
Expand Up @@ -431,7 +431,7 @@ section semiring
variables [comm_semiring R] [semiring A] [semiring B] [semiring C] [semiring D]
variables [algebra R A] [algebra R B] [algebra R C] [algebra R D]

instance : has_coe_to_fun (A →ₐ[R] B) := ⟨_, λ f, f.to_fun⟩
instance : has_coe_to_fun (A →ₐ[R] B) _, A → B) := ⟨alg_hom.to_fun⟩

initialize_simps_projections alg_hom (to_fun → apply)

Expand Down Expand Up @@ -462,6 +462,8 @@ variables (φ : A →ₐ[R] B)
theorem coe_fn_injective : @function.injective (A →ₐ[R] B) (A → B) coe_fn :=
by { intros φ₁ φ₂ H, cases φ₁, cases φ₂, congr, exact H }

theorem coe_fn_inj {φ₁ φ₂ : A →ₐ[R] B} : (φ₁ : A → B) = φ₂ ↔ φ₁ = φ₂ := coe_fn_injective.eq_iff

theorem coe_ring_hom_injective : function.injective (coe : (A →ₐ[R] B) → (A →+* B)) :=
λ φ₁ φ₂ H, coe_fn_injective $ show ((φ₁ : (A →+* B)) : A → B) = ((φ₂ : (A →+* B)) : A → B),
from congr_arg _ H
Expand Down Expand Up @@ -716,7 +718,7 @@ variables [comm_semiring R] [semiring A₁] [semiring A₂] [semiring A₃]
variables [algebra R A₁] [algebra R A₂] [algebra R A₃]
variables (e : A₁ ≃ₐ[R] A₂)

instance : has_coe_to_fun (A₁ ≃ₐ[R] A₂) := ⟨_, alg_equiv.to_fun⟩
instance : has_coe_to_fun (A₁ ≃ₐ[R] A₂) _, A₁ → A₂) := ⟨alg_equiv.to_fun⟩

@[ext]
lemma ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=
Expand Down
3 changes: 1 addition & 2 deletions src/algebra/category/Algebra/basic.lean
Expand Up @@ -34,8 +34,7 @@ attribute [instance] Algebra.is_ring Algebra.is_algebra

namespace Algebra

instance : has_coe_to_sort (Algebra R) :=
{ S := Type v, coe := Algebra.carrier }
instance : has_coe_to_sort (Algebra R) (Type v) := ⟨Algebra.carrier⟩

instance : category (Algebra.{v} R) :=
{ hom := λ A B, A →ₐ[R] B,
Expand Down
14 changes: 10 additions & 4 deletions src/algebra/category/CommRing/basic.lean
Expand Up @@ -36,7 +36,9 @@ instance bundled_hom : bundled_hom assoc_ring_hom :=
λ M N P [semiring M] [semiring N] [semiring P], by exactI @ring_hom.comp M N P _ _ _,
λ M N [semiring M] [semiring N], by exactI @ring_hom.coe_inj M N _ _⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] SemiRing
attribute [derive [large_category, concrete_category]] SemiRing

instance : has_coe_to_sort SemiRing Type* := bundled.has_coe_to_sort

/-- Construct a bundled SemiRing from the underlying type and typeclass. -/
def of (R : Type u) [semiring R] : SemiRing := bundled.of R
Expand Down Expand Up @@ -70,7 +72,7 @@ namespace Ring

instance : bundled_hom.parent_projection @ring.to_semiring := ⟨⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] Ring
attribute [derive [(λ Ring, has_coe_to_sort Ring Type*), large_category, concrete_category]] Ring

/-- Construct a bundled Ring from the underlying type and typeclass. -/
def of (R : Type u) [ring R] : Ring := bundled.of R
Expand Down Expand Up @@ -100,7 +102,9 @@ namespace CommSemiRing

instance : bundled_hom.parent_projection @comm_semiring.to_semiring := ⟨⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] CommSemiRing
attribute [derive [large_category, concrete_category]] CommSemiRing

instance : has_coe_to_sort CommSemiRing Type* := bundled.has_coe_to_sort

/-- Construct a bundled CommSemiRing from the underlying type and typeclass. -/
def of (R : Type u) [comm_semiring R] : CommSemiRing := bundled.of R
Expand Down Expand Up @@ -131,7 +135,9 @@ namespace CommRing

instance : bundled_hom.parent_projection @comm_ring.to_ring := ⟨⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] CommRing
attribute [derive [large_category, concrete_category]] CommRing

instance : has_coe_to_sort CommRing Type* := bundled.has_coe_to_sort

/-- Construct a bundled CommRing from the underlying type and typeclass. -/
def of (R : Type u) [comm_ring R] : CommRing := bundled.of R
Expand Down
7 changes: 3 additions & 4 deletions src/algebra/category/FinVect.lean
Expand Up @@ -31,7 +31,7 @@ universes u
variables (K : Type u) [field K]

/-- Define `FinVect` as the subtype of `Module.{u} K` of finite dimensional vector spaces. -/
@[derive [category, has_coe_to_sort]]
@[derive [category, λ α, has_coe_to_sort α (Sort*)]]
def FinVect := { V : Module.{u} K // finite_dimensional K V }

namespace FinVect
Expand All @@ -57,9 +57,8 @@ variables (V : FinVect K)
def FinVect_dual : FinVect K :=
⟨Module.of K (module.dual K V), subspace.module.dual.finite_dimensional⟩

instance : has_coe_to_fun (FinVect_dual K V) :=
{ F := λ v, V → K,
coe := λ v, by { change V →ₗ[K] K at v, exact v, }, }
instance : has_coe_to_fun (FinVect_dual K V) (λ _, V → K) :=
{ coe := λ v, by { change V →ₗ[K] K at v, exact v, } }

open category_theory.monoidal_category

Expand Down
14 changes: 9 additions & 5 deletions src/algebra/category/Group/basic.lean
Expand Up @@ -33,8 +33,10 @@ namespace Group
@[to_additive]
instance : bundled_hom.parent_projection group.to_monoid := ⟨⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] Group
attribute [to_additive] Group.has_coe_to_sort Group.large_category Group.concrete_category
attribute [derive [large_category, concrete_category]] Group
attribute [to_additive] Group.large_category Group.concrete_category

@[to_additive] instance : has_coe_to_sort Group Type* := bundled.has_coe_to_sort

/-- Construct a bundled `Group` from the underlying type and typeclass. -/
@[to_additive] def of (X : Type u) [group X] : Group := bundled.of X
Expand Down Expand Up @@ -91,9 +93,11 @@ namespace CommGroup
@[to_additive]
instance : bundled_hom.parent_projection comm_group.to_group := ⟨⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] CommGroup
attribute [to_additive] CommGroup.has_coe_to_sort CommGroup.large_category
CommGroup.concrete_category
attribute [derive [large_category, concrete_category]] CommGroup
attribute [to_additive] CommGroup.large_category CommGroup.concrete_category

@[to_additive] instance : has_coe_to_sort CommGroup Type* := bundled.has_coe_to_sort


/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/
@[to_additive] def of (G : Type u) [comm_group G] : CommGroup := bundled.of G
Expand Down
113 changes: 62 additions & 51 deletions src/algebra/category/Module/adjunctions.lean
Expand Up @@ -49,7 +49,7 @@ adjunction.mk_of_hom_equiv
{ hom_equiv := λ X M, (finsupp.lift M R X).to_equiv.symm,
hom_equiv_naturality_left_symm' := λ _ _ M f g,
finsupp.lhom_ext' (λ x, linear_map.ext_ring
(finsupp.sum_map_domain_index_add_monoid_hom (λ y, ((smul_add_hom R M).flip) (g y))).symm) }
(finsupp.sum_map_domain_index_add_monoid_hom (λ y, ((smul_add_hom R M).flip) (g y))).symm) }

instance : is_right_adjoint (forget (Module.{u} R)) := ⟨_, adj R⟩

Expand All @@ -59,61 +59,72 @@ namespace free
variables [comm_ring R]
local attribute [ext] tensor_product.ext

/-- (Implementation detail) The unitor for `free R`. -/
def ε : 𝟙_ (Module.{u} R) ⟶ (free R).obj (𝟙_ (Type u)) :=
finsupp.lsingle punit.star

/-- (Implementation detail) The tensorator for `free R`. -/
def μ (α β : Type u) : (free R).obj α ⊗ (free R).obj β ⟶ (free R).obj (α ⊗ β) :=
(finsupp_tensor_finsupp' R α β).to_linear_map

lemma μ_natural {X Y X' Y' : Type u} (f : X ⟶ Y) (g : X' ⟶ Y') :
((free R).map f ⊗ (free R).map g) ≫ (μ R Y Y') =
(μ R X X') ≫ (free R).map (f ⊗ g) :=
begin
intros,
ext x x' ⟨y, y'⟩,
dsimp [μ],
simp_rw [finsupp.map_domain_single, finsupp_tensor_finsupp'_single_tmul_single, mul_one,
finsupp.map_domain_single, category_theory.tensor_apply],
end

lemma left_unitality (X : Type u) :
(λ_ ((free R).obj X)).hom =
(ε R ⊗ 𝟙 ((free R).obj X)) ≫ μ R (𝟙_ (Type u)) X ≫ map (free R).obj (λ_ X).hom :=
begin
intros,
ext,
dsimp [ε, μ],
simp_rw [finsupp_tensor_finsupp'_single_tmul_single,
Module.monoidal_category.left_unitor_hom_apply, finsupp.smul_single', mul_one,
finsupp.map_domain_single, category_theory.left_unitor_hom_apply],
end

lemma right_unitality (X : Type u) :
(ρ_ ((free R).obj X)).hom =
(𝟙 ((free R).obj X) ⊗ ε R) ≫ μ R X (𝟙_ (Type u)) ≫ map (free R).obj (ρ_ X).hom :=
begin
intros,
ext,
dsimp [ε, μ],
simp_rw [finsupp_tensor_finsupp'_single_tmul_single,
Module.monoidal_category.right_unitor_hom_apply, finsupp.smul_single', mul_one,
finsupp.map_domain_single, category_theory.right_unitor_hom_apply],
end

lemma associativity (X Y Z : Type u) :
(μ R X Y ⊗ 𝟙 ((free R).obj Z)) ≫ μ R (X ⊗ Y) Z ≫ map (free R).obj (α_ X Y Z).hom =
(α_ ((free R).obj X) ((free R).obj Y) ((free R).obj Z)).hom ≫
(𝟙 ((free R).obj X) ⊗ μ R Y Z) ≫ μ R X (Y ⊗ Z) :=
begin
intros,
ext,
dsimp [μ],
simp_rw [finsupp_tensor_finsupp'_single_tmul_single, finsupp.map_domain_single, mul_one,
category_theory.associator_hom_apply],
end

/-- The free R-module functor is lax monoidal. -/
-- In fact, it's strong monoidal, but we don't yet have a typeclass for that.
instance : lax_monoidal.{u} (free R).obj :=
{ -- Send `R` to `punit →₀ R`
ε := finsupp.lsingle punit.star,
ε := ε R,
-- Send `(α →₀ R) ⊗ (β →₀ R)` to `α × β →₀ R`
μ := λ α β, (finsupp_tensor_finsupp' R α β).to_linear_map,
μ_natural' := begin
intros,
ext x x' ⟨y, y'⟩,
-- This is rather tedious: it's a terminal simp, with no arguments,
-- but between the four of them it is too slow.
simp only [tensor_product.mk_apply, mul_one, tensor_apply, monoidal_category.hom_apply,
Module.free_map, Module.coe_comp, map_functorial_obj,
linear_map.compr₂_apply, linear_equiv.coe_to_linear_map, linear_map.comp_apply,
function.comp_app,
finsupp.lmap_domain_apply, finsupp.map_domain_single,
finsupp_tensor_finsupp'_single_tmul_single, finsupp.lsingle_apply],
end,
left_unitality' := begin
intros,
ext,
simp only [tensor_product.mk_apply, mul_one,
Module.id_apply, Module.free_map, Module.coe_comp, map_functorial_obj,
Module.monoidal_category.hom_apply, left_unitor_hom_apply,
Module.monoidal_category.left_unitor_hom_apply,
linear_map.compr₂_apply, linear_equiv.coe_to_linear_map, linear_map.comp_apply,
function.comp_app,
finsupp.lmap_domain_apply, finsupp.smul_single', finsupp.map_domain_single,
finsupp_tensor_finsupp'_single_tmul_single, finsupp.lsingle_apply],
end,
right_unitality' := begin
intros,
ext,
simp only [tensor_product.mk_apply, mul_one,
Module.id_apply, Module.free_map, Module.coe_comp, map_functorial_obj,
Module.monoidal_category.hom_apply, right_unitor_hom_apply,
Module.monoidal_category.right_unitor_hom_apply,
linear_map.compr₂_apply, linear_equiv.coe_to_linear_map, linear_map.comp_apply,
function.comp_app,
finsupp.lmap_domain_apply, finsupp.smul_single', finsupp.map_domain_single,
finsupp_tensor_finsupp'_single_tmul_single, finsupp.lsingle_apply],
end,
associativity' := begin
intros,
ext,
simp only [tensor_product.mk_apply, mul_one,
Module.id_apply, Module.free_map, Module.coe_comp, map_functorial_obj,
Module.monoidal_category.hom_apply, associator_hom_apply,
Module.monoidal_category.associator_hom_apply,
linear_map.compr₂_apply, linear_equiv.coe_to_linear_map, linear_map.comp_apply,
function.comp_app,
finsupp.lmap_domain_apply, finsupp.smul_single', finsupp.map_domain_single,
finsupp_tensor_finsupp'_single_tmul_single, finsupp.lsingle_apply],
end, }
μ := μ R,
μ_natural' := λ X Y X' Y' f g, μ_natural R f g,
left_unitality' := left_unitality R,
right_unitality' := right_unitality R,
associativity' := associativity R, }

end free

Expand Down
3 changes: 1 addition & 2 deletions src/algebra/category/Module/basic.lean
Expand Up @@ -70,8 +70,7 @@ attribute [instance] Module.is_add_comm_group Module.is_module

namespace Module

instance : has_coe_to_sort (Module.{v} R) :=
{ S := Type v, coe := Module.carrier }
instance : has_coe_to_sort (Module.{v} R) (Type v) := ⟨Module.carrier⟩

instance Module_category : category (Module.{v} R) :=
{ hom := λ M N, M →ₗ[R] N,
Expand Down
12 changes: 8 additions & 4 deletions src/algebra/category/Mon/basic.lean
Expand Up @@ -45,8 +45,10 @@ instance bundled_hom : bundled_hom assoc_monoid_hom :=
λ M N P [monoid M] [monoid N] [monoid P], by exactI @monoid_hom.comp M N P _ _ _,
λ M N [monoid M] [monoid N], by exactI @monoid_hom.coe_inj M N _ _⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] Mon
attribute [to_additive] Mon.has_coe_to_sort Mon.large_category Mon.concrete_category
attribute [derive [large_category, concrete_category]] Mon
attribute [to_additive] Mon.large_category Mon.concrete_category

@[to_additive] instance : has_coe_to_sort Mon Type* := bundled.has_coe_to_sort

/-- Construct a bundled `Mon` from the underlying type and typeclass. -/
@[to_additive]
Expand Down Expand Up @@ -87,8 +89,10 @@ namespace CommMon
@[to_additive]
instance : bundled_hom.parent_projection comm_monoid.to_monoid := ⟨⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] CommMon
attribute [to_additive] CommMon.has_coe_to_sort CommMon.large_category CommMon.concrete_category
attribute [derive [large_category, concrete_category]] CommMon
attribute [to_additive] CommMon.large_category CommMon.concrete_category

@[to_additive] instance : has_coe_to_sort CommMon Type* := bundled.has_coe_to_sort

/-- Construct a bundled `CommMon` from the underlying type and typeclass. -/
@[to_additive]
Expand Down
13 changes: 8 additions & 5 deletions src/algebra/category/Semigroup/basic.lean
Expand Up @@ -42,8 +42,10 @@ namespace Magma
instance bundled_hom : bundled_hom @mul_hom :=
⟨@mul_hom.to_fun, @mul_hom.id, @mul_hom.comp, @mul_hom.coe_inj⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] Magma
attribute [to_additive] Magma.has_coe_to_sort Magma.large_category Magma.concrete_category
attribute [derive [large_category, concrete_category]] Magma
attribute [to_additive] Magma.large_category Magma.concrete_category

@[to_additive] instance : has_coe_to_sort Magma Type* := bundled.has_coe_to_sort

/-- Construct a bundled `Magma` from the underlying type and typeclass. -/
@[to_additive]
Expand Down Expand Up @@ -81,9 +83,10 @@ namespace Semigroup
@[to_additive]
instance : bundled_hom.parent_projection semigroup.to_has_mul := ⟨⟩

attribute [derive [has_coe_to_sort, large_category, concrete_category]] Semigroup
attribute [to_additive] Semigroup.has_coe_to_sort Semigroup.large_category
Semigroup.concrete_category
attribute [derive [large_category, concrete_category]] Semigroup
attribute [to_additive] Semigroup.large_category Semigroup.concrete_category

@[to_additive] instance : has_coe_to_sort Semigroup Type* := bundled.has_coe_to_sort

/-- Construct a bundled `Semigroup` from the underlying type and typeclass. -/
@[to_additive]
Expand Down
5 changes: 4 additions & 1 deletion src/algebra/direct_sum/basic.lean
Expand Up @@ -31,9 +31,12 @@ variables (ι : Type v) [dec_ι : decidable_eq ι] (β : ι → Type w)
/-- `direct_sum β` is the direct sum of a family of additive commutative monoids `β i`.

Note: `open_locale direct_sum` will enable the notation `⨁ i, β i` for `direct_sum β`. -/
@[derive [has_coe_to_fun, add_comm_monoid, inhabited]]
@[derive [add_comm_monoid, inhabited]]
def direct_sum [Π i, add_comm_monoid (β i)] : Type* := Π₀ i, β i

instance [Π i, add_comm_monoid (β i)] : has_coe_to_fun (direct_sum ι β) (λ _, Π i : ι, β i) :=
dfinsupp.has_coe_to_fun

localized "notation `⨁` binders `, ` r:(scoped f, direct_sum _ f) := r" in direct_sum

namespace direct_sum
Expand Down
20 changes: 10 additions & 10 deletions src/algebra/group/hom.lean
Expand Up @@ -147,17 +147,17 @@ lemma monoid_with_zero_hom.coe_eq_to_zero_hom
(f : zero_hom M N) = f.to_zero_hom := rfl

@[to_additive]
instance {mM : has_one M} {mN : has_one N} : has_coe_to_fun (one_hom M N) :=
_, one_hom.to_fun⟩
instance {mM : has_one M} {mN : has_one N} : has_coe_to_fun (one_hom M N) (λ _, M → N) :=
⟨one_hom.to_fun⟩
@[to_additive]
instance {mM : has_mul M} {mN : has_mul N} : has_coe_to_fun (mul_hom M N) :=
_, mul_hom.to_fun⟩
instance {mM : has_mul M} {mN : has_mul N} : has_coe_to_fun (mul_hom M N) (λ _, M → N) :=
⟨mul_hom.to_fun⟩
@[to_additive]
instance {mM : mul_one_class M} {mN : mul_one_class N} : has_coe_to_fun (M →* N) :=
_, monoid_hom.to_fun⟩
instance {mM : mul_one_class M} {mN : mul_one_class N} : has_coe_to_fun (M →* N) (λ _, M → N) :=
⟨monoid_hom.to_fun⟩
instance {mM : mul_zero_one_class M} {mN : mul_zero_one_class N} :
has_coe_to_fun (monoid_with_zero_hom M N) :=
_, monoid_with_zero_hom.to_fun⟩
has_coe_to_fun (monoid_with_zero_hom M N) (λ _, M → N) :=
⟨monoid_with_zero_hom.to_fun⟩

-- these must come after the coe_to_fun definitions
initialize_simps_projections zero_hom (to_fun → apply)
Expand Down Expand Up @@ -567,7 +567,7 @@ instance : monoid (monoid.End M) :=

instance : inhabited (monoid.End M) := ⟨1⟩

instance : has_coe_to_fun (monoid.End M) := ⟨_, monoid_hom.to_fun⟩
instance : has_coe_to_fun (monoid.End M) _, M → M) := ⟨monoid_hom.to_fun⟩

end End

Expand All @@ -594,7 +594,7 @@ instance : monoid (add_monoid.End A) :=

instance : inhabited (add_monoid.End A) := ⟨1⟩

instance : has_coe_to_fun (add_monoid.End A) := ⟨_, add_monoid_hom.to_fun⟩
instance : has_coe_to_fun (add_monoid.End A) _, A → A) := ⟨add_monoid_hom.to_fun⟩

end End

Expand Down