linear_algebra.free_module.basicMathlib.LinearAlgebra.FreeModule.Basic

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)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -4,10 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
 -/
 import LinearAlgebra.DirectSum.Finsupp
-import Logic.Small.Basic
+import Logic.Small.Defs
 import LinearAlgebra.StdBasis
 import LinearAlgebra.FinsuppVectorSpace
-import LinearAlgebra.TensorProductBasis
+import LinearAlgebra.TensorProduct.Basis
 
 #align_import linear_algebra.free_module.basic from "leanprover-community/mathlib"@"19cb3751e5e9b3d97adb51023949c50c13b5fdfd"
 
Diff
@@ -41,7 +41,7 @@ section Basic
 variable [Semiring R] [AddCommMonoid M] [Module R M]
 
 #print Module.Free /-
-/- ./././Mathport/Syntax/Translate/Command.lean:404:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:400:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
 /-- `module.free R M` is the statement that the `R`-module `M` is free.-/
 class Module.Free : Prop where
   exists_basis : Nonempty (Σ I : Type v, Basis I R M)
Diff
@@ -41,7 +41,7 @@ section Basic
 variable [Semiring R] [AddCommMonoid M] [Module R M]
 
 #print Module.Free /-
-/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:404:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
 /-- `module.free R M` is the statement that the `R`-module `M` is free.-/
 class Module.Free : Prop where
   exists_basis : Nonempty (Σ I : Type v, Basis I R M)
Diff
@@ -3,11 +3,11 @@ Copyright (c) 2021 Riccardo Brasca. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
 -/
-import Mathbin.LinearAlgebra.DirectSum.Finsupp
-import Mathbin.Logic.Small.Basic
-import Mathbin.LinearAlgebra.StdBasis
-import Mathbin.LinearAlgebra.FinsuppVectorSpace
-import Mathbin.LinearAlgebra.TensorProductBasis
+import LinearAlgebra.DirectSum.Finsupp
+import Logic.Small.Basic
+import LinearAlgebra.StdBasis
+import LinearAlgebra.FinsuppVectorSpace
+import LinearAlgebra.TensorProductBasis
 
 #align_import linear_algebra.free_module.basic from "leanprover-community/mathlib"@"19cb3751e5e9b3d97adb51023949c50c13b5fdfd"
 
@@ -41,7 +41,7 @@ section Basic
 variable [Semiring R] [AddCommMonoid M] [Module R M]
 
 #print Module.Free /-
-/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
 /-- `module.free R M` is the statement that the `R`-module `M` is free.-/
 class Module.Free : Prop where
   exists_basis : Nonempty (Σ I : Type v, Basis I R M)
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Riccardo Brasca. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
-
-! This file was ported from Lean 3 source module linear_algebra.free_module.basic
-! leanprover-community/mathlib commit 19cb3751e5e9b3d97adb51023949c50c13b5fdfd
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.LinearAlgebra.DirectSum.Finsupp
 import Mathbin.Logic.Small.Basic
@@ -14,6 +9,8 @@ import Mathbin.LinearAlgebra.StdBasis
 import Mathbin.LinearAlgebra.FinsuppVectorSpace
 import Mathbin.LinearAlgebra.TensorProductBasis
 
+#align_import linear_algebra.free_module.basic from "leanprover-community/mathlib"@"19cb3751e5e9b3d97adb51023949c50c13b5fdfd"
+
 /-!
 
 # Free modules
Diff
@@ -220,7 +220,7 @@ instance (priority := 100) of_subsingleton' [Subsingleton R] : Module.Free R N :
 #print Module.Free.dfinsupp /-
 instance dfinsupp {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (Π₀ i, M i) :=
-  of_basis <| Dfinsupp.basis fun i => chooseBasis R (M i)
+  of_basis <| DFinsupp.basis fun i => chooseBasis R (M i)
 #align module.free.dfinsupp Module.Free.dfinsupp
 -/
 
Diff
@@ -44,7 +44,7 @@ section Basic
 variable [Semiring R] [AddCommMonoid M] [Module R M]
 
 #print Module.Free /-
-/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
 /-- `module.free R M` is the statement that the `R`-module `M` is free.-/
 class Module.Free : Prop where
   exists_basis : Nonempty (Σ I : Type v, Basis I R M)
@@ -106,10 +106,12 @@ noncomputable def chooseBasis : Basis (ChooseBasisIndex R M) R M :=
 #align module.free.choose_basis Module.Free.chooseBasis
 -/
 
+#print Module.Free.repr /-
 /-- The isomorphism `M ≃ₗ[R] (choose_basis_index R M →₀ R)`. -/
 noncomputable def repr : M ≃ₗ[R] ChooseBasisIndex R M →₀ R :=
   (chooseBasis R M).repr
 #align module.free.repr Module.Free.repr
+-/
 
 #print Module.Free.constr /-
 /-- The universal property of free modules: giving a functon `(choose_basis_index R M) → N`, for `N`
@@ -126,10 +128,12 @@ noncomputable def constr {S : Type z} [Semiring S] [Module S N] [SMulCommClass R
 #align module.free.constr Module.Free.constr
 -/
 
+#print Module.Free.noZeroSMulDivisors /-
 instance (priority := 100) noZeroSMulDivisors [NoZeroDivisors R] : NoZeroSMulDivisors R M :=
   let ⟨⟨_, b⟩⟩ := exists_basis R M
   b.NoZeroSMulDivisors
 #align module.free.no_zero_smul_divisors Module.Free.noZeroSMulDivisors
+-/
 
 instance [Nontrivial M] : Nonempty (Module.Free.ChooseBasisIndex R M) :=
   (Module.Free.chooseBasis R M).index_nonempty
@@ -160,9 +164,11 @@ instance self : Module.Free R R :=
 #align module.free.self Module.Free.self
 -/
 
+#print Module.Free.prod /-
 instance prod [Module.Free R N] : Module.Free R (M × N) :=
   of_basis <| (chooseBasis R M).Prod (chooseBasis R N)
 #align module.free.prod Module.Free.prod
+-/
 
 #print Module.Free.pi /-
 /-- The product of finitely many free modules is free. -/
@@ -190,25 +196,33 @@ instance function [Finite ι] : Module.Free R (ι → M) :=
 #align module.free.function Module.Free.function
 -/
 
+#print Module.Free.finsupp /-
 instance finsupp : Module.Free R (ι →₀ M) :=
   of_basis (Finsupp.basis fun i => chooseBasis R M)
 #align module.free.finsupp Module.Free.finsupp
+-/
 
 variable {ι}
 
+#print Module.Free.of_subsingleton /-
 instance (priority := 100) of_subsingleton [Subsingleton N] : Module.Free R N :=
   of_basis (Basis.empty N : Basis PEmpty R N)
 #align module.free.of_subsingleton Module.Free.of_subsingleton
+-/
 
+#print Module.Free.of_subsingleton' /-
 instance (priority := 100) of_subsingleton' [Subsingleton R] : Module.Free R N :=
   letI := Module.subsingleton R N
   Module.Free.of_subsingleton R N
 #align module.free.of_subsingleton' Module.Free.of_subsingleton'
+-/
 
+#print Module.Free.dfinsupp /-
 instance dfinsupp {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (Π₀ i, M i) :=
   of_basis <| Dfinsupp.basis fun i => chooseBasis R (M i)
 #align module.free.dfinsupp Module.Free.dfinsupp
+-/
 
 #print Module.Free.directSum /-
 instance directSum {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
@@ -225,11 +239,13 @@ variable [CommRing R] [AddCommGroup M] [Module R M] [Module.Free R M]
 
 variable [AddCommGroup N] [Module R N] [Module.Free R N]
 
+#print Module.Free.tensor /-
 instance tensor : Module.Free R (M ⊗[R] N) :=
   let ⟨bM⟩ := exists_basis R M
   let ⟨bN⟩ := exists_basis R N
   of_basis (bM.2.TensorProduct bN.2)
 #align module.free.tensor Module.Free.tensor
+-/
 
 end CommRing
 
Diff
@@ -210,10 +210,12 @@ instance dfinsupp {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (
   of_basis <| Dfinsupp.basis fun i => chooseBasis R (M i)
 #align module.free.dfinsupp Module.Free.dfinsupp
 
+#print Module.Free.directSum /-
 instance directSum {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (⨁ i, M i) :=
   Module.Free.dfinsupp R M
 #align module.free.direct_sum Module.Free.directSum
+-/
 
 end Semiring
 
Diff
@@ -44,7 +44,7 @@ section Basic
 variable [Semiring R] [AddCommMonoid M] [Module R M]
 
 #print Module.Free /-
-/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
 /-- `module.free R M` is the statement that the `R`-module `M` is free.-/
 class Module.Free : Prop where
   exists_basis : Nonempty (Σ I : Type v, Basis I R M)
Diff
@@ -47,7 +47,7 @@ variable [Semiring R] [AddCommMonoid M] [Module R M]
 /- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
 /-- `module.free R M` is the statement that the `R`-module `M` is free.-/
 class Module.Free : Prop where
-  exists_basis : Nonempty (ΣI : Type v, Basis I R M)
+  exists_basis : Nonempty (Σ I : Type v, Basis I R M)
 #align module.free Module.Free
 -/
 
Diff
@@ -37,7 +37,7 @@ universe u v w z
 
 variable {ι : Type _} (R : Type u) (M : Type v) (N : Type z)
 
-open TensorProduct DirectSum BigOperators
+open scoped TensorProduct DirectSum BigOperators
 
 section Basic
 
Diff
@@ -106,12 +106,6 @@ noncomputable def chooseBasis : Basis (ChooseBasisIndex R M) R M :=
 #align module.free.choose_basis Module.Free.chooseBasis
 -/
 
-/- warning: module.free.repr -> Module.Free.repr is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3], LinearEquiv.{u1, u1, u2, max u2 u1} R R _inst_1 _inst_1 (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)) (RingHomInvPair.ids.{u1} R _inst_1) (RingHomInvPair.ids.{u1} R _inst_1) M (Finsupp.{u2, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))))) _inst_2 (Finsupp.addCommMonoid.{u2, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) _inst_3 (Finsupp.module.{u2, u1, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R R _inst_1 (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (Semiring.toModule.{u1} R _inst_1))
-but is expected to have type
-  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3], LinearEquiv.{u1, u1, u2, max u1 u2} R R _inst_1 _inst_1 (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)) (RingHomInvPair.ids.{u1} R _inst_1) (RingHomInvPair.ids.{u1} R _inst_1) M (Finsupp.{u2, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1))) _inst_2 (Finsupp.addCommMonoid.{u2, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) _inst_3 (Finsupp.module.{u2, u1, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R R _inst_1 (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (Semiring.toModule.{u1} R _inst_1))
-Case conversion may be inaccurate. Consider using '#align module.free.repr Module.Free.reprₓ'. -/
 /-- The isomorphism `M ≃ₗ[R] (choose_basis_index R M →₀ R)`. -/
 noncomputable def repr : M ≃ₗ[R] ChooseBasisIndex R M →₀ R :=
   (chooseBasis R M).repr
@@ -132,12 +126,6 @@ noncomputable def constr {S : Type z} [Semiring S] [Module S N] [SMulCommClass R
 #align module.free.constr Module.Free.constr
 -/
 
-/- warning: module.free.no_zero_smul_divisors -> Module.Free.noZeroSMulDivisors is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3] [_inst_7 : NoZeroDivisors.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))))], NoZeroSMulDivisors.{u1, u2} R M (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) (SMulZeroClass.toHasSmul.{u1, u2} R M (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} R M (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1)))) (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} R M (Semiring.toMonoidWithZero.{u1} R _inst_1) (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) (Module.toMulActionWithZero.{u1, u2} R M _inst_1 _inst_2 _inst_3))))
-but is expected to have type
-  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3] [_inst_7 : NoZeroDivisors.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1))], NoZeroSMulDivisors.{u1, u2} R M (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1)) (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)) (SMulZeroClass.toSMul.{u1, u2} R M (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)) (SMulWithZero.toSMulZeroClass.{u1, u2} R M (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1)) (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)) (MulActionWithZero.toSMulWithZero.{u1, u2} R M (Semiring.toMonoidWithZero.{u1} R _inst_1) (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)) (Module.toMulActionWithZero.{u1, u2} R M _inst_1 _inst_2 _inst_3))))
-Case conversion may be inaccurate. Consider using '#align module.free.no_zero_smul_divisors Module.Free.noZeroSMulDivisorsₓ'. -/
 instance (priority := 100) noZeroSMulDivisors [NoZeroDivisors R] : NoZeroSMulDivisors R M :=
   let ⟨⟨_, b⟩⟩ := exists_basis R M
   b.NoZeroSMulDivisors
@@ -172,12 +160,6 @@ instance self : Module.Free R R :=
 #align module.free.self Module.Free.self
 -/
 
-/- warning: module.free.prod -> Module.Free.prod is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3] [_inst_5 : AddCommMonoid.{u3} N] [_inst_6 : Module.{u1, u3} R N _inst_1 _inst_5] [_inst_7 : Module.Free.{u1, u3} R N _inst_1 _inst_5 _inst_6], Module.Free.{u1, max u2 u3} R (Prod.{u2, u3} M N) _inst_1 (Prod.addCommMonoid.{u2, u3} M N _inst_2 _inst_5) (Prod.module.{u1, u2, u3} R M N _inst_1 _inst_2 _inst_5 _inst_3 _inst_6)
-but is expected to have type
-  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3] [_inst_5 : AddCommMonoid.{u3} N] [_inst_6 : Module.{u1, u3} R N _inst_1 _inst_5] [_inst_7 : Module.Free.{u1, u3} R N _inst_1 _inst_5 _inst_6], Module.Free.{u1, max u3 u2} R (Prod.{u2, u3} M N) _inst_1 (Prod.instAddCommMonoidSum.{u2, u3} M N _inst_2 _inst_5) (Prod.module.{u1, u2, u3} R M N _inst_1 _inst_2 _inst_5 _inst_3 _inst_6)
-Case conversion may be inaccurate. Consider using '#align module.free.prod Module.Free.prodₓ'. -/
 instance prod [Module.Free R N] : Module.Free R (M × N) :=
   of_basis <| (chooseBasis R M).Prod (chooseBasis R N)
 #align module.free.prod Module.Free.prod
@@ -208,56 +190,26 @@ instance function [Finite ι] : Module.Free R (ι → M) :=
 #align module.free.function Module.Free.function
 -/
 
-/- warning: module.free.finsupp -> Module.Free.finsupp is a dubious translation:
-lean 3 declaration is
-  forall (ι : Type.{u3}) (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3], Module.Free.{u1, max u3 u2} R (Finsupp.{u3, u2} ι M (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)))) _inst_1 (Finsupp.addCommMonoid.{u3, u2} ι M _inst_2) (Finsupp.module.{u3, u2, u1} ι M R _inst_1 _inst_2 _inst_3)
-but is expected to have type
-  forall (ι : Type.{u3}) (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3], Module.Free.{u1, max u2 u3} R (Finsupp.{u3, u2} ι M (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) _inst_1 (Finsupp.addCommMonoid.{u3, u2} ι M _inst_2) (Finsupp.module.{u3, u2, u1} ι M R _inst_1 _inst_2 _inst_3)
-Case conversion may be inaccurate. Consider using '#align module.free.finsupp Module.Free.finsuppₓ'. -/
 instance finsupp : Module.Free R (ι →₀ M) :=
   of_basis (Finsupp.basis fun i => chooseBasis R M)
 #align module.free.finsupp Module.Free.finsupp
 
 variable {ι}
 
-/- warning: module.free.of_subsingleton -> Module.Free.of_subsingleton is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u}) (N : Type.{z}) [_inst_1 : Semiring.{u} R] [_inst_5 : AddCommMonoid.{z} N] [_inst_6 : Module.{u, z} R N _inst_1 _inst_5] [_inst_7 : Subsingleton.{succ z} N], Module.Free.{u, z} R N _inst_1 _inst_5 _inst_6
-but is expected to have type
-  forall (R : Type.{u}) (N : Type.{z}) [_inst_1 : Semiring.{u} R] [_inst_5 : AddCommMonoid.{z} N] [_inst_6 : Module.{u, z} R N _inst_1 _inst_5] [_inst_7 : Subsingleton.{succ z} N], Module.Free.{u, z} R N _inst_1 _inst_5 _inst_6
-Case conversion may be inaccurate. Consider using '#align module.free.of_subsingleton Module.Free.of_subsingletonₓ'. -/
 instance (priority := 100) of_subsingleton [Subsingleton N] : Module.Free R N :=
   of_basis (Basis.empty N : Basis PEmpty R N)
 #align module.free.of_subsingleton Module.Free.of_subsingleton
 
-/- warning: module.free.of_subsingleton' -> Module.Free.of_subsingleton' is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u}) (N : Type.{z}) [_inst_1 : Semiring.{u} R] [_inst_5 : AddCommMonoid.{z} N] [_inst_6 : Module.{u, z} R N _inst_1 _inst_5] [_inst_7 : Subsingleton.{succ u} R], Module.Free.{u, z} R N _inst_1 _inst_5 _inst_6
-but is expected to have type
-  forall (R : Type.{u}) (N : Type.{z}) [_inst_1 : Semiring.{u} R] [_inst_5 : AddCommMonoid.{z} N] [_inst_6 : Module.{u, z} R N _inst_1 _inst_5] [_inst_7 : Subsingleton.{succ u} R], Module.Free.{u, z} R N _inst_1 _inst_5 _inst_6
-Case conversion may be inaccurate. Consider using '#align module.free.of_subsingleton' Module.Free.of_subsingleton'ₓ'. -/
 instance (priority := 100) of_subsingleton' [Subsingleton R] : Module.Free R N :=
   letI := Module.subsingleton R N
   Module.Free.of_subsingleton R N
 #align module.free.of_subsingleton' Module.Free.of_subsingleton'
 
-/- warning: module.free.dfinsupp -> Module.Free.dfinsupp is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] {ι : Type.{u2}} (M : ι -> Type.{u3}) [_inst_7 : forall (i : ι), AddCommMonoid.{u3} (M i)] [_inst_8 : forall (i : ι), Module.{u1, u3} R (M i) _inst_1 (_inst_7 i)] [_inst_9 : forall (i : ι), Module.Free.{u1, u3} R (M i) _inst_1 (_inst_7 i) (_inst_8 i)], Module.Free.{u1, max u2 u3} R (Dfinsupp.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => AddZeroClass.toHasZero.{u3} (M i) (AddMonoid.toAddZeroClass.{u3} (M i) (AddCommMonoid.toAddMonoid.{u3} (M i) (_inst_7 i))))) _inst_1 (Dfinsupp.addCommMonoid.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) (Dfinsupp.module.{u2, u3, u1} ι R (fun (i : ι) => M i) _inst_1 (fun (i : ι) => _inst_7 i) (fun (i : ι) => _inst_8 i))
-but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] {ι : Type.{u2}} (M : ι -> Type.{u3}) [_inst_7 : forall (i : ι), AddCommMonoid.{u3} (M i)] [_inst_8 : forall (i : ι), Module.{u1, u3} R (M i) _inst_1 (_inst_7 i)] [_inst_9 : forall (i : ι), Module.Free.{u1, u3} R (M i) _inst_1 (_inst_7 i) (_inst_8 i)], Module.Free.{u1, max u3 u2} R (Dfinsupp.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => AddMonoid.toZero.{u3} ((fun (i : ι) => M i) i) (AddCommMonoid.toAddMonoid.{u3} ((fun (i : ι) => M i) i) (_inst_7 i)))) _inst_1 (Dfinsupp.instAddCommMonoidDfinsuppToZeroToAddMonoid.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) (Dfinsupp.module.{u2, u3, u1} ι R (fun (i : ι) => M i) _inst_1 (fun (i : ι) => _inst_7 i) (fun (i : ι) => _inst_8 i))
-Case conversion may be inaccurate. Consider using '#align module.free.dfinsupp Module.Free.dfinsuppₓ'. -/
 instance dfinsupp {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (Π₀ i, M i) :=
   of_basis <| Dfinsupp.basis fun i => chooseBasis R (M i)
 #align module.free.dfinsupp Module.Free.dfinsupp
 
-/- warning: module.free.direct_sum -> Module.Free.directSum is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] {ι : Type.{u2}} (M : ι -> Type.{u3}) [_inst_7 : forall (i : ι), AddCommMonoid.{u3} (M i)] [_inst_8 : forall (i : ι), Module.{u1, u3} R (M i) _inst_1 (_inst_7 i)] [_inst_9 : forall (i : ι), Module.Free.{u1, u3} R (M i) _inst_1 (_inst_7 i) (_inst_8 i)], Module.Free.{u1, max u2 u3} R (DirectSum.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) _inst_1 (DirectSum.addCommMonoid.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) (DirectSum.module.{u1, u2, u3} R _inst_1 ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i) (fun (i : ι) => _inst_8 i))
-but is expected to have type
-  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] {ι : Type.{u2}} (M : ι -> Type.{u3}) [_inst_7 : forall (i : ι), AddCommMonoid.{u3} (M i)] [_inst_8 : forall (i : ι), Module.{u1, u3} R (M i) _inst_1 (_inst_7 i)] [_inst_9 : forall (i : ι), Module.Free.{u1, u3} R (M i) _inst_1 (_inst_7 i) (_inst_8 i)], Module.Free.{u1, max u3 u2} R (DirectSum.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) _inst_1 (instAddCommMonoidDirectSum.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) (DirectSum.instModuleDirectSumInstAddCommMonoidDirectSum.{u1, u2, u3} R _inst_1 ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i) (fun (i : ι) => _inst_8 i))
-Case conversion may be inaccurate. Consider using '#align module.free.direct_sum Module.Free.directSumₓ'. -/
 instance directSum {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (⨁ i, M i) :=
   Module.Free.dfinsupp R M
@@ -271,12 +223,6 @@ variable [CommRing R] [AddCommGroup M] [Module R M] [Module.Free R M]
 
 variable [AddCommGroup N] [Module R N] [Module.Free R N]
 
-/- warning: module.free.tensor -> Module.Free.tensor is a dubious translation:
-lean 3 declaration is
-  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : CommRing.{u1} R] [_inst_2 : AddCommGroup.{u2} M] [_inst_3 : Module.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2)] [_inst_4 : Module.Free.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) _inst_3] [_inst_5 : AddCommGroup.{u3} N] [_inst_6 : Module.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5)] [_inst_7 : Module.Free.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_6], Module.Free.{u1, max u2 u3} R (TensorProduct.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (TensorProduct.addCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (TensorProduct.module.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6)
-but is expected to have type
-  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : CommRing.{u1} R] [_inst_2 : AddCommGroup.{u2} M] [_inst_3 : Module.{u1, u2} R M (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2)] [_inst_4 : Module.Free.{u1, u2} R M (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) _inst_3] [_inst_5 : AddCommGroup.{u3} N] [_inst_6 : Module.{u1, u3} R N (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5)] [_inst_7 : Module.Free.{u1, u3} R N (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_6], Module.Free.{u1, max u3 u2} R (TensorProduct.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (TensorProduct.addCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (TensorProduct.instModuleTensorProductToSemiringAddCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6)
-Case conversion may be inaccurate. Consider using '#align module.free.tensor Module.Free.tensorₓ'. -/
 instance tensor : Module.Free R (M ⊗[R] N) :=
   let ⟨bM⟩ := exists_basis R M
   let ⟨bN⟩ := exists_basis R N
Diff
@@ -275,7 +275,7 @@ variable [AddCommGroup N] [Module R N] [Module.Free R N]
 lean 3 declaration is
   forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : CommRing.{u1} R] [_inst_2 : AddCommGroup.{u2} M] [_inst_3 : Module.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2)] [_inst_4 : Module.Free.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) _inst_3] [_inst_5 : AddCommGroup.{u3} N] [_inst_6 : Module.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5)] [_inst_7 : Module.Free.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_6], Module.Free.{u1, max u2 u3} R (TensorProduct.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (TensorProduct.addCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (TensorProduct.module.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6)
 but is expected to have type
-  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : CommRing.{u1} R] [_inst_2 : AddCommGroup.{u2} M] [_inst_3 : Module.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2)] [_inst_4 : Module.Free.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) _inst_3] [_inst_5 : AddCommGroup.{u3} N] [_inst_6 : Module.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5)] [_inst_7 : Module.Free.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_6], Module.Free.{u1, max u3 u2} R (TensorProduct.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (TensorProduct.addCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (TensorProduct.instModuleTensorProductToSemiringAddCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6)
+  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : CommRing.{u1} R] [_inst_2 : AddCommGroup.{u2} M] [_inst_3 : Module.{u1, u2} R M (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2)] [_inst_4 : Module.Free.{u1, u2} R M (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) _inst_3] [_inst_5 : AddCommGroup.{u3} N] [_inst_6 : Module.{u1, u3} R N (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5)] [_inst_7 : Module.Free.{u1, u3} R N (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_6], Module.Free.{u1, max u3 u2} R (TensorProduct.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)) (TensorProduct.addCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (TensorProduct.instModuleTensorProductToSemiringAddCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6)
 Case conversion may be inaccurate. Consider using '#align module.free.tensor Module.Free.tensorₓ'. -/
 instance tensor : Module.Free R (M ⊗[R] N) :=
   let ⟨bM⟩ := exists_basis R M
Diff
@@ -44,7 +44,7 @@ section Basic
 variable [Semiring R] [AddCommMonoid M] [Module R M]
 
 #print Module.Free /-
-/- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
 /-- `module.free R M` is the statement that the `R`-module `M` is free.-/
 class Module.Free : Prop where
   exists_basis : Nonempty (ΣI : Type v, Basis I R M)
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
 
 ! This file was ported from Lean 3 source module linear_algebra.free_module.basic
-! leanprover-community/mathlib commit 4e7e7009099d4a88a750de710909b95487bf0124
+! leanprover-community/mathlib commit 19cb3751e5e9b3d97adb51023949c50c13b5fdfd
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -18,6 +18,9 @@ import Mathbin.LinearAlgebra.TensorProductBasis
 
 # Free modules
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We introduce a class `module.free R M`, for `R` a `semiring` and `M` an `R`-module and we provide
 several basic instances for this class.
 
Diff
@@ -40,12 +40,15 @@ section Basic
 
 variable [Semiring R] [AddCommMonoid M] [Module R M]
 
+#print Module.Free /-
 /- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`exists_basis] [] -/
 /-- `module.free R M` is the statement that the `R`-module `M` is free.-/
 class Module.Free : Prop where
   exists_basis : Nonempty (ΣI : Type v, Basis I R M)
 #align module.free Module.Free
+-/
 
+#print Module.free_def /-
 /- If `M` fits in universe `w`, then freeness is equivalent to existence of a basis in that
 universe.
 
@@ -57,17 +60,22 @@ theorem Module.free_def [Small.{w} M] : Module.Free R M ↔ ∃ I : Type w, None
       ⟨(Basis.reindexRange h.exists_basis.some.2).reindex (equivShrink _)⟩⟩,
     fun h => ⟨(nonempty_sigma.2 h).map fun ⟨i, b⟩ => ⟨Set.range b, b.reindexRange⟩⟩⟩
 #align module.free_def Module.free_def
+-/
 
+#print Module.free_iff_set /-
 theorem Module.free_iff_set : Module.Free R M ↔ ∃ S : Set M, Nonempty (Basis S R M) :=
   ⟨fun h => ⟨Set.range h.exists_basis.some.2, ⟨Basis.reindexRange h.exists_basis.some.2⟩⟩,
     fun ⟨S, hS⟩ => ⟨nonempty_sigma.2 ⟨S, hS⟩⟩⟩
 #align module.free_iff_set Module.free_iff_set
+-/
 
 variable {R M}
 
+#print Module.Free.of_basis /-
 theorem Module.Free.of_basis {ι : Type w} (b : Basis ι R M) : Module.Free R M :=
   (Module.free_def R M).2 ⟨Set.range b, ⟨b.reindexRange⟩⟩
 #align module.free.of_basis Module.Free.of_basis
+-/
 
 end Basic
 
@@ -79,23 +87,34 @@ variable (R M) [Semiring R] [AddCommMonoid M] [Module R M] [Module.Free R M]
 
 variable [AddCommMonoid N] [Module R N]
 
+#print Module.Free.ChooseBasisIndex /-
 /-- If `module.free R M` then `choose_basis_index R M` is the `ι` which indexes the basis
   `ι → M`. -/
 def ChooseBasisIndex :=
   (exists_basis R M).some.1
 #align module.free.choose_basis_index Module.Free.ChooseBasisIndex
+-/
 
+#print Module.Free.chooseBasis /-
 /-- If `module.free R M` then `choose_basis : ι → M` is the basis.
 Here `ι = choose_basis_index R M`. -/
 noncomputable def chooseBasis : Basis (ChooseBasisIndex R M) R M :=
   (exists_basis R M).some.2
 #align module.free.choose_basis Module.Free.chooseBasis
+-/
 
+/- warning: module.free.repr -> Module.Free.repr is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3], LinearEquiv.{u1, u1, u2, max u2 u1} R R _inst_1 _inst_1 (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)) (RingHomInvPair.ids.{u1} R _inst_1) (RingHomInvPair.ids.{u1} R _inst_1) M (Finsupp.{u2, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))))) _inst_2 (Finsupp.addCommMonoid.{u2, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) _inst_3 (Finsupp.module.{u2, u1, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R R _inst_1 (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (Semiring.toModule.{u1} R _inst_1))
+but is expected to have type
+  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3], LinearEquiv.{u1, u1, u2, max u1 u2} R R _inst_1 _inst_1 (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)) (RingHomInvPair.ids.{u1} R _inst_1) (RingHomInvPair.ids.{u1} R _inst_1) M (Finsupp.{u2, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1))) _inst_2 (Finsupp.addCommMonoid.{u2, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) _inst_3 (Finsupp.module.{u2, u1, u1} (Module.Free.ChooseBasisIndex.{u1, u2} R M _inst_1 _inst_2 _inst_3 _inst_4) R R _inst_1 (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (Semiring.toModule.{u1} R _inst_1))
+Case conversion may be inaccurate. Consider using '#align module.free.repr Module.Free.reprₓ'. -/
 /-- The isomorphism `M ≃ₗ[R] (choose_basis_index R M →₀ R)`. -/
 noncomputable def repr : M ≃ₗ[R] ChooseBasisIndex R M →₀ R :=
   (chooseBasis R M).repr
 #align module.free.repr Module.Free.repr
 
+#print Module.Free.constr /-
 /-- The universal property of free modules: giving a functon `(choose_basis_index R M) → N`, for `N`
 an `R`-module, is the same as giving an `R`-linear map `M →ₗ[R] N`.
 
@@ -108,7 +127,14 @@ noncomputable def constr {S : Type z} [Semiring S] [Module S N] [SMulCommClass R
     (ChooseBasisIndex R M → N) ≃ₗ[S] M →ₗ[R] N :=
   Basis.constr (chooseBasis R M) S
 #align module.free.constr Module.Free.constr
+-/
 
+/- warning: module.free.no_zero_smul_divisors -> Module.Free.noZeroSMulDivisors is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3] [_inst_7 : NoZeroDivisors.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))))], NoZeroSMulDivisors.{u1, u2} R M (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1)))) (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) (SMulZeroClass.toHasSmul.{u1, u2} R M (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} R M (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1)))) (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} R M (Semiring.toMonoidWithZero.{u1} R _inst_1) (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) (Module.toMulActionWithZero.{u1, u2} R M _inst_1 _inst_2 _inst_3))))
+but is expected to have type
+  forall (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3] [_inst_7 : NoZeroDivisors.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R _inst_1))) (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1))], NoZeroSMulDivisors.{u1, u2} R M (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1)) (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)) (SMulZeroClass.toSMul.{u1, u2} R M (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)) (SMulWithZero.toSMulZeroClass.{u1, u2} R M (MonoidWithZero.toZero.{u1} R (Semiring.toMonoidWithZero.{u1} R _inst_1)) (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)) (MulActionWithZero.toSMulWithZero.{u1, u2} R M (Semiring.toMonoidWithZero.{u1} R _inst_1) (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)) (Module.toMulActionWithZero.{u1, u2} R M _inst_1 _inst_2 _inst_3))))
+Case conversion may be inaccurate. Consider using '#align module.free.no_zero_smul_divisors Module.Free.noZeroSMulDivisorsₓ'. -/
 instance (priority := 100) noZeroSMulDivisors [NoZeroDivisors R] : NoZeroSMulDivisors R M :=
   let ⟨⟨_, b⟩⟩ := exists_basis R M
   b.NoZeroSMulDivisors
@@ -119,68 +145,116 @@ instance [Nontrivial M] : Nonempty (Module.Free.ChooseBasisIndex R M) :=
 
 variable {R M N}
 
+#print Module.Free.of_equiv /-
 theorem of_equiv (e : M ≃ₗ[R] N) : Module.Free R N :=
   of_basis <| (chooseBasis R M).map e
 #align module.free.of_equiv Module.Free.of_equiv
+-/
 
+#print Module.Free.of_equiv' /-
 /-- A variation of `of_equiv`: the assumption `module.free R P` here is explicit rather than an
 instance. -/
 theorem of_equiv' {P : Type v} [AddCommMonoid P] [Module R P] (h : Module.Free R P)
     (e : P ≃ₗ[R] N) : Module.Free R N :=
   of_equiv e
 #align module.free.of_equiv' Module.Free.of_equiv'
+-/
 
 variable (R M N)
 
+#print Module.Free.self /-
 /-- The module structure provided by `semiring.to_module` is free. -/
 instance self : Module.Free R R :=
   of_basis (Basis.singleton Unit R)
 #align module.free.self Module.Free.self
+-/
 
+/- warning: module.free.prod -> Module.Free.prod is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3] [_inst_5 : AddCommMonoid.{u3} N] [_inst_6 : Module.{u1, u3} R N _inst_1 _inst_5] [_inst_7 : Module.Free.{u1, u3} R N _inst_1 _inst_5 _inst_6], Module.Free.{u1, max u2 u3} R (Prod.{u2, u3} M N) _inst_1 (Prod.addCommMonoid.{u2, u3} M N _inst_2 _inst_5) (Prod.module.{u1, u2, u3} R M N _inst_1 _inst_2 _inst_5 _inst_3 _inst_6)
+but is expected to have type
+  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3] [_inst_5 : AddCommMonoid.{u3} N] [_inst_6 : Module.{u1, u3} R N _inst_1 _inst_5] [_inst_7 : Module.Free.{u1, u3} R N _inst_1 _inst_5 _inst_6], Module.Free.{u1, max u3 u2} R (Prod.{u2, u3} M N) _inst_1 (Prod.instAddCommMonoidSum.{u2, u3} M N _inst_2 _inst_5) (Prod.module.{u1, u2, u3} R M N _inst_1 _inst_2 _inst_5 _inst_3 _inst_6)
+Case conversion may be inaccurate. Consider using '#align module.free.prod Module.Free.prodₓ'. -/
 instance prod [Module.Free R N] : Module.Free R (M × N) :=
   of_basis <| (chooseBasis R M).Prod (chooseBasis R N)
 #align module.free.prod Module.Free.prod
 
+#print Module.Free.pi /-
 /-- The product of finitely many free modules is free. -/
 instance pi (M : ι → Type _) [Finite ι] [∀ i : ι, AddCommMonoid (M i)] [∀ i : ι, Module R (M i)]
     [∀ i : ι, Module.Free R (M i)] : Module.Free R (∀ i, M i) :=
   let ⟨_⟩ := nonempty_fintype ι
   of_basis <| Pi.basis fun i => choose_basis R (M i)
 #align module.free.pi Module.Free.pi
+-/
 
+#print Module.Free.matrix /-
 /-- The module of finite matrices is free. -/
 instance matrix {m n : Type _} [Finite m] [Finite n] : Module.Free R (Matrix m n M) :=
   Module.Free.pi R _
 #align module.free.matrix Module.Free.matrix
+-/
 
 variable (ι)
 
+#print Module.Free.function /-
 /-- The product of finitely many free modules is free (non-dependent version to help with typeclass
 search). -/
 instance function [Finite ι] : Module.Free R (ι → M) :=
   Free.pi _ _
 #align module.free.function Module.Free.function
+-/
 
+/- warning: module.free.finsupp -> Module.Free.finsupp is a dubious translation:
+lean 3 declaration is
+  forall (ι : Type.{u3}) (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3], Module.Free.{u1, max u3 u2} R (Finsupp.{u3, u2} ι M (AddZeroClass.toHasZero.{u2} M (AddMonoid.toAddZeroClass.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2)))) _inst_1 (Finsupp.addCommMonoid.{u3, u2} ι M _inst_2) (Finsupp.module.{u3, u2, u1} ι M R _inst_1 _inst_2 _inst_3)
+but is expected to have type
+  forall (ι : Type.{u3}) (R : Type.{u1}) (M : Type.{u2}) [_inst_1 : Semiring.{u1} R] [_inst_2 : AddCommMonoid.{u2} M] [_inst_3 : Module.{u1, u2} R M _inst_1 _inst_2] [_inst_4 : Module.Free.{u1, u2} R M _inst_1 _inst_2 _inst_3], Module.Free.{u1, max u2 u3} R (Finsupp.{u3, u2} ι M (AddMonoid.toZero.{u2} M (AddCommMonoid.toAddMonoid.{u2} M _inst_2))) _inst_1 (Finsupp.addCommMonoid.{u3, u2} ι M _inst_2) (Finsupp.module.{u3, u2, u1} ι M R _inst_1 _inst_2 _inst_3)
+Case conversion may be inaccurate. Consider using '#align module.free.finsupp Module.Free.finsuppₓ'. -/
 instance finsupp : Module.Free R (ι →₀ M) :=
   of_basis (Finsupp.basis fun i => chooseBasis R M)
 #align module.free.finsupp Module.Free.finsupp
 
 variable {ι}
 
+/- warning: module.free.of_subsingleton -> Module.Free.of_subsingleton is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u}) (N : Type.{z}) [_inst_1 : Semiring.{u} R] [_inst_5 : AddCommMonoid.{z} N] [_inst_6 : Module.{u, z} R N _inst_1 _inst_5] [_inst_7 : Subsingleton.{succ z} N], Module.Free.{u, z} R N _inst_1 _inst_5 _inst_6
+but is expected to have type
+  forall (R : Type.{u}) (N : Type.{z}) [_inst_1 : Semiring.{u} R] [_inst_5 : AddCommMonoid.{z} N] [_inst_6 : Module.{u, z} R N _inst_1 _inst_5] [_inst_7 : Subsingleton.{succ z} N], Module.Free.{u, z} R N _inst_1 _inst_5 _inst_6
+Case conversion may be inaccurate. Consider using '#align module.free.of_subsingleton Module.Free.of_subsingletonₓ'. -/
 instance (priority := 100) of_subsingleton [Subsingleton N] : Module.Free R N :=
   of_basis (Basis.empty N : Basis PEmpty R N)
 #align module.free.of_subsingleton Module.Free.of_subsingleton
 
+/- warning: module.free.of_subsingleton' -> Module.Free.of_subsingleton' is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u}) (N : Type.{z}) [_inst_1 : Semiring.{u} R] [_inst_5 : AddCommMonoid.{z} N] [_inst_6 : Module.{u, z} R N _inst_1 _inst_5] [_inst_7 : Subsingleton.{succ u} R], Module.Free.{u, z} R N _inst_1 _inst_5 _inst_6
+but is expected to have type
+  forall (R : Type.{u}) (N : Type.{z}) [_inst_1 : Semiring.{u} R] [_inst_5 : AddCommMonoid.{z} N] [_inst_6 : Module.{u, z} R N _inst_1 _inst_5] [_inst_7 : Subsingleton.{succ u} R], Module.Free.{u, z} R N _inst_1 _inst_5 _inst_6
+Case conversion may be inaccurate. Consider using '#align module.free.of_subsingleton' Module.Free.of_subsingleton'ₓ'. -/
 instance (priority := 100) of_subsingleton' [Subsingleton R] : Module.Free R N :=
   letI := Module.subsingleton R N
   Module.Free.of_subsingleton R N
 #align module.free.of_subsingleton' Module.Free.of_subsingleton'
 
+/- warning: module.free.dfinsupp -> Module.Free.dfinsupp is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] {ι : Type.{u2}} (M : ι -> Type.{u3}) [_inst_7 : forall (i : ι), AddCommMonoid.{u3} (M i)] [_inst_8 : forall (i : ι), Module.{u1, u3} R (M i) _inst_1 (_inst_7 i)] [_inst_9 : forall (i : ι), Module.Free.{u1, u3} R (M i) _inst_1 (_inst_7 i) (_inst_8 i)], Module.Free.{u1, max u2 u3} R (Dfinsupp.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => AddZeroClass.toHasZero.{u3} (M i) (AddMonoid.toAddZeroClass.{u3} (M i) (AddCommMonoid.toAddMonoid.{u3} (M i) (_inst_7 i))))) _inst_1 (Dfinsupp.addCommMonoid.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) (Dfinsupp.module.{u2, u3, u1} ι R (fun (i : ι) => M i) _inst_1 (fun (i : ι) => _inst_7 i) (fun (i : ι) => _inst_8 i))
+but is expected to have type
+  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] {ι : Type.{u2}} (M : ι -> Type.{u3}) [_inst_7 : forall (i : ι), AddCommMonoid.{u3} (M i)] [_inst_8 : forall (i : ι), Module.{u1, u3} R (M i) _inst_1 (_inst_7 i)] [_inst_9 : forall (i : ι), Module.Free.{u1, u3} R (M i) _inst_1 (_inst_7 i) (_inst_8 i)], Module.Free.{u1, max u3 u2} R (Dfinsupp.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => AddMonoid.toZero.{u3} ((fun (i : ι) => M i) i) (AddCommMonoid.toAddMonoid.{u3} ((fun (i : ι) => M i) i) (_inst_7 i)))) _inst_1 (Dfinsupp.instAddCommMonoidDfinsuppToZeroToAddMonoid.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) (Dfinsupp.module.{u2, u3, u1} ι R (fun (i : ι) => M i) _inst_1 (fun (i : ι) => _inst_7 i) (fun (i : ι) => _inst_8 i))
+Case conversion may be inaccurate. Consider using '#align module.free.dfinsupp Module.Free.dfinsuppₓ'. -/
 instance dfinsupp {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (Π₀ i, M i) :=
   of_basis <| Dfinsupp.basis fun i => chooseBasis R (M i)
 #align module.free.dfinsupp Module.Free.dfinsupp
 
+/- warning: module.free.direct_sum -> Module.Free.directSum is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] {ι : Type.{u2}} (M : ι -> Type.{u3}) [_inst_7 : forall (i : ι), AddCommMonoid.{u3} (M i)] [_inst_8 : forall (i : ι), Module.{u1, u3} R (M i) _inst_1 (_inst_7 i)] [_inst_9 : forall (i : ι), Module.Free.{u1, u3} R (M i) _inst_1 (_inst_7 i) (_inst_8 i)], Module.Free.{u1, max u2 u3} R (DirectSum.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) _inst_1 (DirectSum.addCommMonoid.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) (DirectSum.module.{u1, u2, u3} R _inst_1 ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i) (fun (i : ι) => _inst_8 i))
+but is expected to have type
+  forall (R : Type.{u1}) [_inst_1 : Semiring.{u1} R] {ι : Type.{u2}} (M : ι -> Type.{u3}) [_inst_7 : forall (i : ι), AddCommMonoid.{u3} (M i)] [_inst_8 : forall (i : ι), Module.{u1, u3} R (M i) _inst_1 (_inst_7 i)] [_inst_9 : forall (i : ι), Module.Free.{u1, u3} R (M i) _inst_1 (_inst_7 i) (_inst_8 i)], Module.Free.{u1, max u3 u2} R (DirectSum.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) _inst_1 (instAddCommMonoidDirectSum.{u2, u3} ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i)) (DirectSum.instModuleDirectSumInstAddCommMonoidDirectSum.{u1, u2, u3} R _inst_1 ι (fun (i : ι) => M i) (fun (i : ι) => _inst_7 i) (fun (i : ι) => _inst_8 i))
+Case conversion may be inaccurate. Consider using '#align module.free.direct_sum Module.Free.directSumₓ'. -/
 instance directSum {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (⨁ i, M i) :=
   Module.Free.dfinsupp R M
@@ -194,6 +268,12 @@ variable [CommRing R] [AddCommGroup M] [Module R M] [Module.Free R M]
 
 variable [AddCommGroup N] [Module R N] [Module.Free R N]
 
+/- warning: module.free.tensor -> Module.Free.tensor is a dubious translation:
+lean 3 declaration is
+  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : CommRing.{u1} R] [_inst_2 : AddCommGroup.{u2} M] [_inst_3 : Module.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2)] [_inst_4 : Module.Free.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) _inst_3] [_inst_5 : AddCommGroup.{u3} N] [_inst_6 : Module.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5)] [_inst_7 : Module.Free.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_6], Module.Free.{u1, max u2 u3} R (TensorProduct.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (TensorProduct.addCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (TensorProduct.module.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6)
+but is expected to have type
+  forall (R : Type.{u1}) (M : Type.{u2}) (N : Type.{u3}) [_inst_1 : CommRing.{u1} R] [_inst_2 : AddCommGroup.{u2} M] [_inst_3 : Module.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2)] [_inst_4 : Module.Free.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) _inst_3] [_inst_5 : AddCommGroup.{u3} N] [_inst_6 : Module.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5)] [_inst_7 : Module.Free.{u1, u3} R N (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_6], Module.Free.{u1, max u3 u2} R (TensorProduct.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (TensorProduct.addCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6) (TensorProduct.instModuleTensorProductToSemiringAddCommMonoid.{u1, u2, u3} R (CommRing.toCommSemiring.{u1} R _inst_1) M N (AddCommGroup.toAddCommMonoid.{u2} M _inst_2) (AddCommGroup.toAddCommMonoid.{u3} N _inst_5) _inst_3 _inst_6)
+Case conversion may be inaccurate. Consider using '#align module.free.tensor Module.Free.tensorₓ'. -/
 instance tensor : Module.Free R (M ⊗[R] N) :=
   let ⟨bM⟩ := exists_basis R M
   let ⟨bN⟩ := exists_basis R N
@@ -206,9 +286,11 @@ section DivisionRing
 
 variable [DivisionRing R] [AddCommGroup M] [Module R M]
 
+#print Module.Free.of_divisionRing /-
 instance (priority := 100) of_divisionRing : Module.Free R M :=
   of_basis (Basis.ofVectorSpace R M)
 #align module.free.of_division_ring Module.Free.of_divisionRing
+-/
 
 end DivisionRing
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
 
 ! This file was ported from Lean 3 source module linear_algebra.free_module.basic
-! leanprover-community/mathlib commit 5fe298160aa02b0f3cf95690a1265232cdd9563c
+! leanprover-community/mathlib commit 4e7e7009099d4a88a750de710909b95487bf0124
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -12,6 +12,7 @@ import Mathbin.LinearAlgebra.DirectSum.Finsupp
 import Mathbin.Logic.Small.Basic
 import Mathbin.LinearAlgebra.StdBasis
 import Mathbin.LinearAlgebra.FinsuppVectorSpace
+import Mathbin.LinearAlgebra.TensorProductBasis
 
 /-!
 
@@ -194,8 +195,9 @@ variable [CommRing R] [AddCommGroup M] [Module R M] [Module.Free R M]
 variable [AddCommGroup N] [Module R N] [Module.Free R N]
 
 instance tensor : Module.Free R (M ⊗[R] N) :=
-  of_equiv' (of_equiv' (Free.finsupp _ R _) (finsuppTensorFinsupp' R _ _).symm)
-    (TensorProduct.congr (chooseBasis R M).repr (chooseBasis R N).repr).symm
+  let ⟨bM⟩ := exists_basis R M
+  let ⟨bN⟩ := exists_basis R N
+  of_basis (bM.2.TensorProduct bN.2)
 #align module.free.tensor Module.Free.tensor
 
 end CommRing
Diff
@@ -64,9 +64,9 @@ theorem Module.free_iff_set : Module.Free R M ↔ ∃ S : Set M, Nonempty (Basis
 
 variable {R M}
 
-theorem Module.Free.ofBasis {ι : Type w} (b : Basis ι R M) : Module.Free R M :=
+theorem Module.Free.of_basis {ι : Type w} (b : Basis ι R M) : Module.Free R M :=
   (Module.free_def R M).2 ⟨Set.range b, ⟨b.reindexRange⟩⟩
-#align module.free.of_basis Module.Free.ofBasis
+#align module.free.of_basis Module.Free.of_basis
 
 end Basic
 
@@ -118,26 +118,26 @@ instance [Nontrivial M] : Nonempty (Module.Free.ChooseBasisIndex R M) :=
 
 variable {R M N}
 
-theorem ofEquiv (e : M ≃ₗ[R] N) : Module.Free R N :=
-  ofBasis <| (chooseBasis R M).map e
-#align module.free.of_equiv Module.Free.ofEquiv
+theorem of_equiv (e : M ≃ₗ[R] N) : Module.Free R N :=
+  of_basis <| (chooseBasis R M).map e
+#align module.free.of_equiv Module.Free.of_equiv
 
 /-- A variation of `of_equiv`: the assumption `module.free R P` here is explicit rather than an
 instance. -/
-theorem ofEquiv' {P : Type v} [AddCommMonoid P] [Module R P] (h : Module.Free R P) (e : P ≃ₗ[R] N) :
-    Module.Free R N :=
-  ofEquiv e
-#align module.free.of_equiv' Module.Free.ofEquiv'
+theorem of_equiv' {P : Type v} [AddCommMonoid P] [Module R P] (h : Module.Free R P)
+    (e : P ≃ₗ[R] N) : Module.Free R N :=
+  of_equiv e
+#align module.free.of_equiv' Module.Free.of_equiv'
 
 variable (R M N)
 
 /-- The module structure provided by `semiring.to_module` is free. -/
 instance self : Module.Free R R :=
-  ofBasis (Basis.singleton Unit R)
+  of_basis (Basis.singleton Unit R)
 #align module.free.self Module.Free.self
 
 instance prod [Module.Free R N] : Module.Free R (M × N) :=
-  ofBasis <| (chooseBasis R M).Prod (chooseBasis R N)
+  of_basis <| (chooseBasis R M).Prod (chooseBasis R N)
 #align module.free.prod Module.Free.prod
 
 /-- The product of finitely many free modules is free. -/
@@ -161,23 +161,23 @@ instance function [Finite ι] : Module.Free R (ι → M) :=
 #align module.free.function Module.Free.function
 
 instance finsupp : Module.Free R (ι →₀ M) :=
-  ofBasis (Finsupp.basis fun i => chooseBasis R M)
+  of_basis (Finsupp.basis fun i => chooseBasis R M)
 #align module.free.finsupp Module.Free.finsupp
 
 variable {ι}
 
-instance (priority := 100) ofSubsingleton [Subsingleton N] : Module.Free R N :=
-  ofBasis (Basis.empty N : Basis PEmpty R N)
-#align module.free.of_subsingleton Module.Free.ofSubsingleton
+instance (priority := 100) of_subsingleton [Subsingleton N] : Module.Free R N :=
+  of_basis (Basis.empty N : Basis PEmpty R N)
+#align module.free.of_subsingleton Module.Free.of_subsingleton
 
-instance (priority := 100) ofSubsingleton' [Subsingleton R] : Module.Free R N :=
+instance (priority := 100) of_subsingleton' [Subsingleton R] : Module.Free R N :=
   letI := Module.subsingleton R N
-  Module.Free.ofSubsingleton R N
-#align module.free.of_subsingleton' Module.Free.ofSubsingleton'
+  Module.Free.of_subsingleton R N
+#align module.free.of_subsingleton' Module.Free.of_subsingleton'
 
 instance dfinsupp {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (Π₀ i, M i) :=
-  ofBasis <| Dfinsupp.basis fun i => chooseBasis R (M i)
+  of_basis <| Dfinsupp.basis fun i => chooseBasis R (M i)
 #align module.free.dfinsupp Module.Free.dfinsupp
 
 instance directSum {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
@@ -194,7 +194,7 @@ variable [CommRing R] [AddCommGroup M] [Module R M] [Module.Free R M]
 variable [AddCommGroup N] [Module R N] [Module.Free R N]
 
 instance tensor : Module.Free R (M ⊗[R] N) :=
-  ofEquiv' (ofEquiv' (Free.finsupp _ R _) (finsuppTensorFinsupp' R _ _).symm)
+  of_equiv' (of_equiv' (Free.finsupp _ R _) (finsuppTensorFinsupp' R _ _).symm)
     (TensorProduct.congr (chooseBasis R M).repr (chooseBasis R N).repr).symm
 #align module.free.tensor Module.Free.tensor
 
@@ -204,9 +204,9 @@ section DivisionRing
 
 variable [DivisionRing R] [AddCommGroup M] [Module R M]
 
-instance (priority := 100) ofDivisionRing : Module.Free R M :=
-  ofBasis (Basis.ofVectorSpace R M)
-#align module.free.of_division_ring Module.Free.ofDivisionRing
+instance (priority := 100) of_divisionRing : Module.Free R M :=
+  of_basis (Basis.ofVectorSpace R M)
+#align module.free.of_division_ring Module.Free.of_divisionRing
 
 end DivisionRing
 

Changes in mathlib4

mathlib3
mathlib4
doc: convert many comments into doc comments (#11940)

All of these changes appear to be oversights to me.

Diff
@@ -37,7 +37,7 @@ class Module.Free : Prop where
   exists_basis : Nonempty <| (I : Type v) × Basis I R M
 #align module.free Module.Free
 
-/- If `M` fits in universe `w`, then freeness is equivalent to existence of a basis in that
+/-- If `M` fits in universe `w`, then freeness is equivalent to existence of a basis in that
 universe.
 
 Note that if `M` does not fit in `w`, the reverse direction of this implication is still true as
style: replace '.-/' by '. -/' (#11938)

Purely automatic replacement. If this is in any way controversial; I'm happy to just close this PR.

Diff
@@ -32,7 +32,7 @@ section Basic
 
 variable [Semiring R] [AddCommMonoid M] [Module R M]
 
-/-- `Module.Free R M` is the statement that the `R`-module `M` is free.-/
+/-- `Module.Free R M` is the statement that the `R`-module `M` is free. -/
 class Module.Free : Prop where
   exists_basis : Nonempty <| (I : Type v) × Basis I R M
 #align module.free Module.Free
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -68,7 +68,6 @@ namespace Module.Free
 section Semiring
 
 variable [Semiring R] [AddCommMonoid M] [Module R M] [Module.Free R M]
-
 variable [AddCommMonoid N] [Module R N]
 
 /-- If `Module.Free R M` then `ChooseBasisIndex R M` is the `ι` which indexes the basis
Acl/reorg tensor product (#11282)

Move:

  • Mathlib/Algebra/Module/DirectLimitAndTensorProduct.lean to LinearAlgebra/TensorProduct/DirectLimit.lean
  • Mathlib/LinearAlgebra/TensorProduct to Mathlib/LinearAlgebra.TensorProduct.Basic.lean
  • Mathlib/RingTheory/TensorProduct to Mathlib/RingTheory/TensorProduct/Basic.lean.

This follows suggestions 1, 2, 3 of

https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Tensor.20Products.20of.20modules.20and.20rings/near/424605543

Co-authored-by: Antoine Chambert-Loir <antoine.chambert-loir@math.univ-paris-diderot.fr>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
 -/
 import Mathlib.Data.Finsupp.Fintype
-import Mathlib.LinearAlgebra.TensorProductBasis
+import Mathlib.LinearAlgebra.TensorProduct.Basis
 
 #align_import linear_algebra.free_module.basic from "leanprover-community/mathlib"@"4e7e7009099d4a88a750de710909b95487bf0124"
 
chore: generalize more DirectSum results to avoid negation (#10965)

Generalize Basis.tensorProduct and instance Module.Free.tensor to CommSemiring and AddCommMonoid, as a follow-up to #10828.

Plus style fixes:

  • tidy up LinearAlgebra.DirectSum.Finsupp.lean:
    • delete unused universe declaration
    • delete duplicate open TensorProduct
    • delete redundant noncomputable annotation and associated comment (due to noncomputable section in the same file)
    • use variable
  • delete "typeclass reminders" in "Module.Flat.iff_rTensor_injective'" (no longer needed)
  • whitespace fixes
  • simplify file structure (section/namespace/open/variable)

Co-authored-by: Richard Copley <rcopley@gmail.com>

Diff
@@ -9,7 +9,6 @@ import Mathlib.LinearAlgebra.TensorProductBasis
 #align_import linear_algebra.free_module.basic from "leanprover-community/mathlib"@"4e7e7009099d4a88a750de710909b95487bf0124"
 
 /-!
-
 # Free modules
 
 We introduce a class `Module.Free R M`, for `R` a `Semiring` and `M` an `R`-module and we provide
@@ -20,7 +19,6 @@ Use `Finsupp.total_id_surjective` to prove that any module is the quotient of a
 ## Main definition
 
 * `Module.Free R M` : the class of free `R`-modules.
-
 -/
 
 
@@ -191,11 +189,10 @@ instance directSum {ι : Type*} (M : ι → Type*) [∀ i : ι, AddCommMonoid (M
 
 end Semiring
 
-section CommRing
-
-variable [CommRing R] [AddCommGroup M] [Module R M] [Module.Free R M]
+section CommSemiring
 
-variable [AddCommGroup N] [Module R N] [Module.Free R N]
+variable [CommSemiring R] [AddCommMonoid M] [Module R M] [Module.Free R M]
+  [AddCommMonoid N] [Module R N] [Module.Free R N]
 
 instance tensor : Module.Free R (M ⊗[R] N) :=
   let ⟨bM⟩ := exists_basis (R := R) (M := M)
@@ -203,6 +200,6 @@ instance tensor : Module.Free R (M ⊗[R] N) :=
   of_basis (bM.2.tensorProduct bN.2)
 #align module.free.tensor Module.Free.tensor
 
-end CommRing
+end CommSemiring
 
 end Module.Free
chore: replace Infinite assumption by Nontrivial in Ideal.absNorm (#9684)

Also fix a typo and remove a now useless maxHeartbeats in Mathlib.NumberTheory.NumberField.Units.

Diff
@@ -3,10 +3,7 @@ Copyright (c) 2021 Riccardo Brasca. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
 -/
-import Mathlib.LinearAlgebra.DirectSum.Finsupp
-import Mathlib.Logic.Small.Basic
-import Mathlib.LinearAlgebra.StdBasis
-import Mathlib.LinearAlgebra.FinsuppVectorSpace
+import Mathlib.Data.Finsupp.Fintype
 import Mathlib.LinearAlgebra.TensorProductBasis
 
 #align_import linear_algebra.free_module.basic from "leanprover-community/mathlib"@"4e7e7009099d4a88a750de710909b95487bf0124"
@@ -118,6 +115,9 @@ instance (priority := 100) noZeroSMulDivisors [NoZeroDivisors R] : NoZeroSMulDiv
 instance [Nontrivial M] : Nonempty (Module.Free.ChooseBasisIndex R M) :=
   (Module.Free.chooseBasis R M).index_nonempty
 
+theorem infinite [Infinite R] [Nontrivial M] : Infinite M :=
+  (Equiv.infinite_iff (chooseBasis R M).repr.toEquiv).mpr Finsupp.infinite_of_right
+
 variable {R M N}
 
 theorem of_equiv (e : M ≃ₗ[R] N) : Module.Free R N :=
chore(*): golf, mostly dropping unused haves (#9292)
Diff
@@ -49,9 +49,6 @@ Note that if `M` does not fit in `w`, the reverse direction of this implication
 `Module.Free.of_basis`. -/
 theorem Module.free_def [Small.{w,v} M] :
     Module.Free R M ↔ ∃ I : Type w, Nonempty (Basis I R M) :=
-  -- Porting note: this is required or Lean cannot solve universe constraints
-  -- The same error presents if inferInstance is called to solve `small`
-  have _small (s : Set M) : Small.{w} ↑s := small_of_injective (fun _ _ => (Subtype.val_inj).mp)
   ⟨fun h =>
     ⟨Shrink (Set.range h.exists_basis.some.2),
       ⟨(Basis.reindexRange h.exists_basis.some.2).reindex (equivShrink _)⟩⟩,
chore: Module.{Free,Finite} instances for ULift (#7135)

These carry no data so should be harmless.

Diff
@@ -157,6 +157,8 @@ instance matrix {m n : Type*} [Finite m] [Finite n] : Module.Free R (Matrix m n
   Module.Free.pi R _
 #align module.free.matrix Module.Free.matrix
 
+instance ulift [Free R M] : Free R (ULift M) := of_equiv ULift.moduleEquiv.symm
+
 variable (ι)
 
 /-- The product of finitely many free modules is free (non-dependent version to help with typeclass
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
@@ -29,7 +29,7 @@ Use `Finsupp.total_id_surjective` to prove that any module is the quotient of a
 
 universe u v w z
 
-variable {ι : Type _} (R : Type u) (M : Type v) (N : Type z)
+variable {ι : Type*} (R : Type u) (M : Type v) (N : Type z)
 
 open TensorProduct DirectSum BigOperators
 
@@ -146,14 +146,14 @@ instance prod [Module.Free R N] : Module.Free R (M × N) :=
 #align module.free.prod Module.Free.prod
 
 /-- The product of finitely many free modules is free. -/
-instance pi (M : ι → Type _) [Finite ι] [∀ i : ι, AddCommMonoid (M i)] [∀ i : ι, Module R (M i)]
+instance pi (M : ι → Type*) [Finite ι] [∀ i : ι, AddCommMonoid (M i)] [∀ i : ι, Module R (M i)]
     [∀ i : ι, Module.Free R (M i)] : Module.Free R (∀ i, M i) :=
   let ⟨_⟩ := nonempty_fintype ι
   of_basis <| Pi.basis fun i => chooseBasis R (M i)
 #align module.free.pi Module.Free.pi
 
 /-- The module of finite matrices is free. -/
-instance matrix {m n : Type _} [Finite m] [Finite n] : Module.Free R (Matrix m n M) :=
+instance matrix {m n : Type*} [Finite m] [Finite n] : Module.Free R (Matrix m n M) :=
   Module.Free.pi R _
 #align module.free.matrix Module.Free.matrix
 
@@ -180,12 +180,12 @@ instance (priority := 100) of_subsingleton' [Subsingleton R] : Module.Free R N :
   Module.Free.of_subsingleton R N
 #align module.free.of_subsingleton' Module.Free.of_subsingleton'
 
-instance dfinsupp {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
+instance dfinsupp {ι : Type*} (M : ι → Type*) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (Π₀ i, M i) :=
   of_basis <| DFinsupp.basis fun i => chooseBasis R (M i)
 #align module.free.dfinsupp Module.Free.dfinsupp
 
-instance directSum {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
+instance directSum {ι : Type*} (M : ι → Type*) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (⨁ i, M i) :=
   Module.Free.dfinsupp R M
 #align module.free.direct_sum Module.Free.directSum
refactor(LinearAlgebra): Ensure ChooseBasisIndex is finite on trivial modules (#6322)

This also changes basisFintypeOfFiniteSpans to use Finite rather than Fintype, as it was noncomputable anyway. This means it has to be renamed to basis_finite_of_finite_spans as it now is a proof!

Co-authored-by: Oliver Nash <github@olivernash.org>

Diff
@@ -80,9 +80,9 @@ variable [Semiring R] [AddCommMonoid M] [Module R M] [Module.Free R M]
 variable [AddCommMonoid N] [Module R N]
 
 /-- If `Module.Free R M` then `ChooseBasisIndex R M` is the `ι` which indexes the basis
-  `ι → M`. -/
-def ChooseBasisIndex :=
-  (exists_basis (R := R) (M := M)).some.1
+  `ι → M`. Note that this is defined such that this type is finite if `R` is trivial. -/
+def ChooseBasisIndex : Type _ :=
+  ((Module.free_iff_set R M).mp ‹_›).choose
 #align module.free.choose_basis_index Module.Free.ChooseBasisIndex
 
 /-- There is no hope of computing this, but we add the instance anyway to avoid fumbling with
@@ -92,7 +92,7 @@ noncomputable instance : DecidableEq (ChooseBasisIndex R M) := Classical.decEq _
 /-- If `Module.Free R M` then `chooseBasis : ι → M` is the basis.
 Here `ι = ChooseBasisIndex R M`. -/
 noncomputable def chooseBasis : Basis (ChooseBasisIndex R M) R M :=
-  (exists_basis (R := R) (M := M)).some.2
+  ((Module.free_iff_set R M).mp ‹_›).choose_spec.some
 #align module.free.choose_basis Module.Free.chooseBasis
 
 /-- The isomorphism `M ≃ₗ[R] (ChooseBasisIndex R M →₀ R)`. -/
chore(LinearAlgebra): remove open Classical (#6320)

This uncovers a few situations where a lemma was stated with the wrong decidability assumption. The corrected lemmas are strictly more syntactically-general.

This is exhaustive in the LinearAlgebra folder.

Where removal is impractical, this switches to open Classical in to make the intent clear.

Diff
@@ -85,6 +85,10 @@ def ChooseBasisIndex :=
   (exists_basis (R := R) (M := M)).some.1
 #align module.free.choose_basis_index Module.Free.ChooseBasisIndex
 
+/-- There is no hope of computing this, but we add the instance anyway to avoid fumbling with
+`open scoped Classical`. -/
+noncomputable instance : DecidableEq (ChooseBasisIndex R M) := Classical.decEq _
+
 /-- If `Module.Free R M` then `chooseBasis : ι → M` is the basis.
 Here `ι = ChooseBasisIndex R M`. -/
 noncomputable def chooseBasis : Basis (ChooseBasisIndex R M) R M :=
chore(Mathlib/LinearAlgebra/Basis): Move results about vector spaces to a new file (#6321)

This breaks a dependency cycle with Module.Free, which means we can immediately show that all vector spaces are free modules.

The lemmas are moved without modification in this PR. A subsequent PR can use the Module.Free results to golf the vector space ones, and deduplicate the API.

Co-authored-by: Oliver Nash <github@olivernash.org>

Diff
@@ -202,14 +202,4 @@ instance tensor : Module.Free R (M ⊗[R] N) :=
 
 end CommRing
 
-section DivisionRing
-
-variable [DivisionRing R] [AddCommGroup M] [Module R M]
-
-instance (priority := 100) of_divisionRing : Module.Free R M :=
-  of_basis (Basis.ofVectorSpace R M)
-#align module.free.of_division_ring Module.Free.of_divisionRing
-
-end DivisionRing
-
 end Module.Free
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) 2021 Riccardo Brasca. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Riccardo Brasca
-
-! This file was ported from Lean 3 source module linear_algebra.free_module.basic
-! leanprover-community/mathlib commit 4e7e7009099d4a88a750de710909b95487bf0124
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.LinearAlgebra.DirectSum.Finsupp
 import Mathlib.Logic.Small.Basic
@@ -14,6 +9,8 @@ import Mathlib.LinearAlgebra.StdBasis
 import Mathlib.LinearAlgebra.FinsuppVectorSpace
 import Mathlib.LinearAlgebra.TensorProductBasis
 
+#align_import linear_algebra.free_module.basic from "leanprover-community/mathlib"@"4e7e7009099d4a88a750de710909b95487bf0124"
+
 /-!
 
 # Free modules
chore: rename Dfinsupp to DFinsupp (#5822)

See #4354

Diff
@@ -181,7 +181,7 @@ instance (priority := 100) of_subsingleton' [Subsingleton R] : Module.Free R N :
 
 instance dfinsupp {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
     [∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] : Module.Free R (Π₀ i, M i) :=
-  of_basis <| Dfinsupp.basis fun i => chooseBasis R (M i)
+  of_basis <| DFinsupp.basis fun i => chooseBasis R (M i)
 #align module.free.dfinsupp Module.Free.dfinsupp
 
 instance directSum {ι : Type _} (M : ι → Type _) [∀ i : ι, AddCommMonoid (M i)]
chore: fix many typos (#4967)

These are all doc fixes

Diff
@@ -53,7 +53,7 @@ Note that if `M` does not fit in `w`, the reverse direction of this implication
 theorem Module.free_def [Small.{w,v} M] :
     Module.Free R M ↔ ∃ I : Type w, Nonempty (Basis I R M) :=
   -- Porting note: this is required or Lean cannot solve universe constraints
-  -- The same error presents if interInstance is called to solve `small`
+  -- The same error presents if inferInstance is called to solve `small`
   have _small (s : Set M) : Small.{w} ↑s := small_of_injective (fun _ _ => (Subtype.val_inj).mp)
   ⟨fun h =>
     ⟨Shrink (Set.range h.exists_basis.some.2),
chore: fix many typos (#4535)

Run codespell Mathlib and keep some suggestions.

Diff
@@ -99,7 +99,7 @@ noncomputable def repr : M ≃ₗ[R] ChooseBasisIndex R M →₀ R :=
   (chooseBasis R M).repr
 #align module.free.repr Module.Free.repr
 
-/-- The universal property of free modules: giving a functon `(ChooseBasisIndex R M) → N`, for `N`
+/-- The universal property of free modules: giving a function `(ChooseBasisIndex R M) → N`, for `N`
 an `R`-module, is the same as giving an `R`-linear map `M →ₗ[R] N`.
 
 This definition is parameterized over an extra `Semiring S`,
chore: tidy various files (#3408)
Diff
@@ -49,7 +49,7 @@ class Module.Free : Prop where
 universe.
 
 Note that if `M` does not fit in `w`, the reverse direction of this implication is still true as
-`module.free.of_basis`. -/
+`Module.Free.of_basis`. -/
 theorem Module.free_def [Small.{w,v} M] :
     Module.Free R M ↔ ∃ I : Type w, Nonempty (Basis I R M) :=
   -- Porting note: this is required or Lean cannot solve universe constraints
@@ -82,30 +82,30 @@ variable [Semiring R] [AddCommMonoid M] [Module R M] [Module.Free R M]
 
 variable [AddCommMonoid N] [Module R N]
 
-/-- If `module.free R M` then `choose_basis_index R M` is the `ι` which indexes the basis
+/-- If `Module.Free R M` then `ChooseBasisIndex R M` is the `ι` which indexes the basis
   `ι → M`. -/
 def ChooseBasisIndex :=
   (exists_basis (R := R) (M := M)).some.1
 #align module.free.choose_basis_index Module.Free.ChooseBasisIndex
 
-/-- If `module.free R M` then `choose_basis : ι → M` is the basis.
-Here `ι = choose_basis_index R M`. -/
+/-- If `Module.Free R M` then `chooseBasis : ι → M` is the basis.
+Here `ι = ChooseBasisIndex R M`. -/
 noncomputable def chooseBasis : Basis (ChooseBasisIndex R M) R M :=
   (exists_basis (R := R) (M := M)).some.2
 #align module.free.choose_basis Module.Free.chooseBasis
 
-/-- The isomorphism `M ≃ₗ[R] (choose_basis_index R M →₀ R)`. -/
+/-- The isomorphism `M ≃ₗ[R] (ChooseBasisIndex R M →₀ R)`. -/
 noncomputable def repr : M ≃ₗ[R] ChooseBasisIndex R M →₀ R :=
   (chooseBasis R M).repr
 #align module.free.repr Module.Free.repr
 
-/-- The universal property of free modules: giving a functon `(choose_basis_index R M) → N`, for `N`
+/-- The universal property of free modules: giving a functon `(ChooseBasisIndex R M) → N`, for `N`
 an `R`-module, is the same as giving an `R`-linear map `M →ₗ[R] N`.
 
-This definition is parameterized over an extra `semiring S`,
-such that `smul_comm_class R S M'` holds.
+This definition is parameterized over an extra `Semiring S`,
+such that `SMulCommClass R S M'` holds.
 If `R` is commutative, you can set `S := R`; if `R` is not commutative,
-you can recover an `add_equiv` by setting `S := ℕ`.
+you can recover an `AddEquiv` by setting `S := ℕ`.
 See library note [bundled maps over different rings]. -/
 noncomputable def constr {S : Type z} [Semiring S] [Module S N] [SMulCommClass R S N] :
     (ChooseBasisIndex R M → N) ≃ₗ[S] M →ₗ[R] N :=
@@ -126,7 +126,7 @@ theorem of_equiv (e : M ≃ₗ[R] N) : Module.Free R N :=
   of_basis <| (chooseBasis R M).map e
 #align module.free.of_equiv Module.Free.of_equiv
 
-/-- A variation of `of_equiv`: the assumption `module.free R P` here is explicit rather than an
+/-- A variation of `of_equiv`: the assumption `Module.Free R P` here is explicit rather than an
 instance. -/
 theorem of_equiv' {P : Type v} [AddCommMonoid P] [Module R P] (_ : Module.Free R P)
     (e : P ≃ₗ[R] N) : Module.Free R N :=
@@ -135,7 +135,7 @@ theorem of_equiv' {P : Type v} [AddCommMonoid P] [Module R P] (_ : Module.Free R
 
 variable (R M N)
 
-/-- The module structure provided by `semiring.to_module` is free. -/
+/-- The module structure provided by `Semiring.toModule` is free. -/
 instance self : Module.Free R R :=
   of_basis (Basis.singleton Unit R)
 #align module.free.self Module.Free.self
@@ -216,4 +216,3 @@ instance (priority := 100) of_divisionRing : Module.Free R M :=
 end DivisionRing
 
 end Module.Free
-
feat: port LinearAlgebra.FreeModule.Basic (#3317)

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

Dependencies 8 + 443

444 files ported (98.2%)
182449 lines ported (98.3%)
Show graph

The unported dependencies are