linear_algebra.free_module.finite.basicMathlib.LinearAlgebra.FreeModule.Finite.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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,7 +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 LinearAlgebra.Dimension
+import LinearAlgebra.Dimension.Basic
 import LinearAlgebra.FreeModule.Basic
 import RingTheory.Finiteness
 
Diff
@@ -62,6 +62,8 @@ theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [
   by
   cases nonempty_fintype ι
   classical
+  refine' ⟨⟨finset.univ.image b, _⟩⟩
+  simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
 #align module.finite.of_basis Module.Finite.of_basis
 -/
 
Diff
@@ -62,8 +62,6 @@ theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [
   by
   cases nonempty_fintype ι
   classical
-  refine' ⟨⟨finset.univ.image b, _⟩⟩
-  simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
 #align module.finite.of_basis Module.Finite.of_basis
 -/
 
Diff
@@ -3,9 +3,9 @@ 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.Dimension
-import Mathbin.LinearAlgebra.FreeModule.Basic
-import Mathbin.RingTheory.Finiteness
+import LinearAlgebra.Dimension
+import LinearAlgebra.FreeModule.Basic
+import RingTheory.Finiteness
 
 #align_import linear_algebra.free_module.finite.basic from "leanprover-community/mathlib"@"25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e"
 
Diff
@@ -43,7 +43,7 @@ noncomputable instance [Nontrivial R] [Module.Finite R M] :
   by
   obtain ⟨h⟩ := id ‹Module.Finite R M›
   choose s hs using h
-  exact basisFintypeOfFiniteSpans (↑s) hs (choose_basis _ _)
+  exact basis_finite_of_finite_spans (↑s) hs (choose_basis _ _)
 
 end Ring
 
Diff
@@ -2,16 +2,13 @@
 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.finite.basic
-! leanprover-community/mathlib commit 25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.LinearAlgebra.Dimension
 import Mathbin.LinearAlgebra.FreeModule.Basic
 import Mathbin.RingTheory.Finiteness
 
+#align_import linear_algebra.free_module.finite.basic from "leanprover-community/mathlib"@"25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e"
+
 /-!
 # Finite and free modules
 
Diff
@@ -58,6 +58,7 @@ variable [AddCommGroup N] [Module R N] [Module.Free R N]
 
 variable {R}
 
+#print Module.Finite.of_basis /-
 /-- A free module with a basis indexed by a `fintype` is finite. -/
 theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [Module R M]
     [Finite ι] (b : Basis ι R M) : Module.Finite R M :=
@@ -67,6 +68,7 @@ theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [
   refine' ⟨⟨finset.univ.image b, _⟩⟩
   simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
 #align module.finite.of_basis Module.Finite.of_basis
+-/
 
 #print Module.Finite.matrix /-
 instance Module.Finite.matrix {ι₁ ι₂ : Type _} [Finite ι₁] [Finite ι₂] :
Diff
@@ -64,8 +64,8 @@ theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [
   by
   cases nonempty_fintype ι
   classical
-    refine' ⟨⟨finset.univ.image b, _⟩⟩
-    simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
+  refine' ⟨⟨finset.univ.image b, _⟩⟩
+  simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
 #align module.finite.of_basis Module.Finite.of_basis
 
 #print Module.Finite.matrix /-
Diff
@@ -58,12 +58,6 @@ variable [AddCommGroup N] [Module R N] [Module.Free R N]
 
 variable {R}
 
-/- warning: module.finite.of_basis -> Module.Finite.of_basis is a dubious translation:
-lean 3 declaration is
-  forall {R : Type.{u1}} {M : Type.{u2}} {ι : Type.{u3}} [_inst_8 : CommRing.{u1} R] [_inst_9 : AddCommGroup.{u2} M] [_inst_10 : Module.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9)] [_inst_11 : Finite.{succ u3} ι], (Basis.{u3, u1, u2} ι R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10) -> (Module.Finite.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10)
-but is expected to have type
-  forall {R : Type.{u3}} {M : Type.{u2}} {ι : Type.{u1}} [_inst_8 : CommRing.{u3} R] [_inst_9 : AddCommGroup.{u2} M] [_inst_10 : Module.{u3, u2} R M (CommSemiring.toSemiring.{u3} R (CommRing.toCommSemiring.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9)] [_inst_11 : Finite.{succ u1} ι], (Basis.{u1, u3, u2} ι R M (CommSemiring.toSemiring.{u3} R (CommRing.toCommSemiring.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10) -> (Module.Finite.{u3, u2} R M (CommSemiring.toSemiring.{u3} R (CommRing.toCommSemiring.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10)
-Case conversion may be inaccurate. Consider using '#align module.finite.of_basis Module.Finite.of_basisₓ'. -/
 /-- A free module with a basis indexed by a `fintype` is finite. -/
 theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [Module R M]
     [Finite ι] (b : Basis ι R M) : Module.Finite R M :=
Diff
@@ -78,8 +78,7 @@ theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [
 instance Module.Finite.matrix {ι₁ ι₂ : Type _} [Finite ι₁] [Finite ι₂] :
     Module.Finite R (Matrix ι₁ ι₂ R) :=
   by
-  cases nonempty_fintype ι₁
-  cases nonempty_fintype ι₂
+  cases nonempty_fintype ι₁; cases nonempty_fintype ι₂
   exact Module.Finite.of_basis (Pi.basis fun i => Pi.basisFun R _)
 #align module.finite.matrix Module.Finite.matrix
 -/
Diff
@@ -62,7 +62,7 @@ variable {R}
 lean 3 declaration is
   forall {R : Type.{u1}} {M : Type.{u2}} {ι : Type.{u3}} [_inst_8 : CommRing.{u1} R] [_inst_9 : AddCommGroup.{u2} M] [_inst_10 : Module.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9)] [_inst_11 : Finite.{succ u3} ι], (Basis.{u3, u1, u2} ι R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10) -> (Module.Finite.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10)
 but is expected to have type
-  forall {R : Type.{u3}} {M : Type.{u2}} {ι : Type.{u1}} [_inst_8 : CommRing.{u3} R] [_inst_9 : AddCommGroup.{u2} M] [_inst_10 : Module.{u3, u2} R M (Ring.toSemiring.{u3} R (CommRing.toRing.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9)] [_inst_11 : Finite.{succ u1} ι], (Basis.{u1, u3, u2} ι R M (Ring.toSemiring.{u3} R (CommRing.toRing.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10) -> (Module.Finite.{u3, u2} R M (Ring.toSemiring.{u3} R (CommRing.toRing.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10)
+  forall {R : Type.{u3}} {M : Type.{u2}} {ι : Type.{u1}} [_inst_8 : CommRing.{u3} R] [_inst_9 : AddCommGroup.{u2} M] [_inst_10 : Module.{u3, u2} R M (CommSemiring.toSemiring.{u3} R (CommRing.toCommSemiring.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9)] [_inst_11 : Finite.{succ u1} ι], (Basis.{u1, u3, u2} ι R M (CommSemiring.toSemiring.{u3} R (CommRing.toCommSemiring.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10) -> (Module.Finite.{u3, u2} R M (CommSemiring.toSemiring.{u3} R (CommRing.toCommSemiring.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10)
 Case conversion may be inaccurate. Consider using '#align module.finite.of_basis Module.Finite.of_basisₓ'. -/
 /-- A free module with a basis indexed by a `fintype` is finite. -/
 theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [Module 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.finite.basic
-! leanprover-community/mathlib commit 59628387770d82eb6f6dd7b7107308aa2509ec95
+! leanprover-community/mathlib commit 25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.RingTheory.Finiteness
 /-!
 # Finite and free modules
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We provide some instances for finite and free modules.
 
 ## Main results
Diff
@@ -55,6 +55,12 @@ variable [AddCommGroup N] [Module R N] [Module.Free R N]
 
 variable {R}
 
+/- warning: module.finite.of_basis -> Module.Finite.of_basis is a dubious translation:
+lean 3 declaration is
+  forall {R : Type.{u1}} {M : Type.{u2}} {ι : Type.{u3}} [_inst_8 : CommRing.{u1} R] [_inst_9 : AddCommGroup.{u2} M] [_inst_10 : Module.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9)] [_inst_11 : Finite.{succ u3} ι], (Basis.{u3, u1, u2} ι R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10) -> (Module.Finite.{u1, u2} R M (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10)
+but is expected to have type
+  forall {R : Type.{u3}} {M : Type.{u2}} {ι : Type.{u1}} [_inst_8 : CommRing.{u3} R] [_inst_9 : AddCommGroup.{u2} M] [_inst_10 : Module.{u3, u2} R M (Ring.toSemiring.{u3} R (CommRing.toRing.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9)] [_inst_11 : Finite.{succ u1} ι], (Basis.{u1, u3, u2} ι R M (Ring.toSemiring.{u3} R (CommRing.toRing.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10) -> (Module.Finite.{u3, u2} R M (Ring.toSemiring.{u3} R (CommRing.toRing.{u3} R _inst_8)) (AddCommGroup.toAddCommMonoid.{u2} M _inst_9) _inst_10)
+Case conversion may be inaccurate. Consider using '#align module.finite.of_basis Module.Finite.of_basisₓ'. -/
 /-- A free module with a basis indexed by a `fintype` is finite. -/
 theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [Module R M]
     [Finite ι] (b : Basis ι R M) : Module.Finite R M :=
@@ -65,6 +71,7 @@ theorem Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [
     simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
 #align module.finite.of_basis Module.Finite.of_basis
 
+#print Module.Finite.matrix /-
 instance Module.Finite.matrix {ι₁ ι₂ : Type _} [Finite ι₁] [Finite ι₂] :
     Module.Finite R (Matrix ι₁ ι₂ R) :=
   by
@@ -72,6 +79,7 @@ instance Module.Finite.matrix {ι₁ ι₂ : Type _} [Finite ι₁] [Finite ι
   cases nonempty_fintype ι₂
   exact Module.Finite.of_basis (Pi.basis fun i => Pi.basisFun R _)
 #align module.finite.matrix Module.Finite.matrix
+-/
 
 end CommRing
 
Diff
@@ -4,10 +4,11 @@ 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.finite.basic
-! leanprover-community/mathlib commit bf2a9e0156cc11bf44893ea1b4b2da8ae655c901
+! leanprover-community/mathlib commit 59628387770d82eb6f6dd7b7107308aa2509ec95
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
+import Mathbin.LinearAlgebra.Dimension
 import Mathbin.LinearAlgebra.FreeModule.Basic
 import Mathbin.RingTheory.Finiteness
 

Changes in mathlib4

mathlib3
mathlib4
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
@@ -46,9 +46,7 @@ end Ring
 section CommRing
 
 variable [CommRing R] [AddCommGroup M] [Module R M] [Module.Free R M]
-
 variable [AddCommGroup N] [Module R N] [Module.Free R N]
-
 variable {R}
 
 /-- A free module with a basis indexed by a `Fintype` is finite. -/
chore: Reorganize results about rank and finrank. (#9349)

The files Mathlib.LinearAlgebra.FreeModule.Rank, Mathlib.LinearAlgebra.FreeModule.Finite.Rank, Mathlib.LinearAlgebra.Dimension and Mathlib.LinearAlgebra.Finrank were reorganized into a folder Mathlib.LinearAlgebra.Dimension, containing the following files

  • Basic.lean: Contains the definition of Module.rank.
  • Finrank.lean: Contains the definition of FiniteDimensional.finrank.
  • StrongRankCondition.lean: Contains results about rank and finrank over rings satisfying strong rank condition
  • Free.lean: Contains results about rank and finrank of free modules
  • Finite.lean: Contains conditions or consequences for rank to be finite or zero
  • Constructions.lean: Contains the calculation of the rank of various constructions.
  • DivisionRing.lean: Contains results about rank and finrank of spaces over division rings.
  • LinearMap.lean: Contains results about LinearMap.rank

API changes: IsNoetherian.rank_lt_aleph0 and FiniteDimensional.rank_lt_aleph0 are replaced with rank_lt_aleph0. Module.Free.finite_basis was renamed to Module.Finite.finite_basis. FiniteDimensional.finrank_eq_rank was renamed to finrank_eq_rank. rank_eq_cardinal_basis and rank_eq_cardinal_basis' were removed in favour of Basis.mk_eq_mk and Basis.mk_eq_mk''.

Co-authored-by: Andrew Yang <36414270+erdOne@users.noreply.github.com>

Diff
@@ -3,9 +3,8 @@ 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.Dimension
-import Mathlib.LinearAlgebra.FreeModule.Basic
 import Mathlib.RingTheory.Finiteness
+import Mathlib.LinearAlgebra.FreeModule.Basic
 
 #align_import linear_algebra.free_module.finite.basic from "leanprover-community/mathlib"@"59628387770d82eb6f6dd7b7107308aa2509ec95"
 
@@ -31,13 +30,6 @@ section Ring
 
 variable [Ring R] [AddCommGroup M] [Module R M] [Module.Free R M]
 
-/-- If a free module is finite, then any arbitrary basis is finite. -/
-lemma finite_basis {R M} [Ring R] [Nontrivial R] [AddCommGroup M] [Module R M]
-    {ι} [Module.Finite R M] (b : Basis ι R M) :
-    _root_.Finite ι :=
-  let ⟨s, hs⟩ := ‹Module.Finite R M›
-  basis_finite_of_finite_spans (↑s) s.finite_toSet hs b
-
 /-- If a free module is finite, then the arbitrary basis is finite. -/
 noncomputable instance ChooseBasisIndex.fintype [Module.Finite R M] :
     Fintype (Module.Free.ChooseBasisIndex R M) := by
@@ -46,7 +38,7 @@ noncomputable instance ChooseBasisIndex.fintype [Module.Finite R M] :
   · have := Module.subsingleton R M
     rw [ChooseBasisIndex]
     infer_instance
-  · exact finite_basis (chooseBasis _ _)
+  · exact Module.Finite.finite_basis (chooseBasis _ _)
 #align module.free.choose_basis_index.fintype Module.Free.ChooseBasisIndex.fintype
 
 end Ring
chore: Generalize results on finrank to rings. (#8912)

A portion of results in Mathlib/LinearAlgebra/FiniteDimensional.lean were generalized to rings and moved to Mathlib/LinearAlgebra/FreeModule/Finite/Rank.lean. Most API lemmas for FiniteDimensional are kept but replaced with one lemma proofs. Definitions and niche lemmas are replaced by the generalized version completely.

Co-authored-by: erd1 <the.erd.one@gmail.com> Co-authored-by: Andrew Yang <the.erd.one@gmail.com>

Diff
@@ -31,6 +31,13 @@ section Ring
 
 variable [Ring R] [AddCommGroup M] [Module R M] [Module.Free R M]
 
+/-- If a free module is finite, then any arbitrary basis is finite. -/
+lemma finite_basis {R M} [Ring R] [Nontrivial R] [AddCommGroup M] [Module R M]
+    {ι} [Module.Finite R M] (b : Basis ι R M) :
+    _root_.Finite ι :=
+  let ⟨s, hs⟩ := ‹Module.Finite R M›
+  basis_finite_of_finite_spans (↑s) s.finite_toSet hs b
+
 /-- If a free module is finite, then the arbitrary basis is finite. -/
 noncomputable instance ChooseBasisIndex.fintype [Module.Finite R M] :
     Fintype (Module.Free.ChooseBasisIndex R M) := by
@@ -39,8 +46,7 @@ noncomputable instance ChooseBasisIndex.fintype [Module.Finite R M] :
   · have := Module.subsingleton R M
     rw [ChooseBasisIndex]
     infer_instance
-  · obtain ⟨s, hs⟩ := id ‹Module.Finite R M›
-    exact basis_finite_of_finite_spans (↑s) s.finite_toSet hs (chooseBasis _ _)
+  · exact finite_basis (chooseBasis _ _)
 #align module.free.choose_basis_index.fintype Module.Free.ChooseBasisIndex.fintype
 
 end Ring
@@ -54,7 +60,7 @@ variable [AddCommGroup N] [Module R N] [Module.Free R N]
 variable {R}
 
 /-- A free module with a basis indexed by a `Fintype` is finite. -/
-theorem _root_.Module.Finite.of_basis {R M ι : Type*} [CommRing R] [AddCommGroup M] [Module R M]
+theorem _root_.Module.Finite.of_basis {R M ι : Type*} [Semiring R] [AddCommMonoid M] [Module R M]
     [_root_.Finite ι] (b : Basis ι R M) : Module.Finite R M := by
   cases nonempty_fintype ι
   classical
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
@@ -54,7 +54,7 @@ variable [AddCommGroup N] [Module R N] [Module.Free R N]
 variable {R}
 
 /-- A free module with a basis indexed by a `Fintype` is finite. -/
-theorem _root_.Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGroup M] [Module R M]
+theorem _root_.Module.Finite.of_basis {R M ι : Type*} [CommRing R] [AddCommGroup M] [Module R M]
     [_root_.Finite ι] (b : Basis ι R M) : Module.Finite R M := by
   cases nonempty_fintype ι
   classical
@@ -62,7 +62,7 @@ theorem _root_.Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGro
     simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
 #align module.finite.of_basis Module.Finite.of_basis
 
-instance _root_.Module.Finite.matrix {ι₁ ι₂ : Type _} [_root_.Finite ι₁] [_root_.Finite ι₂] :
+instance _root_.Module.Finite.matrix {ι₁ ι₂ : Type*} [_root_.Finite ι₁] [_root_.Finite ι₂] :
     Module.Finite R (Matrix ι₁ ι₂ R) := by
   cases nonempty_fintype ι₁
   cases nonempty_fintype ι₂
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
@@ -31,12 +31,16 @@ section Ring
 
 variable [Ring R] [AddCommGroup M] [Module R M] [Module.Free R M]
 
-/-- If a free module is finite, then any basis is finite. -/
-noncomputable instance ChooseBasisIndex.fintype [Nontrivial R] [Module.Finite R M] :
+/-- If a free module is finite, then the arbitrary basis is finite. -/
+noncomputable instance ChooseBasisIndex.fintype [Module.Finite R M] :
     Fintype (Module.Free.ChooseBasisIndex R M) := by
-  obtain ⟨h⟩ := id ‹Module.Finite R M›
-  choose s hs using h
-  exact basisFintypeOfFiniteSpans (↑s) hs (chooseBasis _ _)
+  refine @Fintype.ofFinite _ ?_
+  cases subsingleton_or_nontrivial R
+  · have := Module.subsingleton R M
+    rw [ChooseBasisIndex]
+    infer_instance
+  · obtain ⟨s, hs⟩ := id ‹Module.Finite R M›
+    exact basis_finite_of_finite_spans (↑s) s.finite_toSet hs (chooseBasis _ _)
 #align module.free.choose_basis_index.fintype Module.Free.ChooseBasisIndex.fintype
 
 end Ring
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,16 +2,13 @@
 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.finite.basic
-! leanprover-community/mathlib commit 59628387770d82eb6f6dd7b7107308aa2509ec95
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.LinearAlgebra.Dimension
 import Mathlib.LinearAlgebra.FreeModule.Basic
 import Mathlib.RingTheory.Finiteness
 
+#align_import linear_algebra.free_module.finite.basic from "leanprover-community/mathlib"@"59628387770d82eb6f6dd7b7107308aa2509ec95"
+
 /-!
 # Finite and free modules
 
chore: reenable eta, bump to nightly 2023-05-16 (#3414)

Now that leanprover/lean4#2210 has been merged, this PR:

  • removes all the set_option synthInstance.etaExperiment true commands (and some etaExperiment% term elaborators)
  • removes many but not quite all set_option maxHeartbeats commands
  • makes various other changes required to cope with leanprover/lean4#2210.

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Matthew Ballard <matt@mrb.email>

Diff
@@ -61,7 +61,6 @@ theorem _root_.Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGro
     simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
 #align module.finite.of_basis Module.Finite.of_basis
 
-set_option synthInstance.etaExperiment true in
 instance _root_.Module.Finite.matrix {ι₁ ι₂ : Type _} [_root_.Finite ι₁] [_root_.Finite ι₂] :
     Module.Finite R (Matrix ι₁ ι₂ R) := by
   cases nonempty_fintype ι₁
chore: use etaExperiment rather than hacking with instances (#3668)

This is to fix timeouts in https://github.com/leanprover-community/mathlib4/pull/3552.

See discussion at https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/!4.233552.20.28LinearAlgebra.2EMatrix.2EToLin.29.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -61,6 +61,7 @@ theorem _root_.Module.Finite.of_basis {R M ι : Type _} [CommRing R] [AddCommGro
     simp only [Set.image_univ, Finset.coe_univ, Finset.coe_image, Basis.span_eq]
 #align module.finite.of_basis Module.Finite.of_basis
 
+set_option synthInstance.etaExperiment true in
 instance _root_.Module.Finite.matrix {ι₁ ι₂ : Type _} [_root_.Finite ι₁] [_root_.Finite ι₂] :
     Module.Finite R (Matrix ι₁ ι₂ R) := by
   cases nonempty_fintype ι₁
feat: port LinearAlgebra.FreeModule.Finite.Basic (#3364)

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Dependencies 8 + 509

510 files ported (98.5%)
212114 lines ported (98.6%)
Show graph

The unported dependencies are